@satorijs/adapter-lark 3.8.6 → 3.9.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/lib/bot.d.ts +1 -1
- package/lib/content.d.ts +433 -0
- package/lib/http.d.ts +1 -1
- package/lib/index.cjs +2787 -1714
- package/lib/index.cjs.map +6 -0
- package/lib/index.d.ts +4 -2
- package/lib/internal.d.ts +38 -0
- package/lib/message.d.ts +2 -0
- package/lib/types/acs.d.ts +177 -0
- package/lib/types/admin.d.ts +270 -0
- package/lib/types/aily.d.ts +221 -0
- package/lib/types/apaas.d.ts +499 -0
- package/lib/types/api.d.ts +1 -14
- package/lib/types/application.d.ts +406 -0
- package/lib/types/approval.d.ts +779 -0
- package/lib/types/attendance.d.ts +957 -0
- package/lib/types/auth.d.ts +86 -0
- package/lib/types/authen.d.ts +191 -0
- package/lib/types/baike.d.ts +239 -0
- package/lib/types/bitable.d.ts +691 -0
- package/lib/types/board.d.ts +19 -0
- package/lib/types/calendar.d.ts +653 -0
- package/lib/types/cardkit.d.ts +139 -0
- package/lib/types/compensation.d.ts +54 -0
- package/lib/types/contact.d.ts +1137 -0
- package/lib/types/corehr.d.ts +4383 -0
- package/lib/types/docs.d.ts +23 -0
- package/lib/types/document_ai.d.ts +257 -0
- package/lib/types/docx.d.ts +380 -0
- package/lib/types/drive.d.ts +1045 -0
- package/lib/types/ehr.d.ts +32 -0
- package/lib/types/event.d.ts +9 -18
- package/lib/types/guild.d.ts +59 -0
- package/lib/types/helpdesk.d.ts +738 -0
- package/lib/types/hire.d.ts +3150 -0
- package/lib/types/human_authentication.d.ts +27 -0
- package/lib/types/im.d.ts +1300 -0
- package/lib/types/index.d.ts +16432 -34
- package/lib/types/lingo.d.ts +254 -0
- package/lib/types/mail.d.ts +680 -0
- package/lib/types/mdm.d.ts +42 -0
- package/lib/types/message/asset.d.ts +40 -0
- package/lib/types/minutes.d.ts +31 -0
- package/lib/types/moments.d.ts +18 -0
- package/lib/types/okr.d.ts +205 -0
- package/lib/types/optical_char_recognition.d.ts +17 -0
- package/lib/types/passport.d.ts +45 -0
- package/lib/types/payroll.d.ts +50 -0
- package/lib/types/performance.d.ts +413 -0
- package/lib/types/personal_settings.d.ts +87 -0
- package/lib/types/report.d.ts +57 -0
- package/lib/types/search.d.ts +216 -0
- package/lib/types/security_and_compliance.d.ts +24 -0
- package/lib/types/sheets.d.ts +326 -0
- package/lib/types/speech_to_text.d.ts +39 -0
- package/lib/types/task.d.ts +1153 -0
- package/lib/types/tenant.d.ts +23 -0
- package/lib/types/translation.d.ts +37 -0
- package/lib/types/user.d.ts +78 -0
- package/lib/types/utils.d.ts +9 -0
- package/lib/types/vc.d.ts +948 -0
- package/lib/types/verification.d.ts +14 -0
- package/lib/types/wiki.d.ts +240 -0
- package/lib/types/workplace.d.ts +43 -0
- package/lib/utils.d.ts +143 -7
- package/package.json +6 -4
- package/src/bot.ts +19 -3
- package/src/{types/message/content.ts → content.ts} +1 -0
- package/src/http.ts +1 -3
- package/src/index.ts +4 -2
- package/src/internal.ts +144 -0
- package/src/message.ts +13 -11
- package/src/types/acs.ts +236 -0
- package/src/types/admin.ts +328 -0
- package/src/types/aily.ts +288 -0
- package/src/types/apaas.ts +646 -0
- package/src/types/application.ts +520 -0
- package/src/types/approval.ts +924 -0
- package/src/types/attendance.ts +1153 -0
- package/src/types/auth.ts +114 -0
- package/src/types/authen.ts +220 -0
- package/src/types/baike.ts +306 -0
- package/src/types/bitable.ts +879 -0
- package/src/types/board.ts +31 -0
- package/src/types/calendar.ts +817 -0
- package/src/types/cardkit.ts +182 -0
- package/src/types/compensation.ts +79 -0
- package/src/types/contact.ts +1411 -0
- package/src/types/corehr.ts +5288 -0
- package/src/types/docs.ts +33 -0
- package/src/types/document_ai.ts +352 -0
- package/src/types/docx.ts +471 -0
- package/src/types/drive.ts +1312 -0
- package/src/types/ehr.ts +43 -0
- package/src/types/event.ts +15 -21
- package/src/types/helpdesk.ts +916 -0
- package/src/types/hire.ts +3918 -0
- package/src/types/human_authentication.ts +38 -0
- package/src/types/im.ts +1605 -0
- package/src/types/index.ts +17754 -39
- package/src/types/lingo.ts +321 -0
- package/src/types/mail.ts +851 -0
- package/src/types/mdm.ts +57 -0
- package/src/types/minutes.ts +46 -0
- package/src/types/moments.ts +28 -0
- package/src/types/okr.ts +261 -0
- package/src/types/optical_char_recognition.ts +27 -0
- package/src/types/passport.ts +61 -0
- package/src/types/payroll.ts +69 -0
- package/src/types/performance.ts +524 -0
- package/src/types/personal_settings.ts +116 -0
- package/src/types/report.ts +77 -0
- package/src/types/search.ts +268 -0
- package/src/types/security_and_compliance.ts +33 -0
- package/src/types/sheets.ts +425 -0
- package/src/types/speech_to_text.ts +54 -0
- package/src/types/task.ts +1464 -0
- package/src/types/tenant.ts +36 -0
- package/src/types/translation.ts +52 -0
- package/src/types/vc.ts +1197 -0
- package/src/types/verification.ts +23 -0
- package/src/types/wiki.ts +313 -0
- package/src/types/workplace.ts +59 -0
- package/src/utils.ts +160 -8
- package/src/types/api.ts +0 -30848
- package/src/types/internal.ts +0 -84
- package/src/types/message/index.ts +0 -97
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Verification } from '.';
|
|
2
|
+
declare module '../internal' {
|
|
3
|
+
interface Internal {
|
|
4
|
+
/**
|
|
5
|
+
* 获取认证信息
|
|
6
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/verification-v1/verification/get
|
|
7
|
+
*/
|
|
8
|
+
getVerification(): Promise<GetVerificationResponse>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export interface GetVerificationResponse {
|
|
12
|
+
/** 认证信息 */
|
|
13
|
+
verification?: Verification;
|
|
14
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Member, Node, Setting, Space, TaskResult } from '.';
|
|
2
|
+
import { Pagination } from '../internal';
|
|
3
|
+
declare module '../internal' {
|
|
4
|
+
interface Internal {
|
|
5
|
+
/**
|
|
6
|
+
* 获取知识空间列表
|
|
7
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/list
|
|
8
|
+
*/
|
|
9
|
+
listWikiSpace(query?: ListWikiSpaceQuery): Paginated<Space>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取知识空间信息
|
|
12
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/get
|
|
13
|
+
*/
|
|
14
|
+
getWikiSpace(space_id: string, query?: GetWikiSpaceQuery): Promise<GetWikiSpaceResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* 创建知识空间
|
|
17
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/create
|
|
18
|
+
*/
|
|
19
|
+
createWikiSpace(body: CreateWikiSpaceRequest): Promise<CreateWikiSpaceResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* 获取知识空间成员列表
|
|
22
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-member/list
|
|
23
|
+
*/
|
|
24
|
+
listWikiSpaceMember(space_id: string, query?: Pagination): Paginated<Member, 'members'>;
|
|
25
|
+
/**
|
|
26
|
+
* 添加知识空间成员
|
|
27
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-member/create
|
|
28
|
+
*/
|
|
29
|
+
createWikiSpaceMember(space_id: string, body: CreateWikiSpaceMemberRequest, query?: CreateWikiSpaceMemberQuery): Promise<CreateWikiSpaceMemberResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* 删除知识空间成员
|
|
32
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-member/delete
|
|
33
|
+
*/
|
|
34
|
+
deleteWikiSpaceMember(space_id: string, member_id: string, body: DeleteWikiSpaceMemberRequest): Promise<DeleteWikiSpaceMemberResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* 更新知识空间设置
|
|
37
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-setting/update
|
|
38
|
+
*/
|
|
39
|
+
updateWikiSpaceSetting(space_id: string, body: UpdateWikiSpaceSettingRequest): Promise<UpdateWikiSpaceSettingResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* 创建知识空间节点
|
|
42
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/create
|
|
43
|
+
*/
|
|
44
|
+
createWikiSpaceNode(space_id: string, body: CreateWikiSpaceNodeRequest): Promise<CreateWikiSpaceNodeResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* 获取知识空间节点信息
|
|
47
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/get_node
|
|
48
|
+
*/
|
|
49
|
+
getNodeWikiSpace(query?: GetNodeWikiSpaceQuery): Promise<GetNodeWikiSpaceResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* 获取知识空间子节点列表
|
|
52
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/list
|
|
53
|
+
*/
|
|
54
|
+
listWikiSpaceNode(space_id: string, query?: ListWikiSpaceNodeQuery): Paginated<Node>;
|
|
55
|
+
/**
|
|
56
|
+
* 移动知识空间节点
|
|
57
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/move
|
|
58
|
+
*/
|
|
59
|
+
moveWikiSpaceNode(space_id: string, node_token: string, body: MoveWikiSpaceNodeRequest): Promise<MoveWikiSpaceNodeResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* 更新知识空间节点标题
|
|
62
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/update_title
|
|
63
|
+
*/
|
|
64
|
+
updateTitleWikiSpaceNode(space_id: string, node_token: string, body: UpdateTitleWikiSpaceNodeRequest): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* 创建知识空间节点副本
|
|
67
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/copy
|
|
68
|
+
*/
|
|
69
|
+
copyWikiSpaceNode(space_id: string, node_token: string, body: CopyWikiSpaceNodeRequest): Promise<CopyWikiSpaceNodeResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* 移动云空间文档至知识空间
|
|
72
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/move_docs_to_wiki
|
|
73
|
+
*/
|
|
74
|
+
moveDocsToWikiWikiSpaceNode(space_id: string, body: MoveDocsToWikiWikiSpaceNodeRequest): Promise<MoveDocsToWikiWikiSpaceNodeResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* 获取任务结果
|
|
77
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/task/get
|
|
78
|
+
*/
|
|
79
|
+
getWikiTask(task_id: string, query?: GetWikiTaskQuery): Promise<GetWikiTaskResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* 搜索 Wiki
|
|
82
|
+
* @see https://open.feishu.cn/document/ukTMukTMukTM/uEzN0YjLxcDN24SM3QjN/search_wiki
|
|
83
|
+
*/
|
|
84
|
+
searchWikiNode(body: SearchWikiNodeRequest, query?: Pagination): Paginated<Node>;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export interface ListWikiSpaceQuery extends Pagination {
|
|
88
|
+
/** 当查询个人文档库时,指定返回的文档库名称展示语言。可选值有:zh, id, de, en, es, fr, it, pt, vi, ru, hi, th, ko, ja, zh-HK, zh-TW。 */
|
|
89
|
+
lang?: 'zh' | 'id' | 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt' | 'vi' | 'ru' | 'hi' | 'th' | 'ko' | 'ja' | 'zh-HK' | 'zh-TW';
|
|
90
|
+
}
|
|
91
|
+
export interface GetWikiSpaceQuery {
|
|
92
|
+
/** 当查询个人文档库时,指定返回的文档库名称展示语言。可选值有:zh, id, de, en, es, fr, it, pt, vi, ru, hi, th, ko, ja, zh-HK, zh-TW。 */
|
|
93
|
+
lang?: 'zh' | 'id' | 'de' | 'en' | 'es' | 'fr' | 'it' | 'pt' | 'vi' | 'ru' | 'hi' | 'th' | 'ko' | 'ja' | 'zh-HK' | 'zh-TW';
|
|
94
|
+
}
|
|
95
|
+
export interface CreateWikiSpaceRequest {
|
|
96
|
+
/** 知识空间名称 */
|
|
97
|
+
name?: string;
|
|
98
|
+
/** 知识空间描述 */
|
|
99
|
+
description?: string;
|
|
100
|
+
/** 表示知识空间的分享状态 */
|
|
101
|
+
open_sharing?: 'open' | 'closed';
|
|
102
|
+
}
|
|
103
|
+
export interface CreateWikiSpaceMemberRequest {
|
|
104
|
+
/** 知识库协作者 ID 类型 */
|
|
105
|
+
member_type: string;
|
|
106
|
+
/** 知识库协作者 ID */
|
|
107
|
+
member_id: string;
|
|
108
|
+
/** 知识库协作者角色 */
|
|
109
|
+
member_role: string;
|
|
110
|
+
}
|
|
111
|
+
export interface CreateWikiSpaceMemberQuery {
|
|
112
|
+
/** 添加权限后是否通知对方 */
|
|
113
|
+
need_notification?: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface DeleteWikiSpaceMemberRequest {
|
|
116
|
+
/** 知识库协作者 ID 类型 */
|
|
117
|
+
member_type: string;
|
|
118
|
+
/** 知识库协作者角色 */
|
|
119
|
+
member_role: string;
|
|
120
|
+
/** 知识库协作者类型 */
|
|
121
|
+
type?: 'user' | 'chat' | 'department';
|
|
122
|
+
}
|
|
123
|
+
export interface UpdateWikiSpaceSettingRequest {
|
|
124
|
+
/** 谁可以创建空间的一级页面: "admin_and_member" = 管理员和成员 "admin" - 仅管理员 */
|
|
125
|
+
create_setting?: string;
|
|
126
|
+
/** 可阅读用户可否创建副本/打印/导出/复制: "allow" - 允许 "not_allow" - 不允许 */
|
|
127
|
+
security_setting?: string;
|
|
128
|
+
/** 可阅读用户可否评论: "allow" - 允许 "not_allow" - 不允许 */
|
|
129
|
+
comment_setting?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface CreateWikiSpaceNodeRequest {
|
|
132
|
+
/** 文档类型,对于快捷方式,该字段是对应的实体的obj_type。 */
|
|
133
|
+
obj_type: 'doc' | 'sheet' | 'mindnote' | 'bitable' | 'file' | 'docx' | 'slides';
|
|
134
|
+
/** 父节点 token。若当前节点为一级节点,父节点 token 为空。 */
|
|
135
|
+
parent_node_token?: string;
|
|
136
|
+
/** 节点类型 */
|
|
137
|
+
node_type: 'origin' | 'shortcut';
|
|
138
|
+
/** 快捷方式对应的实体node_token,当节点为快捷方式时,该值不为空。 */
|
|
139
|
+
origin_node_token?: string;
|
|
140
|
+
/** 文档标题 */
|
|
141
|
+
title?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface GetNodeWikiSpaceQuery {
|
|
144
|
+
/** 文档的wiki token */
|
|
145
|
+
token: string;
|
|
146
|
+
/** 文档类型 */
|
|
147
|
+
obj_type?: 'doc' | 'docx' | 'sheet' | 'mindnote' | 'bitable' | 'file' | 'slides' | 'wiki';
|
|
148
|
+
}
|
|
149
|
+
export interface ListWikiSpaceNodeQuery extends Pagination {
|
|
150
|
+
/** 父节点token */
|
|
151
|
+
parent_node_token?: string;
|
|
152
|
+
}
|
|
153
|
+
export interface MoveWikiSpaceNodeRequest {
|
|
154
|
+
/** 移动到的父节点token */
|
|
155
|
+
target_parent_token?: string;
|
|
156
|
+
/** 移动到的知识空间ID */
|
|
157
|
+
target_space_id?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface UpdateTitleWikiSpaceNodeRequest {
|
|
160
|
+
/** 节点新标题 */
|
|
161
|
+
title: string;
|
|
162
|
+
}
|
|
163
|
+
export interface CopyWikiSpaceNodeRequest {
|
|
164
|
+
/** 目标父节点token */
|
|
165
|
+
target_parent_token?: string;
|
|
166
|
+
/** 目标知识空间id */
|
|
167
|
+
target_space_id?: string;
|
|
168
|
+
/** 复制后的新标题。如果填空,则新标题为空。如果不填,则使用原节点标题。 */
|
|
169
|
+
title?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface MoveDocsToWikiWikiSpaceNodeRequest {
|
|
172
|
+
/** 节点的父亲token */
|
|
173
|
+
parent_wiki_token?: string;
|
|
174
|
+
/** 文档类型 */
|
|
175
|
+
obj_type: 'doc' | 'sheet' | 'bitable' | 'mindnote' | 'docx' | 'file' | 'slides';
|
|
176
|
+
/** 文档token */
|
|
177
|
+
obj_token: string;
|
|
178
|
+
/** 没有权限时,是否申请迁入文档 */
|
|
179
|
+
apply?: boolean;
|
|
180
|
+
}
|
|
181
|
+
export interface GetWikiTaskQuery {
|
|
182
|
+
/** 任务类型 */
|
|
183
|
+
task_type: 'move';
|
|
184
|
+
}
|
|
185
|
+
export interface SearchWikiNodeRequest {
|
|
186
|
+
/** 搜索关键词 */
|
|
187
|
+
query: string;
|
|
188
|
+
/** 文档所属的知识空间ID,为空搜索所有 wiki */
|
|
189
|
+
space_id?: string;
|
|
190
|
+
/** wiki token,不为空搜索该节点及其所有子节点,为空搜索所有 wiki(根据 space_id 选择 space) */
|
|
191
|
+
node_id?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface GetWikiSpaceResponse {
|
|
194
|
+
/** 知识空间 */
|
|
195
|
+
space?: Space;
|
|
196
|
+
}
|
|
197
|
+
export interface CreateWikiSpaceResponse {
|
|
198
|
+
/** 知识空间信息 */
|
|
199
|
+
space?: Space;
|
|
200
|
+
}
|
|
201
|
+
export interface CreateWikiSpaceMemberResponse {
|
|
202
|
+
/** 知识库协作者 */
|
|
203
|
+
member?: Member;
|
|
204
|
+
}
|
|
205
|
+
export interface DeleteWikiSpaceMemberResponse {
|
|
206
|
+
/** 成员信息 */
|
|
207
|
+
member: Member;
|
|
208
|
+
}
|
|
209
|
+
export interface UpdateWikiSpaceSettingResponse {
|
|
210
|
+
/** 空间设置 */
|
|
211
|
+
setting?: Setting;
|
|
212
|
+
}
|
|
213
|
+
export interface CreateWikiSpaceNodeResponse {
|
|
214
|
+
/** 节点 */
|
|
215
|
+
node?: Node;
|
|
216
|
+
}
|
|
217
|
+
export interface GetNodeWikiSpaceResponse {
|
|
218
|
+
/** 节点信息 */
|
|
219
|
+
node?: Node;
|
|
220
|
+
}
|
|
221
|
+
export interface MoveWikiSpaceNodeResponse {
|
|
222
|
+
/** 移动后的节点信息 */
|
|
223
|
+
node?: Node;
|
|
224
|
+
}
|
|
225
|
+
export interface CopyWikiSpaceNodeResponse {
|
|
226
|
+
/** copy后的节点 */
|
|
227
|
+
node: Node;
|
|
228
|
+
}
|
|
229
|
+
export interface MoveDocsToWikiWikiSpaceNodeResponse {
|
|
230
|
+
/** 移动后的知识库token */
|
|
231
|
+
wiki_token?: string;
|
|
232
|
+
/** 任务id */
|
|
233
|
+
task_id?: string;
|
|
234
|
+
/** 是否提交了文档迁入申请 */
|
|
235
|
+
applied?: boolean;
|
|
236
|
+
}
|
|
237
|
+
export interface GetWikiTaskResponse {
|
|
238
|
+
/** 任务结果 */
|
|
239
|
+
task: TaskResult;
|
|
240
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BlockAccessData, CustomWorkplaceAccessData, WorkplaceAccessData } from '.';
|
|
2
|
+
import { Pagination } from '../internal';
|
|
3
|
+
declare module '../internal' {
|
|
4
|
+
interface Internal {
|
|
5
|
+
/**
|
|
6
|
+
* 获取工作台访问数据
|
|
7
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_access_data/search
|
|
8
|
+
*/
|
|
9
|
+
searchWorkplaceWorkplaceAccessData(query?: SearchWorkplaceWorkplaceAccessDataQuery): Paginated<WorkplaceAccessData>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取定制工作台访问数据
|
|
12
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/custom_workplace_access_data/search
|
|
13
|
+
*/
|
|
14
|
+
searchWorkplaceCustomWorkplaceAccessData(query?: SearchWorkplaceCustomWorkplaceAccessDataQuery): Paginated<CustomWorkplaceAccessData>;
|
|
15
|
+
/**
|
|
16
|
+
* 获取定制工作台小组件访问数据
|
|
17
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_block_access_data/search
|
|
18
|
+
*/
|
|
19
|
+
searchWorkplaceWorkplaceBlockAccessData(query?: SearchWorkplaceWorkplaceBlockAccessDataQuery): Paginated<BlockAccessData>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export interface SearchWorkplaceWorkplaceAccessDataQuery extends Pagination {
|
|
23
|
+
/** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
|
|
24
|
+
from_date: string;
|
|
25
|
+
/** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
|
|
26
|
+
to_date: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SearchWorkplaceCustomWorkplaceAccessDataQuery extends Pagination {
|
|
29
|
+
/** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
|
|
30
|
+
from_date: string;
|
|
31
|
+
/** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
|
|
32
|
+
to_date: string;
|
|
33
|
+
/** 定制化工作台id.非必填,不填的时候,返回所有定制化工作台数据。 */
|
|
34
|
+
custom_workplace_id?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SearchWorkplaceWorkplaceBlockAccessDataQuery extends Pagination {
|
|
37
|
+
/** 数据检索开始时间,精确到日。格式yyyy-MM-dd。 */
|
|
38
|
+
from_date: string;
|
|
39
|
+
/** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
|
|
40
|
+
to_date: string;
|
|
41
|
+
/** 小组件id */
|
|
42
|
+
block_id?: string;
|
|
43
|
+
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,26 +1,162 @@
|
|
|
1
1
|
import { Context, Session, Universal } from '@satorijs/core';
|
|
2
2
|
import { LarkBot } from './bot';
|
|
3
|
-
import {
|
|
3
|
+
import { GetImChatResponse, ListChat, Message, User } from './types';
|
|
4
|
+
import { MessageContent } from './content';
|
|
5
|
+
export interface EventHeader<K extends keyof Events> {
|
|
6
|
+
event_id: string;
|
|
7
|
+
event_type: K;
|
|
8
|
+
create_time: string;
|
|
9
|
+
token: string;
|
|
10
|
+
app_id: string;
|
|
11
|
+
tenant_key: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Events {
|
|
14
|
+
/**
|
|
15
|
+
* Receive message event.
|
|
16
|
+
* @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/receive
|
|
17
|
+
*/
|
|
18
|
+
'im.message.receive_v1': {
|
|
19
|
+
sender: {
|
|
20
|
+
sender_id: UserIds;
|
|
21
|
+
sender_type?: string;
|
|
22
|
+
tenant_key: string;
|
|
23
|
+
};
|
|
24
|
+
message: {
|
|
25
|
+
message_id: string;
|
|
26
|
+
root_id: string;
|
|
27
|
+
parent_id: string;
|
|
28
|
+
thread_id: string;
|
|
29
|
+
create_time: string;
|
|
30
|
+
chat_id: string;
|
|
31
|
+
chat_type: string;
|
|
32
|
+
message_type: keyof MessageContent;
|
|
33
|
+
content: string;
|
|
34
|
+
mentions: {
|
|
35
|
+
key: string;
|
|
36
|
+
id: UserIds;
|
|
37
|
+
name: string;
|
|
38
|
+
tenant_key: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Message read event.
|
|
44
|
+
* @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/events/message_read
|
|
45
|
+
*/
|
|
46
|
+
'im.message.message_read_v1': {
|
|
47
|
+
reader: {
|
|
48
|
+
reader_id: UserIds;
|
|
49
|
+
read_time: string;
|
|
50
|
+
tenant_key: string;
|
|
51
|
+
};
|
|
52
|
+
message_id_list: string[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Message card callback event.
|
|
56
|
+
* @see https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/feishu-cards/card-callback-communication
|
|
57
|
+
*/
|
|
58
|
+
'card.action.trigger': {
|
|
59
|
+
operator: {
|
|
60
|
+
tenant_key: string;
|
|
61
|
+
user_id: string;
|
|
62
|
+
union_id: string;
|
|
63
|
+
open_id: string;
|
|
64
|
+
};
|
|
65
|
+
token: string;
|
|
66
|
+
action: {
|
|
67
|
+
value: any;
|
|
68
|
+
tag: string;
|
|
69
|
+
timezone?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
form_value?: any;
|
|
72
|
+
input_value?: string;
|
|
73
|
+
option?: string;
|
|
74
|
+
options?: string[];
|
|
75
|
+
checked?: boolean;
|
|
76
|
+
};
|
|
77
|
+
host: string;
|
|
78
|
+
/** 卡片分发类型,固定取值为 url_preview,表示链接预览卡片。仅链接预览卡片有此字段。 */
|
|
79
|
+
delivery_type?: 'url_preview';
|
|
80
|
+
context: {
|
|
81
|
+
url?: string;
|
|
82
|
+
preview_token?: string;
|
|
83
|
+
open_message_id: string;
|
|
84
|
+
open_chat_id: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* 机器人自定义菜单事件
|
|
89
|
+
* @see https://open.feishu.cn/document/client-docs/bot-v3/events/menu
|
|
90
|
+
*/
|
|
91
|
+
'application.bot.menu_v6': {
|
|
92
|
+
operator: {
|
|
93
|
+
operator_name: string;
|
|
94
|
+
operator_id: {
|
|
95
|
+
union_id: string;
|
|
96
|
+
user_id: string;
|
|
97
|
+
open_id: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
event_key: string;
|
|
101
|
+
timestamp: number;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export type EventPayload = {
|
|
105
|
+
[K in keyof Events]: {
|
|
106
|
+
schema: '2.0';
|
|
107
|
+
type: K;
|
|
108
|
+
header: EventHeader<K>;
|
|
109
|
+
event: Events[K];
|
|
110
|
+
};
|
|
111
|
+
}[keyof Events];
|
|
112
|
+
/**
|
|
113
|
+
* A user in Lark has several different IDs.
|
|
114
|
+
* @see https://open.larksuite.com/document/home/user-identity-introduction/introduction
|
|
115
|
+
*/
|
|
116
|
+
export interface UserIds {
|
|
117
|
+
union_id: string;
|
|
118
|
+
/** *user_id* only available when the app has permissions granted by the administrator */
|
|
119
|
+
user_id?: string;
|
|
120
|
+
open_id: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Identify a user in Lark.
|
|
124
|
+
* This behaves like {@link UserIds}, but it only contains *open_id*.
|
|
125
|
+
* (i.e. the id_type is always `open_id`)
|
|
126
|
+
*/
|
|
127
|
+
export interface UserIdentifiers {
|
|
128
|
+
id: string;
|
|
129
|
+
id_type: string;
|
|
130
|
+
}
|
|
131
|
+
export type UserIdType = 'union_id' | 'user_id' | 'open_id';
|
|
132
|
+
/**
|
|
133
|
+
* The id type when specify a receiver, would be used in the request query.
|
|
134
|
+
*
|
|
135
|
+
* NOTE: we always use **open_id** to identify a user, use **chat_id** to identify a channel.
|
|
136
|
+
* @see https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create
|
|
137
|
+
*/
|
|
138
|
+
export type ReceiveIdType = UserIdType | 'email' | 'chat_id';
|
|
139
|
+
export type DepartmentIdType = 'department_id' | 'open_department_id';
|
|
4
140
|
export type Sender = {
|
|
5
|
-
sender_id:
|
|
141
|
+
sender_id: UserIds;
|
|
6
142
|
sender_type?: string;
|
|
7
143
|
tenant_key: string;
|
|
8
|
-
} | (
|
|
144
|
+
} | (UserIdentifiers & {
|
|
9
145
|
sender_type?: string;
|
|
10
146
|
tenant_key: string;
|
|
11
147
|
});
|
|
12
148
|
export declare function adaptSender(sender: Sender, session: Session): Session;
|
|
13
149
|
export declare function adaptMessage(bot: LarkBot, data: Events['im.message.receive_v1'], session: Session, details?: boolean): Promise<Session>;
|
|
14
150
|
export declare function adaptSession<C extends Context>(bot: LarkBot<C>, body: EventPayload): Promise<C[typeof import("cordis").Context.session]>;
|
|
15
|
-
export declare function decodeMessage(bot: LarkBot, body:
|
|
151
|
+
export declare function decodeMessage(bot: LarkBot, body: Message, details?: boolean): Promise<Universal.Message>;
|
|
16
152
|
/**
|
|
17
153
|
* Get ID type from id string
|
|
18
154
|
* @see https://open.larksuite.com/document/home/user-identity-introduction/introduction
|
|
19
155
|
*/
|
|
20
|
-
export declare function extractIdType(id: string):
|
|
156
|
+
export declare function extractIdType(id: string): ReceiveIdType;
|
|
21
157
|
export declare function decodeChannel(channelId: string, guild: GetImChatResponse): Universal.Channel;
|
|
22
|
-
export declare function decodeGuild(guild:
|
|
23
|
-
export declare function decodeUser(user:
|
|
158
|
+
export declare function decodeGuild(guild: ListChat): Universal.Guild;
|
|
159
|
+
export declare function decodeUser(user: User): Universal.User;
|
|
24
160
|
export declare class Cipher {
|
|
25
161
|
encryptKey: string;
|
|
26
162
|
key: Buffer;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@satorijs/adapter-lark",
|
|
3
3
|
"description": "Lark (飞书) Adapter for Satorijs",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.9.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -35,10 +35,12 @@
|
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@cordisjs/plugin-server": "^0.2.5",
|
|
38
|
-
"@satorijs/core": "^4.
|
|
39
|
-
"cordis": "^3.18.1"
|
|
38
|
+
"@satorijs/core": "^4.5.0",
|
|
39
|
+
"cordis": "^3.18.1",
|
|
40
|
+
"cosmokit": "^1.6.3",
|
|
41
|
+
"dedent": "^1.5.3"
|
|
40
42
|
},
|
|
41
43
|
"peerDependencies": {
|
|
42
|
-
"@satorijs/core": "^4.
|
|
44
|
+
"@satorijs/core": "^4.5.0"
|
|
43
45
|
}
|
|
44
46
|
}
|
package/src/bot.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { Bot, Context, h, HTTP, Schema, Time, Universal } from '@satorijs/core'
|
|
2
|
-
|
|
2
|
+
import { CreateImFileForm } from './types'
|
|
3
3
|
import { HttpServer } from './http'
|
|
4
4
|
import { LarkMessageEncoder } from './message'
|
|
5
|
-
import { Internal } from './
|
|
5
|
+
import { Internal } from './internal'
|
|
6
6
|
import * as Utils from './utils'
|
|
7
7
|
|
|
8
|
+
const fileTypeMap: Record<Exclude<CreateImFileForm['file_type'], 'stream'>, string[]> = {
|
|
9
|
+
opus: ['audio/opus'],
|
|
10
|
+
mp4: ['video/mp4'],
|
|
11
|
+
pdf: ['application/pdf'],
|
|
12
|
+
doc: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
13
|
+
xls: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
14
|
+
ppt: ['application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
export class LarkBot<C extends Context = Context> extends Bot<C, LarkBot.Config> {
|
|
9
18
|
static inject = ['server', 'http']
|
|
10
19
|
static MessageEncoder = LarkMessageEncoder
|
|
@@ -145,9 +154,16 @@ export class LarkBot<C extends Context = Context> extends Bot<C, LarkBot.Config>
|
|
|
145
154
|
|
|
146
155
|
async createUpload(...uploads: Universal.Upload[]): Promise<string[]> {
|
|
147
156
|
return await Promise.all(uploads.map(async (upload) => {
|
|
157
|
+
let type: CreateImFileForm['file_type'] = 'stream'
|
|
158
|
+
for (const [key, value] of Object.entries(fileTypeMap)) {
|
|
159
|
+
if (value.includes(upload.type)) {
|
|
160
|
+
type = key as CreateImFileForm['file_type']
|
|
161
|
+
break
|
|
162
|
+
}
|
|
163
|
+
}
|
|
148
164
|
const response = await this.internal.createImFile({
|
|
149
165
|
file_name: upload.filename,
|
|
150
|
-
file_type:
|
|
166
|
+
file_type: type,
|
|
151
167
|
file: new Blob([upload.data]),
|
|
152
168
|
})
|
|
153
169
|
return this.getInternalUrl(`/im/v1/files/${response.file_key}`)
|
package/src/http.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Adapter, Context, Logger, Schema } from '@satorijs/core'
|
|
2
2
|
import {} from '@cordisjs/plugin-server'
|
|
3
|
-
|
|
4
3
|
import { LarkBot } from './bot'
|
|
5
|
-
import { EventPayload } from './
|
|
6
|
-
import { adaptSession, Cipher } from './utils'
|
|
4
|
+
import { adaptSession, Cipher, EventPayload } from './utils'
|
|
7
5
|
|
|
8
6
|
export class HttpServer<C extends Context = Context> extends Adapter<C, LarkBot<C>> {
|
|
9
7
|
static inject = ['server']
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LarkBot } from './bot'
|
|
2
|
+
import { Internal } from './internal'
|
|
3
|
+
import { EventPayload } from './utils'
|
|
2
4
|
import * as Lark from './types'
|
|
3
5
|
|
|
4
6
|
export * from './bot'
|
|
@@ -9,7 +11,7 @@ export default LarkBot
|
|
|
9
11
|
|
|
10
12
|
declare module '@satorijs/core' {
|
|
11
13
|
interface Session {
|
|
12
|
-
feishu:
|
|
13
|
-
lark:
|
|
14
|
+
feishu: Internal & EventPayload
|
|
15
|
+
lark: Internal & EventPayload
|
|
14
16
|
}
|
|
15
17
|
}
|