@digitalsee-ai/rcs 2.0.0-beta2 → 2.0.0-beta3

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.
@@ -1,4 +1,5 @@
1
1
  import { EdgeType } from '../enums/edge';
2
+ import { ExecutionControlState } from '../store/workflowSlice';
2
3
  import { CanvasAPI, WorkflowCanvasMode } from '../types/engine';
3
4
  import { FlowDraftPayload } from '../types/flowVersion';
4
5
  import { MarkerType, Viewport } from '@xyflow/react';
@@ -21,6 +22,23 @@ export declare const defaultEdgeOptions: {
21
22
  color: string;
22
23
  };
23
24
  };
25
+ /**
26
+ * 宿主 onLoad 需返回的工作流数据(ACM 流程格式)
27
+ *
28
+ * @description 与 adaptApiGetFlowData 的输入结构一致
29
+ */
30
+ export type WorkflowLoadResponse = {
31
+ id?: string;
32
+ name?: string;
33
+ /** 流程节点列表(ACM 后端格式) */
34
+ nodes?: any[];
35
+ /** 流程连接列表(ACM 后端格式) */
36
+ connections?: any[];
37
+ /** 流程状态,如 online/offline */
38
+ op_status?: string;
39
+ /** 执行控制配置 */
40
+ execution_control?: ExecutionControlState | null;
41
+ };
24
42
  /** 工作流画布属性接口 */
25
43
  export interface WorkflowCanvasProps {
26
44
  workflowId?: string;
@@ -29,6 +47,7 @@ export interface WorkflowCanvasProps {
29
47
  onSave?: (workflow: FlowDraftPayload) => void | Promise<void>;
30
48
  onInit?: (api: CanvasAPI) => void;
31
49
  onOffline?: (workflowId: string) => Promise<boolean>;
50
+ onLoad?: (workflowId?: string) => Promise<WorkflowLoadResponse>;
32
51
  scene?: string;
33
52
  }
34
53
  /** 常量定义 */
@@ -1,5 +1,6 @@
1
+ import { WorkflowLoadResponse } from '../constants';
1
2
  import { LoadErrorInfo } from '../FullscreenLoading';
2
- import { WorkflowCanvasStrategy } from '../types';
3
+ import { LoadFlowResult, WorkflowCanvasStrategy } from '../types';
3
4
  import { AppDispatch } from '../../store';
4
5
  import { Edge, Node } from '@xyflow/react';
5
6
  interface UseDataLoadingParams {
@@ -12,6 +13,7 @@ interface UseDataLoadingParams {
12
13
  dispatch: AppDispatch;
13
14
  setFlowOpStatusAction: (status: any) => void;
14
15
  refreshWorkFlowNum: number;
16
+ onLoad?: (workflowId?: string) => Promise<WorkflowLoadResponse>;
15
17
  }
16
18
  /**
17
19
  * 扫描 flowNodes 中带 action_key / action_ver 的 NodePackage 节点,
@@ -38,6 +40,12 @@ export declare function preloadClassicNodeSchemas(flowNodes: Node[]): Promise<vo
38
40
  * 拉取做去重,幂等检查由 listRegisteredDescriptorIds().includes 兜底。
39
41
  */
40
42
  export declare function ensureClassicNodeTypesRegistered(flowNodes: Node[]): Promise<void>;
43
+ /**
44
+ * 将宿主 onLoad 返回的 ACM 流程数据适配为 LoadFlowResult。
45
+ *
46
+ * Export 仅供测试访问,业务侧请通过 useDataLoading 触发。
47
+ */
48
+ export declare function adaptOnLoadResponse(response: WorkflowLoadResponse): LoadFlowResult;
41
49
  /**
42
50
  * 数据加载 Hook
43
51
  *
@@ -1,3 +1,4 @@
1
+ import { WorkflowLoadResponse } from './Canvas/constants';
1
2
  import { default as defaultCanvasEngineConfig } from './config/defaultCanvasEngineConfig';
2
3
  import { CanvasEngineConfig, DeepPartial, WorkflowCanvasMode, CanvasAPI, HistoryNavigator, HttpClient } from './types/engine';
3
4
  import { mergeConfig } from './utils/mergeConfig';
@@ -64,6 +65,15 @@ export interface DigitalseeWorkFlowProps {
64
65
  * @returns 是否成功下线
65
66
  */
66
67
  onOffline?: (workflowId: string) => Promise<boolean>;
68
+ /**
69
+ * 由宿主提供的工作流数据加载方法
70
+ *
71
+ * @description 提供后,画布加载数据时将调用它替代内部 API(需同时传入 workflowId)。
72
+ * workflowId 参数仅作透传参考,宿主可忽略并自行决定加载内容。
73
+ * 返回数据须符合 ACM 流程格式,见 WorkflowLoadResponse。
74
+ * 加载失败时宿主应 throw / reject,画布会展示失败浮层并支持重试。
75
+ */
76
+ onLoad?: (workflowId?: string) => Promise<WorkflowLoadResponse>;
67
77
  /**
68
78
  * 场景值
69
79
  */
@@ -76,6 +86,7 @@ export interface DigitalseeWorkFlowProps {
76
86
  */
77
87
  declare const DigitalseeWorkFlow: (props: DigitalseeWorkFlowProps) => any;
78
88
  export type { WorkflowHttpClient } from './api';
89
+ export type { WorkflowLoadResponse } from './Canvas/constants';
79
90
  export { configureWorkflow, getGlobalWorkflowConfig, resetGlobalWorkflowConfig, } from './config/globalConfig';
80
91
  export * from './config/themeConfig';
81
92
  export { useCanvasApi } from './context/canvasApiContext';