weaver-work-cli 0.1.2 → 0.1.5

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 (405) hide show
  1. package/README.md +176 -78
  2. package/dist/cmd/setup/index.js +5 -5
  3. package/dist/cmd/skills/index.js +1 -1
  4. package/dist/core/hooks.js +7 -0
  5. package/dist/index.js +0 -0
  6. package/dist/internal/e10/auth/commands.js +159 -54
  7. package/dist/internal/e10/auth/xiaoe.js +268 -0
  8. package/dist/internal/e10/context.js +16 -2
  9. package/dist/internal/e10/index.js +1 -0
  10. package/dist/internal/e10/request-runtime.js +345 -0
  11. package/dist/internal/skills/install.js +48 -6
  12. package/dist/internal/skills/reader.js +27 -0
  13. package/dist/shortcuts/archive/continuation.js +70 -0
  14. package/dist/shortcuts/archive/errors.js +53 -0
  15. package/dist/shortcuts/archive/host.js +197 -0
  16. package/dist/shortcuts/archive/index.js +363 -0
  17. package/dist/shortcuts/archive/manifest.js +45 -0
  18. package/dist/shortcuts/archive/operations/archive-info.js +55 -0
  19. package/dist/shortcuts/archive/operations/borrow-car.js +146 -0
  20. package/dist/shortcuts/archive/operations/borrow-list.js +200 -0
  21. package/dist/shortcuts/archive/operations/confirm.js +46 -0
  22. package/dist/shortcuts/archive/operations/download.js +238 -0
  23. package/dist/shortcuts/archive/operations/flow-url.js +240 -0
  24. package/dist/shortcuts/archive/operations/fonds.js +95 -0
  25. package/dist/shortcuts/archive/operations/getPageUrl.js +137 -0
  26. package/dist/shortcuts/archive/operations/registry.js +43 -0
  27. package/dist/shortcuts/archive/operations/search.js +88 -0
  28. package/dist/shortcuts/archive/operations/shared.js +120 -0
  29. package/dist/shortcuts/archive/operations/types.js +23 -0
  30. package/dist/shortcuts/archive/operations/upload.js +182 -0
  31. package/dist/shortcuts/archive/operations.js +13 -0
  32. package/dist/shortcuts/archive/render/search-format.js +276 -0
  33. package/dist/shortcuts/archive/render/search-view.js +125 -0
  34. package/dist/shortcuts/asset/continuation.js +70 -0
  35. package/dist/shortcuts/asset/errors.js +67 -0
  36. package/dist/shortcuts/asset/host.js +438 -0
  37. package/dist/shortcuts/asset/index.js +255 -0
  38. package/dist/shortcuts/asset/manifest.js +471 -0
  39. package/dist/shortcuts/asset/operations/query.js +249 -0
  40. package/dist/shortcuts/asset/operations/registry.js +85 -0
  41. package/dist/shortcuts/asset/operations/shared.js +100 -0
  42. package/dist/shortcuts/asset/operations/type-cache.js +49 -0
  43. package/dist/shortcuts/asset/operations/types.js +1 -0
  44. package/dist/shortcuts/asset/operations/viewlink.js +117 -0
  45. package/dist/shortcuts/asset/operations/write.js +435 -0
  46. package/dist/shortcuts/asset/operations.js +9 -0
  47. package/dist/shortcuts/calendar/continuation.js +70 -0
  48. package/dist/shortcuts/calendar/errors.js +53 -0
  49. package/dist/shortcuts/calendar/host.js +148 -0
  50. package/dist/shortcuts/calendar/index.js +125 -0
  51. package/dist/shortcuts/calendar/manifest.js +26 -0
  52. package/dist/shortcuts/calendar/operations/read.js +259 -0
  53. package/dist/shortcuts/calendar/operations/registry.js +31 -0
  54. package/dist/shortcuts/calendar/operations/shared.js +132 -0
  55. package/dist/shortcuts/calendar/operations/types.js +25 -0
  56. package/dist/shortcuts/calendar/operations/write.js +439 -0
  57. package/dist/shortcuts/calendar/operations.js +8 -0
  58. package/dist/shortcuts/ehr/continuation.js +70 -0
  59. package/dist/shortcuts/ehr/errors.js +53 -0
  60. package/dist/shortcuts/ehr/host.js +213 -0
  61. package/dist/shortcuts/ehr/index.js +205 -0
  62. package/dist/shortcuts/ehr/manifest.js +47 -0
  63. package/dist/shortcuts/ehr/operations/attend-read.js +373 -0
  64. package/dist/shortcuts/ehr/operations/attend-write.js +514 -0
  65. package/dist/shortcuts/ehr/operations/hr-contact.js +363 -0
  66. package/dist/shortcuts/ehr/operations/hr-ds.js +298 -0
  67. package/dist/shortcuts/ehr/operations/hr-report.js +386 -0
  68. package/dist/shortcuts/ehr/operations/recruit-write.js +1629 -0
  69. package/dist/shortcuts/ehr/operations/recruit.js +803 -0
  70. package/dist/shortcuts/ehr/operations/registry.js +43 -0
  71. package/dist/shortcuts/ehr/operations/salary.js +319 -0
  72. package/dist/shortcuts/ehr/operations/shared.js +246 -0
  73. package/dist/shortcuts/ehr/operations/types.js +25 -0
  74. package/dist/shortcuts/ehr/operations.js +25 -0
  75. package/dist/shortcuts/esb/continuation.js +70 -0
  76. package/dist/shortcuts/esb/errors.js +65 -0
  77. package/dist/shortcuts/esb/host.js +187 -0
  78. package/dist/shortcuts/esb/index.js +112 -0
  79. package/dist/shortcuts/esb/manifest.js +91 -0
  80. package/dist/shortcuts/esb/operations/input-format.js +31 -0
  81. package/dist/shortcuts/esb/operations/registry.js +48 -0
  82. package/dist/shortcuts/esb/operations/shared.js +152 -0
  83. package/dist/shortcuts/esb/operations/trigger.js +76 -0
  84. package/dist/shortcuts/esb/operations/types.js +21 -0
  85. package/dist/shortcuts/esb/operations.js +15 -0
  86. package/dist/shortcuts/fna/continuation.js +70 -0
  87. package/dist/shortcuts/fna/errors.js +59 -0
  88. package/dist/shortcuts/fna/host.js +146 -0
  89. package/dist/shortcuts/fna/index.js +111 -0
  90. package/dist/shortcuts/fna/manifest.js +41 -0
  91. package/dist/shortcuts/fna/operations/budget.js +124 -0
  92. package/dist/shortcuts/fna/operations/expense-center.js +148 -0
  93. package/dist/shortcuts/fna/operations/invoice-writeoff.js +212 -0
  94. package/dist/shortcuts/fna/operations/loan.js +195 -0
  95. package/dist/shortcuts/fna/operations/registry.js +35 -0
  96. package/dist/shortcuts/fna/operations/shared.js +210 -0
  97. package/dist/shortcuts/fna/operations/types.js +25 -0
  98. package/dist/shortcuts/fna/operations.js +19 -0
  99. package/dist/shortcuts/hrm/errors.js +38 -0
  100. package/dist/shortcuts/hrm/host.js +156 -0
  101. package/dist/shortcuts/hrm/index.js +111 -0
  102. package/dist/shortcuts/hrm/manifest.js +32 -0
  103. package/dist/shortcuts/hrm/operations/employee.js +338 -0
  104. package/dist/shortcuts/hrm/operations/org.js +110 -0
  105. package/dist/shortcuts/hrm/operations/position.js +176 -0
  106. package/dist/shortcuts/hrm/operations/registry.js +33 -0
  107. package/dist/shortcuts/hrm/operations/shared.js +143 -0
  108. package/dist/shortcuts/hrm/operations/types.js +23 -0
  109. package/dist/shortcuts/hrm/operations.js +19 -0
  110. package/dist/shortcuts/index.js +24 -0
  111. package/dist/shortcuts/invoice/host.js +99 -94
  112. package/dist/shortcuts/invoice/index.js +58 -59
  113. package/dist/shortcuts/invoice/manifest.js +200 -3
  114. package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
  115. package/dist/shortcuts/invoice/operations/issuing.js +198 -0
  116. package/dist/shortcuts/invoice/operations/registry.js +17 -0
  117. package/dist/shortcuts/invoice/operations/reim.js +401 -0
  118. package/dist/shortcuts/invoice/operations/shared.js +247 -0
  119. package/dist/shortcuts/jiuchuanhui/cache.js +441 -0
  120. package/dist/shortcuts/jiuchuanhui/continuation.js +70 -0
  121. package/dist/shortcuts/jiuchuanhui/errors.js +59 -0
  122. package/dist/shortcuts/jiuchuanhui/host.js +159 -0
  123. package/dist/shortcuts/jiuchuanhui/index.js +109 -0
  124. package/dist/shortcuts/jiuchuanhui/manifest.js +469 -0
  125. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +214 -0
  126. package/dist/shortcuts/jiuchuanhui/operations/esb.js +157 -0
  127. package/dist/shortcuts/jiuchuanhui/operations/generic.js +146 -0
  128. package/dist/shortcuts/jiuchuanhui/operations/registry.js +133 -0
  129. package/dist/shortcuts/jiuchuanhui/operations/shared.js +158 -0
  130. package/dist/shortcuts/jiuchuanhui/operations/types.js +1 -0
  131. package/dist/shortcuts/jiuchuanhui/operations.js +8 -0
  132. package/dist/shortcuts/mail/continuation.js +70 -0
  133. package/dist/shortcuts/mail/errors.js +53 -0
  134. package/dist/shortcuts/mail/host.js +182 -0
  135. package/dist/shortcuts/mail/index.js +519 -0
  136. package/dist/shortcuts/mail/manifest.js +38 -0
  137. package/dist/shortcuts/mail/operations/mail-blacklist.js +79 -0
  138. package/dist/shortcuts/mail/operations/mail-contacts.js +195 -0
  139. package/dist/shortcuts/mail/operations/mail-manage.js +335 -0
  140. package/dist/shortcuts/mail/operations/mail-read.js +508 -0
  141. package/dist/shortcuts/mail/operations/mail-send.js +474 -0
  142. package/dist/shortcuts/mail/operations/mail-sign.js +203 -0
  143. package/dist/shortcuts/mail/operations/mail-template.js +170 -0
  144. package/dist/shortcuts/mail/operations/registry.js +41 -0
  145. package/dist/shortcuts/mail/operations/shared.js +64 -0
  146. package/dist/shortcuts/mail/operations/types.js +27 -0
  147. package/dist/shortcuts/mail/operations.js +19 -0
  148. package/dist/shortcuts/meeting/continuation.js +70 -0
  149. package/dist/shortcuts/meeting/errors.js +63 -0
  150. package/dist/shortcuts/meeting/host.js +167 -0
  151. package/dist/shortcuts/meeting/index.js +123 -0
  152. package/dist/shortcuts/meeting/manifest.js +64 -0
  153. package/dist/shortcuts/meeting/operations/catalogs.js +58 -0
  154. package/dist/shortcuts/meeting/operations/change.js +242 -0
  155. package/dist/shortcuts/meeting/operations/conflicts.js +142 -0
  156. package/dist/shortcuts/meeting/operations/create.js +349 -0
  157. package/dist/shortcuts/meeting/operations/env.js +191 -0
  158. package/dist/shortcuts/meeting/operations/lifecycle.js +139 -0
  159. package/dist/shortcuts/meeting/operations/meetings.js +73 -0
  160. package/dist/shortcuts/meeting/operations/receipts.js +195 -0
  161. package/dist/shortcuts/meeting/operations/registry.js +47 -0
  162. package/dist/shortcuts/meeting/operations/rooms.js +132 -0
  163. package/dist/shortcuts/meeting/operations/shared.js +112 -0
  164. package/dist/shortcuts/meeting/operations/signs.js +41 -0
  165. package/dist/shortcuts/meeting/operations/types.js +25 -0
  166. package/dist/shortcuts/meeting/operations.js +19 -0
  167. package/dist/shortcuts/plan/continuation.js +70 -0
  168. package/dist/shortcuts/plan/errors.js +70 -0
  169. package/dist/shortcuts/plan/host.js +180 -0
  170. package/dist/shortcuts/plan/index.js +150 -0
  171. package/dist/shortcuts/plan/manifest.js +53 -0
  172. package/dist/shortcuts/plan/operations/link.js +256 -0
  173. package/dist/shortcuts/plan/operations/read.js +259 -0
  174. package/dist/shortcuts/plan/operations/registry.js +33 -0
  175. package/dist/shortcuts/plan/operations/shared.js +246 -0
  176. package/dist/shortcuts/plan/operations/types.js +49 -0
  177. package/dist/shortcuts/plan/operations/version.js +49 -0
  178. package/dist/shortcuts/plan/operations/write.js +710 -0
  179. package/dist/shortcuts/plan/operations.js +8 -0
  180. package/dist/shortcuts/yimiaoban/continuation.js +70 -0
  181. package/dist/shortcuts/yimiaoban/errors.js +61 -0
  182. package/dist/shortcuts/yimiaoban/host.js +469 -0
  183. package/dist/shortcuts/yimiaoban/index.js +271 -0
  184. package/dist/shortcuts/yimiaoban/manifest.js +28 -0
  185. package/dist/shortcuts/yimiaoban/operations/file-user.js +288 -0
  186. package/dist/shortcuts/yimiaoban/operations/group-read.js +477 -0
  187. package/dist/shortcuts/yimiaoban/operations/group-write.js +591 -0
  188. package/dist/shortcuts/yimiaoban/operations/msg-parse.js +429 -0
  189. package/dist/shortcuts/yimiaoban/operations/msg-sync.js +519 -0
  190. package/dist/shortcuts/yimiaoban/operations/msg-write.js +593 -0
  191. package/dist/shortcuts/yimiaoban/operations/person.js +102 -0
  192. package/dist/shortcuts/yimiaoban/operations/registry.js +38 -0
  193. package/dist/shortcuts/yimiaoban/operations/session.js +437 -0
  194. package/dist/shortcuts/yimiaoban/operations/shared.js +236 -0
  195. package/dist/shortcuts/yimiaoban/operations/types.js +27 -0
  196. package/dist/shortcuts/yimiaoban/operations/write-util.js +78 -0
  197. package/dist/shortcuts/yimiaoban/operations.js +8 -0
  198. package/docs/SKILL.md +11 -7
  199. package/docs/_catalog.md +28 -5
  200. package/docs/agent-invoice.md +19 -9
  201. package/docs/agent-skill-install.md +141 -22
  202. package/docs/calendar.md +87 -0
  203. package/docs/e10-auth.md +28 -9
  204. package/docs/ehr.md +186 -0
  205. package/docs/esb.md +64 -0
  206. package/docs/fna.md +72 -0
  207. package/docs/hrm.md +89 -0
  208. package/docs/invoice.md +61 -20
  209. package/docs/jiuchuanhui.md +131 -0
  210. package/docs/meeting.md +48 -0
  211. package/docs/operation-manual.md +443 -0
  212. package/docs/plan.md +82 -0
  213. package/docs/wenshuding.md +129 -0
  214. package/docs/yimiaoban.md +86 -0
  215. package/docs/ziguanjia.md +89 -0
  216. package/package.json +4 -4
  217. package/scripts/package-skill.mjs +127 -34
  218. package/scripts/postbuild.mjs +13 -0
  219. package/skill-template/business-info.json +16 -2
  220. package/skill-template/domains/calendar.md +15 -0
  221. package/skill-template/domains/esb.md +13 -0
  222. package/skill-template/domains/hrm.md +16 -0
  223. package/skill-template/domains/jiuchuanhui.md +23 -0
  224. package/skill-template/domains/jucailin.md +22 -0
  225. package/skill-template/domains/mail.md +21 -0
  226. package/skill-template/domains/meeting.md +3 -0
  227. package/skill-template/domains/plan.md +17 -0
  228. package/skill-template/domains/qiyecheng.md +17 -0
  229. package/skill-template/domains/shared.md +5 -3
  230. package/skill-template/domains/skill-maker.md +10 -0
  231. package/skill-template/domains/wenshuding.md +22 -0
  232. package/skill-template/domains/{invoice.md → yepiaotong.md} +4 -0
  233. package/skill-template/domains/yimiaoban.md +21 -0
  234. package/skill-template/domains/ziguanjia.md +21 -0
  235. package/skill-template/master-skill-template.md +12 -6
  236. package/skill-template/skill-template.md +26 -10
  237. package/skills/weaver-e10-calendar/SKILL.md +102 -0
  238. package/skills/weaver-e10-calendar/product.json +8 -0
  239. package/skills/weaver-e10-calendar/references/calendar-app-check.md +65 -0
  240. package/skills/weaver-e10-calendar/references/calendar-dict.md +55 -0
  241. package/skills/weaver-e10-calendar/references/calendar-query.md +70 -0
  242. package/skills/weaver-e10-calendar/references/calendar-write.md +97 -0
  243. package/skills/weaver-e10-calendar/references/source-manifest.json +54 -0
  244. package/skills/weaver-e10-esb/SKILL.md +103 -0
  245. package/skills/weaver-e10-esb/product.json +8 -0
  246. package/skills/weaver-e10-esb/references/input-format.md +52 -0
  247. package/skills/weaver-e10-esb/references/source-manifest.json +242 -0
  248. package/skills/weaver-e10-esb/references/trigger.md +99 -0
  249. package/skills/weaver-e10-hrm/SKILL.md +88 -0
  250. package/skills/weaver-e10-hrm/product.json +8 -0
  251. package/skills/weaver-e10-hrm/references/employee.md +109 -0
  252. package/skills/weaver-e10-hrm/references/org.md +95 -0
  253. package/skills/weaver-e10-hrm/references/position.md +95 -0
  254. package/skills/weaver-e10-hrm/references/source-manifest.json +121 -0
  255. package/skills/weaver-e10-jiuchuanhui/SKILL.md +175 -0
  256. package/skills/weaver-e10-jiuchuanhui/product.json +8 -0
  257. package/skills/weaver-e10-jiuchuanhui/references/cache.md +110 -0
  258. package/skills/weaver-e10-jiuchuanhui/references/clue.md +61 -0
  259. package/skills/weaver-e10-jiuchuanhui/references/contact-plan.md +56 -0
  260. package/skills/weaver-e10-jiuchuanhui/references/contact-records.md +48 -0
  261. package/skills/weaver-e10-jiuchuanhui/references/contact.md +56 -0
  262. package/skills/weaver-e10-jiuchuanhui/references/customer.md +69 -0
  263. package/skills/weaver-e10-jiuchuanhui/references/disabled-capabilities.md +24 -0
  264. package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +60 -0
  265. package/skills/weaver-e10-jiuchuanhui/references/general-helpers.md +59 -0
  266. package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +60 -0
  267. package/skills/weaver-e10-jiuchuanhui/references/sale.md +72 -0
  268. package/skills/weaver-e10-jiuchuanhui/references/source-manifest.json +2632 -0
  269. package/skills/weaver-e10-jucailin/SKILL.md +102 -0
  270. package/skills/weaver-e10-jucailin/product.json +8 -0
  271. package/skills/weaver-e10-jucailin/references/attend-read.md +73 -0
  272. package/skills/weaver-e10-jucailin/references/attend-write.md +82 -0
  273. package/skills/weaver-e10-jucailin/references/hr-contact.md +92 -0
  274. package/skills/weaver-e10-jucailin/references/hr-datasource.md +104 -0
  275. package/skills/weaver-e10-jucailin/references/hr-report.md +76 -0
  276. package/skills/weaver-e10-jucailin/references/recruit-read.md +76 -0
  277. package/skills/weaver-e10-jucailin/references/recruit-write.md +70 -0
  278. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +35 -0
  279. package/skills/weaver-e10-jucailin/references/salary.md +110 -0
  280. package/skills/weaver-e10-jucailin/references/source-manifest.json +152 -0
  281. package/skills/weaver-e10-mail/SKILL.md +152 -0
  282. package/skills/weaver-e10-mail/product.json +8 -0
  283. package/skills/weaver-e10-mail/references/mail-agent-entry.md +47 -0
  284. package/skills/weaver-e10-mail/references/mail-attachment.md +30 -0
  285. package/skills/weaver-e10-mail/references/mail-blacklist.md +27 -0
  286. package/skills/weaver-e10-mail/references/mail-contacts.md +33 -0
  287. package/skills/weaver-e10-mail/references/mail-manage.md +44 -0
  288. package/skills/weaver-e10-mail/references/mail-read.md +76 -0
  289. package/skills/weaver-e10-mail/references/mail-send.md +43 -0
  290. package/skills/weaver-e10-mail/references/mail-sign.md +33 -0
  291. package/skills/weaver-e10-mail/references/mail-template.md +31 -0
  292. package/skills/weaver-e10-mail/references/safety-boundaries.md +32 -0
  293. package/skills/weaver-e10-meeting/SKILL.md +106 -0
  294. package/skills/weaver-e10-meeting/product.json +8 -0
  295. package/skills/weaver-e10-meeting/references/meeting-change.md +67 -0
  296. package/skills/weaver-e10-meeting/references/meeting-create.md +52 -0
  297. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +57 -0
  298. package/skills/weaver-e10-meeting/references/meeting-queries.md +61 -0
  299. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +48 -0
  300. package/skills/weaver-e10-meeting/references/meeting-update.md +7 -0
  301. package/skills/weaver-e10-meeting/references/source-manifest.json +50 -0
  302. package/skills/weaver-e10-plan/SKILL.md +140 -0
  303. package/skills/weaver-e10-plan/product.json +8 -0
  304. package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +123 -0
  305. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +138 -0
  306. package/skills/weaver-e10-plan/references/plan-report-query.md +154 -0
  307. package/skills/weaver-e10-plan/references/plan-report-remind.md +104 -0
  308. package/skills/weaver-e10-plan/references/plan-report-write.md +162 -0
  309. package/skills/weaver-e10-plan/references/source-manifest.json +858 -0
  310. package/skills/weaver-e10-qiyecheng/SKILL.md +119 -0
  311. package/skills/weaver-e10-qiyecheng/product.json +8 -0
  312. package/skills/weaver-e10-qiyecheng/references/budget.md +65 -0
  313. package/skills/weaver-e10-qiyecheng/references/catalog.md +56 -0
  314. package/skills/weaver-e10-qiyecheng/references/expense-center.md +51 -0
  315. package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +57 -0
  316. package/skills/weaver-e10-qiyecheng/references/loan-management.md +59 -0
  317. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +698 -0
  318. package/skills/weaver-e10-shared/SKILL.md +90 -0
  319. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
  320. package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/json-output-contract.md +34 -0
  321. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
  322. package/skills/weaver-e10-skill-maker/SKILL.md +78 -0
  323. package/skills/weaver-e10-skill-maker/product.json +8 -0
  324. package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +124 -0
  325. package/skills/weaver-e10-skill-maker/references/detector-validation.md +101 -0
  326. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +230 -0
  327. package/skills/weaver-e10-skill-maker/references/post-generation-install.md +105 -0
  328. package/skills/weaver-e10-skill-maker/references/source-update-detection.md +261 -0
  329. package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +141 -0
  330. package/skills/weaver-e10-wenshuding/SKILL.md +158 -0
  331. package/skills/weaver-e10-wenshuding/product.json +8 -0
  332. package/skills/weaver-e10-wenshuding/references/archive-agent-entry.md +63 -0
  333. package/skills/weaver-e10-wenshuding/references/archive-borrow-car.md +52 -0
  334. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +52 -0
  335. package/skills/weaver-e10-wenshuding/references/archive-disabled-capabilities.md +22 -0
  336. package/skills/weaver-e10-wenshuding/references/archive-download.md +48 -0
  337. package/skills/weaver-e10-wenshuding/references/archive-flow.md +46 -0
  338. package/skills/weaver-e10-wenshuding/references/archive-fonds.md +34 -0
  339. package/skills/weaver-e10-wenshuding/references/archive-info.md +33 -0
  340. package/skills/weaver-e10-wenshuding/references/archive-search.md +52 -0
  341. package/skills/weaver-e10-wenshuding/references/archive-upload.md +41 -0
  342. package/skills/weaver-e10-wenshuding/references/source-manifest.json +517 -0
  343. package/skills/weaver-e10-yepiaotong/SKILL.md +184 -0
  344. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-add.md +1 -1
  345. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-agent-entry.md +16 -9
  346. package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +204 -0
  347. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-delete.md +1 -1
  348. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-detail.md +13 -5
  349. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +28 -0
  350. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-download.md +9 -2
  351. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-enterprise-list.md +12 -4
  352. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +9 -2
  353. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-import.md +16 -7
  354. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +120 -0
  355. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +161 -0
  356. package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +99 -0
  357. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-ocr-preview.md +12 -4
  358. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-personal-list.md +12 -4
  359. package/skills/weaver-e10-yepiaotong/references/invoice-red.md +261 -0
  360. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +97 -0
  361. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-update.md +1 -1
  362. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-validation-preview.md +9 -2
  363. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1340 -0
  364. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +845 -0
  365. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +94 -0
  366. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +449 -0
  367. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +266 -0
  368. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +494 -0
  369. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +1103 -0
  370. package/skills/weaver-e10-yimiaoban/SKILL.md +104 -0
  371. package/skills/weaver-e10-yimiaoban/product.json +8 -0
  372. package/skills/weaver-e10-yimiaoban/references/ding-write.md +68 -0
  373. package/skills/weaver-e10-yimiaoban/references/error-codes.md +85 -0
  374. package/skills/weaver-e10-yimiaoban/references/field-resolution.md +46 -0
  375. package/skills/weaver-e10-yimiaoban/references/file-user-i18n.md +54 -0
  376. package/skills/weaver-e10-yimiaoban/references/group-read.md +55 -0
  377. package/skills/weaver-e10-yimiaoban/references/group-write.md +72 -0
  378. package/skills/weaver-e10-yimiaoban/references/msg-read.md +59 -0
  379. package/skills/weaver-e10-yimiaoban/references/msg-write.md +64 -0
  380. package/skills/weaver-e10-yimiaoban/references/person.md +44 -0
  381. package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +61 -0
  382. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +47 -0
  383. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +485 -0
  384. package/skills/weaver-e10-ziguanjia/SKILL.md +163 -0
  385. package/skills/weaver-e10-ziguanjia/product.json +8 -0
  386. package/skills/weaver-e10-ziguanjia/references/source-manifest.json +147 -0
  387. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +65 -0
  388. package/skills/weaver-e10-ziguanjia/references/ziguanjia-create.md +45 -0
  389. package/skills/weaver-e10-ziguanjia/references/ziguanjia-depre.md +48 -0
  390. package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +22 -0
  391. package/skills/weaver-e10-ziguanjia/references/ziguanjia-purch.md +57 -0
  392. package/skills/weaver-e10-ziguanjia/references/ziguanjia-query.md +62 -0
  393. package/skills/weaver-e10-ziguanjia/references/ziguanjia-repair.md +83 -0
  394. package/skills/weaver-e10-ziguanjia/references/ziguanjia-resolve.md +49 -0
  395. package/skills/weaver-e10-ziguanjia/references/ziguanjia-return.md +70 -0
  396. package/skills/weaver-e10-ziguanjia/references/ziguanjia-update.md +45 -0
  397. package/skills/weaver-e10-ziguanjia/references/ziguanjia-use.md +60 -0
  398. package/skills/weaver-e10-ziguanjia/references/ziguanjia-viewlink.md +81 -0
  399. package/skills/weaver-work-cli-invoice/SKILL.md +0 -122
  400. package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
  401. package/skills/weaver-work-cli-shared/SKILL.md +0 -63
  402. package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -90
  403. package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -73
  404. /package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/high-risk-write.md +0 -0
  405. /package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/product.json +0 -0
@@ -0,0 +1,363 @@
1
+ import { ehrValidationError } from '../errors.js';
2
+ import { READ, SCHEMA_DATE, SCHEMA_ID, SCHEMA_ID_LIST, ehrSuccess, schemaOf, } from './types.js';
3
+ import { assertDateRange, assertEnum, compact, normalizePaged, pickDefined, toIdList, toNumber, toPositiveInt, } from './shared.js';
4
+ const BROWSER_TYPES = ['department', 'subcompany', 'position', 'resource', 'jobsetid', 'grade'];
5
+ const USERNAME_OPERATORS = ['in', 'notIn', 'eq', 'notEq'];
6
+ const PERSONNEL_STATUS = ['all', 'normal', '1', '2', '3', '4', '5', '6', '7', '9', '10'];
7
+ const CHANGE_TYPES = [
8
+ 'trial',
9
+ 'hire',
10
+ 'extend',
11
+ 'redeploy',
12
+ 'dismiss',
13
+ 'retire',
14
+ 'quit',
15
+ 'rehire',
16
+ 'custom',
17
+ ];
18
+ const CHANGE_STATUSES = ['ineffective', 'effective', 'disuse'];
19
+ const pageSchema = { current: SCHEMA_ID, pageSize: SCHEMA_ID };
20
+ /**
21
+ * 通讯录高级搜索条件(saCondition)。
22
+ * 结构由 /api/bs/hr/contact/main/sa 动态返回,此处不固化字段集合,
23
+ * 只要求「对象 -> 条件对象数组」的形状。
24
+ */
25
+ function normalizeSaCondition(value) {
26
+ if (!value || typeof value !== 'object' || Array.isArray(value))
27
+ return undefined;
28
+ const result = {};
29
+ for (const [key, list] of Object.entries(value)) {
30
+ if (!Array.isArray(list)) {
31
+ throw ehrValidationError('sa_condition_invalid', `saCondition.${key} 必须是条件对象数组`);
32
+ }
33
+ result[key] = list;
34
+ }
35
+ return Object.keys(result).length > 0 ? result : undefined;
36
+ }
37
+ function buildSaCondition(args) {
38
+ const explicit = normalizeSaCondition(args.saCondition);
39
+ if (explicit)
40
+ return explicit;
41
+ const sa = {};
42
+ if (args.username) {
43
+ // 姓名必须按「数组包对象」结构传并带条件操作符,扁平传文本会返回 500。
44
+ const operator = args.usernameOperator
45
+ ? assertEnum(args.usernameOperator, USERNAME_OPERATORS, 'usernameOperator')
46
+ : 'in';
47
+ sa.username = [{ username_condition: operator, username: args.username }];
48
+ }
49
+ if (args.jobNum) {
50
+ sa.job_num = [{ job_num_condition: 'in', job_num: args.jobNum }];
51
+ }
52
+ if (args.sex) {
53
+ sa.sex = [{ sex: assertEnum(args.sex, ['all', 'male', 'female'], 'sex') }];
54
+ }
55
+ // 通讯录默认只查在职,这是与 empchange(默认含离职)相反的关键差异。
56
+ const status = Array.isArray(args.personnelStatus) ? args.personnelStatus : ['normal'];
57
+ for (const item of status)
58
+ assertEnum(item, PERSONNEL_STATUS, 'personnelStatus');
59
+ sa.personnel_status = [{ personnel_status: status }];
60
+ return sa;
61
+ }
62
+ const contactFields = {
63
+ name: 'ehr.hr.contact.fields',
64
+ resource: 'hr',
65
+ method: 'contact.fields',
66
+ action: 'ehr.hr.contact.fields',
67
+ summary: '获取通讯录全部可展示字段及 key(按基本信息/个人信息/账号信息分组),是 contact.search 的前置步骤',
68
+ capability: 'hr',
69
+ risk: READ,
70
+ inputSchema: schemaOf({}),
71
+ handler: async (_args, { host }) => {
72
+ const response = await host.request({
73
+ method: 'POST',
74
+ path: '/api/bs/hr/contact/col/list',
75
+ body: { formEnable: true },
76
+ });
77
+ return ehrSuccess('ehr.hr.contact.fields', normalizePaged(response).data);
78
+ },
79
+ };
80
+ const contactSa = {
81
+ name: 'ehr.hr.contact.sa',
82
+ resource: 'hr',
83
+ method: 'contact.sa',
84
+ action: 'ehr.hr.contact.sa',
85
+ summary: '获取通讯录高级搜索条件定义与可选项,用于确认 saCondition 的字段 id、itemType 与 browserBean.type',
86
+ capability: 'hr',
87
+ risk: READ,
88
+ inputSchema: schemaOf({}),
89
+ handler: async (_args, { host }) => {
90
+ const response = await host.request({
91
+ method: 'POST',
92
+ path: '/api/bs/hr/contact/main/sa',
93
+ body: { formEnable: true },
94
+ });
95
+ return ehrSuccess('ehr.hr.contact.sa', normalizePaged(response).data);
96
+ },
97
+ };
98
+ const contactSearchProperties = {
99
+ username: { type: 'string', description: '姓名,按「包含」模糊匹配;重名返回多条时必须让用户选择,不得自动取第一条' },
100
+ usernameOperator: { type: 'string', enum: [...USERNAME_OPERATORS], description: 'in 包含 / notIn 不包含 / eq 等于 / notEq 不等于' },
101
+ jobNum: { type: 'string' },
102
+ sex: { type: 'string', enum: ['all', 'male', 'female'] },
103
+ personnelStatus: {
104
+ type: 'array',
105
+ items: { type: 'string', enum: [...PERSONNEL_STATUS] },
106
+ description: '默认 ["normal"] 在职;["all"] 不限状态。不要用 ["normal","6"] 这类组合,实测无法覆盖离职人员',
107
+ },
108
+ saCondition: { type: 'object', description: '完整高级搜索条件;传入后将忽略上面的便捷字段' },
109
+ onlyFieldList: { type: 'array', items: { type: 'string' }, description: '只返回这些字段,key 以 contact.fields 返回的 fieldList[].id 为准' },
110
+ keyword: { type: 'string' },
111
+ saMatchType: { type: 'string', enum: ['and', 'or'] },
112
+ queryType: { type: 'string', enum: ['nomarl', 'monthActive', 'monthDimission', 'monthRetire'] },
113
+ };
114
+ const contactSearch = {
115
+ name: 'ehr.hr.contact.search',
116
+ resource: 'hr',
117
+ method: 'contact.search',
118
+ action: 'ehr.hr.contact.search',
119
+ summary: '按高级搜索条件分页查询通讯录在职人员;pageSize 被页面配置固定为 100,全量需递增 current 翻页',
120
+ capability: 'hr',
121
+ risk: READ,
122
+ inputSchema: schemaOf({ ...contactSearchProperties, ...pageSchema }),
123
+ handler: async (args, { host }) => {
124
+ const body = {
125
+ formEnable: true,
126
+ searchCount: true,
127
+ ...pickDefined(args, ['onlyFieldList', 'keyword', 'saMatchType', 'queryType']),
128
+ saCondition: buildSaCondition(args),
129
+ };
130
+ const current = toPositiveInt(args.current, 'current');
131
+ const pageSize = toNumber(args.pageSize, 'pageSize');
132
+ if (current !== undefined)
133
+ body.current = current;
134
+ if (pageSize !== undefined)
135
+ body.pageSize = pageSize;
136
+ const response = await host.request({
137
+ method: 'POST',
138
+ path: '/api/bs/hr/contact/main/table',
139
+ body: compact(body),
140
+ });
141
+ const { data, page } = normalizePaged(response);
142
+ return ehrSuccess('ehr.hr.contact.search', data, { page });
143
+ },
144
+ };
145
+ const contactCount = {
146
+ name: 'ehr.hr.contact.count',
147
+ resource: 'hr',
148
+ method: 'contact.count',
149
+ action: 'ehr.hr.contact.count',
150
+ summary: '只统计符合高级搜索条件的通讯录人员数量,不返回列表',
151
+ capability: 'hr',
152
+ risk: READ,
153
+ inputSchema: schemaOf(contactSearchProperties),
154
+ handler: async (args, { host }) => {
155
+ const response = await host.request({
156
+ method: 'POST',
157
+ path: '/api/bs/hr/contact/main/count',
158
+ body: {
159
+ formEnable: true,
160
+ ...pickDefined(args, ['keyword', 'saMatchType', 'queryType']),
161
+ saCondition: buildSaCondition(args),
162
+ },
163
+ });
164
+ return ehrSuccess('ehr.hr.contact.count', normalizePaged(response).data);
165
+ },
166
+ };
167
+ const browserComplete = {
168
+ name: 'ehr.hr.browser.complete',
169
+ resource: 'hr',
170
+ method: 'browser.complete',
171
+ action: 'ehr.hr.browser.complete',
172
+ summary: '按名称查询浏览器选择器条目取 id(部门/分部/岗位/职级/职务/上级等),供 saCondition 构造使用',
173
+ capability: 'hr',
174
+ risk: READ,
175
+ inputSchema: schemaOf({
176
+ type: { type: 'string', enum: [...BROWSER_TYPES], description: 'browserBean.type,取自 contact.sa 返回的字段定义' },
177
+ searchValue: { type: 'string', minLength: 1 },
178
+ }, { required: ['type', 'searchValue'] }),
179
+ handler: async (args, { host }) => {
180
+ const type = assertEnum(args.type, BROWSER_TYPES, 'type');
181
+ if (!args.searchValue || !String(args.searchValue).trim()) {
182
+ throw ehrValidationError('search_value_required', 'searchValue 必填');
183
+ }
184
+ const response = await host.request({
185
+ method: 'POST',
186
+ path: `/api/hrm/common/browser/complete/${type}`,
187
+ body: { browserMultiple: true, newly: 0, searchValue: String(args.searchValue) },
188
+ });
189
+ const data = normalizePaged(response).data;
190
+ const candidates = Array.isArray(data?.data) ? data.data : [];
191
+ return ehrSuccess('ehr.hr.browser.complete', {
192
+ candidates,
193
+ total: candidates.length,
194
+ // 多条命中时严禁自动取第一条,必须列候选让用户选择。
195
+ requiresDisambiguation: candidates.length > 1,
196
+ hint: candidates.length > 1
197
+ ? '存在多个匹配项,必须列出候选让用户确认选择哪一个,不得自动取第一条'
198
+ : undefined,
199
+ });
200
+ },
201
+ };
202
+ const birthdayConditions = {
203
+ name: 'ehr.hr.birthday.conditions',
204
+ resource: 'hr',
205
+ method: 'birthday.conditions',
206
+ action: 'ehr.hr.birthday.conditions',
207
+ summary: '获取过生日人员查询的高级搜索条件定义;该接口只能用 GET,POST 会返回 405',
208
+ capability: 'hr',
209
+ risk: READ,
210
+ inputSchema: schemaOf({}),
211
+ handler: async (_args, { host }) => {
212
+ const response = await host.request({
213
+ method: 'GET',
214
+ path: '/api/hr/birthday/getSearchCondition',
215
+ });
216
+ return ehrSuccess('ehr.hr.birthday.conditions', normalizePaged(response).data);
217
+ },
218
+ };
219
+ const birthdayList = {
220
+ name: 'ehr.hr.birthday.list',
221
+ resource: 'hr',
222
+ method: 'birthday.list',
223
+ action: 'ehr.hr.birthday.list',
224
+ summary: '按生日月/日、姓名、工号、部门、分部查询过生日人员;pageSize 被页面配置固定为 100',
225
+ capability: 'hr',
226
+ risk: READ,
227
+ inputSchema: schemaOf({
228
+ birthdayM: { type: 'string', pattern: '^(0[1-9]|1[0-2])$', description: '生日月 01-12,缺省取当前月' },
229
+ birthdayD: { type: 'string', pattern: '^(0[1-9]|[12][0-9]|3[01])$', description: '生日日 01-31;与 birthdayM 组合为单日' },
230
+ username: { type: 'string' },
231
+ jobNum: { type: 'string' },
232
+ departmentIds: SCHEMA_ID_LIST,
233
+ subcompanyIds: SCHEMA_ID_LIST,
234
+ ...pageSchema,
235
+ }),
236
+ handler: async (args, { host }) => {
237
+ const params = {};
238
+ if (args.birthdayM)
239
+ params.birthdayM = [{ birthdayM: args.birthdayM }];
240
+ if (args.birthdayD)
241
+ params.birthdayD = [{ birthdayD: args.birthdayD }];
242
+ if (args.username)
243
+ params.username = [{ username: args.username }];
244
+ if (args.jobNum)
245
+ params.jobNum = [{ jobNum: args.jobNum }];
246
+ const departmentIds = toIdList(args.departmentIds, 'departmentIds');
247
+ const subcompanyIds = toIdList(args.subcompanyIds, 'subcompanyIds');
248
+ if (departmentIds?.length) {
249
+ params.department = [{ department: departmentIds.map((id) => ({ id: String(id) })) }];
250
+ }
251
+ if (subcompanyIds?.length) {
252
+ params.subcompany = [{ subcompany: subcompanyIds.map((id) => ({ id: String(id) })) }];
253
+ }
254
+ const body = {
255
+ // menuCode 固定,来源文档明确可直接调 tableData。
256
+ menuCode: 'birthdaylist',
257
+ params,
258
+ };
259
+ const current = toPositiveInt(args.current, 'current');
260
+ const pageSize = toNumber(args.pageSize, 'pageSize');
261
+ if (current !== undefined)
262
+ body.current = current;
263
+ if (pageSize !== undefined)
264
+ body.pageSize = pageSize;
265
+ const response = await host.request({
266
+ method: 'POST',
267
+ path: '/api/hr/birthday/tableData',
268
+ body,
269
+ });
270
+ const { data, page } = normalizePaged(response);
271
+ return ehrSuccess('ehr.hr.birthday.list', data, { page });
272
+ },
273
+ };
274
+ const empchangeConditions = {
275
+ name: 'ehr.hr.empchange.conditions',
276
+ resource: 'hr',
277
+ method: 'empchange.conditions',
278
+ action: 'ehr.hr.empchange.conditions',
279
+ summary: '获取人员状态变更记录的筛选字段定义与枚举;该接口只能用 GET,POST 实测返回 405',
280
+ capability: 'hr',
281
+ risk: READ,
282
+ inputSchema: schemaOf({}),
283
+ handler: async (_args, { host }) => {
284
+ const response = await host.request({
285
+ method: 'GET',
286
+ path: '/api/bs/hrm/empchange/record/searchCondition',
287
+ });
288
+ return ehrSuccess('ehr.hr.empchange.conditions', normalizePaged(response).data);
289
+ },
290
+ };
291
+ const empchangeList = {
292
+ name: 'ehr.hr.empchange.list',
293
+ resource: 'hr',
294
+ method: 'empchange.list',
295
+ action: 'ehr.hr.empchange.list',
296
+ summary: '查询人员状态变更台账(试用/转正/续签/调动/离职/退休/解聘/返聘);默认包含离职人员,与通讯录默认在职相反',
297
+ capability: 'hr',
298
+ risk: READ,
299
+ inputSchema: schemaOf({
300
+ userName: { type: 'string', description: '姓名模糊匹配;可能重名,查个人建议用 resourceId' },
301
+ jobNum: { type: 'string' },
302
+ keySearch: { type: 'string' },
303
+ resourceId: SCHEMA_ID,
304
+ resource: SCHEMA_ID_LIST,
305
+ department: { ...SCHEMA_ID_LIST, description: '部门 id 数组;过滤的是人员当前所在部门' },
306
+ position: { ...SCHEMA_ID_LIST, description: '岗位 id 数组' },
307
+ changeDateStart: SCHEMA_DATE,
308
+ changeDateEnd: SCHEMA_DATE,
309
+ changeType: { type: 'array', items: { type: 'string', enum: [...CHANGE_TYPES] } },
310
+ changeStatuses: { type: 'array', items: { type: 'string', enum: [...CHANGE_STATUSES] } },
311
+ containUnavailable: { type: 'boolean', description: '是否包含离职人员,默认 true。注意:2026-09-04 实测该字段对服务端无效(true/false 均返回相同 total),已透传但被忽略,不要依赖它过滤离职人员' },
312
+ containPartTimeJob: { type: 'boolean' },
313
+ ...pageSchema,
314
+ }),
315
+ handler: async (args, { host }) => {
316
+ // 变更日期必须用两个独立字段传起止,传 changeDate 数组格式实测无效。
317
+ assertDateRange(args, 'changeDateStart', 'changeDateEnd');
318
+ const body = {
319
+ ...pickDefined(args, [
320
+ 'userName',
321
+ 'jobNum',
322
+ 'keySearch',
323
+ 'changeDateStart',
324
+ 'changeDateEnd',
325
+ 'changeType',
326
+ 'changeStatuses',
327
+ 'containUnavailable',
328
+ 'containPartTimeJob',
329
+ ]),
330
+ };
331
+ const current = toPositiveInt(args.current, 'current');
332
+ const pageSize = toNumber(args.pageSize, 'pageSize');
333
+ if (current !== undefined)
334
+ body.current = current;
335
+ if (pageSize !== undefined)
336
+ body.pageSize = pageSize;
337
+ if (args.resourceId !== undefined)
338
+ body.resourceId = Number(args.resourceId);
339
+ for (const key of ['department', 'position', 'resource']) {
340
+ const list = toIdList(args[key], key);
341
+ if (list?.length)
342
+ body[key] = list;
343
+ }
344
+ const response = await host.request({
345
+ method: 'POST',
346
+ path: '/api/bs/hrm/empchange/getTable',
347
+ body: compact(body),
348
+ });
349
+ const { data, page } = normalizePaged(response);
350
+ return ehrSuccess('ehr.hr.empchange.list', data, { page });
351
+ },
352
+ };
353
+ export const hrContactOperations = [
354
+ contactFields,
355
+ contactSa,
356
+ contactSearch,
357
+ contactCount,
358
+ browserComplete,
359
+ birthdayConditions,
360
+ birthdayList,
361
+ empchangeConditions,
362
+ empchangeList,
363
+ ];
@@ -0,0 +1,298 @@
1
+ import { ehrValidationError } from '../errors.js';
2
+ import { READ, SCHEMA_ID, ehrSuccess, schemaOf, } from './types.js';
3
+ import { assertEnum, compact, normalizePaged, toNumber, toPositiveInt } from './shared.js';
4
+ /**
5
+ * 聚才林数据源(HR 报表)固定 formId 对照表。
6
+ * 文档明确:formId 固定、不区分租户,groupId 恒为 weaver-hr-service。
7
+ */
8
+ export const HR_DATA_SOURCE_IDS = {
9
+ // 历史时点(必填 timePoint,eq)
10
+ tp: '754217732232708651',
11
+ // 编制
12
+ estCalc: '754217732232708751',
13
+ estDcCalc: '754217732232709056',
14
+ // 基本状况分析
15
+ basicAge: '754217732232708200',
16
+ basicSex: '754217732232708188',
17
+ basicWorkYear: '754217732232708201',
18
+ basicEdu: '754217732232708202',
19
+ basicMarry: '754217732232708203',
20
+ basicJobCall: '754217732232708204',
21
+ basicJobLevel: '754217732232708205',
22
+ basicStatus: '754217732232708207',
23
+ basicSecLevel: '754217732232708208',
24
+ // 流失统计
25
+ changeLossPersonCount: '754217732232708374',
26
+ changeLossDeptCount: '754217732232708375',
27
+ changeLossPer: '754217732232708376',
28
+ changeDismissPersonCount: '754217732232708378',
29
+ changeDismissDeptCount: '754217732232708379',
30
+ changeDismissPer: '754217732232708380',
31
+ changeQuitPersonCount: '754217732232708382',
32
+ changeQuitDeptCount: '754217732232708383',
33
+ changeQuitPer: '754217732232708384',
34
+ changeRetirePersonCount: '754217732232708386',
35
+ changeRetireDeptCount: '754217732232708387',
36
+ changeRetirePer: '754217732232708388',
37
+ // 部门人数
38
+ deptPanelDeptCount: '754217732232708426',
39
+ deptPanelPersonCount: '754217732232708427',
40
+ deptPanelMaxPersonCount: '754217732232708428',
41
+ deptPanelMinPersonCount: '754217732232708429',
42
+ // 离职名册(过滤字段 dismissDate 可选)
43
+ dismiss: '754217732232708654',
44
+ // 历史曾在职(必填 dutyDate)
45
+ hw: '754217732232708653',
46
+ // 职务状况
47
+ jobPanelPersonCount: '754217732232708445',
48
+ jobPanelJobTypeCount: '754217732232708446',
49
+ jobPanelJobCount: '754217732232708447',
50
+ // 岗位人数
51
+ posiPanelPosiCount: '754217732232708440',
52
+ posiPanelPersonCount: '754217732232708441',
53
+ posiPanelMaxPersonCount: '754217732232708442',
54
+ posiPanelMinPersonCount: '754217732232708443',
55
+ // 人员流动分析(必填 dateRange)
56
+ turn: '754217732232708655',
57
+ // 人员情况合计(必填 month)
58
+ v2DeptEmpMove: '754217732232709010',
59
+ };
60
+ const HR_GROUP_ID = 'weaver-hr-service';
61
+ /**
62
+ * 数据源条件操作符白名单。不同字段支持的操作符不同,以 ehr.hr.ds.fields 返回的
63
+ * conditionType 为准;此处只做兜底,避免误拦截(真正决定成败的是传法,见下)。
64
+ *
65
+ * 两类易混操作符在源资料中都存在,必须都保留:
66
+ * - `gtAndEq` / `ltAndEq`:见 tp(历史时点)文档
67
+ * - `gte` / `lte`:见 hw / turn / v2DeptEmpMove / dismiss 文档
68
+ *
69
+ * 日期范围条件的正确传法(2026-09-04 依源资料修正,此前判错):
70
+ * hw 的 dutyDate、turn 的 dateRange、v2DeptEmpMove 的 month、dismiss 的 dismissDate
71
+ * **必须拆成 2 个条件**——`gte` 起 + `lte` 止,引擎取前 2 个 conditionValue 作为起止日期。
72
+ * 用单个 between 传 "起,止" 会报 500「日期范围过滤条件错误」。
73
+ * 只有 tp 的 timePoint 是单条件,用 `eq`。
74
+ */
75
+ const COMPARE_TYPES = [
76
+ 'eq',
77
+ 'in',
78
+ 'like',
79
+ 'gtAndEq',
80
+ 'ltAndEq',
81
+ 'gte',
82
+ 'lte',
83
+ 'between',
84
+ ];
85
+ const PERMISSION_TYPE_KEYS = [
86
+ 'hiredate',
87
+ 'location',
88
+ 'personnelStatus',
89
+ 'subcompany',
90
+ 'department',
91
+ 'baseAgeSplit',
92
+ 'baseWorkYearSplit',
93
+ ];
94
+ function buildPermissionType(value) {
95
+ if (!value || typeof value !== 'object' || Array.isArray(value))
96
+ return undefined;
97
+ const raw = value;
98
+ if (Object.keys(raw).length === 0)
99
+ return undefined;
100
+ const payload = {
101
+ hiredate: Array.isArray(raw.hiredate) ? raw.hiredate : [],
102
+ location: Array.isArray(raw.location) ? raw.location.map(String) : [],
103
+ // personnelStatus 未提供时按 normal(在职)处理,这是报表类的默认语义。
104
+ personnelStatus: Array.isArray(raw.personnelStatus) ? raw.personnelStatus : ['normal'],
105
+ subcompany: Array.isArray(raw.subcompany) ? raw.subcompany.map(String) : [],
106
+ department: Array.isArray(raw.department) ? raw.department.map(String) : [],
107
+ };
108
+ if (raw.baseAgeSplit !== undefined)
109
+ payload.baseAgeSplit = String(raw.baseAgeSplit);
110
+ if (raw.baseWorkYearSplit !== undefined)
111
+ payload.baseWorkYearSplit = String(raw.baseWorkYearSplit);
112
+ return JSON.stringify(payload);
113
+ }
114
+ function buildQueryFields(formId, fields) {
115
+ if (!Array.isArray(fields) || fields.length === 0)
116
+ return undefined;
117
+ return fields.map((name, index) => ({
118
+ objId: formId,
119
+ fieldId: String(name),
120
+ fieldName: String(name),
121
+ ...(index === 0 ? { mainPrimaryKey: true } : {}),
122
+ }));
123
+ }
124
+ function buildConditionTrees(conditions) {
125
+ if (!Array.isArray(conditions) || conditions.length === 0)
126
+ return undefined;
127
+ return {
128
+ isParent: true,
129
+ relationship: '1',
130
+ conditionList: conditions.map((item, index) => {
131
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
132
+ throw ehrValidationError('condition_invalid', `conditions[${index}] 必须是对象`);
133
+ }
134
+ const record = item;
135
+ if (!record.field) {
136
+ throw ehrValidationError('condition_invalid', `conditions[${index}].field 必填`);
137
+ }
138
+ return {
139
+ isParent: false,
140
+ conditionId: String(record.field),
141
+ conditionValue: String(record.value ?? ''),
142
+ compareType: assertEnum(record.compareType, COMPARE_TYPES, `conditions[${index}].compareType`),
143
+ };
144
+ }),
145
+ };
146
+ }
147
+ const dsQueryProperties = {
148
+ formId: { oneOf: [{ type: 'string', minLength: 1 }, { type: 'integer' }], description: '数据源 formId,见 schema 中的 dataSourceIds' },
149
+ conditions: {
150
+ type: 'array',
151
+ description: '条件列表。日期范围条件必须拆成 2 项:{field,value:起始,compareType:"gte"} + {field,value:截止,compareType:"lte"};不要用单个 between 传 "起,止"。可用操作符以 ehr.hr.ds.fields 返回的 conditionType 为准',
152
+ items: {
153
+ type: 'object',
154
+ additionalProperties: false,
155
+ properties: {
156
+ field: { type: 'string', minLength: 1, description: '字段 name,来自 ds.fields' },
157
+ value: { oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }], description: '条件值;日期范围 gte 传起始、lte 传截止' },
158
+ compareType: { type: 'string', enum: [...COMPARE_TYPES] },
159
+ },
160
+ required: ['field', 'value', 'compareType'],
161
+ },
162
+ },
163
+ queryFields: { type: 'array', items: { type: 'string' }, description: '查询字段 name 列表,来自 ds.fields' },
164
+ permissionType: {
165
+ type: 'object',
166
+ additionalProperties: false,
167
+ description: '人员范围过滤,JSON 字符串化后内嵌到 queryDto',
168
+ properties: {
169
+ hiredate: { type: 'array', items: { type: 'string' }, minItems: 2, maxItems: 2 },
170
+ location: { type: 'array', items: { type: 'string' } },
171
+ personnelStatus: { type: 'array', items: { type: 'string' }, description: '默认 ["normal"];["all"] 不限状态' },
172
+ subcompany: { type: 'array', items: { type: 'string' } },
173
+ department: { type: 'array', items: { type: 'string' } },
174
+ baseAgeSplit: { type: 'string' },
175
+ baseWorkYearSplit: { type: 'string' },
176
+ },
177
+ },
178
+ pageNo: SCHEMA_ID,
179
+ pageSize: SCHEMA_ID,
180
+ queryCount: { type: 'boolean' },
181
+ rawQueryDto: {
182
+ type: 'object',
183
+ description: '逃生舱:直接传完整 queryDto 对象,将覆盖上面的结构化构造结果',
184
+ },
185
+ };
186
+ function buildQueryDto(args, queryType) {
187
+ if (args.formId === undefined || args.formId === null || args.formId === '') {
188
+ throw ehrValidationError('form_id_required', 'formId 必填');
189
+ }
190
+ const formId = String(args.formId);
191
+ if (args.rawQueryDto && typeof args.rawQueryDto === 'object' && !Array.isArray(args.rawQueryDto)) {
192
+ return { ...args.rawQueryDto, tableId: formId, groupId: HR_GROUP_ID };
193
+ }
194
+ const queryDto = {
195
+ tableId: formId,
196
+ groupId: HR_GROUP_ID,
197
+ queryType,
198
+ pageNo: toPositiveInt(args.pageNo, 'pageNo') ?? 1,
199
+ pageSize: toNumber(args.pageSize, 'pageSize') ?? 100,
200
+ queryCount: args.queryCount !== false,
201
+ };
202
+ const conditionTrees = buildConditionTrees(args.conditions);
203
+ if (conditionTrees)
204
+ queryDto.conditionTrees = conditionTrees;
205
+ const queryFields = buildQueryFields(formId, args.queryFields);
206
+ if (queryFields)
207
+ queryDto.queryFields = queryFields;
208
+ const permissionType = buildPermissionType(args.permissionType);
209
+ if (permissionType)
210
+ queryDto.permissionType = permissionType;
211
+ return queryDto;
212
+ }
213
+ const dsFields = {
214
+ name: 'ehr.hr.ds.fields',
215
+ resource: 'hr',
216
+ method: 'ds.fields',
217
+ action: 'ehr.hr.ds.fields',
218
+ summary: '获取 HR 数据源的字段结构(哪些字段可作查询条件、支持的操作符),是构造 ds.list/ds.count/ds.chart 的唯一依据',
219
+ capability: 'hr',
220
+ risk: READ,
221
+ inputSchema: schemaOf({ formId: { oneOf: [{ type: 'string', minLength: 1 }, { type: 'integer' }] } }, { required: ['formId'] }),
222
+ handler: async (args, { host }) => {
223
+ if (args.formId === undefined || args.formId === null || args.formId === '') {
224
+ throw ehrValidationError('form_id_required', 'formId 必填');
225
+ }
226
+ // 数据源接口全部是 form-urlencoded 提交,不是 JSON body。
227
+ const response = await host.request({
228
+ method: 'POST',
229
+ path: '/api/bs/hr/ds/fields',
230
+ form: {
231
+ sourceType: 'LOGIC',
232
+ sourceId: String(args.formId),
233
+ groupId: HR_GROUP_ID,
234
+ },
235
+ });
236
+ return ehrSuccess('ehr.hr.ds.fields', normalizePaged(response).data);
237
+ },
238
+ };
239
+ const dsList = {
240
+ name: 'ehr.hr.ds.list',
241
+ resource: 'hr',
242
+ method: 'ds.list',
243
+ action: 'ehr.hr.ds.list',
244
+ summary: '查询 HR 数据源列表数据(历史时点名册、离职名册、历史曾在职、编制、流动分析、人员情况合计等)',
245
+ capability: 'hr',
246
+ risk: READ,
247
+ inputSchema: schemaOf({ ...dsQueryProperties }, { required: ['formId'] }),
248
+ handler: async (args, { host }) => {
249
+ const response = await host.request({
250
+ method: 'POST',
251
+ // /api/bs/hr/ds/getListData 已废弃 404,必须走 /ai/ 路径。
252
+ path: '/api/bs/hr/ai/ds/getListData',
253
+ form: { sourceType: 'LOGIC', queryDto: buildQueryDto(args, 'list') },
254
+ });
255
+ const { data, page } = normalizePaged(response);
256
+ return ehrSuccess('ehr.hr.ds.list', data, { page });
257
+ },
258
+ };
259
+ const dsCount = {
260
+ name: 'ehr.hr.ds.count',
261
+ resource: 'hr',
262
+ method: 'ds.count',
263
+ action: 'ehr.hr.ds.count',
264
+ summary: '查询 HR 数据源数量统计,返回 totalCount/totalPage/pageSize/tableId(不是 count 字段)',
265
+ capability: 'hr',
266
+ risk: READ,
267
+ inputSchema: schemaOf({ ...dsQueryProperties }, { required: ['formId'] }),
268
+ handler: async (args, { host }) => {
269
+ const response = await host.request({
270
+ method: 'POST',
271
+ path: '/api/bs/hr/ai/ds/getCountData',
272
+ form: { sourceType: 'LOGIC', queryDto: buildQueryDto(args, 'count') },
273
+ });
274
+ const { data, page } = normalizePaged(response);
275
+ return ehrSuccess('ehr.hr.ds.count', data, { page });
276
+ },
277
+ };
278
+ const dsChart = {
279
+ name: 'ehr.hr.ds.chart',
280
+ resource: 'hr',
281
+ method: 'ds.chart',
282
+ action: 'ehr.hr.ds.chart',
283
+ summary: '查询 HR 数据源图表分布数据(基本状况分析:年龄/性别/工龄/学历/婚姻/职称/职级/状态/安全级别)',
284
+ capability: 'hr',
285
+ risk: READ,
286
+ inputSchema: schemaOf({ ...dsQueryProperties }, { required: ['formId'] }),
287
+ handler: async (args, { host }) => {
288
+ const response = await host.request({
289
+ method: 'POST',
290
+ path: '/api/bs/hr/ai/ds/getChartData',
291
+ form: { sourceType: 'LOGIC', queryDto: buildQueryDto(args, 'chart') },
292
+ });
293
+ const { data, page } = normalizePaged(response);
294
+ return ehrSuccess('ehr.hr.ds.chart', data, { page });
295
+ },
296
+ };
297
+ export const hrDataSourceOperations = [dsFields, dsList, dsCount, dsChart];
298
+ export { compact, PERMISSION_TYPE_KEYS };