mobx-lark 2.8.1 → 2.10.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.
@@ -1,3 +1,5 @@
1
+ import { Gender } from '../User/type';
2
+
1
3
  export type InvoiceEntityType =
2
4
  | `invoice_${'code' | 'no' | 'special_seal'}`
3
5
  | `seller_${'name' | 'taxpayer_no'}_in_seal`;
@@ -67,3 +69,189 @@ export interface VehicleInvoice {
67
69
  | `total_price${'' | '_little'}`;
68
70
  value: string;
69
71
  }
72
+
73
+ export interface BankCardEntity {
74
+ type: 'card_number' | 'date_of_expiry';
75
+ value: string;
76
+ }
77
+
78
+ export interface IDCardEntity {
79
+ type:
80
+ | `identity_${'code' | 'name'}`
81
+ | 'birth'
82
+ | 'gender'
83
+ | 'race'
84
+ | 'address'
85
+ | 'issued_by'
86
+ | `valid_date_${'start' | 'end'}`;
87
+ value: string;
88
+ }
89
+
90
+ export enum IDCardSide {
91
+ Cover = 0,
92
+ Profile = 1
93
+ }
94
+
95
+ export interface IDCard {
96
+ entities: IDCardEntity[];
97
+ side: IDCardSide;
98
+ corners: number[];
99
+ }
100
+
101
+ export interface BusinessCardEntity {
102
+ type:
103
+ | `${'contact' | 'company'}_names`
104
+ | 'departments'
105
+ | 'job_titles'
106
+ | 'emails'
107
+ | 'websites'
108
+ | 'addresses'
109
+ | `${'mobile' | 'work' | 'other'}_phones`
110
+ | 'faxes';
111
+ value: string;
112
+ }
113
+
114
+ export interface BusinessCard {
115
+ entities: BusinessCardEntity[];
116
+ }
117
+
118
+ export interface BusinessLicenseEntity {
119
+ type:
120
+ | 'certificate_type'
121
+ | 'unified_social_credit_code'
122
+ | `company_${'name' | 'type'}`
123
+ | 'domicile'
124
+ | 'legal_representative'
125
+ | 'registered_capital'
126
+ | `established_${'time' | 'date'}` // 成立日期、营业期限
127
+ | 'business_scope'
128
+ | 'approval_date'
129
+ | 'website';
130
+ value: string;
131
+ }
132
+
133
+ export interface BusinessLicense {
134
+ entities: BusinessLicenseEntity[];
135
+ }
136
+
137
+ export type ResumePeriod = Record<`${'start' | 'end'}_${'date' | 'time'}`, string>;
138
+
139
+ export enum EducationQualification {
140
+ PrimarySchool = 1,
141
+ JuniorHighSchool = 2,
142
+ VocationalHighSchool = 3,
143
+ HighSchool = 4,
144
+ AssociateDegree = 5,
145
+ BachelorDegree = 6,
146
+ MasterDegree = 7,
147
+ Doctorate = 8,
148
+ Other = 9
149
+ }
150
+
151
+ export interface ResumeEducation
152
+ extends ResumePeriod, Record<'school' | 'major' | 'degree', string> {
153
+ qualification: EducationQualification;
154
+ }
155
+
156
+ export enum CareerType {
157
+ Internship = 1,
158
+ FullTime = 2
159
+ }
160
+
161
+ export interface ResumeCareer
162
+ extends ResumePeriod, Record<'company' | 'title' | 'type_str' | 'job_description', string> {
163
+ type: CareerType;
164
+ }
165
+
166
+ export type ResumeProject = ResumePeriod & Record<'name' | 'title' | 'description', string>;
167
+
168
+ export interface ResumeLanguage {
169
+ level: number;
170
+ description: string;
171
+ }
172
+
173
+ export type ResumeAward = Record<'award' | 'date' | 'description', string>;
174
+
175
+ export type ResumeCertificate = Record<'name' | 'desc', string>;
176
+
177
+ export type ResumeCompetition = ResumeCertificate;
178
+
179
+ export interface Resume
180
+ extends
181
+ Record<
182
+ | 'file_md5'
183
+ | `${'' | 'new_'}content`
184
+ | 'name'
185
+ | 'email'
186
+ | 'mobile'
187
+ | 'country_code'
188
+ | 'date_of_birth'
189
+ | `${'current' | 'home'}_location`
190
+ | 'self_evaluation',
191
+ string
192
+ >,
193
+ Record<`willing_${'positions' | 'locations'}` | 'urls' | 'social_links', string[]> {
194
+ mobile_is_virtual: boolean;
195
+ educations: ResumeEducation[];
196
+ careers: ResumeCareer[];
197
+ projects: ResumeProject[];
198
+ work_year: number | null;
199
+ gender: Gender;
200
+ languages: ResumeLanguage[];
201
+ awards: ResumeAward[];
202
+ certificates: ResumeCertificate[];
203
+ competitions: ResumeCompetition[];
204
+ }
205
+
206
+ export interface ContractPrice {
207
+ contract_price: number;
208
+ contract_price_original: string;
209
+ text: string;
210
+ }
211
+
212
+ export type ContractInitialTerm = Record<`initial_${'time' | 'unit'}`, string>;
213
+
214
+ export interface ContractTime extends Record<
215
+ `${'' | 'original_'}time_${'start' | 'end'}` | `text_${'start' | 'end' | 'initial_term'}`,
216
+ string
217
+ > {
218
+ initial_term: ContractInitialTerm;
219
+ }
220
+
221
+ export interface ContractCopy extends Record<'original_copy' | 'key' | 'text', string> {
222
+ copy_num: number;
223
+ }
224
+
225
+ export type ContractCurrency = Record<`currency_${'name' | 'text'}`, string>;
226
+
227
+ export type ContractBodyType = 'buy' | 'sell' | 'third';
228
+
229
+ export type ContractContact = Record<
230
+ 'contacts' | 'id_number' | 'phone' | 'email' | 'address',
231
+ string
232
+ >;
233
+ export type ContractBodyEntity = ContractContact & Record<'legal_representative' | 'party', string>;
234
+
235
+ export interface ContractBodyInfo {
236
+ body_type: ContractBodyType;
237
+ value: ContractBodyEntity;
238
+ }
239
+
240
+ export type ContractBankType = `${'buy' | 'sell' | 'third' | 'uncertain'}_bank`;
241
+
242
+ export type ContractBankEntity = ContractContact &
243
+ Record<'bank_name' | `account_${'name' | 'number'}` | 'tax_number', string>;
244
+
245
+ export interface ContractBankInfo {
246
+ bank_type: ContractBankType;
247
+ value: ContractBankEntity;
248
+ }
249
+
250
+ export interface Contract extends Record<'file_id' | 'header', string> {
251
+ price: ContractPrice;
252
+ time: ContractTime;
253
+ copy: ContractCopy;
254
+ currency: ContractCurrency;
255
+ body_info: ContractBodyInfo[];
256
+ bank_info: ContractBankInfo[];
257
+ }
@@ -4,7 +4,16 @@ import { buildURLData, splitArray } from 'web-utility';
4
4
 
5
5
  import { LarkData, LarkDocumentPathTypeMap, LarkDocumentType, UploadTargetType } from '../../type';
6
6
  import { UserIdType } from '../User/type';
7
- import { CopiedFile, DriveFile, DriveFileType, TransferOwner, TransferOption } from './type';
7
+ import {
8
+ CopiedFile,
9
+ DriveFile,
10
+ DriveFileType,
11
+ PublicFileType,
12
+ PublicPermission,
13
+ PublicPermissionPatch,
14
+ TransferOption,
15
+ TransferOwner
16
+ } from './type';
8
17
 
9
18
  export * from './type';
10
19
 
@@ -106,6 +115,33 @@ export abstract class DriveFileModel extends BaseListModel<DriveFile> {
106
115
  return body!.data!.file;
107
116
  }
108
117
 
118
+ /**
119
+ * @see {@link https://open.feishu.cn/document/server-docs/docs/permission/permission-public/patch-2}
120
+ */
121
+ @toggle('uploading')
122
+ async updatePublicPermission(
123
+ type: PublicFileType,
124
+ token: string,
125
+ permission: PublicPermissionPatch
126
+ ) {
127
+ const { body } = await this.client.patch<LarkData<{ permission_public: PublicPermission }>>(
128
+ `${this.baseURI}/../v2/permissions/${token}/public?${buildURLData({ type })}`,
129
+ permission
130
+ );
131
+ return body!.data!.permission_public;
132
+ }
133
+
134
+ /**
135
+ * @see {@link https://open.feishu.cn/document/server-docs/docs/permission/permission-public/permission-public-password/create}
136
+ */
137
+ @toggle('uploading')
138
+ async createPublicPassword(type: PublicFileType, token: string) {
139
+ const { body } = await this.client.post<LarkData<{ password: string }>>(
140
+ `${this.baseURI}/permissions/${token}/public/password?${buildURLData({ type })}`
141
+ );
142
+ return body!.data!.password;
143
+ }
144
+
109
145
  /**
110
146
  * @see {@link https://open.feishu.cn/document/server-docs/docs/permission/permission-member/transfer_owner}
111
147
  */
@@ -14,6 +14,38 @@ export type DriveFile = Record<
14
14
  export type CopiedFile = Record<'type' | `${'parent_' | ''}token` | 'name' | 'url', string>;
15
15
 
16
16
  export type DriveFileType = LarkDocumentType | 'minutes' | 'folder' | 'wiki';
17
+ export type PublicFileType = Exclude<DriveFileType, 'folder'>;
18
+
19
+ type PublicEditableLevel = 'view' | 'edit';
20
+ type PublicLinkAccessLevel = 'readable' | 'editable';
21
+ type PublicLinkShareScope = `${'' | 'partner_'}tenant` | 'anyone';
22
+
23
+ export type PublicCommentEntity = `anyone_can_${PublicEditableLevel}`;
24
+ export type PublicPermissionLevel = PublicCommentEntity | 'only_full_access';
25
+ export type PublicShareEntity = 'anyone' | 'same_tenant';
26
+ export type PublicCollaboratorEntity =
27
+ | `collaborator_can_${PublicEditableLevel}`
28
+ | 'collaborator_full_access';
29
+ export type PublicExternalAccessEntity = 'open' | 'closed' | 'allow_share_partner_tenant';
30
+ export type PublicLinkShareEntity = `${PublicLinkShareScope}_${PublicLinkAccessLevel}` | 'closed';
31
+
32
+ export interface PublicPermission {
33
+ external_access_entity: PublicExternalAccessEntity;
34
+ security_entity: PublicPermissionLevel;
35
+ comment_entity: PublicCommentEntity;
36
+ share_entity: PublicShareEntity;
37
+ manage_collaborator_entity: PublicCollaboratorEntity;
38
+ link_share_entity: PublicLinkShareEntity;
39
+ copy_entity: PublicPermissionLevel;
40
+ lock_switch: boolean;
41
+ }
42
+
43
+ export type PublicPermissionPatch = Partial<Omit<PublicPermission, 'lock_switch'>>;
44
+
45
+ export interface PublishedFile {
46
+ permission: PublicPermission;
47
+ password?: string;
48
+ }
17
49
 
18
50
  export interface TransferOwner {
19
51
  member_type: 'email' | 'userid' | 'openid';