@yanhaidao/wecom 2.3.13 → 2.3.14

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.
@@ -0,0 +1,1404 @@
1
+ const accountIdProperty = {
2
+ type: "string",
3
+ minLength: 1,
4
+ description: "可选:指定企业微信账号 ID;不填时按 agent 账号/默认账号自动选择",
5
+ };
6
+
7
+ const docTypeProperty = {
8
+ oneOf: [
9
+ {
10
+ type: "string",
11
+ enum: ["doc", "spreadsheet", "smart_table"],
12
+ },
13
+ {
14
+ type: "integer",
15
+ enum: [3, 4, 10],
16
+ },
17
+ ],
18
+ default: "doc",
19
+ description: "文档类型:doc=文档,spreadsheet=表格,smart_table=智能表格",
20
+ };
21
+
22
+ const sheetIdProperty = {
23
+ type: "string",
24
+ minLength: 1,
25
+ description: "子表 ID (sheet_id)",
26
+ };
27
+
28
+ const docIdProperty = {
29
+ type: "string",
30
+ minLength: 1,
31
+ description: "文档 docid",
32
+ };
33
+
34
+ const formIdProperty = {
35
+ type: "string",
36
+ minLength: 1,
37
+ description: "收集表 formid",
38
+ };
39
+
40
+ const shareUrlProperty = {
41
+ type: "string",
42
+ minLength: 1,
43
+ description: "企业微信文档分享链接",
44
+ };
45
+
46
+ const genericObjectProperty = {
47
+ type: "object",
48
+ additionalProperties: true,
49
+ };
50
+
51
+ const nonEmptyObjectProperty = {
52
+ ...genericObjectProperty,
53
+ minProperties: 1,
54
+ };
55
+
56
+ // --- Doc Permission Schemas ---
57
+
58
+ const coAuthListProperty = {
59
+ type: "array",
60
+ items: {
61
+ type: "object",
62
+ required: ["departmentid", "auth", "type"],
63
+ properties: {
64
+ departmentid: { type: "integer", description: "特定部门id" },
65
+ auth: { type: "integer", enum: [1, 2], description: "1:只读, 2:读写" },
66
+ type: { type: "integer", const: 2, description: "2:部门" }
67
+ }
68
+ }
69
+ };
70
+
71
+ const docMemberListProperty = {
72
+ type: "array",
73
+ items: {
74
+ type: "object",
75
+ required: ["type", "auth"],
76
+ properties: {
77
+ type: { type: "integer", const: 1, description: "1:用户" },
78
+ userid: { type: "string", description: "企业成员userid" },
79
+ tmp_external_userid: { type: "string", description: "外部用户临时id" },
80
+ auth: { type: "integer", enum: [1, 2, 7], description: "1:只读 2:读写 7:管理员" }
81
+ }
82
+ }
83
+ };
84
+
85
+ const delDocMemberListProperty = {
86
+ type: "array",
87
+ items: {
88
+ type: "object",
89
+ required: ["type"],
90
+ properties: {
91
+ type: { type: "integer", const: 1 },
92
+ userid: { type: "string" },
93
+ tmp_external_userid: { type: "string" }
94
+ }
95
+ }
96
+ };
97
+
98
+ const watermarkProperty = {
99
+ type: "object",
100
+ properties: {
101
+ margin_type: { type: "integer", enum: [1, 2], description: "1:稀疏, 2:紧密" },
102
+ show_visitor_name: { type: "boolean" },
103
+ show_text: { type: "boolean" },
104
+ text: { type: "string" }
105
+ }
106
+ };
107
+
108
+ // --- Smartsheet Permission Schemas ---
109
+
110
+ const fieldRuleListSchema = {
111
+ type: "array",
112
+ items: {
113
+ type: "object",
114
+ required: ["field_id", "can_edit", "can_insert", "can_view"],
115
+ properties: {
116
+ field_id: { type: "string" },
117
+ field_type: { type: "string" },
118
+ can_edit: { type: "boolean" },
119
+ can_insert: { type: "boolean" },
120
+ can_view: { type: "boolean" }
121
+ }
122
+ }
123
+ };
124
+
125
+ const fieldPrivSchema = {
126
+ type: "object",
127
+ required: ["field_range_type", "field_rule_list"],
128
+ properties: {
129
+ field_range_type: { type: "integer", enum: [1, 2], description: "1-所有字段;2-部分字段" },
130
+ field_rule_list: fieldRuleListSchema,
131
+ field_default_rule: {
132
+ type: "object",
133
+ properties: {
134
+ can_edit: { type: "boolean" },
135
+ can_insert: { type: "boolean" },
136
+ can_view: { type: "boolean" }
137
+ }
138
+ }
139
+ }
140
+ };
141
+
142
+ const recordRuleListSchema = {
143
+ type: "array",
144
+ items: {
145
+ type: "object",
146
+ required: ["field_id", "oper_type"],
147
+ properties: {
148
+ field_id: { type: "string" },
149
+ field_type: { type: "string" },
150
+ oper_type: { type: "integer", description: "1-包含自己; 2-包含value; 3-不包含; 4-等于; 5-不等于; 6-为空; 7-非空" },
151
+ value: { type: "array", items: { type: "string" } }
152
+ }
153
+ }
154
+ };
155
+
156
+ const recordPrivSchema = {
157
+ type: "object",
158
+ required: ["record_range_type"],
159
+ properties: {
160
+ record_range_type: { type: "integer", enum: [1, 2, 3], description: "1-全部; 2-任意条件; 3-全部条件" },
161
+ record_rule_list: recordRuleListSchema,
162
+ other_priv: { type: "integer", enum: [1, 2], description: "1-不可编辑; 2-不可查看" }
163
+ }
164
+ };
165
+
166
+ const privListSchema = {
167
+ type: "array",
168
+ items: {
169
+ type: "object",
170
+ required: ["sheet_id", "priv"],
171
+ properties: {
172
+ sheet_id: { type: "string" },
173
+ priv: {
174
+ oneOf: [{ type: "string" }, { type: "integer" }],
175
+ description: "1-全部权限;2-可编辑;3-仅浏览;4-无权限"
176
+ },
177
+ can_insert_record: { type: "boolean" },
178
+ can_delete_record: { type: "boolean" },
179
+ can_create_modify_delete_view: { type: "boolean" },
180
+ field_priv: fieldPrivSchema,
181
+ record_priv: recordPrivSchema,
182
+ clear: { type: "boolean" }
183
+ }
184
+ }
185
+ };
186
+
187
+ const memberRangeSchema = {
188
+ type: "object",
189
+ properties: {
190
+ userid_list: { type: "array", items: { type: "string" } }
191
+ }
192
+ };
193
+
194
+ // --- Doc Content Update Schemas ---
195
+
196
+ const locationProperty = {
197
+ type: "object",
198
+ required: ["index"],
199
+ properties: {
200
+ index: { type: "integer", minimum: 0, description: "位置索引" }
201
+ }
202
+ };
203
+
204
+ const rangeProperty = {
205
+ type: "object",
206
+ required: ["start_index", "length"],
207
+ properties: {
208
+ start_index: { type: "integer", minimum: 0, description: "起始位置" },
209
+ length: { type: "integer", minimum: 1, description: "长度" }
210
+ }
211
+ };
212
+
213
+ const textPropertySchema = {
214
+ type: "object",
215
+ description: "文本属性",
216
+ properties: {
217
+ bold: { type: "boolean" },
218
+ italics: { type: "boolean" },
219
+ underline: { type: "boolean" },
220
+ strike: { type: "boolean" },
221
+ color: { type: "string", pattern: "^[0-9A-Fa-f]{6}$", description: "RRGGBB 格式颜色" },
222
+ background_color: { type: "string", pattern: "^[0-9A-Fa-f]{6}$", description: "RRGGBB 格式背景色" },
223
+ size: { type: "integer", description: "字体大小(half-points)" }
224
+ }
225
+ };
226
+
227
+ const insertTextRequest = {
228
+ type: "object",
229
+ required: ["text", "location"],
230
+ properties: {
231
+ text: { type: "string", minLength: 1 },
232
+ location: locationProperty
233
+ }
234
+ };
235
+
236
+ const replaceTextRequest = {
237
+ type: "object",
238
+ required: ["text", "ranges"],
239
+ properties: {
240
+ text: { type: "string" },
241
+ ranges: { type: "array", items: rangeProperty, minItems: 1 }
242
+ }
243
+ };
244
+
245
+ const deleteContentRequest = {
246
+ type: "object",
247
+ required: ["range"],
248
+ properties: {
249
+ range: rangeProperty
250
+ }
251
+ };
252
+
253
+ const updateTextPropertyRequest = {
254
+ type: "object",
255
+ required: ["text_property", "ranges"],
256
+ properties: {
257
+ text_property: textPropertySchema,
258
+ ranges: { type: "array", items: rangeProperty, minItems: 1 }
259
+ }
260
+ };
261
+
262
+ const insertImageRequest = {
263
+ type: "object",
264
+ required: ["image_id", "location"],
265
+ properties: {
266
+ image_id: { type: "string", description: "上传图片获得的 image_id/url" },
267
+ location: locationProperty,
268
+ width: { type: "integer", description: "宽(px)" },
269
+ height: { type: "integer", description: "高(px)" }
270
+ }
271
+ };
272
+
273
+ const insertPageBreakRequest = {
274
+ type: "object",
275
+ required: ["location"],
276
+ properties: {
277
+ location: locationProperty
278
+ }
279
+ };
280
+
281
+ const insertTableRequest = {
282
+ type: "object",
283
+ required: ["rows", "cols", "location"],
284
+ properties: {
285
+ rows: { type: "integer", minimum: 1, maximum: 100 },
286
+ cols: { type: "integer", minimum: 1, maximum: 60 },
287
+ location: locationProperty
288
+ }
289
+ };
290
+
291
+ const insertParagraphRequest = {
292
+ type: "object",
293
+ description: "在指定位置插入段落。注意:请使用此操作来分段,而不是在 insert_text 中使用换行符。",
294
+ required: ["location"],
295
+ properties: {
296
+ location: locationProperty
297
+ }
298
+ };
299
+
300
+ // --- Spreadsheet Update Schemas ---
301
+
302
+ const addSheetRequest = {
303
+ type: "object",
304
+ required: ["title"],
305
+ properties: {
306
+ title: { type: "string", minLength: 1 },
307
+ row_count: { type: "integer", minimum: 1 },
308
+ column_count: { type: "integer", minimum: 1 }
309
+ }
310
+ };
311
+
312
+ const deleteSheetRequest = {
313
+ type: "object",
314
+ required: ["sheet_id"],
315
+ properties: {
316
+ sheet_id: { type: "string", minLength: 1 }
317
+ }
318
+ };
319
+
320
+ const deleteDimensionRequest = {
321
+ type: "object",
322
+ required: ["sheet_id", "dimension", "start_index", "end_index"],
323
+ properties: {
324
+ sheet_id: { type: "string" },
325
+ dimension: { type: "string", enum: ["ROW", "COLUMN"] },
326
+ start_index: { type: "integer", minimum: 1 },
327
+ end_index: { type: "integer", minimum: 2 }
328
+ }
329
+ };
330
+
331
+ const cellValueSchema = {
332
+ type: "object",
333
+ properties: {
334
+ text: { type: "string" },
335
+ link: {
336
+ type: "object",
337
+ required: ["text", "url"],
338
+ properties: {
339
+ text: { type: "string" },
340
+ url: { type: "string" }
341
+ }
342
+ }
343
+ }
344
+ };
345
+
346
+ const cellFormatSchema = {
347
+ type: "object",
348
+ properties: {
349
+ text_format: {
350
+ type: "object",
351
+ properties: {
352
+ bold: { type: "boolean" },
353
+ italic: { type: "boolean" },
354
+ strikethrough: { type: "boolean" },
355
+ underline: { type: "boolean" },
356
+ color: {
357
+ type: "object",
358
+ required: ["red", "green", "blue"],
359
+ properties: {
360
+ red: { type: "integer", minimum: 0, maximum: 255 },
361
+ green: { type: "integer", minimum: 0, maximum: 255 },
362
+ blue: { type: "integer", minimum: 0, maximum: 255 },
363
+ alpha: { type: "integer", minimum: 0, maximum: 255 }
364
+ }
365
+ },
366
+ font_size: { type: "integer" }
367
+ }
368
+ }
369
+ }
370
+ };
371
+
372
+ const cellDataSchema = {
373
+ type: "object",
374
+ properties: {
375
+ cell_value: cellValueSchema,
376
+ cell_format: cellFormatSchema
377
+ }
378
+ };
379
+
380
+ const rowDataSchema = {
381
+ type: "object",
382
+ required: ["values"],
383
+ properties: {
384
+ values: {
385
+ type: "array",
386
+ items: cellDataSchema
387
+ }
388
+ }
389
+ };
390
+
391
+ const gridDataSchema = {
392
+ type: "object",
393
+ required: ["rows"],
394
+ properties: {
395
+ start_row: { type: "integer", default: 0 },
396
+ start_column: { type: "integer", default: 0 },
397
+ rows: {
398
+ type: "array",
399
+ items: rowDataSchema
400
+ }
401
+ }
402
+ };
403
+
404
+ const updateRangeRequest = {
405
+ type: "object",
406
+ required: ["sheet_id", "grid_data"],
407
+ properties: {
408
+ sheet_id: { type: "string" },
409
+ grid_data: gridDataSchema
410
+ }
411
+ };
412
+
413
+
414
+ const docMemberEntryProperty = {
415
+ oneOf: [
416
+ { type: "string", minLength: 1 },
417
+ { type: "object", additionalProperties: true, minProperties: 1 },
418
+ ],
419
+ };
420
+
421
+ const docMemberEntryArrayProperty = {
422
+ type: "array",
423
+ minItems: 1,
424
+ items: docMemberEntryProperty,
425
+ };
426
+
427
+ export const wecomDocToolSchema = {
428
+ oneOf: [
429
+ {
430
+ type: "object",
431
+ additionalProperties: false,
432
+ required: ["action", "docId"],
433
+ properties: {
434
+ action: { const: "get_doc_security_setting" },
435
+ accountId: accountIdProperty,
436
+ docId: docIdProperty,
437
+ },
438
+ },
439
+ {
440
+ type: "object",
441
+ additionalProperties: false,
442
+ required: ["action", "docId", "setting"],
443
+ properties: {
444
+ action: { const: "mod_doc_security_setting" },
445
+ accountId: accountIdProperty,
446
+ docId: docIdProperty,
447
+ setting: nonEmptyObjectProperty,
448
+ },
449
+ },
450
+ {
451
+ type: "object",
452
+ additionalProperties: false,
453
+ required: ["action", "docName"],
454
+ properties: {
455
+ action: { const: "create" },
456
+ accountId: accountIdProperty,
457
+ docName: {
458
+ type: "string",
459
+ minLength: 1,
460
+ description: "文档名称",
461
+ },
462
+ docType: docTypeProperty,
463
+ spaceId: {
464
+ type: "string",
465
+ minLength: 1,
466
+ description: "可选:文档空间 ID",
467
+ },
468
+ fatherId: {
469
+ type: "string",
470
+ minLength: 1,
471
+ description: "可选:父目录 fileid;传 spaceId 时通常也应传 fatherId",
472
+ },
473
+ adminUsers: {
474
+ type: "array",
475
+ description: "可选:文档管理员 userid 列表",
476
+ items: {
477
+ type: "string",
478
+ minLength: 1,
479
+ },
480
+ },
481
+ viewers: {
482
+ ...docMemberEntryArrayProperty,
483
+ description: "可选:创建后立即授予查看权限的成员列表",
484
+ },
485
+ collaborators: {
486
+ ...docMemberEntryArrayProperty,
487
+ description: "可选:创建后立即授予协作者权限的成员列表",
488
+ },
489
+ init_content: {
490
+ type: "array",
491
+ description: "可选:初始文档内容(段落列表)。插件会自动处理段落分隔,确保标题和正文分离。",
492
+ items: {
493
+ type: "string",
494
+ description: "段落内容",
495
+ },
496
+ },
497
+ },
498
+ },
499
+ {
500
+ type: "object",
501
+ additionalProperties: false,
502
+ required: ["action", "docId", "newName"],
503
+ properties: {
504
+ action: { const: "rename" },
505
+ accountId: accountIdProperty,
506
+ docId: docIdProperty,
507
+ newName: {
508
+ type: "string",
509
+ minLength: 1,
510
+ description: "新文档名",
511
+ },
512
+ },
513
+ },
514
+ {
515
+ type: "object",
516
+ additionalProperties: false,
517
+ required: ["action", "docId"],
518
+ properties: {
519
+ action: { const: "copy" },
520
+ accountId: accountIdProperty,
521
+ docId: docIdProperty,
522
+ newName: {
523
+ type: "string",
524
+ minLength: 1,
525
+ description: "可选:复制后的新文档名",
526
+ },
527
+ spaceId: {
528
+ type: "string",
529
+ minLength: 1,
530
+ description: "可选:目标空间 ID",
531
+ },
532
+ fatherId: {
533
+ type: "string",
534
+ minLength: 1,
535
+ description: "可选:目标父目录 fileid",
536
+ },
537
+ },
538
+ },
539
+ {
540
+ type: "object",
541
+ additionalProperties: false,
542
+ required: ["action", "docId"],
543
+ properties: {
544
+ action: { const: "get_info" },
545
+ accountId: accountIdProperty,
546
+ docId: docIdProperty,
547
+ },
548
+ },
549
+ {
550
+ type: "object",
551
+ additionalProperties: false,
552
+ required: ["action", "docId"],
553
+ properties: {
554
+ action: { const: "share" },
555
+ accountId: accountIdProperty,
556
+ docId: docIdProperty,
557
+ },
558
+ },
559
+ {
560
+ type: "object",
561
+ additionalProperties: false,
562
+ required: ["action", "docId"],
563
+ properties: {
564
+ action: { const: "get_auth" },
565
+ accountId: accountIdProperty,
566
+ docId: docIdProperty,
567
+ },
568
+ },
569
+ {
570
+ type: "object",
571
+ additionalProperties: false,
572
+ required: ["action", "docId", "notified_scope_type"],
573
+ properties: {
574
+ action: { const: "mod_doc_member_notified_scope" },
575
+ accountId: accountIdProperty,
576
+ docId: docIdProperty,
577
+ notified_scope_type: { type: "integer", description: "通知范围类型:0-不通知,1-仅协作者,2-所有人" },
578
+ notified_member_list: { type: "array", items: nonEmptyObjectProperty, description: "指定成员列表" },
579
+ },
580
+ },
581
+ {
582
+ type: "object",
583
+ additionalProperties: false,
584
+ required: ["action", "docId"],
585
+ properties: {
586
+ action: { const: "diagnose_auth" },
587
+ accountId: accountIdProperty,
588
+ docId: docIdProperty,
589
+ },
590
+ },
591
+ {
592
+ type: "object",
593
+ additionalProperties: false,
594
+ required: ["action", "shareUrl"],
595
+ properties: {
596
+ action: { const: "validate_share_link" },
597
+ accountId: accountIdProperty,
598
+ shareUrl: shareUrlProperty,
599
+ },
600
+ },
601
+ {
602
+ type: "object",
603
+ additionalProperties: false,
604
+ required: ["action"],
605
+ anyOf: [{ required: ["docId"] }, { required: ["formId"] }],
606
+ properties: {
607
+ action: { const: "delete" },
608
+ accountId: accountIdProperty,
609
+ docId: docIdProperty,
610
+ formId: formIdProperty,
611
+ },
612
+ },
613
+ {
614
+ type: "object",
615
+ additionalProperties: false,
616
+ required: ["action", "docId", "request"],
617
+ properties: {
618
+ action: { const: "set_join_rule" },
619
+ accountId: accountIdProperty,
620
+ docId: docIdProperty,
621
+ request: {
622
+ type: "object",
623
+ description: "mod_doc_join_rule 请求体。插件会自动补 docid。",
624
+ additionalProperties: false,
625
+ properties: {
626
+ enable_corp_internal: { type: "boolean" },
627
+ corp_internal_auth: { type: "integer", description: "1:只读 2:读写" },
628
+ enable_corp_external: { type: "boolean" },
629
+ corp_external_auth: { type: "integer", description: "1:只读 2:读写" },
630
+ corp_internal_approve_only_by_admin: { type: "boolean" },
631
+ corp_external_approve_only_by_admin: { type: "boolean" },
632
+ ban_share_external: { type: "boolean" },
633
+ update_co_auth_list: { type: "boolean" },
634
+ co_auth_list: coAuthListProperty
635
+ }
636
+ },
637
+ },
638
+ },
639
+ {
640
+ type: "object",
641
+ additionalProperties: false,
642
+ required: ["action", "docId"],
643
+ anyOf: [
644
+ { required: ["viewers"] },
645
+ { required: ["collaborators"] },
646
+ { required: ["removeViewers"] },
647
+ { required: ["removeCollaborators"] },
648
+ ],
649
+ properties: {
650
+ action: { const: "grant_access" },
651
+ accountId: accountIdProperty,
652
+ docId: docIdProperty,
653
+ auth: {
654
+ type: "integer",
655
+ enum: [1, 2, 7],
656
+ description: "权限位:1-查看,2-编辑,7-管理",
657
+ },
658
+ viewers: {
659
+ ...docMemberEntryArrayProperty,
660
+ description: "新增查看成员列表",
661
+ },
662
+ collaborators: {
663
+ ...docMemberEntryArrayProperty,
664
+ description: "新增协作者列表",
665
+ },
666
+ removeViewers: {
667
+ ...docMemberEntryArrayProperty,
668
+ description: "移除查看成员列表",
669
+ },
670
+ removeCollaborators: {
671
+ ...docMemberEntryArrayProperty,
672
+ description: "移除协作者列表",
673
+ },
674
+ },
675
+ },
676
+ {
677
+ type: "object",
678
+ additionalProperties: false,
679
+ required: ["action", "docId", "collaborators"],
680
+ properties: {
681
+ action: { const: "add_collaborators" },
682
+ accountId: accountIdProperty,
683
+ docId: docIdProperty,
684
+ auth: {
685
+ type: "integer",
686
+ enum: [1, 2, 7],
687
+ description: "权限位:1-查看,2-编辑,7-管理;默认为 2 (编辑)",
688
+ },
689
+ collaborators: {
690
+ ...docMemberEntryArrayProperty,
691
+ description: "要添加的协作者列表;字符串会自动按 userid 处理",
692
+ },
693
+ },
694
+ },
695
+ {
696
+ type: "object",
697
+ additionalProperties: false,
698
+ required: ["action", "docId"],
699
+ properties: {
700
+ action: { const: "get_content" },
701
+ accountId: accountIdProperty,
702
+ docId: docIdProperty,
703
+ },
704
+ },
705
+ {
706
+ type: "object",
707
+ additionalProperties: false,
708
+ required: ["action", "docId", "requests"],
709
+ properties: {
710
+ action: { const: "update_content" },
711
+ accountId: accountIdProperty,
712
+ docId: docIdProperty,
713
+ version: {
714
+ type: "integer",
715
+ description: "可选:文档版本号,用于乐观锁",
716
+ },
717
+ requests: {
718
+ type: "array",
719
+ minItems: 1,
720
+ description: "操作列表,必须遵循企业微信 batch_update 格式",
721
+ items: {
722
+ type: "object",
723
+ // additionalProperties: false, // 移除此行,因为 oneOf 验证在空 properties 下会导致验证失败
724
+ oneOf: [
725
+ { required: ["replace_text"], properties: { replace_text: replaceTextRequest } },
726
+ { required: ["insert_text"], properties: { insert_text: insertTextRequest } },
727
+ { required: ["delete_content"], properties: { delete_content: deleteContentRequest } },
728
+ { required: ["update_text_property"], properties: { update_text_property: updateTextPropertyRequest } },
729
+ { required: ["insert_image"], properties: { insert_image: insertImageRequest } },
730
+ { required: ["insert_page_break"], properties: { insert_page_break: insertPageBreakRequest } },
731
+ { required: ["insert_table"], properties: { insert_table: insertTableRequest } },
732
+ { required: ["insert_paragraph"], properties: { insert_paragraph: insertParagraphRequest } }
733
+ ]
734
+ },
735
+ },
736
+ },
737
+ },
738
+ {
739
+ type: "object",
740
+ additionalProperties: false,
741
+ required: ["action", "docId", "request"],
742
+ properties: {
743
+ action: { const: "set_member_auth" },
744
+ accountId: accountIdProperty,
745
+ docId: docIdProperty,
746
+ request: {
747
+ type: "object",
748
+ description: "mod_doc_member 请求体。插件会自动补 docid。",
749
+ additionalProperties: false,
750
+ properties: {
751
+ update_file_member_list: docMemberListProperty,
752
+ del_file_member_list: delDocMemberListProperty
753
+ }
754
+ },
755
+ },
756
+ },
757
+ {
758
+ type: "object",
759
+ additionalProperties: false,
760
+ required: ["action", "docId", "request"],
761
+ properties: {
762
+ action: { const: "set_safety_setting" },
763
+ accountId: accountIdProperty,
764
+ docId: docIdProperty,
765
+ request: {
766
+ type: "object",
767
+ description: "mod_doc_safty_setting 请求体",
768
+ additionalProperties: false,
769
+ properties: {
770
+ enable_readonly_copy: { type: "boolean", description: "是否允许只读成员复制、下载" },
771
+ watermark: watermarkProperty,
772
+ },
773
+ },
774
+ },
775
+ },
776
+ {
777
+ type: "object",
778
+ additionalProperties: false,
779
+ required: ["action", "formInfo"],
780
+ properties: {
781
+ action: { const: "create_collect" },
782
+ accountId: accountIdProperty,
783
+ formInfo: {
784
+ ...nonEmptyObjectProperty,
785
+ description: "收集表 form_info 对象,至少应包含 form_title 等官方字段",
786
+ },
787
+ spaceId: {
788
+ type: "string",
789
+ minLength: 1,
790
+ description: "可选:文档空间 ID",
791
+ },
792
+ fatherId: {
793
+ type: "string",
794
+ minLength: 1,
795
+ description: "可选:父目录 fileid",
796
+ },
797
+ },
798
+ },
799
+ {
800
+ type: "object",
801
+ additionalProperties: false,
802
+ required: ["action", "oper", "formId", "formInfo"],
803
+ properties: {
804
+ action: { const: "modify_collect" },
805
+ accountId: accountIdProperty,
806
+ oper: {
807
+ type: "string",
808
+ minLength: 1,
809
+ description: "修改操作类型,按企业微信官方 modify_collect 定义填写",
810
+ },
811
+ formId: formIdProperty,
812
+ formInfo: {
813
+ ...nonEmptyObjectProperty,
814
+ description: "收集表 form_info 对象",
815
+ },
816
+ },
817
+ },
818
+ {
819
+ type: "object",
820
+ additionalProperties: false,
821
+ required: ["action", "formId"],
822
+ properties: {
823
+ action: { const: "get_form_info" },
824
+ accountId: accountIdProperty,
825
+ formId: formIdProperty,
826
+ },
827
+ },
828
+ {
829
+ type: "object",
830
+ additionalProperties: false,
831
+ required: ["action", "repeatedId"],
832
+ properties: {
833
+ action: { const: "get_form_answer" },
834
+ accountId: accountIdProperty,
835
+ repeatedId: {
836
+ type: "string",
837
+ minLength: 1,
838
+ description: "收集表提交记录 repeated_id",
839
+ },
840
+ answerIds: {
841
+ type: "array",
842
+ description: "可选:答案 ID 列表",
843
+ items: {
844
+ type: "integer",
845
+ },
846
+ },
847
+ },
848
+ },
849
+ {
850
+ type: "object",
851
+ additionalProperties: false,
852
+ required: ["action", "requests"],
853
+ properties: {
854
+ action: { const: "get_form_statistic" },
855
+ accountId: accountIdProperty,
856
+ requests: {
857
+ type: "array",
858
+ minItems: 1,
859
+ description: "统计请求列表;每项按企业微信 get_form_statistic 官方结构填写",
860
+ items: nonEmptyObjectProperty,
861
+ },
862
+ },
863
+ },
864
+ {
865
+ type: "object",
866
+ additionalProperties: false,
867
+ required: ["action", "docId"],
868
+ properties: {
869
+ action: { const: "get_sheet_properties" },
870
+ accountId: accountIdProperty,
871
+ docId: {
872
+ ...docIdProperty,
873
+ description: "在线表格 docid",
874
+ },
875
+ },
876
+ },
877
+ {
878
+ type: "object",
879
+ additionalProperties: false,
880
+ required: ["action", "docId", "request"],
881
+ properties: {
882
+ action: { const: "edit_sheet_data" },
883
+ accountId: accountIdProperty,
884
+ docId: {
885
+ ...docIdProperty,
886
+ description: "在线表格 docid",
887
+ },
888
+ request: {
889
+ type: "object",
890
+ description: "编辑表格请求体,按企业微信官方 edit_data 定义填写",
891
+ additionalProperties: true,
892
+ required: ["sheet_id", "range", "values"],
893
+ properties: {
894
+ sheet_id: { type: "string" },
895
+ range: { type: "string" },
896
+ values: {
897
+ type: "array",
898
+ items: {
899
+ type: "array",
900
+ items: {
901
+ type: "object",
902
+ properties: { text: { type: "string" }, url: { type: "string" } }
903
+ }
904
+ }
905
+ }
906
+ }
907
+ },
908
+ },
909
+ },
910
+ {
911
+ type: "object",
912
+ additionalProperties: false,
913
+ required: ["action", "docId", "sheetId", "range"],
914
+ properties: {
915
+ action: { const: "get_sheet_data" },
916
+ accountId: accountIdProperty,
917
+ docId: {
918
+ ...docIdProperty,
919
+ description: "在线表格 docid",
920
+ },
921
+ sheetId: {
922
+ type: "string",
923
+ minLength: 1,
924
+ description: "工作表 sheet_id",
925
+ },
926
+ range: {
927
+ type: "string",
928
+ minLength: 1,
929
+ description: "读取范围,如 A1:E10",
930
+ },
931
+ },
932
+ },
933
+ {
934
+ type: "object",
935
+ additionalProperties: false,
936
+ required: ["action", "docId", "requests"],
937
+ properties: {
938
+ action: { const: "modify_sheet_properties" },
939
+ accountId: accountIdProperty,
940
+ docId: {
941
+ ...docIdProperty,
942
+ description: "在线表格 docid",
943
+ },
944
+ requests: {
945
+ type: "array",
946
+ minItems: 1,
947
+ maxItems: 5,
948
+ description: "修改属性请求列表,必须遵循企业微信 modify_sheet_properties 定义",
949
+ items: {
950
+ type: "object",
951
+ oneOf: [
952
+ { required: ["add_sheet_request"], properties: { add_sheet_request: addSheetRequest } },
953
+ { required: ["update_range_request"], properties: { update_range_request: updateRangeRequest } },
954
+ { required: ["delete_dimension_request"], properties: { delete_dimension_request: deleteDimensionRequest } },
955
+ { required: ["delete_sheet_request"], properties: { delete_sheet_request: deleteSheetRequest } }
956
+ ]
957
+ }
958
+ },
959
+ },
960
+ },
961
+ {
962
+ type: "object",
963
+ additionalProperties: false,
964
+ required: ["action", "docId", "sheetId", "records"],
965
+ properties: {
966
+ action: { const: "smartsheet_add_records" },
967
+ accountId: accountIdProperty,
968
+ docId: docIdProperty,
969
+ sheetId: { type: "string", description: "子表 ID" },
970
+ records: { type: "array", items: nonEmptyObjectProperty, description: "记录列表" },
971
+ },
972
+ },
973
+ {
974
+ type: "object",
975
+ additionalProperties: false,
976
+ required: ["action", "docId", "sheetId", "records"],
977
+ properties: {
978
+ action: { const: "smartsheet_update_records" },
979
+ accountId: accountIdProperty,
980
+ docId: docIdProperty,
981
+ sheetId: { type: "string", description: "子表 ID" },
982
+ records: { type: "array", items: nonEmptyObjectProperty, description: "更新记录列表,需包含 record_id" },
983
+ },
984
+ },
985
+ {
986
+ type: "object",
987
+ additionalProperties: false,
988
+ required: ["action", "docId", "sheetId", "record_ids"],
989
+ properties: {
990
+ action: { const: "smartsheet_del_records" },
991
+ accountId: accountIdProperty,
992
+ docId: docIdProperty,
993
+ sheetId: { type: "string", description: "子表 ID" },
994
+ record_ids: { type: "array", items: { type: "string" }, description: "记录 ID 列表" },
995
+ },
996
+ },
997
+ {
998
+ type: "object",
999
+ additionalProperties: false,
1000
+ required: ["action", "docId", "sheetId"],
1001
+ properties: {
1002
+ action: { const: "smartsheet_get_records" },
1003
+ accountId: accountIdProperty,
1004
+ docId: docIdProperty,
1005
+ sheetId: { type: "string", description: "子表 ID" },
1006
+ record_ids: { type: "array", items: { type: "string" }, description: "可选:指定记录 ID 列表" },
1007
+ offset: { type: "integer" },
1008
+ limit: { type: "integer" },
1009
+ },
1010
+ },
1011
+ {
1012
+ type: "object",
1013
+ additionalProperties: false,
1014
+ required: ["action", "docId", "sheetId"],
1015
+ properties: {
1016
+ action: { const: "smartsheet_get_fields" },
1017
+ accountId: accountIdProperty,
1018
+ docId: docIdProperty,
1019
+ sheetId: { type: "string", description: "子表 ID" },
1020
+ view_id: { type: "string", description: "可选:视图 ID" },
1021
+ },
1022
+ },
1023
+ {
1024
+ type: "object",
1025
+ additionalProperties: false,
1026
+ required: ["action", "docId", "sheetId"],
1027
+ properties: {
1028
+ action: { const: "smartsheet_get_views" },
1029
+ accountId: accountIdProperty,
1030
+ docId: docIdProperty,
1031
+ sheetId: { type: "string", description: "子表 ID" },
1032
+ },
1033
+ },
1034
+ {
1035
+ type: "object",
1036
+ additionalProperties: false,
1037
+ required: ["action", "docId"],
1038
+ properties: {
1039
+ action: { const: "smartsheet_get_sheets" },
1040
+ accountId: accountIdProperty,
1041
+ docId: docIdProperty,
1042
+ },
1043
+ },
1044
+ {
1045
+ type: "object",
1046
+ additionalProperties: false,
1047
+ required: ["action", "docId", "title"],
1048
+ properties: {
1049
+ action: { const: "smartsheet_add_sheet" },
1050
+ accountId: accountIdProperty,
1051
+ docId: docIdProperty,
1052
+ title: { type: "string", description: "子表标题" },
1053
+ index: { type: "integer", description: "可选:子表位置索引" },
1054
+ },
1055
+ },
1056
+ {
1057
+ type: "object",
1058
+ additionalProperties: false,
1059
+ required: ["action", "docId", "sheetId"],
1060
+ properties: {
1061
+ action: { const: "smartsheet_del_sheet" },
1062
+ accountId: accountIdProperty,
1063
+ docId: docIdProperty,
1064
+ sheetId: sheetIdProperty,
1065
+ },
1066
+ },
1067
+ {
1068
+ type: "object",
1069
+ additionalProperties: false,
1070
+ required: ["action", "docId", "sheetId"],
1071
+ properties: {
1072
+ action: { const: "smartsheet_update_sheet" },
1073
+ accountId: accountIdProperty,
1074
+ docId: docIdProperty,
1075
+ sheetId: sheetIdProperty,
1076
+ title: { type: "string", description: "新标题" },
1077
+ },
1078
+ },
1079
+ {
1080
+ type: "object",
1081
+ additionalProperties: false,
1082
+ required: ["action", "docId", "sheetId", "view_title", "view_type"],
1083
+ properties: {
1084
+ action: { const: "smartsheet_add_view" },
1085
+ accountId: accountIdProperty,
1086
+ docId: docIdProperty,
1087
+ sheetId: sheetIdProperty,
1088
+ view_title: { type: "string", description: "视图标题" },
1089
+ view_type: {
1090
+ type: "string",
1091
+ enum: ["VIEW_TYPE_GRID", "VIEW_TYPE_KANBAN", "VIEW_TYPE_GALLERY", "VIEW_TYPE_GANTT", "VIEW_TYPE_CALENDAR"],
1092
+ description: "视图类型"
1093
+ },
1094
+ property_gantt: genericObjectProperty,
1095
+ property_calendar: genericObjectProperty,
1096
+ },
1097
+ },
1098
+ {
1099
+ type: "object",
1100
+ additionalProperties: false,
1101
+ required: ["action", "docId", "sheetId", "view_id"],
1102
+ properties: {
1103
+ action: { const: "smartsheet_update_view" },
1104
+ accountId: accountIdProperty,
1105
+ docId: docIdProperty,
1106
+ sheetId: sheetIdProperty,
1107
+ view_id: { type: "string", description: "视图 ID" },
1108
+ view_title: { type: "string", description: "视图标题" },
1109
+ property_gantt: genericObjectProperty,
1110
+ property_calendar: genericObjectProperty,
1111
+ },
1112
+ },
1113
+ {
1114
+ type: "object",
1115
+ additionalProperties: false,
1116
+ required: ["action", "docId", "sheetId", "view_ids"],
1117
+ properties: {
1118
+ action: { const: "smartsheet_del_view" },
1119
+ accountId: accountIdProperty,
1120
+ docId: docIdProperty,
1121
+ sheetId: sheetIdProperty,
1122
+ view_ids: { type: "array", items: { type: "string" }, description: "视图 ID 列表" },
1123
+ },
1124
+ },
1125
+ {
1126
+ type: "object",
1127
+ additionalProperties: false,
1128
+ required: ["action", "docId", "sheetId", "fields"],
1129
+ properties: {
1130
+ action: { const: "smartsheet_add_fields" },
1131
+ accountId: accountIdProperty,
1132
+ docId: docIdProperty,
1133
+ sheetId: sheetIdProperty,
1134
+ fields: {
1135
+ type: "array",
1136
+ items: nonEmptyObjectProperty,
1137
+ description: "要添加的字段列表,每项包含 field_title, field_type 等"
1138
+ },
1139
+ },
1140
+ },
1141
+ {
1142
+ type: "object",
1143
+ additionalProperties: false,
1144
+ required: ["action", "docId", "sheetId", "field_ids"],
1145
+ properties: {
1146
+ action: { const: "smartsheet_del_fields" },
1147
+ accountId: accountIdProperty,
1148
+ docId: docIdProperty,
1149
+ sheetId: sheetIdProperty,
1150
+ field_ids: { type: "array", items: { type: "string" }, description: "字段 ID 列表" },
1151
+ },
1152
+ },
1153
+ {
1154
+ type: "object",
1155
+ additionalProperties: false,
1156
+ required: ["action", "docId", "sheetId", "fields"],
1157
+ properties: {
1158
+ action: { const: "smartsheet_update_fields" },
1159
+ accountId: accountIdProperty,
1160
+ docId: docIdProperty,
1161
+ sheetId: sheetIdProperty,
1162
+ fields: {
1163
+ type: "array",
1164
+ items: nonEmptyObjectProperty,
1165
+ description: "要更新的字段列表,每项需包含 field_id"
1166
+ },
1167
+ },
1168
+ },
1169
+ {
1170
+ type: "object",
1171
+ additionalProperties: false,
1172
+ required: ["action", "docId", "sheetId", "name"],
1173
+ properties: {
1174
+ action: { const: "smartsheet_add_group" },
1175
+ accountId: accountIdProperty,
1176
+ docId: docIdProperty,
1177
+ sheetId: sheetIdProperty,
1178
+ name: { type: "string", description: "编组名称" },
1179
+ children: { type: "array", items: { type: "string" }, description: "字段 ID 列表" },
1180
+ },
1181
+ },
1182
+ {
1183
+ type: "object",
1184
+ additionalProperties: false,
1185
+ required: ["action", "docId", "sheetId", "field_group_id"],
1186
+ properties: {
1187
+ action: { const: "smartsheet_del_group" },
1188
+ accountId: accountIdProperty,
1189
+ docId: docIdProperty,
1190
+ sheetId: sheetIdProperty,
1191
+ field_group_id: { type: "string", description: "编组 ID" },
1192
+ },
1193
+ },
1194
+ {
1195
+ type: "object",
1196
+ additionalProperties: false,
1197
+ required: ["action", "docId", "sheetId", "field_group_id"],
1198
+ properties: {
1199
+ action: { const: "smartsheet_update_group" },
1200
+ accountId: accountIdProperty,
1201
+ docId: docIdProperty,
1202
+ sheetId: sheetIdProperty,
1203
+ field_group_id: { type: "string", description: "编组 ID" },
1204
+ name: { type: "string" },
1205
+ children: { type: "array", items: { type: "string" } },
1206
+ },
1207
+ },
1208
+ {
1209
+ type: "object",
1210
+ additionalProperties: false,
1211
+ required: ["action", "docId", "sheetId"],
1212
+ properties: {
1213
+ action: { const: "smartsheet_get_groups" },
1214
+ accountId: accountIdProperty,
1215
+ docId: docIdProperty,
1216
+ sheetId: sheetIdProperty,
1217
+ },
1218
+ },
1219
+ {
1220
+ type: "object",
1221
+ additionalProperties: false,
1222
+ required: ["action", "docId", "sheetId", "records"],
1223
+ properties: {
1224
+ action: { const: "smartsheet_add_external_records" },
1225
+ accountId: accountIdProperty,
1226
+ docId: docIdProperty,
1227
+ sheetId: sheetIdProperty,
1228
+ records: { type: "array", items: nonEmptyObjectProperty, description: "记录列表" },
1229
+ },
1230
+ },
1231
+ {
1232
+ type: "object",
1233
+ additionalProperties: false,
1234
+ required: ["action", "docId", "sheetId", "records"],
1235
+ properties: {
1236
+ action: { const: "smartsheet_update_external_records" },
1237
+ accountId: accountIdProperty,
1238
+ docId: docIdProperty,
1239
+ sheetId: sheetIdProperty,
1240
+ records: { type: "array", items: nonEmptyObjectProperty, description: "记录列表" },
1241
+ },
1242
+ },
1243
+ {
1244
+ type: "object",
1245
+ additionalProperties: false,
1246
+ required: ["action", "docId", "sheetId", "records"],
1247
+ properties: {
1248
+ action: { const: "smartsheet_add_records" },
1249
+ accountId: accountIdProperty,
1250
+ docId: docIdProperty,
1251
+ sheetId: { type: "string", description: "子表 ID" },
1252
+ records: { type: "array", items: nonEmptyObjectProperty, description: "记录列表" },
1253
+ },
1254
+ },
1255
+ {
1256
+ type: "object",
1257
+ additionalProperties: false,
1258
+ required: ["action", "docId", "sheetId", "records"],
1259
+ properties: {
1260
+ action: { const: "smartsheet_update_records" },
1261
+ accountId: accountIdProperty,
1262
+ docId: docIdProperty,
1263
+ sheetId: { type: "string", description: "子表 ID" },
1264
+ records: { type: "array", items: nonEmptyObjectProperty, description: "更新记录列表,需包含 record_id" },
1265
+ },
1266
+ },
1267
+ {
1268
+ type: "object",
1269
+ additionalProperties: false,
1270
+ required: ["action", "docId", "sheetId", "record_ids"],
1271
+ properties: {
1272
+ action: { const: "smartsheet_del_records" },
1273
+ accountId: accountIdProperty,
1274
+ docId: docIdProperty,
1275
+ sheetId: { type: "string", description: "子表 ID" },
1276
+ record_ids: { type: "array", items: { type: "string" }, description: "记录 ID 列表" },
1277
+ },
1278
+ },
1279
+ {
1280
+ type: "object",
1281
+ additionalProperties: false,
1282
+ required: ["action", "docId", "sheetId"],
1283
+ properties: {
1284
+ action: { const: "smartsheet_get_records" },
1285
+ accountId: accountIdProperty,
1286
+ docId: docIdProperty,
1287
+ sheetId: { type: "string", description: "子表 ID" },
1288
+ record_ids: { type: "array", items: { type: "string" }, description: "可选:指定记录 ID 列表" },
1289
+ offset: { type: "integer" },
1290
+ limit: { type: "integer" },
1291
+ },
1292
+ },
1293
+ {
1294
+ type: "object",
1295
+ additionalProperties: false,
1296
+ required: ["action", "docId", "type"],
1297
+ properties: {
1298
+ action: { const: "smartsheet_get_sheet_priv" },
1299
+ accountId: accountIdProperty,
1300
+ docId: docIdProperty,
1301
+ type: { type: "integer", enum: [1, 2], description: "规则类型:1-全员权限,2-额外权限" },
1302
+ rule_id_list: { type: "array", items: { type: "integer" }, description: "规则 ID 列表" },
1303
+ },
1304
+ },
1305
+ {
1306
+ type: "object",
1307
+ additionalProperties: false,
1308
+ required: ["action", "docId", "priv_list"],
1309
+ anyOf: [
1310
+ { required: ["rule_id"] },
1311
+ { required: ["name"] }
1312
+ ],
1313
+ properties: {
1314
+ action: { const: "smartsheet_update_sheet_priv" },
1315
+ accountId: accountIdProperty,
1316
+ docId: docIdProperty,
1317
+ type: { type: "integer", enum: [1, 2], const: 2, description: "必须为2 (额外权限) ? 或支持1? 文档update_sheet_priv支持更新全员(type=1)或额外(type=2)" },
1318
+ rule_id: { type: "integer" },
1319
+ name: { type: "string" },
1320
+ priv_list: privListSchema,
1321
+ },
1322
+ },
1323
+ {
1324
+ type: "object",
1325
+ additionalProperties: false,
1326
+ required: ["action", "docId", "name"],
1327
+ properties: {
1328
+ action: { const: "smartsheet_create_rule" },
1329
+ accountId: accountIdProperty,
1330
+ docId: docIdProperty,
1331
+ name: { type: "string", description: "权限规则名称" },
1332
+ },
1333
+ },
1334
+ {
1335
+ type: "object",
1336
+ additionalProperties: false,
1337
+ required: ["action", "docId", "rule_id"],
1338
+ properties: {
1339
+ action: { const: "smartsheet_mod_rule_member" },
1340
+ accountId: accountIdProperty,
1341
+ docId: docIdProperty,
1342
+ rule_id: { type: "integer" },
1343
+ add_member_range: memberRangeSchema,
1344
+ del_member_range: memberRangeSchema
1345
+ },
1346
+ },
1347
+ {
1348
+ type: "object",
1349
+ additionalProperties: false,
1350
+ required: ["action", "docId", "rule_id_list"],
1351
+ properties: {
1352
+ action: { const: "smartsheet_delete_rule" },
1353
+ accountId: accountIdProperty,
1354
+ docId: docIdProperty,
1355
+ rule_id_list: { type: "array", items: { type: "integer" }, description: "规则 ID 列表" },
1356
+ },
1357
+ },
1358
+ {
1359
+ type: "object",
1360
+ additionalProperties: false,
1361
+ required: ["action", "userid_list"],
1362
+ properties: {
1363
+ action: { const: "doc_assign_advanced_account" },
1364
+ accountId: accountIdProperty,
1365
+ userid_list: { type: "array", items: { type: "string" }, description: "成员 ID 列表" },
1366
+ },
1367
+ },
1368
+ {
1369
+ type: "object",
1370
+ additionalProperties: false,
1371
+ required: ["action", "userid_list"],
1372
+ properties: {
1373
+ action: { const: "doc_cancel_advanced_account" },
1374
+ accountId: accountIdProperty,
1375
+ userid_list: { type: "array", items: { type: "string" }, description: "成员 ID 列表" },
1376
+ },
1377
+ },
1378
+ {
1379
+ type: "object",
1380
+ additionalProperties: false,
1381
+ required: ["action"],
1382
+ properties: {
1383
+ action: { const: "doc_get_advanced_account_list" },
1384
+ accountId: accountIdProperty,
1385
+ offset: { type: "integer" },
1386
+ limit: { type: "integer" },
1387
+ },
1388
+ },
1389
+ {
1390
+ type: "object",
1391
+ additionalProperties: false,
1392
+ required: ["action", "file_path", "docId"],
1393
+ properties: {
1394
+ action: { const: "upload_doc_image" },
1395
+ accountId: accountIdProperty,
1396
+ docId: {
1397
+ ...docIdProperty,
1398
+ description: "文档 docid,上传图片需要关联文档",
1399
+ },
1400
+ file_path: { type: "string", description: "本地图片路径" },
1401
+ },
1402
+ },
1403
+ ],
1404
+ } as const;