weaver-work-cli 0.1.39 → 0.1.42
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.
- package/README.md +4 -2
- package/dist/chunks/{archive-ENZYBBME.js → archive-J4I6MCKF.js} +2 -2
- package/dist/chunks/{archive-oa-YWLEC5V4.js → archive-oa-BRZKKTO4.js} +2 -2
- package/dist/chunks/{asset-OOV6DWPA.js → asset-L7D4FAOZ.js} +2 -2
- package/dist/chunks/{asset-idle-RE632MY5.js → asset-idle-DADLLV75.js} +2 -2
- package/dist/chunks/{attachment-content-RWN2FCLL.js → attachment-content-K4C7VLWQ.js} +3 -3
- package/dist/chunks/{blog-PEPOJAL7.js → blog-BVGQ7NZL.js} +2 -2
- package/dist/chunks/{caizhilian-WYIQDVPJ.js → caizhilian-SAADNFD6.js} +2 -2
- package/dist/chunks/{calendar-CIARBAOX.js → calendar-Q7NQY5Z2.js} +61 -23
- package/dist/chunks/{chunk-F2EQXUEE.js → chunk-3KTFS4IA.js} +397 -159
- package/dist/chunks/{chunk-G2JSIUWF.js → chunk-4PD5NWAX.js} +89 -0
- package/dist/chunks/{chunk-HJYVHXUQ.js → chunk-4RAE6JXP.js} +1 -1
- package/dist/chunks/{chunk-CQHGNCK2.js → chunk-72CKAUAG.js} +41 -8
- package/dist/chunks/{chunk-K3RUEEOL.js → chunk-APVFJUQH.js} +2 -2
- package/dist/chunks/{chunk-BJGXMFGD.js → chunk-BBKDXQEC.js} +2 -2
- package/dist/chunks/chunk-BIPYLLVS.js +501 -0
- package/dist/chunks/{chunk-GVPJZXJ2.js → chunk-EKWAQSLU.js} +92 -50
- package/dist/chunks/{chunk-XXJOSZTQ.js → chunk-FOAA27U5.js} +381 -57
- package/dist/chunks/{chunk-I2HB737U.js → chunk-G4UR6NXN.js} +2 -2
- package/dist/chunks/{chunk-YS5DPN4T.js → chunk-GEWYMQME.js} +1 -1
- package/dist/chunks/{chunk-P2DAISYW.js → chunk-GHXCDPTM.js} +1 -1
- package/dist/chunks/{chunk-L4N7B7ZD.js → chunk-IZ7S7QUS.js} +4 -4
- package/dist/chunks/{chunk-NLK2RZKG.js → chunk-JPRO6ER2.js} +122 -2214
- package/dist/chunks/{chunk-36DIFZAH.js → chunk-LADPYOWC.js} +2 -2
- package/dist/chunks/chunk-LDZQPUIA.js +1238 -0
- package/dist/chunks/chunk-NKZRQXST.js +2546 -0
- package/dist/chunks/{chunk-EINRJHQ3.js → chunk-QKNKR4RH.js} +3 -3
- package/dist/chunks/{chunk-T7JDJJ7H.js → chunk-R4CHUSKC.js} +126 -19
- package/dist/chunks/{chunk-EZGFHJFW.js → chunk-SA6VBIHY.js} +88 -15
- package/dist/chunks/{chunk-ZXRNHZTE.js → chunk-TTPJJJC4.js} +2 -2
- package/dist/chunks/{chunk-KTCB5R5H.js → chunk-W7BEHOSR.js} +2 -2
- package/dist/chunks/{chunk-MUQUHKPG.js → chunk-YRSZQUD2.js} +2 -2
- package/dist/chunks/{conflict-DRMDOL56.js → conflict-F2OMZRTO.js} +2 -2
- package/dist/chunks/{contract-73MERZWN.js → contract-5BETHRSG.js} +2 -2
- package/dist/chunks/{cowork-HNGBPD7A.js → cowork-3MN6EQQO.js} +27 -10
- package/dist/chunks/create-flow-5FQNNMVO.js +55 -0
- package/dist/chunks/{ebuilder-form-OY6DVNRK.js → ebuilder-form-SBHOYBUD.js} +3 -3
- package/dist/chunks/{ehr-RAQNEQO7.js → ehr-KMOJULKG.js} +432 -1234
- package/dist/chunks/env-LB7NBL2O.js +19 -0
- package/dist/chunks/{esb-6XV7C7YV.js → esb-W2PJCFCX.js} +4 -4
- package/dist/chunks/factory-6ZFQXQ46.js +30 -0
- package/dist/chunks/{fna-XTSRB7G7.js → fna-ZQPCUV4R.js} +2 -2
- package/dist/chunks/group-chat-2HHAJN46.js +20 -0
- package/dist/chunks/{host-YMBXWFWX.js → host-4CBHGOHT.js} +3 -3
- package/dist/chunks/{host-A7J6GDUP.js → host-ATKVNZAT.js} +3 -3
- package/dist/chunks/{host-3F5UM5GN.js → host-BQH22NTQ.js} +3 -3
- package/dist/chunks/{host-YAQAPYNP.js → host-X2CSLFM6.js} +3 -3
- package/dist/chunks/{host-VGPVP7YF.js → host-YTODKMSL.js} +3 -3
- package/dist/chunks/{hrm-TLHKC545.js → hrm-FFM4UJFS.js} +4 -4
- package/dist/chunks/{im-YOUCFMUK.js → im-VEHKDQPB.js} +8 -8
- package/dist/chunks/{invoice-WNBS2B4C.js → invoice-LVIKSIIF.js} +3 -3
- package/dist/chunks/{jiuchuanhui-XABWS5RN.js → jiuchuanhui-X6DINO5P.js} +2 -2
- package/dist/chunks/{lazy-dispatch-NLZ5UQQI.js → lazy-dispatch-KSWTN5L6.js} +4 -4
- package/dist/chunks/{mail-LRYMBFNL.js → mail-VDKRGUD3.js} +9 -4
- package/dist/chunks/{meeting-ESXL6MFI.js → meeting-CLC6HP3Z.js} +12 -10
- package/dist/chunks/{okr-EOV65SSF.js → okr-CHG4OO3U.js} +2 -2
- package/dist/chunks/{plan-YFPVKW6Y.js → plan-XWR75667.js} +2 -2
- package/dist/chunks/{project-MDVZUYQW.js → project-5BXOOKMG.js} +40 -23
- package/dist/chunks/recruit-stage-DGMFNNDE.js +4507 -0
- package/dist/chunks/{registry-VT5Y2HLA.js → registry-7FFOXIAW.js} +4 -4
- package/dist/chunks/{registry-QCLZEDAP.js → registry-BKBZPBAJ.js} +10 -8
- package/dist/chunks/{registry-YX4CSEMD.js → registry-RHMW6ANW.js} +2 -2
- package/dist/chunks/{registry-NYPYMZXG.js → registry-Z43434VG.js} +1 -1
- package/dist/chunks/{room-recommend-L3MWH4JW.js → room-recommend-62H7ZQQ6.js} +4 -4
- package/dist/chunks/{schedule-UASAVDVD.js → schedule-FNXKH3DQ.js} +4 -4
- package/dist/chunks/{workflow-KDGIUCNW.js → workflow-ADHKCAJK.js} +4 -4
- package/dist/index.js +33 -28
- package/dist/internal/e10/auth/commands.js +110 -56
- package/dist/internal/e10/auth/messages.js +6 -0
- package/dist/internal/e10/auth/session.js +28 -1
- package/dist/internal/e10/auth/xiaoe.js +315 -48
- package/dist/internal/e10/auth-recovery.js +36 -5
- package/dist/internal/e10/client.js +13 -0
- package/dist/internal/e10/context.js +61 -9
- package/dist/internal/e10/index.js +1 -1
- package/dist/internal/e10/network-error.js +93 -0
- package/dist/internal/e10/request-runtime.js +15 -0
- package/dist/shortcuts/calendar/operations/read.js +31 -22
- package/dist/shortcuts/calendar/operations/write.js +45 -1
- package/dist/shortcuts/cowork/operations/discuss-write.js +5 -1
- package/dist/shortcuts/cowork/operations/item-write.js +5 -3
- package/dist/shortcuts/cowork/operations/member-write.js +3 -1
- package/dist/shortcuts/cowork/operations/permission-write.js +5 -1
- package/dist/shortcuts/cowork/operations/shared.js +7 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +43 -1
- package/dist/shortcuts/ehr/operations/hr-contact.js +7 -4
- package/dist/shortcuts/ehr/operations/hr-report.js +13 -7
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +134 -59
- package/dist/shortcuts/ehr/operations/recruit-write.js +262 -17
- package/dist/shortcuts/ehr/operations/recruit.js +10 -4
- package/dist/shortcuts/ehr/operations/shared.js +47 -0
- package/dist/shortcuts/hrm/operations/org.js +118 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/operations/mail-send.js +8 -2
- package/dist/shortcuts/meeting/operations/eb/catalog.js +9 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +461 -127
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
- package/dist/shortcuts/meeting/operations/eb/factory.js +33 -0
- package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +605 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +96 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +44 -6
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
- package/dist/shortcuts/project/operations/read.js +6 -25
- package/dist/shortcuts/project/operations/shared.js +22 -0
- package/dist/shortcuts/project/operations/write.js +28 -2
- package/dist/shortcuts/recruit-stage/context.js +119 -0
- package/dist/shortcuts/recruit-stage/continuation.js +73 -0
- package/dist/shortcuts/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/recruit-stage/host.js +109 -0
- package/dist/shortcuts/recruit-stage/index.js +115 -0
- package/dist/shortcuts/recruit-stage/manifest.js +29 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +722 -0
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +269 -0
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +630 -0
- package/dist/shortcuts/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/recruit-stage/operations/registry.js +38 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +1198 -0
- package/dist/shortcuts/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/recruit-stage/operations/types.js +25 -0
- package/dist/shortcuts/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/recruit-stage/shared.js +608 -0
- package/dist/shortcuts/workflow/operations/form.js +21 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +52 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +4 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +19 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +17 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +14 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +78 -10
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +3 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +17 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +16 -40
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +52 -15
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.pipeline.js +16 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +151 -63
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subGroup.js +56 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +53 -16
- package/docs/e10-auth.md +22 -1
- package/docs/operation-manual.md +8 -0
- package/package.json +1 -1
- package/scripts/install-skill-to-xiaoe.mjs +105 -0
- package/scripts/mcp-meeting.mjs +234 -0
- package/scripts/package-skill.mjs +4 -2
- package/skill-template/business-info.json +24 -0
- package/skill-template/domains/recruit-stage.md +29 -0
- package/skills/weaver-e10-calendar/SKILL.md +2 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +54 -0
- package/skills/weaver-e10-cowork/SKILL.md +1 -1
- package/skills/weaver-e10-cowork/references/cowork-write.md +3 -1
- package/skills/weaver-e10-jucailin/SKILL.md +1 -1
- package/skills/weaver-e10-jucailin/references/attend-write.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-contact.md +8 -0
- package/skills/weaver-e10-jucailin/references/hr-report.md +8 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -3
- package/skills/weaver-e10-mail/SKILL.md +1 -1
- package/skills/weaver-e10-mail/references/mail-send.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +119 -26
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +226 -0
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +119 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +188 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +322 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +127 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +65 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +63 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +73 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +56 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +148 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +59 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +438 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-shared/SKILL.md +2 -2
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-shijingran/SKILL.md +3 -2
- package/skills/weaver-e10-shijingran/references/operations.md +3 -1
- package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
- package/skills/weaver-e10-shijingran/references/write-operations.md +2 -0
- package/skills/weaver-e10-workflow/SKILL.md +7 -1
- package/skills/weaver-e10-workflow/aigroup/default.json +23 -9
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +37 -21
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +135 -43
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -10
- package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +6 -3
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
meetingStateDir
|
|
5
|
+
} from "./chunk-GEWYMQME.js";
|
|
6
|
+
import {
|
|
7
|
+
meetingSuccess,
|
|
8
|
+
meetingValidationError,
|
|
9
|
+
schemaOf
|
|
10
|
+
} from "./chunk-72CKAUAG.js";
|
|
11
|
+
|
|
12
|
+
// src/shortcuts/meeting/operations/eb/group-chat.ts
|
|
13
|
+
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
var DEFAULT_MEETING_GROUP_FLOW_ID = "1333212605456498718";
|
|
16
|
+
var GROUP_FIELD = "imchat_groupid";
|
|
17
|
+
var PENDING_DIR = "pending-forms";
|
|
18
|
+
async function buildEsbEnv(env) {
|
|
19
|
+
const { createEsbHost } = await import("./host-YTODKMSL.js");
|
|
20
|
+
const { createEsbContinuationSigner } = await import("./continuation-NLECEJPX.js");
|
|
21
|
+
return { ctx: env.ctx, host: createEsbHost(env.ctx), continuation: createEsbContinuationSigner(env.ctx) };
|
|
22
|
+
}
|
|
23
|
+
async function buildImEnv(env) {
|
|
24
|
+
const { createImHost } = await import("./host-BQH22NTQ.js");
|
|
25
|
+
const { createImContinuationSigner } = await import("./continuation-2CKSBLA6.js");
|
|
26
|
+
return { ctx: env.ctx, host: createImHost(env.ctx), continuation: createImContinuationSigner(env.ctx) };
|
|
27
|
+
}
|
|
28
|
+
async function buildWorkflowEnv(env) {
|
|
29
|
+
const { createWorkflowHost } = await import("./host-X2CSLFM6.js");
|
|
30
|
+
const { createWorkflowContinuationSigner } = await import("./continuation-HZIZRZBX.js");
|
|
31
|
+
return { ctx: env.ctx, host: createWorkflowHost(env.ctx), continuation: createWorkflowContinuationSigner(env.ctx) };
|
|
32
|
+
}
|
|
33
|
+
function parseLocalTime(value) {
|
|
34
|
+
const text = String(value ?? "").trim();
|
|
35
|
+
if (text === "") return 0;
|
|
36
|
+
const normalized = /^\d{4}-\d{2}-\d{2}$/u.test(text) ? `${text} 00:00:00` : text;
|
|
37
|
+
const ts = new Date(normalized.replace(/-/g, "/")).getTime();
|
|
38
|
+
return Number.isFinite(ts) ? ts : 0;
|
|
39
|
+
}
|
|
40
|
+
function formatLocalTime(date) {
|
|
41
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
42
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
43
|
+
}
|
|
44
|
+
function pendingDirOf(env) {
|
|
45
|
+
return resolve(meetingStateDir(env.ctx), PENDING_DIR);
|
|
46
|
+
}
|
|
47
|
+
async function savePendingForm(env, record) {
|
|
48
|
+
try {
|
|
49
|
+
const dir = pendingDirOf(env);
|
|
50
|
+
await mkdir(dir, { recursive: true });
|
|
51
|
+
const preparedAt = String(record.preparedAt ?? "").trim() || formatLocalTime(/* @__PURE__ */ new Date());
|
|
52
|
+
let baselineRequestId = "";
|
|
53
|
+
try {
|
|
54
|
+
const latest = await searchMyRequests(env, {
|
|
55
|
+
...record.workflowId ? { workflowId: record.workflowId } : {}
|
|
56
|
+
});
|
|
57
|
+
baselineRequestId = latest[0]?.requestId ?? "";
|
|
58
|
+
} catch {
|
|
59
|
+
baselineRequestId = "";
|
|
60
|
+
}
|
|
61
|
+
const body = { ...record, preparedAt, baselineRequestId };
|
|
62
|
+
const file = resolve(dir, `${Date.now()}-${String(record.workflowId || "wf")}.json`);
|
|
63
|
+
await writeFile(file, `${JSON.stringify(body, null, 2)}
|
|
64
|
+
`, "utf8");
|
|
65
|
+
const files = (await readdir(dir)).filter((one) => one.endsWith(".json")).sort();
|
|
66
|
+
for (const stale of files.slice(0, Math.max(0, files.length - 30))) {
|
|
67
|
+
await rm(resolve(dir, stale), { force: true });
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function loadLatestPending(env) {
|
|
73
|
+
try {
|
|
74
|
+
const dir = pendingDirOf(env);
|
|
75
|
+
const files = (await readdir(dir)).filter((one) => one.endsWith(".json")).sort().reverse();
|
|
76
|
+
for (const file of files) {
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(await readFile(resolve(dir, file), "utf8"));
|
|
79
|
+
if (parsed && String(parsed.groupId ?? "").trim() !== "") return parsed;
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function pickGroupId(value, depth = 0) {
|
|
89
|
+
if (value === null || value === void 0 || depth > 6) return "";
|
|
90
|
+
if (Array.isArray(value)) {
|
|
91
|
+
for (const one of value) {
|
|
92
|
+
const hit = pickGroupId(one, depth + 1);
|
|
93
|
+
if (hit) return hit;
|
|
94
|
+
}
|
|
95
|
+
return "";
|
|
96
|
+
}
|
|
97
|
+
if (typeof value !== "object") return "";
|
|
98
|
+
const obj = value;
|
|
99
|
+
for (const [key, raw] of Object.entries(obj)) {
|
|
100
|
+
const normalized = key.toLowerCase().replace(/[_-]/gu, "");
|
|
101
|
+
if (normalized.includes("group") || normalized.includes("chat")) {
|
|
102
|
+
const text = raw === null || raw === void 0 ? "" : String(raw).trim();
|
|
103
|
+
if (/^\d{6,}$/u.test(text)) return text;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const raw of Object.values(obj)) {
|
|
107
|
+
const hit = pickGroupId(raw, depth + 1);
|
|
108
|
+
if (hit) return hit;
|
|
109
|
+
}
|
|
110
|
+
return "";
|
|
111
|
+
}
|
|
112
|
+
async function findGroupByName(env, name) {
|
|
113
|
+
const target = name.trim();
|
|
114
|
+
if (target === "") return null;
|
|
115
|
+
try {
|
|
116
|
+
const { getImOperation } = await import("./registry-OZSMDVPP.js");
|
|
117
|
+
const search = getImOperation("im.group.search");
|
|
118
|
+
const imEnv = await buildImEnv(env);
|
|
119
|
+
const found = await search.handler({ name: target }, imEnv);
|
|
120
|
+
const groups = (found?.data?.groups ?? []).map((one) => ({
|
|
121
|
+
id: String(one.id ?? "").trim(),
|
|
122
|
+
name: String(one.name ?? "").trim(),
|
|
123
|
+
createTime: String(one.createTime ?? "").trim()
|
|
124
|
+
})).filter((one) => one.id !== "");
|
|
125
|
+
if (groups.length === 0) return null;
|
|
126
|
+
const exact = groups.filter((one) => one.name === target);
|
|
127
|
+
const pool = exact.length > 0 ? exact : groups;
|
|
128
|
+
if (exact.length === 0 && pool.length > 1) return null;
|
|
129
|
+
pool.sort((a, b) => parseLocalTime(b.createTime) - parseLocalTime(a.createTime));
|
|
130
|
+
return { ...pool[0], exact: exact.length > 0 };
|
|
131
|
+
} catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function findGroupWithRetry(env, name) {
|
|
136
|
+
const delays = [0, 1200, 2500, 4e3];
|
|
137
|
+
for (let index = 0; index < delays.length; index += 1) {
|
|
138
|
+
if (delays[index] > 0) await new Promise((done) => setTimeout(done, delays[index]));
|
|
139
|
+
const hit = await findGroupByName(env, name);
|
|
140
|
+
if (hit) return hit;
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
async function triggerGroupFlow(env, input, meetingName, memberIds) {
|
|
145
|
+
const session = await env.host.getSession();
|
|
146
|
+
const employeeId = String(input.employeeId ?? session?.userId ?? "").trim();
|
|
147
|
+
if (!employeeId) {
|
|
148
|
+
return { actionData: null, error: "\u53D6\u4E0D\u5230\u5F53\u524D\u767B\u5F55\u7528\u6237 id\uFF0C\u65E0\u6CD5\u89E6\u53D1\u5EFA\u7FA4\u52A8\u4F5C\u6D41" };
|
|
149
|
+
}
|
|
150
|
+
const mainTable = {
|
|
151
|
+
mt_name: meetingName,
|
|
152
|
+
begindatetime: String(input.beginDatetime ?? ""),
|
|
153
|
+
enddatetime: String(input.endDatetime ?? ""),
|
|
154
|
+
hrmmembers: memberIds.join(",")
|
|
155
|
+
};
|
|
156
|
+
if (input.address) {
|
|
157
|
+
const raw = input.address;
|
|
158
|
+
let addressText = raw && typeof raw === "object" ? String(raw.name ?? raw.id ?? "") : String(raw).trim();
|
|
159
|
+
if (addressText === "[object Object]") addressText = "";
|
|
160
|
+
if (addressText) {
|
|
161
|
+
try {
|
|
162
|
+
const { resolveAddressRoom } = await import("./create-flow-5FQNNMVO.js");
|
|
163
|
+
const room = await resolveAddressRoom(env, addressText);
|
|
164
|
+
if (room?.name) addressText = room.name;
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (addressText) mainTable.address = addressText;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const { getEsbOperation } = await import("./registry-7FFOXIAW.js");
|
|
172
|
+
const esbEnv = await buildEsbEnv(env);
|
|
173
|
+
const prepare = getEsbOperation("esb.trigger.prepare");
|
|
174
|
+
const apply = getEsbOperation("esb.trigger.apply");
|
|
175
|
+
const pre = await prepare.handler(
|
|
176
|
+
{
|
|
177
|
+
esbFlowId: String(input.flowId ?? "").trim() || DEFAULT_MEETING_GROUP_FLOW_ID,
|
|
178
|
+
employeeId,
|
|
179
|
+
customParams: { mainTable },
|
|
180
|
+
moduleSource: ""
|
|
181
|
+
},
|
|
182
|
+
esbEnv
|
|
183
|
+
);
|
|
184
|
+
const applied = await apply.handler(
|
|
185
|
+
{ continuation: pre?.data?.continuation, confirm: true },
|
|
186
|
+
esbEnv
|
|
187
|
+
);
|
|
188
|
+
if (applied?.ok === false) {
|
|
189
|
+
return {
|
|
190
|
+
actionData: applied?.data ?? null,
|
|
191
|
+
error: String(applied?.error?.message ?? applied?.message ?? "\u5EFA\u7FA4\u52A8\u4F5C\u6D41\u6267\u884C\u5931\u8D25").slice(0, 300)
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return { actionData: applied?.data?.actionData ?? null };
|
|
195
|
+
} catch (error) {
|
|
196
|
+
return { actionData: null, error: String(error?.message ?? error).slice(0, 300) };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async function bindGroupToMeeting(env, meetingId, groupId) {
|
|
200
|
+
const id = String(meetingId).trim();
|
|
201
|
+
const group = String(groupId).trim();
|
|
202
|
+
if (id === "" || group === "") return { ok: false, error: "\u6CA1\u6709\u4F1A\u8BAE id \u6216\u7FA4 id" };
|
|
203
|
+
try {
|
|
204
|
+
const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-6ZFQXQ46.js");
|
|
205
|
+
const session = await env.host.getSession();
|
|
206
|
+
await env.host.request({
|
|
207
|
+
method: "POST",
|
|
208
|
+
path: `${EB_BASE}/updateFormData/change_meeting`,
|
|
209
|
+
query: { id },
|
|
210
|
+
operation: "meeting.eb.meeting.group.ensure",
|
|
211
|
+
body: writeBody(String(session.userId), {
|
|
212
|
+
mainTable: { id, operate_type: "UPDATE", [GROUP_FIELD]: group },
|
|
213
|
+
details: {},
|
|
214
|
+
operateType: {}
|
|
215
|
+
}),
|
|
216
|
+
acceptBusiness: ebBusinessSuccess
|
|
217
|
+
});
|
|
218
|
+
} catch (error) {
|
|
219
|
+
return { ok: false, error: String(error?.message ?? error).slice(0, 300) };
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
const { getMeetingOperation } = await import("./registry-BKBZPBAJ.js");
|
|
223
|
+
const detail = getMeetingOperation("meeting.eb.meeting.detail");
|
|
224
|
+
const read = await detail.handler({ id }, env);
|
|
225
|
+
const main = read?.data?.data ?? read?.data?.main ?? {};
|
|
226
|
+
const value = main[GROUP_FIELD];
|
|
227
|
+
if (value === void 0 || value === null) return { ok: true };
|
|
228
|
+
const text = String(value).trim();
|
|
229
|
+
if (text === group) return { ok: true, readBack: text };
|
|
230
|
+
if (text !== "") return { ok: false, error: `\u56DE\u8BFB\u4E0D\u4E00\u81F4\uFF1A${text}` };
|
|
231
|
+
return { ok: true };
|
|
232
|
+
} catch {
|
|
233
|
+
return { ok: true };
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function searchMyRequests(env, options = {}) {
|
|
237
|
+
try {
|
|
238
|
+
const { getWorkflowOperation } = await import("./registry-RHMW6ANW.js");
|
|
239
|
+
const op = getWorkflowOperation("workflow.search");
|
|
240
|
+
const wfEnv = await buildWorkflowEnv(env);
|
|
241
|
+
const args = { category: "mine", pageSize: 20, sort: "createTime:desc" };
|
|
242
|
+
if (options.sinceMs) {
|
|
243
|
+
const from = formatLocalTime(new Date(options.sinceMs)).slice(0, 16);
|
|
244
|
+
const to = formatLocalTime(/* @__PURE__ */ new Date()).slice(0, 16);
|
|
245
|
+
args.createTime = `${from}~${to}`;
|
|
246
|
+
}
|
|
247
|
+
const res = await op.handler(args, wfEnv);
|
|
248
|
+
const cards = (res?.data?.cards ?? []).map((one) => ({
|
|
249
|
+
requestId: String(one.requestId ?? "").trim(),
|
|
250
|
+
flowName: String(one.flowName ?? "").trim(),
|
|
251
|
+
workflowId: String(one.workflowId ?? "").trim(),
|
|
252
|
+
createdAt: String(one.createdAt ?? one.createTime ?? "").trim()
|
|
253
|
+
})).filter((one) => one.requestId !== "");
|
|
254
|
+
return cards.filter((one) => {
|
|
255
|
+
if (options.workflowId && one.workflowId !== options.workflowId) return false;
|
|
256
|
+
if (options.sinceMs) {
|
|
257
|
+
const created = parseLocalTime(one.createdAt);
|
|
258
|
+
if (created !== 0 && created < options.sinceMs) return false;
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
});
|
|
262
|
+
} catch {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async function resolveMeetingByRequestId(env, requestId, sinceMs) {
|
|
267
|
+
const target = String(requestId).trim();
|
|
268
|
+
if (target === "") return null;
|
|
269
|
+
try {
|
|
270
|
+
const { getMeetingOperation } = await import("./registry-BKBZPBAJ.js");
|
|
271
|
+
const list = getMeetingOperation("meeting.eb.meeting.list");
|
|
272
|
+
const detail = getMeetingOperation("meeting.eb.meeting.detail");
|
|
273
|
+
const page = await list.handler({ pageSize: 30 }, env);
|
|
274
|
+
const rows = (page?.data?.rows ?? []).map((row) => row?.mainTable ?? row ?? {}).filter((main) => String(main.id ?? "").trim() !== "");
|
|
275
|
+
const candidates = rows.filter((main) => {
|
|
276
|
+
const created = parseLocalTime(main.create_time);
|
|
277
|
+
return created === 0 || sinceMs === 0 || created >= sinceMs - 12e4;
|
|
278
|
+
}).slice(0, 10);
|
|
279
|
+
for (const candidate of candidates) {
|
|
280
|
+
const id = String(candidate.id).trim();
|
|
281
|
+
try {
|
|
282
|
+
const read = await detail.handler({ id }, env);
|
|
283
|
+
const main = read?.data?.data ?? read?.data?.main ?? {};
|
|
284
|
+
if (String(main.request_id ?? "").trim() === target) {
|
|
285
|
+
return {
|
|
286
|
+
id,
|
|
287
|
+
name: String(main.mt_name ?? candidate.mt_name ?? "").trim(),
|
|
288
|
+
begin: String(main.begin_datetime ?? candidate.begin_datetime ?? "").trim(),
|
|
289
|
+
requestId: target
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return null;
|
|
296
|
+
} catch {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async function ensureMeetingGroupChat(env, input) {
|
|
301
|
+
const memberIds = (input.memberIds ?? []).map((one) => String(one).trim()).filter((one) => one !== "");
|
|
302
|
+
const pending = input.lookupPending === true ? await loadLatestPending(env) : null;
|
|
303
|
+
let meetingName = String(input.meetingName ?? pending?.mtName ?? "").trim();
|
|
304
|
+
let meetingId = String(input.meetingId ?? "").trim();
|
|
305
|
+
let requestId = String(input.requestId ?? "").trim();
|
|
306
|
+
let meetingLookup = null;
|
|
307
|
+
let requestCandidates;
|
|
308
|
+
if (meetingId === "" && (input.lookupPending === true || requestId !== "")) {
|
|
309
|
+
const sinceMs = parseLocalTime(pending?.preparedAt) || Date.now() - 2 * 36e5;
|
|
310
|
+
if (requestId === "") {
|
|
311
|
+
const requests = await searchMyRequests(env, {
|
|
312
|
+
...pending?.workflowId ? { workflowId: pending.workflowId } : {}
|
|
313
|
+
});
|
|
314
|
+
const baseline = String(pending?.baselineRequestId ?? "").trim();
|
|
315
|
+
const baselineIndex = baseline === "" ? -1 : requests.findIndex((one) => one.requestId === baseline);
|
|
316
|
+
const fresh = baselineIndex > 0 ? requests.slice(0, baselineIndex) : baselineIndex === 0 ? [] : requests.slice(0, 3);
|
|
317
|
+
if (fresh.length === 1) {
|
|
318
|
+
requestId = fresh[0].requestId;
|
|
319
|
+
} else if (fresh.length > 1) {
|
|
320
|
+
requestCandidates = fresh.slice(0, 5).map((one) => ({
|
|
321
|
+
requestId: one.requestId,
|
|
322
|
+
flowName: one.flowName,
|
|
323
|
+
createdAt: one.createdAt
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (requestId !== "") {
|
|
328
|
+
meetingLookup = await resolveMeetingByRequestId(env, requestId, sinceMs);
|
|
329
|
+
if (meetingLookup) {
|
|
330
|
+
meetingId = meetingLookup.id;
|
|
331
|
+
if (meetingName === "") meetingName = meetingLookup.name;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (meetingName === "" && input.groupId === void 0 && pending === null) {
|
|
336
|
+
return {
|
|
337
|
+
ok: false,
|
|
338
|
+
groupId: null,
|
|
339
|
+
groupName: null,
|
|
340
|
+
created: false,
|
|
341
|
+
bound: false,
|
|
342
|
+
meetingId: meetingId || null,
|
|
343
|
+
requestId: requestId || null,
|
|
344
|
+
error: "\u65E2\u6CA1\u6709\u4F1A\u8BAE\u540D\u79F0\uFF0C\u4E5F\u6CA1\u6709\u672C\u673A\u5F85\u7ED1\u8BB0\u5F55/\u7FA4 id\uFF0C\u65E0\u6CD5\u5EFA\u7FA4\u6216\u8865\u7ED1"
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
const knownGroupId = String(input.groupId ?? pending?.groupId ?? "").trim();
|
|
348
|
+
if (knownGroupId !== "") {
|
|
349
|
+
const bound2 = meetingId ? await bindGroupToMeeting(env, meetingId, knownGroupId) : {
|
|
350
|
+
ok: false,
|
|
351
|
+
error: requestCandidates ? "\u540C\u4E00\u65F6\u95F4\u7A97\u6709\u591A\u4E2A\u6D41\u7A0B\u5355\uFF0C\u5148\u8BA9\u7528\u6237\u786E\u8BA4\u662F\u54EA\u4E00\u5F20\uFF08\u89C1 requestCandidates\uFF09\uFF0C\u518D\u4F20 requestId" : requestId ? `\u6D41\u7A0B\u5355 ${requestId} \u5BF9\u5E94\u4E0D\u5230\u4F1A\u8BAE\uFF08\u53EF\u80FD\u8FD8\u5728\u5BA1\u6279\u3001\u6216\u4F1A\u8BAE\u5C1A\u672A\u540C\u6B65\uFF09` : "\u6CA1\u62FF\u5230\u6D41\u7A0B\u5355 id\uFF0C\u65E0\u6CD5\u5B9A\u4F4D\u4F1A\u8BAE"
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
ok: bound2.ok,
|
|
355
|
+
groupId: knownGroupId,
|
|
356
|
+
groupName: pending?.groupName ?? null,
|
|
357
|
+
created: false,
|
|
358
|
+
bound: bound2.ok,
|
|
359
|
+
meetingId: meetingId || null,
|
|
360
|
+
requestId: requestId || null,
|
|
361
|
+
...input.lookupPending === true || requestId !== "" ? { meetingLookup } : {},
|
|
362
|
+
...requestCandidates ? { requestCandidates } : {},
|
|
363
|
+
...bound2.readBack ? { readBack: bound2.readBack } : {},
|
|
364
|
+
...bound2.error ? { error: bound2.error } : {}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
const existing = await findGroupByName(env, meetingName);
|
|
368
|
+
let groupId = existing?.id ?? "";
|
|
369
|
+
let groupName = existing?.name ?? "";
|
|
370
|
+
let created = false;
|
|
371
|
+
let error;
|
|
372
|
+
if (groupId === "") {
|
|
373
|
+
const triggered = await triggerGroupFlow(env, input, meetingName, memberIds);
|
|
374
|
+
error = triggered.error;
|
|
375
|
+
groupId = pickGroupId(triggered.actionData);
|
|
376
|
+
if (groupId === "") {
|
|
377
|
+
const newest = await findGroupWithRetry(env, meetingName);
|
|
378
|
+
groupId = newest?.id ?? "";
|
|
379
|
+
groupName = newest?.name ?? "";
|
|
380
|
+
}
|
|
381
|
+
created = groupId !== "";
|
|
382
|
+
}
|
|
383
|
+
if (groupId === "") {
|
|
384
|
+
return {
|
|
385
|
+
ok: false,
|
|
386
|
+
groupId: null,
|
|
387
|
+
groupName: null,
|
|
388
|
+
created: false,
|
|
389
|
+
bound: false,
|
|
390
|
+
meetingId: meetingId || null,
|
|
391
|
+
requestId: requestId || null,
|
|
392
|
+
...requestCandidates ? { requestCandidates } : {},
|
|
393
|
+
...error ? { error } : { error: "\u5EFA\u7FA4\u52A8\u4F5C\u6D41\u5DF2\u89E6\u53D1\uFF0C\u4F46\u6CA1\u80FD\u53CD\u67E5\u5230\u7FA4 id\uFF08\u7FA4\u540D\u4E0E\u4F1A\u8BAE\u540D\u79F0\u4E0D\u4E00\u81F4\uFF1F\uFF09" }
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (meetingId === "") {
|
|
397
|
+
return {
|
|
398
|
+
ok: true,
|
|
399
|
+
groupId,
|
|
400
|
+
groupName: groupName || meetingName,
|
|
401
|
+
created,
|
|
402
|
+
bound: false,
|
|
403
|
+
meetingId: null,
|
|
404
|
+
requestId: requestId || null,
|
|
405
|
+
...requestCandidates ? { requestCandidates } : {},
|
|
406
|
+
...input.lookupPending === true && !requestCandidates ? { error: "\u7FA4\u5DF2\u5EFA\u597D\uFF0C\u4F46\u8FD8\u6CA1\u627E\u5230\u5BF9\u5E94\u6D41\u7A0B\u5355\uFF08\u53EF\u80FD\u7528\u6237\u8FD8\u6CA1\u63D0\u4EA4\uFF0C\u6216\u521A\u63D0\u4EA4\u8FD8\u6CA1\u540C\u6B65\uFF09" } : {}
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const bound = await bindGroupToMeeting(env, meetingId, groupId);
|
|
410
|
+
return {
|
|
411
|
+
ok: bound.ok,
|
|
412
|
+
groupId,
|
|
413
|
+
groupName: groupName || meetingName,
|
|
414
|
+
created,
|
|
415
|
+
bound: bound.ok,
|
|
416
|
+
meetingId,
|
|
417
|
+
requestId: requestId || null,
|
|
418
|
+
...input.lookupPending === true || requestId !== "" ? { meetingLookup } : {},
|
|
419
|
+
...requestCandidates ? { requestCandidates } : {},
|
|
420
|
+
...bound.readBack ? { readBack: bound.readBack } : {},
|
|
421
|
+
...bound.error ? { error: bound.error } : {}
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
var ebMeetingGroupEnsure = {
|
|
425
|
+
name: "meeting.eb.meeting.group.ensure",
|
|
426
|
+
resource: "eb",
|
|
427
|
+
method: "meeting.eb.meeting.group.ensure",
|
|
428
|
+
action: "meeting.eb.meeting.group.ensure",
|
|
429
|
+
summary: "\u5EFA\u4F1A\u540C\u6B65\u5EFA\u7FA4\u804A\uFF1A\u6309\u4F1A\u8BAE\u540D\u79F0/\u8D77\u6B62/\u53C2\u4F1A\u4EBA\u8C03\u5EFA\u7FA4\u52A8\u4F5C\u6D41\uFF08\u7FA4\u5185\u53D1\u4F1A\u8BAE\u4FE1\u606F\uFF09\uFF0C\u53CD\u67E5\u7FA4 id\uFF1B\u8865\u7ED1\u4F1A\u8BAE\u8BB0\u5F55\u65F6\u6309 requestId \u53CD\u67E5\uFF08\u4E0D\u6309\u4F1A\u8BAE\u540D\u79F0\uFF09",
|
|
430
|
+
capability: "eb.meeting",
|
|
431
|
+
// 建群是写操作但不破坏数据(可解散重建),按「先确认会议要素再调」的口径标注
|
|
432
|
+
risk: "read-before-write",
|
|
433
|
+
inputSchema: schemaOf(
|
|
434
|
+
{
|
|
435
|
+
mt_name: { type: "string", description: "\u5EFA\u4F1A\u65F6\u7684\u4F1A\u8BAE\u540D\u79F0\uFF08=\u7FA4\u540D\u79F0\uFF09\u3002\u8865\u7ED1\u65F6\u53EF\u4E0D\u4F20\uFF0C\u81EA\u52A8\u8BFB\u672C\u673A\u5F85\u7ED1\u8BB0\u5F55" },
|
|
436
|
+
begin_datetime: { type: "string", description: "\u4F1A\u8BAE\u5F00\u59CB\u65F6\u95F4\uFF08yyyy-MM-dd HH:mm\uFF09" },
|
|
437
|
+
end_datetime: { type: "string", description: "\u4F1A\u8BAE\u7ED3\u675F\u65F6\u95F4\uFF08yyyy-MM-dd HH:mm\uFF09" },
|
|
438
|
+
hrm_members: { type: "string", description: "\u53C2\u4F1A\u4EBA\u5458\u5458\u5DE5 id\uFF0C\u9017\u53F7\u5206\u9694\uFF08\u52A8\u4F5C\u6D41\u8981\u6C42 id\uFF0C\u4E0D\u8981\u4F20\u59D3\u540D\uFF09" },
|
|
439
|
+
address: { type: "string", description: "\u4F1A\u8BAE\u5BA4 id\uFF08\u53EF\u9009\uFF09" },
|
|
440
|
+
meetingId: { type: "string", description: "\u4F1A\u8BAE id\uFF1A\u4F20\u4E86\u5C31\u53EA\u505A\u7ED1\u7FA4" },
|
|
441
|
+
requestId: { type: "string", description: "\u6D41\u7A0B\u5355\u636E id\uFF1A\u6309\u5B83\u53CD\u67E5\u4F1A\u8BAE\uFF08\u4F1A\u8BAE\u8BB0\u5F55\u7684 request_id\uFF09\uFF0C\u6BD4\u540D\u79F0\u53EF\u9760" },
|
|
442
|
+
groupId: { type: "string", description: "\u5DF2\u77E5\u7FA4 id\uFF1A\u4F20\u5165\u5219\u8DF3\u8FC7\u5EFA\u7FA4\uFF0C\u76F4\u63A5\u7ED1\u5B9A" },
|
|
443
|
+
lookupPending: {
|
|
444
|
+
type: "boolean",
|
|
445
|
+
description: "\u8865\u7ED1\u6A21\u5F0F\uFF1A\u8BFB\u672C\u673A\u300C\u8868\u5355\u5DF2\u53D1\u51FA\u300D\u8BB0\u5F55\uFF0C\u6309\u6D41\u7A0B\u5355\u53CD\u67E5\u4F1A\u8BAE\u518D\u7ED1\u7FA4\uFF08\u7528\u6237\u70B9\u63D0\u4EA4\u540E\u7528\u8FD9\u4E2A\uFF09"
|
|
446
|
+
},
|
|
447
|
+
flowId: { type: "string", description: `\u8986\u76D6\u5EFA\u7FA4\u52A8\u4F5C\u6D41 id\uFF08\u9ED8\u8BA4 ${DEFAULT_MEETING_GROUP_FLOW_ID}\uFF09` },
|
|
448
|
+
employeeId: { type: "string", description: "\u8986\u76D6\u89E6\u53D1\u4EBA\u5458 id\uFF08\u9ED8\u8BA4\u5F53\u524D\u767B\u5F55\u7528\u6237\uFF09" }
|
|
449
|
+
},
|
|
450
|
+
{}
|
|
451
|
+
),
|
|
452
|
+
handler: async (args, env) => {
|
|
453
|
+
const result = await ensureMeetingGroupChat(env, {
|
|
454
|
+
...args.mt_name ? { meetingName: String(args.mt_name).trim() } : {},
|
|
455
|
+
...args.begin_datetime ? { beginDatetime: String(args.begin_datetime).trim() } : {},
|
|
456
|
+
...args.end_datetime ? { endDatetime: String(args.end_datetime).trim() } : {},
|
|
457
|
+
memberIds: String(args.hrm_members ?? "").split(/[,;,;\s]+/u).map((one) => one.trim()).filter((one) => one !== ""),
|
|
458
|
+
...args.address ? { address: String(args.address).trim() } : {},
|
|
459
|
+
...args.meetingId ? { meetingId: String(args.meetingId).trim() } : {},
|
|
460
|
+
...args.requestId ? { requestId: String(args.requestId).trim() } : {},
|
|
461
|
+
...args.groupId ? { groupId: String(args.groupId).trim() } : {},
|
|
462
|
+
...args.lookupPending === true ? { lookupPending: true } : {},
|
|
463
|
+
...args.flowId ? { flowId: String(args.flowId).trim() } : {},
|
|
464
|
+
...args.employeeId ? { employeeId: String(args.employeeId).trim() } : {}
|
|
465
|
+
});
|
|
466
|
+
if (!result.ok && !result.groupId) {
|
|
467
|
+
throw meetingValidationError(
|
|
468
|
+
"group_create_failed",
|
|
469
|
+
result.error ?? "\u5EFA\u7FA4\u5931\u8D25",
|
|
470
|
+
{ requestId: result.requestId ?? null, requestCandidates: result.requestCandidates ?? [] }
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
const warnings = [];
|
|
474
|
+
if (result.requestCandidates && result.requestCandidates.length > 0) {
|
|
475
|
+
warnings.push(
|
|
476
|
+
`\u540C\u4E00\u65F6\u95F4\u7A97\u67E5\u5230 ${result.requestCandidates.length} \u5F20\u6D41\u7A0B\u5355\uFF0C\u6CA1\u6CD5\u786E\u5B9A\u662F\u54EA\u4E00\u5F20\uFF1A` + result.requestCandidates.map((one) => `${one.flowName || "(\u65E0\u6807\u9898)"} ${one.requestId}`).join("\u3001") + "\u3002\u26D4 \u4E0D\u8981\u81EA\u5DF1\u731C \u2014\u2014 \u8BA9\u7528\u6237\u786E\u8BA4\u662F\u54EA\u4E00\u5F20\uFF0C\u518D\u628A\u5B83\u7684 requestId \u4F20\u8FDB\u6765\u3002"
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
if (result.bound) {
|
|
480
|
+
warnings.push(`\u7FA4\u5DF2\u7ED1\u5B9A\u5230\u4F1A\u8BAE\u8BB0\u5F55\uFF08imchat_groupid=${result.groupId}${result.readBack ? "\uFF0C\u56DE\u8BFB\u4E00\u81F4" : ""}\uFF09\u3002`);
|
|
481
|
+
} else if (!result.meetingId) {
|
|
482
|
+
warnings.push(
|
|
483
|
+
result.error ? `\u7FA4\u5DF2\u5EFA\u597D\uFF08\u7FA4 id ${result.groupId}\uFF09\uFF0C\u4F46\u8FD8\u6CA1\u7ED1\u4E0A\uFF1A${result.error}` : "\u7FA4\u5DF2\u5EFA\u597D\uFF0C\u4F46\u8FD8\u6CA1\u6709\u4F1A\u8BAE id\uFF1A\u7528\u6237\u63D0\u4EA4\u540E\u5E26 lookupPending:true\uFF08\u6216 requestId\uFF09\u518D\u8DD1\u4E00\u6B21\u5373\u53EF\u8865\u7ED1\u3002"
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
return meetingSuccess(
|
|
487
|
+
"meeting.eb.meeting.group.ensure",
|
|
488
|
+
{ ...result },
|
|
489
|
+
warnings.length > 0 ? { warnings } : {}
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
var meetingEbGroupChatOperations = [ebMeetingGroupEnsure];
|
|
494
|
+
|
|
495
|
+
export {
|
|
496
|
+
DEFAULT_MEETING_GROUP_FLOW_ID,
|
|
497
|
+
buildImEnv,
|
|
498
|
+
savePendingForm,
|
|
499
|
+
ensureMeetingGroupChat,
|
|
500
|
+
meetingEbGroupChatOperations
|
|
501
|
+
};
|