feat(simulation): 支持单租户未发布草稿快照、已发布版本回溯与每刻报销接入
- 模拟测试原生支持 ruleSource:默认保持以线上生效规则运行(无破坏性变更);显式传递 --draft 对未发布草稿拍摄不可变快照;传递 --rule-version <versionId> 回溯指定历史发布版本。 - 单租户原地即可闭环草稿模拟验证与多版本对比,彻底解耦对双企业组(corps sync-test 强制预发版)的硬依赖。 - 新增每刻报销(maycur / maycur-standard)来源系统支持,引入 --form-codes 单号批量测试并自动解析租户 signKey。 - 完善 simulation create 参数解析器、Zod 类型定义、Help 文档与 Skill 决策工作流规约。
This commit is contained in:
1 parent
03189c072d
commit
d25c09c3be
11 files changed
+247
-74
No files matched your search
@@ -87,6 +87,31 @@ export async function handleSimulationCommand(
|
||||
);
|
||||
}
|
||||
|
||||
const isDraft =
|
||||
booleanOption(args.options.draft) ||
|
||||
booleanOption(args.options.current) ||
|
||||
booleanOption(args.options["current-rules"]) ||
|
||||
booleanOption(args.options.currentRules) ||
|
||||
stringOption(args.options.ruleSource) === "current" ||
|
||||
stringOption(args.options["rule-source"]) === "current";
|
||||
|
||||
const ruleVersion =
|
||||
stringOption(args.options.ruleVersion) ??
|
||||
stringOption(args.options["rule-version"]) ??
|
||||
stringOption(args.options["rule-version-id"]) ??
|
||||
stringOption(args.options.ruleVersionId);
|
||||
|
||||
let ruleSource: { type: "current" } | { type: "published"; versionId: string } | undefined;
|
||||
if (isDraft) {
|
||||
ruleSource = { type: "current" };
|
||||
} else if (ruleVersion) {
|
||||
ruleSource = { type: "published", versionId: ruleVersion };
|
||||
}
|
||||
|
||||
const formCodes =
|
||||
splitOption(args.options.formCodes) ??
|
||||
splitOption(args.options["form-codes"]);
|
||||
|
||||
const result = await runCapabilityResult(
|
||||
"sealSimulationBatchCreate",
|
||||
client,
|
||||
@@ -96,11 +121,14 @@ export async function handleSimulationCommand(
|
||||
sourceSystem: mode,
|
||||
flowIds,
|
||||
documentSn: flowIds,
|
||||
formCodes,
|
||||
rejectNodeName: stringOption(args.options.rejectNode) ?? stringOption(args.options["reject-node"]) ?? null,
|
||||
thinkingDepthOverride: stringOption(args.options.thinkingDepth) ?? stringOption(args.options["thinking-depth"]),
|
||||
skipInvoiceGeneration: booleanOption(args.options.skipInvoiceGeneration) ?? booleanOption(args.options["skip-invoice-generation"]),
|
||||
skipExpenseExtraction,
|
||||
disableAttachmentCache: booleanOption(args.options.disableAttachmentCache) ?? booleanOption(args.options["disable-attachment-cache"]),
|
||||
ruleSource,
|
||||
ruleVersion,
|
||||
signKey,
|
||||
packageIds,
|
||||
packageId,
|
||||
|
||||
+4
-3
@@ -849,10 +849,11 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "create",
|
||||
summary: "Trigger a simulation batch (reuses an identical batch within the reuse window; defaults to skipping background expense DB extraction)",
|
||||
summary: "Trigger a simulation batch (reuses an identical batch within the reuse window; defaults to skipping background expense DB extraction; defaults to latest published rules; pass --draft for unreleased draft snapshot)",
|
||||
usage: [
|
||||
"seal-use simulation create --mode hosecloud --flow-ids \"B26017701,B26022501\" [--wait] [--timeout 10m] [--poll-interval 2s] [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-extract|--extract] [--skip-invoice-generation] [--no-wait] [--force] [--reuse-window 5m] [--corp <corpId>]",
|
||||
"seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]",
|
||||
"seal-use simulation create --mode hosecloud --flow-ids \"B26017701,B26022501\" [--wait] [--timeout 10m] [--poll-interval 2s] [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-extract|--extract] [--skip-invoice-generation] [--no-wait] [--force] [--reuse-window 5m] [--draft] [--rule-version <versionId>] [--corp <corpId>]",
|
||||
"seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--draft] [--rule-version <versionId>] [--corp <corpId>]",
|
||||
"seal-use simulation create --mode maycur --form-codes \"MC001,MC002\" [--draft] [--corp <corpId>]",
|
||||
"seal-use simulation create --source-system weaver --request-ids \"req-01,req-02\" [--corp <corpId>]"
|
||||
]
|
||||
},
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ export const BOOLEAN_FLAGS = new Set([
|
||||
"V", "add", "all", "allow-unreviewed", "allowUnreviewed", "as-hose", "attachments", "auto",
|
||||
"auto-login", "autoLogin", "bg-save", "changelog", "check", "check-only",
|
||||
"completed-only", "completedOnly", "confirm", "count", "disable-attachment-cache", "disableAttachmentCache",
|
||||
"download", "downloads", "dry-run", "dryRun", "elevate-hose", "enabled",
|
||||
"download", "downloads", "draft", "current", "dry-run", "dryRun", "elevate-hose", "enabled",
|
||||
"exclude-deleted", "extract", "extract-expenses", "extractExpenses", "fail-on-flips", "flow", "force", "full", "glossary", "has-input", "has-output", "help",
|
||||
"has-extra-risk", "hasExtraRisk", "hose", "hose-outbound", "hose-sso", "hoseOutbound", "hoseSso", "include-deleted", "include-io-preview", "include-simulation", "include-unchanged",
|
||||
"include-bridge", "includeBridge", "includeSimulation", "includeUnchanged", "local", "no-attachments", "no-flow", "no-glossary",
|
||||
@@ -54,7 +54,7 @@ export const VALUE_FLAGS = new Set([
|
||||
"documentId", "document-limit", "documentLimit", "documentSn", "documentType", "domain", "enable",
|
||||
"end", "end-date", "end-time", "endDate", "endTime", "env",
|
||||
"environment", "expire", "expires-in", "expiresIn", "fields", "file", "file-id", "file-name", "flow-concurrency",
|
||||
"flow-id", "flow-ids", "flow-status-list", "flowId", "flowIds", "flowStatusList", "format", "from",
|
||||
"flow-id", "flow-ids", "flow-status-list", "flowId", "flowIds", "flowStatusList", "form-codes", "formCodes", "format", "from",
|
||||
"from-link", "host", "hours", "human", "human-accuracy", "humanAccuracy", "human-result", "humanResult", "id", "input", "integration",
|
||||
"json", "json-path", "key-id", "keyId", "keyword", "ledger", "level", "limit",
|
||||
"lines", "link", "linter", "manual-approval-status", "manual-status", "manualApprovalStatus", "manualStatus",
|
||||
@@ -70,7 +70,7 @@ export const VALUE_FLAGS = new Set([
|
||||
"reviewed-by", "reviewedBy",
|
||||
"report-id",
|
||||
"repo", "request-ids", "requestIds", "resubmit-method", "resubmitMethod", "result-url", "resultUrl", "reuse-window",
|
||||
"reuseWindow", "rule", "rule-hints", "rule-id", "ruleId", "rule-version", "ruleVersion", "runtime-id",
|
||||
"reuseWindow", "rule", "rule-hints", "rule-id", "ruleId", "rule-source", "ruleSource", "rule-version", "ruleVersion", "rule-version-id", "ruleVersionId", "runtime-id",
|
||||
"runtimeId", "samples", "scenarios", "schema-config", "schemaConfig", "scope",
|
||||
"sealUrl", "search", "secret", "selector", "session-id", "sign-key", "signKey",
|
||||
"simulation-batch-id", "simulationBatchId", "since", "sn", "sn-prefix", "sn-suffix", "snPrefix",
|
||||
|
||||
@@ -88,6 +88,8 @@ import {
|
||||
SimulationIntegrationStatusSchema,
|
||||
SimulationHosecloudIntegration,
|
||||
SimulationHosecloudIntegrationSchema,
|
||||
SimulationMaycurIntegration,
|
||||
SimulationMaycurIntegrationSchema,
|
||||
MaterialPackage,
|
||||
MaterialPackageSchema,
|
||||
SimulationSpecification,
|
||||
@@ -824,6 +826,22 @@ export async function listSimulationHosecloudIntegrations(
|
||||
return z.array(SimulationHosecloudIntegrationSchema).parse(data);
|
||||
}
|
||||
|
||||
export async function listSimulationMaycurPrivateIntegrations(
|
||||
client: KyInstance
|
||||
): Promise<SimulationMaycurIntegration[]> {
|
||||
const json = (await client.get("api/v1/simulation/maycur-private-integrations").json()) as { data?: unknown };
|
||||
const data = json.data ?? json;
|
||||
return z.array(SimulationMaycurIntegrationSchema).parse(data);
|
||||
}
|
||||
|
||||
export async function listSimulationMaycurStandardIntegrations(
|
||||
client: KyInstance
|
||||
): Promise<SimulationMaycurIntegration[]> {
|
||||
const json = (await client.get("api/v1/simulation/maycur-standard-integrations").json()) as { data?: unknown };
|
||||
const data = json.data ?? json;
|
||||
return z.array(SimulationMaycurIntegrationSchema).parse(data);
|
||||
}
|
||||
|
||||
export async function cleanSimulationBatch(
|
||||
client: KyInstance,
|
||||
batchId: string
|
||||
|
||||
@@ -21,6 +21,7 @@ import type {
|
||||
ApprovalRun,
|
||||
RuleSetVersion,
|
||||
SimulationBatch,
|
||||
SimulationRuleSourceInput,
|
||||
WebhookIntegration
|
||||
} from "../types.js";
|
||||
import { extractApprovalRunAttachments } from "../approval-runs/attachments.js";
|
||||
@@ -230,39 +231,18 @@ export function normalizeRuleStrictness(value?: string): string {
|
||||
}
|
||||
|
||||
export type SimulationBatchCreateInput = {
|
||||
mode?: string;
|
||||
sourceSystem?: string;
|
||||
flowIds?: string[];
|
||||
documentSn?: string | string[];
|
||||
mode?: string; sourceSystem?: string; signKey?: string;
|
||||
flowIds?: string[]; documentSn?: string | string[]; formCodes?: string[];
|
||||
rejectNodeName?: string | null;
|
||||
thinkingDepthOverride?: "default" | "medium" | "high";
|
||||
skipInvoiceGeneration?: boolean;
|
||||
skipExpenseExtraction?: boolean;
|
||||
disableAttachmentCache?: boolean;
|
||||
signKey?: string;
|
||||
packageIds?: string[];
|
||||
packageId?: string;
|
||||
templateId?: string;
|
||||
schemaConfig?: Record<string, unknown>;
|
||||
approvalCode?: string;
|
||||
nodeId?: string;
|
||||
runMode?: string;
|
||||
requestIds?: string[];
|
||||
workflowTypeId?: string;
|
||||
flowStatusList?: number[];
|
||||
businessCodes?: string[];
|
||||
documentType?: string;
|
||||
formCodes?: string[];
|
||||
formSubTypeBizCode?: string;
|
||||
formStatus?: string;
|
||||
pageNo?: number;
|
||||
pageSize?: number;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
status?: string[];
|
||||
limit?: number;
|
||||
// 预留:其他取数模式(如合思时间范围)透传参数,覆盖构建结果
|
||||
rawParams?: Record<string, unknown>;
|
||||
skipInvoiceGeneration?: boolean; skipExpenseExtraction?: boolean; disableAttachmentCache?: boolean;
|
||||
ruleSource?: SimulationRuleSourceInput; ruleVersion?: string;
|
||||
packageIds?: string[]; packageId?: string; templateId?: string;
|
||||
schemaConfig?: Record<string, unknown>; approvalCode?: string; nodeId?: string; runMode?: string;
|
||||
requestIds?: string[]; workflowTypeId?: string; flowStatusList?: number[]; businessCodes?: string[];
|
||||
documentType?: string; formSubTypeBizCode?: string; formStatus?: string;
|
||||
pageNo?: number; pageSize?: number; startTime?: number; endTime?: number;
|
||||
status?: string[]; limit?: number; rawParams?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export function redactIntegrationSecrets(integration: Record<string, unknown>) {
|
||||
@@ -320,6 +300,12 @@ export function buildSimulationBatchParams(input: SimulationBatchCreateInput): R
|
||||
thinkingDepthOverride: input.thinkingDepthOverride ?? "default",
|
||||
disableAttachmentCache: input.disableAttachmentCache ?? false
|
||||
};
|
||||
const resolvedRuleSource =
|
||||
input.ruleSource ??
|
||||
(input.ruleVersion ? { type: "published", versionId: input.ruleVersion } : undefined);
|
||||
if (resolvedRuleSource) {
|
||||
params.ruleSource = resolvedRuleSource;
|
||||
}
|
||||
|
||||
const docSns = input.flowIds ?? (typeof input.documentSn === "string" ? input.documentSn.split(",").map((s) => s.trim()).filter(Boolean) : input.documentSn);
|
||||
|
||||
@@ -376,17 +362,21 @@ export function buildSimulationBatchParams(input: SimulationBatchCreateInput): R
|
||||
rejectNodeName: input.rejectNodeName ?? null
|
||||
});
|
||||
} else if (sourceSystem === "maycur" || sourceSystem === "maycur-standard") {
|
||||
Object.assign(params, {
|
||||
sourceSystem,
|
||||
formCodes: input.formCodes ?? docSns,
|
||||
createdAtStart: input.startTime,
|
||||
createdAtEnd: input.endTime,
|
||||
formSubTypeBizCode: input.formSubTypeBizCode,
|
||||
formStatus: input.formStatus,
|
||||
pageNo: input.pageNo ?? 1,
|
||||
pageSize: input.pageSize ?? 100,
|
||||
signKey: input.signKey
|
||||
});
|
||||
const formCodes = input.formCodes ?? docSns;
|
||||
if (formCodes?.length) {
|
||||
Object.assign(params, { sourceSystem, formCodes, ...(input.signKey ? { signKey: input.signKey } : {}) });
|
||||
} else {
|
||||
Object.assign(params, {
|
||||
sourceSystem,
|
||||
createdAtStart: input.startTime,
|
||||
createdAtEnd: input.endTime,
|
||||
formSubTypeBizCode: input.formSubTypeBizCode,
|
||||
formStatus: input.formStatus,
|
||||
pageNo: input.pageNo ?? 1,
|
||||
pageSize: input.pageSize ?? 100,
|
||||
signKey: input.signKey
|
||||
});
|
||||
}
|
||||
} else if (sourceSystem === "feishu") {
|
||||
Object.assign(params, {
|
||||
sourceSystem: "feishu",
|
||||
@@ -418,6 +408,7 @@ export function summarizeSimulationBatch(batch: SimulationBatch) {
|
||||
failedCount: batch.failedCount,
|
||||
createdCount: batch.createdCount,
|
||||
createFailedCount: batch.createFailedCount,
|
||||
ruleSource: batch.ruleSource,
|
||||
requestSummary: batch.requestSummary,
|
||||
resultSummary: batch.resultSummary,
|
||||
createdAt: batch.createdAt
|
||||
|
||||
@@ -324,6 +324,29 @@ describe("buildSimulationBatchParams", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("builds request payload with specified ruleVersion", () => {
|
||||
const params = buildSimulationBatchParams({
|
||||
mode: "hosecloud",
|
||||
flowIds: ["B26017701"],
|
||||
signKey: SIGN_KEY,
|
||||
ruleVersion: "01a123bd-ef1c-7579-8ebc-3c02058c9c72"
|
||||
});
|
||||
expect(params.ruleSource).toEqual({
|
||||
type: "published",
|
||||
versionId: "01a123bd-ef1c-7579-8ebc-3c02058c9c72"
|
||||
});
|
||||
});
|
||||
|
||||
test("builds request payload with explicit ruleSource", () => {
|
||||
const params = buildSimulationBatchParams({
|
||||
mode: "hosecloud",
|
||||
flowIds: ["B26017701"],
|
||||
signKey: SIGN_KEY,
|
||||
ruleSource: { type: "current" }
|
||||
});
|
||||
expect(params.ruleSource).toEqual({ type: "current" });
|
||||
});
|
||||
|
||||
test("rejects hosecloud mode without flowIds", () => {
|
||||
expect(() => buildSimulationBatchParams({ mode: "hosecloud", signKey: SIGN_KEY }))
|
||||
.toThrow("hosecloud 模式需要提供 flowIds");
|
||||
|
||||
@@ -5,7 +5,9 @@ import { readFileSync } from "node:fs";
|
||||
import { formatBeijingIso } from "../../../core/config/timestamps.js";
|
||||
import * as api from "../api.js";
|
||||
import {
|
||||
type SimulationBatch
|
||||
type SimulationBatch,
|
||||
SimulationRuleSourceInputSchema,
|
||||
type SimulationRuleSourceInput
|
||||
} from "../types.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
import { parseDurationMs } from "../../../core/duration.js";
|
||||
@@ -85,16 +87,21 @@ export const simulationCapabilities = [
|
||||
},
|
||||
{
|
||||
name: "sealSimulationBatchCreate",
|
||||
description: "创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;默认幂等:复用窗口内同 flow-ids/packageIds 的既有批次直接返回不重复扣费(--force 跳过);其他取数模式通过 rawParams 预留透传。",
|
||||
description: "创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)、每刻报销(maycur/maycur-standard)、泛微(weaver)、汇联易(helios)与材料包导入(material_pack)模式;默认以线上生效规则运行,支持 ruleSource.type=current 或 --draft 显式拍摄未发布草稿快照,或指定 ruleVersion 回溯已发布版本;默认幂等:复用窗口内同 flow-ids/packageIds 的既有批次直接返回不重复扣费(--force 跳过);其他取数模式通过 rawParams 预留透传。",
|
||||
parameters: z.object({
|
||||
mode: z.enum(["hosecloud", "material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),
|
||||
flowIds: z.array(z.string()).max(100).optional().describe("合思模式: 单据流水号列表"),
|
||||
mode: z.enum(["hosecloud", "material_pack", "weaver", "helios", "maycur", "maycur-standard"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入; weaver=泛微OA; helios=汇联易; maycur=每刻报销私有版; maycur-standard=每刻报销标准版"),
|
||||
sourceSystem: z.string().optional().describe("来源系统,缺省同 mode"),
|
||||
flowIds: z.array(z.string()).max(100).optional().describe("合思/通用单据流水号列表"),
|
||||
documentSn: z.union([z.string(), z.array(z.string())]).optional().describe("单据编号(别名)"),
|
||||
formCodes: z.array(z.string()).max(100).optional().describe("每刻报销单号列表"),
|
||||
rejectNodeName: z.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),
|
||||
thinkingDepthOverride: z.enum(["default", "medium", "high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),
|
||||
skipInvoiceGeneration: z.boolean().optional().describe("跳过发票生成, 默认 true"),
|
||||
skipExpenseExtraction: z.boolean().optional().describe("跳过后台历史费用明细库提取(防重报检索用), 默认 true"),
|
||||
disableAttachmentCache: z.boolean().optional().describe("不使用附件缓存, 默认 false"),
|
||||
signKey: z.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),
|
||||
ruleSource: SimulationRuleSourceInputSchema.optional().describe("规则来源: { type: 'current' } 或 { type: 'published', versionId: '...' }"),
|
||||
ruleVersion: z.string().optional().describe("指定已发布规则版本 ID (等同于 ruleSource.type=published)"),
|
||||
signKey: z.string().optional().describe("合思/每刻集成标识; 缺省时自动取对应集成"),
|
||||
packageIds: z.array(z.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),
|
||||
templateId: z.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),
|
||||
schemaConfig: z.record(z.string(), z.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),
|
||||
@@ -106,13 +113,18 @@ export const simulationCapabilities = [
|
||||
handler: async (
|
||||
client: KyInstance,
|
||||
params: {
|
||||
mode?: "hosecloud" | "material_pack";
|
||||
mode?: "hosecloud" | "material_pack" | "weaver" | "helios" | "maycur" | "maycur-standard";
|
||||
sourceSystem?: string;
|
||||
flowIds?: string[];
|
||||
documentSn?: string | string[];
|
||||
formCodes?: string[];
|
||||
rejectNodeName?: string | null;
|
||||
thinkingDepthOverride?: "default" | "medium" | "high";
|
||||
skipInvoiceGeneration?: boolean;
|
||||
skipExpenseExtraction?: boolean;
|
||||
disableAttachmentCache?: boolean;
|
||||
ruleSource?: SimulationRuleSourceInput;
|
||||
ruleVersion?: string;
|
||||
signKey?: string;
|
||||
packageIds?: string[];
|
||||
templateId?: string;
|
||||
@@ -123,7 +135,7 @@ export const simulationCapabilities = [
|
||||
rawParams?: Record<string, unknown>;
|
||||
}
|
||||
) => {
|
||||
const mode = params.mode ?? "hosecloud";
|
||||
const mode = params.mode ?? (params.sourceSystem as typeof params.mode) ?? "hosecloud";
|
||||
let signKey = params.signKey;
|
||||
if (mode === "hosecloud" && !signKey) {
|
||||
const integrations = await api.listSimulationHosecloudIntegrations(client);
|
||||
@@ -131,16 +143,27 @@ export const simulationCapabilities = [
|
||||
if (!signKey) {
|
||||
throw validationError("未找到合思集成 signKey, 请通过 signKey 参数提供");
|
||||
}
|
||||
} else if (mode === "maycur" && !signKey) {
|
||||
const integrations = await api.listSimulationMaycurPrivateIntegrations(client).catch(() => []);
|
||||
signKey = integrations.find((item) => item.signKey)?.signKey;
|
||||
} else if (mode === "maycur-standard" && !signKey) {
|
||||
const integrations = await api.listSimulationMaycurStandardIntegrations(client).catch(() => []);
|
||||
signKey = integrations.find((item) => item.signKey)?.signKey;
|
||||
}
|
||||
|
||||
const payload = buildSimulationBatchParams({
|
||||
mode,
|
||||
sourceSystem: params.sourceSystem ?? mode,
|
||||
flowIds: params.flowIds,
|
||||
documentSn: params.documentSn,
|
||||
formCodes: params.formCodes,
|
||||
rejectNodeName: params.rejectNodeName,
|
||||
thinkingDepthOverride: params.thinkingDepthOverride,
|
||||
skipInvoiceGeneration: params.skipInvoiceGeneration,
|
||||
skipExpenseExtraction: params.skipExpenseExtraction,
|
||||
disableAttachmentCache: params.disableAttachmentCache,
|
||||
ruleSource: params.ruleSource,
|
||||
ruleVersion: params.ruleVersion,
|
||||
signKey,
|
||||
packageIds: params.packageIds,
|
||||
templateId: params.templateId,
|
||||
@@ -361,14 +384,16 @@ export const simulationCapabilities = [
|
||||
},
|
||||
{
|
||||
name: "sealSimulationIntegrationsGet",
|
||||
description: "查询模拟测试可用的来源集成状态与合思集成选项(signKey 等)",
|
||||
description: "查询模拟测试可用的来源集成状态与合思/每刻集成选项(signKey 等)",
|
||||
parameters: z.object({}),
|
||||
handler: async (client: KyInstance) => {
|
||||
const [status, hosecloudIntegrations] = await Promise.all([
|
||||
const [status, hosecloudIntegrations, maycurPrivateIntegrations, maycurStandardIntegrations] = await Promise.all([
|
||||
api.getSimulationIntegrationStatus(client),
|
||||
api.listSimulationHosecloudIntegrations(client)
|
||||
api.listSimulationHosecloudIntegrations(client).catch(() => []),
|
||||
api.listSimulationMaycurPrivateIntegrations(client).catch(() => []),
|
||||
api.listSimulationMaycurStandardIntegrations(client).catch(() => [])
|
||||
]);
|
||||
return { status, hosecloudIntegrations };
|
||||
return { status, hosecloudIntegrations, maycurPrivateIntegrations, maycurStandardIntegrations };
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -238,6 +238,9 @@ export const ApprovalRunSchema = z.object({
|
||||
ruleSetVersionNumber: z.number().optional(),
|
||||
ruleSetPublishedAt: z.number().optional(),
|
||||
ruleSetPublishedByName: z.string().optional(),
|
||||
ruleSetSnapshotCreatedAt: z.number().optional(),
|
||||
thinkingDepthLevel: z.string().optional(),
|
||||
durationMs: z.number().optional(),
|
||||
createdAt: z.union([z.string(), z.number()]).optional(),
|
||||
updatedAt: z.union([z.string(), z.number()]).optional()
|
||||
}).passthrough();
|
||||
@@ -480,7 +483,9 @@ export const SimulationBatchParamsSchema = z.object({
|
||||
packageIds: z.array(z.string()).optional(),
|
||||
packageLabel: z.string().optional(),
|
||||
runMode: z.string().optional(),
|
||||
schemaConfig: SimulationSchemaConfigSchema.optional()
|
||||
schemaConfig: SimulationSchemaConfigSchema.optional(),
|
||||
ruleSource: z.unknown().optional(),
|
||||
formCodes: z.array(z.string()).optional()
|
||||
}).passthrough();
|
||||
|
||||
export const SimulationRequestSummarySchema = z.object({
|
||||
@@ -498,6 +503,34 @@ export const SimulationResultSummarySchema = z.object({
|
||||
message: z.string().optional()
|
||||
}).passthrough();
|
||||
|
||||
export const SimulationRuleSourceSchema = z.discriminatedUnion("type", [
|
||||
z.object({
|
||||
type: z.literal("snapshot"),
|
||||
snapshotId: z.string(),
|
||||
createdAt: z.number().optional()
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("published"),
|
||||
versionId: z.string(),
|
||||
versionNumber: z.number().optional()
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("current")
|
||||
})
|
||||
]);
|
||||
export type SimulationRuleSource = z.infer<typeof SimulationRuleSourceSchema>;
|
||||
|
||||
export const SimulationRuleSourceInputSchema = z.discriminatedUnion("type", [
|
||||
z.object({
|
||||
type: z.literal("current")
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("published"),
|
||||
versionId: z.string().min(1)
|
||||
})
|
||||
]);
|
||||
export type SimulationRuleSourceInput = z.infer<typeof SimulationRuleSourceInputSchema>;
|
||||
|
||||
export const SimulationBatchSchema = z.object({
|
||||
id: z.string(),
|
||||
tenantId: z.string().optional(),
|
||||
@@ -514,6 +547,7 @@ export const SimulationBatchSchema = z.object({
|
||||
params: SimulationBatchParamsSchema.optional(),
|
||||
requestSummary: SimulationRequestSummarySchema.nullable().optional(),
|
||||
resultSummary: SimulationResultSummarySchema.nullable().optional(),
|
||||
ruleSource: SimulationRuleSourceSchema.optional(),
|
||||
createdAt: z.union([z.string(), z.number()]).optional(),
|
||||
updatedAt: z.union([z.string(), z.number()]).optional()
|
||||
}).passthrough();
|
||||
@@ -556,6 +590,13 @@ export const SimulationHosecloudIntegrationSchema = z.object({
|
||||
corporationId: z.string().optional()
|
||||
}).passthrough();
|
||||
|
||||
export const SimulationMaycurIntegrationSchema = z.object({
|
||||
signKey: z.string(),
|
||||
displayName: z.string(),
|
||||
sourceSystem: z.enum(["maycur", "maycur-standard"]).optional()
|
||||
}).passthrough();
|
||||
export type SimulationMaycurIntegration = z.infer<typeof SimulationMaycurIntegrationSchema>;
|
||||
|
||||
export const MaterialPackageSchema = z.object({
|
||||
id: z.string(),
|
||||
tenantId: z.string().optional(),
|
||||
|
||||
Reference in new issue
Block a user