weaver-e10-builder 1.0.7-beta → 1.0.9-beta
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/dist/commands/actionflow.d.ts +7 -0
- package/dist/commands/actionflow.d.ts.map +1 -0
- package/dist/commands/actionflow.js +105 -0
- package/dist/commands/actionflow.js.map +1 -0
- package/dist/commands/auth.js +1 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/form-list.d.ts.map +1 -1
- package/dist/commands/form-list.js +18 -9
- package/dist/commands/form-list.js.map +1 -1
- package/dist/commands/form-native.d.ts +0 -14
- package/dist/commands/form-native.d.ts.map +1 -1
- package/dist/commands/form-native.js +398 -72
- package/dist/commands/form-native.js.map +1 -1
- package/dist/commands/form.d.ts.map +1 -1
- package/dist/commands/form.js +5 -2
- package/dist/commands/form.js.map +1 -1
- package/dist/commands/wf-form.d.ts.map +1 -1
- package/dist/commands/wf-form.js +872 -42
- package/dist/commands/wf-form.js.map +1 -1
- package/dist/commands/workflow-action.d.ts +11 -0
- package/dist/commands/workflow-action.d.ts.map +1 -1
- package/dist/commands/workflow-action.js +13 -1586
- package/dist/commands/workflow-action.js.map +1 -1
- package/dist/commands/workflow-create-workflow.d.ts.map +1 -1
- package/dist/commands/workflow-create-workflow.js +111 -30
- package/dist/commands/workflow-create-workflow.js.map +1 -1
- package/dist/commands/workflow-node-robot.js +1 -1
- package/dist/commands/workflow-node-robot.js.map +1 -1
- package/dist/commands/workflow-node-validate.d.ts.map +1 -1
- package/dist/commands/workflow-node-validate.js +56 -45
- package/dist/commands/workflow-node-validate.js.map +1 -1
- package/dist/commands/workflow-numbering.d.ts.map +1 -1
- package/dist/commands/workflow-numbering.js +98 -2
- package/dist/commands/workflow-numbering.js.map +1 -1
- package/dist/commands/workflow-operator-sign.d.ts +3 -0
- package/dist/commands/workflow-operator-sign.d.ts.map +1 -0
- package/dist/commands/workflow-operator-sign.js +118 -0
- package/dist/commands/workflow-operator-sign.js.map +1 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +83 -6
- package/dist/commands/workflow.js.map +1 -1
- package/dist/core/client.d.ts +2 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +2 -0
- package/dist/core/client.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/services/actionflow/build_workflow_draft.d.ts +20 -0
- package/dist/services/actionflow/build_workflow_draft.d.ts.map +1 -0
- package/dist/services/actionflow/build_workflow_draft.js +222 -0
- package/dist/services/actionflow/build_workflow_draft.js.map +1 -0
- package/dist/services/actionflow/calendar_mapper.d.ts +3 -0
- package/dist/services/actionflow/calendar_mapper.d.ts.map +1 -0
- package/dist/services/actionflow/calendar_mapper.js +152 -0
- package/dist/services/actionflow/calendar_mapper.js.map +1 -0
- package/dist/services/actionflow/component_registry.d.ts +13 -0
- package/dist/services/actionflow/component_registry.d.ts.map +1 -0
- package/dist/services/actionflow/component_registry.js +213 -0
- package/dist/services/actionflow/component_registry.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_add.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_add.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_add.js +127 -0
- package/dist/services/actionflow/components/action_eb_add.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.js +13 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_delete.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete.js +69 -0
- package/dist/services/actionflow/components/action_eb_delete.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.js +7 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_recover.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover.js +28 -0
- package/dist/services/actionflow/components/action_eb_recover.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.js +16 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_save_version.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version.js +30 -0
- package/dist/services/actionflow/components/action_eb_save_version.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.js +15 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_update.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_update.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_update.js +154 -0
- package/dist/services/actionflow/components/action_eb_update.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts +16 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.js +94 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -0
- package/dist/services/actionflow/components/approve_create.d.ts +3 -0
- package/dist/services/actionflow/components/approve_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_create.js +44 -0
- package/dist/services/actionflow/components/approve_create.js.map +1 -0
- package/dist/services/actionflow/components/approve_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/approve_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_trigger.js +184 -0
- package/dist/services/actionflow/components/approve_trigger.js.map +1 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.js +20 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.js.map +1 -0
- package/dist/services/actionflow/components/condition.d.ts +3 -0
- package/dist/services/actionflow/components/condition.d.ts.map +1 -0
- package/dist/services/actionflow/components/condition.js +23 -0
- package/dist/services/actionflow/components/condition.js.map +1 -0
- package/dist/services/actionflow/components/date_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/date_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/date_trigger.js +129 -0
- package/dist/services/actionflow/components/date_trigger.js.map +1 -0
- package/dist/services/actionflow/components/document_actions.d.ts +28 -0
- package/dist/services/actionflow/components/document_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/document_actions.js +266 -0
- package/dist/services/actionflow/components/document_actions.js.map +1 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.d.ts +5 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.d.ts.map +1 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.js +44 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.js.map +1 -0
- package/dist/services/actionflow/components/enquiry_form.d.ts +5 -0
- package/dist/services/actionflow/components/enquiry_form.d.ts.map +1 -0
- package/dist/services/actionflow/components/enquiry_form.js +100 -0
- package/dist/services/actionflow/components/enquiry_form.js.map +1 -0
- package/dist/services/actionflow/components/event_form_data.d.ts +3 -0
- package/dist/services/actionflow/components/event_form_data.d.ts.map +1 -0
- package/dist/services/actionflow/components/event_form_data.js +29 -0
- package/dist/services/actionflow/components/event_form_data.js.map +1 -0
- package/dist/services/actionflow/components/hrm_actions.d.ts +7 -0
- package/dist/services/actionflow/components/hrm_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/hrm_actions.js +138 -0
- package/dist/services/actionflow/components/hrm_actions.js.map +1 -0
- package/dist/services/actionflow/components/index.d.ts +32 -0
- package/dist/services/actionflow/components/index.d.ts.map +1 -0
- package/dist/services/actionflow/components/index.js +132 -0
- package/dist/services/actionflow/components/index.js.map +1 -0
- package/dist/services/actionflow/components/logic_flow_set.d.ts +10 -0
- package/dist/services/actionflow/components/logic_flow_set.d.ts.map +1 -0
- package/dist/services/actionflow/components/logic_flow_set.js +79 -0
- package/dist/services/actionflow/components/logic_flow_set.js.map +1 -0
- package/dist/services/actionflow/components/meeting_create.d.ts +5 -0
- package/dist/services/actionflow/components/meeting_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/meeting_create.js +37 -0
- package/dist/services/actionflow/components/meeting_create.js.map +1 -0
- package/dist/services/actionflow/components/multiple_execution.d.ts +5 -0
- package/dist/services/actionflow/components/multiple_execution.d.ts.map +1 -0
- package/dist/services/actionflow/components/multiple_execution.js +136 -0
- package/dist/services/actionflow/components/multiple_execution.js.map +1 -0
- package/dist/services/actionflow/components/output.d.ts +9 -0
- package/dist/services/actionflow/components/output.d.ts.map +1 -0
- package/dist/services/actionflow/components/output.js +81 -0
- package/dist/services/actionflow/components/output.js.map +1 -0
- package/dist/services/actionflow/components/schedule_create.d.ts +5 -0
- package/dist/services/actionflow/components/schedule_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/schedule_create.js +42 -0
- package/dist/services/actionflow/components/schedule_create.js.map +1 -0
- package/dist/services/actionflow/components/send_message.d.ts +7 -0
- package/dist/services/actionflow/components/send_message.d.ts.map +1 -0
- package/dist/services/actionflow/components/send_message.js +200 -0
- package/dist/services/actionflow/components/send_message.js.map +1 -0
- package/dist/services/actionflow/components/simple_scheduler.d.ts +5 -0
- package/dist/services/actionflow/components/simple_scheduler.d.ts.map +1 -0
- package/dist/services/actionflow/components/simple_scheduler.js +22 -0
- package/dist/services/actionflow/components/simple_scheduler.js.map +1 -0
- package/dist/services/actionflow/components/time_batch_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/time_batch_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/time_batch_trigger.js +92 -0
- package/dist/services/actionflow/components/time_batch_trigger.js.map +1 -0
- package/dist/services/actionflow/components/workflow_actions.d.ts +26 -0
- package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/workflow_actions.js +403 -0
- package/dist/services/actionflow/components/workflow_actions.js.map +1 -0
- package/dist/services/actionflow/context_data_builder.d.ts +9 -0
- package/dist/services/actionflow/context_data_builder.d.ts.map +1 -0
- package/dist/services/actionflow/context_data_builder.js +31 -0
- package/dist/services/actionflow/context_data_builder.js.map +1 -0
- package/dist/services/actionflow/context_preflight.d.ts +6 -0
- package/dist/services/actionflow/context_preflight.d.ts.map +1 -0
- package/dist/services/actionflow/context_preflight.js +122 -0
- package/dist/services/actionflow/context_preflight.js.map +1 -0
- package/dist/services/actionflow/context_provider.d.ts +18 -0
- package/dist/services/actionflow/context_provider.d.ts.map +1 -0
- package/dist/services/actionflow/context_provider.js +102 -0
- package/dist/services/actionflow/context_provider.js.map +1 -0
- package/dist/services/actionflow/context_source.d.ts +7 -0
- package/dist/services/actionflow/context_source.d.ts.map +1 -0
- package/dist/services/actionflow/context_source.js +10 -0
- package/dist/services/actionflow/context_source.js.map +1 -0
- package/dist/services/actionflow/design_client.d.ts +48 -0
- package/dist/services/actionflow/design_client.d.ts.map +1 -0
- package/dist/services/actionflow/design_client.js +170 -0
- package/dist/services/actionflow/design_client.js.map +1 -0
- package/dist/services/actionflow/document_source.d.ts +5 -0
- package/dist/services/actionflow/document_source.d.ts.map +1 -0
- package/dist/services/actionflow/document_source.js +5 -0
- package/dist/services/actionflow/document_source.js.map +1 -0
- package/dist/services/actionflow/enrich_approve_trigger.d.ts +12 -0
- package/dist/services/actionflow/enrich_approve_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/enrich_approve_trigger.js +107 -0
- package/dist/services/actionflow/enrich_approve_trigger.js.map +1 -0
- package/dist/services/actionflow/filter_rules.d.ts +14 -0
- package/dist/services/actionflow/filter_rules.d.ts.map +1 -0
- package/dist/services/actionflow/filter_rules.js +259 -0
- package/dist/services/actionflow/filter_rules.js.map +1 -0
- package/dist/services/actionflow/form_source.d.ts +17 -0
- package/dist/services/actionflow/form_source.d.ts.map +1 -0
- package/dist/services/actionflow/form_source.js +42 -0
- package/dist/services/actionflow/form_source.js.map +1 -0
- package/dist/services/actionflow/formula_service.d.ts +51 -0
- package/dist/services/actionflow/formula_service.d.ts.map +1 -0
- package/dist/services/actionflow/formula_service.js +999 -0
- package/dist/services/actionflow/formula_service.js.map +1 -0
- package/dist/services/actionflow/generation_service.d.ts +28 -0
- package/dist/services/actionflow/generation_service.d.ts.map +1 -0
- package/dist/services/actionflow/generation_service.js +283 -0
- package/dist/services/actionflow/generation_service.js.map +1 -0
- package/dist/services/actionflow/hrm_source.d.ts +4 -0
- package/dist/services/actionflow/hrm_source.d.ts.map +1 -0
- package/dist/services/actionflow/hrm_source.js +8 -0
- package/dist/services/actionflow/hrm_source.js.map +1 -0
- package/dist/services/actionflow/id_generator.d.ts +13 -0
- package/dist/services/actionflow/id_generator.d.ts.map +1 -0
- package/dist/services/actionflow/id_generator.js +33 -0
- package/dist/services/actionflow/id_generator.js.map +1 -0
- package/dist/services/actionflow/person_source.d.ts +7 -0
- package/dist/services/actionflow/person_source.d.ts.map +1 -0
- package/dist/services/actionflow/person_source.js +34 -0
- package/dist/services/actionflow/person_source.js.map +1 -0
- package/dist/services/actionflow/preflight_service.d.ts +42 -0
- package/dist/services/actionflow/preflight_service.d.ts.map +1 -0
- package/dist/services/actionflow/preflight_service.js +1247 -0
- package/dist/services/actionflow/preflight_service.js.map +1 -0
- package/dist/services/actionflow/query_field_defaults.d.ts +3 -0
- package/dist/services/actionflow/query_field_defaults.d.ts.map +1 -0
- package/dist/services/actionflow/query_field_defaults.js +46 -0
- package/dist/services/actionflow/query_field_defaults.js.map +1 -0
- package/dist/services/actionflow/readback_verifier.d.ts +11 -0
- package/dist/services/actionflow/readback_verifier.d.ts.map +1 -0
- package/dist/services/actionflow/readback_verifier.js +252 -0
- package/dist/services/actionflow/readback_verifier.js.map +1 -0
- package/dist/services/actionflow/request.d.ts +13 -0
- package/dist/services/actionflow/request.d.ts.map +1 -0
- package/dist/services/actionflow/request.js +15 -0
- package/dist/services/actionflow/request.js.map +1 -0
- package/dist/services/actionflow/runtime_metadata.d.ts +27 -0
- package/dist/services/actionflow/runtime_metadata.d.ts.map +1 -0
- package/dist/services/actionflow/runtime_metadata.js +142 -0
- package/dist/services/actionflow/runtime_metadata.js.map +1 -0
- package/dist/services/actionflow/save_workflow_draft.d.ts +34 -0
- package/dist/services/actionflow/save_workflow_draft.d.ts.map +1 -0
- package/dist/services/actionflow/save_workflow_draft.js +449 -0
- package/dist/services/actionflow/save_workflow_draft.js.map +1 -0
- package/dist/services/actionflow/system_params.d.ts +5 -0
- package/dist/services/actionflow/system_params.d.ts.map +1 -0
- package/dist/services/actionflow/system_params.js +55 -0
- package/dist/services/actionflow/system_params.js.map +1 -0
- package/dist/services/actionflow/trigger_common.d.ts +6 -0
- package/dist/services/actionflow/trigger_common.d.ts.map +1 -0
- package/dist/services/actionflow/trigger_common.js +41 -0
- package/dist/services/actionflow/trigger_common.js.map +1 -0
- package/dist/services/actionflow/workflow_compiler.d.ts +27 -0
- package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/workflow_compiler.js +1804 -0
- package/dist/services/actionflow/workflow_compiler.js.map +1 -0
- package/dist/services/actionflow/workflow_source.d.ts +14 -0
- package/dist/services/actionflow/workflow_source.d.ts.map +1 -0
- package/dist/services/actionflow/workflow_source.js +86 -0
- package/dist/services/actionflow/workflow_source.js.map +1 -0
- package/dist/services/workflow-initiator.d.ts +15 -0
- package/dist/services/workflow-initiator.d.ts.map +1 -0
- package/dist/services/workflow-initiator.js +77 -0
- package/dist/services/workflow-initiator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function base(client) {
|
|
2
|
+
return (client.auth?.getBaseUrl() || '').replace(/\/$/, '');
|
|
3
|
+
}
|
|
4
|
+
/** 返回当前租户新建动作流所需的机构 ID(非分权租户返回空串)。 */
|
|
5
|
+
export async function resolveApplicationOrgId(client) {
|
|
6
|
+
try {
|
|
7
|
+
const entrance = await client.get(base(client) + '/api/bs/ebuilder/app/permit/entrance');
|
|
8
|
+
const data = (entrance && typeof entrance === 'object' ? entrance.data : undefined) || {};
|
|
9
|
+
if (!(entrance && entrance.code === 200 && typeof data === 'object' && data.isDetachable)) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
const tree = await client.get(base(client) + '/api/hrm/common/getOrgTree?menuCode=eBuilder&onlySubcompany=false&containDisableDept=false&moduleCode=EBUILDER&virtualId=1&loadCount=false&isMobile=false');
|
|
13
|
+
const rows = (tree && typeof tree === 'object' ? tree.data : undefined) || [];
|
|
14
|
+
if (tree && tree.code === 200 && Array.isArray(rows) && rows.length) {
|
|
15
|
+
const first = rows[0];
|
|
16
|
+
if (first && typeof first === 'object')
|
|
17
|
+
return String(first.id || '');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// 探测失败返回空值,由后端维持兼容行为。
|
|
22
|
+
}
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
/** 创建/初始化 ESB 应用(暂存的前置条件)。 */
|
|
26
|
+
export async function createApplication(client, name, description = '', appType = 0, orgId = '', module = 'esb', appSources = []) {
|
|
27
|
+
return client.post(base(client) + '/api/bs/esb/setting/application/save', {
|
|
28
|
+
type: appType,
|
|
29
|
+
name,
|
|
30
|
+
orgId,
|
|
31
|
+
description,
|
|
32
|
+
id: '',
|
|
33
|
+
moudle: String(module || 'esb'),
|
|
34
|
+
appSources: Array.isArray(appSources) ? appSources : [],
|
|
35
|
+
lightId: '',
|
|
36
|
+
initData: '',
|
|
37
|
+
templateId: '',
|
|
38
|
+
templateVersionId: '',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** 查询应用详情。 */
|
|
42
|
+
export async function getApplication(client, appId) {
|
|
43
|
+
return client.get(base(client) + `/api/bs/esb/setting/application/getAppById/${appId}`);
|
|
44
|
+
}
|
|
45
|
+
/** 回收刚创建但未通过校验的动作流,避免留下无效 AI 草稿。 */
|
|
46
|
+
export async function recycleApplication(client, appId, name) {
|
|
47
|
+
const app = { id: String(appId), name: String(name) };
|
|
48
|
+
try {
|
|
49
|
+
await client.post(base(client) + '/api/bs/esb/setting/application/forbiddenAppById', app);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// 禁用失败仍尝试回收;批量回收接口会返回具体失败原因。
|
|
53
|
+
}
|
|
54
|
+
return client.post(base(client) + '/api/bs/esb/setting/application/batchAddRecycle', { appDesignList: [app] });
|
|
55
|
+
}
|
|
56
|
+
/** 查询应用的版本/场景列表(含 secretKey / activeVersion)。 */
|
|
57
|
+
export async function getVersionList(client, appId) {
|
|
58
|
+
return client.get(base(client) + `/api/bs/esb/setting/application/version/versionList/${appId}`);
|
|
59
|
+
}
|
|
60
|
+
/** 保存前预检(flow/design/check)。 */
|
|
61
|
+
export async function checkDesign(client, design) {
|
|
62
|
+
const payload = {
|
|
63
|
+
appId: design.appId || '',
|
|
64
|
+
sceneId: design.sceneId || '',
|
|
65
|
+
event: design.event,
|
|
66
|
+
actions: design.actions || [],
|
|
67
|
+
assistLayer: design.assistLayer || '{}',
|
|
68
|
+
versionConfig: '{}',
|
|
69
|
+
version: design.version ?? 1,
|
|
70
|
+
addIds: design.addIds || [],
|
|
71
|
+
deleteActions: design.deleteActions || [],
|
|
72
|
+
addCheckMsg: [],
|
|
73
|
+
saveAndStart: false,
|
|
74
|
+
secretKey: design.secretKey || '',
|
|
75
|
+
reloadFormula: design.reloadFormula || [],
|
|
76
|
+
};
|
|
77
|
+
return client.post(base(client) + '/api/bs/esb/setting/flow/design/check', payload);
|
|
78
|
+
}
|
|
79
|
+
/** 保存动作流设计为暂存(仅供显式暂存模式使用)。 */
|
|
80
|
+
export async function saveStashSnapshot(client, design) {
|
|
81
|
+
const storeInfo = {
|
|
82
|
+
saveAndStart: design.saveAndStart ?? false,
|
|
83
|
+
appId: design.appId || '',
|
|
84
|
+
sceneId: design.sceneId || '',
|
|
85
|
+
event: design.event,
|
|
86
|
+
actions: design.actions || [],
|
|
87
|
+
assistLayer: design.assistLayer || '{}',
|
|
88
|
+
versionConfig: design.versionConfig || '{}',
|
|
89
|
+
version: design.version ?? 1,
|
|
90
|
+
addIds: design.addIds || [],
|
|
91
|
+
deleteActions: design.deleteActions || [],
|
|
92
|
+
addCheckMsg: design.addCheckMsg || [],
|
|
93
|
+
secretKey: design.secretKey || '',
|
|
94
|
+
reloadFormula: design.reloadFormula || [],
|
|
95
|
+
saveNewVersion: false,
|
|
96
|
+
lightId: '',
|
|
97
|
+
initData: '',
|
|
98
|
+
versionDes: null,
|
|
99
|
+
operateType: '',
|
|
100
|
+
appName: '',
|
|
101
|
+
};
|
|
102
|
+
return client.post(base(client) + '/api/bs/esb/setting/flow/design/saveStashSnapshot', {
|
|
103
|
+
appId: design.appId || '',
|
|
104
|
+
versionId: design.sceneId || '',
|
|
105
|
+
storeInfo,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 保存正式设计。saveAndStart=true 时同时启用动作流;调用方必须明确传入,
|
|
110
|
+
* 避免将未完成的条件注册保存误启用。
|
|
111
|
+
*/
|
|
112
|
+
export async function saveDesign(client, design, saveAndStart) {
|
|
113
|
+
return client.post(base(client) + '/api/bs/esb/setting/flow/design/saveDesign', {
|
|
114
|
+
ajaxUrl: '/api/bs/esb/setting/flow/design/saveDesign',
|
|
115
|
+
saveAndStart,
|
|
116
|
+
appId: design.appId || '',
|
|
117
|
+
sceneId: design.sceneId || '',
|
|
118
|
+
event: design.event,
|
|
119
|
+
actions: design.actions || [],
|
|
120
|
+
addIds: design.addIds || [],
|
|
121
|
+
deleteActions: design.deleteActions || [],
|
|
122
|
+
version: design.version ?? 1,
|
|
123
|
+
delCheckMsg: design.delCheckMsg || [],
|
|
124
|
+
addCheckMsg: design.addCheckMsg || [],
|
|
125
|
+
assistLayer: design.assistLayer || '{}',
|
|
126
|
+
versionConfig: design.versionConfig || '{}',
|
|
127
|
+
saveNewVersion: false,
|
|
128
|
+
lightId: '',
|
|
129
|
+
initData: '',
|
|
130
|
+
secretKey: design.secretKey || '',
|
|
131
|
+
appName: design.appName || '',
|
|
132
|
+
reloadFormula: design.reloadFormula || [],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** 读取指定应用版本的暂存设计。 */
|
|
136
|
+
export async function getStashSnapshot(client, appId, versionId) {
|
|
137
|
+
return client.post(base(client) + '/api/bs/esb/setting/flow/design/getStashSnapshot', {
|
|
138
|
+
appId: String(appId),
|
|
139
|
+
versionId: String(versionId),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** 按场景 ID 读取设计(正式版本,非暂存)。 */
|
|
143
|
+
export async function getDesign(client, sceneId) {
|
|
144
|
+
return client.get(base(client) + `/api/bs/esb/setting/flow/design/getDesignBySceneId/${sceneId}`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 读取设计器当前租户可添加的执行组件目录。
|
|
148
|
+
*
|
|
149
|
+
* 这个目录不仅用于展示:设计器在手工添加节点时会把目录项完整写入
|
|
150
|
+
* `originId/options`。对于循环等容器节点,缺少这组前端节点壳会使其内部
|
|
151
|
+
* 的后续编辑状态无法持久化。因此生成时必须从当前租户读取,不能硬编码。
|
|
152
|
+
*/
|
|
153
|
+
export async function getComponentsForDesign(client) {
|
|
154
|
+
return client.get(base(client) + '/api/bs/esb/setting/flow/design/getCompnentGroupForDesign?entranceType=actionFlow');
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* ESB 专用条件保存端点(source=8)——Condition 节点两步法的第一步。
|
|
158
|
+
* 前端来源:weapp-esb-develop/src/components/common/condition-rule/index.tsx saveRuleUrl
|
|
159
|
+
* = "/api/bs/esb/setting/condition/saveCondition";getConditionSet 用 GET。
|
|
160
|
+
* 返回 { data: { conditionKey, conditionId, conditionCn, mapId, needMapping, ... } },
|
|
161
|
+
* 其中 conditionKey 必须回填为 Condition 节点的 mapBaseId,否则 saveDesign 保存主流程时条件被清空。
|
|
162
|
+
*/
|
|
163
|
+
export async function saveCondition(client, ruleTree) {
|
|
164
|
+
return client.post(base(client) + '/api/bs/esb/setting/condition/saveCondition', ruleTree);
|
|
165
|
+
}
|
|
166
|
+
/** 读取条件服务持久化后的完整 ExpressionBean。 */
|
|
167
|
+
export async function getExpressionBean(client, conditionId) {
|
|
168
|
+
return client.get(base(client) + `/api/bs/esb/setting/condition/getExpressionBean?conditionId=${encodeURIComponent(String(conditionId))}`);
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=design_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design_client.js","sourceRoot":"","sources":["../../../src/services/actionflow/design_client.ts"],"names":[],"mappings":"AAOA,SAAS,IAAI,CAAC,MAAiB;IAC7B,OAAO,CAAE,MAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,MAAiB;IAC7D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,sCAAsC,CAAC,CAAC;QACzF,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS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5E,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,+DAA+D,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7I,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** 文档领域的前端镜像查询接口。 */
|
|
2
|
+
import type { ApiClient } from '../../core/client.js';
|
|
3
|
+
/** 更新文档状态组件的当前租户状态选项。镜像前端 /component/getDocSelectData。 */
|
|
4
|
+
export declare function getDocumentStatusOptions(client: ApiClient): Promise<any>;
|
|
5
|
+
//# sourceMappingURL=document_source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document_source.d.ts","sourceRoot":"","sources":["../../../src/services/actionflow/document_source.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,0DAA0D;AAC1D,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAE9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document_source.js","sourceRoot":"","sources":["../../../src/services/actionflow/document_source.ts"],"names":[],"mappings":"AAGA,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,MAAiB;IAC9D,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,gDAAgD,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 流程触发器节点补全(preflight 阶段)。
|
|
3
|
+
* 对齐 Python 版 components/approve_trigger/compiler.py 的 enrich_approve_trigger_node(黄金参照)。
|
|
4
|
+
*/
|
|
5
|
+
import type { ApiClient } from '../../core/client.js';
|
|
6
|
+
export interface EnrichResult {
|
|
7
|
+
plan: Record<string, any>;
|
|
8
|
+
errors: string[];
|
|
9
|
+
warnings: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function enrichApproveTriggerNode(plan: Record<string, any>, client: ApiClient): Promise<EnrichResult>;
|
|
12
|
+
//# sourceMappingURL=enrich_approve_trigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrich_approve_trigger.d.ts","sourceRoot":"","sources":["../../../src/services/actionflow/enrich_approve_trigger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CA8FlH"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { workflowPathNodeBrowser } from './workflow_source.js';
|
|
2
|
+
const WORKFLOW_NODES_CACHE = {};
|
|
3
|
+
const SUBMIT_TIMINGS = new Set(['submitted', 'submitted_after', 'workflow_started', 'submit']);
|
|
4
|
+
const APPROVE_TIMINGS = new Set(['approve_passed', 'approve_node_passed', 'approvepass', 'approve']);
|
|
5
|
+
const END_TIMINGS = new Set(['workflow_completed', 'workflow_archived', 'workflowcompleted', 'end', 'archived', '流程结束']);
|
|
6
|
+
const ANY_NODE_TIMINGS = new Set(['leave', 'node_leave', 'after', 'delete', 'flow_deleted', 'process_deleted', 'save', 'flow_saved', 'process_saved', 'revert', 'flow_reverted', 'process_reverted', 'cancel', 'cancel_and_recover', 'flow_canceled', 'process_canceled', 'link', 'exit', 'node_link']);
|
|
7
|
+
const PAUSE_TIMINGS = new Set(['pause', 'stop_and_open', 'flow_paused', 'process_paused']);
|
|
8
|
+
export async function enrichApproveTriggerNode(plan, client) {
|
|
9
|
+
const enriched = JSON.parse(JSON.stringify(plan));
|
|
10
|
+
const event = enriched.event;
|
|
11
|
+
const errors = enriched._enrich_errors || [];
|
|
12
|
+
const warnings = enriched._enrich_warnings || [];
|
|
13
|
+
delete enriched._enrich_errors;
|
|
14
|
+
delete enriched._enrich_warnings;
|
|
15
|
+
if (!event || typeof event !== 'object' || event.type !== 'ApproveTrigger')
|
|
16
|
+
return { plan: enriched, errors, warnings };
|
|
17
|
+
let timing = String(event.triggerTiming ?? '').trim().toLowerCase();
|
|
18
|
+
let workflowId = String(event.workflowId ?? '');
|
|
19
|
+
let existingNode = event.approveNode;
|
|
20
|
+
if ((!existingNode || typeof existingNode !== 'object') && event.params && typeof event.params === 'object') {
|
|
21
|
+
existingNode = event.params.approveNode;
|
|
22
|
+
}
|
|
23
|
+
if (event.params && typeof event.params === 'object') {
|
|
24
|
+
const params = event.params;
|
|
25
|
+
timing = timing || String(params.triggerTiming ?? '').trim().toLowerCase();
|
|
26
|
+
const wp = params.workflowPath;
|
|
27
|
+
workflowId = workflowId || (wp && typeof wp === 'object' ? String(wp.id ?? '') : '');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
event.params = {};
|
|
31
|
+
}
|
|
32
|
+
if (workflowId && event.params && typeof event.params === 'object' && !event.params.workflowPath) {
|
|
33
|
+
event.params.workflowPath = { id: workflowId };
|
|
34
|
+
}
|
|
35
|
+
if (!workflowId || !timing)
|
|
36
|
+
return { plan: enriched, errors, warnings };
|
|
37
|
+
let requestedName = '';
|
|
38
|
+
if (existingNode && typeof existingNode === 'object') {
|
|
39
|
+
if (existingNode.nodeType !== undefined && existingNode.nodeType !== null) {
|
|
40
|
+
// 仍需校验 id
|
|
41
|
+
}
|
|
42
|
+
requestedName = String(existingNode.name ?? '').trim();
|
|
43
|
+
}
|
|
44
|
+
const wfKey = String(workflowId);
|
|
45
|
+
let nodeQueryError = '';
|
|
46
|
+
if (!(wfKey in WORKFLOW_NODES_CACHE)) {
|
|
47
|
+
try {
|
|
48
|
+
const response = await workflowPathNodeBrowser(client, wfKey);
|
|
49
|
+
const cachedNodes = response?.data?.data ?? [];
|
|
50
|
+
WORKFLOW_NODES_CACHE[wfKey] = Array.isArray(cachedNodes) ? cachedNodes : [];
|
|
51
|
+
}
|
|
52
|
+
catch (exc) {
|
|
53
|
+
WORKFLOW_NODES_CACHE[wfKey] = [];
|
|
54
|
+
nodeQueryError = String(exc);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const nodes = WORKFLOW_NODES_CACHE[wfKey];
|
|
58
|
+
// plan 指定 approveNode 时校验 id 是否为当前流程节点
|
|
59
|
+
if (existingNode && typeof existingNode === 'object' && existingNode.id) {
|
|
60
|
+
const planNid = String(existingNode.id);
|
|
61
|
+
const liveNode = nodes.find((n) => n && typeof n === 'object' && String(n.id) === planNid);
|
|
62
|
+
if (liveNode !== undefined) {
|
|
63
|
+
event.params.approveNode = liveNode;
|
|
64
|
+
return { plan: enriched, errors, warnings };
|
|
65
|
+
}
|
|
66
|
+
warnings.push(`approveNode.id=${planNid} 不在流程 ${workflowId} 当前节点列表中(流程可能已重建), 已按触发时机 '${timing}' 自动重选正确节点`);
|
|
67
|
+
existingNode = null;
|
|
68
|
+
requestedName = '';
|
|
69
|
+
}
|
|
70
|
+
let desiredTypes;
|
|
71
|
+
if (SUBMIT_TIMINGS.has(timing))
|
|
72
|
+
desiredTypes = [0];
|
|
73
|
+
else if (APPROVE_TIMINGS.has(timing))
|
|
74
|
+
desiredTypes = [1, 2, 5];
|
|
75
|
+
else if (END_TIMINGS.has(timing))
|
|
76
|
+
desiredTypes = [3];
|
|
77
|
+
else if (PAUSE_TIMINGS.has(timing))
|
|
78
|
+
desiredTypes = [0, 1, 2, 5];
|
|
79
|
+
else if (ANY_NODE_TIMINGS.has(timing))
|
|
80
|
+
desiredTypes = [1, 2, 5, 0, 3];
|
|
81
|
+
else
|
|
82
|
+
desiredTypes = [3];
|
|
83
|
+
let node = null;
|
|
84
|
+
if (requestedName) {
|
|
85
|
+
node = nodes.find((item) => item && typeof item === 'object' && String(item.name ?? '').trim() === requestedName);
|
|
86
|
+
if (node === undefined) {
|
|
87
|
+
errors.push(`指定触发节点 '${requestedName}' 不在流程 ${workflowId} 中; 实际节点: ${nodes.filter((n) => n && typeof n === 'object').map((n) => n.name)}`);
|
|
88
|
+
return { plan: enriched, errors, warnings };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
node = nodes.find((item) => item && typeof item === 'object' && desiredTypes.includes(item.nodeType));
|
|
93
|
+
}
|
|
94
|
+
if (node) {
|
|
95
|
+
event.params.approveNode = node;
|
|
96
|
+
return { plan: enriched, errors, warnings };
|
|
97
|
+
}
|
|
98
|
+
const typeLabel = { 0: '发起节点', 3: '结束节点' }[desiredTypes[0]] ?? `nodeType∈${desiredTypes}`;
|
|
99
|
+
if (!nodes.length) {
|
|
100
|
+
errors.push(`流程 ${workflowId} 节点查询失败: ${nodeQueryError || '未返回任何节点'}; 请确认当前环境会话有效,或先用 workflow-nodes 查询并把真实 approveNode 传入`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
errors.push(`triggerTiming='${timing}' 要求触发节点为 ${typeLabel}, 但流程 ${workflowId} 只有 ${nodes.filter((n) => n && typeof n === 'object').map((n) => n.nodeType)} 类型节点`);
|
|
104
|
+
}
|
|
105
|
+
return { plan: enriched, errors, warnings };
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=enrich_approve_trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrich_approve_trigger.js","sourceRoot":"","sources":["../../../src/services/actionflow/enrich_approve_trigger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,oBAAoB,GAA0B,EAAE,CAAC;AAEvD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CAAC,YAAY,CAAC,CAAC,CAAW,CAAC,IAAI,YAAY,YAAY,EAAE,CAAC;IACpG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,MAAM,UAAU,YAAY,cAAc,IAAI,SAAS,wDAAwD,CAAC,CAAC;IAC/H,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,kBAAkB,MAAM,aAAa,SAAS,SAAS,UAAU,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrK,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const FILTER_OPERATOR_ALIASES: Record<string, string>;
|
|
2
|
+
export declare const FILTER_ALLOWED_OPERATORS: Record<string, Set<string>>;
|
|
3
|
+
export declare function conditionFieldFamily(componentKey: string, fieldType: string): string;
|
|
4
|
+
export declare function filterFieldType(fieldType: string, componentKey?: string): string;
|
|
5
|
+
export declare function normalizeFilterOperator(operator: any, family: string, opts?: {
|
|
6
|
+
contextIsArray?: boolean;
|
|
7
|
+
multiSelect?: boolean;
|
|
8
|
+
allowedOverride?: Set<string> | null;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function conditionOperatorOverride(fieldMeta: Record<string, any>, family: string, componentKey: string, fieldId: string, filterValueType?: string): Set<string> | null;
|
|
11
|
+
export declare function resolveFormCtx(result: Record<string, any>, meta: Record<string, any>, formId: string): Record<string, any>;
|
|
12
|
+
export declare function formulaConfigObject(value: Record<string, any>): Record<string, any>;
|
|
13
|
+
export declare function buildFilterContextFormula(right: Record<string, any>, meta: Record<string, any>, appId: string, targetFieldType: string, targetComponentKey?: string): [Record<string, any>, boolean];
|
|
14
|
+
//# sourceMappingURL=filter_rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter_rules.d.ts","sourceRoot":"","sources":["../../../src/services/actionflow/filter_rules.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkB1D,CAAC;AAWF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAahE,CAAC;AASF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAmBpF;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,MAAM,CAM5E;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAC7B,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAAO,GACnG,MAAM,CAcR;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EACpE,OAAO,EAAE,MAAM,EAAE,eAAe,SAAK,GACpC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAsBpB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAgB1H;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAMnF;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EACpE,eAAe,EAAE,MAAM,EAAE,kBAAkB,SAAK,GAC/C,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAqEhC"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 条件筛选的字段类型、操作符和右值公式规则。
|
|
3
|
+
* 对齐 Python 版 core/filter_rules.py(黄金参照)。
|
|
4
|
+
*/
|
|
5
|
+
import { genSfId } from './id_generator.js';
|
|
6
|
+
import { getWorkflowContextFields, workflowFieldId, findInMetadata } from './runtime_metadata.js';
|
|
7
|
+
export const FILTER_OPERATOR_ALIASES = {
|
|
8
|
+
'==': 'eq', '=': 'eq', '等于': 'eq',
|
|
9
|
+
ne: 'neq', noteq: 'neq', notequals: 'neq', '!=': 'neq', '<>': 'neq', '不等于': 'neq',
|
|
10
|
+
'>': 'gt', '大于': 'gt', '>=': 'gte', '大于等于': 'gte',
|
|
11
|
+
'<': 'lt', '小于': 'lt', '<=': 'lte', '小于等于': 'lte',
|
|
12
|
+
contain: 'contains', include: 'contains', '包含': 'contains',
|
|
13
|
+
notcontain: 'uncontains', notcontains: 'uncontains', notlike: 'uncontains',
|
|
14
|
+
notinclude: 'uncontains', exclude: 'uncontains', '不包含': 'uncontains',
|
|
15
|
+
startswith: 'startWith', startwith: 'startWith', '开头包含': 'startWith',
|
|
16
|
+
unstartswith: 'unStartWith', unstartwith: 'unStartWith', notstartswith: 'unStartWith', '开头不包含': 'unStartWith',
|
|
17
|
+
endswith: 'endWith', endwith: 'endWith', '结尾包含': 'endWith',
|
|
18
|
+
unendswith: 'unEndWith', unendwith: 'unEndWith', notendswith: 'unEndWith', '结尾不包含': 'unEndWith',
|
|
19
|
+
between: 'range', '区间': 'range',
|
|
20
|
+
containedwith: 'containedWith', '被包含于': 'containedWith',
|
|
21
|
+
in: 'aggregate', '属于': 'aggregate',
|
|
22
|
+
notin: 'unaggregate', not_in: 'unaggregate', '不属于': 'unaggregate',
|
|
23
|
+
isnull: 'empty', '为空': 'empty',
|
|
24
|
+
notempty: 'nempty', isnotnull: 'nempty', '不为空': 'nempty',
|
|
25
|
+
};
|
|
26
|
+
const FILTER_TEXT_COMPONENTS = new Set(['String', 'Text', 'TextArea', 'RichText', 'Email', 'Phone', 'Mobile', 'IDCard', 'SerialNumber', 'PositionComponent']);
|
|
27
|
+
const FILTER_NUMBER_COMPONENTS = new Set(['Number', 'NumberComponent', 'Money', 'Monitor', 'Raty', 'ProgressBar']);
|
|
28
|
+
const FILTER_DATE_COMPONENTS = new Set(['Date', 'DateComponent', 'DateInterval', 'TimeComponent', 'DateTimeComponent']);
|
|
29
|
+
const FILTER_SELECT_COMPONENTS = new Set(['Select', 'SelectMultiple', 'RadioBox', 'CheckBox', 'ImageRadioBox', 'ImageCheckBox', 'ComboSelect', 'BusinessData']);
|
|
30
|
+
const FILTER_BOOLEAN_COMPONENTS = new Set(['Switch', 'Boolean', 'Checkbox']);
|
|
31
|
+
const FILTER_REFERENCE_COMPONENTS = new Set(['Employee', 'Department', 'Subcompany', 'EmployeeScope', 'EmployeeOrganization', 'HrmPosition', 'Ebuilder', 'RelateBrowser', 'TreeSelect', 'Mainline', 'MainlineType', 'Task', 'Document', 'Workflow', 'AgendaComponent', 'CustomerComponent', 'ClueComponent', 'OrderComponent', 'ContactComponent', 'ChanceComponent', 'ProductionComponent', 'ContractComponent', 'ActivityComponent', 'WorkreportComponent', 'CompetitorComponent', 'KpiFlowComponent', 'QuoteComponent', 'AttendComponent', 'FormComponent', 'DataSource', 'ODocReceiveComponent', 'RelateODoc', 'CashBook', 'EinvoiceComponent', 'WorkflowPathBrowser', 'WorkflowNodes', 'RelateTag', 'Cascader', 'EmployeeShare', 'Country', 'Province', 'City', 'District', 'Browser', 'Sharer']);
|
|
32
|
+
const FILTER_FILE_COMPONENTS = new Set(['ImageComponent', 'FileComponent']);
|
|
33
|
+
const FILTER_EMPTY_ONLY_COMPONENTS = new Set(['HandwritingSignature', 'SignatureComponent', 'AudioRecord', 'VideoRecord']);
|
|
34
|
+
export const FILTER_ALLOWED_OPERATORS = {
|
|
35
|
+
text: new Set(['eq', 'neq', 'aggregate', 'unaggregate', 'contains', 'uncontains', 'startWith', 'unStartWith', 'endWith', 'unEndWith', 'empty', 'nempty', 'containedWith']),
|
|
36
|
+
number: new Set(['range', 'eq', 'neq', 'aggregate', 'unaggregate', 'gt', 'lt', 'gte', 'lte', 'empty', 'nempty']),
|
|
37
|
+
date: new Set(['range', 'eq', 'neq', 'gt', 'lt', 'gte', 'lte', 'contains', 'uncontains', 'startWith', 'endWith', 'empty', 'nempty']),
|
|
38
|
+
select: new Set(['eq', 'neq', 'empty', 'nempty', 'aggregate', 'unaggregate']),
|
|
39
|
+
boolean: new Set(['eq', 'neq', 'empty', 'nempty', 'aggregate', 'unaggregate']),
|
|
40
|
+
reference: new Set(['eq', 'neq', 'empty', 'nempty', 'aggregate', 'unaggregate']),
|
|
41
|
+
file: new Set(['eq', 'neq', 'contains', 'uncontains', 'empty', 'nempty']),
|
|
42
|
+
color: new Set(['eq', 'neq', 'empty', 'nempty']),
|
|
43
|
+
empty_only: new Set(['empty', 'nempty']),
|
|
44
|
+
app_tag: new Set(['contains', 'uncontains']),
|
|
45
|
+
doc_folder: new Set(['eq', 'neq', 'aggregate', 'unaggregate', 'contains', 'uncontains', 'startWith', 'endWith', 'empty', 'nempty']),
|
|
46
|
+
placeholder: new Set(['eq']),
|
|
47
|
+
};
|
|
48
|
+
const PLACEHOLDER_OPERATOR_MAP = {
|
|
49
|
+
eq: 'eq', noteq: 'neq', like: 'contains', notlike: 'uncontains',
|
|
50
|
+
isnull: 'empty', isnotnull: 'nempty', between: 'range',
|
|
51
|
+
include: 'contains', notinclude: 'uncontains', in: 'aggregate',
|
|
52
|
+
notin: 'unaggregate', gt: 'gt', lt: 'lt', startwith: 'startWith', endwith: 'endWith',
|
|
53
|
+
};
|
|
54
|
+
export function conditionFieldFamily(componentKey, fieldType) {
|
|
55
|
+
if (FILTER_TEXT_COMPONENTS.has(componentKey))
|
|
56
|
+
return 'text';
|
|
57
|
+
if (FILTER_NUMBER_COMPONENTS.has(componentKey))
|
|
58
|
+
return 'number';
|
|
59
|
+
if (FILTER_DATE_COMPONENTS.has(componentKey))
|
|
60
|
+
return 'date';
|
|
61
|
+
if (FILTER_SELECT_COMPONENTS.has(componentKey))
|
|
62
|
+
return 'select';
|
|
63
|
+
if (FILTER_BOOLEAN_COMPONENTS.has(componentKey))
|
|
64
|
+
return 'boolean';
|
|
65
|
+
if (FILTER_REFERENCE_COMPONENTS.has(componentKey))
|
|
66
|
+
return 'reference';
|
|
67
|
+
if (FILTER_FILE_COMPONENTS.has(componentKey))
|
|
68
|
+
return 'file';
|
|
69
|
+
if (componentKey === 'ColorPicker')
|
|
70
|
+
return 'color';
|
|
71
|
+
if (FILTER_EMPTY_ONLY_COMPONENTS.has(componentKey))
|
|
72
|
+
return 'empty_only';
|
|
73
|
+
if (componentKey === 'EbuilderAppTag')
|
|
74
|
+
return 'app_tag';
|
|
75
|
+
if (componentKey === 'DocFolder' || componentKey === 'DocFloder')
|
|
76
|
+
return 'doc_folder';
|
|
77
|
+
if (componentKey === 'Placeholder')
|
|
78
|
+
return 'placeholder';
|
|
79
|
+
const t = String(fieldType || '').toLowerCase();
|
|
80
|
+
if (['number', 'int', 'integer', 'long', 'double', 'float', 'decimal', 'money', 'numbercomponent'].includes(t))
|
|
81
|
+
return 'number';
|
|
82
|
+
if (['date', 'time', 'datetime', 'timestamp'].includes(t))
|
|
83
|
+
return 'date';
|
|
84
|
+
if (['select', 'enum'].includes(t))
|
|
85
|
+
return 'select';
|
|
86
|
+
if (['bool', 'boolean'].includes(t))
|
|
87
|
+
return 'boolean';
|
|
88
|
+
return 'text';
|
|
89
|
+
}
|
|
90
|
+
export function filterFieldType(fieldType, componentKey = '') {
|
|
91
|
+
const family = conditionFieldFamily(componentKey, fieldType);
|
|
92
|
+
return {
|
|
93
|
+
number: 'Number', date: 'Date', select: 'Select',
|
|
94
|
+
boolean: 'Boolean', reference: fieldType || 'String',
|
|
95
|
+
}[family] ?? 'String';
|
|
96
|
+
}
|
|
97
|
+
export function normalizeFilterOperator(operator, family, opts = {}) {
|
|
98
|
+
const operatorText = String(operator || 'eq').trim();
|
|
99
|
+
const raw = operatorText.toLowerCase();
|
|
100
|
+
let func = FILTER_OPERATOR_ALIASES[raw] ?? operatorText;
|
|
101
|
+
if (opts.contextIsArray && func === 'eq')
|
|
102
|
+
func = 'aggregate';
|
|
103
|
+
else if (opts.contextIsArray && func === 'neq')
|
|
104
|
+
func = 'unaggregate';
|
|
105
|
+
if (opts.multiSelect && func === 'aggregate')
|
|
106
|
+
func = 'contains';
|
|
107
|
+
else if (opts.multiSelect && func === 'unaggregate')
|
|
108
|
+
func = 'uncontains';
|
|
109
|
+
const allowed = new Set(opts.allowedOverride ?? FILTER_ALLOWED_OPERATORS[family] ?? FILTER_ALLOWED_OPERATORS.text);
|
|
110
|
+
if (opts.multiSelect)
|
|
111
|
+
for (const x of ['eq', 'neq', 'contains', 'uncontains', 'empty', 'nempty'])
|
|
112
|
+
allowed.add(x);
|
|
113
|
+
if (!allowed.has(func)) {
|
|
114
|
+
throw new Error(`filterCondition operator '${operator}' 不适用于 ${family} 字段; 支持: ${[...allowed].sort().join(', ')}`);
|
|
115
|
+
}
|
|
116
|
+
return func;
|
|
117
|
+
}
|
|
118
|
+
export function conditionOperatorOverride(fieldMeta, family, componentKey, fieldId, filterValueType = '') {
|
|
119
|
+
const schema = fieldMeta.schema && typeof fieldMeta.schema === 'object' ? fieldMeta.schema : {};
|
|
120
|
+
let rawConfig = fieldMeta.config;
|
|
121
|
+
if (typeof rawConfig === 'string') {
|
|
122
|
+
try {
|
|
123
|
+
rawConfig = JSON.parse(rawConfig);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
rawConfig = {};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (family === 'placeholder') {
|
|
130
|
+
let conditionTypes = fieldMeta.conditionType || schema.conditionType || (rawConfig && typeof rawConfig === 'object' ? rawConfig.conditionType : null) || [];
|
|
131
|
+
if (!Array.isArray(conditionTypes))
|
|
132
|
+
conditionTypes = [];
|
|
133
|
+
const mapped = new Set(conditionTypes.map((entry) => PLACEHOLDER_OPERATOR_MAP[String((entry && typeof entry === 'object' ? entry.id : entry)).toLowerCase()] || '').filter(Boolean));
|
|
134
|
+
return mapped.size ? mapped : new Set(['eq']);
|
|
135
|
+
}
|
|
136
|
+
if (componentKey === 'Employee' || componentKey === 'Sharer') {
|
|
137
|
+
if (filterValueType) {
|
|
138
|
+
if (['Department', 'Subcompany', 'Position'].includes(filterValueType))
|
|
139
|
+
return new Set(['aggregate', 'unaggregate', 'empty', 'nempty']);
|
|
140
|
+
if (filterValueType === 'Role')
|
|
141
|
+
return new Set(['contains', 'uncontains']);
|
|
142
|
+
if (filterValueType === 'sup')
|
|
143
|
+
return new Set(['eq', 'neq', 'contains', 'uncontains', 'empty', 'nempty']);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const fieldName = String(fieldMeta.fieldName || fieldId).toLowerCase();
|
|
147
|
+
if (fieldName === 'batchmytags' || fieldName === 'batchpubtags')
|
|
148
|
+
return new Set(['aggregate', 'unaggregate', 'empty', 'nempty']);
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
export function resolveFormCtx(result, meta, formId) {
|
|
152
|
+
const tf = result.targetForm || result.dataSource || {};
|
|
153
|
+
const fid = formId || tf.id || '';
|
|
154
|
+
const groupId = tf.groupId || result.appId || '';
|
|
155
|
+
const formName = tf.text || tf.name || '';
|
|
156
|
+
const form = findInMetadata(meta, 'forms', { id: fid }) || {};
|
|
157
|
+
const schema = form.schema || {};
|
|
158
|
+
return {
|
|
159
|
+
formId: fid,
|
|
160
|
+
groupId: groupId || schema.groupId || '',
|
|
161
|
+
formName: formName || schema.formName || '',
|
|
162
|
+
sformId: schema.sformId || fid,
|
|
163
|
+
objId: schema.objId || fid,
|
|
164
|
+
refObjId: schema.refObjId || fid,
|
|
165
|
+
layoutId: schema.layoutId || fid,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export function formulaConfigObject(value) {
|
|
169
|
+
const config = value && typeof value === 'object' ? value.config || {} : {};
|
|
170
|
+
if (typeof config === 'string') {
|
|
171
|
+
try {
|
|
172
|
+
const parsed = JSON.parse(config);
|
|
173
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return config && typeof config === 'object' ? config : {};
|
|
180
|
+
}
|
|
181
|
+
export function buildFilterContextFormula(right, meta, appId, targetFieldType, targetComponentKey = '') {
|
|
182
|
+
let workflowId = String(meta._workflow_id || '');
|
|
183
|
+
const sourceId = String(meta._upstream_w_id || '');
|
|
184
|
+
const requestedKey = String(right.key || right.paramKey || right.value || '');
|
|
185
|
+
if (requestedKey.startsWith('FormData.') || requestedKey.startsWith('ApprovalData.') || requestedKey.startsWith('CycleParams.') || requestedKey.startsWith('FilterResult.')) {
|
|
186
|
+
throw new Error('filterCondition 上下文引用必须使用原始 paramKey(key/paramKey),不能使用 FormData./ApprovalData. 设计器公式路径');
|
|
187
|
+
}
|
|
188
|
+
if (!workflowId) {
|
|
189
|
+
const candidates = Object.entries(getWorkflowContextFields()).filter(([, fields]) => requestedKey in fields).map(([wfId]) => wfId);
|
|
190
|
+
if (candidates.length === 1)
|
|
191
|
+
workflowId = candidates[0];
|
|
192
|
+
}
|
|
193
|
+
let sourceMeta = {};
|
|
194
|
+
if (workflowId) {
|
|
195
|
+
const ctxFields = getWorkflowContextFields()[workflowId] || {};
|
|
196
|
+
sourceMeta = ctxFields[requestedKey] || {};
|
|
197
|
+
if (!sourceMeta || Object.keys(sourceMeta).length === 0) {
|
|
198
|
+
for (const f of Object.values(ctxFields)) {
|
|
199
|
+
if (f && typeof f === 'object' && String(f.paramKey || '') === requestedKey) {
|
|
200
|
+
sourceMeta = f;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
let paramKey = String(sourceMeta.paramKey || '');
|
|
207
|
+
if (!paramKey) {
|
|
208
|
+
if (workflowId && requestedKey.startsWith(`${workflowId}.`))
|
|
209
|
+
paramKey = requestedKey;
|
|
210
|
+
else {
|
|
211
|
+
const sourceFieldId = workflowId ? workflowFieldId(workflowId, requestedKey) : requestedKey;
|
|
212
|
+
paramKey = workflowId && sourceFieldId ? `${workflowId}.${sourceFieldId}` : sourceFieldId;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (!sourceId || !paramKey)
|
|
216
|
+
throw new Error(`filterCondition 右值上下文字段 '${requestedKey}' 未解析到真实触发器节点/paramKey`);
|
|
217
|
+
const label = String(right.label || sourceMeta.showName || requestedKey);
|
|
218
|
+
let paramType = String(sourceMeta.paramType || '').toLowerCase();
|
|
219
|
+
if (!paramType)
|
|
220
|
+
paramType = { Number: 'double', Date: 'date', Boolean: 'boolean' }[targetFieldType] ?? 'string';
|
|
221
|
+
const componentKey = String(sourceMeta.componentKey || '');
|
|
222
|
+
if (componentKey) {
|
|
223
|
+
const sourceFamily = conditionFieldFamily(componentKey, paramType);
|
|
224
|
+
const targetFamily = conditionFieldFamily(targetComponentKey, targetFieldType);
|
|
225
|
+
if (sourceFamily !== targetFamily) {
|
|
226
|
+
throw new Error(`filterCondition 右值字段 '${requestedKey}'(${componentKey}) 与左侧字段(${targetComponentKey || targetFieldType})类型不兼容`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const contextIsArray = paramKey.endsWith('[]') || Boolean(sourceMeta.arrs);
|
|
230
|
+
const tail = paramKey.includes('.') ? paramKey.slice(paramKey.lastIndexOf('.') + 1).replace(/\[\]$/, '') : paramKey.replace(/\[\]$/, '');
|
|
231
|
+
const isApproval = !/^\d+$/.test(tail) && !String(sourceMeta.componentKey || '');
|
|
232
|
+
const valuePath = paramKey.startsWith('FormData.') || paramKey.startsWith('ApprovalData.') || paramKey.startsWith('CycleParams.') || paramKey.startsWith('FilterResult.')
|
|
233
|
+
? paramKey
|
|
234
|
+
: (isApproval ? `ApprovalData.${paramKey}` : `FormData.${paramKey}`);
|
|
235
|
+
const tablePrimaryKey = isApproval ? 'ApprovalData' : 'FormData';
|
|
236
|
+
const tableName = isApproval ? '流程数据' : '表单数据';
|
|
237
|
+
const wfName = String(meta._upstream_workflow_name || '');
|
|
238
|
+
const displayParent = isApproval && wfName ? `${wfName}.${label}` : label;
|
|
239
|
+
const config = {
|
|
240
|
+
paramKey, paramType, isMultCom: false, comType: 'ApproveTrigger',
|
|
241
|
+
parentName: displayParent, newParentName: displayParent, parentComId: 0, multName: '', multKey: '',
|
|
242
|
+
multTypeObj: { allName: displayParent, currentName: displayParent, currentParamKey: valuePath, allParamKey: valuePath },
|
|
243
|
+
comId: sourceId, tableName,
|
|
244
|
+
fieldInfo: { paramKey, tablePrimaryKey },
|
|
245
|
+
};
|
|
246
|
+
const value = {
|
|
247
|
+
frontId: String(sourceMeta.id || tail),
|
|
248
|
+
formulaType: paramType,
|
|
249
|
+
businessId: genSfId(),
|
|
250
|
+
paramKey, paramType,
|
|
251
|
+
name: label, showName: label, parentName: displayParent,
|
|
252
|
+
source: sourceId, id: genSfId(), type: '3', applicationId: String(appId),
|
|
253
|
+
value: valuePath, arrs: contextIsArray, config, fieldType: paramType,
|
|
254
|
+
};
|
|
255
|
+
if (componentKey)
|
|
256
|
+
value.componentKey = componentKey;
|
|
257
|
+
return [value, contextIsArray];
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=filter_rules.js.map
|