@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
package/lib/index.js ADDED
@@ -0,0 +1,2765 @@
1
+ import { Adapter, ElementRegistry, PlatformError, Status, defineMode, h, normalize } from "@deepseek-ai/cordis-plugin-im-core";
2
+ import z from "@deepseek-ai/schemastery";
3
+ import { isPhrasingContainer } from "@deepseek-ai/satori-element";
4
+ import { createHmac, timingSafeEqual } from "node:crypto";
5
+ // \0rolldown/runtime.js
6
+ var __defProp = Object.defineProperty;
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
14
+ return target;
15
+ };
16
+ // lib/types/errors.js
17
+ /**
18
+ * Platform failures of the DingTalk REST surface and their mapping onto the core taxonomy.
19
+ *
20
+ * DingTalk answers failures in three forms: an HTTP 4xx with `{ code, message, requestid }` (the `/v1.0/*` endpoints), an
21
+ * HTTP 200 with `{ errcode, errmsg }` (the legacy `oapi` endpoints, such as the media upload), and an HTML page from
22
+ * the IP-dimension rate limiter. Only an explicit platform refusal may be reported as `published: 'no'`.
23
+ */
24
+ /** One failed DingTalk call, with the fields `classify` needs. */
25
+ var DingtalkApiError = class extends Error {
26
+ status;
27
+ code;
28
+ requestid;
29
+ bodyText;
30
+ nonJson;
31
+ constructor(message, init = {}) {
32
+ super(message, init.cause === void 0 ? void 0 : { cause: init.cause });
33
+ this.name = "DingtalkApiError";
34
+ this.status = init.status;
35
+ this.code = init.code;
36
+ this.requestid = init.requestid;
37
+ this.bodyText = init.bodyText;
38
+ this.nonJson = init.nonJson ?? false;
39
+ }
40
+ };
41
+ const RATE_LIMIT = {
42
+ kind: "rate-limit",
43
+ published: "no"
44
+ };
45
+ const LIMIT = {
46
+ kind: "limit",
47
+ published: "no"
48
+ };
49
+ const PERMISSION = {
50
+ kind: "permission",
51
+ published: "no"
52
+ };
53
+ const NOT_FOUND = {
54
+ kind: "not-found",
55
+ published: "no"
56
+ };
57
+ const INVALID = {
58
+ kind: "invalid",
59
+ published: "no"
60
+ };
61
+ /** The platform reports an unknown send result: it may or may not have published, so the outcome stays open. */
62
+ const INVALID_UNKNOWN = {
63
+ kind: "invalid",
64
+ published: "unknown"
65
+ };
66
+ const RETRYABLE = {
67
+ kind: "retryable",
68
+ published: "unknown"
69
+ };
70
+ /**
71
+ * Codes of the documented error tables of `groupMessages/send`, `oToMessages/batchSend` and `groupMessages/recall`
72
+ * (three near-identical tables), plus the shared frequency-limit codes and the legacy `oapi` errcodes.
73
+ */
74
+ const CODE_VERDICTS = [
75
+ [RATE_LIMIT, [
76
+ "send.too.fast",
77
+ "send.byToken.tooFast",
78
+ "too.many.group",
79
+ "too.many.people",
80
+ "90018",
81
+ "90006",
82
+ "90002",
83
+ "Forbidden.AccessDenied.QpsLimitForAppkeyAndApi"
84
+ ]],
85
+ [LIMIT, [
86
+ "invalidParameter.msgParam.tooLong",
87
+ "invalidParameter.userIds.overMax",
88
+ "invalidParameter.processQueryKeys.overMax"
89
+ ]],
90
+ [PERMISSION, [
91
+ "InvalidAuthentication",
92
+ "invalidParameter.token.invalid",
93
+ "Forbidden.AccessDenied.AccessTokenInvalid",
94
+ "send.forbidden",
95
+ "bot.forbidden.sendMessage",
96
+ "unauthorized",
97
+ "auth.error",
98
+ "not.allowed.robotCode",
99
+ "ip.not.match",
100
+ "keywords.not.match",
101
+ "sign.not.match",
102
+ "only.groupAdmin.canAtAll",
103
+ "conversation.org.notMatch"
104
+ ]],
105
+ [NOT_FOUND, [
106
+ "invalidParameter.robotCode.empty",
107
+ "invalidParameter.robotCode.missing",
108
+ "invalidParameter.robotCode.invalid",
109
+ "invalidParameter.robotCode.notExsit",
110
+ "invalidParameter.robotCode.auth",
111
+ "invalidParameter.robotCode.coolApp",
112
+ "template.not.existed",
113
+ "template.stopped",
114
+ "bot.stopped",
115
+ "resource.not.found",
116
+ "resource.unavailable",
117
+ "notFound.robotCode",
118
+ "invalid.openConversationId",
119
+ "miss.openConversationId",
120
+ "group.disbanded",
121
+ "staffId.notExisted",
122
+ "robot.oto.notExist",
123
+ "chatbotId.notAllow.sendOTO",
124
+ "invalidParameter.processQueryKey.missing",
125
+ "invalid.processQueryKey",
126
+ "session.notExisted",
127
+ "session.expired",
128
+ "token.notExisted"
129
+ ]],
130
+ [INVALID, [
131
+ "invalidParameter.msgKey.empty",
132
+ "invalidParameter.msgKey.invalid",
133
+ "invalidParameter.msg.unsupport",
134
+ "invalidParameter.msgParam.invalid",
135
+ "invalidParameter.msgBody.invalid",
136
+ "invalidParameter.param.invalid",
137
+ "contain.unsafe.url",
138
+ "contain.notAllowed.text",
139
+ "contain.notAllowed.picture",
140
+ "contain.notAllowed.content"
141
+ ]],
142
+ [INVALID_UNKNOWN, ["unknown.send.result"]],
143
+ [RETRYABLE, ["system.error", "send.ding.exception"]]
144
+ ];
145
+ /** Code prefixes whose whole family has one verdict (`miss.param.*`, `invalid.param.actionCard*`, `4xxxx` errcodes). */
146
+ const CODE_PREFIX_VERDICTS = [[INVALID, "miss.param."], [INVALID, "invalid.param.actionCard"]];
147
+ const EXACT_CODES = new Map(CODE_VERDICTS.flatMap(([verdict, codes]) => codes.map((code) => [code, verdict])));
148
+ /**
149
+ * Verdict of one platform code, if the tables cover it.
150
+ * @param code - `code` of a `/v1.0/*` answer or `errcode` of an `oapi` one.
151
+ * @returns its classification, or undefined for a code this adapter does not know.
152
+ */
153
+ function verdictOfCode(code) {
154
+ const exact = EXACT_CODES.get(code);
155
+ if (exact !== void 0) return exact;
156
+ for (const [verdict, prefix] of CODE_PREFIX_VERDICTS) if (code.startsWith(prefix)) return verdict;
157
+ if (/^400\d{2}$/.test(code)) return INVALID;
158
+ }
159
+ /** Codes that name the application credentials rather than a policy the caller can fix. */
160
+ const AUTH_CODES = /* @__PURE__ */ new Set([
161
+ "InvalidAuthentication",
162
+ "invalidParameter.token.invalid",
163
+ "Forbidden.AccessDenied.AccessTokenInvalid"
164
+ ]);
165
+ /** Whether a failed call means the access token was refused, so the token is re-minted and the call retried once. */
166
+ function isAuthFailure(error) {
167
+ if (!(error instanceof DingtalkApiError)) return false;
168
+ if (error.status === 401) return true;
169
+ return error.code !== void 0 && AUTH_CODES.has(String(error.code));
170
+ }
171
+ const CREDENTIAL_CODES = /* @__PURE__ */ new Set([
172
+ ...AUTH_CODES,
173
+ "invalidClientIdOrSecret",
174
+ "invalidClientId",
175
+ "invalidClientSecret",
176
+ "app.not.found"
177
+ ]);
178
+ /**
179
+ * Whether a failed Stream registration names the configured credentials themselves.
180
+ *
181
+ * Such a refusal cannot be fixed by reconnecting: the loop stops and the bot reports the error until the profile is
182
+ * edited.
183
+ *
184
+ * @param error - the caught failure.
185
+ * @returns true for a credential code such as `invalidClientIdOrSecret`.
186
+ */
187
+ function isCredentialRefusal(error) {
188
+ return error instanceof DingtalkApiError && error.code !== void 0 && CREDENTIAL_CODES.has(String(error.code));
189
+ }
190
+ /**
191
+ * Whether a failed Stream registration is an authentication or authorisation refusal.
192
+ *
193
+ * A refusal without a credential code may be transient (a gateway hiccup, a rate-limited gateway), so the loop keeps
194
+ * retrying; a run of them means the credentials are wrong.
195
+ *
196
+ * @param error - the caught failure.
197
+ * @returns true for a 401/403 answer or a credential code.
198
+ */
199
+ function isAuthRefusal(error) {
200
+ return error instanceof DingtalkApiError && (error.status === 401 || error.status === 403 || isCredentialRefusal(error));
201
+ }
202
+ /** The verdict of a failed call: the code table first, then the HTTP status, then an assumed transient failure. */
203
+ function verdictOf(error) {
204
+ if (error.nonJson) return RETRYABLE;
205
+ if (error.code !== void 0) {
206
+ const verdict = verdictOfCode(String(error.code));
207
+ if (verdict !== void 0) return verdict;
208
+ }
209
+ if (error.status === 429) return RATE_LIMIT;
210
+ if (error.status === 401 || error.status === 403) return PERMISSION;
211
+ if (error.status === 404) return NOT_FOUND;
212
+ if (error.status !== void 0 && error.status >= 400 && error.status < 500) return INVALID;
213
+ return RETRYABLE;
214
+ }
215
+ /**
216
+ * Map any failure onto the core platform taxonomy.
217
+ *
218
+ * A transport failure, a 5xx answer or a non-JSON answer leaves the outcome open: the request may have reached the
219
+ * platform. Only a documented refusal is reported as unpublished.
220
+ *
221
+ * @param error - the caught failure.
222
+ * @returns the classified platform error.
223
+ */
224
+ function classifyDingtalkError(error) {
225
+ if (error instanceof PlatformError) return error;
226
+ if (error instanceof DingtalkApiError) {
227
+ const verdict = verdictOf(error);
228
+ return new PlatformError(verdict.kind, error.message, {
229
+ ...error.code === void 0 ? {} : { code: error.code },
230
+ published: verdict.published,
231
+ cause: error
232
+ });
233
+ }
234
+ if (error instanceof Error && error.name === "AbortError") return new PlatformError("fatal", error.message, {
235
+ published: "unknown",
236
+ cause: error
237
+ });
238
+ const message = error instanceof Error ? error.message : String(error);
239
+ return new PlatformError("retryable", `dingtalk request failed: ${message}`, {
240
+ published: "unknown",
241
+ cause: error
242
+ });
243
+ }
244
+ // lib/types/request.js
245
+ /**
246
+ * The two-root transport every DingTalk REST call shares: URL and version resolution, access-token authentication,
247
+ * envelope unwrapping, and the failure an `errors.ts` verdict classifies.
248
+ *
249
+ * The typed method surface lives on `Internal`; the generated route table calls {@link invoke}, so the migrated layer
250
+ * and the hand-written calls (the Stream registration, the media upload) cannot diverge in authentication or failure
251
+ * handling.
252
+ */
253
+ /**
254
+ * Endpoints that authenticate with the application credentials in their own body, because they mint the token every
255
+ * other `/v1.0/*` call carries. The generated route table keys them without the version segment.
256
+ */
257
+ const CREDENTIAL_PATHS = /* @__PURE__ */ new Set(["/oauth2/accessToken"]);
258
+ /** How much of a non-JSON body is kept in the error and the log; enough to recognise a gateway page. */
259
+ const BODY_PREFIX_BYTES = 512;
260
+ /** One JSON object, when the value is a plain object. */
261
+ function asRecord(value) {
262
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
263
+ }
264
+ /** Message of any caught value, for a log line. */
265
+ function messageOf$3(error) {
266
+ return error instanceof Error ? error.message : String(error);
267
+ }
268
+ /**
269
+ * The full request URL of one endpoint.
270
+ *
271
+ * The generated route table keys paths without the version segment (`/robot/groupMessages/send`), while the
272
+ * hand-written calls name the version root themselves (`/v1.0/gateway/connections/open`); both resolve here.
273
+ *
274
+ * @param config - the adapter configuration holding both roots.
275
+ * @param base - which root the path belongs to.
276
+ * @param path - endpoint path.
277
+ * @returns the absolute request URL.
278
+ */
279
+ function endpointOf(config, base, path) {
280
+ if (base === "oapi") return `${config.oapiBaseUrl.replace(/\/+$/, "")}${path}`;
281
+ return `${config.apiBaseUrl.replace(/\/+$/, "")}${path.startsWith("/v1.0/") ? path : `/v1.0${path}`}`;
282
+ }
283
+ /**
284
+ * Whether a failed `ctx.http` call was the caller's cancellation rather than a transport failure.
285
+ * @param cause - the value `ctx.http` rejected with.
286
+ * @param signal - the call's signal.
287
+ * @returns true when the caller cancelled the request.
288
+ */
289
+ function isCancellation(cause, signal) {
290
+ if (signal?.aborted === true) return true;
291
+ if ((cause instanceof Error || cause instanceof DOMException) && cause.name === "AbortError") return true;
292
+ return signal?.reason !== void 0 && cause === signal.reason;
293
+ }
294
+ /** A cancelled request rejects with the signal's reason, so the classifier sees the cancellation itself. */
295
+ function cancellation(cause, signal) {
296
+ return signal?.aborted === true ? signal.reason : cause;
297
+ }
298
+ /**
299
+ * The access token of one request, or undefined for the endpoints that mint it.
300
+ * @param bot - the adapter whose token cache the call uses.
301
+ * @param base - which root the request uses.
302
+ * @param path - the endpoint path.
303
+ * @returns the token to carry, if the endpoint needs one.
304
+ */
305
+ async function authorization(bot, base, path) {
306
+ if (base === "api") {
307
+ const endpoint = path.startsWith("/v1.0/") ? path.slice(5) : path;
308
+ if (CREDENTIAL_PATHS.has(endpoint)) return void 0;
309
+ if (bot.tokens.minting) return void 0;
310
+ }
311
+ return await bot.tokens.get();
312
+ }
313
+ /** Send one request and unwrap its answer. */
314
+ async function send(bot, base, method, path, config, token) {
315
+ const url = endpointOf(bot.config, base, path);
316
+ const params = { ...config.params };
317
+ if (token !== void 0 && base === "oapi") params.access_token = token;
318
+ const headers = {};
319
+ if (token !== void 0 && base === "api") headers["x-acs-dingtalk-access-token"] = token;
320
+ let response;
321
+ try {
322
+ response = await bot.ctx.http(url, {
323
+ method,
324
+ ...config.data === void 0 ? {} : { data: config.data },
325
+ ...Object.keys(params).length === 0 ? {} : { params },
326
+ ...Object.keys(headers).length === 0 ? {} : { headers },
327
+ ...config.signal === void 0 ? {} : { signal: config.signal }
328
+ });
329
+ } catch (cause) {
330
+ if (isCancellation(cause, config.signal)) throw cancellation(cause, config.signal);
331
+ throw new DingtalkApiError(`dingtalk: ${method} ${path} request failed: ${messageOf$3(cause)}`, { cause });
332
+ }
333
+ let text;
334
+ try {
335
+ text = await response.text();
336
+ } catch (cause) {
337
+ if (isCancellation(cause, config.signal)) throw cancellation(cause, config.signal);
338
+ throw new DingtalkApiError(`dingtalk: ${method} ${path} answered ${response.status} but its body could not be read`, {
339
+ status: response.status,
340
+ cause
341
+ });
342
+ }
343
+ let body;
344
+ try {
345
+ body = text === "" ? void 0 : JSON.parse(text);
346
+ } catch (error) {
347
+ throw new DingtalkApiError(`dingtalk: ${method} ${path} answered ${response.status} without JSON: ${text.slice(0, BODY_PREFIX_BYTES)}`, {
348
+ status: response.status,
349
+ nonJson: true,
350
+ bodyText: text.slice(0, BODY_PREFIX_BYTES),
351
+ cause: error
352
+ });
353
+ }
354
+ const record = asRecord(body);
355
+ const code = record?.code ?? record?.errcode;
356
+ const message = record?.message ?? record?.errmsg;
357
+ const details = {
358
+ status: response.status,
359
+ ...typeof code === "string" || typeof code === "number" ? { code } : {},
360
+ ...typeof record?.requestid === "string" ? { requestid: record.requestid } : {},
361
+ ...text === "" ? {} : { bodyText: text.slice(0, BODY_PREFIX_BYTES) }
362
+ };
363
+ const suffix = (code === void 0 ? "" : ` (${String(code)})`) + (typeof message === "string" ? `: ${message}` : "");
364
+ if (response.status < 200 || response.status >= 300) throw new DingtalkApiError(`dingtalk: ${method} ${path} answered ${response.status}${suffix}`, details);
365
+ if (code !== void 0 && code !== 0) throw new DingtalkApiError(`dingtalk: ${method} ${path} answered ${response.status}${suffix}`, details);
366
+ return body;
367
+ }
368
+ /**
369
+ * Call one DingTalk endpoint.
370
+ *
371
+ * A call refused for its access token re-mints the token and is retried once; every other failure is thrown as the
372
+ * `DingtalkApiError` `classify` maps. A cancelled call rejects with the cancellation itself.
373
+ *
374
+ * @param bot - the adapter whose configuration and token cache the call uses.
375
+ * @param base - which root (`/v1.0` OpenAPI or the legacy `oapi`) the path belongs to.
376
+ * @param method - HTTP method.
377
+ * @param path - endpoint path, with or without the `/v1.0` segment.
378
+ * @param config - body, query parameters and cancellation of the call.
379
+ * @returns the unwrapped JSON answer.
380
+ */
381
+ async function invoke(bot, base, method, path, config = {}) {
382
+ const token = await authorization(bot, base, path);
383
+ try {
384
+ return await send(bot, base, method, path, config, token);
385
+ } catch (error) {
386
+ if (!isAuthFailure(error) || token === void 0) throw error;
387
+ bot.tokens.invalidate();
388
+ return await send(bot, base, method, path, config, await authorization(bot, base, path));
389
+ }
390
+ }
391
+ // lib/types/internal.js
392
+ /**
393
+ * Route table of the migrated REST layer: one entry per generated `Internal.define({...})` block.
394
+ *
395
+ * `isOldApi` selects the version-family transport: the new `api.dingtalk.com/v1.0` endpoints take a version query
396
+ * parameter and the access token in a header, the legacy `oapi.dingtalk.com` ones take `method` + `access_token` as
397
+ * query parameters.
398
+ */
399
+ var Internal = class Internal {
400
+ bot;
401
+ constructor(bot) {
402
+ this.bot = bot;
403
+ }
404
+ static define(routes) {
405
+ const methods = Internal.prototype;
406
+ for (const path in routes) {
407
+ const byMethod = routes[path];
408
+ for (const key in byMethod) {
409
+ const method = key;
410
+ const table = byMethod[method];
411
+ for (const name of Object.keys(table)) {
412
+ const isOldApi = table[name];
413
+ methods[name] = async function(...args) {
414
+ const raw = args.join(", ");
415
+ const url = path.replace(/\{([^}]+)\}/g, () => {
416
+ if (!args.length) throw new Error(`too few arguments for ${path}, received ${raw}`);
417
+ return args.shift();
418
+ });
419
+ const config = {};
420
+ if (args.length === 1) {
421
+ if (method === "GET" || method === "DELETE") config.params = args[0];
422
+ else config.data = args[0];
423
+ } else if (args.length === 2 && method !== "GET" && method !== "DELETE") {
424
+ config.data = args[0];
425
+ config.params = args[1];
426
+ } else if (args.length > 1) throw new Error(`too many arguments for ${path}, received ${raw}`);
427
+ if (isOldApi) config.params = {
428
+ method,
429
+ ...config.params
430
+ };
431
+ return await invoke(this.bot, isOldApi ? "oapi" : "api", method, url, config);
432
+ };
433
+ }
434
+ }
435
+ }
436
+ }
437
+ };
438
+ // lib/types/api/oauth2.js
439
+ Internal.define({
440
+ "/oauth2/jsapiTickets": { POST: { createJsapiTicket: false } },
441
+ "/oauth2/ssoAccessToken": { POST: { getSsoAccessToken: false } },
442
+ "/oauth2/authRules/user": { GET: { getPersonalAuthRule: false } },
443
+ "/oauth2/accessToken": { POST: { getAccessToken: false } },
444
+ "/oauth2/corpAccessToken": { POST: { getCorpAccessToken: false } },
445
+ "/oauth2/userAccessToken": { POST: { getUserToken: false } },
446
+ "/oauth2/ssoUserInfo": { GET: { getSsoUserInfo: false } }
447
+ });
448
+ // lib/types/api/oapi.js
449
+ Internal.define({
450
+ "/service/get_corp_token": { POST: { oapiServiceGetCorpToken: true } },
451
+ "/sso/gettoken": { GET: { oapiSsoGettoken: true } },
452
+ "/get_jsapi_ticket": { GET: { oapiGetJsapiTicket: true } },
453
+ "/gettoken": { GET: { oapiGettoken: true } },
454
+ "/v2/user/getuserinfo": { POST: { oapiV2UserGetuserinfo: true } },
455
+ "/sns/getuserinfo_bycode": { POST: { oapiSnsGetuserinfoBycode: true } },
456
+ "/sso/getuserinfo": { GET: { oapiSsoGetuserinfo: true } },
457
+ "/service/get_auth_info": { POST: { oapiServiceGetAuthInfo: true } },
458
+ "/v2/user/update": { POST: { oapiV2UserUpdate: true } },
459
+ "/v2/user/create": { POST: { oapiV2UserCreate: true } },
460
+ "/org/union/trunk/get": { POST: { oapiOrgUnionTrunkGet: true } },
461
+ "/smartwork/hrm/roster/meta/get": { POST: { oapiSmartworkHrmRosterMetaGet: true } },
462
+ "/smartwork/hrm/employee/v2/list": { POST: { oapiSmartworkHrmEmployeeV2List: true } },
463
+ "/smartwork/hrm/employee/v2/update": { POST: { oapiSmartworkHrmEmployeeV2Update: true } },
464
+ "/smartwork/hrm/employee/field/grouplist": { POST: { oapiSmartworkHrmEmployeeFieldGrouplist: true } },
465
+ "/smartwork/hrm/employee/update": { POST: { oapiSmartworkHrmEmployeeUpdate: true } },
466
+ "/smartwork/hrm/employee/queryonjob": { POST: { oapiSmartworkHrmEmployeeQueryonjob: true } },
467
+ "/smartwork/hrm/employee/querypreentry": { POST: { oapiSmartworkHrmEmployeeQuerypreentry: true } },
468
+ "/smartwork/hrm/employee/addpreentry": { POST: { oapiSmartworkHrmEmployeeAddpreentry: true } },
469
+ "/smartwork/hrm/employee/list": { POST: { oapiSmartworkHrmEmployeeList: true } },
470
+ "/report/template/getbyname": { POST: { oapiReportTemplateGetbyname: true } },
471
+ "/report/create": { POST: { oapiReportCreate: true } },
472
+ "/report/savecontent": { POST: { oapiReportSavecontent: true } },
473
+ "/report/simplelist": { POST: { oapiReportSimplelist: true } },
474
+ "/report/statistics/listbytype": { POST: { oapiReportStatisticsListbytype: true } },
475
+ "/report/receiver/list": { POST: { oapiReportReceiverList: true } },
476
+ "/report/comment/list": { POST: { oapiReportCommentList: true } },
477
+ "/report/statistics": { POST: { oapiReportStatistics: true } },
478
+ "/report/getunreadcount": { POST: { oapiReportGetunreadcount: true } },
479
+ "/report/list": { POST: { oapiReportList: true } },
480
+ "/report/template/listbyuserid": { POST: { oapiReportTemplateListbyuserid: true } },
481
+ "/checkin/record/get": { POST: { oapiCheckinRecordGet: true } },
482
+ "/checkin/record": { GET: { oapiCheckinRecord: true } },
483
+ "/blackboard/category/list": { POST: { oapiBlackboardCategoryList: true } },
484
+ "/blackboard/update": { POST: { oapiBlackboardUpdate: true } },
485
+ "/blackboard/delete": { POST: { oapiBlackboardDelete: true } },
486
+ "/blackboard/get": { POST: { oapiBlackboardGet: true } },
487
+ "/blackboard/listids": { POST: { oapiBlackboardListids: true } },
488
+ "/blackboard/create": { POST: { oapiBlackboardCreate: true } },
489
+ "/blackboard/listtopten": { POST: { oapiBlackboardListtopten: true } },
490
+ "/health/stepinfo/getuserstatus": { POST: { oapiHealthStepinfoGetuserstatus: true } },
491
+ "/health/stepinfo/listbyuserid": { POST: { oapiHealthStepinfoListbyuserid: true } },
492
+ "/health/stepinfo/list": { POST: { oapiHealthStepinfoList: true } },
493
+ "/microapp/list_by_userid": { GET: { oapiMicroappListByUserid: true } },
494
+ "/microapp/list": { POST: { oapiMicroappList: true } },
495
+ "/microapp/delete": { POST: { oapiMicroappDelete: true } },
496
+ "/microapp/set_visible_scopes": { POST: { oapiMicroappSetVisibleScopes: true } },
497
+ "/microapp/visible_scopes": { POST: { oapiMicroappVisibleScopes: true } },
498
+ "/asr/voice/translate": { POST: { oapiAsrVoiceTranslate: true } },
499
+ "/ai/mt/translate": { POST: { oapiAiMtTranslate: true } },
500
+ "/ocr/structured/recognize": { POST: { oapiOcrStructuredRecognize: true } },
501
+ "/im/chat/scencegroup/message/send_v2": { POST: { oapiImChatScencegroupMessageSendV2: true } },
502
+ "/im/chat/scenegroup/template/close": { POST: { oapiImChatScenegroupTemplateClose: true } },
503
+ "/im/chat/scenegroup/template/apply": { POST: { oapiImChatScenegroupTemplateApply: true } },
504
+ "/im/chat/scencegroup/interactivecard/callback/register": { POST: { oapiImChatScencegroupInteractivecardCallbackRegister: true } },
505
+ "/im/chat/scenegroup/create": { POST: { oapiImChatScenegroupCreate: true } },
506
+ "/im/chat/scenegroup/member/add": { POST: { oapiImChatScenegroupMemberAdd: true } },
507
+ "/im/chat/scenegroup/member/get": { POST: { oapiImChatScenegroupMemberGet: true } },
508
+ "/im/chat/scenegroup/update": { POST: { oapiImChatScenegroupUpdate: true } },
509
+ "/im/chat/scenegroup/member/delete": { POST: { oapiImChatScenegroupMemberDelete: true } },
510
+ "/im/chat/scenegroup/get": { POST: { oapiImChatScenegroupGet: true } },
511
+ "/robot/send": { POST: { oapiRobotSend: true } },
512
+ "/alitrip/btrip/invoice/setting/rule": { POST: { oapiAlitripBtripInvoiceSettingRule: true } },
513
+ "/alitrip/btrip/invoice/setting/add": { POST: { oapiAlitripBtripInvoiceSettingAdd: true } },
514
+ "/alitrip/btrip/project/delete": { POST: { oapiAlitripBtripProjectDelete: true } },
515
+ "/alitrip/btrip/project/modify": { POST: { oapiAlitripBtripProjectModify: true } },
516
+ "/alitrip/btrip/project/add": { POST: { oapiAlitripBtripProjectAdd: true } },
517
+ "/alitrip/btrip/invoice/setting/delete": { POST: { oapiAlitripBtripInvoiceSettingDelete: true } },
518
+ "/alitrip/btrip/invoice/setting/modify": { POST: { oapiAlitripBtripInvoiceSettingModify: true } },
519
+ "/alitrip/btrip/price/query": { POST: { oapiAlitripBtripPriceQuery: true } },
520
+ "/alitrip/btrip/train/city/suggest": { POST: { oapiAlitripBtripTrainCitySuggest: true } },
521
+ "/alitrip/btrip/monthbill/url/get": { POST: { oapiAlitripBtripMonthbillUrlGet: true } },
522
+ "/alitrip/btrip/address/get": { POST: { oapiAlitripBtripAddressGet: true } },
523
+ "/alitrip/btrip/approval/modify": { POST: { oapiAlitripBtripApprovalModify: true } },
524
+ "/alitrip/btrip/flight/city/suggest": { POST: { oapiAlitripBtripFlightCitySuggest: true } },
525
+ "/alitrip/btrip/vehicle/order/search": { POST: { oapiAlitripBtripVehicleOrderSearch: true } },
526
+ "/alitrip/btrip/cost/center/query": { POST: { oapiAlitripBtripCostCenterQuery: true } },
527
+ "/alitrip/btrip/approval/update": { POST: { oapiAlitripBtripApprovalUpdate: true } },
528
+ "/alitrip/btrip/cost/center/new": { POST: { oapiAlitripBtripCostCenterNew: true } },
529
+ "/alitrip/btrip/cost/center/modify": { POST: { oapiAlitripBtripCostCenterModify: true } },
530
+ "/alitrip/btrip/cost/center/delete": { POST: { oapiAlitripBtripCostCenterDelete: true } },
531
+ "/alitrip/btrip/cost/center/entity/set": { POST: { oapiAlitripBtripCostCenterEntitySet: true } },
532
+ "/alitrip/btrip/hotel/order/search": { POST: { oapiAlitripBtripHotelOrderSearch: true } },
533
+ "/alitrip/btrip/train/order/search": { POST: { oapiAlitripBtripTrainOrderSearch: true } },
534
+ "/alitrip/btrip/flight/order/search": { POST: { oapiAlitripBtripFlightOrderSearch: true } },
535
+ "/alitrip/btrip/invoice/search": { POST: { oapiAlitripBtripInvoiceSearch: true } },
536
+ "/alitrip/btrip/cost/center/transfer": { POST: { oapiAlitripBtripCostCenterTransfer: true } },
537
+ "/alitrip/btrip/apply/get": { POST: { oapiAlitripBtripApplyGet: true } },
538
+ "/alitrip/btrip/apply/search": { POST: { oapiAlitripBtripApplySearch: true } },
539
+ "/alitrip/btrip/approval/new": { POST: { oapiAlitripBtripApprovalNew: true } },
540
+ "/alitrip/btrip/cost/center/entity/delete": { POST: { oapiAlitripBtripCostCenterEntityDelete: true } },
541
+ "/workspace/auditlog/list": { POST: { oapiWorkspaceAuditlogList: true } },
542
+ "/edu/cert/get": { POST: { oapiEduCertGet: true } },
543
+ "/edu/user/list": { POST: { oapiEduUserList: true } },
544
+ "/smartdevice/device/querybyid": { POST: { oapiSmartdeviceDeviceQuerybyid: true } },
545
+ "/smartdevice/device/querylist": { POST: { oapiSmartdeviceDeviceQuerylist: true } },
546
+ "/smartdevice/device/query": { POST: { oapiSmartdeviceDeviceQuery: true } },
547
+ "/smartdevice/device/updatenick": { POST: { oapiSmartdeviceDeviceUpdatenick: true } },
548
+ "/smartdevice/device/unbind": { POST: { oapiSmartdeviceDeviceUnbind: true } },
549
+ "/smartdevice/external/bind": { POST: { oapiSmartdeviceExternalBind: true } },
550
+ "/crm/objectdata/contact/delete": { POST: { oapiCrmObjectdataContactDelete: true } },
551
+ "/crm/objectdata/customobject/create": { POST: { oapiCrmObjectdataCustomobjectCreate: true } },
552
+ "/crm/objectdata/customobject/update": { POST: { oapiCrmObjectdataCustomobjectUpdate: true } },
553
+ "/crm/objectdata/list": { POST: { oapiCrmObjectdataList: true } },
554
+ "/crm/objectdata/query": { POST: { oapiCrmObjectdataQuery: true } },
555
+ "/crm/objectmeta/describe": { POST: { oapiCrmObjectmetaDescribe: true } },
556
+ "/crm/objectdata/contact/query": { POST: { oapiCrmObjectdataContactQuery: true } },
557
+ "/crm/objectdata/followrecord/list": { POST: { oapiCrmObjectdataFollowrecordList: true } },
558
+ "/crm/objectdata/followrecord/query": { POST: { oapiCrmObjectdataFollowrecordQuery: true } },
559
+ "/crm/objectdata/contact/list": { POST: { oapiCrmObjectdataContactList: true } },
560
+ "/crm/objectmeta/contact/describe": { POST: { oapiCrmObjectmetaContactDescribe: true } },
561
+ "/crm/objectmeta/followrecord/describe": { POST: { oapiCrmObjectmetaFollowrecordDescribe: true } },
562
+ "/cspace/add_to_single_chat": { POST: { oapiCspaceAddToSingleChat: true } },
563
+ "/cspace/grant_custom_space": { GET: { oapiCspaceGrantCustomSpace: true } },
564
+ "/cspace/get_custom_space": { GET: { oapiCspaceGetCustomSpace: true } },
565
+ "/cspace/add": { GET: { oapiCspaceAdd: true } },
566
+ "/chat/subadmin/update": { POST: { oapiChatSubadminUpdate: true } },
567
+ "/chat/qrcode/get": { POST: { oapiChatQrcodeGet: true } },
568
+ "/chat/member/friendswitch/update": { POST: { oapiChatMemberFriendswitchUpdate: true } },
569
+ "/chat/updategroupnick": { POST: { oapiChatUpdategroupnick: true } },
570
+ "/chat/update": { POST: { oapiChatUpdate: true } },
571
+ "/chat/create": { POST: { oapiChatCreate: true } },
572
+ "/chat/get": { GET: { oapiChatGet: true } },
573
+ "/smartbot/msg/push": { POST: { oapiSmartbotMsgPush: true } }
574
+ });
575
+ // lib/types/api/contact.js
576
+ Internal.define({
577
+ "/contact/organizations/authInfos": { GET: { getOrgAuthInfo: false } },
578
+ "/contact/cooperateCorps/unionApplications/approve": { POST: { batchApproveUnionApply: false } }
579
+ });
580
+ // lib/types/api/swform.js
581
+ Internal.define({
582
+ "/swform/instances/{formInstanceId}": { GET: { getFormInstance: false } },
583
+ "/swform/forms/{formCode}/instances": { GET: { listFormInstances: false } },
584
+ "/swform/users/forms": { GET: { listFormSchemasByCreator: false } }
585
+ });
586
+ // lib/types/api/hrm.js
587
+ Internal.define({
588
+ "/hrm/processes/employees/terminations": { PUT: { hrmProcessUpdateTerminationInfo: false } },
589
+ "/hrm/processes/regulars/become": { POST: { hrmProcessRegular: false } },
590
+ "/hrm/employees/dismissions": { GET: { queryDismissionStaffIdList: false } },
591
+ "/hrm/rosters/meta/fields/options": { PUT: { rosterMetaFieldOptionsUpdate: false } },
592
+ "/hrm/processes/transfer": { POST: { hrmProcessTransfer: false } },
593
+ "/hrm/employees/dimissionInfos": { GET: { queryHrmEmployeeDismissionInfo: false } },
594
+ "/hrm/jobs": { GET: { queryJobs: false } },
595
+ "/hrm/jobRanks": { GET: { queryJobRanks: false } },
596
+ "/hrm/positions/query": { POST: { queryPositions: false } }
597
+ });
598
+ // lib/types/api/todo.js
599
+ Internal.define({
600
+ "/todo/users/{unionId}/org/tasks/query": { POST: { queryOrgTodoTasks: false } },
601
+ "/todo/users/{unionId}/tasks/{taskId}/executorStatus": { PUT: { updateTodoTaskExecutorStatus: false } },
602
+ "/todo/users/{unionId}/tasks": { POST: { createTodoTask: false } },
603
+ "/todo/users/{unionId}/tasks/{taskId}": {
604
+ PUT: { updateTodoTask: false },
605
+ DELETE: { deleteTodoTask: false }
606
+ }
607
+ });
608
+ // lib/types/api/attendance.js
609
+ Internal.define({
610
+ "/attendance/adjustments": { GET: { getAdjustments: false } },
611
+ "/attendance/overtimeSettings": { GET: { getSimpleOvertimeSetting: false } },
612
+ "/attendance/overtimeSettings/query": { POST: { getOvertimeSetting: false } }
613
+ });
614
+ // lib/types/api/calendar.js
615
+ Internal.define({
616
+ "/calendar/users/{userId}/meetingRooms/schedules/query": { POST: { getMeetingRoomsSchedule: false } },
617
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/meetingRooms": { POST: { addMeetingRooms: false } },
618
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/meetingRooms/batchRemove": { POST: { removeMeetingRooms: false } },
619
+ "/calendar/users/{userId}/calendars/{calendarId}/unsubscribe": { POST: { unsubscribeCalendar: false } },
620
+ "/calendar/users/{userId}/subscribedCalendars/{calendarId}": {
621
+ DELETE: { deleteSubscribedCalendar: false },
622
+ GET: { getSubscribedCalendar: false }
623
+ },
624
+ "/calendar/users/{userId}/subscribedCalendars": { POST: { createSubscribedCalendar: false } },
625
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/signOut": {
626
+ POST: { signOut: false },
627
+ GET: { getSignOutList: false }
628
+ },
629
+ "/calendar/users/{userId}/calendars/{calendarId}/subscribe": { POST: { subscribeCalendar: false } },
630
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/attendees": {
631
+ GET: { listAttendees: false },
632
+ POST: { addAttendee: false }
633
+ },
634
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/signin": {
635
+ POST: { signIn: false },
636
+ GET: { getSignInList: false }
637
+ },
638
+ "/calendar/users/{userId}/calendars/{calendarId}/acls": {
639
+ GET: { listAcls: false },
640
+ POST: { createAcls: false }
641
+ },
642
+ "/calendar/users/{userId}/calendars/{calendarId}/acls/{aclId}": { DELETE: { deleteAcl: false } },
643
+ "/calendar/users/{userId}/calendars": { GET: { listCalendars: false } },
644
+ "/calendar/users/{userId}/querySchedule": { POST: { getSchedule: false } },
645
+ "/calendar/users/{userId}/calendars/{calendarId}/events": {
646
+ GET: { listEvents: false },
647
+ POST: { createEvent: false }
648
+ },
649
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}": {
650
+ GET: { getEvent: false },
651
+ DELETE: { deleteEvent: false },
652
+ PUT: { patchEvent: false }
653
+ },
654
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/attendees/batchRemove": { POST: { removeAttendee: false } },
655
+ "/calendar/users/{userId}/calendars/{calendarId}/eventsview": { GET: { listEventsView: false } },
656
+ "/calendar/users/{userId}/calendars/{calendarId}/events/{eventId}/respond": { POST: { respondEvent: false } }
657
+ });
658
+ // lib/types/api/blackboard.js
659
+ Internal.define({ "/blackboard/spaces": { GET: { queryBlackboardSpace: false } } });
660
+ // lib/types/api/microApp.js
661
+ Internal.define({
662
+ "/microApp/innerMiniApps/{agentId}/versions/rollback": { POST: { rollbackInnerAppVersion: false } },
663
+ "/microApp/innerMiniApps/{agentId}/versions/publish": { POST: { publishInnerAppVersion: false } },
664
+ "/microApp/innerMiniApps/{agentId}/historyVersions": { GET: { pageInnerAppHistoryVersion: false } },
665
+ "/microApp/innerMiniApps/{agentId}/versions": { GET: { listInnerAppVersion: false } },
666
+ "/microApp/allInnerApps": { GET: { listAllInnerApps: false } },
667
+ "/microApp/apps/{agentId}/scopes": {
668
+ GET: { getMicroAppScope: false },
669
+ POST: { setMicroAppScope: false }
670
+ },
671
+ "/microApp/users/{userId}/apps": { GET: { listUserVilebleApp: false } },
672
+ "/microApp/allApps": { GET: { listAllApp: false } },
673
+ "/microApp/apps/{agentId}": {
674
+ DELETE: { deleteInnerApp: false },
675
+ PUT: { updateInnerApp: false }
676
+ },
677
+ "/microApp/apps": { POST: { createInnerApp: false } }
678
+ });
679
+ // lib/types/api/im.js
680
+ Internal.define({
681
+ "/im/sceneGroups/templates/robots": { GET: { querySceneGroupTemplateRobot: false } },
682
+ "/im/sceneGroups/members/batchQuery": { POST: { batchQueryGroupMember: false } },
683
+ "/im/sceneGroups/muteSettings": { GET: { queryGroupMuteStatus: false } },
684
+ "/im/sceneGroups/muteMembers/set": { POST: { updateMemberBanWords: false } },
685
+ "/im/sceneGroups/query": { POST: { getSceneGroupInfo: false } },
686
+ "/im/sceneGroups/subAdmins": { PUT: { updateGroupSubAdmin: false } },
687
+ "/im/sceneGroups/members/groupNicks": { PUT: { updateMemberGroupNick: false } },
688
+ "/im/interactiveCards/templates/send": { POST: { sendTemplateInteractiveCard: false } },
689
+ "/im/interactiveCards": { PUT: { updateInteractiveCard: false } },
690
+ "/im/interactiveCards/send": { POST: { sendInteractiveCard: false } },
691
+ "/im/robots/interactiveCards": { PUT: { updateRobotInteractiveCard: false } },
692
+ "/im/v1.0/robot/interactiveCards/send": { POST: { sendRobotInteractiveCard: false } },
693
+ "/im/chat/{chatId}/convertToOpenConversationId": { POST: { chatIdToOpenConversationId: false } },
694
+ "/im/subAdministrators": { POST: { chatSubAdminUpdate: false } },
695
+ "/im/interconnections/groups": { POST: { createGroupConversation: false } },
696
+ "/im/interconnections/couples/groups": { POST: { createCoupleGroup: false } },
697
+ "/im/interconnections/groups/owners": { PUT: { changeGroupOwner: false } },
698
+ "/im/interconnections/groups/dismiss": { POST: { dismissGroupConversation: false } },
699
+ "/im/interconnections/robotMessages/send": { POST: { sendRobotMessage: false } },
700
+ "/im/interconnections/storeGroups": { POST: { createStoreGroupConversation: false } },
701
+ "/im/interconnections/coupleGroups": { POST: { createCoupleGroupConversation: false } },
702
+ "/im/interconnections/groups/names": { PUT: { updateGroupName: false } },
703
+ "/im/interconnections/groups/avatars": { PUT: { updateGroupAvatar: false } },
704
+ "/im/interconnections/doubleGroups/query": { POST: { querySingleGroup: false } },
705
+ "/im/interconnections/conversations/members": { GET: { queryGroupMember: false } },
706
+ "/im/interconnections/unReadMsgs/query": { POST: { queryUnReadMessage: false } },
707
+ "/im/interconnections/messages/send": { POST: { sendMessage: false } },
708
+ "/im/interconnections/groups/members/remove": { POST: { removeGroupMember: false } },
709
+ "/im/interconnections/groups/members": { POST: { addGroupMember: false } },
710
+ "/im/interconnections/dingMessages/send": { POST: { sendDingMessage: false } },
711
+ "/im/conversations/urls": { POST: { getConversationUrl: false } },
712
+ "/im/interconnections": { POST: { createInterconnection: false } },
713
+ "/im/privateChat/interactiveCards/send": { POST: { sendOTOInteractiveCard: false } },
714
+ "/im/topBoxes/close": { POST: { closeTopbox: false } },
715
+ "/im/topBoxes": { POST: { createTopbox: false } }
716
+ });
717
+ // lib/types/api/connector.js
718
+ Internal.define({
719
+ "/connector/data/{dataModelId}": { GET: { pullDataByPk: false } },
720
+ "/connector/data": { GET: { pullDataByPage: false } },
721
+ "/connector/triggers/data/sync": { POST: { syncData: false } }
722
+ });
723
+ // lib/types/api/exclusive.js
724
+ Internal.define({
725
+ "/exclusive/enterpriseSecurities/userBehaviors/screenshots/query": { POST: { queryUserBehavior: false } },
726
+ "/exclusive/trusts/publicDevices": { GET: { getPublicDevices: false } },
727
+ "/exclusive/phoneDings/send": { POST: { sendPhoneDing: false } },
728
+ "/exclusive/partners/users/{userId}": { GET: { queryPartnerInfo: false } },
729
+ "/exclusive/data/conferences": { GET: { getConfBaseInfoByLogicalId: false } },
730
+ "/exclusive/trusts/devices": { POST: { createTrustedDeviceBatch: false } },
731
+ "/exclusive/fileAuditLogs": { GET: { listAuditLog: false } },
732
+ "/exclusive/enterpriseSecurities/banOrOpenGroupWords": { PUT: { banOrOpenGroupWords: false } },
733
+ "/exclusive/audits/users": { GET: { getSignedDetailByPage: false } },
734
+ "/exclusive/comments/send": { POST: { publishFileChangeNotice: false } },
735
+ "/exclusive/appDings/send": { POST: { sendAppDing: false } },
736
+ "/exclusive/partnerLabels/{parentId}": { GET: { getPartnerTypeByParentId: false } },
737
+ "/exclusive/partnerDepartments": {
738
+ POST: { setDeptPartnerTypeAndNum: false },
739
+ GET: { getAllLabelableDepts: false }
740
+ }
741
+ });
742
+ // lib/types/api/alitrip.js
743
+ Internal.define({
744
+ "/alitrip/billSettlements/btripTrains": { GET: { billSettementBtripTrain: false } },
745
+ "/alitrip/billSettlements/hotels": { GET: { billSettementHotel: false } },
746
+ "/alitrip/billSettlements/cars": { GET: { billSettementCar: false } },
747
+ "/alitrip/billSettlements/flights": { GET: { billSettementFlight: false } },
748
+ "/alitrip/exceedapply/getFlight": { GET: { getFlightExceedApply: false } },
749
+ "/alitrip/unionOrders": { GET: { queryUnionOrder: false } },
750
+ "/alitrip/exceedapply/getTrain": { GET: { getTrainExceedApply: false } },
751
+ "/alitrip/exceedapply/getHotel": { GET: { getHotelExceedApply: false } },
752
+ "/alitrip/exceedapply/sync": { POST: { syncExceedApply: false } },
753
+ "/alitrip/cityCarApprovals": {
754
+ GET: { queryCityCarApply: false },
755
+ PUT: { approveCityCarApply: false },
756
+ POST: { addCityCarApply: false }
757
+ }
758
+ });
759
+ // lib/types/api/project.js
760
+ Internal.define({
761
+ "/project/users/{userId}/projects/{projectId}/customfields": { PUT: { createProjectCustomfieldStatus: false } },
762
+ "/project/users/{userId}/tasks/{taskId}/contents": { PUT: { updateTaskContent: false } },
763
+ "/project/users/{userId}/tasks/{taskId}/notes": { PUT: { updateTaskNote: false } },
764
+ "/project/users/{userId}/tasks/{taskId}/involveMembers": { PUT: { updateTaskInvolvemembers: false } },
765
+ "/project/users/{userId}/tasks/{taskId}/executors": { PUT: { updateTaskExecutor: false } },
766
+ "/project/users/{userId}/tasks/{taskId}/priorities": { PUT: { updateTaskPriority: false } },
767
+ "/project/users/{userId}/tasks/{taskId}/dueDates": { PUT: { updateTaskDueDate: false } },
768
+ "/project/users/{userId}/tasks": {
769
+ GET: { getTaskByIds: false },
770
+ POST: { createTask: false }
771
+ },
772
+ "/project/users/{userId}/tasks/{taskId}/archive": { POST: { archiveTask: false } },
773
+ "/project/users/{userId}/tasks/search": { POST: { searchUserTask: false } },
774
+ "/project/users/{userId}/projects/{projectId}/taskStages/search": { POST: { seachTaskStage: false } },
775
+ "/project/users/{userId}/projects/{projectId}/taskLists/search": { POST: { searchTaskList: false } },
776
+ "/project/users/{userId}/projects/{projectId}/taskflows/search": { POST: { searchTaskFlow: false } },
777
+ "/project/users/{userId}/projects/{projectId}/statuses": { GET: { getProjectStatusList: false } },
778
+ "/project/users/{userId}/projects/{projectId}/members/remove": { POST: { deleteProjectMember: false } },
779
+ "/project/users/{userId}/projects/{projectId}/members": {
780
+ GET: { getProjectMemebers: false },
781
+ POST: { addProjectMember: false }
782
+ },
783
+ "/project/users/{userId}/projects/query": { POST: { queryProject: false } },
784
+ "/project/users/{userId}/projects/{projectId}/taskflowStatuses/search": { GET: { searchTaskflowStatus: false } },
785
+ "/project/users/{userId}/tasks/{taskId}/taskflowStatuses": { PUT: { updateTaskTaskflowstatus: false } },
786
+ "/project/users/{userId}/tasks/{taskId}/startDates": { PUT: { updateTaskStartdate: false } },
787
+ "/project/users/{userId}/projects": { POST: { createProject: false } },
788
+ "/project/users/{userId}/joinProjects": { GET: { getUserJoinedProject: false } },
789
+ "/project/users/{userId}/projects/{projectId}/archive": { POST: { archiveProject: false } },
790
+ "/project/users/{userId}/projects/{projectId}/unsuspend": { POST: { unSuspendProject: false } },
791
+ "/project/users/{userId}/projects/{projectId}/suspend": { POST: { suspendProject: false } },
792
+ "/project/users/{userId}/projectIds/{projectId}/tasks": { GET: { queryTaskOfProject: false } },
793
+ "/project/users/{userId}/workTimes": { POST: { createWorkTime: false } },
794
+ "/project/users/{userId}/planTimes": { POST: { createPlanTime: false } },
795
+ "/project/users/{userId}/tasks/{taskId}/customFields": { PUT: { updateCustomfieldValue: false } },
796
+ "/project/teambition/users": { GET: { getTbUserIdByStaffId: false } },
797
+ "/project/teambition/organizations": { GET: { getTbOrgIdByDingOrgId: false } },
798
+ "/project/users/{userId}/projects/{projectId}/groups": { PUT: { updateProjectGroup: false } },
799
+ "/project/users/{userId}/templates/projects": { POST: { createProjectByTemplate: false } },
800
+ "/project/organizations/users/{userId}/groups": { GET: { getProjectGroup: false } },
801
+ "/project/organizations/users/{userId}/templates": { GET: { searchProjectTemplate: false } },
802
+ "/project/users/{userId}/tasks/{taskId}/objectLinks": { POST: { createTaskObjectLink: false } },
803
+ "/project/organizations/users/{userId}/tasks": {
804
+ GET: { getOrganizatioTaskByIds: false },
805
+ POST: { createOrganizationTask: false }
806
+ },
807
+ "/project/organizations/users/{userId}/tasks/{taskId}/priorities": { PUT: { updateOrganizationTaskPriority: false } },
808
+ "/project/organizations/users/{userId}/tasks/{taskId}/notes": { PUT: { updateOrganizationTaskNote: false } },
809
+ "/project/organizations/users/{userId}/tasks/{taskId}/involveMembers": { PUT: { updateOrganizationTaskInvolveMembers: false } },
810
+ "/project/organizations/users/{userId}/tasks/{taskId}/executors": { PUT: { updateOrganizationTaskExecutor: false } },
811
+ "/project/organizations/users/{userId}/tasks/{taskId}/dueDates": { PUT: { updateOrganizationTaskDueDate: false } },
812
+ "/project/organizations/users/{userId}/tasks/{taskId}/contents": { PUT: { updateOrganizationTaskContent: false } },
813
+ "/project/organizations/users/{userId}/tasks/{taskId}/states": { PUT: { updateOrganizationTaskStatus: false } },
814
+ "/project/organizations/users/{userId}/priorities": { GET: { getOrganizationPriorityList: false } },
815
+ "/project/organizations/users/{userId}/tasks/{taskId}": { GET: { getOrganizationTask: false } },
816
+ "/project/users/{userId}/tasks/{taskId}": { DELETE: { deleteTask: false } }
817
+ });
818
+ // lib/types/api/edu.js
819
+ Internal.define({ "/edu/students/move": { POST: { moveStudent: false } } });
820
+ // lib/types/api/crm.js
821
+ Internal.define({
822
+ "/crm/globalInfos": { GET: { queryGlobalInfo: false } },
823
+ "/crm/followRecords/batch": {
824
+ PUT: { batchUpdateFollowRecords: false },
825
+ POST: { batchAddFollowRecords: false }
826
+ },
827
+ "/crm/followRecords/batchRemove": { POST: { batchRemoveFollowRecords: false } },
828
+ "/crm/customObjectDatas/instances/{instanceId}": { DELETE: { deleteCrmCustomObjectData: false } },
829
+ "/crm/contacts/batch": {
830
+ PUT: { batchUpdateContacts: false },
831
+ POST: { batchAddContacts: false }
832
+ },
833
+ "/crm/relationDatas/batch": {
834
+ POST: { batchAddRelationDatas: false },
835
+ PUT: { batchUpdateRelationDatas: false }
836
+ },
837
+ "/crm/relationUkSettings": { GET: { getRelationUkSetting: false } },
838
+ "/crm/groups": { POST: { crmCreateGroup: false } },
839
+ "/crm/crmGroupChats/batchQuery": { POST: { getCrmGroupChatMulti: false } },
840
+ "/crm/crmGroupChats/query": { POST: { getCrmGroupChatSingle: false } },
841
+ "/crm/relations/datas/targets/{targetId}": { GET: { queryRelationDatasByTargetId: false } },
842
+ "/crm/crmGroupChats": { GET: { queryCrmGroupChats: false } },
843
+ "/crm/groupSets/set": { PUT: { crmUpdateGroupSet: false } },
844
+ "/crm/groupSets/lists": { GET: { listGroupSet: false } },
845
+ "/crm/groupSets": {
846
+ POST: { createGroupSet: false },
847
+ GET: { getGroupSet: false }
848
+ },
849
+ "/crm/personalCustomers": {
850
+ PUT: { updateCrmPersonalCustomer: false },
851
+ POST: { addCrmPersonalCustomer: false },
852
+ GET: { queryCrmPersonalCustomer: false }
853
+ },
854
+ "/crm/personalCustomers/{dataId}": { DELETE: { deleteCrmPersonalCustomer: false } },
855
+ "/crm/personalCustomers/objectMeta": { GET: { describeCrmPersonalCustomerObjectMeta: false } },
856
+ "/crm/personalCustomers/batchQuery": { POST: { listCrmPersonalCustomers: false } },
857
+ "/crm/customerInstances": { POST: { queryAllCustomer: false } },
858
+ "/crm/officialAccounts/oToMessages/send": { POST: { sendOfficialAccountOTOMessage: false } },
859
+ "/crm/officialAccounts/oToMessages/batchSend": { POST: { batchSendOfficialAccountOTOMessage: false } }
860
+ });
861
+ // lib/types/api/yida.js
862
+ Internal.define({
863
+ "/yida/forms": { GET: { getFormListInApp: false } },
864
+ "/yida/forms/formFields": { GET: { getFieldDefByUuid: false } },
865
+ "/yida/tasks/batches/execute": { POST: { executeBatchTask: false } },
866
+ "/yida/forms/operationsLogs/query": { POST: { listOperationLogs: false } },
867
+ "/yida/forms/remarks/query": { POST: { listFormRemarks: false } },
868
+ "/yida/services/invocationRecords": { GET: { queryServiceRecord: false } },
869
+ "/yida/forms/instances/batchRemove": { POST: { batchRemovalByFormInstanceIdList: false } },
870
+ "/yida/forms/instances/components": { PUT: { batchUpdateFormDataByInstanceId: false } },
871
+ "/yida/forms/instances/datas": { PUT: { batchUpdateFormDataByInstanceMap: false } },
872
+ "/yida/organizations/applications": { GET: { listApplication: false } },
873
+ "/yida/forms/instances/batchSave": { POST: { batchSaveFormData: false } },
874
+ "/yida/forms/instances/advances/query": { POST: { searchFormDataSecondGenerationNoTableField: false } },
875
+ "/yida/forms/instances/insertOrUpdate": { POST: { createOrUpdateFormData: false } },
876
+ "/yida/forms/instances/advances/queryAll": { POST: { searchFormDataSecondGeneration: false } },
877
+ "/yida/forms/instances/ids/query": { POST: { batchGetFormDataByIdList: false } },
878
+ "/yida/tasks/taskCopies": { GET: { getTaskCopies: false } },
879
+ "/yida/forms/instances/ids/{appType}/{formUuid}": { POST: { searchFormDataIdList: false } },
880
+ "/yida/forms/innerTables/{formInstanceId}": { GET: { listTableDataByFormInstanceIdTableId: false } },
881
+ "/yida/tasks/completedTasks/{corpId}/{userId}": { GET: { getCorpAccomplishmentTasks: false } },
882
+ "/yida/forms/definitions/{appType}/{formUuid}": { GET: { getFormComponentDefinitionList: false } },
883
+ "/yida/processes/instanceIds": { POST: { getInstanceIdList: false } },
884
+ "/yida/processes/instances/searchWithIds": { GET: { getInstancesByIdList: false } },
885
+ "/yida/tasks/myCorpSubmission/{userId}": { GET: { getMeCorpSubmission: false } },
886
+ "/yida/processes/definitions/{processInstanceId}": { GET: { getProcessDefinition: false } },
887
+ "/yida/corpTasks": { GET: { getCorpTasks: false } },
888
+ "/yida/corpNotifications/{userId}": { GET: { getNotifyMe: false } },
889
+ "/yida/processDefinitions/buttons/{appType}/{processCode}/{activityId}": { GET: { getActivityButtonList: false } },
890
+ "/yida/authorization/platformResources": { GET: { getApplicationAuthorizationServicePlatformResource: false } },
891
+ "/yida/processes/instances": {
892
+ PUT: { updateInstance: false },
893
+ DELETE: { deleteInstance: false },
894
+ POST: { getInstances: false }
895
+ },
896
+ "/yida/processes/operationRecords": { GET: { getOperationRecords: false } },
897
+ "/yida/processes/instances/terminate": { PUT: { terminateInstance: false } },
898
+ "/yida/tasks/execute": { POST: { executeTask: false } },
899
+ "/yida/tasks/platformTasks/execute": { POST: { executePlatformTask: false } },
900
+ "/yida/tasks/redirect": { POST: { redirectTask: false } },
901
+ "/yida/apps/temporaryUrls/{appType}": { GET: { getOpenUrl: false } },
902
+ "/yida/forms/remarks": { POST: { saveFormRemark: false } },
903
+ "/yida/apps/navigations": { GET: { listNavigationByFormType: false } },
904
+ "/yida/apps/orderBuy/validate": { GET: { validateOrderBuy: false } },
905
+ "/yida/processes/tasks/getRunningTasks": { GET: { getRunningTasks: false } },
906
+ "/yida/processes/activities": { GET: { getActivityList: false } },
907
+ "/yida/apps/customApi/execute": { POST: { executeCustomApi: false } },
908
+ "/yida/apps/activationCode/information": { GET: { searchActivationCode: false } },
909
+ "/yida/apps/saleUserInfo": { GET: { getSaleUserInfoByUserId: false } },
910
+ "/yida/apps/corpLevel": { GET: { getCorpLevelByAccountId: false } },
911
+ "/yida/forms/status": { PUT: { updateStatus: false } },
912
+ "/yida/apps/orderUpgrade/validate": { GET: { validateOrderUpgrade: false } },
913
+ "/yida/appAuth/commodities/release": { DELETE: { releaseCommodity: false } },
914
+ "/yida/appAuth/commodities/expire": { PUT: { expireCommodity: false } },
915
+ "/yida/appAuth/commodities/refund": { POST: { refundCommodity: false } },
916
+ "/yida/forms/employeeFields": { POST: { searchEmployeeFieldValues: false } },
917
+ "/yida/forms/deleteSequence": { DELETE: { deleteSequence: false } },
918
+ "/yida/forms/instances": {
919
+ POST: { saveFormData: false },
920
+ PUT: { updateFormData: false },
921
+ DELETE: { deleteFormData: false }
922
+ },
923
+ "/yida/forms/instances/search": { POST: { searchFormDatas: false } },
924
+ "/yida/processes/instancesInfos/{id}": { GET: { getInstanceById: false } },
925
+ "/yida/processes/instances/start": { POST: { startInstance: false } },
926
+ "/yida/forms/instances/{id}": { GET: { getFormDataByID: false } }
927
+ });
928
+ // lib/types/api/drive.js
929
+ Internal.define({
930
+ "/drive/spaces/customSpaces": { POST: { addCustomSpace: false } },
931
+ "/drive/spaces/{spaceId}": { DELETE: { deleteSpace: false } },
932
+ "/drive/spaces": {
933
+ POST: { driveAddSpace: false },
934
+ GET: { listSpaces: false }
935
+ }
936
+ });
937
+ // lib/types/api/workbench.js
938
+ Internal.define({
939
+ "/workbench/components/recentUsed/batch": { POST: { addRecentUserAppList: false } },
940
+ "/workbench/plugins/validationRules": { GET: { getPluginRuleCheckInfo: false } },
941
+ "/workbench/plugins/permissions": { GET: { getPluginPermissionPoint: false } }
942
+ });
943
+ // lib/types/api/robot.js
944
+ Internal.define({
945
+ "/robot/groups/robots/query": { POST: { getBotListInGroup: false } },
946
+ "/robot/messageFiles/download": { POST: { robotMessageFileDownload: false } },
947
+ "/robot/plugins/clear": { POST: { clearRobotPlugin: false } },
948
+ "/robot/plugins/set": { POST: { setRobotPlugin: false } },
949
+ "/robot/plugins/query": { POST: { queryRobotPlugin: false } },
950
+ "/robot/groupMessages/recall": { POST: { orgGroupRecall: false } },
951
+ "/robot/groupMessages/query": { POST: { orgGroupQuery: false } },
952
+ "/robot/groupMessages/send": { POST: { orgGroupSend: false } },
953
+ "/robot/otoMessages/batchRecall": { POST: { batchRecallOTO: false } },
954
+ "/robot/oToMessages/readStatus": { GET: { batchOTOQuery: false } },
955
+ "/robot/oToMessages/batchSend": { POST: { batchSendOTO: false } },
956
+ "/robot/privateChatMessages/send": { POST: { privateChatSend: false } },
957
+ "/robot/privateChatMessages/query": { POST: { privateChatQuery: false } },
958
+ "/robot/privateChatMessages/batchRecall": { POST: { batchRecallPrivateChat: false } }
959
+ });
960
+ // lib/types/api/conference.js
961
+ Internal.define({
962
+ "/conference/videoConferences/{conferenceId}/users/invite": { POST: { inviteUsers: false } },
963
+ "/conference/videoConferences/{conferenceId}/focus": { POST: { focus: false } },
964
+ "/conference/videoConferences/{conferenceId}/coHosts/set": { POST: { cohosts: false } },
965
+ "/conference/videoConferences/{conferenceId}/members/mute": { POST: { muteMembers: false } },
966
+ "/conference/videoConferences/scheduleConferences/{scheduleConferenceId}": { GET: { queryScheduleConferenceInfo: false } },
967
+ "/conference/videoConferences/{conferenceId}/cloudRecords/getVideos": { GET: { queryCloudRecordVideo: false } },
968
+ "/conference/videoConferences/{conferenceId}/cloudRecords/getTexts": { GET: { queryCloudRecordText: false } },
969
+ "/conference/videoConferences/{conferenceId}/cloudRecords/videos/getPlayInfos": { GET: { queryCloudRecordVideoPlayInfo: false } },
970
+ "/conference/videoConferences/{conferenceId}/cloudRecords/stop": { POST: { stopCloudRecord: false } },
971
+ "/conference/videoConferences/{conferenceId}/streamOuts/stop": { POST: { stopStreamOut: false } },
972
+ "/conference/videoConferences/{conferenceId}/streamOuts/start": { POST: { startStreamOut: false } },
973
+ "/conference/videoConferences/{conferenceId}/cloudRecords/start": { POST: { startCloudRecord: false } },
974
+ "/conference/videoConferences/query": { POST: { queryConferenceInfoBatch: false } },
975
+ "/conference/videoConferences/{conferenceId}": {
976
+ DELETE: { closeVideoConference: false },
977
+ GET: { queryConferenceInfo: false }
978
+ },
979
+ "/conference/videoConferences": { POST: { createVideoConference: false } },
980
+ "/conference/videoConferences/{conferenceId}/members": { GET: { queryConferenceMembers: false } },
981
+ "/conference/scheduleConferences/cancel": { POST: { cancelScheduleConference: false } },
982
+ "/conference/scheduleConferences/{scheduleConferenceId}/infos": { GET: { queryScheduleConference: false } },
983
+ "/conference/scheduleConferences": {
984
+ PUT: { updateScheduleConference: false },
985
+ POST: { createScheduleConference: false }
986
+ }
987
+ });
988
+ // lib/types/api/serviceGroup.js
989
+ Internal.define({
990
+ "/serviceGroup/groups/members": { POST: { addMemberToServiceGroup: false } },
991
+ "/serviceGroup/messages/tasks/send": { POST: { sendMsgByTask: false } },
992
+ "/serviceGroup/normalGroups/upgrade": { POST: { upgradeNormalGroup: false } },
993
+ "/serviceGroup/cloudGroups/upgrade": { POST: { upgradeCloudGroup: false } },
994
+ "/serviceGroup/groups/queryActiveUsers": { GET: { queryActiveUsers: false } },
995
+ "/serviceGroup/messages/send": { POST: { sendServiceGroupMessage: false } },
996
+ "/serviceGroup/groups": { POST: { serviceGroupCreateGroup: false } },
997
+ "/serviceGroup/groups/configurations": { PUT: { serviceGroupUpdateGroupSet: false } }
998
+ });
999
+ // lib/types/api/customerService.js
1000
+ Internal.define({
1001
+ "/customerService/tickets/{ticketId}": { PUT: { executeActivity: false } },
1002
+ "/customerService/tickets/{ticketId}/actions": { GET: { pageListAction: false } },
1003
+ "/customerService/tickets": {
1004
+ GET: { pageListTicket: false },
1005
+ POST: { createTicket: false }
1006
+ }
1007
+ });
1008
+ // lib/types/api/esign.js
1009
+ Internal.define({
1010
+ "/esign/flowTasks/{taskId}/docs": { GET: { getFlowDocs: false } },
1011
+ "/esign/approvals/{taskId}": { GET: { approvalList: false } }
1012
+ });
1013
+ // lib/types/api/jzcrm.js
1014
+ Internal.define({
1015
+ "/jzcrm/contacts": { POST: { editContact: false } },
1016
+ "/jzcrm/customerPools": { POST: { editCustomerPool: false } },
1017
+ "/jzcrm/exchanges": { POST: { editExchange: false } },
1018
+ "/jzcrm/goods": { POST: { editGoods: false } },
1019
+ "/jzcrm/outstocks": { POST: { editOutstock: false } },
1020
+ "/jzcrm/intostocks": { POST: { editIntostock: false } },
1021
+ "/jzcrm/productions": { POST: { editProduction: false } },
1022
+ "/jzcrm/purchases": { POST: { editPurchase: false } },
1023
+ "/jzcrm/orders": { POST: { editOrder: false } },
1024
+ "/jzcrm/invoices": { POST: { editInvoice: false } },
1025
+ "/jzcrm/customers": { POST: { editCustomer: false } },
1026
+ "/jzcrm/dataView": { GET: { getDataView: false } },
1027
+ "/jzcrm/data": { GET: { getDataList: false } }
1028
+ });
1029
+ // lib/types/api/badge.js
1030
+ Internal.define({
1031
+ "/badge/notices": { POST: { createBadgeNotify: false } },
1032
+ "/badge/codes/verifyResults": { POST: { notifyBadgeCodeVerifyResult: false } },
1033
+ "/badge/codes/corpInstances": { POST: { saveBadgeCodeCorpInstance: false } },
1034
+ "/badge/codes/payResults": { POST: { notifyBadgeCodePayResult: false } },
1035
+ "/badge/codes/userInstances": {
1036
+ POST: { createBadgeCodeUserInstance: false },
1037
+ PUT: { updateBadgeCodeUserInstance: false }
1038
+ },
1039
+ "/badge/codes/refundResults": { POST: { notifyBadgeCodeRefundResult: false } },
1040
+ "/badge/codes/decode": { POST: { decodeBadgeCode: false } }
1041
+ });
1042
+ // lib/types/api/datacenter.js
1043
+ Internal.define({
1044
+ "/datacenter/generalDataServices": { GET: { queryGeneralDataService: false } },
1045
+ "/datacenter/onlineUserData": { GET: { queryOnlineUserStatisticalData: false } },
1046
+ "/datacenter/activeUserData": { GET: { queryActiveUserStatisticalData: false } },
1047
+ "/datacenter/employeeTypeData": { GET: { queryEmployeeTypeStatisticalData: false } },
1048
+ "/datacenter/circleData": { GET: { queryCircleStatisticalData: false } },
1049
+ "/datacenter/singleMessagerData": { GET: { querySingleMessageStatisticalData: false } },
1050
+ "/datacenter/groupMessageData": { GET: { queryGroupMessageStatisticalData: false } },
1051
+ "/datacenter/dingSendData": { GET: { queryDingSendStatisticalData: false } },
1052
+ "/datacenter/dingReciveData": { GET: { queryDingReciveStatisticalData: false } },
1053
+ "/datacenter/vedioMeetingData": { GET: { queryVedioMeetingStatisticalData: false } },
1054
+ "/datacenter/telMeetingData": { GET: { queryTelMeetingStatisticalData: false } },
1055
+ "/datacenter/groupLiveData": { GET: { queryGroupLiveStatisticalData: false } },
1056
+ "/datacenter/redEnvelopeSendData": { GET: { queryRedEnvelopeSendStatisticalData: false } },
1057
+ "/datacenter/redEnvelopeReciveData": { GET: { queryRedEnvelopeReciveStatisticalData: false } },
1058
+ "/datacenter/blackboardData": { GET: { queryBlackboardStatisticalData: false } },
1059
+ "/datacenter/todoUserData": { GET: { queryTodoStatisticalData: false } },
1060
+ "/datacenter/healtheUserData": { GET: { queryHealthStatisticalData: false } },
1061
+ "/datacenter/documentData": { GET: { queryDocumentStatisticalData: false } },
1062
+ "/datacenter/checkinData": { GET: { queryCheckinStatisticalData: false } },
1063
+ "/datacenter/approvalData": { GET: { queryApprovalStatisticalData: false } },
1064
+ "/datacenter/reportData": { GET: { queryReportStatisticalData: false } },
1065
+ "/datacenter/attendanceData": { GET: { queryAttendanceStatisticalData: false } },
1066
+ "/datacenter/driveData": { GET: { queryDriveStatisticalData: false } },
1067
+ "/datacenter/mailData": { GET: { queryMailStatisticalData: false } },
1068
+ "/datacenter/calendarData": { GET: { queryCalendarStatisticalData: false } },
1069
+ "/datacenter/digitalCounty/orgInfos/query": { POST: { queryDigitalDistrictOrgInfo: false } }
1070
+ });
1071
+ // lib/types/api/resident.js
1072
+ Internal.define({
1073
+ "/resident/points": { POST: { addPoint: false } },
1074
+ "/resident/points/records": { GET: { pagePointHistory: false } },
1075
+ "/resident/points/rules": { GET: { listPointRules: false } },
1076
+ "/resident/industryRoles/users": { GET: { listIndustryRoleUsers: false } },
1077
+ "/resident/users/industryRoles": { GET: { listUserIndustryRoles: false } }
1078
+ });
1079
+ // lib/types/api/wiki.js
1080
+ Internal.define({
1081
+ "/wiki/nodes": { GET: { listNodes: false } },
1082
+ "/wiki/nodes/queryByUrl": { POST: { getNodeByUrl: false } },
1083
+ "/wiki/nodes/batchQuery": { POST: { getNodes: false } },
1084
+ "/wiki/nodes/{nodeId}": { GET: { getNode: false } },
1085
+ "/wiki/words/details": { GET: { wikiWordsDetail: false } },
1086
+ "/wiki/words/parse": { POST: { wikiWordsParse: false } }
1087
+ });
1088
+ // lib/types/api/storage.js
1089
+ Internal.define({
1090
+ "/storage/workspaces/search": { POST: { searchWorkspaces: false } },
1091
+ "/storage/spaces/dentries/{dentryUuid}/permissions/inheritances": {
1092
+ PUT: { setPermissionInheritance: false },
1093
+ GET: { getPermissionInheritance: false }
1094
+ },
1095
+ "/storage/spaces/dentries/{dentryUuid}/permissions": {
1096
+ PUT: { storageUpdatePermission: false },
1097
+ POST: { storageAddPermission: false }
1098
+ },
1099
+ "/storage/spaces/dentries/{dentryUuid}/permissions/remove": { POST: { storageDeletePermission: false } },
1100
+ "/storage/spaces/dentries/{dentryUuid}/permissions/query": { POST: { listPermissionsOrg: false } },
1101
+ "/storage/dentries/search": { POST: { searchDentries: false } },
1102
+ "/storage/spaces/files/{parentDentryUuid}/commit": { POST: { storageCommitFile: false } },
1103
+ "/storage/spaces/files/{parentDentryUuid}/uploadInfos/query": { POST: { storageGetFileUploadInfo: false } },
1104
+ "/storage/events/unsubscribe": { POST: { unsubscribeEvent: false } },
1105
+ "/storage/spaces/{spaceId}/dentries/listAll": { POST: { listAllDentries: false } },
1106
+ "/storage/spaces/{spaceId}/dentries/query": { POST: { getDentries: false } },
1107
+ "/storage/spaces/{spaceId}/thumbnails/query": { POST: { getDentryThumbnails: false } },
1108
+ "/storage/spaces/{spaceId}/dentries/batchMove": { POST: { moveDentries: false } },
1109
+ "/storage/spaces/{spaceId}/dentries/batchCopy": { POST: { copyDentries: false } },
1110
+ "/storage/spaces/{spaceId}/dentries/batchRemove": { POST: { deleteDentries: false } },
1111
+ "/storage/tasks/{taskId}": { GET: { getTask: false } },
1112
+ "/storage/spaces/{spaceId}/files/multiPartUploadInfos/init": { POST: { initMultipartFileUpload: false } },
1113
+ "/storage/spaces/files/multiPartUploadInfos/query": { POST: { getMultipartFileUploadInfos: false } },
1114
+ "/storage/orgs/{corpId}": { GET: { getOrg: false } },
1115
+ "/storage/recycleBins/{recycleBinId}/recycleItems/{recycleItemId}/restore": { POST: { restoreRecycleItem: false } },
1116
+ "/storage/recycleBins": { GET: { getRecycleBin: false } },
1117
+ "/storage/recycleBins/{recycleBinId}/recycleItems/{recycleItemId}": {
1118
+ GET: { getRecycleItem: false },
1119
+ DELETE: { deleteRecycleItem: false }
1120
+ },
1121
+ "/storage/recycleBins/{recycleBinId}/clear": { POST: { clearRecycleBin: false } },
1122
+ "/storage/recycleBins/{recycleBinId}/recycleItems/batchRemove": { POST: { deleteRecycleItems: false } },
1123
+ "/storage/recycleBins/{recycleBinId}/recycleItems/batchRestore": { POST: { restoreRecycleItems: false } },
1124
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/versions": { GET: { listDentryVersions: false } },
1125
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/openInfos/query": { POST: { getDentryOpenInfo: false } },
1126
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/move": { POST: { moveDentry: false } },
1127
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/permissions/query": { POST: { listPermissionsIsv: false } },
1128
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/downloadInfos/query": { POST: { getFileDownloadInfo: false } },
1129
+ "/storage/recycleBins/{recycleBinId}/recycleItems": { GET: { listRecycleItems: false } },
1130
+ "/storage/spaces/{spaceId}/dentries/{dentryId}": { DELETE: { deleteDentry: false } },
1131
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/rename": { POST: { renameDentry: false } },
1132
+ "/storage/spaces/{spaceId}/dentries": { GET: { listDentries: false } },
1133
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/versions/{version}/revert": { POST: { revertDentryVersion: false } },
1134
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/copy": { POST: { copyDentry: false } },
1135
+ "/storage/currentApps/query": { POST: { getCurrentApp: false } },
1136
+ "/storage/spaces/{spaceId}": { GET: { storageGetSpace: false } },
1137
+ "/storage/spaces/{spaceId}/dentries/{parentId}/folders": { POST: { addFolder: false } },
1138
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/query": { POST: { getDentry: false } },
1139
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/appProperties/remove": { POST: { deleteDentryAppProperties: false } },
1140
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/appProperties": { PUT: { updateDentryAppProperties: false } },
1141
+ "/storage/spaces/{spaceId}/files/commit": { POST: { storageCommitFile: false } },
1142
+ "/storage/spaces/{spaceId}/files/uploadInfos/query": { POST: { storageGetFileUploadInfo: false } },
1143
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/permissions": {
1144
+ PUT: { storageUpdatePermission: false },
1145
+ POST: { storageAddPermission: false }
1146
+ },
1147
+ "/storage/spaces/{spaceId}/dentries/{dentryId}/permissions/remove": { POST: { storageDeletePermission: false } },
1148
+ "/storage/spaces": { POST: { storageAddSpace: false } }
1149
+ });
1150
+ // lib/types/api/doc.js
1151
+ Internal.define({
1152
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/setRowsVisibility": { POST: { setRowsVisibility: false } },
1153
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/setColumnsVisibility": { POST: { setColumnsVisibility: false } },
1154
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/deleteRows": { POST: { deleteRows: false } },
1155
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/deleteColumns": { POST: { deleteColumns: false } },
1156
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/insertRowsBefore": { POST: { insertRowsBefore: false } },
1157
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/insertColumnsBefore": { POST: { insertColumnsBefore: false } },
1158
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/ranges/{rangeAddress}/clear": { POST: { clear: false } },
1159
+ "/doc/workbooks/{workbookId}/sheets/{sheetId}/ranges/{rangeAddress}/clearData": { POST: { clearData: false } }
1160
+ });
1161
+ // lib/types/api/diot.js
1162
+ Internal.define({ "/diot/upgrade/device": { POST: { upgradeDevice: false } } });
1163
+ // lib/types/api/h3yun.js
1164
+ Internal.define({
1165
+ "/h3yun/attachments/uploadUrls": { GET: { getUploadUrl: false } },
1166
+ "/h3yun/apps/functionNodes": { GET: { queryAppFunctionNodes: false } },
1167
+ "/h3yun/processes/instances": {
1168
+ POST: { createProcessesInstance: false },
1169
+ DELETE: { deleteProcessesInstance: false },
1170
+ GET: { queryProcessesInstance: false }
1171
+ },
1172
+ "/h3yun/forms/loadBizFields": { GET: { loadBizFields: false } },
1173
+ "/h3yun/processes/workItems": { GET: { queryProcessesWorkItems: false } },
1174
+ "/h3yun/forms/instances/batch": { POST: { batchInsertBizObject: false } },
1175
+ "/h3yun/forms/instances": {
1176
+ DELETE: { deleteBizObject: false },
1177
+ POST: { createBizObject: false },
1178
+ PUT: { updateBizObject: false }
1179
+ },
1180
+ "/h3yun/processes/instances/cancel": { POST: { cancelProcessInstance: false } },
1181
+ "/h3yun/forms/instances/loadInstances": { GET: { loadBizObject: false } },
1182
+ "/h3yun/forms/instances/search": { POST: { loadBizObjects: false } },
1183
+ "/h3yun/attachments/temporaryUrls": { GET: { getAttachmentTemporaryUrl: false } },
1184
+ "/h3yun/roles/roleUsers": { GET: { getRoleUsers: false } },
1185
+ "/h3yun/roles": { GET: { getRoles: false } },
1186
+ "/h3yun/users": { GET: { getUsers: false } },
1187
+ "/h3yun/apps/search": { POST: { getApps: false } },
1188
+ "/h3yun/departments": { GET: { getOrganizations: false } }
1189
+ });
1190
+ // lib/types/api/link.js
1191
+ Internal.define({
1192
+ "/link/followers/statuses": { GET: { getUserFollowStatus: false } },
1193
+ "/link/accounts": { GET: { listAccount: false } },
1194
+ "/link/followers": { GET: { listFollower: false } },
1195
+ "/link/followers/infos": { GET: { getFollowerInfo: false } }
1196
+ });
1197
+ // lib/types/api/pedia.js
1198
+ Internal.define({
1199
+ "/pedia/words/query": { POST: { pediaWordsQuery: false } },
1200
+ "/pedia/words/search": { POST: { pediaWordsSearch: false } },
1201
+ "/pedia/words/approve": { POST: { pediaWordsApprove: false } },
1202
+ "/pedia/words": {
1203
+ DELETE: { pediaWordsDelete: false },
1204
+ PUT: { pediaWordsUpdate: false },
1205
+ POST: { pediaWordsAdd: false }
1206
+ }
1207
+ });
1208
+ // lib/types/api/devicemng.js
1209
+ Internal.define({
1210
+ "/devicemng/customers/devices/maintainInfos/query": { POST: { listMaintainInfo: false } },
1211
+ "/devicemng/customers/devices/inspectInfos/query": { POST: { listInspectInfo: false } },
1212
+ "/devicemng/customers/devices/activations/infos": { GET: { listActivateDevices: false } },
1213
+ "/devicemng/customers/devices/registrationActivations/batch": { POST: { registerAndActivateDeviceBatch: false } },
1214
+ "/devicemng/customers/devices/registerAndActivate": { POST: { registerAndActivateDevice: false } }
1215
+ });
1216
+ // lib/types/api/convFile.js
1217
+ Internal.define({
1218
+ "/convFile/conversations/files/links/send": { POST: { sendLink: false } },
1219
+ "/convFile/conversations/files/send": { POST: { send: false } },
1220
+ "/convFile/conversations/spaces/query": { POST: { convFileGetSpace: false } },
1221
+ "/convFile/apps/conversations/files/send": { POST: { sendByApp: false } }
1222
+ });
1223
+ // lib/types/api/industry.js
1224
+ Internal.define({
1225
+ "/industry/campuses/projectInfos": { GET: { campusGetCampus: false } },
1226
+ "/industry/campuses/projects/groupInfos": { GET: { campusGetCampusGroup: false } },
1227
+ "/industry/campuses/projects": { POST: { campusCreateCampus: false } },
1228
+ "/industry/campuses/projects/groups": {
1229
+ POST: { campusCreateCampusGroup: false },
1230
+ DELETE: { campusDeleteCampusGroup: false }
1231
+ }
1232
+ });
1233
+ // lib/types/api/live.js
1234
+ Internal.define({
1235
+ "/live/lives": {
1236
+ DELETE: { deleteLive: false },
1237
+ PUT: { updateLive: false },
1238
+ POST: { createLive: false },
1239
+ GET: { queryLiveInfo: false }
1240
+ },
1241
+ "/live/lives/watchUsers": { GET: { queryLiveWatchUserList: false } },
1242
+ "/live/lives/watchDetails": { GET: { queryLiveWatchDetail: false } }
1243
+ });
1244
+ // lib/types/api/card.js
1245
+ Internal.define({
1246
+ "/card/instances": {
1247
+ PUT: { updateCard: false },
1248
+ POST: { createCard: false }
1249
+ },
1250
+ "/card/instances/createAndDeliver": { POST: { createAndDeliver: false } },
1251
+ "/card/callbacks/register": { POST: { registerCallback: false } },
1252
+ "/card/instances/spaces": { PUT: { appendSpace: false } },
1253
+ "/card/instances/deliver": { POST: { deliverCard: false } }
1254
+ });
1255
+ // lib/types/api/rooms.js
1256
+ Internal.define({
1257
+ "/rooms/devices/properties/query": { POST: { queryDeviceProperties: false } },
1258
+ "/rooms/devices": { GET: { queryMeetingRoomDevice: false } },
1259
+ "/rooms/groups/{groupId}": {
1260
+ DELETE: { deleteMeetingRoomGroup: false },
1261
+ GET: { queryMeetingRoomGroup: false }
1262
+ },
1263
+ "/rooms/groups": {
1264
+ PUT: { updateMeetingRoomGroup: false },
1265
+ POST: { createMeetingRoomGroup: false }
1266
+ },
1267
+ "/rooms/groupLists": { GET: { queryMeetingRoomGroupList: false } },
1268
+ "/rooms/meetingRooms/{roomId}": {
1269
+ DELETE: { deleteMeetingRoom: false },
1270
+ GET: { queryMeetingRoom: false }
1271
+ },
1272
+ "/rooms/meetingRoomLists": { GET: { queryMeetingRoomList: false } },
1273
+ "/rooms/meetingRooms": { PUT: { updateMeetingRoom: false } },
1274
+ "/rooms/meetingrooms": { POST: { createMeetingRoom: false } }
1275
+ });
1276
+ // lib/types/types/index.js
1277
+ var types_exports = /* @__PURE__ */ __exportAll({});
1278
+ // lib/types/config.js
1279
+ /** Validated DingTalk adapter configuration. */
1280
+ const Config = z.object({
1281
+ appkey: z.string().required(),
1282
+ secret: z.string().role("secret").required(),
1283
+ protocol: z.union(["ws", "http"]).required(),
1284
+ path: z.string().default("/dingtalk"),
1285
+ apiBaseUrl: z.string().role("url").default("https://api.dingtalk.com"),
1286
+ oapiBaseUrl: z.string().role("url").default("https://oapi.dingtalk.com"),
1287
+ ws: z.object({
1288
+ retryTimes: z.natural().default(6),
1289
+ retryInterval: z.natural().role("ms").default(5e3),
1290
+ retryLazy: z.natural().role("ms").default(6e4)
1291
+ }).default({})
1292
+ });
1293
+ /**
1294
+ * The configuration the adapter cannot work from, as far as it can tell locally.
1295
+ *
1296
+ * A profile that leaves a credential out, or that points the OpenAPI root at a non-HTTPS origin, is refused when the
1297
+ * bot starts (`connect()`) rather than at the first dial or the first callback.
1298
+ *
1299
+ * @param config - the validated configuration.
1300
+ * @returns the configuration error, or undefined when the configuration is usable.
1301
+ */
1302
+ function configError(config) {
1303
+ if (config.appkey === "") return /* @__PURE__ */ new Error("dingtalk: appkey is required (the application Client ID, formerly AppKey)");
1304
+ if (config.secret === "") return /* @__PURE__ */ new Error("dingtalk: secret is required (the application Client Secret, formerly AppSecret)");
1305
+ for (const [name, url] of [["apiBaseUrl", config.apiBaseUrl], ["oapiBaseUrl", config.oapiBaseUrl]]) if (!url.startsWith("https://")) return /* @__PURE__ */ new Error(`dingtalk: ${name} must be an https URL, got "${url}"`);
1306
+ }
1307
+ /**
1308
+ * Normalize an inbound route path: absolute, no trailing slash.
1309
+ * @param path - the configured `path`.
1310
+ * @returns the pathname to register.
1311
+ */
1312
+ function routePath(path) {
1313
+ const withSlash = path.startsWith("/") ? path : `/${path}`;
1314
+ return withSlash.length > 1 ? withSlash.replace(/\/+$/, "") : withSlash;
1315
+ }
1316
+ // lib/types/media.js
1317
+ /**
1318
+ * Media: the outbound upload endpoint and the inbound `downloadCode` exchange.
1319
+ *
1320
+ * DingTalk has a standalone upload (`/media/upload`) whose `media_id` is reusable across chats, so outbound media
1321
+ * uploads once per content and the per-kind `sample*` template then carries the id. Inbound media is served from the
1322
+ * bot's own `satori:` route: a `downloadCode` is exchanged for a short-lived signed `downloadUrl` at read time, so a
1323
+ * message read later still resolves while the code is valid.
1324
+ */
1325
+ /** The platform's upload `type` of a MIME type: `image`, `voice`, `video` or `file`. */
1326
+ function mediaTypeOf(mime) {
1327
+ if (mime === void 0) return "file";
1328
+ if (mime.startsWith("image/")) return "image";
1329
+ if (mime.startsWith("video/")) return "video";
1330
+ if (mime.startsWith("audio/")) return "voice";
1331
+ return "file";
1332
+ }
1333
+ /** File name of a source, for the multipart part of an upload. */
1334
+ function fileNameOf(ref, fetchedName, mime) {
1335
+ if (ref.meta.name !== void 0 && ref.meta.name !== "") return ref.meta.name;
1336
+ if (fetchedName !== void 0 && fetchedName !== "") return fetchedName;
1337
+ const kind = ref.kind;
1338
+ const subtype = mime?.split("/")[1]?.split(";")[0];
1339
+ return `dingtalk-${kind}${subtype === void 0 ? "" : `.${subtype}`}`;
1340
+ }
1341
+ /**
1342
+ * Upload one outbound attachment and return its `media_id`.
1343
+ *
1344
+ * The endpoint is a legacy `oapi` multipart call: the `access_token` rides the query string (the transport adds it) and
1345
+ * the `type` + `media` fields are the body.
1346
+ *
1347
+ * @param bot - the adapter whose credentials and transport the upload uses.
1348
+ * @param ref - the unresolved resource.
1349
+ * @param ctx - fetch context of the send pipeline.
1350
+ * @returns the platform media key.
1351
+ */
1352
+ async function uploadMedia(bot, ref, ctx) {
1353
+ const fetched = await ctx.fetch(ref.src, ctx.signal);
1354
+ const mime = ref.meta.mime ?? fetched.mime;
1355
+ const name = fileNameOf(ref, fetched.name, mime);
1356
+ const form = new FormData();
1357
+ form.append("type", mediaTypeOf(mime));
1358
+ form.append("media", new Blob([fetched.data], mime === void 0 ? {} : { type: mime }), name);
1359
+ const answer = await invoke(bot, "oapi", "POST", "/media/upload", {
1360
+ data: form,
1361
+ signal: ctx.signal
1362
+ });
1363
+ if (answer.media_id === void 0 || answer.media_id === "") throw new PlatformError("invalid", "dingtalk: /media/upload answered without a media_id", { published: "unknown" });
1364
+ return {
1365
+ key: answer.media_id,
1366
+ extra: {
1367
+ name,
1368
+ ...mime === void 0 ? {} : { mime }
1369
+ }
1370
+ };
1371
+ }
1372
+ /**
1373
+ * Exchange an inbound `downloadCode` for the signed URL of its bytes.
1374
+ *
1375
+ * The URL is short-lived, so the route calls this per read instead of baking the URL into the decoded element.
1376
+ *
1377
+ * @param bot - the receiving adapter.
1378
+ * @param downloadCode - the code the callback carried.
1379
+ * @returns the signed download URL.
1380
+ */
1381
+ async function downloadUrlOf(bot, downloadCode) {
1382
+ const answer = await bot.internal.robotMessageFileDownload({
1383
+ downloadCode,
1384
+ robotCode: bot.config.appkey
1385
+ });
1386
+ if (answer.downloadUrl === "") throw new DingtalkApiError("dingtalk: messageFiles/download answered without a downloadUrl", { status: 200 });
1387
+ return answer.downloadUrl;
1388
+ }
1389
+ /**
1390
+ * The `satori:` source of one inbound media element.
1391
+ *
1392
+ * The platform's own `downloadCode` rides the query string, so a stored message stays readable with no adapter state: a
1393
+ * restart, another process of the same profile and a read days later all resolve while the code is valid. The path keeps
1394
+ * the message id and the media position, which name the element in a log line or a stored message.
1395
+ *
1396
+ * @param bot - the receiving adapter.
1397
+ * @param messageId - platform message id the element belongs to.
1398
+ * @param index - position of the media element in the message content.
1399
+ * @param code - the `downloadCode` the route exchanges for a signed URL.
1400
+ * @returns the internal URL the host downloads through.
1401
+ */
1402
+ function mediaSource(bot, messageId, index, code) {
1403
+ return bot.getInternalUrl(`/messages/${encodeURIComponent(messageId)}/resources/${index}`, { code });
1404
+ }
1405
+ // lib/types/modes/shared.js
1406
+ /**
1407
+ * Nodes, drafts, payloads and text rules of the single `markdown` mode.
1408
+ *
1409
+ * DingTalk renders one body per outgoing message from `msgKey` + `msgParam`, and a message carries at most one media
1410
+ * item, so media leaves the text run and becomes a message of its own (as the upstream encoder did by splitting an image
1411
+ * out of the markdown).
1412
+ */
1413
+ /** Zero-width non-joiner: a body the platform accepts where the content is empty. */
1414
+ const ZERO_WIDTH = "⁠";
1415
+ /** The two bounds the platform documents, and nothing else. */
1416
+ const DINGTALK_LIMITS = {
1417
+ /**
1418
+ * `msgParam` is capped at 15000 bytes ("长度限制 15000 字节以内"). The adapter measures the UTF-8 bytes of the JSON
1419
+ * body it sends; a platform that counted characters instead would only make an accepted body shorter.
1420
+ */
1421
+ payloadBytes: 15e3,
1422
+ /** A single-chat message can be recalled within 24 hours; the group endpoint documents no other window. */
1423
+ deleteWindowMs: 864e5
1424
+ };
1425
+ /** Title length; the notification and the conversation list show it. */
1426
+ const TITLE_LENGTH = 40;
1427
+ /**
1428
+ * Escape text so DingTalk markdown renders it literally.
1429
+ *
1430
+ * Four rules, identical to the upstream encoder's: a markup character gets a zero-width space, markdown punctuation
1431
+ * gets a backslash, a list marker after a space is broken up, and four leading spaces (a code block) are replaced.
1432
+ *
1433
+ * @param text - the text of a `text` element.
1434
+ * @returns the text to append to the markdown body.
1435
+ */
1436
+ function escape(text) {
1437
+ return text.replace(/(?<!\u200B)[*_~`]/g, "​$&").replace(/([\\`*_{}[\]\-(#!>])/g, "\\$&").replace(/([\-*]|\d\.) /g, "​$&").replace(/^(\s{4})/gm, "​&nbsp;&nbsp;&nbsp;&nbsp;");
1438
+ }
1439
+ /**
1440
+ * Undo {@link escape}.
1441
+ *
1442
+ * DingTalk never echoes what the adapter sent, so this exists for the inbound side and to keep a round trip of the
1443
+ * upstream rules testable.
1444
+ *
1445
+ * @param text - escaped text.
1446
+ * @returns the text as it was written.
1447
+ */
1448
+ function unescape(text) {
1449
+ return text.replace(/\u200B([*_~`])/g, "$1");
1450
+ }
1451
+ /** The visible text of one line of markdown, with the notation this adapter emits removed. */
1452
+ function plainLine(line) {
1453
+ return line.replace(/\u200B/g, "").replace(/\\(.)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/`/g, "").replace(/\*\*|__/g, "").replace(/[*_~]/g, "").replace(/^#+\s*/, "").replace(/^\d+\.\s+/, "").replace(/^[-*]\s+/, "").replace(/^>\s?/, "");
1454
+ }
1455
+ /**
1456
+ * The `title` the `sampleMarkdown` template requires.
1457
+ *
1458
+ * The error table names `miss.param.markdownTotitle`, so the field is sent even though the upstream adapter left it
1459
+ * out: the first non-empty line, its markdown notation removed, cut to 40 characters.
1460
+ *
1461
+ * @param text - the body of the draft, before the paragraph newlines are doubled.
1462
+ * @returns the title, or a zero-width body when the message has no visible text.
1463
+ */
1464
+ function titleOf(text) {
1465
+ const line = text.split("\n").find((item) => item.trim() !== "");
1466
+ if (line === void 0) return "⁠";
1467
+ const plain = plainLine(line).trim();
1468
+ if (plain === "") return "⁠";
1469
+ return [...plain].slice(0, TITLE_LENGTH).join("");
1470
+ }
1471
+ /** DingTalk markdown separates paragraphs with a blank line; this is the only place newlines are doubled. */
1472
+ function paragraphBreaks(text) {
1473
+ return text.replace(/\n/g, "\n\n");
1474
+ }
1475
+ /**
1476
+ * Media element → the node of its own platform message.
1477
+ *
1478
+ * A DingTalk message carries one media item, so media never stays inside a text run. Media that stood in phrasing
1479
+ * content (`<p>`, a heading, a link, an inline wrapper) is reported as `moved`: the caller sees the text plus an extra
1480
+ * media message instead of one block.
1481
+ *
1482
+ * @param el - one of `img`/`audio`/`video`/`file`.
1483
+ * @param ctx - render context of the mode.
1484
+ * @returns the media node, published after the text run it was found in.
1485
+ */
1486
+ function mediaNode(el, ctx) {
1487
+ const parent = ctx.ancestors[ctx.ancestors.length - 1];
1488
+ if (parent !== void 0 && isPhrasingContainer(parent.type)) ctx.report.moved.push({
1489
+ tag: el.type,
1490
+ reason: "dingtalk-media-split",
1491
+ path: ctx.stableId(el)
1492
+ });
1493
+ switch (el.type) {
1494
+ case "img": return {
1495
+ type: "media",
1496
+ media: {
1497
+ kind: "image",
1498
+ ref: ctx.resource("image", el.attrs.src, {})
1499
+ }
1500
+ };
1501
+ case "audio": return {
1502
+ type: "media",
1503
+ media: audioMedia(el, ctx)
1504
+ };
1505
+ case "video": return {
1506
+ type: "media",
1507
+ media: {
1508
+ kind: "video",
1509
+ ref: ctx.resource("video", el.attrs.src, {
1510
+ ...el.attrs.name === void 0 ? {} : { name: el.attrs.name },
1511
+ ...el.attrs.duration === void 0 ? {} : { duration: el.attrs.duration }
1512
+ }),
1513
+ ...el.attrs.name === void 0 ? {} : { name: el.attrs.name },
1514
+ ...el.attrs.duration === void 0 ? {} : { duration: el.attrs.duration }
1515
+ }
1516
+ };
1517
+ case "file": return {
1518
+ type: "media",
1519
+ media: {
1520
+ kind: "file",
1521
+ ref: ctx.resource("file", el.attrs.src, el.attrs.name === void 0 ? {} : { name: el.attrs.name }),
1522
+ ...el.attrs.name === void 0 ? {} : { name: el.attrs.name }
1523
+ }
1524
+ };
1525
+ }
1526
+ }
1527
+ /** Audio has the same fields as video without a poster, split out so the switch above stays readable. */
1528
+ function audioMedia(el, ctx) {
1529
+ return {
1530
+ kind: "audio",
1531
+ ref: ctx.resource("audio", el.attrs.src, {
1532
+ ...el.attrs.name === void 0 ? {} : { name: el.attrs.name },
1533
+ ...el.attrs.duration === void 0 ? {} : { duration: el.attrs.duration }
1534
+ }),
1535
+ ...el.attrs.name === void 0 ? {} : { name: el.attrs.name },
1536
+ ...el.attrs.duration === void 0 ? {} : { duration: el.attrs.duration }
1537
+ };
1538
+ }
1539
+ /** One text run being accumulated, in send order. */
1540
+ var Run = class {
1541
+ buffer = "";
1542
+ /** The text so far, and the media that has to go out before the next text draft. */
1543
+ drafts = [];
1544
+ /** Append text. */
1545
+ push(content) {
1546
+ this.buffer += content;
1547
+ }
1548
+ /** Close the current line unless it is already closed. */
1549
+ breakLine() {
1550
+ if (this.buffer === "" || this.buffer.endsWith("\n")) return;
1551
+ this.buffer += "\n";
1552
+ }
1553
+ /** Emit the accumulated text as a draft of its own, then the media. */
1554
+ flush(next) {
1555
+ const text = this.buffer.trim();
1556
+ this.buffer = "";
1557
+ if (text !== "") this.drafts.push({
1558
+ kind: "text",
1559
+ text
1560
+ });
1561
+ if (next !== void 0) this.drafts.push({
1562
+ kind: "media",
1563
+ media: next
1564
+ });
1565
+ }
1566
+ };
1567
+ /**
1568
+ * Fold a node stream into platform messages: a text draft per run, and one draft per media item.
1569
+ *
1570
+ * DingTalk sends one media item per message, so a run of text followed by an image is two platform messages; the run is
1571
+ * split rather than merged into the image, because no template carries both.
1572
+ *
1573
+ * @param nodes - rendered nodes, in source order.
1574
+ * @returns at least one draft; empty content yields an empty text draft.
1575
+ */
1576
+ function assembleDraft(nodes) {
1577
+ const run = new Run();
1578
+ for (const node of nodes) switch (node.type) {
1579
+ case "text":
1580
+ run.push(node.content);
1581
+ break;
1582
+ case "break":
1583
+ run.breakLine();
1584
+ break;
1585
+ case "media": run.flush(node.media);
1586
+ }
1587
+ run.flush();
1588
+ if (run.drafts.length === 0) run.drafts.push({
1589
+ kind: "text",
1590
+ text: ""
1591
+ });
1592
+ return run.drafts;
1593
+ }
1594
+ /** The upload's own report of a media item (`extra`), when the adapter recorded one. */
1595
+ function extraOf(value) {
1596
+ if (typeof value !== "object" || value === null) return void 0;
1597
+ const name = "name" in value && typeof value.name === "string" ? value.name : void 0;
1598
+ const mime = "mime" in value && typeof value.mime === "string" ? value.mime : void 0;
1599
+ if (name === void 0 && mime === void 0) return void 0;
1600
+ return {
1601
+ ...name === void 0 ? {} : { name },
1602
+ ...mime === void 0 ? {} : { mime }
1603
+ };
1604
+ }
1605
+ /** Resolve one media item of a prepared draft. */
1606
+ function resolvedMedia(prepared, media) {
1607
+ const resolved = prepared.resolved.get(media.ref);
1608
+ if (resolved === void 0) throw new Error("dingtalk: media was not prepared before serialize");
1609
+ const extra = extraOf(resolved.extra);
1610
+ return {
1611
+ key: resolved.key,
1612
+ name: media.name ?? extra?.name,
1613
+ mime: media.ref.meta.mime ?? extra?.mime
1614
+ };
1615
+ }
1616
+ /** File extension of a name, without the dot. */
1617
+ function extensionOf(name) {
1618
+ if (name === void 0) return void 0;
1619
+ const dot = name.lastIndexOf(".");
1620
+ if (dot <= 0 || dot === name.length - 1) return void 0;
1621
+ return name.slice(dot + 1).toLowerCase();
1622
+ }
1623
+ /** Media type of a MIME type: the subtype, without any `+suffix`. */
1624
+ function subtypeOf(mime) {
1625
+ if (mime === void 0) return void 0;
1626
+ const subtype = mime.split(";")[0].split("/")[1];
1627
+ if (subtype === void 0) return void 0;
1628
+ return subtype.replace(/\+.*$/, "");
1629
+ }
1630
+ /**
1631
+ * The `fileType` field of `sampleFile`.
1632
+ * @param name - file name of the attachment.
1633
+ * @param mime - MIME type the upload detected.
1634
+ * @returns the extension of the name, else the MIME subtype, else `file`.
1635
+ */
1636
+ function fileTypeOf(name, mime) {
1637
+ return extensionOf(name) ?? subtypeOf(mime) ?? "file";
1638
+ }
1639
+ /**
1640
+ * Build the request payload of one draft.
1641
+ *
1642
+ * The paragraph newlines are doubled here and nowhere else: `assemble` keeps single newlines, so a text that already
1643
+ * contains them cannot be doubled twice.
1644
+ *
1645
+ * @param prepared - the draft with every resource resolved.
1646
+ * @param _ctx - serialize context (the adapter needs nothing from it; quotes are not rendered, see the design).
1647
+ * @returns the exact `msgKey` + `msgParam` pair of the message.
1648
+ */
1649
+ function serializeDraft(prepared, _ctx) {
1650
+ const draft = prepared.draft;
1651
+ if (draft.kind === "text") {
1652
+ const text = paragraphBreaks(draft.text);
1653
+ return {
1654
+ kind: "text",
1655
+ msgKey: "sampleMarkdown",
1656
+ msgParam: {
1657
+ title: titleOf(draft.text),
1658
+ text: text === "" ? "⁠" : text
1659
+ }
1660
+ };
1661
+ }
1662
+ const media = resolvedMedia(prepared, draft.media);
1663
+ switch (draft.media.kind) {
1664
+ case "image": return {
1665
+ kind: "image",
1666
+ msgKey: "sampleImageMsg",
1667
+ msgParam: { photoURL: media.key }
1668
+ };
1669
+ case "audio": return {
1670
+ kind: "audio",
1671
+ msgKey: "sampleAudio",
1672
+ msgParam: {
1673
+ mediaId: media.key,
1674
+ duration: String(draft.media.duration ?? 0)
1675
+ }
1676
+ };
1677
+ case "video": return {
1678
+ kind: "video",
1679
+ msgKey: "sampleVideo",
1680
+ msgParam: {
1681
+ duration: String(draft.media.duration ?? 0),
1682
+ videoMediaId: media.key,
1683
+ videoType: "mp4"
1684
+ }
1685
+ };
1686
+ case "file": return {
1687
+ kind: "file",
1688
+ msgKey: "sampleFile",
1689
+ msgParam: {
1690
+ mediaId: media.key,
1691
+ fileName: media.name ?? "file",
1692
+ fileType: fileTypeOf(media.name, media.mime)
1693
+ }
1694
+ };
1695
+ }
1696
+ }
1697
+ /**
1698
+ * Hard platform limits of one draft, checked before any request.
1699
+ *
1700
+ * Only `msgParam` can fail: a text body over 15000 bytes is refused by the platform, and truncating it would silently
1701
+ * drop model output. A media item's `msgParam` is a handful of ids and never reaches the bound.
1702
+ *
1703
+ * @param draft - the assembled draft.
1704
+ * @returns every violation the platform would refuse.
1705
+ */
1706
+ function checkDraft(draft) {
1707
+ if (draft.kind !== "text") return [];
1708
+ const bytes = Buffer.byteLength(JSON.stringify({
1709
+ title: titleOf(draft.text),
1710
+ text: paragraphBreaks(draft.text) || "⁠"
1711
+ }), "utf8");
1712
+ if (bytes <= DINGTALK_LIMITS.payloadBytes) return [];
1713
+ return [{
1714
+ kind: "size",
1715
+ key: "limit.payload.bytes",
1716
+ limit: DINGTALK_LIMITS.payloadBytes,
1717
+ actual: bytes,
1718
+ message: `DingTalk accepts ${DINGTALK_LIMITS.payloadBytes} bytes of msgParam, got ${bytes}`
1719
+ }];
1720
+ }
1721
+ // lib/types/modes/markdown.js
1722
+ /**
1723
+ * The single `markdown` mode: DingTalk message markdown.
1724
+ *
1725
+ * Native tags are the ones DingTalk's markdown subset renders (text, formatting, links, mentions as plain text, headings,
1726
+ * lists, quotes, code) plus the media that travels as its own message. Everything else takes the core fallback and is
1727
+ * reported as degraded: an ActionCard's buttons are all jump links, so no second mode could carry more.
1728
+ */
1729
+ /** A text node. */
1730
+ function text(content) {
1731
+ return {
1732
+ type: "text",
1733
+ content
1734
+ };
1735
+ }
1736
+ /**
1737
+ * Prefix every line of a subtree with the quote marker.
1738
+ * @param nodes - rendered children of the quote block.
1739
+ * @returns the same content with `> ` at the start of every line.
1740
+ */
1741
+ function quoteLines(nodes) {
1742
+ const quoted = [];
1743
+ let atLineStart = true;
1744
+ for (const node of nodes) {
1745
+ if (node.type === "break") {
1746
+ atLineStart = true;
1747
+ quoted.push(node);
1748
+ continue;
1749
+ }
1750
+ if (node.type !== "text") {
1751
+ quoted.push(node);
1752
+ continue;
1753
+ }
1754
+ let content = "";
1755
+ for (const char of node.content) {
1756
+ if (atLineStart && char !== "\n") content += "> ";
1757
+ content += char;
1758
+ atLineStart = char === "\n";
1759
+ }
1760
+ quoted.push(text(content));
1761
+ }
1762
+ return quoted;
1763
+ }
1764
+ /**
1765
+ * The rendered children without the leading break a container may add.
1766
+ * @param nodes - rendered children.
1767
+ * @returns the children, with a leading break removed.
1768
+ */
1769
+ function withoutLeadingBreaks(nodes) {
1770
+ return nodes[0]?.type === "break" ? nodes.slice(1) : [...nodes];
1771
+ }
1772
+ /** A block element: one line start, its content, and a closing line break. */
1773
+ function block(nodes) {
1774
+ return [
1775
+ { type: "break" },
1776
+ ...withoutLeadingBreaks(nodes),
1777
+ { type: "break" }
1778
+ ];
1779
+ }
1780
+ /** A heading line: `#` repeated for the level, then the content on one line. */
1781
+ function heading(level, nodes) {
1782
+ return [
1783
+ { type: "break" },
1784
+ text(`${"#".repeat(level)} `),
1785
+ ...withoutLeadingBreaks(nodes),
1786
+ { type: "break" }
1787
+ ];
1788
+ }
1789
+ /** Build the `markdown` mode. */
1790
+ function createMarkdownMode() {
1791
+ const elements = new ElementRegistry().register("text", (el) => text(escape(el.attrs.content))).register("p", (el, ctx) => block(ctx.render(el.children))).register("br", () => text("\n")).register("b", (el, ctx) => [
1792
+ text("**"),
1793
+ ...ctx.render(el.children),
1794
+ text("**")
1795
+ ]).register("i", (el, ctx) => [
1796
+ text("*"),
1797
+ ...ctx.render(el.children),
1798
+ text("*")
1799
+ ]).register("a", (el, ctx) => {
1800
+ const children = ctx.render(el.children);
1801
+ const media = children.filter((node) => node.type === "media");
1802
+ const body = children.filter((node) => node.type === "text");
1803
+ const label = body.length === 0 ? [text(escape(el.attrs.href))] : body;
1804
+ return [
1805
+ text("["),
1806
+ ...label,
1807
+ text(`](${encodeURI(el.attrs.href)})`),
1808
+ ...media
1809
+ ];
1810
+ }).register("at", (el) => text(`@${el.attrs.id ?? ""}`), { variants: ["user"] }).register("h1", (el, ctx) => heading(1, ctx.render(el.children))).register("h2", (el, ctx) => heading(2, ctx.render(el.children))).register("h3", (el, ctx) => heading(3, ctx.render(el.children))).register("h4", (el, ctx) => heading(4, ctx.render(el.children))).register("h5", (el, ctx) => heading(5, ctx.render(el.children))).register("h6", (el, ctx) => heading(6, ctx.render(el.children))).register("ul", (el, ctx) => block(ctx.render(el.children))).register("ol", (el, ctx) => block(ctx.render(el.children))).register("li", (el, ctx) => {
1811
+ return [
1812
+ { type: "break" },
1813
+ text(ctx.ancestors[ctx.ancestors.length - 1]?.type === "ol" ? "1. " : "- "),
1814
+ ...withoutLeadingBreaks(ctx.render(el.children)),
1815
+ { type: "break" }
1816
+ ];
1817
+ }).register("blockquote", (el, ctx) => block(quoteLines(ctx.render(el.children)))).register("code", (el, ctx) => [text(`\`${ctx.text(el.children).replaceAll("`", "​")}\``)]).register("pre", (el, ctx) => [
1818
+ { type: "break" },
1819
+ text(`\`\`\`${el.attrs.lang ?? ""}\n`),
1820
+ text(ctx.text(el.children)),
1821
+ text("\n```"),
1822
+ { type: "break" }
1823
+ ], { variants: ["lang"] }).register("img", (el, ctx) => mediaNode(el, ctx), { variants: ["inline"] }).register("audio", (el, ctx) => mediaNode(el, ctx)).register("video", (el, ctx) => mediaNode(el, ctx)).register("file", (el, ctx) => mediaNode(el, ctx));
1824
+ return defineMode()({
1825
+ id: "markdown",
1826
+ elements,
1827
+ limits: {
1828
+ "limit.payload.bytes": DINGTALK_LIMITS.payloadBytes,
1829
+ "limit.delete.window": DINGTALK_LIMITS.deleteWindowMs
1830
+ },
1831
+ assemble: (nodes) => assembleDraft(nodes),
1832
+ serialize: (prepared, ctx) => serializeDraft(prepared, ctx),
1833
+ check: (draft) => checkDraft(draft)
1834
+ });
1835
+ }
1836
+ // lib/types/send.js
1837
+ /**
1838
+ * Outbound calls: one serialized payload becomes one platform message, and one published part becomes one recall.
1839
+ *
1840
+ * A group message posts to `groupMessages/send` with the open conversation id; a single chat posts to
1841
+ * `oToMessages/batchSend` with the recipient's staff id. The response's `processQueryKey` is the only handle a recall
1842
+ * accepts, so a send answer without one is reported as an unknown outcome rather than an unpublished one.
1843
+ */
1844
+ /** The platform message id of one payload, for the diagnostic record kept in `SentPart.raw`. */
1845
+ function mediaIdOf(payload) {
1846
+ switch (payload.kind) {
1847
+ case "text": return;
1848
+ case "image": return payload.msgParam.photoURL;
1849
+ case "audio":
1850
+ case "file": return payload.msgParam.mediaId;
1851
+ case "video": return payload.msgParam.videoMediaId;
1852
+ }
1853
+ }
1854
+ /** The published part of one platform message. */
1855
+ function partOf(payload, processQueryKey, referrer) {
1856
+ if (processQueryKey === void 0 || processQueryKey === "") throw new PlatformError("invalid", "dingtalk: the send answer carried no processQueryKey", { published: "unknown" });
1857
+ const mediaId = mediaIdOf(payload);
1858
+ return {
1859
+ id: processQueryKey,
1860
+ kind: "message",
1861
+ time: Date.now(),
1862
+ referrer,
1863
+ raw: {
1864
+ msgKey: payload.msgKey,
1865
+ ...mediaId === void 0 ? {} : { mediaId }
1866
+ }
1867
+ };
1868
+ }
1869
+ /**
1870
+ * The adapter context one published part reports.
1871
+ *
1872
+ * The platform has no quoted reply, so the id of the quoted message is recorded for diagnostics only (never rendered).
1873
+ *
1874
+ * @param conversation - the conversation fields of the send answer.
1875
+ * @param ctx - core send context: `quote` is present on every part, and only part 0 records it.
1876
+ * @returns the referrer of the published part.
1877
+ */
1878
+ function referrerOf(conversation, ctx) {
1879
+ return {
1880
+ ...conversation,
1881
+ ...ctx.index === 0 && ctx.quote !== void 0 ? { quotedMessageId: ctx.quote } : {}
1882
+ };
1883
+ }
1884
+ /**
1885
+ * Send one serialized payload.
1886
+ *
1887
+ * @param deps - adapter services.
1888
+ * @param payload - the serialized draft.
1889
+ * @param target - the chat the payload goes to.
1890
+ * @param ctx - core send context (part index, cancellation, quote).
1891
+ * @returns the published part.
1892
+ */
1893
+ async function sendPayload(deps, payload, target, ctx) {
1894
+ const msgParam = JSON.stringify(payload.msgParam);
1895
+ const robotCode = deps.config.appkey;
1896
+ if (target.chat.type === "direct") {
1897
+ const answer = await deps.internal.batchSendOTO({
1898
+ robotCode,
1899
+ userIds: [target.chat.id],
1900
+ msgKey: payload.msgKey,
1901
+ msgParam
1902
+ });
1903
+ const invalid = answer.invalidStaffIdList ?? [];
1904
+ if (invalid.length > 0) throw new PlatformError("invalid", `dingtalk: the recipient cannot receive a robot message (${invalid.join(", ")})`, {
1905
+ published: "no",
1906
+ code: "invalidStaffIdList"
1907
+ });
1908
+ const flowControlled = answer.flowControlledStaffIdList ?? [];
1909
+ if (flowControlled.length > 0) throw new PlatformError("rate-limit", `dingtalk: the recipient is flow-controlled (${flowControlled.join(", ")})`, {
1910
+ published: "no",
1911
+ code: "flowControlledStaffIdList"
1912
+ });
1913
+ return partOf(payload, answer.processQueryKey, referrerOf({
1914
+ conversationType: "1",
1915
+ userId: target.chat.id
1916
+ }, ctx));
1917
+ }
1918
+ return partOf(payload, (await deps.internal.orgGroupSend({
1919
+ robotCode,
1920
+ openConversationId: target.chat.id,
1921
+ msgKey: payload.msgKey,
1922
+ msgParam
1923
+ })).processQueryKey, referrerOf({
1924
+ conversationType: "2",
1925
+ openConversationId: target.chat.id
1926
+ }, ctx));
1927
+ }
1928
+ /**
1929
+ * Recall one published message.
1930
+ *
1931
+ * The recall answers with the ids it accepted; an answer that does not list this part means the message was already
1932
+ * recalled, expired past the window, or is not the robot's.
1933
+ *
1934
+ * @param deps - adapter services.
1935
+ * @param part - the published part.
1936
+ * @param handle - the message handle (carries the target chat).
1937
+ */
1938
+ async function deletePart(deps, part, handle) {
1939
+ const robotCode = deps.config.appkey;
1940
+ if (handle.target.chat.type === "direct") {
1941
+ if (!((await deps.internal.batchRecallOTO({
1942
+ robotCode,
1943
+ processQueryKeys: [part.id]
1944
+ })).successResult ?? []).includes(part.id)) throw new PlatformError("not-found", `dingtalk: the recall did not accept ${part.id}`, { published: "no" });
1945
+ return;
1946
+ }
1947
+ if (!((await deps.internal.orgGroupRecall({
1948
+ robotCode,
1949
+ openConversationId: handle.target.chat.id,
1950
+ processQueryKeys: [part.id]
1951
+ })).successResult ?? []).includes(part.id)) throw new PlatformError("not-found", `dingtalk: the recall did not accept ${part.id}`, { published: "no" });
1952
+ }
1953
+ // lib/types/token.js
1954
+ /**
1955
+ * The application `accessToken` every `/v1.0/*` request carries.
1956
+ *
1957
+ * The platform mints one token per application with a two-hour lifetime, and warns against requesting it often, so the
1958
+ * cache is lazy (no background timer) and single-flight: concurrent callers share one request. A refusal classified as
1959
+ * an authentication failure invalidates the cache and the caller asks again.
1960
+ */
1961
+ /** Seconds shaved off the announced lifetime, so a request never races the expiry. */
1962
+ const REFRESH_MARGIN_SECONDS = 300;
1963
+ var AccessTokenCache = class {
1964
+ mint;
1965
+ now;
1966
+ current;
1967
+ inflight;
1968
+ /**
1969
+ * @param mint - requests a new token from the platform.
1970
+ * @param now - clock of the expiry check; tests replace it.
1971
+ */
1972
+ constructor(mint, now = Date.now) {
1973
+ this.mint = mint;
1974
+ this.now = now;
1975
+ }
1976
+ /** The cached token, requesting one when none is cached or the cached one is near its expiry. */
1977
+ async get() {
1978
+ const current = this.current;
1979
+ if (current !== void 0 && this.now() < current.expiresAt) return current.value;
1980
+ this.inflight ??= this.mint().then((answer) => {
1981
+ if (answer.accessToken === void 0 || answer.accessToken === "") throw new Error("dingtalk: getAccessToken answered without a token");
1982
+ const expireIn = answer.expireIn;
1983
+ if (typeof expireIn === "number" && Number.isFinite(expireIn)) this.current = {
1984
+ value: answer.accessToken,
1985
+ expiresAt: this.now() + (expireIn - REFRESH_MARGIN_SECONDS) * 1e3
1986
+ };
1987
+ return answer.accessToken;
1988
+ }).finally(() => {
1989
+ this.inflight = void 0;
1990
+ });
1991
+ return await this.inflight;
1992
+ }
1993
+ /** Drop the cached token, so the next {@link get} asks the platform again. */
1994
+ invalidate() {
1995
+ this.current = void 0;
1996
+ }
1997
+ /** The token in the cache, when one is cached; for diagnostics only. */
1998
+ get cached() {
1999
+ return this.current?.value;
2000
+ }
2001
+ /** Whether a token request is in flight, so the transport can leave the minting request itself unauthenticated. */
2002
+ get minting() {
2003
+ return this.inflight !== void 0;
2004
+ }
2005
+ };
2006
+ // lib/types/decode.js
2007
+ /**
2008
+ * Inbound decoding: one bot-message callback body becomes an intake `Session`.
2009
+ *
2010
+ * DingTalk pushes six `msgtype`s to a robot (`text`, `richText`, `picture`, `file`, `audio`, `video`); all become one
2011
+ * message event. Media elements name the bot's own `satori:` route rather than the platform's signed download URL, so a
2012
+ * message read after the URL expired still resolves (the route exchanges the `downloadCode` per read).
2013
+ */
2014
+ /** The `errorCode` of a delivery failure body, which carries no message content. */
2015
+ function errorCodeOf(body) {
2016
+ return "errorCode" in body ? body.errorCode : void 0;
2017
+ }
2018
+ /** The `errorMessage` of a delivery failure body. */
2019
+ function errorMessageOf(body) {
2020
+ return "errorMessage" in body ? body.errorMessage : void 0;
2021
+ }
2022
+ /**
2023
+ * Chat of one callback.
2024
+ *
2025
+ * A group message names its open conversation; a single chat has no conversation id on the send side, so the chat is
2026
+ * the staff id the single-chat send endpoint addresses.
2027
+ *
2028
+ * @param body - the callback body.
2029
+ * @param senderId - resolved sender id.
2030
+ * @returns the chat reference.
2031
+ */
2032
+ function chatOf(body, senderId) {
2033
+ if (body.conversationType === "1") return {
2034
+ id: senderId,
2035
+ type: "direct"
2036
+ };
2037
+ return {
2038
+ id: body.conversationId,
2039
+ type: "group",
2040
+ ...body.conversationTitle === void 0 ? {} : { name: body.conversationTitle }
2041
+ };
2042
+ }
2043
+ /** The sender of one callback: `senderStaffId` exists only for an internal chat of a published robot. */
2044
+ function senderOf(body) {
2045
+ return {
2046
+ id: body.senderStaffId || body.senderId,
2047
+ ...body.senderNick ? { name: body.senderNick } : {},
2048
+ isBot: false,
2049
+ role: body.isAdmin === true ? "admin" : "member"
2050
+ };
2051
+ }
2052
+ /** Mentions of one callback: a group message reaches a robot only when it mentions it. */
2053
+ function mentionsOf(body, chat) {
2054
+ const users = [];
2055
+ for (const at of body.atUsers ?? []) {
2056
+ const id = at.staffId || at.dingtalkId;
2057
+ if (id) users.push({ id });
2058
+ }
2059
+ return {
2060
+ self: chat.type === "group",
2061
+ all: false,
2062
+ users
2063
+ };
2064
+ }
2065
+ /** The `createAt` timestamp, which the platform sends as a string in the documented sample and as a number in practice. */
2066
+ function timeOf(body) {
2067
+ const time = Number(body.createAt);
2068
+ return Number.isFinite(time) ? time : Date.now();
2069
+ }
2070
+ /**
2071
+ * One media element of a message, with the source the host reads it through.
2072
+ *
2073
+ * @param bot - the receiving adapter.
2074
+ * @param body - the callback body the element comes from.
2075
+ * @param code - the platform `downloadCode` of this media item.
2076
+ * @param index - position of the media element in the message content.
2077
+ * @returns the element; its `src` carries the code, so the host can resolve it without adapter state.
2078
+ */
2079
+ function mediaElement(bot, body, code, index) {
2080
+ const src = mediaSource(bot, body.msgId, index, code);
2081
+ switch (body.msgtype) {
2082
+ case "picture": return h("img", { src });
2083
+ case "file": return h("file", {
2084
+ src,
2085
+ ...body.content.fileName ? { name: body.content.fileName } : {}
2086
+ });
2087
+ case "audio": return h("audio", {
2088
+ src,
2089
+ ...body.content.duration === void 0 ? {} : { duration: body.content.duration }
2090
+ });
2091
+ case "video": return h("video", {
2092
+ src,
2093
+ ...body.content.duration === void 0 ? {} : { duration: body.content.duration }
2094
+ });
2095
+ default: return h("img", { src });
2096
+ }
2097
+ }
2098
+ /** The content tree of one callback, never empty. */
2099
+ function decodeContent(bot, body) {
2100
+ const nodes = [];
2101
+ let index = 0;
2102
+ switch (body.msgtype) {
2103
+ case "text":
2104
+ nodes.push(h.text(body.text.content));
2105
+ break;
2106
+ case "richText":
2107
+ for (const item of body.content.richText) {
2108
+ if (item.text) {
2109
+ nodes.push(h.text(item.text));
2110
+ continue;
2111
+ }
2112
+ const code = item.downloadCode || item.pictureDownloadCode;
2113
+ if (!code) continue;
2114
+ nodes.push(mediaElement(bot, body, code, index));
2115
+ index += 1;
2116
+ }
2117
+ break;
2118
+ case "picture":
2119
+ case "file":
2120
+ case "audio":
2121
+ case "video":
2122
+ if (body.content.downloadCode) nodes.push(mediaElement(bot, body, body.content.downloadCode, 0));
2123
+ if (body.msgtype === "audio" && body.content.recognition) nodes.push(h.text(body.content.recognition));
2124
+ }
2125
+ if (nodes.length === 0) nodes.push(h("raw", {
2126
+ platform: "dingtalk",
2127
+ type: body.msgtype,
2128
+ data: body
2129
+ }, h.text("")));
2130
+ return normalize(nodes);
2131
+ }
2132
+ /**
2133
+ * Decode one delivered callback body.
2134
+ *
2135
+ * A quota or delivery failure carries no message content (`errorCode: 20001` after the monthly allowance is spent), so
2136
+ * it is logged instead of being decoded into an empty message.
2137
+ *
2138
+ * @param bot - the receiving adapter (its routes and identity are used by the decoded elements).
2139
+ * @param body - the callback body of either transport.
2140
+ * @returns the session to publish, or undefined for a body this adapter does not turn into a message.
2141
+ */
2142
+ function decodeMessage(bot, body) {
2143
+ if (typeof body !== "object" || body === null) return void 0;
2144
+ const errorCode = errorCodeOf(body);
2145
+ if (errorCode !== void 0) {
2146
+ bot.ctx.logger.error("dingtalk quota or delivery error: %s %s", String(errorCode), String(errorMessageOf(body) ?? ""));
2147
+ return;
2148
+ }
2149
+ const sender = senderOf(body);
2150
+ const chat = chatOf(body, sender.id);
2151
+ const content = decodeContent(bot, body);
2152
+ if (body.robotCode && body.robotCode !== bot.config.appkey) bot.ctx.logger.warn("dingtalk: the callback names robotCode %s, which differs from the configured appkey", body.robotCode);
2153
+ const referrer = {
2154
+ conversationId: body.conversationId,
2155
+ conversationType: body.conversationType,
2156
+ msgId: body.msgId,
2157
+ chatbotUserId: body.chatbotUserId,
2158
+ ...body.sessionWebhook ? { sessionWebhook: body.sessionWebhook } : {},
2159
+ ...body.sessionWebhookExpiredTime ? { sessionWebhookExpiredTime: body.sessionWebhookExpiredTime } : {}
2160
+ };
2161
+ const message = {
2162
+ id: body.msgId,
2163
+ chat,
2164
+ sender,
2165
+ content,
2166
+ mentions: mentionsOf(body, chat),
2167
+ time: timeOf(body),
2168
+ referrer,
2169
+ raw: body
2170
+ };
2171
+ return bot.session({
2172
+ type: "message",
2173
+ id: body.msgId,
2174
+ timestamp: message.time,
2175
+ message,
2176
+ referrer,
2177
+ raw: body
2178
+ });
2179
+ }
2180
+ // lib/types/transport/stream.js
2181
+ /**
2182
+ * Stream Mode transport (`protocol: 'ws'`).
2183
+ *
2184
+ * The adapter registers a fresh connection before every dial: the platform's ticket is single-use and expires within 90
2185
+ * seconds, so it can never be cached. The loop dials again forever — `ws.retryTimes` is a fast-retry budget, not a
2186
+ * give-up count — and only a credential refusal stops it.
2187
+ *
2188
+ * A callback frame is acknowledged only after `bot.receive` accepted the message (`Bot.receive` waits for the intake
2189
+ * listeners), so an acknowledgement always means the message is stored. Robot messages are fire-and-forget: the platform
2190
+ * does not redeliver an acknowledged frame.
2191
+ */
2192
+ /** The one topic this adapter subscribes to. */
2193
+ const CALLBACK_TOPIC = "/v1.0/im/bot/messages/get";
2194
+ /** System topics the protocol defines. */
2195
+ const PING_TOPIC = "ping";
2196
+ const DISCONNECT_TOPIC = "disconnect";
2197
+ /**
2198
+ * The `ua` of the connection registration (`name-sdk-lang/version`). Keep the version in step with `package.json`.
2199
+ */
2200
+ const CLIENT_USER_AGENT = "dsh-im-more/dingtalk/0.1.0";
2201
+ /** Waitable sleep that resolves early on abort. */
2202
+ function sleep(ms, signal) {
2203
+ return new Promise((resolve) => {
2204
+ if (signal.aborted) {
2205
+ resolve();
2206
+ return;
2207
+ }
2208
+ const timer = setTimeout(() => {
2209
+ signal.removeEventListener("abort", onAbort);
2210
+ resolve();
2211
+ }, ms);
2212
+ const onAbort = () => {
2213
+ clearTimeout(timer);
2214
+ resolve();
2215
+ };
2216
+ signal.addEventListener("abort", onAbort, { once: true });
2217
+ });
2218
+ }
2219
+ /** Message of any caught value, for a log line. */
2220
+ function messageOf$2(error) {
2221
+ return error instanceof Error ? error.message : String(error);
2222
+ }
2223
+ /** The Stream Mode client of one bot. */
2224
+ var DingtalkStream = class {
2225
+ bot;
2226
+ controller;
2227
+ running;
2228
+ socket;
2229
+ /** Set by a `disconnect` frame: the redial follows at once instead of waiting out the retry interval. */
2230
+ redialImmediately = false;
2231
+ constructor(bot) {
2232
+ this.bot = bot;
2233
+ }
2234
+ /**
2235
+ * Start the reconnect loop.
2236
+ *
2237
+ * Returning before the first dial is deliberate: `Bot.start` awaits `connect()`, and waiting here would hold plugin
2238
+ * initialization for as long as the platform is unreachable.
2239
+ */
2240
+ async start() {
2241
+ this.controller = new AbortController();
2242
+ this.running = this.loop(this.controller.signal);
2243
+ }
2244
+ /** Stop the loop and wait for it to unwind. */
2245
+ async stop() {
2246
+ this.controller?.abort();
2247
+ this.controller = void 0;
2248
+ this.closeSocket();
2249
+ await this.running?.catch(() => void 0);
2250
+ this.running = void 0;
2251
+ }
2252
+ async loop(signal) {
2253
+ let failures = 0;
2254
+ let authFailures = 0;
2255
+ while (!signal.aborted) try {
2256
+ const url = await this.openUrl(signal);
2257
+ const socket = await this.dial(url, signal);
2258
+ this.socket = socket;
2259
+ this.bot.online();
2260
+ failures = 0;
2261
+ authFailures = 0;
2262
+ await this.accept(socket, signal);
2263
+ this.socket = void 0;
2264
+ if (signal.aborted) return;
2265
+ this.bot.ctx.logger.warn("dingtalk: the Stream Mode connection closed; reconnecting");
2266
+ this.bot.status = Status.RECONNECT;
2267
+ if (this.redialImmediately) {
2268
+ this.redialImmediately = false;
2269
+ continue;
2270
+ }
2271
+ await sleep(this.intervalOf(failures), signal);
2272
+ } catch (error) {
2273
+ if (signal.aborted) return;
2274
+ if (isCredentialRefusal(error)) {
2275
+ this.bot.ctx.logger.error("dingtalk: %s", messageOf$2(error));
2276
+ this.bot.offline(error);
2277
+ return;
2278
+ }
2279
+ authFailures = isAuthRefusal(error) ? authFailures + 1 : 0;
2280
+ failures += 1;
2281
+ this.bot.ctx.logger.warn("dingtalk: %s; reconnecting", messageOf$2(error));
2282
+ this.bot.status = Status.RECONNECT;
2283
+ if (authFailures >= this.bot.config.ws.retryTimes) {
2284
+ this.bot.ctx.logger.error("dingtalk: %s consecutive authentication refusals; check appkey and secret, then restart the bot", String(authFailures));
2285
+ this.bot.offline(error);
2286
+ return;
2287
+ }
2288
+ await sleep(this.intervalOf(failures), signal);
2289
+ }
2290
+ }
2291
+ /** Delay before the next dial: the fast interval while the failure budget lasts, the lazy one after it. */
2292
+ intervalOf(failures) {
2293
+ const { ws } = this.bot.config;
2294
+ return failures < ws.retryTimes ? ws.retryInterval : ws.retryLazy;
2295
+ }
2296
+ /** Register one connection and give back the socket URL its single-use ticket belongs to. */
2297
+ async openUrl(signal) {
2298
+ const answer = await invoke(this.bot, "api", "POST", "/v1.0/gateway/connections/open", {
2299
+ data: {
2300
+ clientId: this.bot.config.appkey,
2301
+ clientSecret: this.bot.config.secret,
2302
+ subscriptions: [{
2303
+ type: "CALLBACK",
2304
+ topic: CALLBACK_TOPIC
2305
+ }],
2306
+ ua: CLIENT_USER_AGENT
2307
+ },
2308
+ signal
2309
+ });
2310
+ if (!answer.endpoint || !answer.ticket) throw new Error("dingtalk: gateway/connections/open answered without an endpoint and ticket");
2311
+ return `${answer.endpoint}?ticket=${encodeURIComponent(answer.ticket)}`;
2312
+ }
2313
+ /** Dial the connection URL and resolve once the socket is open. */
2314
+ dial(url, signal) {
2315
+ const socket = this.bot.ctx.http.ws(url);
2316
+ return new Promise((resolve, reject) => {
2317
+ const cleanup = () => {
2318
+ socket.removeEventListener("open", onOpen);
2319
+ socket.removeEventListener("error", onError);
2320
+ socket.removeEventListener("close", onClose);
2321
+ signal.removeEventListener("abort", onAbort);
2322
+ };
2323
+ const onOpen = () => {
2324
+ cleanup();
2325
+ resolve(socket);
2326
+ };
2327
+ const onError = (event) => {
2328
+ cleanup();
2329
+ reject(/* @__PURE__ */ new Error(`dingtalk: WebSocket error${event.message === void 0 ? "" : `: ${event.message}`}`));
2330
+ };
2331
+ const onClose = (event) => {
2332
+ cleanup();
2333
+ reject(/* @__PURE__ */ new Error(`dingtalk: WebSocket closed before opening (code ${String(event.code)})`));
2334
+ };
2335
+ const onAbort = () => {
2336
+ cleanup();
2337
+ reject(signal.reason ?? /* @__PURE__ */ new Error("dingtalk: adapter stopped"));
2338
+ };
2339
+ if (signal.aborted) {
2340
+ onAbort();
2341
+ return;
2342
+ }
2343
+ socket.addEventListener("open", onOpen);
2344
+ socket.addEventListener("error", onError);
2345
+ socket.addEventListener("close", onClose);
2346
+ signal.addEventListener("abort", onAbort, { once: true });
2347
+ });
2348
+ }
2349
+ /** Serve one open connection until it closes. */
2350
+ async accept(socket, signal) {
2351
+ const closed = new Promise((resolve) => {
2352
+ socket.addEventListener("close", () => {
2353
+ resolve();
2354
+ });
2355
+ });
2356
+ socket.addEventListener("message", (event) => {
2357
+ this.handleFrame(socket, String(event.data));
2358
+ });
2359
+ const onAbort = () => {
2360
+ this.closeSocket();
2361
+ };
2362
+ signal.addEventListener("abort", onAbort, { once: true });
2363
+ try {
2364
+ await closed;
2365
+ } finally {
2366
+ signal.removeEventListener("abort", onAbort);
2367
+ }
2368
+ }
2369
+ /** Dispatch one received frame: a system notice, a callback, or a topic this adapter does not subscribe to. */
2370
+ handleFrame(socket, text) {
2371
+ let frame;
2372
+ try {
2373
+ frame = JSON.parse(text);
2374
+ } catch (error) {
2375
+ this.bot.ctx.logger.warn("dingtalk: cannot parse a Stream frame: %s", messageOf$2(error));
2376
+ return;
2377
+ }
2378
+ if (typeof frame !== "object" || frame === null) return;
2379
+ const topic = frame.headers?.topic;
2380
+ if (frame.type === "SYSTEM" && topic === PING_TOPIC) {
2381
+ this.acknowledge(socket, frame, {
2382
+ code: 200,
2383
+ message: "OK",
2384
+ data: opaqueEcho(frame.data)
2385
+ });
2386
+ return;
2387
+ }
2388
+ if (frame.type === "SYSTEM" && topic === DISCONNECT_TOPIC) {
2389
+ this.bot.ctx.logger.info("dingtalk: the platform announced the connection expiry; redialing");
2390
+ this.redialImmediately = true;
2391
+ this.closeSocket();
2392
+ return;
2393
+ }
2394
+ if (frame.type === "SYSTEM") {
2395
+ this.bot.ctx.logger.debug("dingtalk: ignored a system frame of topic \"%s\"", topic ?? "unknown");
2396
+ return;
2397
+ }
2398
+ if (frame.type === "CALLBACK" && topic === "/v1.0/im/bot/messages/get") {
2399
+ this.deliver(socket, frame);
2400
+ return;
2401
+ }
2402
+ this.bot.ctx.logger.debug("dingtalk: ignored a frame of type \"%s\" and topic \"%s\"", frame.type ?? "unknown", topic ?? "unknown");
2403
+ this.acknowledge(socket, frame, {
2404
+ code: 404,
2405
+ message: "topic not supported"
2406
+ });
2407
+ }
2408
+ /**
2409
+ * Hand one callback frame to intake, then acknowledge it.
2410
+ *
2411
+ * The acknowledgement goes out after `receive` resolved: the host stores a message before `receive` returns, so an
2412
+ * acknowledged frame is a stored message. A failed intake is only logged, because no acknowledgement means the
2413
+ * platform will not redeliver anyway (robot messages are fire-and-forget).
2414
+ */
2415
+ async deliver(socket, frame) {
2416
+ let body;
2417
+ try {
2418
+ body = JSON.parse(frame.data ?? "");
2419
+ } catch (error) {
2420
+ this.bot.ctx.logger.error("dingtalk: cannot parse a callback body: %s", messageOf$2(error));
2421
+ this.acknowledge(socket, frame, {
2422
+ code: 500,
2423
+ message: "internal error"
2424
+ });
2425
+ return;
2426
+ }
2427
+ let session;
2428
+ try {
2429
+ session = decodeMessage(this.bot, body);
2430
+ } catch (error) {
2431
+ this.bot.ctx.logger.error("dingtalk: cannot decode a callback: %s", messageOf$2(error));
2432
+ this.acknowledge(socket, frame, {
2433
+ code: 500,
2434
+ message: "internal error"
2435
+ });
2436
+ return;
2437
+ }
2438
+ if (session === void 0) {
2439
+ this.acknowledge(socket, frame, {
2440
+ code: 200,
2441
+ message: "OK",
2442
+ data: "{\"response\":null}"
2443
+ });
2444
+ return;
2445
+ }
2446
+ try {
2447
+ await this.bot.receive(session);
2448
+ } catch (error) {
2449
+ this.bot.ctx.logger.error("dingtalk: intake failed: %s", messageOf$2(error));
2450
+ return;
2451
+ }
2452
+ this.acknowledge(socket, frame, {
2453
+ code: 200,
2454
+ message: "OK",
2455
+ data: "{\"response\":null}"
2456
+ });
2457
+ }
2458
+ /** Send one acknowledgement; a socket that already closed cannot carry it, which is only logged. */
2459
+ acknowledge(socket, frame, body) {
2460
+ const ack = {
2461
+ code: body.code,
2462
+ headers: {
2463
+ ...frame.headers?.messageId === void 0 ? {} : { messageId: frame.headers.messageId },
2464
+ contentType: "application/json"
2465
+ },
2466
+ message: body.message,
2467
+ ...body.data === void 0 ? {} : { data: body.data }
2468
+ };
2469
+ try {
2470
+ socket.send(JSON.stringify(ack));
2471
+ } catch (error) {
2472
+ this.bot.ctx.logger.warn("dingtalk: could not acknowledge a frame: %s", messageOf$2(error));
2473
+ }
2474
+ }
2475
+ closeSocket() {
2476
+ const socket = this.socket;
2477
+ this.socket = void 0;
2478
+ try {
2479
+ socket?.close(1e3, "adapter stopped");
2480
+ } catch (error) {}
2481
+ }
2482
+ };
2483
+ /**
2484
+ * The acknowledgement body of a `ping`: the frame's `opaque` value echoed back.
2485
+ *
2486
+ * @param data - the frame's JSON-string `data`, expected to carry `opaque`.
2487
+ * @returns a JSON string carrying the same `opaque`, or the original string when it cannot be read.
2488
+ */
2489
+ function opaqueEcho(data) {
2490
+ if (data === void 0) return "{\"opaque\":null}";
2491
+ try {
2492
+ const parsed = JSON.parse(data);
2493
+ if (typeof parsed === "object" && parsed !== null && "opaque" in parsed) return JSON.stringify({ opaque: parsed.opaque });
2494
+ } catch (error) {}
2495
+ return data;
2496
+ }
2497
+ // lib/types/transport/webhook.js
2498
+ /**
2499
+ * HTTP callback transport (`protocol: 'http'`).
2500
+ *
2501
+ * The platform posts bot messages to a URL configured in the developer console; the adapter registers that path on the
2502
+ * profile's `webServer` and verifies the request with the platform's own `secret`
2503
+ * (`Base64(HMAC-SHA256(key = secret, message = timestamp + "\n" + secret))`).
2504
+ *
2505
+ * The handler answers `200` once the message is stored and `500` when intake failed, so a retrying platform can resend;
2506
+ * every refusal is answered before any work is done.
2507
+ */
2508
+ /** How far a request's `timestamp` may be from now; the platform documents an hour. */
2509
+ const TIMESTAMP_WINDOW_MS = 36e5;
2510
+ /**
2511
+ * The `sign` header value of one request.
2512
+ *
2513
+ * @param secret - the application Client Secret.
2514
+ * @param timestamp - the request's `timestamp` header.
2515
+ * @returns the base64 HMAC-SHA256 of `timestamp + "\n" + secret`.
2516
+ */
2517
+ function signOf(secret, timestamp) {
2518
+ return createHmac("sha256", secret).update(`${timestamp}\n${secret}`).digest("base64");
2519
+ }
2520
+ /**
2521
+ * Compare two signatures without leaking where they differ.
2522
+ *
2523
+ * @param expected - the signature computed from the headers.
2524
+ * @param received - the signature the request carried.
2525
+ * @returns whether they are equal.
2526
+ */
2527
+ function matchesSign(expected, received) {
2528
+ const left = Buffer.from(expected, "utf8");
2529
+ const right = Buffer.from(received, "utf8");
2530
+ if (left.length !== right.length) return false;
2531
+ return timingSafeEqual(left, right);
2532
+ }
2533
+ /** One header of an inbound request, when it arrived exactly once. */
2534
+ function headerOf(request, name) {
2535
+ const value = request.headers[name];
2536
+ return typeof value === "string" ? value : void 0;
2537
+ }
2538
+ /** Read a request body to its end. The adapter imposes no size limit of its own. */
2539
+ async function readBody(request) {
2540
+ const chunks = [];
2541
+ for await (const chunk of request) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
2542
+ return Buffer.concat(chunks).toString("utf8");
2543
+ }
2544
+ /** Write one bodiless answer. */
2545
+ function writeStatus(response, status, headers = {}) {
2546
+ response.writeHead(status, headers);
2547
+ response.end();
2548
+ }
2549
+ /** Message of any caught value, for a log line. */
2550
+ function messageOf$1(error) {
2551
+ return error instanceof Error ? error.message : String(error);
2552
+ }
2553
+ /**
2554
+ * The HTTP callback transport.
2555
+ *
2556
+ * The route is anonymous at the Web server layer and authenticated by the platform's signature, so a profile without
2557
+ * `webServer` fails loudly instead of silently receiving nothing.
2558
+ */
2559
+ var DingtalkWebhook = class {
2560
+ bot;
2561
+ dispose;
2562
+ constructor(bot) {
2563
+ this.bot = bot;
2564
+ }
2565
+ /** Register the route over the profile's `webServer`. */
2566
+ async start() {
2567
+ const webServer = this.bot.ctx.get("webServer");
2568
+ if (webServer === void 0) throw this.failStart("dingtalk: protocol \"http\" needs a profile-provided webServer; use protocol \"ws\" instead");
2569
+ await this.bot.tokens.get();
2570
+ this.dispose = webServer.register({
2571
+ kind: "exact",
2572
+ path: routePath(this.bot.config.path),
2573
+ auth: "anonymous",
2574
+ handler: (request, response) => this.handle(request, response)
2575
+ });
2576
+ this.bot.online();
2577
+ }
2578
+ /** Release the route. */
2579
+ async stop() {
2580
+ this.dispose?.();
2581
+ this.dispose = void 0;
2582
+ }
2583
+ /**
2584
+ * Log a fatal start failure before the caller throws it, because `Bot.start` only stores a connect failure on
2585
+ * `bot.error`.
2586
+ *
2587
+ * @param message - error text that also names the corrective action.
2588
+ * @returns the error for the caller to throw.
2589
+ */
2590
+ failStart(message) {
2591
+ this.bot.ctx.logger.error(message);
2592
+ return new Error(message);
2593
+ }
2594
+ async handle(request, response) {
2595
+ try {
2596
+ if (request.method !== "POST") {
2597
+ writeStatus(response, 405, { allow: "POST" });
2598
+ return;
2599
+ }
2600
+ const timestamp = headerOf(request, "timestamp");
2601
+ const sign = headerOf(request, "sign");
2602
+ if (timestamp === void 0 || sign === void 0) {
2603
+ writeStatus(response, 401);
2604
+ return;
2605
+ }
2606
+ const sentAt = Number(timestamp);
2607
+ if (!Number.isFinite(sentAt) || Math.abs(Date.now() - sentAt) > 36e5) {
2608
+ writeStatus(response, 401);
2609
+ return;
2610
+ }
2611
+ const body = await readBody(request);
2612
+ let parsed;
2613
+ try {
2614
+ parsed = JSON.parse(body);
2615
+ } catch (error) {
2616
+ this.bot.ctx.logger.warn("dingtalk: cannot parse a callback request: %s", messageOf$1(error));
2617
+ writeStatus(response, 400);
2618
+ return;
2619
+ }
2620
+ if (typeof parsed !== "object" || parsed === null) {
2621
+ writeStatus(response, 400);
2622
+ return;
2623
+ }
2624
+ if (!matchesSign(signOf(this.bot.config.secret, timestamp), sign)) {
2625
+ writeStatus(response, 401);
2626
+ return;
2627
+ }
2628
+ const session = decodeMessage(this.bot, parsed);
2629
+ if (session !== void 0) await this.bot.receive(session);
2630
+ writeStatus(response, 200);
2631
+ } catch (error) {
2632
+ this.bot.ctx.logger.warn("dingtalk: HTTP callback delivery failed: %s", messageOf$1(error));
2633
+ if (!response.headersSent) writeStatus(response, 500);
2634
+ else response.end();
2635
+ }
2636
+ }
2637
+ };
2638
+ // lib/types/bot.js
2639
+ /** Message of any caught value, for a log line. */
2640
+ function messageOf(error) {
2641
+ return error instanceof Error ? error.message : String(error);
2642
+ }
2643
+ /**
2644
+ * DingTalk robot adapter.
2645
+ *
2646
+ * Identity is the configured `appkey` (DingTalk exposes no robot user id to look up), Stream Mode and the HTTP callback
2647
+ * are the two transports, and `markdown` is the only mode: `sampleMarkdown` is the one body template the upstream adapter
2648
+ * ever produced, and an ActionCard's buttons are all jump links. Media goes out as its own message, because a DingTalk
2649
+ * message carries one media item.
2650
+ */
2651
+ var DingtalkBot = class extends Adapter {
2652
+ /** The adapter needs the Satori service and the isolated `http` service. */
2653
+ static inject = ["satori", "http"];
2654
+ /** The Loader applies this schema to a profile row's `config` before the constructor runs. */
2655
+ static Config = Config;
2656
+ modes;
2657
+ modeOrder = ["markdown"];
2658
+ /** Full typed REST surface registered by the migrated declarations. */
2659
+ internal;
2660
+ /** The application `accessToken` every `/v1.0/*` request carries. */
2661
+ tokens;
2662
+ transport;
2663
+ constructor(ctx, config) {
2664
+ super(ctx, config, {
2665
+ id: `dingtalk:${config.appkey}`,
2666
+ platform: "dingtalk",
2667
+ adapter: "dingtalk"
2668
+ });
2669
+ this.selfId = config.appkey;
2670
+ this.user = {
2671
+ id: config.appkey,
2672
+ isBot: true
2673
+ };
2674
+ this.internal = new Internal(this);
2675
+ this.tokens = new AccessTokenCache(async () => {
2676
+ return await this.internal.getAccessToken({
2677
+ appKey: config.appkey,
2678
+ appSecret: config.secret
2679
+ });
2680
+ });
2681
+ this.modes = { markdown: createMarkdownMode() };
2682
+ this.defineInternalRoute("/messages/:messageId/resources/:index", async ({ params, query }) => {
2683
+ const code = query.get("code");
2684
+ if (code === null || code === "") {
2685
+ this.ctx.logger.debug("dingtalk: media %s/%s has no download code", params.messageId, params.index);
2686
+ return new Response(null, { status: 404 });
2687
+ }
2688
+ return await this.serveMessageFile(params.messageId, params.index, code);
2689
+ });
2690
+ }
2691
+ async connect() {
2692
+ const invalid = configError(this.config);
2693
+ if (invalid !== void 0) {
2694
+ this.ctx.logger.error("dingtalk: connect failed: %s", invalid.message);
2695
+ throw invalid;
2696
+ }
2697
+ this.transport = this.config.protocol === "http" ? new DingtalkWebhook(this) : new DingtalkStream(this);
2698
+ await this.transport.start();
2699
+ }
2700
+ async disconnect() {
2701
+ const transport = this.transport;
2702
+ this.transport = void 0;
2703
+ await transport?.stop();
2704
+ }
2705
+ /**
2706
+ * Upload one outbound attachment to the platform's media endpoint.
2707
+ *
2708
+ * `media_id` is application-wide and reusable, so the scope is the bot rather than the chat.
2709
+ */
2710
+ async upload(ref, _scope, ctx) {
2711
+ return await uploadMedia(this, ref, ctx);
2712
+ }
2713
+ resourceScope(_target, _kind) {
2714
+ return this.id;
2715
+ }
2716
+ async sendPayload(payload, target, ctx) {
2717
+ return await sendPayload({
2718
+ internal: this.internal,
2719
+ config: this.config
2720
+ }, payload, target, ctx);
2721
+ }
2722
+ async deletePart(part, handle) {
2723
+ await deletePart({
2724
+ internal: this.internal,
2725
+ config: this.config
2726
+ }, part, handle);
2727
+ }
2728
+ classify(error) {
2729
+ return classifyDingtalkError(error);
2730
+ }
2731
+ /**
2732
+ * Resolve one message-media route.
2733
+ *
2734
+ * The `downloadCode` from the query is exchanged for a signed URL per read and never cached, because the URL is
2735
+ * short-lived while a stored message is not. A code or URL the platform no longer accepts answers `502`.
2736
+ *
2737
+ * @param messageId - platform message id, for the log line only.
2738
+ * @param index - media position in the message, for the log line only.
2739
+ * @param code - the platform `downloadCode` the source carried.
2740
+ * @returns the bytes, or the refusal status.
2741
+ */
2742
+ async serveMessageFile(messageId, index, code) {
2743
+ try {
2744
+ const url = await downloadUrlOf(this, code);
2745
+ const response = await this.ctx.http(url);
2746
+ if (!response.ok) {
2747
+ this.ctx.logger.warn("dingtalk: media %s/%s answered %s at its signed URL", messageId, index, String(response.status));
2748
+ return new Response(null, { status: 502 });
2749
+ }
2750
+ const headers = new Headers();
2751
+ const mime = response.headers.get("content-type");
2752
+ if (mime !== null) headers.set("content-type", mime);
2753
+ return new Response(response.body, {
2754
+ status: response.status,
2755
+ headers
2756
+ });
2757
+ } catch (error) {
2758
+ this.ctx.logger.warn("dingtalk: media %s/%s could not be served: %s", messageId, index, messageOf(error));
2759
+ return new Response(null, { status: 502 });
2760
+ }
2761
+ }
2762
+ };
2763
+ export { AccessTokenCache, CALLBACK_TOPIC, CLIENT_USER_AGENT, Config, DINGTALK_LIMITS, types_exports as Dingtalk, DingtalkApiError, DingtalkBot, DingtalkBot as default, DingtalkStream, DingtalkWebhook, Internal, TIMESTAMP_WINDOW_MS, ZERO_WIDTH, assembleDraft, checkDraft, classifyDingtalkError, configError, createMarkdownMode, decodeMessage, deletePart, downloadUrlOf, endpointOf, escape, fileTypeOf, invoke, isAuthFailure, isAuthRefusal, isCredentialRefusal, matchesSign, mediaNode, mediaSource, mediaTypeOf, routePath, sendPayload, serializeDraft, signOf, titleOf, unescape, uploadMedia, verdictOfCode };
2764
+
2765
+ //# sourceMappingURL=index.js.map