@yanhaidao/wecom 2.4.160 → 2.5.110

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 (313) hide show
  1. package/dist/index.js +68 -0
  2. package/dist/src/accounts.js +20 -0
  3. package/dist/src/agent/handler.js +895 -0
  4. package/dist/src/agent/index.js +5 -0
  5. package/dist/src/app/account-runtime.js +216 -0
  6. package/dist/src/app/bootstrap.js +19 -0
  7. package/dist/src/app/index.js +118 -0
  8. package/dist/src/capability/agent/delivery-service.js +63 -0
  9. package/dist/src/capability/agent/fallback-policy.js +6 -0
  10. package/dist/src/capability/agent/ingress-service.js +33 -0
  11. package/dist/src/capability/agent/upstream-delivery-service.js +71 -0
  12. package/dist/src/capability/bot/dispatch-config.js +45 -0
  13. package/dist/src/capability/bot/fallback-delivery.js +147 -0
  14. package/dist/src/capability/bot/local-path-delivery.js +178 -0
  15. package/dist/src/capability/bot/sandbox-media.js +138 -0
  16. package/dist/src/capability/bot/service.js +49 -0
  17. package/dist/src/capability/bot/stream-delivery.js +321 -0
  18. package/dist/src/capability/bot/stream-finalizer.js +81 -0
  19. package/dist/src/capability/bot/stream-orchestrator.js +318 -0
  20. package/dist/src/capability/bot/types.js +1 -0
  21. package/{src/capability/calendar/client.ts → dist/src/capability/calendar/client.js} +118 -241
  22. package/{src/capability/calendar/schema.ts → dist/src/capability/calendar/schema.js} +0 -38
  23. package/dist/src/capability/calendar/tool.js +365 -0
  24. package/dist/src/capability/calendar/types.js +12 -0
  25. package/{src/capability/doc/client.ts → dist/src/capability/doc/client.js} +370 -605
  26. package/{src/capability/doc/schema.ts → dist/src/capability/doc/schema.js} +345 -394
  27. package/dist/src/capability/doc/tool.js +1556 -0
  28. package/dist/src/capability/doc/types.js +113 -0
  29. package/dist/src/capability/mcp/index.js +3 -0
  30. package/dist/src/capability/mcp/schema.js +102 -0
  31. package/dist/src/capability/mcp/tool.js +146 -0
  32. package/dist/src/capability/mcp/transport.js +293 -0
  33. package/dist/src/channel.js +224 -0
  34. package/dist/src/config/accounts.js +236 -0
  35. package/dist/src/config/derived-paths.js +31 -0
  36. package/dist/src/config/index.js +7 -0
  37. package/dist/src/config/media.js +110 -0
  38. package/dist/src/config/network.js +32 -0
  39. package/dist/src/config/routing.js +20 -0
  40. package/dist/src/config/runtime-config.js +25 -0
  41. package/dist/src/config/schema.js +4 -0
  42. package/{src/config-schema.ts → dist/src/config-schema.js} +1 -1
  43. package/dist/src/context-store.js +219 -0
  44. package/{src/crypto/aes.ts → dist/src/crypto/aes.js} +11 -28
  45. package/dist/src/crypto/index.js +9 -0
  46. package/{src/crypto/signature.ts → dist/src/crypto/signature.js} +3 -18
  47. package/{src/crypto/xml.ts → dist/src/crypto/xml.js} +3 -11
  48. package/dist/src/crypto.js +145 -0
  49. package/dist/src/domain/models.js +1 -0
  50. package/dist/src/domain/policies.js +32 -0
  51. package/{src/dynamic-agent.ts → dist/src/dynamic-agent.js} +36 -73
  52. package/dist/src/gateway-monitor.js +139 -0
  53. package/dist/src/http.js +114 -0
  54. package/{src/media.ts → dist/src/media.js} +21 -40
  55. package/dist/src/monitor/limits.js +7 -0
  56. package/dist/src/monitor/state.js +28 -0
  57. package/dist/src/monitor.js +84 -0
  58. package/dist/src/observability/audit-log.js +30 -0
  59. package/dist/src/observability/legacy-operational-event-store.js +22 -0
  60. package/dist/src/observability/raw-envelope-log.js +24 -0
  61. package/dist/src/observability/status-registry.js +9 -0
  62. package/dist/src/observability/transport-session-view.js +14 -0
  63. package/dist/src/onboarding.js +546 -0
  64. package/dist/src/outbound.js +557 -0
  65. package/dist/src/runtime/dispatcher.js +57 -0
  66. package/{src/runtime/index.ts → dist/src/runtime/index.js} +0 -1
  67. package/dist/src/runtime/outbound-intent.js +1 -0
  68. package/dist/src/runtime/reply-orchestrator.js +38 -0
  69. package/dist/src/runtime/routing-bridge.js +26 -0
  70. package/dist/src/runtime/session-manager.js +112 -0
  71. package/dist/src/runtime/source-registry.js +174 -0
  72. package/dist/src/runtime.js +1 -0
  73. package/dist/src/shared/command-auth.js +57 -0
  74. package/{src/shared/index.ts → dist/src/shared/index.js} +0 -1
  75. package/dist/src/shared/media-asset.js +65 -0
  76. package/dist/src/shared/media-service.js +59 -0
  77. package/dist/src/shared/media-types.js +1 -0
  78. package/{src/shared/xml-parser.ts → dist/src/shared/xml-parser.js} +72 -63
  79. package/dist/src/store/active-reply-store.js +41 -0
  80. package/dist/src/store/interfaces.js +1 -0
  81. package/dist/src/store/memory-store.js +33 -0
  82. package/dist/src/store/stream-batch-store.js +319 -0
  83. package/{src/target.ts → dist/src/target.js} +15 -48
  84. package/dist/src/transport/agent-api/client.js +168 -0
  85. package/dist/src/transport/agent-api/core.js +337 -0
  86. package/dist/src/transport/agent-api/delivery.js +28 -0
  87. package/dist/src/transport/agent-api/media-upload.js +4 -0
  88. package/dist/src/transport/agent-api/reply.js +24 -0
  89. package/dist/src/transport/agent-api/upstream-delivery.js +30 -0
  90. package/dist/src/transport/agent-api/upstream-media-upload.js +46 -0
  91. package/dist/src/transport/agent-api/upstream-reply.js +26 -0
  92. package/dist/src/transport/agent-callback/http-handler.js +30 -0
  93. package/dist/src/transport/agent-callback/inbound.js +4 -0
  94. package/dist/src/transport/agent-callback/reply.js +8 -0
  95. package/dist/src/transport/agent-callback/request-handler.js +189 -0
  96. package/dist/src/transport/agent-callback/session.js +15 -0
  97. package/dist/src/transport/bot-webhook/active-reply.js +27 -0
  98. package/dist/src/transport/bot-webhook/http-handler.js +31 -0
  99. package/dist/src/transport/bot-webhook/inbound-normalizer.js +496 -0
  100. package/dist/src/transport/bot-webhook/inbound.js +4 -0
  101. package/dist/src/transport/bot-webhook/message-shape.js +98 -0
  102. package/dist/src/transport/bot-webhook/protocol.js +124 -0
  103. package/dist/src/transport/bot-webhook/reply.js +9 -0
  104. package/dist/src/transport/bot-webhook/request-handler.js +285 -0
  105. package/dist/src/transport/bot-webhook/session.js +15 -0
  106. package/dist/src/transport/bot-ws/inbound.js +147 -0
  107. package/dist/src/transport/bot-ws/media.js +236 -0
  108. package/dist/src/transport/bot-ws/reply.js +310 -0
  109. package/dist/src/transport/bot-ws/sdk-adapter.js +257 -0
  110. package/dist/src/transport/bot-ws/session.js +15 -0
  111. package/dist/src/transport/http/common.js +78 -0
  112. package/dist/src/transport/http/registry.js +71 -0
  113. package/dist/src/transport/http/request-handler.js +51 -0
  114. package/{src/transport/index.ts → dist/src/transport/index.js} +2 -10
  115. package/dist/src/types/account.js +1 -0
  116. package/dist/src/types/config.js +1 -0
  117. package/dist/src/types/constants.js +28 -0
  118. package/dist/src/types/events.js +1 -0
  119. package/dist/src/types/index.js +1 -0
  120. package/dist/src/types/legacy-stream.js +1 -0
  121. package/dist/src/types/message.js +5 -0
  122. package/dist/src/types/runtime-context.js +1 -0
  123. package/dist/src/types/runtime.js +1 -0
  124. package/dist/src/types.js +1 -0
  125. package/dist/src/upstream/index.js +111 -0
  126. package/dist/src/wecom_msg_adapter/markdown_adapter.js +280 -0
  127. package/openclaw.plugin.json +15 -0
  128. package/package.json +18 -1
  129. package/.github/workflows/release.yml +0 -143
  130. package/GOVERNANCE.md +0 -26
  131. package/SKILLS_CAL.md +0 -895
  132. package/SKILLS_DOC.md +0 -2288
  133. package/UPSTREAM_CONFIG.md +0 -170
  134. package/UPSTREAM_PLAN.md +0 -175
  135. package/assets/01.bot-add.png +0 -0
  136. package/assets/01.bot-setp2.png +0 -0
  137. package/assets/01.image.jpg +0 -0
  138. package/assets/02.agent.add.png +0 -0
  139. package/assets/02.agent.api-set.png +0 -0
  140. package/assets/02.image.jpg +0 -0
  141. package/assets/03.agent.page.png +0 -0
  142. package/assets/03.bot.page.png +0 -0
  143. package/assets/link-me.jpg +0 -0
  144. package/assets/register.png +0 -0
  145. package/changelog/v2.2.28.md +0 -70
  146. package/changelog/v2.3.10.md +0 -17
  147. package/changelog/v2.3.11.md +0 -19
  148. package/changelog/v2.3.12.md +0 -25
  149. package/changelog/v2.3.13.md +0 -19
  150. package/changelog/v2.3.14.md +0 -48
  151. package/changelog/v2.3.15.md +0 -15
  152. package/changelog/v2.3.16.md +0 -11
  153. package/changelog/v2.3.18.md +0 -22
  154. package/changelog/v2.3.19.md +0 -73
  155. package/changelog/v2.3.2.md +0 -28
  156. package/changelog/v2.3.26.md +0 -21
  157. package/changelog/v2.3.27.md +0 -33
  158. package/changelog/v2.3.4.md +0 -20
  159. package/changelog/v2.3.9.md +0 -22
  160. package/changelog/v2.4.12.md +0 -37
  161. package/changelog/v2.4.16.md +0 -19
  162. package/compat-single-account.md +0 -148
  163. package/index.test.ts +0 -38
  164. package/scripts/test-proxy.ts +0 -70
  165. package/src/accounts.ts +0 -34
  166. package/src/agent/api-client.upload.test.ts +0 -109
  167. package/src/agent/handler.event-filter.test.ts +0 -100
  168. package/src/agent/handler.ts +0 -1105
  169. package/src/agent/index.ts +0 -12
  170. package/src/app/account-runtime.ts +0 -276
  171. package/src/app/bootstrap.ts +0 -29
  172. package/src/app/index.ts +0 -192
  173. package/src/capability/agent/delivery-service.ts +0 -87
  174. package/src/capability/agent/fallback-policy.ts +0 -13
  175. package/src/capability/agent/ingress-service.ts +0 -38
  176. package/src/capability/agent/upstream-delivery-service.ts +0 -96
  177. package/src/capability/bot/dispatch-config.ts +0 -47
  178. package/src/capability/bot/fallback-delivery.ts +0 -178
  179. package/src/capability/bot/local-path-delivery.ts +0 -215
  180. package/src/capability/bot/sandbox-media.test.ts +0 -221
  181. package/src/capability/bot/sandbox-media.ts +0 -176
  182. package/src/capability/bot/service.ts +0 -56
  183. package/src/capability/bot/stream-delivery.ts +0 -379
  184. package/src/capability/bot/stream-finalizer.ts +0 -120
  185. package/src/capability/bot/stream-orchestrator.ts +0 -371
  186. package/src/capability/bot/types.ts +0 -8
  187. package/src/capability/calendar/SKILLS_CHECKLIST.md +0 -251
  188. package/src/capability/calendar/tool.ts +0 -417
  189. package/src/capability/calendar/types.ts +0 -309
  190. package/src/capability/doc/tool.ts +0 -1629
  191. package/src/capability/doc/types.ts +0 -792
  192. package/src/capability/mcp/index.ts +0 -10
  193. package/src/capability/mcp/schema.ts +0 -107
  194. package/src/capability/mcp/tool.ts +0 -174
  195. package/src/capability/mcp/transport.ts +0 -394
  196. package/src/channel.config.test.ts +0 -147
  197. package/src/channel.lifecycle.test.ts +0 -255
  198. package/src/channel.meta.test.ts +0 -26
  199. package/src/channel.ts +0 -256
  200. package/src/config/accounts.resolve.test.ts +0 -75
  201. package/src/config/accounts.ts +0 -296
  202. package/src/config/derived-paths.test.ts +0 -111
  203. package/src/config/derived-paths.ts +0 -41
  204. package/src/config/index.ts +0 -26
  205. package/src/config/media.test.ts +0 -113
  206. package/src/config/media.ts +0 -139
  207. package/src/config/network.ts +0 -53
  208. package/src/config/routing.test.ts +0 -88
  209. package/src/config/routing.ts +0 -26
  210. package/src/config/runtime-config.ts +0 -46
  211. package/src/config/schema.ts +0 -90
  212. package/src/context-store.ts +0 -297
  213. package/src/crypto/index.ts +0 -24
  214. package/src/crypto.test.ts +0 -32
  215. package/src/crypto.ts +0 -176
  216. package/src/domain/models.ts +0 -7
  217. package/src/domain/policies.ts +0 -36
  218. package/src/dynamic-agent.account-scope.test.ts +0 -17
  219. package/src/gateway-monitor.ts +0 -181
  220. package/src/http.ts +0 -145
  221. package/src/media.test.ts +0 -82
  222. package/src/monitor/limits.ts +0 -7
  223. package/src/monitor/state.queue.test.ts +0 -185
  224. package/src/monitor/state.ts +0 -34
  225. package/src/monitor.active.test.ts +0 -245
  226. package/src/monitor.inbound-filter.test.ts +0 -63
  227. package/src/monitor.integration.test.ts +0 -208
  228. package/src/monitor.ts +0 -121
  229. package/src/monitor.webhook.test.ts +0 -774
  230. package/src/observability/audit-log.ts +0 -48
  231. package/src/observability/legacy-operational-event-store.ts +0 -36
  232. package/src/observability/raw-envelope-log.ts +0 -28
  233. package/src/observability/status-registry.ts +0 -13
  234. package/src/observability/transport-session-view.ts +0 -14
  235. package/src/onboarding.test.ts +0 -336
  236. package/src/onboarding.ts +0 -704
  237. package/src/outbound.test.ts +0 -1271
  238. package/src/outbound.ts +0 -746
  239. package/src/runtime/dispatcher.ts +0 -71
  240. package/src/runtime/outbound-intent.ts +0 -4
  241. package/src/runtime/reply-orchestrator.test.ts +0 -71
  242. package/src/runtime/reply-orchestrator.ts +0 -67
  243. package/src/runtime/routing-bridge.test.ts +0 -115
  244. package/src/runtime/routing-bridge.ts +0 -44
  245. package/src/runtime/session-manager.test.ts +0 -174
  246. package/src/runtime/session-manager.ts +0 -139
  247. package/src/runtime/source-registry.ts +0 -249
  248. package/src/runtime.ts +0 -14
  249. package/src/shared/command-auth.ts +0 -87
  250. package/src/shared/media-asset.ts +0 -78
  251. package/src/shared/media-service.test.ts +0 -111
  252. package/src/shared/media-service.ts +0 -84
  253. package/src/shared/media-types.ts +0 -5
  254. package/src/shared/xml-parser.test.ts +0 -50
  255. package/src/store/active-reply-store.ts +0 -42
  256. package/src/store/interfaces.ts +0 -11
  257. package/src/store/memory-store.ts +0 -43
  258. package/src/store/stream-batch-store.ts +0 -350
  259. package/src/transport/agent-api/client.ts +0 -277
  260. package/src/transport/agent-api/core.ts +0 -463
  261. package/src/transport/agent-api/delivery.ts +0 -41
  262. package/src/transport/agent-api/media-upload.ts +0 -11
  263. package/src/transport/agent-api/reply.ts +0 -39
  264. package/src/transport/agent-api/upstream-delivery.ts +0 -45
  265. package/src/transport/agent-api/upstream-media-upload.ts +0 -70
  266. package/src/transport/agent-api/upstream-reply.ts +0 -43
  267. package/src/transport/agent-callback/http-handler.ts +0 -47
  268. package/src/transport/agent-callback/inbound.ts +0 -5
  269. package/src/transport/agent-callback/reply.ts +0 -13
  270. package/src/transport/agent-callback/request-handler.ts +0 -244
  271. package/src/transport/agent-callback/session.ts +0 -23
  272. package/src/transport/bot-webhook/active-reply.ts +0 -39
  273. package/src/transport/bot-webhook/http-handler.ts +0 -48
  274. package/src/transport/bot-webhook/inbound-normalizer.test.ts +0 -433
  275. package/src/transport/bot-webhook/inbound-normalizer.ts +0 -558
  276. package/src/transport/bot-webhook/inbound.ts +0 -5
  277. package/src/transport/bot-webhook/message-shape.ts +0 -92
  278. package/src/transport/bot-webhook/protocol.ts +0 -148
  279. package/src/transport/bot-webhook/reply.ts +0 -15
  280. package/src/transport/bot-webhook/request-handler.ts +0 -394
  281. package/src/transport/bot-webhook/session.ts +0 -23
  282. package/src/transport/bot-ws/inbound.test.ts +0 -290
  283. package/src/transport/bot-ws/inbound.ts +0 -163
  284. package/src/transport/bot-ws/media.test.ts +0 -44
  285. package/src/transport/bot-ws/media.ts +0 -321
  286. package/src/transport/bot-ws/reply.test.ts +0 -450
  287. package/src/transport/bot-ws/reply.ts +0 -365
  288. package/src/transport/bot-ws/sdk-adapter.test.ts +0 -187
  289. package/src/transport/bot-ws/sdk-adapter.ts +0 -314
  290. package/src/transport/bot-ws/session.ts +0 -28
  291. package/src/transport/http/common.ts +0 -109
  292. package/src/transport/http/registry.ts +0 -92
  293. package/src/transport/http/request-handler.ts +0 -84
  294. package/src/types/account.ts +0 -70
  295. package/src/types/config.ts +0 -114
  296. package/src/types/constants.ts +0 -31
  297. package/src/types/events.ts +0 -21
  298. package/src/types/global.d.ts +0 -9
  299. package/src/types/index.ts +0 -17
  300. package/src/types/legacy-stream.ts +0 -50
  301. package/src/types/message.ts +0 -189
  302. package/src/types/runtime-context.ts +0 -28
  303. package/src/types/runtime.ts +0 -165
  304. package/src/types.ts +0 -41
  305. package/src/upstream/index.ts +0 -150
  306. package/src/upstream.test.ts +0 -84
  307. package/src/wecom_msg_adapter/markdown_adapter.ts +0 -331
  308. package/tsconfig.json +0 -22
  309. package/vitest.config.ts +0 -26
  310. /package/{src/capability/agent/index.ts → dist/src/capability/agent/index.js} +0 -0
  311. /package/{src/capability/bot/index.ts → dist/src/capability/bot/index.js} +0 -0
  312. /package/{src/capability/calendar/index.ts → dist/src/capability/calendar/index.js} +0 -0
  313. /package/{src/capability/index.ts → dist/src/capability/index.js} +0 -0
@@ -1,792 +0,0 @@
1
-
2
- export interface DocMemberEntry {
3
- userid?: string;
4
- partyid?: string;
5
- tagid?: string;
6
- /**
7
- * 权限位:1-查看,2-编辑,7-管理
8
- */
9
- auth?: number;
10
- type?: number; // 1:用户, 2:部门
11
- tmp_external_userid?: string;
12
- }
13
-
14
- export interface Node {
15
- begin: number;
16
- end: number;
17
- property: Property;
18
- type: NodeType;
19
- children: Node[];
20
- text?: string;
21
- }
22
-
23
- export enum NodeType {
24
- Document = "Document",
25
- MainStory = "MainStory",
26
- Section = "Section",
27
- Paragraph = "Paragraph",
28
- Table = "Table",
29
- TableRow = "TableRow",
30
- TableCell = "TableCell",
31
- Text = "Text",
32
- Drawing = "Drawing"
33
- }
34
-
35
- export interface Property {
36
- section_property?: SectionProperty;
37
- paragraph_property?: ParagraphProperty;
38
- run_property?: RunProperty;
39
- table_property?: TableProperty;
40
- table_row_property?: TableRowProperty;
41
- table_cell_property?: TableCellProperty;
42
- drawing_property?: DrawingProperty;
43
- }
44
-
45
- export interface SectionProperty {
46
- page_size?: PageSize;
47
- page_margins?: PageMargins;
48
- }
49
-
50
- export interface PageSize {
51
- width: number;
52
- height: number;
53
- orientation?: PageOrientation;
54
- }
55
-
56
- export interface PageOrientation {
57
- orientation: "PAGE_ORIENTATION_PORTRAIT" | "PAGE_ORIENTATION_LANDSCAPE" | "PAGE_ORIENTATION_UNSPECIFIED";
58
- }
59
-
60
- export interface PageMargins {
61
- top: number;
62
- right: number;
63
- bottom: number;
64
- left: number;
65
- }
66
-
67
- export interface ParagraphProperty {
68
- number_property?: NumberProperty;
69
- spacing?: Spacing;
70
- indent?: Indent;
71
- alignment_type?: AlignmentType;
72
- text_direction?: TextDirection;
73
- }
74
-
75
- export interface NumberProperty {
76
- nesting_level: number;
77
- number_id: string;
78
- }
79
-
80
- export interface Spacing {
81
- before?: number;
82
- after?: number;
83
- line?: number;
84
- line_rule?: LineSpacingRule;
85
- }
86
-
87
- export enum LineSpacingRule {
88
- UNSPECIFIED = "LINE_SPACING_RULE_UNSPECIFIED",
89
- AUTO = "LINE_SPACING_RULE_AUTO",
90
- EXACT = "LINE_SPACING_RULE_EXACT",
91
- AT_LEAST = "LINE_SPACING_RULE_AT_LEAST"
92
- }
93
-
94
- export interface Indent {
95
- left?: number;
96
- left_chars?: number;
97
- right?: number;
98
- right_chars?: number;
99
- hanging?: number;
100
- hanging_chars?: number;
101
- first_line?: number;
102
- first_line_chars?: number;
103
- }
104
-
105
- export enum AlignmentType {
106
- UNSPECIFIED = "ALIGNMENT_TYPE_UNSPECIFIED",
107
- CENTER = "ALIGNMENT_TYPE_CENTER",
108
- BOTH = "ALIGNMENT_TYPE_BOTH", // Justified
109
- DISTRIBUTE = "ALIGNMENT_TYPE_DISTRIBUTE",
110
- LEFT = "ALIGNMENT_TYPE_LEFT",
111
- RIGHT = "ALIGNMENT_TYPE_RIGHT"
112
- }
113
-
114
- export enum TextDirection {
115
- UNSPECIFIED = "TEXT_DIRECTION_UNSPECIFIED",
116
- RTL = "TEXT_DIRECTION_RIGHT_TO_LEFT",
117
- LTR = "TEXT_DIRECTION_LEFT_TO_RIGHT"
118
- }
119
-
120
- export interface RunProperty {
121
- font?: string;
122
- bold?: boolean;
123
- italics?: boolean;
124
- underline?: boolean;
125
- strike?: boolean;
126
- color?: string; // RRGGBB
127
- spacing?: number;
128
- size?: number; // half-points
129
- shading?: Shading;
130
- vertical_align?: TextVerticalAlign;
131
- is_placeholder?: boolean;
132
- }
133
-
134
- export interface Shading {
135
- foreground_color: string; // RRGGBB
136
- background_color: string; // RRGGBB
137
- }
138
-
139
- export enum TextVerticalAlign {
140
- UNSPECIFIED = "RUN_VERTICAL_ALIGN_UNSPECIFIED",
141
- BASELINE = "RUN_VERTICAL_ALIGN_BASELINE",
142
- SUPER_SCRIPT = "RUN_VERTICAL_ALIGN_SUPER_SCRIPT",
143
- SUB_SCRIPT = "RUN_VERTICAL_ALIGN_SUB_SCRIPT"
144
- }
145
-
146
- export interface TableProperty {
147
- table_width?: TableWidth;
148
- horizontal_alignment_type?: TableHorizontalAlignmentType;
149
- table_layout?: TableLayoutType;
150
- }
151
-
152
- export interface TableWidth {
153
- width: number;
154
- type: TableWidthType;
155
- }
156
-
157
- export enum TableHorizontalAlignmentType {
158
- UNSPECIFIED = "TABLE_HORIZONTAL_ALIGNMENT_TYPE_UNSPECIFIED",
159
- CENTER = "TABLE_HORIZONTAL_ALIGNMENT_TYPE_CENTER",
160
- LEFT = "TABLE_HORIZONTAL_ALIGNMENT_TYPE_LEFT",
161
- START = "TABLE_HORIZONTAL_ALIGNMENT_TYPE_START"
162
- }
163
-
164
- export enum TableLayoutType {
165
- UNSPECIFIED = "TABLE_LAYOUT_TYPE_UNSPECIFIED",
166
- FIXED = "TABLE_LAYOUT_TYPE_FIXED",
167
- AUTO_FIT = "TABLE_LAYOUT_TYPE_AUTO_FIT"
168
- }
169
-
170
- export enum TableWidthType {
171
- UNSPECIFIED = "TABLE_LAYOUT_TYPE_UNSPECIFIED",
172
- FIXED = "TABLE_LAYOUT_TYPE_FIXED",
173
- AUTO_FIT = "TABLE_LAYOUT_TYPE_AUTO_FIT"
174
- }
175
-
176
- export interface TableRowProperty {
177
- is_header?: boolean;
178
- }
179
-
180
- export interface TableCellProperty {
181
- table_cell_borders?: Borders;
182
- vertical_alignment?: VerticalAlignment;
183
- }
184
-
185
- export interface Borders {
186
- top?: BorderProperty;
187
- left?: BorderProperty;
188
- bottom?: BorderProperty;
189
- right?: BorderProperty;
190
- }
191
-
192
- export interface BorderProperty {
193
- color: string; // RRGGBB
194
- width: number;
195
- }
196
-
197
- export enum VerticalAlignment {
198
- UNSPECIFIED = "VERTICAL_ALIGNMENT__UNSPECIFIED",
199
- TOP = "VERTICAL_ALIGNMENT_TOP",
200
- CENTER = "VERTICAL_ALIGNMENT_CENTER",
201
- BOTH = "VERTICAL_ALIGNMENT_BOTH",
202
- BOTTOM = "VERTICAL_ALIGNMENT_BOTTOM"
203
- }
204
-
205
- export interface DrawingProperty {
206
- inline_keyword?: Inline;
207
- anchor?: Anchor;
208
- is_placeholder?: boolean;
209
- }
210
-
211
- export interface Inline {
212
- picture?: InlinePicture;
213
- addon?: InlineAddon;
214
- }
215
-
216
- export interface InlinePicture {
217
- uri: string;
218
- relative_rect?: RelativeRect;
219
- shape?: ShapeProperties;
220
- }
221
-
222
- export interface RelativeRect {
223
- left: number;
224
- top: number;
225
- right: number;
226
- bottom: number;
227
- }
228
-
229
- export interface ShapeProperties {
230
- transform?: Transform2D;
231
- }
232
-
233
- export interface Transform2D {
234
- extent?: PositiveSize2D;
235
- rotation?: number;
236
- }
237
-
238
- export interface PositiveSize2D {
239
- cx: number;
240
- cy: number;
241
- }
242
-
243
- export interface InlineAddon {
244
- addon_id: string;
245
- addon_source: AddonSourceType;
246
- }
247
-
248
- export enum AddonSourceType {
249
- UNSPECIFIED = "ADDON_SOURCE_TYPE_UNSPECIFIED",
250
- NONE = "ADDON_SOURCE_TYPE_NONE",
251
- LATEX = "ADDON_SOURCE_TYPE_LATEX",
252
- SIGN = "ADDON_SOURCE_TYPE_SIGN",
253
- SIGN_BAR = "ADDON_SOURCE_TYPE_SIGN_BAR"
254
- }
255
-
256
- export interface Anchor {
257
- picture?: AnchorPicture;
258
- }
259
-
260
- export interface AnchorPicture {
261
- uri: string;
262
- relative_rect?: RelativeRect;
263
- shape?: ShapeProperties;
264
- position_horizontal?: PositionHorizontal;
265
- position_vertical?: PositionVertical;
266
- wrap_none?: boolean;
267
- wrap_square?: WrapSquare;
268
- wrap_top_and_bottom?: boolean;
269
- behind_doc?: boolean;
270
- allow_overlap?: boolean;
271
- }
272
-
273
- export interface PositionHorizontal {
274
- pos_offset: number;
275
- relative_from: RelativeFromHorizontal;
276
- }
277
-
278
- export enum RelativeFromHorizontal {
279
- UNSPECIFIED = "RELATIVE_FROM_HORIZONTAL_UNSPECIFIED",
280
- MARGIN = "RELATIVE_FROM_HORIZONTAL_MARGIN",
281
- PAGE = "RELATIVE_FROM_HORIZONTAL_PAGE",
282
- COLUMN = "RELATIVE_FROM_HORIZONTAL_COLUMN",
283
- CHARACTER = "RELATIVE_FROM_HORIZONTAL_CHARACTER",
284
- LEFT_MARGIN = "RELATIVE_FROM_HORIZONTAL_LEFT_MARGIN",
285
- RIGHT_MARGIN = "RELATIVE_FROM_HORIZONTAL_RIGHT_MARGIN",
286
- INSIDE_MARGIN = "RELATIVE_FROM_HORIZONTAL_INSIDE_MARGIN",
287
- OUTSIDE_MARGIN = "RELATIVE_FROM_HORIZONTAL_OUTSIDE_MARGIN"
288
- }
289
-
290
- export interface PositionVertical {
291
- pos_offset: number;
292
- relative_from: RelativeFromVertical;
293
- }
294
-
295
- export enum RelativeFromVertical {
296
- UNSPECIFIED = "RELATIVE_FROM_VERTICAL_UNSPECIFIED",
297
- MARGIN = "RELATIVE_FROM_VERTICAL_MARGIN",
298
- PAGE = "RELATIVE_FROM_VERTICAL_PAGE",
299
- PARAGRAPH = "RELATIVE_FROM_VERTICAL_PARAGRAPH",
300
- LINE = "RELATIVE_FROM_VERTICAL_LINE",
301
- TOP_MARGIN = "RELATIVE_FROM_VERTICAL_TOP_MARGIN",
302
- BOTTOM_MARGIN = "RELATIVE_FROM_VERTICAL_BOTTOM_MARGIN",
303
- INSIDE_MARGIN = "RELATIVE_FROM_VERTICAL_INSIDE_MARGIN",
304
- OUTSIDE_MARGIN = "RELATIVE_FROM_VERTICAL_OUTSIDE_MARGIN"
305
- }
306
-
307
- export interface WrapSquare {
308
- wrap_text: WrapText;
309
- }
310
-
311
- export enum WrapText {
312
- UNSPECIFIED = "WRAP_TEXT_BOTH_UNSPECIFIED",
313
- BOTH_SIDES = "WRAP_TEXT_BOTH_SIDES",
314
- LEFT = "WRAP_TEXT_LEFT",
315
- RIGHT = "WRAP_TEXT_RIGHT",
316
- LARGEST = "WRAP_TEXT_LARGEST"
317
- }
318
-
319
-
320
- // --- Update Requests ---
321
-
322
- export interface Location {
323
- index: number;
324
- }
325
-
326
- export interface Range {
327
- start_index: number;
328
- length: number;
329
- }
330
-
331
- export interface ReplaceTextRequest {
332
- text: string;
333
- ranges: Range[]; // 最多 10 个范围
334
- }
335
-
336
- export interface InsertTextRequest {
337
- text: string;
338
- location: Location;
339
- }
340
-
341
- export interface DeleteContentRequest {
342
- range: Range;
343
- }
344
-
345
- export interface InsertImageRequest {
346
- image_id: string;
347
- location: Location;
348
- width?: number;
349
- height?: number;
350
- }
351
-
352
- export interface InsertPageBreakRequest {
353
- location: Location;
354
- }
355
-
356
- export interface InsertTableRequest {
357
- rows: number;
358
- cols: number;
359
- location: Location;
360
- }
361
-
362
- export interface InsertParagraphRequest {
363
- location: Location;
364
- }
365
-
366
- export interface TextProperty {
367
- bold?: boolean;
368
- italics?: boolean;
369
- underline?: boolean;
370
- strikethrough?: boolean;
371
- color?: string;
372
- background_color?: string;
373
- font_size?: number;
374
- }
375
-
376
- export interface UpdateTextPropertyRequest {
377
- text_property: TextProperty;
378
- ranges: Range[]; // 最多 10 个范围
379
- }
380
-
381
- export interface UpdateRequest {
382
- replace_text?: ReplaceTextRequest;
383
- insert_text?: InsertTextRequest;
384
- delete_content?: DeleteContentRequest;
385
- insert_image?: InsertImageRequest;
386
- insert_page_break?: InsertPageBreakRequest;
387
- insert_table?: InsertTableRequest;
388
- insert_paragraph?: InsertParagraphRequest;
389
- update_text_property?: UpdateTextPropertyRequest;
390
- }
391
-
392
- export interface BatchUpdateDocResponse {
393
- errcode: number;
394
- errmsg: string;
395
- responses?: Array<{
396
- insert_text_response?: { end_location: Location };
397
- delete_content_response?: { end_location: Location };
398
- replace_text_response?: { occurances: number };
399
- insert_image_response?: { image_id: string };
400
- insert_table_response?: { table_id: string };
401
- insert_paragraph_response?: { paragraph_id: string };
402
- update_text_property_response?: Record<string, never>;
403
- }>;
404
- }
405
-
406
- export interface GetDocContentResponse {
407
- errcode: number;
408
- errmsg: string;
409
- version: number;
410
- document: Node;
411
- }
412
-
413
- // --- Collect Form (收集表) Types ---
414
-
415
- export interface FormQuestionOption {
416
- key: number; // 必填,选项 key 从 1 开始
417
- value: string; // 必填,选项内容
418
- status?: number; // 1 正常,2 删除。创建时不传则自动填充为 1
419
- }
420
-
421
- export interface FormQuestion {
422
- question_id: number; // 必填,问题 ID 从 1 开始(家校从 2 开始)
423
- title: string; // 必填,问题标题
424
- pos: number; // 必填,问题序号从 1 开始
425
- status?: number; // 1 正常,2 删除。创建时不传则自动填充为 1
426
- reply_type: number; // 必填,问题类型(1-22)
427
- must_reply: boolean; // 必填,是否必答
428
- note?: string; // 可选,备注
429
- placeholder?: string; // 可选,输入提示
430
- question_extend_setting?: FormQuestionExtendSetting; // 可选,题型扩展设置
431
- option_item?: FormQuestionOption[]; // 单选/多选/下拉列表必填,创建时不传 status 则自动填充为 1
432
- }
433
-
434
- export interface FormQuestionExtendSetting {
435
- // 文本(reply_type=1)
436
- text_setting?: {
437
- validation_type?: number; // 0 字符个数,1 数字,2 邮箱,3 网址,4 身份证,5 手机号,6 固定电话
438
- validation_detail?: number; // 根据 validation_type 选择
439
- char_len?: number; // 字符长度 ≤4000
440
- number_min?: number; // 数字最小值
441
- number_max?: number; // 数字最大值
442
- };
443
- // 单选(reply_type=2)
444
- radio_setting?: {
445
- add_other_option?: boolean; // 是否增加"其他"选项
446
- };
447
- // 多选(reply_type=3)
448
- checkbox_setting?: {
449
- add_other_option?: boolean; // 是否增加"其他"选项
450
- type?: number; // 0 不限制,1 至少,2 最多,3 固定
451
- number?: number; // 当 type=1/2/3 时必填
452
- };
453
- // 位置(reply_type=5)
454
- location_setting?: {
455
- location_type?: number; // 0 省市区街道 + 详细,1 省/市,2 省/市/区,3 省/市/区/街道,4 自动定位
456
- distance_type?: number; // 0 当前,1 附近 100 米,2 附近 200 米,3 附近 300 米
457
- };
458
- // 图片(reply_type=9)
459
- image_setting?: {
460
- camera_only?: boolean; // 是否仅限手机拍照
461
- upload_image_limit?: {
462
- count_limit_type?: number; // 0 等于,1 小于等于
463
- count?: number; // 1~9
464
- max_size?: number; // MB,最大 3000
465
- };
466
- };
467
- // 文件(reply_type=10)
468
- file_setting?: {
469
- upload_file_limit?: {
470
- count_limit_type?: number;
471
- count?: number;
472
- max_size?: number;
473
- };
474
- };
475
- // 日期(reply_type=11)
476
- date_setting?: {
477
- date_format_type?: number; // 0 年月日时分,1 年月日,2 年月
478
- };
479
- // 时间(reply_type=14)
480
- time_setting?: {
481
- time_format_type?: number; // 0 时分,1 时分秒
482
- };
483
- // 体温(reply_type=16)
484
- temperature_setting?: {
485
- unit_type?: number; // 0 摄氏度,1 华氏度
486
- };
487
- // 部门(reply_type=18)
488
- department_setting?: {
489
- allow_multiple_selection?: boolean; // 是否允许多选
490
- };
491
- // 成员(reply_type=19)
492
- member_setting?: {
493
- allow_multiple_selection?: boolean; // 是否允许多选
494
- };
495
- // 时长(reply_type=22)
496
- duration_setting?: {
497
- time_scale?: number; // 1 按天,2 按小时
498
- date_type?: number; // 1 自然日,2 工作日
499
- day_range?: number; // 1~24,默认 24
500
- };
501
- }
502
-
503
- export interface FormSetting {
504
- fill_out_auth?: number; // 0 所有人,1 指定人/部门,4 家校所有范围
505
- fill_in_range?: { // 当 fill_out_auth=1 时必填
506
- userids?: string[]; // 成员列表
507
- departmentids?: number[]; // 部门列表
508
- };
509
- setting_manager_range?: { // 可选,管理员
510
- userids?: string[];
511
- };
512
- timed_repeat_info?: { // 可选,定时重复设置
513
- enable?: boolean; // 是否开启
514
- remind_time?: number; // 提醒时间戳(秒)
515
- repeat_type?: number; // 0 每周,1 每天,2 每月
516
- week_flag?: number; // 每周几,bit 组合(周一至周日对应 bit0-6)
517
- skip_holiday?: boolean; // 是否跳过节假日(repeat_type=1 有效)
518
- day_of_month?: number; // 每月第几天(repeat_type=2 有效)
519
- fork_finish_type?: number; // 补填:0 允许,1 仅当天,2 最后五天,3 一个月内,4 下一次生成前
520
- };
521
- allow_multi_fill?: boolean; // 是否允许多人提交多份
522
- timed_finish?: number; // 定时关闭时间戳(秒,与定时重复互斥)
523
- can_anonymous?: boolean; // 是否支持匿名
524
- can_notify_submit?: boolean; // 是否有回复时提醒
525
- }
526
-
527
- export interface FormInfo {
528
- form_title: string; // 必填,收集表标题
529
- form_desc?: string; // 可选,收集表描述
530
- form_header?: string; // 可选,背景图链接
531
- form_question: { // 必填,问题列表
532
- items: FormQuestion[]; // 问题数组 ≤200
533
- };
534
- form_setting?: FormSetting; // 可选,收集表设置
535
- }
536
-
537
- export interface CreateCollectRequest {
538
- spaceid?: string; // 可选,空间 ID
539
- fatherid?: string; // 可选,父目录 fileid
540
- form_info: FormInfo; // 必填,收集表信息
541
- }
542
-
543
- export interface CreateCollectResponse {
544
- errcode: number;
545
- errmsg: string;
546
- formid: string;
547
- }
548
-
549
- // --- Spreadsheet (在线表格) Types ---
550
-
551
- export interface SheetProperties {
552
- sheet_id: string;
553
- title: string;
554
- row_count: number;
555
- column_count: number;
556
- }
557
-
558
- export interface GetSheetPropertiesResponse {
559
- errcode: number;
560
- errmsg: string;
561
- properties: SheetProperties[];
562
- }
563
-
564
- export interface GridData {
565
- start_row: number; // 起始行号(从 0 开始)
566
- start_column: number; // 起始列号(从 0 开始)
567
- rows: RowData[]; // 行数据列表
568
- }
569
-
570
- export interface RowData {
571
- values: CellData[]; // 该行各列单元格数据
572
- }
573
-
574
- export interface CellData {
575
- cell_value?: CellValue; // 单元格数据内容(可选)
576
- cell_format?: CellFormat; // 单元格样式(可选)
577
- }
578
-
579
- export interface CellValue {
580
- text?: string; // 纯文本
581
- link?: Link; // 超链接(与 text 互斥)
582
- }
583
-
584
- export interface Link {
585
- url: string; // 链接地址
586
- text: string; // 链接显示文本
587
- }
588
-
589
- export interface CellFormat {
590
- text_format?: TextFormat; // 文字样式
591
- }
592
-
593
- export interface TextFormat {
594
- font?: string; // 字体名称(如 "Microsoft YaHei")
595
- font_size?: number; // 字号,最大 72
596
- bold?: boolean;
597
- italic?: boolean;
598
- strikethrough?: boolean;
599
- underline?: boolean;
600
- color?: Color; // 文字颜色(RGBA)
601
- }
602
-
603
- export interface Color {
604
- red: number; // 0~255
605
- green: number; // 0~255
606
- blue: number; // 0~255
607
- alpha?: number; // 0~255,默认 255(不透明),可选
608
- }
609
-
610
- export enum Dimension {
611
- ROW = "ROW", // 行
612
- COLUMN = "COLUMN" // 列
613
- }
614
-
615
- // Batch Update Requests
616
- export interface AddSheetRequest {
617
- add_sheet_request: {
618
- title: string;
619
- row_count?: number;
620
- column_count?: number;
621
- };
622
- }
623
-
624
- export interface DeleteSheetRequest {
625
- delete_sheet_request: {
626
- sheet_id: string;
627
- };
628
- }
629
-
630
- export interface UpdateRangeRequest {
631
- update_range_request: {
632
- sheet_id: string;
633
- grid_data: GridData;
634
- };
635
- }
636
-
637
- export interface DeleteDimensionRequest {
638
- delete_dimension_request: {
639
- sheet_id: string;
640
- dimension: Dimension;
641
- start_index: number; // 从 1 开始
642
- end_index: number; // 从 1 开始,不包含
643
- };
644
- }
645
-
646
- export type SpreadsheetUpdateRequest =
647
- | AddSheetRequest
648
- | DeleteSheetRequest
649
- | UpdateRangeRequest
650
- | DeleteDimensionRequest;
651
-
652
- export interface SpreadsheetBatchUpdateResponse {
653
- errcode: number;
654
- errmsg: string;
655
- data?: {
656
- responses: Array<{
657
- add_sheet_response?: {
658
- properties: SheetProperties;
659
- };
660
- delete_sheet_response?: {
661
- sheet_id: string;
662
- };
663
- update_range_response?: {
664
- updated_cells: number;
665
- };
666
- delete_dimension_response?: {
667
- deleted: number;
668
- };
669
- }>;
670
- };
671
- }
672
-
673
- export interface GetSheetRangeDataResponse {
674
- errcode: number;
675
- errmsg: string;
676
- data: {
677
- result: GridData;
678
- };
679
- }
680
-
681
- // --- Smart Table Records & Fields Types ---
682
-
683
- export interface SmartTableRecord {
684
- record_id: string;
685
- create_time?: string;
686
- update_time?: string;
687
- values: Record<string, any>;
688
- creator_name?: string;
689
- updater_name?: string;
690
- }
691
-
692
- export interface SmartTableGetRecordsResponse {
693
- errcode: number;
694
- errmsg: string;
695
- records?: SmartTableRecord[];
696
- total?: number;
697
- has_more?: boolean;
698
- next?: number;
699
- ver?: number;
700
- }
701
-
702
- export interface SmartTableField {
703
- field_id: string;
704
- field_title: string;
705
- field_type: string;
706
- property_number?: any;
707
- property_checkbox?: any;
708
- property_date_time?: any;
709
- property_attachment?: any;
710
- property_user?: any;
711
- property_url?: any;
712
- property_select?: any;
713
- property_created_time?: any;
714
- property_modified_time?: any;
715
- property_progress?: any;
716
- property_single_select?: any;
717
- property_reference?: any;
718
- property_location?: any;
719
- property_auto_number?: any;
720
- property_currency?: any;
721
- property_ww_group?: any;
722
- property_percentage?: any;
723
- property_barcode?: any;
724
- property_image?: any;
725
- property_phone_number?: any;
726
- property_email?: any;
727
- }
728
-
729
- export interface SmartTableGetFieldsResponse {
730
- errcode: number;
731
- errmsg: string;
732
- fields?: SmartTableField[];
733
- total?: number;
734
- has_more?: boolean;
735
- next?: number;
736
- }
737
-
738
- export interface SmartTableView {
739
- view_id: string;
740
- view_title: string;
741
- view_type: string;
742
- is_visible?: boolean;
743
- type?: string;
744
- property?: any;
745
- }
746
-
747
- export interface SmartTableGetViewsResponse {
748
- errcode: number;
749
- errmsg: string;
750
- views?: SmartTableView[];
751
- total?: number;
752
- has_more?: boolean;
753
- next?: number;
754
- }
755
-
756
- export interface SmartTableFieldGroup {
757
- field_group_id: string;
758
- name: string;
759
- children?: { field_id: string }[];
760
- }
761
-
762
- export interface SmartTableGetGroupsResponse {
763
- errcode: number;
764
- errmsg: string;
765
- field_groups?: SmartTableFieldGroup[];
766
- total?: number;
767
- has_more?: boolean;
768
- next?: number;
769
- }
770
-
771
- export interface SmartTableSheetPriv {
772
- sheet_id: string;
773
- priv: number;
774
- can_insert_record?: boolean;
775
- can_delete_record?: boolean;
776
- can_create_modify_delete_view?: boolean;
777
- field_priv?: any;
778
- record_priv?: any;
779
- clear?: boolean;
780
- }
781
-
782
- export interface SmartTableGetSheetPrivResponse {
783
- errcode: number;
784
- errmsg: string;
785
- rule_list?: any[];
786
- }
787
-
788
- export interface SmartTableCreateRuleResponse {
789
- errcode: number;
790
- errmsg: string;
791
- rule_id?: number;
792
- }