@satorijs/adapter-lark 3.10.5 → 3.11.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.
Files changed (119) hide show
  1. package/lib/content.d.ts +2 -1
  2. package/lib/index.cjs +3296 -2387
  3. package/lib/internal.d.ts +4 -4
  4. package/lib/message.d.ts +1 -0
  5. package/lib/types/acs.d.ts +212 -172
  6. package/lib/types/admin.d.ts +331 -291
  7. package/lib/types/aily.d.ts +331 -216
  8. package/lib/types/apaas.d.ts +646 -494
  9. package/lib/types/application.d.ts +559 -458
  10. package/lib/types/approval.d.ts +826 -791
  11. package/lib/types/attendance.d.ts +1094 -994
  12. package/lib/types/auth.d.ts +66 -61
  13. package/lib/types/authen.d.ts +221 -186
  14. package/lib/types/baike.d.ts +258 -233
  15. package/lib/types/base.d.ts +74 -0
  16. package/lib/types/bitable.d.ts +830 -770
  17. package/lib/types/board.d.ts +29 -14
  18. package/lib/types/calendar.d.ts +660 -605
  19. package/lib/types/cardkit.d.ts +149 -134
  20. package/lib/types/compensation.d.ts +84 -49
  21. package/lib/types/contact.d.ts +1279 -1204
  22. package/lib/types/corehr.d.ts +4982 -4526
  23. package/lib/types/directory.d.ts +447 -0
  24. package/lib/types/docs.d.ts +28 -18
  25. package/lib/types/document_ai.d.ts +347 -252
  26. package/lib/types/docx.d.ts +428 -383
  27. package/lib/types/drive.d.ts +1093 -1048
  28. package/lib/types/ehr.d.ts +66 -51
  29. package/lib/types/event.d.ts +16 -6
  30. package/lib/types/helpdesk.d.ts +816 -741
  31. package/lib/types/hire.d.ts +3955 -3589
  32. package/lib/types/human_authentication.d.ts +32 -22
  33. package/lib/types/im.d.ts +1420 -1295
  34. package/lib/types/index.d.ts +1422 -330
  35. package/lib/types/lingo.d.ts +279 -249
  36. package/lib/types/mail.d.ts +1032 -675
  37. package/lib/types/mdm.d.ts +105 -37
  38. package/lib/types/minutes.d.ts +73 -26
  39. package/lib/types/moments.d.ts +23 -13
  40. package/lib/types/okr.d.ts +266 -225
  41. package/lib/types/optical_char_recognition.d.ts +22 -12
  42. package/lib/types/passport.d.ts +58 -48
  43. package/lib/types/payroll.d.ts +210 -53
  44. package/lib/types/performance.d.ts +463 -414
  45. package/lib/types/personal_settings.d.ts +93 -82
  46. package/lib/types/report.d.ts +79 -58
  47. package/lib/types/search.d.ts +265 -235
  48. package/lib/types/security_and_compliance.d.ts +30 -19
  49. package/lib/types/sheets.d.ts +356 -321
  50. package/lib/types/speech_to_text.d.ts +44 -34
  51. package/lib/types/task.d.ts +998 -1087
  52. package/lib/types/tenant.d.ts +25 -15
  53. package/lib/types/translation.d.ts +42 -32
  54. package/lib/types/trust_party.d.ts +81 -0
  55. package/lib/types/vc.d.ts +1218 -1123
  56. package/lib/types/verification.d.ts +11 -6
  57. package/lib/types/wiki.d.ts +270 -235
  58. package/lib/types/workplace.d.ts +58 -38
  59. package/lib/utils.d.ts +2 -2
  60. package/package.json +4 -4
  61. package/src/bot.ts +15 -15
  62. package/src/content.ts +2 -0
  63. package/src/internal.ts +29 -12
  64. package/src/message.ts +76 -24
  65. package/src/types/acs.ts +234 -186
  66. package/src/types/admin.ts +353 -305
  67. package/src/types/aily.ts +375 -233
  68. package/src/types/apaas.ts +754 -568
  69. package/src/types/application.ts +633 -507
  70. package/src/types/approval.ts +914 -872
  71. package/src/types/attendance.ts +1226 -1104
  72. package/src/types/auth.ts +72 -66
  73. package/src/types/authen.ts +233 -191
  74. package/src/types/baike.ts +276 -246
  75. package/src/types/base.ts +93 -0
  76. package/src/types/bitable.ts +966 -894
  77. package/src/types/board.ts +34 -16
  78. package/src/types/calendar.ts +751 -685
  79. package/src/types/cardkit.ts +164 -146
  80. package/src/types/compensation.ts +97 -55
  81. package/src/types/contact.ts +1465 -1375
  82. package/src/types/corehr.ts +5664 -5077
  83. package/src/types/directory.ts +569 -0
  84. package/src/types/docs.ts +31 -19
  85. package/src/types/document_ai.ts +401 -287
  86. package/src/types/docx.ts +492 -438
  87. package/src/types/drive.ts +1266 -1213
  88. package/src/types/ehr.ts +71 -53
  89. package/src/types/event.ts +19 -7
  90. package/src/types/helpdesk.ts +930 -840
  91. package/src/types/hire.ts +4453 -4019
  92. package/src/types/human_authentication.ts +35 -23
  93. package/src/types/im.ts +1626 -1476
  94. package/src/types/index.ts +1532 -346
  95. package/src/types/lingo.ts +299 -263
  96. package/src/types/mail.ts +1231 -779
  97. package/src/types/mdm.ts +122 -39
  98. package/src/types/minutes.ts +88 -28
  99. package/src/types/moments.ts +26 -14
  100. package/src/types/okr.ts +286 -238
  101. package/src/types/optical_char_recognition.ts +25 -13
  102. package/src/types/passport.ts +62 -50
  103. package/src/types/payroll.ts +254 -57
  104. package/src/types/performance.ts +528 -467
  105. package/src/types/personal_settings.ts +101 -89
  106. package/src/types/report.ts +86 -62
  107. package/src/types/search.ts +285 -249
  108. package/src/types/security_and_compliance.ts +33 -21
  109. package/src/types/sheets.ts +421 -379
  110. package/src/types/speech_to_text.ts +48 -36
  111. package/src/types/task.ts +1152 -1260
  112. package/src/types/tenant.ts +29 -17
  113. package/src/types/translation.ts +46 -34
  114. package/src/types/trust_party.ts +110 -0
  115. package/src/types/vc.ts +1397 -1283
  116. package/src/types/verification.ts +13 -7
  117. package/src/types/wiki.ts +293 -251
  118. package/src/types/workplace.ts +65 -41
  119. package/src/utils.ts +7 -6
@@ -1,59 +1,83 @@
1
- import { BlockAccessData, CustomWorkplaceAccessData, WorkplaceAccessData } from '.'
2
- import { Internal, Pagination } from '../internal'
1
+ import * as Lark from '.'
2
+ import { Internal, Paginated, Pagination } from '../internal'
3
3
 
4
4
  declare module '../internal' {
5
5
  interface Internal {
6
- /**
7
- * 获取工作台访问数据
8
- * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_access_data/search
9
- */
10
- searchWorkplaceWorkplaceAccessData(query?: SearchWorkplaceWorkplaceAccessDataQuery): Paginated<WorkplaceAccessData>
11
- /**
12
- * 获取定制工作台访问数据
13
- * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/custom_workplace_access_data/search
14
- */
15
- searchWorkplaceCustomWorkplaceAccessData(query?: SearchWorkplaceCustomWorkplaceAccessDataQuery): Paginated<CustomWorkplaceAccessData>
16
- /**
17
- * 获取定制工作台小组件访问数据
18
- * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_block_access_data/search
19
- */
20
- searchWorkplaceWorkplaceBlockAccessData(query?: SearchWorkplaceWorkplaceBlockAccessDataQuery): Paginated<BlockAccessData>
6
+ workplace: Workplace.Methods
21
7
  }
22
8
  }
23
9
 
24
- export interface SearchWorkplaceWorkplaceAccessDataQuery extends Pagination {
25
- /** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
26
- from_date: string
27
- /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
28
- to_date: string
29
- }
10
+ export namespace Workplace {
11
+ export interface Methods {
12
+ workplaceAccessData: WorkplaceAccessData.Methods
13
+ customWorkplaceAccessData: CustomWorkplaceAccessData.Methods
14
+ workplaceBlockAccessData: WorkplaceBlockAccessData.Methods
15
+ }
30
16
 
31
- export interface SearchWorkplaceCustomWorkplaceAccessDataQuery extends Pagination {
32
- /** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
33
- from_date: string
34
- /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
35
- to_date: string
36
- /** 定制化工作台id.非必填,不填的时候,返回所有定制化工作台数据。 */
37
- custom_workplace_id?: string
38
- }
17
+ export namespace WorkplaceAccessData {
18
+ export interface Methods {
19
+ /**
20
+ * 获取工作台访问数据
21
+ * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_access_data/search
22
+ */
23
+ search(query?: SearchQuery): Paginated<Lark.WorkplaceAccessData>
24
+ }
25
+
26
+ export interface SearchQuery extends Pagination {
27
+ /** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
28
+ from_date: string
29
+ /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
30
+ to_date: string
31
+ }
32
+ }
39
33
 
40
- export interface SearchWorkplaceWorkplaceBlockAccessDataQuery extends Pagination {
41
- /** 数据检索开始时间,精确到日。格式yyyy-MM-dd。 */
42
- from_date: string
43
- /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
44
- to_date: string
45
- /** 小组件id */
46
- block_id?: string
34
+ export namespace CustomWorkplaceAccessData {
35
+ export interface Methods {
36
+ /**
37
+ * 获取定制工作台访问数据
38
+ * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/custom_workplace_access_data/search
39
+ */
40
+ search(query?: SearchQuery): Paginated<Lark.CustomWorkplaceAccessData>
41
+ }
42
+
43
+ export interface SearchQuery extends Pagination {
44
+ /** 数据检索开始时间,精确到日。格式yyyy-MM-dd */
45
+ from_date: string
46
+ /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
47
+ to_date: string
48
+ /** 定制化工作台id.非必填,不填的时候,返回所有定制化工作台数据。 */
49
+ custom_workplace_id?: string
50
+ }
51
+ }
52
+
53
+ export namespace WorkplaceBlockAccessData {
54
+ export interface Methods {
55
+ /**
56
+ * 获取定制工作台小组件访问数据
57
+ * @see https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/workplace-v1/workplace_block_access_data/search
58
+ */
59
+ search(query?: SearchQuery): Paginated<Lark.BlockAccessData>
60
+ }
61
+
62
+ export interface SearchQuery extends Pagination {
63
+ /** 数据检索开始时间,精确到日。格式yyyy-MM-dd。 */
64
+ from_date: string
65
+ /** 数据检索结束时间,精确到日。格式yyyy-MM-dd。 */
66
+ to_date: string
67
+ /** 小组件id */
68
+ block_id?: string
69
+ }
70
+ }
47
71
  }
48
72
 
49
73
  Internal.define({
50
74
  '/workplace/v1/workplace_access_data/search': {
51
- POST: { name: 'searchWorkplaceWorkplaceAccessData', pagination: { argIndex: 0 } },
75
+ POST: { name: 'workplace.workplaceAccessData.search', pagination: { argIndex: 0 } },
52
76
  },
53
77
  '/workplace/v1/custom_workplace_access_data/search': {
54
- POST: { name: 'searchWorkplaceCustomWorkplaceAccessData', pagination: { argIndex: 0 } },
78
+ POST: { name: 'workplace.customWorkplaceAccessData.search', pagination: { argIndex: 0 } },
55
79
  },
56
80
  '/workplace/v1/workplace_block_access_data/search': {
57
- POST: { name: 'searchWorkplaceWorkplaceBlockAccessData', pagination: { argIndex: 0 } },
81
+ POST: { name: 'workplace.workplaceBlockAccessData.search', pagination: { argIndex: 0 } },
58
82
  },
59
83
  })
package/src/utils.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import crypto from 'crypto'
2
2
  import { Context, h, pick, Session, Universal } from '@satorijs/core'
3
3
  import { LarkBot } from './bot'
4
- import { GetImChatResponse, ListChat, Message, User } from './types'
4
+ import { Im, ListChat, Message, User } from './types'
5
5
  import { MessageContent } from './content'
6
+ import { hyphenate } from 'cosmokit'
6
7
 
7
8
  export interface EventHeader<K extends keyof Events> {
8
9
  event_id: string
@@ -291,11 +292,11 @@ export async function adaptSession<C extends Context>(bot: LarkBot<C>, body: Eve
291
292
  }
292
293
  for (const [key, value] of Object.entries(options)) {
293
294
  if (value === true) {
294
- content += ` --${key} 1`
295
+ content += ` --${hyphenate(key)} 1`
295
296
  } else if (value === false) {
296
- content += ` --${key} 0`
297
+ content += ` --${hyphenate(key)} 0`
297
298
  } else {
298
- content += ` --${key} ${toArg(value)}`
299
+ content += ` --${hyphenate(key)} ${toArg(value)}`
299
300
  }
300
301
  }
301
302
  if (body.event.action.input_value) {
@@ -306,7 +307,7 @@ export async function adaptSession<C extends Context>(bot: LarkBot<C>, body: Eve
306
307
  session.channelId = body.event.context.open_chat_id
307
308
  session.guildId = body.event.context.open_chat_id
308
309
  session.userId = body.event.operator.open_id
309
- const chat = await bot.internal.getImChat(session.channelId)
310
+ const chat = await bot.internal.im.chat.get(session.channelId)
310
311
  // TODO: add channel data
311
312
  session.isDirect = chat.chat_mode === 'p2p'
312
313
  }
@@ -387,7 +388,7 @@ export function extractIdType(id: string): ReceiveIdType {
387
388
  return 'user_id'
388
389
  }
389
390
 
390
- export function decodeChannel(channelId: string, guild: GetImChatResponse): Universal.Channel {
391
+ export function decodeChannel(channelId: string, guild: Im.Chat.GetResponse): Universal.Channel {
391
392
  return {
392
393
  id: channelId,
393
394
  type: Universal.Channel.Type.TEXT,