@im-more/dsh-dingtalk 0.0.0-stage → 0.1.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 (292) hide show
  1. package/LICENSE +21 -0
  2. package/cordis.patch.yml +11 -0
  3. package/lib/index.js +2765 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/types/api/alitrip.d.ts +397 -0
  6. package/lib/types/api/alitrip.d.ts.map +1 -0
  7. package/lib/types/api/alitrip.js +21 -0
  8. package/lib/types/api/alitrip.js.map +1 -0
  9. package/lib/types/api/attendance.d.ts +63 -0
  10. package/lib/types/api/attendance.d.ts.map +1 -0
  11. package/lib/types/api/attendance.js +8 -0
  12. package/lib/types/api/attendance.js.map +1 -0
  13. package/lib/types/api/badge.d.ts +233 -0
  14. package/lib/types/api/badge.d.ts.map +1 -0
  15. package/lib/types/api/badge.js +19 -0
  16. package/lib/types/api/badge.js.map +1 -0
  17. package/lib/types/api/blackboard.d.ts +17 -0
  18. package/lib/types/api/blackboard.d.ts.map +1 -0
  19. package/lib/types/api/blackboard.js +6 -0
  20. package/lib/types/api/blackboard.js.map +1 -0
  21. package/lib/types/api/calendar.d.ts +621 -0
  22. package/lib/types/api/calendar.d.ts.map +1 -0
  23. package/lib/types/api/calendar.js +57 -0
  24. package/lib/types/api/calendar.js.map +1 -0
  25. package/lib/types/api/card.d.ts +185 -0
  26. package/lib/types/api/card.d.ts.map +1 -0
  27. package/lib/types/api/card.js +13 -0
  28. package/lib/types/api/card.js.map +1 -0
  29. package/lib/types/api/conference.d.ts +404 -0
  30. package/lib/types/api/conference.d.ts.map +1 -0
  31. package/lib/types/api/conference.js +60 -0
  32. package/lib/types/api/conference.js.map +1 -0
  33. package/lib/types/api/connector.d.ts +79 -0
  34. package/lib/types/api/connector.d.ts.map +1 -0
  35. package/lib/types/api/connector.js +8 -0
  36. package/lib/types/api/connector.js.map +1 -0
  37. package/lib/types/api/contact.d.ts +40 -0
  38. package/lib/types/api/contact.d.ts.map +1 -0
  39. package/lib/types/api/contact.js +9 -0
  40. package/lib/types/api/contact.js.map +1 -0
  41. package/lib/types/api/convFile.d.ts +135 -0
  42. package/lib/types/api/convFile.d.ts.map +1 -0
  43. package/lib/types/api/convFile.js +9 -0
  44. package/lib/types/api/convFile.js.map +1 -0
  45. package/lib/types/api/crm.d.ts +662 -0
  46. package/lib/types/api/crm.d.ts.map +1 -0
  47. package/lib/types/api/crm.js +59 -0
  48. package/lib/types/api/crm.js.map +1 -0
  49. package/lib/types/api/customerService.d.ts +128 -0
  50. package/lib/types/api/customerService.d.ts.map +1 -0
  51. package/lib/types/api/customerService.js +13 -0
  52. package/lib/types/api/customerService.js.map +1 -0
  53. package/lib/types/api/datacenter.d.ts +506 -0
  54. package/lib/types/api/datacenter.d.ts.map +1 -0
  55. package/lib/types/api/datacenter.js +61 -0
  56. package/lib/types/api/datacenter.js.map +1 -0
  57. package/lib/types/api/devicemng.d.ts +161 -0
  58. package/lib/types/api/devicemng.d.ts.map +1 -0
  59. package/lib/types/api/devicemng.js +20 -0
  60. package/lib/types/api/devicemng.js.map +1 -0
  61. package/lib/types/api/diot.d.ts +13 -0
  62. package/lib/types/api/diot.d.ts.map +1 -0
  63. package/lib/types/api/diot.js +4 -0
  64. package/lib/types/api/diot.js.map +1 -0
  65. package/lib/types/api/doc.d.ts +141 -0
  66. package/lib/types/api/doc.d.ts.map +1 -0
  67. package/lib/types/api/doc.js +27 -0
  68. package/lib/types/api/doc.js.map +1 -0
  69. package/lib/types/api/drive.d.ts +88 -0
  70. package/lib/types/api/drive.d.ts.map +1 -0
  71. package/lib/types/api/drive.js +11 -0
  72. package/lib/types/api/drive.js.map +1 -0
  73. package/lib/types/api/edu.d.ts +23 -0
  74. package/lib/types/api/edu.d.ts.map +1 -0
  75. package/lib/types/api/edu.js +4 -0
  76. package/lib/types/api/edu.js.map +1 -0
  77. package/lib/types/api/esign.d.ts +34 -0
  78. package/lib/types/api/esign.d.ts.map +1 -0
  79. package/lib/types/api/esign.js +7 -0
  80. package/lib/types/api/esign.js.map +1 -0
  81. package/lib/types/api/exclusive.d.ts +304 -0
  82. package/lib/types/api/exclusive.d.ts.map +1 -0
  83. package/lib/types/api/exclusive.js +27 -0
  84. package/lib/types/api/exclusive.js.map +1 -0
  85. package/lib/types/api/h3yun.d.ts +438 -0
  86. package/lib/types/api/h3yun.d.ts.map +1 -0
  87. package/lib/types/api/h3yun.js +33 -0
  88. package/lib/types/api/h3yun.js.map +1 -0
  89. package/lib/types/api/hrm.d.ts +215 -0
  90. package/lib/types/api/hrm.d.ts.map +1 -0
  91. package/lib/types/api/hrm.js +20 -0
  92. package/lib/types/api/hrm.js.map +1 -0
  93. package/lib/types/api/im.d.ts +773 -0
  94. package/lib/types/api/im.d.ts.map +1 -0
  95. package/lib/types/api/im.js +72 -0
  96. package/lib/types/api/im.js.map +1 -0
  97. package/lib/types/api/industry.d.ts +118 -0
  98. package/lib/types/api/industry.d.ts.map +1 -0
  99. package/lib/types/api/industry.js +14 -0
  100. package/lib/types/api/industry.js.map +1 -0
  101. package/lib/types/api/jzcrm.d.ts +255 -0
  102. package/lib/types/api/jzcrm.d.ts.map +1 -0
  103. package/lib/types/api/jzcrm.js +18 -0
  104. package/lib/types/api/jzcrm.js.map +1 -0
  105. package/lib/types/api/link.d.ts +73 -0
  106. package/lib/types/api/link.d.ts.map +1 -0
  107. package/lib/types/api/link.js +9 -0
  108. package/lib/types/api/link.js.map +1 -0
  109. package/lib/types/api/live.d.ts +132 -0
  110. package/lib/types/api/live.d.ts.map +1 -0
  111. package/lib/types/api/live.js +13 -0
  112. package/lib/types/api/live.js.map +1 -0
  113. package/lib/types/api/microApp.d.ts +240 -0
  114. package/lib/types/api/microApp.d.ts.map +1 -0
  115. package/lib/types/api/microApp.js +29 -0
  116. package/lib/types/api/microApp.js.map +1 -0
  117. package/lib/types/api/oapi.d.ts +3362 -0
  118. package/lib/types/api/oapi.d.ts.map +1 -0
  119. package/lib/types/api/oapi.js +247 -0
  120. package/lib/types/api/oapi.js.map +1 -0
  121. package/lib/types/api/oauth2.d.ts +115 -0
  122. package/lib/types/api/oauth2.d.ts.map +1 -0
  123. package/lib/types/api/oauth2.js +12 -0
  124. package/lib/types/api/oauth2.js.map +1 -0
  125. package/lib/types/api/pedia.d.ts +186 -0
  126. package/lib/types/api/pedia.d.ts.map +1 -0
  127. package/lib/types/api/pedia.js +13 -0
  128. package/lib/types/api/pedia.js.map +1 -0
  129. package/lib/types/api/project.d.ts +1119 -0
  130. package/lib/types/api/project.d.ts.map +1 -0
  131. package/lib/types/api/project.js +135 -0
  132. package/lib/types/api/project.js.map +1 -0
  133. package/lib/types/api/resident.d.ts +107 -0
  134. package/lib/types/api/resident.d.ts.map +1 -0
  135. package/lib/types/api/resident.js +10 -0
  136. package/lib/types/api/resident.js.map +1 -0
  137. package/lib/types/api/robot.d.ts +256 -0
  138. package/lib/types/api/robot.d.ts.map +1 -0
  139. package/lib/types/api/robot.js +21 -0
  140. package/lib/types/api/robot.js.map +1 -0
  141. package/lib/types/api/rooms.d.ts +256 -0
  142. package/lib/types/api/rooms.d.ts.map +1 -0
  143. package/lib/types/api/rooms.js +23 -0
  144. package/lib/types/api/rooms.js.map +1 -0
  145. package/lib/types/api/serviceGroup.d.ts +176 -0
  146. package/lib/types/api/serviceGroup.d.ts.map +1 -0
  147. package/lib/types/api/serviceGroup.js +15 -0
  148. package/lib/types/api/serviceGroup.js.map +1 -0
  149. package/lib/types/api/storage.d.ts +1241 -0
  150. package/lib/types/api/storage.d.ts.map +1 -0
  151. package/lib/types/api/storage.js +128 -0
  152. package/lib/types/api/storage.js.map +1 -0
  153. package/lib/types/api/swform.d.ts +71 -0
  154. package/lib/types/api/swform.d.ts.map +1 -0
  155. package/lib/types/api/swform.js +8 -0
  156. package/lib/types/api/swform.js.map +1 -0
  157. package/lib/types/api/todo.d.ts +169 -0
  158. package/lib/types/api/todo.d.ts.map +1 -0
  159. package/lib/types/api/todo.js +16 -0
  160. package/lib/types/api/todo.js.map +1 -0
  161. package/lib/types/api/wiki.d.ts +195 -0
  162. package/lib/types/api/wiki.d.ts.map +1 -0
  163. package/lib/types/api/wiki.js +11 -0
  164. package/lib/types/api/wiki.js.map +1 -0
  165. package/lib/types/api/workbench.d.ts +46 -0
  166. package/lib/types/api/workbench.d.ts.map +1 -0
  167. package/lib/types/api/workbench.js +14 -0
  168. package/lib/types/api/workbench.js.map +1 -0
  169. package/lib/types/api/yida.d.ts +1838 -0
  170. package/lib/types/api/yida.d.ts.map +1 -0
  171. package/lib/types/api/yida.js +103 -0
  172. package/lib/types/api/yida.js.map +1 -0
  173. package/lib/types/bot.d.ts +62 -0
  174. package/lib/types/bot.d.ts.map +1 -0
  175. package/lib/types/bot.js +134 -0
  176. package/lib/types/bot.js.map +1 -0
  177. package/lib/types/config.d.ts +47 -0
  178. package/lib/types/config.d.ts.map +1 -0
  179. package/lib/types/config.js +53 -0
  180. package/lib/types/config.js.map +1 -0
  181. package/lib/types/decode.d.ts +36 -0
  182. package/lib/types/decode.d.ts.map +1 -0
  183. package/lib/types/decode.js +200 -0
  184. package/lib/types/decode.js.map +1 -0
  185. package/lib/types/errors.d.ts +77 -0
  186. package/lib/types/errors.d.ts.map +1 -0
  187. package/lib/types/errors.js +249 -0
  188. package/lib/types/errors.js.map +1 -0
  189. package/lib/types/index.d.ts +22 -0
  190. package/lib/types/index.d.ts.map +1 -0
  191. package/lib/types/index.js +22 -0
  192. package/lib/types/index.js.map +1 -0
  193. package/lib/types/internal.d.ts +15 -0
  194. package/lib/types/internal.d.ts.map +1 -0
  195. package/lib/types/internal.js +57 -0
  196. package/lib/types/internal.js.map +1 -0
  197. package/lib/types/media.d.ts +57 -0
  198. package/lib/types/media.d.ts.map +1 -0
  199. package/lib/types/media.js +99 -0
  200. package/lib/types/media.js.map +1 -0
  201. package/lib/types/modes/markdown.d.ts +12 -0
  202. package/lib/types/modes/markdown.d.ts.map +1 -0
  203. package/lib/types/modes/markdown.js +148 -0
  204. package/lib/types/modes/markdown.js.map +1 -0
  205. package/lib/types/modes/shared.d.ts +183 -0
  206. package/lib/types/modes/shared.d.ts.map +1 -0
  207. package/lib/types/modes/shared.js +358 -0
  208. package/lib/types/modes/shared.js.map +1 -0
  209. package/lib/types/request.d.ts +63 -0
  210. package/lib/types/request.d.ts.map +1 -0
  211. package/lib/types/request.js +182 -0
  212. package/lib/types/request.js.map +1 -0
  213. package/lib/types/send.d.ts +38 -0
  214. package/lib/types/send.d.ts.map +1 -0
  215. package/lib/types/send.js +128 -0
  216. package/lib/types/send.js.map +1 -0
  217. package/lib/types/token.d.ts +32 -0
  218. package/lib/types/token.d.ts.map +1 -0
  219. package/lib/types/token.js +62 -0
  220. package/lib/types/token.js.map +1 -0
  221. package/lib/types/transport/stream.d.ts +89 -0
  222. package/lib/types/transport/stream.d.ts.map +1 -0
  223. package/lib/types/transport/stream.js +345 -0
  224. package/lib/types/transport/stream.js.map +1 -0
  225. package/lib/types/transport/webhook.d.ts +54 -0
  226. package/lib/types/transport/webhook.d.ts.map +1 -0
  227. package/lib/types/transport/webhook.js +159 -0
  228. package/lib/types/transport/webhook.js.map +1 -0
  229. package/lib/types/types/index.d.ts +150 -0
  230. package/lib/types/types/index.d.ts.map +1 -0
  231. package/lib/types/types/index.js +43 -0
  232. package/lib/types/types/index.js.map +1 -0
  233. package/package.json +61 -3
  234. package/src/api/.eslintrc.yml +2 -0
  235. package/src/api/alitrip.ts +467 -0
  236. package/src/api/attendance.ts +81 -0
  237. package/src/api/badge.ts +285 -0
  238. package/src/api/blackboard.ts +28 -0
  239. package/src/api/calendar.ts +817 -0
  240. package/src/api/card.ts +215 -0
  241. package/src/api/conference.ts +561 -0
  242. package/src/api/connector.ts +97 -0
  243. package/src/api/contact.ts +56 -0
  244. package/src/api/convFile.ts +166 -0
  245. package/src/api/crm.ts +830 -0
  246. package/src/api/customerService.ts +156 -0
  247. package/src/api/datacenter.ts +672 -0
  248. package/src/api/devicemng.ts +202 -0
  249. package/src/api/diot.ts +19 -0
  250. package/src/api/doc.ts +232 -0
  251. package/src/api/drive.ts +109 -0
  252. package/src/api/edu.ts +30 -0
  253. package/src/api/esign.ts +44 -0
  254. package/src/api/exclusive.ts +372 -0
  255. package/src/api/h3yun.ts +537 -0
  256. package/src/api/hrm.ts +272 -0
  257. package/src/api/im.ts +978 -0
  258. package/src/api/industry.ts +153 -0
  259. package/src/api/jzcrm.ts +304 -0
  260. package/src/api/link.ts +94 -0
  261. package/src/api/live.ts +162 -0
  262. package/src/api/microApp.ts +309 -0
  263. package/src/api/oapi.ts +4083 -0
  264. package/src/api/oauth2.ts +146 -0
  265. package/src/api/pedia.ts +222 -0
  266. package/src/api/project.ts +1519 -0
  267. package/src/api/resident.ts +133 -0
  268. package/src/api/robot.ts +326 -0
  269. package/src/api/rooms.ts +334 -0
  270. package/src/api/serviceGroup.ts +216 -0
  271. package/src/api/storage.ts +1701 -0
  272. package/src/api/swform.ts +94 -0
  273. package/src/api/todo.ts +220 -0
  274. package/src/api/wiki.ts +231 -0
  275. package/src/api/workbench.ts +73 -0
  276. package/src/api/yida.ts +2165 -0
  277. package/src/bot.ts +211 -0
  278. package/src/config.ts +88 -0
  279. package/src/decode.ts +250 -0
  280. package/src/errors.ts +282 -0
  281. package/src/index.ts +82 -0
  282. package/src/internal.ts +60 -0
  283. package/src/media.ts +149 -0
  284. package/src/modes/markdown.ts +173 -0
  285. package/src/modes/shared.ts +473 -0
  286. package/src/request.ts +262 -0
  287. package/src/send.ts +195 -0
  288. package/src/token.ts +72 -0
  289. package/src/transport/stream.ts +436 -0
  290. package/src/transport/webhook.ts +198 -0
  291. package/src/types/index.ts +165 -0
  292. package/README.md +0 -3
@@ -0,0 +1,57 @@
1
+ import { invoke } from "./request.js";
2
+ /**
3
+ * Route table of the migrated REST layer: one entry per generated `Internal.define({...})` block.
4
+ *
5
+ * `isOldApi` selects the version-family transport: the new `api.dingtalk.com/v1.0` endpoints take a version query
6
+ * parameter and the access token in a header, the legacy `oapi.dingtalk.com` ones take `method` + `access_token` as
7
+ * query parameters.
8
+ */
9
+ export class Internal {
10
+ bot;
11
+ constructor(bot) {
12
+ this.bot = bot;
13
+ }
14
+ static define(routes) {
15
+ // One method per generated route; the prototype is the method table the declarations augment.
16
+ const methods = Internal.prototype;
17
+ for (const path in routes) {
18
+ const byMethod = routes[path];
19
+ for (const key in byMethod) {
20
+ const method = key;
21
+ const table = byMethod[method];
22
+ for (const name of Object.keys(table)) {
23
+ const isOldApi = table[name];
24
+ methods[name] = async function (...args) {
25
+ const raw = args.join(', ');
26
+ const url = path.replace(/\{([^}]+)\}/g, () => {
27
+ if (!args.length)
28
+ throw new Error(`too few arguments for ${path}, received ${raw}`);
29
+ return args.shift();
30
+ });
31
+ const config = {};
32
+ if (args.length === 1) {
33
+ if (method === 'GET' || method === 'DELETE') {
34
+ config.params = args[0];
35
+ }
36
+ else {
37
+ config.data = args[0];
38
+ }
39
+ }
40
+ else if (args.length === 2 && method !== 'GET' && method !== 'DELETE') {
41
+ config.data = args[0];
42
+ config.params = args[1];
43
+ }
44
+ else if (args.length > 1) {
45
+ throw new Error(`too many arguments for ${path}, received ${raw}`);
46
+ }
47
+ if (isOldApi) {
48
+ config.params = { method, ...config.params };
49
+ }
50
+ return await invoke(this.bot, isOldApi ? 'oapi' : 'api', method, url, config);
51
+ };
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,OAAO,QAAQ;IACC;IAApB,YAAoB,GAAgB;QAAhB,QAAG,GAAH,GAAG,CAAa;IAAI,CAAC;IAEzC,MAAM,CAAC,MAAM,CAAC,MAA8D;QAC1E,8FAA8F;QAC9F,MAAM,OAAO,GAAG,QAAQ,CAAC,SAA+C,CAAA;QACxE,KAAK,M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AG,IAAI,CAAC,CAAC,CAAC,CAAA;4BACrB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;wBACzB,CAAC;6BAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BAC3B,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,cAAc,GAAG,EAAE,CAAC,CAAA;wBACpE,CAAC;wBACD,IAAI,QAAQ,EAAE,CAAC;4BACb,MAAM,CAAC,MAAM,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;wBAC9C,CAAC;wBACD,OAAO,MAAM,MAAM,CACjB,IAAI,CAAC,GAAG,EACR,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EACzB,MAAM,EACN,GAAG,EACH,MAAM,CACP,CAAA;oBACH,CAAC,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Media: the outbound upload endpoint and the inbound `downloadCode` exchange.
3
+ *
4
+ * DingTalk has a standalone upload (`/media/upload`) whose `media_id` is reusable across chats, so outbound media
5
+ * uploads once per content and the per-kind `sample*` template then carries the id. Inbound media is served from the
6
+ * bot's own `satori:` route: a `downloadCode` is exchanged for a short-lived signed `downloadUrl` at read time, so a
7
+ * message read later still resolves while the code is valid.
8
+ */
9
+ import type { PrepareContext, ResolvedResource, ResourceRef } from '@deepseek-ai/cordis-plugin-im-core';
10
+ import type { DingtalkBot } from './bot.ts';
11
+ /** One answer of `POST /media/upload`. */
12
+ export interface DingtalkMediaUploadAnswer {
13
+ errcode?: number;
14
+ errmsg?: string;
15
+ media_id?: string;
16
+ type?: string;
17
+ created_at?: number;
18
+ }
19
+ /** The platform's upload `type` of a MIME type: `image`, `voice`, `video` or `file`. */
20
+ export declare function mediaTypeOf(mime: string | undefined): string;
21
+ /**
22
+ * Upload one outbound attachment and return its `media_id`.
23
+ *
24
+ * The endpoint is a legacy `oapi` multipart call: the `access_token` rides the query string (the transport adds it) and
25
+ * the `type` + `media` fields are the body.
26
+ *
27
+ * @param bot - the adapter whose credentials and transport the upload uses.
28
+ * @param ref - the unresolved resource.
29
+ * @param ctx - fetch context of the send pipeline.
30
+ * @returns the platform media key.
31
+ */
32
+ export declare function uploadMedia(bot: DingtalkBot, ref: ResourceRef, ctx: PrepareContext): Promise<ResolvedResource>;
33
+ /**
34
+ * Exchange an inbound `downloadCode` for the signed URL of its bytes.
35
+ *
36
+ * The URL is short-lived, so the route calls this per read instead of baking the URL into the decoded element.
37
+ *
38
+ * @param bot - the receiving adapter.
39
+ * @param downloadCode - the code the callback carried.
40
+ * @returns the signed download URL.
41
+ */
42
+ export declare function downloadUrlOf(bot: DingtalkBot, downloadCode: string): Promise<string>;
43
+ /**
44
+ * The `satori:` source of one inbound media element.
45
+ *
46
+ * The platform's own `downloadCode` rides the query string, so a stored message stays readable with no adapter state: a
47
+ * restart, another process of the same profile and a read days later all resolve while the code is valid. The path keeps
48
+ * the message id and the media position, which name the element in a log line or a stored message.
49
+ *
50
+ * @param bot - the receiving adapter.
51
+ * @param messageId - platform message id the element belongs to.
52
+ * @param index - position of the media element in the message content.
53
+ * @param code - the `downloadCode` the route exchanges for a signed URL.
54
+ * @returns the internal URL the host downloads through.
55
+ */
56
+ export declare function mediaSource(bot: DingtalkBot, messageId: string, index: number, code: string): string;
57
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/media.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACZ,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI3C,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM5D;AAeD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,gBAAgB,CAAC,CA8B3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM,CAOR"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Media: the outbound upload endpoint and the inbound `downloadCode` exchange.
3
+ *
4
+ * DingTalk has a standalone upload (`/media/upload`) whose `media_id` is reusable across chats, so outbound media
5
+ * uploads once per content and the per-kind `sample*` template then carries the id. Inbound media is served from the
6
+ * bot's own `satori:` route: a `downloadCode` is exchanged for a short-lived signed `downloadUrl` at read time, so a
7
+ * message read later still resolves while the code is valid.
8
+ */
9
+ import { PlatformError } from '@deepseek-ai/cordis-plugin-im-core';
10
+ import { DingtalkApiError } from "./errors.js";
11
+ import { invoke } from "./request.js";
12
+ /** The platform's upload `type` of a MIME type: `image`, `voice`, `video` or `file`. */
13
+ export function mediaTypeOf(mime) {
14
+ if (mime === undefined)
15
+ return 'file';
16
+ if (mime.startsWith('image/'))
17
+ return 'image';
18
+ if (mime.startsWith('video/'))
19
+ return 'video';
20
+ if (mime.startsWith('audio/'))
21
+ return 'voice';
22
+ return 'file';
23
+ }
24
+ /** File name of a source, for the multipart part of an upload. */
25
+ function fileNameOf(ref, fetchedName, mime) {
26
+ if (ref.meta.name !== undefined && ref.meta.name !== '')
27
+ return ref.meta.name;
28
+ if (fetchedName !== undefined && fetchedName !== '')
29
+ return fetchedName;
30
+ const kind = ref.kind;
31
+ const subtype = mime?.split('/')[1]?.split(';')[0];
32
+ return `dingtalk-${kind}${subtype === undefined ? '' : `.${subtype}`}`;
33
+ }
34
+ /**
35
+ * Upload one outbound attachment and return its `media_id`.
36
+ *
37
+ * The endpoint is a legacy `oapi` multipart call: the `access_token` rides the query string (the transport adds it) and
38
+ * the `type` + `media` fields are the body.
39
+ *
40
+ * @param bot - the adapter whose credentials and transport the upload uses.
41
+ * @param ref - the unresolved resource.
42
+ * @param ctx - fetch context of the send pipeline.
43
+ * @returns the platform media key.
44
+ */
45
+ export async function uploadMedia(bot, ref, ctx) {
46
+ const fetched = await ctx.fetch(ref.src, ctx.signal);
47
+ const mime = ref.meta.mime ?? fetched.mime;
48
+ const name = fileNameOf(ref, fetched.name, mime);
49
+ const form = new FormData();
50
+ form.append('type', mediaTypeOf(mime));
51
+ form.append('media', new Blob([fetched.data], mime === undefined ? {} : { type: mime }), name);
52
+ const answer = await invoke(bot, 'oapi', 'POST', '/media/upload', { data: form, signal: ctx.signal });
53
+ if (answer.media_id === undefined || answer.media_id === '') {
54
+ // The request reached the platform and it accepted the call, but no reusable key came back.
55
+ throw new PlatformError('invalid', 'dingtalk: /media/upload answered without a media_id', { published: 'unknown' });
56
+ }
57
+ return {
58
+ key: answer.media_id,
59
+ extra: { name, ...(mime === undefined ? {} : { mime }) },
60
+ };
61
+ }
62
+ /**
63
+ * Exchange an inbound `downloadCode` for the signed URL of its bytes.
64
+ *
65
+ * The URL is short-lived, so the route calls this per read instead of baking the URL into the decoded element.
66
+ *
67
+ * @param bot - the receiving adapter.
68
+ * @param downloadCode - the code the callback carried.
69
+ * @returns the signed download URL.
70
+ */
71
+ export async function downloadUrlOf(bot, downloadCode) {
72
+ const answer = await bot.internal.robotMessageFileDownload({
73
+ downloadCode,
74
+ robotCode: bot.config.appkey,
75
+ });
76
+ if (answer.downloadUrl === '') {
77
+ throw new DingtalkApiError('dingtalk: messageFiles/download answered without a downloadUrl', { status: 200 });
78
+ }
79
+ return answer.downloadUrl;
80
+ }
81
+ /**
82
+ * The `satori:` source of one inbound media element.
83
+ *
84
+ * The platform's own `downloadCode` rides the query string, so a stored message stays readable with no adapter state: a
85
+ * restart, another process of the same profile and a read days later all resolve while the code is valid. The path keeps
86
+ * the message id and the media position, which name the element in a log line or a stored message.
87
+ *
88
+ * @param bot - the receiving adapter.
89
+ * @param messageId - platform message id the element belongs to.
90
+ * @param index - position of the media element in the message content.
91
+ * @param code - the `downloadCode` the route exchanges for a signed URL.
92
+ * @returns the internal URL the host downloads through.
93
+ */
94
+ export function mediaSource(bot, messageId, index, code) {
95
+ // The id is encoded because it is an opaque platform value: a character the route grammar reserves would otherwise
96
+ // split the path. The query helper encodes the code, which is base64 and may carry `/`, `+` and `=`.
97
+ return bot.getInternalUrl(`/messages/${encodeURIComponent(messageId)}/resources/${index}`, { code });
98
+ }
99
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/media.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAOlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAWrC,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,IAAwB;IAClD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACrC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAA;IAC7C,IAAI,IAAI,CAAC,UAAU,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;IACD,OAAO,MAAM,CAAC,WAAW,CAAA;AAC3B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,GAAgB,EAChB,SAAiB,EACjB,KAAa,EACb,IAAY;IAEZ,mHAAmH;IACnH,qGAAqG;IACrG,OAAO,GAAG,CAAC,cAAc,CACvB,aAAa,kBAAkB,CAAC,SAAS,CAAC,cAAc,KAAK,EAAE,EAC/D,EAAE,IAAI,EAAE,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The single `markdown` mode: DingTalk message markdown.
3
+ *
4
+ * Native tags are the ones DingTalk's markdown subset renders (text, formatting, links, mentions as plain text, headings,
5
+ * lists, quotes, code) plus the media that travels as its own message. Everything else takes the core fallback and is
6
+ * reported as degraded: an ActionCard's buttons are all jump links, so no second mode could carry more.
7
+ */
8
+ import type { Mode } from '@deepseek-ai/cordis-plugin-im-core';
9
+ import type { DingtalkModeTypes } from './shared.ts';
10
+ /** Build the `markdown` mode. */
11
+ export declare function createMarkdownMode(): Mode<DingtalkModeTypes>;
12
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/modes/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAU9D,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,aAAa,CAAA;AAgElE,iCAAiC;AACjC,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAwF5D"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * The single `markdown` mode: DingTalk message markdown.
3
+ *
4
+ * Native tags are the ones DingTalk's markdown subset renders (text, formatting, links, mentions as plain text, headings,
5
+ * lists, quotes, code) plus the media that travels as its own message. Everything else takes the core fallback and is
6
+ * reported as degraded: an ActionCard's buttons are all jump links, so no second mode could carry more.
7
+ */
8
+ import { defineMode, ElementRegistry } from '@deepseek-ai/cordis-plugin-im-core';
9
+ import { assembleDraft, checkDraft, DINGTALK_LIMITS, escape, mediaNode, serializeDraft, } from "./shared.js";
10
+ /** A text node. */
11
+ function text(content) {
12
+ return { type: 'text', content };
13
+ }
14
+ /**
15
+ * Prefix every line of a subtree with the quote marker.
16
+ * @param nodes - rendered children of the quote block.
17
+ * @returns the same content with `> ` at the start of every line.
18
+ */
19
+ function quoteLines(nodes) {
20
+ const quoted = [];
21
+ let atLineStart = true;
22
+ for (const node of nodes) {
23
+ if (node.type === 'break') {
24
+ // A paragraph inside the quote closes its line with a break node, so the next text node starts a line.
25
+ atLineStart = true;
26
+ quoted.push(node);
27
+ continue;
28
+ }
29
+ if (node.type !== 'text') {
30
+ quoted.push(node);
31
+ continue;
32
+ }
33
+ let content = '';
34
+ for (const char of node.content) {
35
+ if (atLineStart && char !== '\n')
36
+ content += '> ';
37
+ content += char;
38
+ atLineStart = char === '\n';
39
+ }
40
+ quoted.push(text(content));
41
+ }
42
+ return quoted;
43
+ }
44
+ /**
45
+ * The rendered children without the leading break a container may add.
46
+ * @param nodes - rendered children.
47
+ * @returns the children, with a leading break removed.
48
+ */
49
+ function withoutLeadingBreaks(nodes) {
50
+ return nodes[0]?.type === 'break' ? nodes.slice(1) : [...nodes];
51
+ }
52
+ /** A block element: one line start, its content, and a closing line break. */
53
+ function block(nodes) {
54
+ return [{ type: 'break' }, ...withoutLeadingBreaks(nodes), { type: 'break' }];
55
+ }
56
+ /** A heading line: `#` repeated for the level, then the content on one line. */
57
+ function heading(level, nodes) {
58
+ return [
59
+ { type: 'break' },
60
+ text(`${'#'.repeat(level)} `),
61
+ ...withoutLeadingBreaks(nodes),
62
+ { type: 'break' },
63
+ ];
64
+ }
65
+ /** Build the `markdown` mode. */
66
+ export function createMarkdownMode() {
67
+ const elements = new ElementRegistry()
68
+ .register('text', (el) => text(escape(el.attrs.content)))
69
+ .register('p', (el, ctx) => block(ctx.render(el.children)))
70
+ .register('br', () => text('\n'))
71
+ .register('b', (el, ctx) => [
72
+ text('**'),
73
+ ...ctx.render(el.children),
74
+ text('**'),
75
+ ])
76
+ .register('i', (el, ctx) => [
77
+ text('*'),
78
+ ...ctx.render(el.children),
79
+ text('*'),
80
+ ])
81
+ .register('a', (el, ctx) => {
82
+ const children = ctx.render(el.children);
83
+ const media = children.filter((node) => node.type === 'media');
84
+ const body = children.filter((node) => node.type === 'text');
85
+ // A link carries a label; a media element wrapped by one leaves the text run and keeps the URL as its label.
86
+ const label = body.length === 0 ? [text(escape(el.attrs.href))] : body;
87
+ return [
88
+ text('['),
89
+ ...label,
90
+ text(`](${encodeURI(el.attrs.href)})`),
91
+ ...media,
92
+ ];
93
+ })
94
+ .register('at', (el) => text(`@${el.attrs.id ?? ''}`), {
95
+ variants: ['user'],
96
+ })
97
+ .register('h1', (el, ctx) => heading(1, ctx.render(el.children)))
98
+ .register('h2', (el, ctx) => heading(2, ctx.render(el.children)))
99
+ .register('h3', (el, ctx) => heading(3, ctx.render(el.children)))
100
+ .register('h4', (el, ctx) => heading(4, ctx.render(el.children)))
101
+ .register('h5', (el, ctx) => heading(5, ctx.render(el.children)))
102
+ .register('h6', (el, ctx) => heading(6, ctx.render(el.children)))
103
+ .register('ul', (el, ctx) => block(ctx.render(el.children)))
104
+ .register('ol', (el, ctx) => block(ctx.render(el.children)))
105
+ .register('li', (el, ctx) => {
106
+ const parent = ctx.ancestors[ctx.ancestors.length - 1];
107
+ // DingTalk's client numbers an ordered list itself, so every item is written as `1. ` (the upstream encoder's
108
+ // choice); an unordered item gets a dash.
109
+ const marker = parent?.type === 'ol' ? '1. ' : '- ';
110
+ return [
111
+ { type: 'break' },
112
+ text(marker),
113
+ ...withoutLeadingBreaks(ctx.render(el.children)),
114
+ { type: 'break' },
115
+ ];
116
+ })
117
+ .register('blockquote', (el, ctx) => block(quoteLines(ctx.render(el.children))))
118
+ .register('code', (el, ctx) => [
119
+ // Markdown is not parsed inside code, so its text stays unescaped; a backtick would close the span early.
120
+ text(`\`${ctx.text(el.children).replaceAll('`', '\u200B')}\``),
121
+ ])
122
+ .register('pre', (el, ctx) => [
123
+ { type: 'break' },
124
+ text(`\`\`\`${el.attrs.lang ?? ''}\n`),
125
+ // As with inline code, a fenced block carries the text as written; markup escaping would show in the code.
126
+ text(ctx.text(el.children)),
127
+ text('\n```'),
128
+ { type: 'break' },
129
+ ], { variants: ['lang'] })
130
+ .register('img', (el, ctx) => mediaNode(el, ctx), {
131
+ variants: ['inline'],
132
+ })
133
+ .register('audio', (el, ctx) => mediaNode(el, ctx))
134
+ .register('video', (el, ctx) => mediaNode(el, ctx))
135
+ .register('file', (el, ctx) => mediaNode(el, ctx));
136
+ return defineMode()({
137
+ id: 'markdown',
138
+ elements,
139
+ limits: {
140
+ 'limit.payload.bytes': DINGTALK_LIMITS.payloadBytes,
141
+ 'limit.delete.window': DINGTALK_LIMITS.deleteWindowMs,
142
+ },
143
+ assemble: (nodes) => assembleDraft(nodes),
144
+ serialize: (prepared, ctx) => serializeDraft(prepared, ctx),
145
+ check: (draft) => checkDraft(draft),
146
+ });
147
+ }
148
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../src/modes/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAGhF,OAAO,EACL,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,cAAc,GACf,MAAM,aAAa,CAAA;AAGpB,mBAAmB;AACnB,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAClC,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,KAA8B;IAChD,MAAM,MAAM,GAAmB,EAAE,CAAA;IACjC,IAAI,WAAW,GAAG,IAAI,C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AAS,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;SACpE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAmB,EAAE,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA;IAErE,OAAO,UAAU,EAAqB,CAAC;QACrC,EAAE,EAAE,UAAU;QACd,QAAQ;QACR,MAAM,EAAE;YACN,qBAAqB,EAAE,eAAe,CAAC,YAAY;YACnD,qBAAqB,EAAE,eAAe,CAAC,cAAc;SACtD;QACD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC;QACzC,SAAS,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC;QAC3D,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;KACpC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Nodes, drafts, payloads and text rules of the single `markdown` mode.
3
+ *
4
+ * DingTalk renders one body per outgoing message from `msgKey` + `msgParam`, and a message carries at most one media
5
+ * item, so media leaves the text run and becomes a message of its own (as the upstream encoder did by splitting an image
6
+ * out of the markdown).
7
+ */
8
+ import type { LimitViolation, ModeTypes, Prepared, RenderContext, ResourceKind, ResourceRef, SerializeContext } from '@deepseek-ai/cordis-plugin-im-core';
9
+ import type { Element } from '@deepseek-ai/satori-element';
10
+ /** Zero-width non-joiner: a body the platform accepts where the content is empty. */
11
+ export declare const ZERO_WIDTH = "\u2060";
12
+ /** Media kinds DingTalk's `sample*` templates distinguish; one per core resource kind. */
13
+ export type DingtalkMediaKind = ResourceKind;
14
+ /** One media attachment lifted out of the text run. */
15
+ export interface DingtalkMedia {
16
+ kind: DingtalkMediaKind;
17
+ ref: ResourceRef;
18
+ /** `name` attribute of the element, for the file-name field. */
19
+ name?: string;
20
+ /** `duration` attribute of the element, in milliseconds, passed through as the platform's string. */
21
+ duration?: number;
22
+ }
23
+ /** One node a mode handler produces. */
24
+ export type DingtalkNode = {
25
+ type: 'text';
26
+ content: string;
27
+ }
28
+ /** A line break that closes the current line; no effect when the run already ends one. */
29
+ | {
30
+ type: 'break';
31
+ } | {
32
+ type: 'media';
33
+ media: DingtalkMedia;
34
+ };
35
+ /** One platform message before resource resolution. */
36
+ export type DingtalkDraft = {
37
+ kind: 'text';
38
+ text: string;
39
+ } | {
40
+ kind: 'media';
41
+ media: DingtalkMedia;
42
+ };
43
+ /**
44
+ * Exact request data of one platform message.
45
+ *
46
+ * `msgParam` is the platform's template body; the generated send layer stringifies it and puts it into `msgParam` of the
47
+ * request. It is not flattened here: the transport needs the object to measure the byte limit.
48
+ */
49
+ export type DingtalkPayload = {
50
+ kind: 'text';
51
+ msgKey: 'sampleMarkdown';
52
+ msgParam: {
53
+ title: string;
54
+ text: string;
55
+ };
56
+ } | {
57
+ kind: 'image';
58
+ msgKey: 'sampleImageMsg';
59
+ msgParam: {
60
+ photoURL: string;
61
+ };
62
+ } | {
63
+ kind: 'audio';
64
+ msgKey: 'sampleAudio';
65
+ msgParam: {
66
+ mediaId: string;
67
+ duration: string;
68
+ };
69
+ } | {
70
+ kind: 'video';
71
+ msgKey: 'sampleVideo';
72
+ msgParam: {
73
+ duration: string;
74
+ videoMediaId: string;
75
+ videoType: string;
76
+ picMediaId?: string;
77
+ };
78
+ } | {
79
+ kind: 'file';
80
+ msgKey: 'sampleFile';
81
+ msgParam: {
82
+ mediaId: string;
83
+ fileName: string;
84
+ fileType: string;
85
+ };
86
+ };
87
+ /** Mode types of the `markdown` mode. */
88
+ export interface DingtalkModeTypes extends ModeTypes {
89
+ node: DingtalkNode;
90
+ draft: DingtalkDraft;
91
+ payload: DingtalkPayload;
92
+ }
93
+ /** The two bounds the platform documents, and nothing else. */
94
+ export declare const DINGTALK_LIMITS: {
95
+ /**
96
+ * `msgParam` is capped at 15000 bytes ("长度限制 15000 字节以内"). The adapter measures the UTF-8 bytes of the JSON
97
+ * body it sends; a platform that counted characters instead would only make an accepted body shorter.
98
+ */
99
+ readonly payloadBytes: 15000;
100
+ /** A single-chat message can be recalled within 24 hours; the group endpoint documents no other window. */
101
+ readonly deleteWindowMs: number;
102
+ };
103
+ /**
104
+ * Escape text so DingTalk markdown renders it literally.
105
+ *
106
+ * Four rules, identical to the upstream encoder's: a markup character gets a zero-width space, markdown punctuation
107
+ * gets a backslash, a list marker after a space is broken up, and four leading spaces (a code block) are replaced.
108
+ *
109
+ * @param text - the text of a `text` element.
110
+ * @returns the text to append to the markdown body.
111
+ */
112
+ export declare function escape(text: string): string;
113
+ /**
114
+ * Undo {@link escape}.
115
+ *
116
+ * DingTalk never echoes what the adapter sent, so this exists for the inbound side and to keep a round trip of the
117
+ * upstream rules testable.
118
+ *
119
+ * @param text - escaped text.
120
+ * @returns the text as it was written.
121
+ */
122
+ export declare function unescape(text: string): string;
123
+ /**
124
+ * The `title` the `sampleMarkdown` template requires.
125
+ *
126
+ * The error table names `miss.param.markdownTotitle`, so the field is sent even though the upstream adapter left it
127
+ * out: the first non-empty line, its markdown notation removed, cut to 40 characters.
128
+ *
129
+ * @param text - the body of the draft, before the paragraph newlines are doubled.
130
+ * @returns the title, or a zero-width body when the message has no visible text.
131
+ */
132
+ export declare function titleOf(text: string): string;
133
+ /**
134
+ * Media element → the node of its own platform message.
135
+ *
136
+ * A DingTalk message carries one media item, so media never stays inside a text run. Media that stood in phrasing
137
+ * content (`<p>`, a heading, a link, an inline wrapper) is reported as `moved`: the caller sees the text plus an extra
138
+ * media message instead of one block.
139
+ *
140
+ * @param el - one of `img`/`audio`/`video`/`file`.
141
+ * @param ctx - render context of the mode.
142
+ * @returns the media node, published after the text run it was found in.
143
+ */
144
+ export declare function mediaNode(el: Element<'img'> | Element<'audio'> | Element<'video'> | Element<'file'>, ctx: RenderContext<DingtalkModeTypes>): DingtalkNode;
145
+ /**
146
+ * Fold a node stream into platform messages: a text draft per run, and one draft per media item.
147
+ *
148
+ * DingTalk sends one media item per message, so a run of text followed by an image is two platform messages; the run is
149
+ * split rather than merged into the image, because no template carries both.
150
+ *
151
+ * @param nodes - rendered nodes, in source order.
152
+ * @returns at least one draft; empty content yields an empty text draft.
153
+ */
154
+ export declare function assembleDraft(nodes: readonly DingtalkNode[]): DingtalkDraft[];
155
+ /**
156
+ * The `fileType` field of `sampleFile`.
157
+ * @param name - file name of the attachment.
158
+ * @param mime - MIME type the upload detected.
159
+ * @returns the extension of the name, else the MIME subtype, else `file`.
160
+ */
161
+ export declare function fileTypeOf(name: string | undefined, mime: string | undefined): string;
162
+ /**
163
+ * Build the request payload of one draft.
164
+ *
165
+ * The paragraph newlines are doubled here and nowhere else: `assemble` keeps single newlines, so a text that already
166
+ * contains them cannot be doubled twice.
167
+ *
168
+ * @param prepared - the draft with every resource resolved.
169
+ * @param _ctx - serialize context (the adapter needs nothing from it; quotes are not rendered, see the design).
170
+ * @returns the exact `msgKey` + `msgParam` pair of the message.
171
+ */
172
+ export declare function serializeDraft(prepared: Prepared<DingtalkDraft>, _ctx: SerializeContext): DingtalkPayload;
173
+ /**
174
+ * Hard platform limits of one draft, checked before any request.
175
+ *
176
+ * Only `msgParam` can fail: a text body over 15000 bytes is refused by the platform, and truncating it would silently
177
+ * drop model output. A media item's `msgParam` is a handful of ids and never reaches the bound.
178
+ *
179
+ * @param draft - the assembled draft.
180
+ * @returns every violation the platform would refuse.
181
+ */
182
+ export declare function checkDraft(draft: DingtalkDraft): LimitViolation[];
183
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/modes/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EACjB,MAAM,oCAAoC,CAAA;AAE3C,OAAO,KAAK,EAAE,OAA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