mobx-lark 2.6.5 → 2.8.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.
@@ -11,7 +11,7 @@ export interface TableView extends Record<'view_id' | 'view_name', string> {
11
11
  view_type: 'grid' | 'kanban' | 'gallery' | 'gantt' | 'form';
12
12
  }
13
13
  export interface TableFormView extends Record<'name' | 'description' | 'shared_url', string>, Record<'shared' | 'submit_limit_once', boolean> {
14
- shared_limit: 'tenant_editable';
14
+ shared_limit: 'off' | `${'tenant' | 'anyone'}_editable`;
15
15
  }
16
16
  export type LarkFormData = LarkData<{
17
17
  form: TableFormView;
@@ -0,0 +1,31 @@
1
+ import { BaseModel, RESTClient } from 'mobx-restful';
2
+ import { TaxiInvoice, TrainInvoice, VatInvoice, VehicleInvoice } from './type';
3
+ export * from './type';
4
+ export declare abstract class DocumentAIModel extends BaseModel {
5
+ baseURI: string;
6
+ abstract client: RESTClient;
7
+ /**
8
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/vat_invoice/recognize}
9
+ */
10
+ recognizeVatInvoices(file: File): Promise<{
11
+ entities: VatInvoice[];
12
+ }[]>;
13
+ /**
14
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/taxi_invoice/recognize}
15
+ */
16
+ recognizeTaxiInvoices(file: File): Promise<{
17
+ entities: TaxiInvoice[];
18
+ }[]>;
19
+ /**
20
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/train_invoice/recognize}
21
+ */
22
+ recognizeTrainInvoices(file: File): Promise<{
23
+ entities: TrainInvoice[];
24
+ }[]>;
25
+ /**
26
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/vehicle_invoice/recognize}
27
+ */
28
+ recognizeVehicleInvoice(file: File): Promise<{
29
+ entities: VehicleInvoice[];
30
+ }>;
31
+ }
@@ -0,0 +1,19 @@
1
+ export type InvoiceEntityType = `invoice_${'code' | 'no' | 'special_seal'}` | `seller_${'name' | 'taxpayer_no'}_in_seal`;
2
+ export type TrafficInvoiceEntityType = 'total_amount' | 'price';
3
+ export interface VatInvoice {
4
+ type: InvoiceEntityType | `invoice_${'name' | 'date'}` | `total_${'price' | 'tax'}` | `${'big_' | ''}total_price_and_tax` | 'check_code' | `buyer_${'name' | 'taxpayer_no' | 'address_phone' | 'account'}` | `seller_${'name' | 'taxpayer_no' | 'address_phone' | 'account'}` | 'payee' | 'password_area' | 'remarks' | 'reviewer' | 'drawer' | 'is_sealed' | 'machine_num';
5
+ value: string;
6
+ items: Record<'type' | 'value', string>[][];
7
+ }
8
+ export interface TaxiInvoice {
9
+ type: InvoiceEntityType | TrafficInvoiceEntityType | 'car_number' | 'start_date' | `${'start' | 'end'}_time` | 'distance' | `${'dispatch' | 'additional'}_fee` | 'is_sealed' | 'title_trial';
10
+ value: string;
11
+ }
12
+ export interface TrainInvoice {
13
+ type: TrafficInvoiceEntityType | 'name' | 'id_num' | 'time' | `${'start' | 'end'}_station` | `sale_${'num' | 'station'}` | `${'train' | 'seat' | 'ticket'}_num` | `seat_${'num' | 'cls'}`;
14
+ value: string;
15
+ }
16
+ export interface VehicleInvoice {
17
+ type: 'date' | `invoice_${'code' | 'num'}` | `print_${'code' | 'num'}` | `buyer_${'name' | 'id'}` | `saler_${'name' | 'id' | 'addr'}` | 'vehicle_type' | 'product_model' | `${'certificate' | 'machine' | 'engine'}_num` | 'vin' | `tax${'' | '_rate'}` | 'price' | `total_price${'' | '_little'}`;
18
+ value: string;
19
+ }
@@ -57,7 +57,7 @@ export declare abstract class ChatListModel extends ChatListModel_base {
57
57
  * @see {@link https://open.feishu.cn/document/server-docs/group/chat/create}
58
58
  * @see {@link https://open.feishu.cn/document/server-docs/group/chat/update-2}
59
59
  */
60
- updateOne({ chat_id, ...data }: NewData<ChatMeta>, option?: CreateChatOption): Promise<ChatMeta>;
60
+ updateOne({ chat_id, ...data }: Partial<NewData<ChatMeta>>, option?: CreateChatOption): Promise<ChatMeta>;
61
61
  }
62
62
  declare const MessageListModel_base: (abstract new (...args: any[]) => {
63
63
  stream?: AsyncGenerator<ChatMessage, void, any> | undefined;
@@ -0,0 +1,70 @@
1
+ import { Filter, IDType, ListModel, NewData } from 'mobx-restful';
2
+ import { MailMessage } from './type';
3
+ export * from './type';
4
+ export type MailMessageFilter = Filter<MailMessage> & {
5
+ folder_id?: string;
6
+ only_unread?: boolean;
7
+ };
8
+ declare const MailMessageModel_base: (abstract new (...args: any[]) => {
9
+ stream?: AsyncGenerator<MailMessage, void, any> | undefined;
10
+ openStream(filter: MailMessageFilter): AsyncGenerator<MailMessage, void, any>;
11
+ clearList(): void;
12
+ clear(): void;
13
+ restoreList({ filter, pageIndex, pageSize, allItems, totalCount }?: Partial<Pick<ListModel<MailMessage, Partial<NewData<MailMessage>>>, "filter" | "pageIndex" | "pageSize" | "allItems" | "totalCount">> | undefined): Promise<void>;
14
+ loadStream(filter: MailMessageFilter, newCount: number): Promise<MailMessage[]>;
15
+ loadPage(pageIndex: number, pageSize: number, filter: MailMessageFilter): Promise<{
16
+ pageData: MailMessage[];
17
+ totalCount: number;
18
+ }>;
19
+ pageIndex: number;
20
+ pageSize: number;
21
+ filter: MailMessageFilter;
22
+ totalCount: number;
23
+ pageList: MailMessage[][];
24
+ readonly currentPage: MailMessage[];
25
+ readonly pageCount: number;
26
+ readonly allItems: MailMessage[];
27
+ readonly noMore: boolean;
28
+ statistic: Partial<Record<import("web-utility").TypeKeys<MailMessage, import("web-utility").IndexKey>, Record<string, number>>>;
29
+ turnTo(pageIndex: number, pageSize?: number): ListModel<MailMessage, MailMessageFilter>;
30
+ loadNewPage(pageIndex: number, pageSize: number, filter: MailMessageFilter): Promise<{
31
+ pageData: MailMessage[];
32
+ totalCount: number;
33
+ }>;
34
+ getList(filter?: MailMessageFilter | undefined, pageIndex?: number, pageSize?: number): Promise<MailMessage[]>;
35
+ refreshList(): Promise<MailMessage[]>;
36
+ getAllInStream(filter?: MailMessageFilter | undefined, pageSize?: number): AsyncGenerator<MailMessage, void, unknown>;
37
+ getAll(filter?: MailMessageFilter | undefined, pageSize?: number): Promise<MailMessage[]>;
38
+ countAll(keys: import("web-utility").TypeKeys<MailMessage, import("web-utility").IndexKey>[], filter?: MailMessageFilter | undefined, pageSize?: number): Promise<Partial<Record<import("web-utility").TypeKeys<MailMessage, import("web-utility").IndexKey>, Record<string, number>>>>;
39
+ indexOf(id: IDType): number;
40
+ changeOne(data: Partial<MailMessage>, id: IDType, patch?: boolean): void;
41
+ updateOne(data: Partial<NewData<MailMessage>>, id?: IDType): Promise<MailMessage>;
42
+ removeOne(id: IDType): Promise<void>;
43
+ deleteOne(id: IDType): Promise<void>;
44
+ client: import("mobx-restful").RESTClient;
45
+ baseURI: string;
46
+ indexKey: "message_id" | "smtp_message_id" | "body_plain_text" | "body_html" | "thread_id" | "internal_date" | "subject" | "to" | "cc" | "bcc" | "dedupe_key" | "message_state" | "head_from" | "raw" | "attachments";
47
+ currentOne: MailMessage;
48
+ clearCurrent(): void;
49
+ getOne(id: IDType): Promise<MailMessage>;
50
+ downloading: number;
51
+ uploading: number;
52
+ [Symbol.asyncIterator]: (filter?: MailMessageFilter | undefined, pageSize?: number) => AsyncGenerator<MailMessage, void, unknown>;
53
+ }) & import("web-utility").AbstractClass<ListModel<MailMessage, MailMessageFilter>>;
54
+ export declare abstract class MailMessageModel extends MailMessageModel_base {
55
+ mailboxId: string;
56
+ baseURI: string;
57
+ constructor(mailboxId: string);
58
+ /**
59
+ * @see {@link https://open.feishu.cn/document/mail-v1/user_mailbox-message/list}
60
+ */
61
+ openStream(filter?: MailMessageFilter): AsyncGenerator<MailMessage, void, unknown>;
62
+ /**
63
+ * @see {@link https://open.feishu.cn/document/mail-v1/user_mailbox-message/get}
64
+ */
65
+ getOne(id: IDType): Promise<MailMessage>;
66
+ /**
67
+ * @see {@link https://open.feishu.cn/document/server-docs/mail-v1/user_mailbox-message/send}
68
+ */
69
+ updateOne(mail: Partial<NewData<MailMessage>>): Promise<MailMessage>;
70
+ }
@@ -0,0 +1,27 @@
1
+ export interface MailAddress {
2
+ mail_address: string;
3
+ name?: string;
4
+ }
5
+ export declare enum MailAttachmentType {
6
+ Normal = 1,
7
+ Large = 2
8
+ }
9
+ export interface MailAttachment {
10
+ attachment_type: MailAttachmentType;
11
+ id: string;
12
+ cid?: string;
13
+ filename: string;
14
+ is_inline: boolean;
15
+ }
16
+ export declare enum MailMessageState {
17
+ Received = 1,
18
+ Sent = 2,
19
+ Draft = 3
20
+ }
21
+ export type MailMessage = Record<`${'smtp_' | ''}message_id` | 'thread_id' | 'internal_date' | 'subject' | `body_${'plain_text' | 'html'}`, string> & Record<'to' | 'cc' | 'bcc', MailAddress[]> & {
22
+ dedupe_key?: string;
23
+ message_state: MailMessageState;
24
+ head_from: MailAddress;
25
+ raw?: string;
26
+ attachments: MailAttachment[];
27
+ };
@@ -1,2 +1,2 @@
1
1
  import { DataObject, RESTClient } from 'mobx-restful';
2
- export declare function createPageStream<T extends DataObject>(client: RESTClient, path: string, onCount: (total: number) => any, filter?: DataObject): AsyncGenerator<T, void, unknown>;
2
+ export declare function createPageStream<T = DataObject>(client: RESTClient, path: string, onCount: (total: number) => any, filter?: DataObject): AsyncGenerator<Awaited<T>, void, unknown>;
@@ -1,9 +1,11 @@
1
1
  export * from './base';
2
2
  export * from './User/type';
3
3
  export * from './InstantMessenger';
4
+ export * from './Mail';
4
5
  export * from './Task';
5
6
  export * from './Document';
6
7
  export * from './SpreadSheet';
7
8
  export * from './BITable';
8
9
  export * from './Drive';
9
10
  export * from './Wiki';
11
+ export * from './DocumentAI';
package/dist/type.d.ts CHANGED
@@ -8,7 +8,7 @@ export type LarkData<D extends Record<string, any> = {}, E extends Record<string
8
8
  [key: string]: any;
9
9
  };
10
10
  };
11
- export type LarkPageData<D extends Record<string, any> = {}> = LarkData<{
11
+ export type LarkPageData<D = {}> = LarkData<{
12
12
  page_token: string;
13
13
  items: D[];
14
14
  has_more: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-lark",
3
- "version": "2.6.5",
3
+ "version": "2.8.0",
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.",
@@ -25,9 +25,9 @@
25
25
  "url": "https://github.com/idea2app/MobX-Lark/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@swc/helpers": "^0.5.18",
28
+ "@swc/helpers": "^0.5.20",
29
29
  "@types/react": "^19.2.14",
30
- "koajax": "^3.1.2",
30
+ "koajax": "^3.3.0",
31
31
  "lodash.memoize": "^4.1.2",
32
32
  "mobx": "^6.15.0",
33
33
  "mobx-restful": "^2.1.4",
@@ -42,20 +42,20 @@
42
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": "^24.10.13",
45
+ "@types/node": "^24.12.0",
46
46
  "@types/react-dom": "^19.2.3",
47
47
  "@types/turndown": "^5.0.6",
48
48
  "dotenv": "^17.3.1",
49
- "fs-extra": "^11.3.3",
49
+ "fs-extra": "^11.3.4",
50
50
  "husky": "^9.1.7",
51
- "lint-staged": "^16.2.7",
51
+ "lint-staged": "^16.4.0",
52
52
  "parcel": "~2.16.4",
53
53
  "prettier": "^3.8.1",
54
54
  "react": "^19.2.4",
55
55
  "react-dom": "^19.2.4",
56
56
  "ts-node": "^10.9.2",
57
57
  "turndown": "^7.2.2",
58
- "typedoc": "^0.28.16",
58
+ "typedoc": "^0.28.18",
59
59
  "typedoc-plugin-mdn-links": "^5.1.1",
60
60
  "typescript": "~5.8.3"
61
61
  },
package/src/Lark.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  BiTableSchema,
7
7
  BiTableView,
8
8
  CopiedFile,
9
+ DocumentAIModel,
9
10
  DocumentModel,
10
11
  DriveFileModel,
11
12
  TableFormView,
@@ -51,6 +52,7 @@ export class LarkApp implements LarkAppOption {
51
52
  driveFileStore: DriveFileModel;
52
53
  wikiNodeStore: WikiNodeModel;
53
54
  documentStore: DocumentModel;
55
+ documentAIStore: DocumentAIModel;
54
56
 
55
57
  constructor(option: LarkAppServerOption | LarkAppClientOption) {
56
58
  Object.assign(this, option);
@@ -74,6 +76,9 @@ export class LarkApp implements LarkAppOption {
74
76
  this.documentStore = new (class extends DocumentModel {
75
77
  client = client;
76
78
  })('');
79
+ this.documentAIStore = new (class extends DocumentAIModel {
80
+ client = client;
81
+ })();
77
82
  }
78
83
 
79
84
  private boot() {
@@ -18,7 +18,7 @@ export interface TableFormView
18
18
  extends
19
19
  Record<'name' | 'description' | 'shared_url', string>,
20
20
  Record<'shared' | 'submit_limit_once', boolean> {
21
- shared_limit: 'tenant_editable';
21
+ shared_limit: 'off' | `${'tenant' | 'anyone'}_editable`;
22
22
  }
23
23
 
24
24
  export type LarkFormData = LarkData<{ form: TableFormView }>;
@@ -0,0 +1,61 @@
1
+ import { makeFormData } from 'koajax';
2
+ import { BaseModel, RESTClient, toggle } from 'mobx-restful';
3
+
4
+ import { LarkData } from '../../type';
5
+ import { TaxiInvoice, TrainInvoice, VatInvoice, VehicleInvoice } from './type';
6
+
7
+ export * from './type';
8
+
9
+ export abstract class DocumentAIModel extends BaseModel {
10
+ baseURI = 'document_ai/v1';
11
+
12
+ abstract client: RESTClient;
13
+
14
+ /**
15
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/vat_invoice/recognize}
16
+ */
17
+ @toggle('uploading')
18
+ async recognizeVatInvoices(file: File) {
19
+ const { body } = await this.client.post<
20
+ LarkData<{ vat_invoices: { entities: VatInvoice[] }[] }>
21
+ >(`${this.baseURI}/vat_invoice/recognize`, makeFormData({ file }));
22
+
23
+ return body!.data!.vat_invoices;
24
+ }
25
+
26
+ /**
27
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/taxi_invoice/recognize}
28
+ */
29
+ @toggle('uploading')
30
+ async recognizeTaxiInvoices(file: File) {
31
+ const { body } = await this.client.post<
32
+ LarkData<{ taxi_invoices: { entities: TaxiInvoice[] }[] }>
33
+ >(`${this.baseURI}/taxi_invoice/recognize`, makeFormData({ file }));
34
+
35
+ return body!.data!.taxi_invoices;
36
+ }
37
+
38
+ /**
39
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/train_invoice/recognize}
40
+ */
41
+ @toggle('uploading')
42
+ async recognizeTrainInvoices(file: File) {
43
+ const { body } = await this.client.post<
44
+ LarkData<{ train_invoices: { entities: TrainInvoice[] }[] }>
45
+ >(`${this.baseURI}/train_invoice/recognize`, makeFormData({ file }));
46
+
47
+ return body!.data!.train_invoices;
48
+ }
49
+
50
+ /**
51
+ * @see {@link https://open.feishu.cn/document/ai/document_ai-v1/vehicle_invoice/recognize}
52
+ */
53
+ @toggle('uploading')
54
+ async recognizeVehicleInvoice(file: File) {
55
+ const { body } = await this.client.post<
56
+ LarkData<{ vehicle_invoice: { entities: VehicleInvoice[] } }>
57
+ >(`${this.baseURI}/vehicle_invoice/recognize`, makeFormData({ file }));
58
+
59
+ return body!.data!.vehicle_invoice;
60
+ }
61
+ }
@@ -0,0 +1,69 @@
1
+ export type InvoiceEntityType =
2
+ | `invoice_${'code' | 'no' | 'special_seal'}`
3
+ | `seller_${'name' | 'taxpayer_no'}_in_seal`;
4
+
5
+ export type TrafficInvoiceEntityType = 'total_amount' | 'price';
6
+
7
+ export interface VatInvoice {
8
+ type:
9
+ | InvoiceEntityType
10
+ | `invoice_${'name' | 'date'}`
11
+ | `total_${'price' | 'tax'}`
12
+ | `${'big_' | ''}total_price_and_tax`
13
+ | 'check_code'
14
+ | `buyer_${'name' | 'taxpayer_no' | 'address_phone' | 'account'}`
15
+ | `seller_${'name' | 'taxpayer_no' | 'address_phone' | 'account'}`
16
+ | 'payee'
17
+ | 'password_area'
18
+ | 'remarks'
19
+ | 'reviewer'
20
+ | 'drawer'
21
+ | 'is_sealed'
22
+ | 'machine_num';
23
+ value: string;
24
+ items: Record<'type' | 'value', string>[][];
25
+ }
26
+
27
+ export interface TaxiInvoice {
28
+ type:
29
+ | InvoiceEntityType
30
+ | TrafficInvoiceEntityType
31
+ | 'car_number'
32
+ | 'start_date'
33
+ | `${'start' | 'end'}_time`
34
+ | 'distance'
35
+ | `${'dispatch' | 'additional'}_fee`
36
+ | 'is_sealed'
37
+ | 'title_trial';
38
+ value: string;
39
+ }
40
+
41
+ export interface TrainInvoice {
42
+ type:
43
+ | TrafficInvoiceEntityType
44
+ | 'name'
45
+ | 'id_num'
46
+ | 'time'
47
+ | `${'start' | 'end'}_station`
48
+ | `sale_${'num' | 'station'}`
49
+ | `${'train' | 'seat' | 'ticket'}_num`
50
+ | `seat_${'num' | 'cls'}`;
51
+ value: string;
52
+ }
53
+
54
+ export interface VehicleInvoice {
55
+ type:
56
+ | 'date'
57
+ | `invoice_${'code' | 'num'}`
58
+ | `print_${'code' | 'num'}`
59
+ | `buyer_${'name' | 'id'}`
60
+ | `saler_${'name' | 'id' | 'addr'}`
61
+ | 'vehicle_type'
62
+ | 'product_model'
63
+ | `${'certificate' | 'machine' | 'engine'}_num`
64
+ | 'vin'
65
+ | `tax${'' | '_rate'}`
66
+ | 'price'
67
+ | `total_price${'' | '_little'}`;
68
+ value: string;
69
+ }
@@ -26,7 +26,10 @@ export abstract class ChatListModel extends Stream<ChatMeta>(ListModel) {
26
26
  * @see {@link https://open.feishu.cn/document/server-docs/group/chat/update-2}
27
27
  */
28
28
  @toggle('uploading')
29
- async updateOne({ chat_id, ...data }: NewData<ChatMeta>, option: CreateChatOption = {}) {
29
+ async updateOne(
30
+ { chat_id, ...data }: Partial<NewData<ChatMeta>>,
31
+ option: CreateChatOption = {}
32
+ ) {
30
33
  const { body } = await (chat_id
31
34
  ? this.client.put<LarkData<ChatMeta>>(`${this.baseURI}/${chat_id}`, data)
32
35
  : this.client.post<LarkData<ChatMeta>>(
@@ -0,0 +1,57 @@
1
+ import { Filter, IDType, ListModel, NewData, Stream, toggle } from 'mobx-restful';
2
+
3
+ import { LarkData } from '../../type';
4
+ import { createPageStream } from '../base';
5
+ import { MailMessage } from './type';
6
+
7
+ export * from './type';
8
+
9
+ export type MailMessageFilter = Filter<MailMessage> & {
10
+ folder_id?: string;
11
+ only_unread?: boolean;
12
+ };
13
+
14
+ export abstract class MailMessageModel extends Stream<MailMessage, MailMessageFilter>(ListModel) {
15
+ baseURI = '';
16
+
17
+ constructor(public mailboxId: string) {
18
+ super();
19
+ this.baseURI = `mail/v1/user_mailboxes/${mailboxId}/messages`;
20
+ }
21
+
22
+ /**
23
+ * @see {@link https://open.feishu.cn/document/mail-v1/user_mailbox-message/list}
24
+ */
25
+ async *openStream(filter: MailMessageFilter = { folder_id: 'INBOX' }) {
26
+ const stream = createPageStream<string>(
27
+ this.client,
28
+ this.baseURI,
29
+ total => (this.totalCount = total),
30
+ filter
31
+ );
32
+ for await (const message_id of stream) yield this.getOne(message_id);
33
+ }
34
+
35
+ /**
36
+ * @see {@link https://open.feishu.cn/document/mail-v1/user_mailbox-message/get}
37
+ */
38
+ @toggle('downloading')
39
+ async getOne(id: IDType) {
40
+ const { body } = await this.client.get<LarkData<{ message: MailMessage }>>(
41
+ `${this.baseURI}/${id}`
42
+ );
43
+ return (this.currentOne = body!.data!.message);
44
+ }
45
+
46
+ /**
47
+ * @see {@link https://open.feishu.cn/document/server-docs/mail-v1/user_mailbox-message/send}
48
+ */
49
+ @toggle('uploading')
50
+ async updateOne(mail: Partial<NewData<MailMessage>>) {
51
+ const { body } = await this.client.post<
52
+ LarkData<Record<`${'message' | 'thread'}_id`, string>>
53
+ >(`${this.baseURI}/send`, mail);
54
+
55
+ return (this.currentOne = await this.getOne(body!.data!.message_id));
56
+ }
57
+ }
@@ -0,0 +1,39 @@
1
+ export interface MailAddress {
2
+ mail_address: string;
3
+ name?: string;
4
+ }
5
+
6
+ export enum MailAttachmentType {
7
+ Normal = 1,
8
+ Large = 2
9
+ }
10
+
11
+ export interface MailAttachment {
12
+ attachment_type: MailAttachmentType;
13
+ id: string;
14
+ cid?: string;
15
+ filename: string;
16
+ is_inline: boolean;
17
+ }
18
+
19
+ export enum MailMessageState {
20
+ Received = 1,
21
+ Sent = 2,
22
+ Draft = 3
23
+ }
24
+
25
+ export type MailMessage = Record<
26
+ | `${'smtp_' | ''}message_id`
27
+ | 'thread_id'
28
+ | 'internal_date'
29
+ | 'subject'
30
+ | `body_${'plain_text' | 'html'}`,
31
+ string
32
+ > &
33
+ Record<'to' | 'cc' | 'bcc', MailAddress[]> & {
34
+ dedupe_key?: string;
35
+ message_state: MailMessageState;
36
+ head_from: MailAddress;
37
+ raw?: string;
38
+ attachments: MailAttachment[];
39
+ };
@@ -3,7 +3,7 @@ import { buildURLData } from 'web-utility';
3
3
 
4
4
  import { LarkPageData } from '../type';
5
5
 
6
- export async function* createPageStream<T extends DataObject>(
6
+ export async function* createPageStream<T = DataObject>(
7
7
  client: RESTClient,
8
8
  path: string,
9
9
  onCount: (total: number) => any,
@@ -1,9 +1,11 @@
1
1
  export * from './base';
2
2
  export * from './User/type';
3
3
  export * from './InstantMessenger';
4
+ export * from './Mail';
4
5
  export * from './Task';
5
6
  export * from './Document';
6
7
  export * from './SpreadSheet';
7
8
  export * from './BITable';
8
9
  export * from './Drive';
9
10
  export * from './Wiki';
11
+ export * from './DocumentAI';
package/src/type.ts CHANGED
@@ -10,7 +10,7 @@ export type LarkData<D extends Record<string, any> = {}, E extends Record<string
10
10
  };
11
11
  };
12
12
 
13
- export type LarkPageData<D extends Record<string, any> = {}> = LarkData<{
13
+ export type LarkPageData<D = {}> = LarkData<{
14
14
  page_token: string;
15
15
  items: D[];
16
16
  has_more: boolean;