@nest-packages/nestjs-lark-sdk 0.1.1 → 0.2.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.
@@ -2,8 +2,11 @@ import * as lark from '@larksuiteoapi/node-sdk';
2
2
  export type bitableType = lark.Client['bitable'];
3
3
  export type appTableRecordType = bitableType['appTableRecord'];
4
4
  export type appTableRecordListType = appTableRecordType['list'];
5
- export type appTableRecordListParamsType = Parameters<appTableRecordListType>[0]['params'];
5
+ export type appTableRecordListParamsType =
6
+ Parameters<appTableRecordListType>[0]['params'];
6
7
  export type TypeAppTablePath = Parameters<appTableRecordListType>[0]['path'];
7
8
  export type TypeAppTableRecordSearch = appTableRecordType['search'];
8
- export type TypeAppTableRecordSearchPayloadData = Parameters<TypeAppTableRecordSearch>[0]['data'];
9
- export type TypeAppTableRecordSearchPayloadParams = Parameters<TypeAppTableRecordSearch>[0]['params'];
9
+ export type TypeAppTableRecordSearchPayloadData =
10
+ Parameters<TypeAppTableRecordSearch>[0]['data'];
11
+ export type TypeAppTableRecordSearchPayloadParams =
12
+ Parameters<TypeAppTableRecordSearch>[0]['params'];
package/dist/type.d.ts CHANGED
@@ -1,63 +1,68 @@
1
1
  import * as lark from '@larksuiteoapi/node-sdk';
2
2
  export interface TypeUser {
3
- avatar: {
4
- avatar_240: string;
5
- };
6
- city: string;
7
- country: string;
8
- department_ids: string[];
9
- description: string;
10
- email: string;
11
- employee_no: string;
12
- employee_type: number;
13
- en_name: string;
14
- enterprise_email: string;
15
- gender: 1 | 2;
16
- is_tenant_manager: boolean;
17
- job_title: string;
18
- join_time: number;
19
- mobile: string;
20
- mobile_visible: boolean;
21
- name: string;
22
- nickname: string;
23
- open_id: string;
24
- orders: Array<{
25
- department_id: string;
26
- department_order: number;
27
- is_primary_dept: boolean;
28
- user_order: number;
29
- }>;
30
- status: {
31
- is_activated: boolean;
32
- is_exited: boolean;
33
- is_frozen: boolean;
34
- is_resigned: boolean;
35
- is_unjoin: boolean;
36
- };
37
- union_id: string;
38
- user_id: string;
39
- work_station: string;
3
+ avatar: {
4
+ avatar_240: string;
5
+ };
6
+ city: string;
7
+ country: string;
8
+ department_ids: string[];
9
+ description: string;
10
+ email: string;
11
+ employee_no: string;
12
+ employee_type: number;
13
+ en_name: string;
14
+ enterprise_email: string;
15
+ gender: 1 | 2;
16
+ is_tenant_manager: boolean;
17
+ job_title: string;
18
+ join_time: number;
19
+ mobile: string;
20
+ mobile_visible: boolean;
21
+ name: string;
22
+ nickname: string;
23
+ open_id: string;
24
+ orders: Array<{
25
+ department_id: string;
26
+ department_order: number;
27
+ is_primary_dept: boolean;
28
+ user_order: number;
29
+ }>;
30
+ status: {
31
+ is_activated: boolean;
32
+ is_exited: boolean;
33
+ is_frozen: boolean;
34
+ is_resigned: boolean;
35
+ is_unjoin: boolean;
36
+ };
37
+ union_id: string;
38
+ user_id: string;
39
+ work_station: string;
40
40
  }
41
- export type TypeUserStore = Pick<TypeUser, 'name' | 'open_id' | 'mobile' | 'nickname' | 'user_id'>;
41
+ export type TypeUserStore = Pick<
42
+ TypeUser,
43
+ 'name' | 'open_id' | 'mobile' | 'nickname' | 'user_id'
44
+ >;
42
45
  export interface TypeDepartment {
43
- department_id: string;
44
- i18n_name: {
45
- [key: string]: string;
46
- };
47
- leader_user_id?: string;
48
- leaders: Array<{
49
- leaderID: string;
50
- leaderType: number;
51
- }>;
52
- member_count: number;
53
- name: string;
54
- open_department_id?: string;
55
- order: string;
56
- parent_department_id: string;
57
- primary_member_count: number;
58
- status: {
59
- is_deleted: boolean;
60
- };
61
- chat_id: string;
46
+ department_id: string;
47
+ i18n_name: {
48
+ [key: string]: string;
49
+ };
50
+ leader_user_id?: string;
51
+ leaders: Array<{
52
+ leaderID: string;
53
+ leaderType: number;
54
+ }>;
55
+ member_count: number;
56
+ name: string;
57
+ open_department_id?: string;
58
+ order: string;
59
+ parent_department_id: string;
60
+ primary_member_count: number;
61
+ status: {
62
+ is_deleted: boolean;
63
+ };
64
+ chat_id: string;
62
65
  }
63
- export type BitableRecordChangedDataType = Parameters<lark.EventHandles['drive.file.bitable_record_changed_v1']>[0];
66
+ export type BitableRecordChangedDataType = Parameters<
67
+ lark.EventHandles['drive.file.bitable_record_changed_v1']
68
+ >[0];
@@ -1,168 +1,224 @@
1
- import { CardActionHandler, Client, EventDispatcher } from '@larksuiteoapi/node-sdk';
1
+ import {
2
+ CardActionHandler,
3
+ Client,
4
+ EventDispatcher,
5
+ } from '@larksuiteoapi/node-sdk';
2
6
  import { ModuleMetadata, Type } from '@nestjs/common';
3
7
  export type LarkClientParamsType = ConstructorParameters<typeof Client>[0];
4
- export type LarkEventDispatcherParamsType = ConstructorParameters<typeof EventDispatcher>[0];
5
- export type LarkClientCardActionHandlerType = ConstructorParameters<typeof CardActionHandler>[0];
8
+ export type LarkEventDispatcherParamsType = ConstructorParameters<
9
+ typeof EventDispatcher
10
+ >[0];
11
+ export type LarkClientCardActionHandlerType = ConstructorParameters<
12
+ typeof CardActionHandler
13
+ >[0];
6
14
  export interface NestjsLarkSdkModuleOptionsFactory {
7
- createNestjsLarkSdkModuleOptions(): Promise<NestjsLarkSdkModuleOptions> | NestjsLarkSdkModuleOptions;
15
+ createNestjsLarkSdkModuleOptions():
16
+ | Promise<NestjsLarkSdkModuleOptions>
17
+ | NestjsLarkSdkModuleOptions;
8
18
  }
9
19
  export interface NestjsLarkSdkModuleOptions {
10
- LarkClientParams: LarkClientParamsType;
11
- LarkEventDispatcherParams?: LarkEventDispatcherParamsType;
12
- }
13
- export interface NestjsLarkSdkModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
14
- inject?: any[];
15
- useClass?: Type<NestjsLarkSdkModuleOptionsFactory>;
16
- useExisting?: Type<NestjsLarkSdkModuleOptionsFactory>;
17
- useFactory?: (...args: any[]) => Promise<NestjsLarkSdkModuleOptions> | NestjsLarkSdkModuleOptions;
20
+ LarkClientParams: LarkClientParamsType;
21
+ LarkEventDispatcherParams?: LarkEventDispatcherParamsType;
22
+ }
23
+ export interface NestjsLarkSdkModuleAsyncOptions
24
+ extends Pick<ModuleMetadata, 'imports'> {
25
+ inject?: any[];
26
+ useClass?: Type<NestjsLarkSdkModuleOptionsFactory>;
27
+ useExisting?: Type<NestjsLarkSdkModuleOptionsFactory>;
28
+ useFactory?: (
29
+ ...args: any[]
30
+ ) => Promise<NestjsLarkSdkModuleOptions> | NestjsLarkSdkModuleOptions;
18
31
  }
19
32
  import * as lark from '@larksuiteoapi/node-sdk';
20
33
  export type EhrEmployeeList = lark.Client['ehr']['employee']['list'];
21
34
  export type EhrEmployeeListReturnType = ReturnType<EhrEmployeeList>;
22
35
  export type EhrEmployeeListParams = Parameters<EhrEmployeeList>[0]['params'];
23
- export type EhrEmployeeListDataItems = UnPromise<EhrEmployeeListReturnType>['data']['items'];
24
- export type BitableAppTableFieldList = lark.Client['bitable']['appTableField']['list'];
25
- export type BitableAppTableFieldListReturnType = ReturnType<BitableAppTableFieldList>;
26
- export type BitableAppTableFieldListDataItems = UnPromise<BitableAppTableFieldListReturnType>['data']['items'];
27
- export type BitableAppTableFieldCreate = lark.Client['bitable']['appTableField']['create'];
28
- export type appTableFieldCreateData = Parameters<BitableAppTableFieldCreate>[0]['data'];
29
- export type appTableFieldCreatePath = Parameters<BitableAppTableFieldCreate>[0]['path'];
30
- export type bitableAppTableCreate = lark.Client['bitable']['appTable']['create'];
31
- export type appTableCreateData = Parameters<bitableAppTableCreate>[0]['data']['table']['fields'][0];
36
+ export type EhrEmployeeListDataItems =
37
+ UnPromise<EhrEmployeeListReturnType>['data']['items'];
38
+ export type BitableAppTableFieldList =
39
+ lark.Client['bitable']['appTableField']['list'];
40
+ export type BitableAppTableFieldListReturnType =
41
+ ReturnType<BitableAppTableFieldList>;
42
+ export type BitableAppTableFieldListDataItems =
43
+ UnPromise<BitableAppTableFieldListReturnType>['data']['items'];
44
+ export type BitableAppTableFieldCreate =
45
+ lark.Client['bitable']['appTableField']['create'];
46
+ export type appTableFieldCreateData =
47
+ Parameters<BitableAppTableFieldCreate>[0]['data'];
48
+ export type appTableFieldCreatePath =
49
+ Parameters<BitableAppTableFieldCreate>[0]['path'];
50
+ export type bitableAppTableCreate =
51
+ lark.Client['bitable']['appTable']['create'];
52
+ export type appTableCreateData =
53
+ Parameters<bitableAppTableCreate>[0]['data']['table']['fields'][0];
32
54
  export type appTableCreatePath = Parameters<bitableAppTableCreate>[0]['path'];
33
- export type BitableAppTableFieldCreateReturnTypeDataField = UnPromise<ReturnType<BitableAppTableFieldCreate>>['data']['field'];
34
- export type typeAppTableRecordCreateFields = Parameters<lark.Client['bitable']['appTableRecord']['create']>[0]['data']['fields'];
35
- type returnTypeAppTableRecordCreate = ReturnType<lark.Client['bitable']['appTableRecord']['create']>;
55
+ export type BitableAppTableFieldCreateReturnTypeDataField = UnPromise<
56
+ ReturnType<BitableAppTableFieldCreate>
57
+ >['data']['field'];
58
+ export type typeAppTableRecordCreateFields = Parameters<
59
+ lark.Client['bitable']['appTableRecord']['create']
60
+ >[0]['data']['fields'];
61
+ type returnTypeAppTableRecordCreate = ReturnType<
62
+ lark.Client['bitable']['appTableRecord']['create']
63
+ >;
36
64
  export type UnPromise<T> = T extends Promise<infer R> ? R : any;
37
- type returnTypeImMessageCreate = ReturnType<lark.Client['im']['message']['create']>;
65
+ type returnTypeImMessageCreate = ReturnType<
66
+ lark.Client['im']['message']['create']
67
+ >;
38
68
  export type responseTypeImMessageCreate = UnPromise<returnTypeImMessageCreate>;
39
69
  export interface typeFeishuImMessageCreated {
40
- requestData: any;
41
- responseData: responseTypeImMessageCreate;
42
- larkClient?: lark.Client;
43
- }
44
- export type responseAppTableRecordCreate = UnPromise<returnTypeAppTableRecordCreate>;
45
- type returnTypeAppTableRecordList = ReturnType<lark.Client['bitable']['appTableRecord']['list']>;
46
- export type AppTableRecordApiResponseRecordField = UnPromise<returnTypeAppTableRecordList>;
47
- export type AppTableRecordRecordField = AppTableRecordApiResponseRecordField['data']['items'][0];
48
- type returnTypeAppTableFieldList = ReturnType<lark.Client['bitable']['appTableField']['list']>;
49
- export type appTableFieldApiResponseRecordField = UnPromise<returnTypeAppTableFieldList>;
50
- export type appTableFieldRecordField = appTableFieldApiResponseRecordField['data']['items'][0];
51
- export type IMessageRootObject = Parameters<lark.EventHandles['im.message.receive_v1']>[0];
52
- export type IMessageEvent = Parameters<lark.EventHandles['im.message.receive_v1']>[0]['message'];
70
+ requestData: any;
71
+ responseData: responseTypeImMessageCreate;
72
+ larkClient?: lark.Client;
73
+ }
74
+ export type responseAppTableRecordCreate =
75
+ UnPromise<returnTypeAppTableRecordCreate>;
76
+ type returnTypeAppTableRecordList = ReturnType<
77
+ lark.Client['bitable']['appTableRecord']['list']
78
+ >;
79
+ export type AppTableRecordApiResponseRecordField =
80
+ UnPromise<returnTypeAppTableRecordList>;
81
+ export type AppTableRecordRecordField =
82
+ AppTableRecordApiResponseRecordField['data']['items'][0];
83
+ type returnTypeAppTableFieldList = ReturnType<
84
+ lark.Client['bitable']['appTableField']['list']
85
+ >;
86
+ export type appTableFieldApiResponseRecordField =
87
+ UnPromise<returnTypeAppTableFieldList>;
88
+ export type appTableFieldRecordField =
89
+ appTableFieldApiResponseRecordField['data']['items'][0];
90
+ export type IMessageRootObject = Parameters<
91
+ lark.EventHandles['im.message.receive_v1']
92
+ >[0];
93
+ export type IMessageEvent = Parameters<
94
+ lark.EventHandles['im.message.receive_v1']
95
+ >[0]['message'];
53
96
  export interface FileToken {
54
- file_token?: string;
97
+ file_token?: string;
55
98
  }
56
99
  export interface UploadImage {
57
- file_name: string;
58
- parent_type: 'doc_image' | 'docx_image' | 'sheet_image' | 'doc_file' | 'docx_file' | 'sheet_file' | 'vc_virtual_background' | 'bitable_image' | 'bitable_file' | 'moments' | 'ccm_import_open';
59
- parent_node: string;
60
- extra?: {
61
- image_key: string;
62
- };
100
+ file_name: string;
101
+ parent_type:
102
+ | 'doc_image'
103
+ | 'docx_image'
104
+ | 'sheet_image'
105
+ | 'doc_file'
106
+ | 'docx_file'
107
+ | 'sheet_file'
108
+ | 'vc_virtual_background'
109
+ | 'bitable_image'
110
+ | 'bitable_file'
111
+ | 'moments'
112
+ | 'ccm_import_open';
113
+ parent_node: string;
114
+ extra?: {
115
+ image_key: string;
116
+ };
63
117
  }
64
118
  export interface Link {
65
- text?: string;
66
- link?: string;
119
+ text?: string;
120
+ link?: string;
67
121
  }
68
122
  export interface Address {
69
- location?: string;
70
- pname?: string;
71
- cityname?: string;
72
- adname?: string;
73
- address?: string;
74
- name?: string;
75
- full_address?: string;
123
+ location?: string;
124
+ pname?: string;
125
+ cityname?: string;
126
+ adname?: string;
127
+ address?: string;
128
+ name?: string;
129
+ full_address?: string;
76
130
  }
77
131
  export interface Person {
78
- id?: string;
79
- name?: string;
80
- en_name?: string;
81
- email?: string;
132
+ id?: string;
133
+ name?: string;
134
+ en_name?: string;
135
+ email?: string;
82
136
  }
83
137
  export interface Files {
84
- file_token?: string;
85
- name?: string;
86
- type?: string;
87
- size?: number;
88
- url?: string;
89
- tmp_url?: string;
138
+ file_token?: string;
139
+ name?: string;
140
+ type?: string;
141
+ size?: number;
142
+ url?: string;
143
+ tmp_url?: string;
90
144
  }
91
145
  export interface Text {
92
- tag: 'text';
93
- text: string;
146
+ tag: 'text';
147
+ text: string;
94
148
  }
95
149
  export interface Image {
96
- tag: 'img';
97
- image_key: string;
98
- width: number;
99
- height: number;
150
+ tag: 'img';
151
+ image_key: string;
152
+ width: number;
153
+ height: number;
100
154
  }
101
155
  export interface AtUser {
102
- tag: 'at';
103
- user_id: string;
104
- user_name: string;
156
+ tag: 'at';
157
+ user_id: string;
158
+ user_name: string;
105
159
  }
106
160
  export interface Field {
107
- field_id: string;
108
- field_value: string;
161
+ field_id: string;
162
+ field_value: string;
109
163
  }
110
164
  export interface TypeBitablePath {
111
- app_token: string;
112
- table_id: string;
113
- view_id: string;
165
+ app_token: string;
166
+ table_id: string;
167
+ view_id: string;
114
168
  }
115
169
  export type SubEventMessageParseItemText = Text[];
116
170
  export type SubEventMessageParseItemImage = Image[];
117
171
  export type SubEventMessageParseItemAtUser = AtUser[];
118
172
  export type SubEventMessageParse = Array<Array<Text | Image | AtUser>>;
119
173
  export interface CardInteraction {
120
- schema: string;
121
- header: Header;
122
- event: Event;
174
+ schema: string;
175
+ header: Header;
176
+ event: Event;
123
177
  }
124
178
  export interface Header {
125
- event_id: string;
126
- token: string;
127
- create_time: string;
128
- event_type: string;
129
- tenant_key: string;
130
- app_id: string;
179
+ event_id: string;
180
+ token: string;
181
+ create_time: string;
182
+ event_type: string;
183
+ tenant_key: string;
184
+ app_id: string;
131
185
  }
132
186
  export interface Event {
133
- operator: Operator;
134
- token: string;
135
- action: Action;
136
- host: string;
137
- delivery_type: string;
138
- context: Context;
187
+ operator: Operator;
188
+ token: string;
189
+ action: Action;
190
+ host: string;
191
+ delivery_type: string;
192
+ context: Context;
139
193
  }
140
194
  export interface Operator {
141
- tenant_key: string;
142
- user_id: string;
143
- open_id: string;
195
+ tenant_key: string;
196
+ user_id: string;
197
+ open_id: string;
144
198
  }
145
199
  export interface Action {
146
- value: Value;
147
- tag: string;
148
- form_value: {
149
- statementIntro: string;
150
- };
200
+ value: Value;
201
+ tag: string;
202
+ form_value: {
203
+ statementIntro: string;
204
+ };
151
205
  }
152
206
  export interface Value {
153
- actionType: any;
154
- [key: string]: string;
207
+ actionType: any;
208
+ [key: string]: string;
155
209
  }
156
210
  export interface Context {
157
- url: string;
158
- preview_token: string;
159
- open_message_id: string;
160
- open_chat_id: string;
161
- }
162
- export interface InteractiveCardActionEvent extends lark.InteractiveCardActionEvent, CardInteraction {
163
- context: Context;
164
- operator: Operator;
165
- action: Action;
166
- event_type: 'card.action.trigger';
211
+ url: string;
212
+ preview_token: string;
213
+ open_message_id: string;
214
+ open_chat_id: string;
215
+ }
216
+ export interface InteractiveCardActionEvent
217
+ extends lark.InteractiveCardActionEvent,
218
+ CardInteraction {
219
+ context: Context;
220
+ operator: Operator;
221
+ action: Action;
222
+ event_type: 'card.action.trigger';
167
223
  }
168
224
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-packages/nestjs-lark-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -8,7 +8,8 @@
8
8
  ],
9
9
  "peerDependencies": {
10
10
  "@nestjs/common": "^11.0.0",
11
- "@nestjs/core": "^11.0.0"
11
+ "@nestjs/core": "^11.0.0",
12
+ "@nest-packages/nestjs-queue-events": "*"
12
13
  },
13
14
  "scripts": {
14
15
  "build": "tsc -p tsconfig.build.json"