mobx-lark 2.6.4 → 2.6.5
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module/InstantMessenger/index.d.ts +4 -3
- package/dist/module/InstantMessenger/type/index.d.ts +20 -7
- package/package.json +12 -12
- package/src/module/InstantMessenger/index.ts +7 -7
- package/src/module/InstantMessenger/type/index.ts +37 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListModel, NewData } from 'mobx-restful';
|
|
2
|
-
import { ChatMessage, ChatMeta, SendChatMessage } from './type';
|
|
2
|
+
import { ChatMessage, ChatMeta, CreateChatOption, SendChatMessage } from './type';
|
|
3
3
|
export * from './type';
|
|
4
4
|
declare const ChatListModel_base: (abstract new (...args: any[]) => {
|
|
5
5
|
stream?: AsyncGenerator<ChatMeta, void, any> | undefined;
|
|
@@ -54,9 +54,10 @@ export declare abstract class ChatListModel extends ChatListModel_base {
|
|
|
54
54
|
*/
|
|
55
55
|
openStream(): AsyncGenerator<ChatMeta, void, unknown>;
|
|
56
56
|
/**
|
|
57
|
-
* @see https://open.feishu.cn/document/
|
|
57
|
+
* @see {@link https://open.feishu.cn/document/server-docs/group/chat/create}
|
|
58
|
+
* @see {@link https://open.feishu.cn/document/server-docs/group/chat/update-2}
|
|
58
59
|
*/
|
|
59
|
-
updateOne({ chat_id }: NewData<ChatMeta
|
|
60
|
+
updateOne({ chat_id, ...data }: NewData<ChatMeta>, option?: CreateChatOption): Promise<ChatMeta>;
|
|
60
61
|
}
|
|
61
62
|
declare const MessageListModel_base: (abstract new (...args: any[]) => {
|
|
62
63
|
stream?: AsyncGenerator<ChatMessage, void, any> | undefined;
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { TranslationMap } from '../../../type';
|
|
2
|
+
import { UserIdType } from '../../User/type';
|
|
2
3
|
import { ChatMessageContent } from './message';
|
|
3
4
|
export * from './message';
|
|
4
5
|
export type ChatPermission = 'all_members' | 'only_owner' | 'not_anyone';
|
|
5
|
-
export
|
|
6
|
+
export type ChatManagerPermission = Exclude<ChatPermission, 'not_anyone'>;
|
|
7
|
+
export type ChatMemberPermission = Exclude<ChatPermission, 'only_owner'>;
|
|
8
|
+
export interface RestrictedModeSetting extends Partial<Record<`${'screenshot' | 'download' | 'message'}_has_permission_setting`, ChatMemberPermission>> {
|
|
9
|
+
status?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateChatMeta extends Record<'owner_id' | 'avatar' | 'name' | 'description', string>, Record<`${'join' | 'leave'}_message_visibility`, ChatPermission>, Record<`${'user' | 'bot'}_id_list`, string[]>, Record<`${'urgent' | 'video_conference' | 'hide_member_count'}_setting` | 'edit_permission', ChatManagerPermission> {
|
|
6
12
|
chat_mode: 'group';
|
|
7
13
|
chat_type: 'private' | 'public';
|
|
14
|
+
group_message_type: 'chat' | 'thread';
|
|
8
15
|
i18n_names: TranslationMap;
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
membership_approval: `${'no_' | ''}approval_required`;
|
|
17
|
+
restricted_mode_setting: RestrictedModeSetting;
|
|
11
18
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
export interface CreateChatOption {
|
|
20
|
+
user_id_type?: UserIdType;
|
|
21
|
+
set_bot_manager?: boolean;
|
|
22
|
+
uuid?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ChatMeta extends CreateChatMeta, Record<'tenant_key' | 'chat_id', string>, Record<`${'add_member' | 'at_all' | 'moderation'}_permission`, ChatPermission> {
|
|
25
|
+
owner_id_type: UserIdType;
|
|
26
|
+
chat_tag: 'inner' | 'tenant' | 'department' | 'edu' | 'meeting' | 'customer_service';
|
|
27
|
+
external: boolean;
|
|
28
|
+
share_card_permission: `${'not_' | ''}allowed`;
|
|
16
29
|
}
|
|
17
30
|
export type ChatMessageType = 'text' | 'card';
|
|
18
31
|
export interface SendChatMessage {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-lark",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"license": "LGPL-3.0",
|
|
5
5
|
"author": "shiy2008@gmail.com",
|
|
6
6
|
"description": "Unofficial TypeScript SDK for FeiShu/Lark API, which is based on MobX-RESTful.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@swc/helpers": "^0.5.18",
|
|
29
|
-
"@types/react": "^19.2.
|
|
29
|
+
"@types/react": "^19.2.14",
|
|
30
30
|
"koajax": "^3.1.2",
|
|
31
31
|
"lodash.memoize": "^4.1.2",
|
|
32
32
|
"mobx": "^6.15.0",
|
|
@@ -38,25 +38,25 @@
|
|
|
38
38
|
"react": ">=16"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@parcel/config-default": "~2.16.
|
|
42
|
-
"@parcel/transformer-typescript-tsc": "~2.16.
|
|
41
|
+
"@parcel/config-default": "~2.16.4",
|
|
42
|
+
"@parcel/transformer-typescript-tsc": "~2.16.4",
|
|
43
43
|
"@types/fs-extra": "^11.0.4",
|
|
44
44
|
"@types/lodash.memoize": "^4.1.9",
|
|
45
|
-
"@types/node": "^
|
|
45
|
+
"@types/node": "^24.10.13",
|
|
46
46
|
"@types/react-dom": "^19.2.3",
|
|
47
47
|
"@types/turndown": "^5.0.6",
|
|
48
|
-
"dotenv": "^17.
|
|
48
|
+
"dotenv": "^17.3.1",
|
|
49
49
|
"fs-extra": "^11.3.3",
|
|
50
50
|
"husky": "^9.1.7",
|
|
51
51
|
"lint-staged": "^16.2.7",
|
|
52
|
-
"parcel": "~2.16.
|
|
53
|
-
"prettier": "^3.
|
|
54
|
-
"react": "^19.2.
|
|
55
|
-
"react-dom": "^19.2.
|
|
52
|
+
"parcel": "~2.16.4",
|
|
53
|
+
"prettier": "^3.8.1",
|
|
54
|
+
"react": "^19.2.4",
|
|
55
|
+
"react-dom": "^19.2.4",
|
|
56
56
|
"ts-node": "^10.9.2",
|
|
57
57
|
"turndown": "^7.2.2",
|
|
58
|
-
"typedoc": "^0.28.
|
|
59
|
-
"typedoc-plugin-mdn-links": "^5.
|
|
58
|
+
"typedoc": "^0.28.16",
|
|
59
|
+
"typedoc-plugin-mdn-links": "^5.1.1",
|
|
60
60
|
"typescript": "~5.8.3"
|
|
61
61
|
},
|
|
62
62
|
"pnpm": {
|
|
@@ -3,7 +3,7 @@ import { buildURLData } from 'web-utility';
|
|
|
3
3
|
|
|
4
4
|
import { LarkData } from '../../type';
|
|
5
5
|
import { createPageStream } from '../base';
|
|
6
|
-
import { ChatMessage, ChatMeta, SendChatMessage } from './type';
|
|
6
|
+
import { ChatMessage, ChatMeta, CreateChatOption, SendChatMessage } from './type';
|
|
7
7
|
|
|
8
8
|
export * from './type';
|
|
9
9
|
|
|
@@ -22,16 +22,16 @@ export abstract class ChatListModel extends Stream<ChatMeta>(ListModel) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* @see https://open.feishu.cn/document/
|
|
25
|
+
* @see {@link https://open.feishu.cn/document/server-docs/group/chat/create}
|
|
26
|
+
* @see {@link https://open.feishu.cn/document/server-docs/group/chat/update-2}
|
|
26
27
|
*/
|
|
27
28
|
@toggle('uploading')
|
|
28
|
-
async updateOne({ chat_id }: NewData<ChatMeta
|
|
29
|
+
async updateOne({ chat_id, ...data }: NewData<ChatMeta>, option: CreateChatOption = {}) {
|
|
29
30
|
const { body } = await (chat_id
|
|
30
|
-
? this.client.put<LarkData<ChatMeta>>(`${this.baseURI}
|
|
31
|
+
? this.client.put<LarkData<ChatMeta>>(`${this.baseURI}/${chat_id}`, data)
|
|
31
32
|
: this.client.post<LarkData<ChatMeta>>(
|
|
32
|
-
`${this.baseURI}
|
|
33
|
-
|
|
34
|
-
})}`
|
|
33
|
+
`${this.baseURI}?${buildURLData(option)}`,
|
|
34
|
+
data
|
|
35
35
|
));
|
|
36
36
|
return (this.currentOne = body!.data!);
|
|
37
37
|
}
|
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
import { TranslationMap } from '../../../type';
|
|
2
|
+
import { UserIdType } from '../../User/type';
|
|
2
3
|
import { ChatMessageContent } from './message';
|
|
3
4
|
|
|
4
5
|
export * from './message';
|
|
5
6
|
|
|
6
7
|
export type ChatPermission = 'all_members' | 'only_owner' | 'not_anyone';
|
|
7
8
|
|
|
9
|
+
export type ChatManagerPermission = Exclude<ChatPermission, 'not_anyone'>;
|
|
10
|
+
|
|
11
|
+
export type ChatMemberPermission = Exclude<ChatPermission, 'only_owner'>;
|
|
12
|
+
|
|
13
|
+
export interface RestrictedModeSetting extends Partial<
|
|
14
|
+
Record<`${'screenshot' | 'download' | 'message'}_has_permission_setting`, ChatMemberPermission>
|
|
15
|
+
> {
|
|
16
|
+
status?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
export interface CreateChatMeta
|
|
9
|
-
extends
|
|
20
|
+
extends
|
|
21
|
+
Record<'owner_id' | 'avatar' | 'name' | 'description', string>,
|
|
10
22
|
Record<`${'join' | 'leave'}_message_visibility`, ChatPermission>,
|
|
11
|
-
Record<`${'user' | 'bot'}_id_list`, string[]
|
|
23
|
+
Record<`${'user' | 'bot'}_id_list`, string[]>,
|
|
24
|
+
Record<
|
|
25
|
+
`${'urgent' | 'video_conference' | 'hide_member_count'}_setting` | 'edit_permission',
|
|
26
|
+
ChatManagerPermission
|
|
27
|
+
> {
|
|
12
28
|
chat_mode: 'group';
|
|
13
29
|
chat_type: 'private' | 'public';
|
|
30
|
+
group_message_type: 'chat' | 'thread';
|
|
14
31
|
i18n_names: TranslationMap;
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
membership_approval: `${'no_' | ''}approval_required`;
|
|
33
|
+
restricted_mode_setting: RestrictedModeSetting;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface CreateChatOption {
|
|
37
|
+
user_id_type?: UserIdType;
|
|
38
|
+
set_bot_manager?: boolean;
|
|
39
|
+
uuid?: string;
|
|
17
40
|
}
|
|
18
41
|
|
|
19
42
|
export interface ChatMeta
|
|
20
|
-
extends
|
|
43
|
+
extends
|
|
44
|
+
CreateChatMeta,
|
|
21
45
|
Record<'tenant_key' | 'chat_id', string>,
|
|
22
|
-
Record
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
chat_tag: 'inner';
|
|
28
|
-
share_card_permission: 'allowed';
|
|
46
|
+
Record<`${'add_member' | 'at_all' | 'moderation'}_permission`, ChatPermission> {
|
|
47
|
+
owner_id_type: UserIdType;
|
|
48
|
+
chat_tag: 'inner' | 'tenant' | 'department' | 'edu' | 'meeting' | 'customer_service';
|
|
49
|
+
external: boolean;
|
|
50
|
+
share_card_permission: `${'not_' | ''}allowed`;
|
|
29
51
|
}
|
|
30
52
|
|
|
31
53
|
export type ChatMessageType = 'text' | 'card';
|
|
@@ -45,13 +67,11 @@ export type ChatMetion = Pick<ChatSender, 'id' | 'id_type' | 'tenant_key'> &
|
|
|
45
67
|
Record<'key' | 'name', string>;
|
|
46
68
|
|
|
47
69
|
export interface ChatMessage
|
|
48
|
-
extends
|
|
70
|
+
extends
|
|
71
|
+
Pick<SendChatMessage, 'msg_type'>,
|
|
49
72
|
Record<`${'create' | 'update'}_time`, string>,
|
|
50
73
|
Record<'deleted' | 'updated', boolean>,
|
|
51
|
-
Record
|
|
52
|
-
`${'chat' | 'message' | 'upper_message' | 'root' | 'parent'}_id`,
|
|
53
|
-
string
|
|
54
|
-
> {
|
|
74
|
+
Record<`${'chat' | 'message' | 'upper_message' | 'root' | 'parent'}_id`, string> {
|
|
55
75
|
sender: ChatSender;
|
|
56
76
|
mentions: ChatMetion[];
|
|
57
77
|
body: {
|