@blueking/bkflow-canvas-editor 1.0.2 → 1.0.3

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/index.d.ts CHANGED
@@ -6,8 +6,45 @@ import { CanvasUiEvent, QuickAddConfig, FlowModel, FlowNodeModel, NodeActionsCon
6
6
  export { InsertDirection, QuickAddConfig, QuickAddInsertDirectionResolver, QuickAddPortResolver } from '@blueking/flow-canvas';
7
7
 
8
8
  type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED';
9
+ type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
9
10
  interface NodeExecutionState {
10
11
  status: NodeExecutionStatus;
12
+ /** 旧版任务引擎的 task 状态,优先用于识别 REVOKED */
13
+ taskState?: string;
14
+ /** 兼容旧版 snake_case 字段 */
15
+ task_state?: string;
16
+ /** 节点组件 code,如 pause_node / bk_approve,用于动作分流 */
17
+ nodeCode?: string;
18
+ /** 兼容旧版 snake_case 字段 */
19
+ code?: string;
20
+ /** 编辑态配置:失败可重试 */
21
+ retryable?: boolean;
22
+ /** 编辑态配置:失败可跳过 */
23
+ skippable?: boolean;
24
+ /** 编辑态配置:自动忽略错误(隐含 retry/skip 权限) */
25
+ errorIgnorable?: boolean;
26
+ /** 兼容旧版 snake_case 字段 */
27
+ error_ignorable?: boolean;
28
+ /** 是否有管理员权限,影响强制终止按钮 */
29
+ hasAdminPerm?: boolean;
30
+ /** 兼容旧版 snake_case 字段 */
31
+ has_admin_perm?: boolean;
32
+ /** 运行时信息:实际重试次数 */
33
+ retry?: number;
34
+ /** 运行时信息:是否已跳过 */
35
+ skip?: boolean;
36
+ /** 运行时信息:是否自动忽略错误 */
37
+ errorIgnored?: boolean;
38
+ /** 兼容旧版 snake_case 字段 */
39
+ error_ignored?: boolean;
40
+ /** 运行时信息:循环次数 */
41
+ loop?: number;
42
+ /** 运行时信息:生命周期阶段 */
43
+ phase?: number;
44
+ /** 若由上游直接给出操作列表,则 resolver 不再推导 */
45
+ actions?: ExecutionNodeAction[];
46
+ /** 兼容旧版后端直接透出的动作数组字段 */
47
+ action_list?: ExecutionNodeAction[];
11
48
  }
12
49
  type TaskExecutionStates = Record<string, NodeExecutionState>;
13
50
 
@@ -70,6 +107,16 @@ interface Activity {
70
107
  action: string;
71
108
  };
72
109
  status?: NodeExecutionStatus;
110
+ /** 执行态:实际重试次数 */
111
+ retry?: number;
112
+ /** 执行态:是否被跳过 */
113
+ skip?: boolean;
114
+ /** 执行态:是否自动忽略错误 */
115
+ error_ignored?: boolean;
116
+ /** 执行态:循环执行次数 */
117
+ loop?: number;
118
+ /** 执行态:生命周期阶段 */
119
+ phase?: number;
73
120
  }
74
121
 
75
122
  interface StartEvent {
@@ -768,6 +815,12 @@ type __VLS_Props$4 = {
768
815
  onBack?: () => void;
769
816
  };
770
817
  declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
818
+ retry: (nodeId: string) => any;
819
+ skip: (nodeId: string) => any;
820
+ resume: (nodeId: string) => any;
821
+ approve: (nodeId: string) => any;
822
+ forceFail: (nodeId: string) => any;
823
+ gatewaySkip: (nodeId: string) => any;
771
824
  back: () => any;
772
825
  "ui-event": (event: CanvasUiEvent) => any;
773
826
  "node-click": (event: {
@@ -776,7 +829,17 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
776
829
  } & {
777
830
  type: "node.click";
778
831
  }) => any;
832
+ "execution-action": (payload: {
833
+ nodeId: string;
834
+ action: ExecutionNodeAction;
835
+ }) => any;
779
836
  }, string, vue.PublicProps, Readonly<__VLS_Props$4> & Readonly<{
837
+ onRetry?: ((nodeId: string) => any) | undefined;
838
+ onSkip?: ((nodeId: string) => any) | undefined;
839
+ onResume?: ((nodeId: string) => any) | undefined;
840
+ onApprove?: ((nodeId: string) => any) | undefined;
841
+ onForceFail?: ((nodeId: string) => any) | undefined;
842
+ onGatewaySkip?: ((nodeId: string) => any) | undefined;
780
843
  onBack?: (() => any) | undefined;
781
844
  "onUi-event"?: ((event: CanvasUiEvent) => any) | undefined;
782
845
  "onNode-click"?: ((event: {
@@ -785,6 +848,10 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
785
848
  } & {
786
849
  type: "node.click";
787
850
  }) => any) | undefined;
851
+ "onExecution-action"?: ((payload: {
852
+ nodeId: string;
853
+ action: ExecutionNodeAction;
854
+ }) => any) | undefined;
788
855
  }>, {
789
856
  showHeader: boolean;
790
857
  defaultZoom: number;
@@ -1246,6 +1313,21 @@ declare const bkflowConnectionValidator: ConnectionValidator;
1246
1313
 
1247
1314
  declare function createExecutionStatusPlugin(stateRef: Ref<TaskExecutionStates>): CanvasPlugin;
1248
1315
 
1316
+ /**
1317
+ * 执行态动作 resolver。
1318
+ *
1319
+ * 输入的 nodeType 必须是 canvas-adapter schema 层的节点类型(例如 `task` /
1320
+ * `exclusive-gateway` / `parallel-gateway`),不要直接传 pipelineTree 的
1321
+ * `ServiceActivity` / `ExclusiveGateway` 等原始类型。
1322
+ *
1323
+ * 行为:
1324
+ * - 如果上游显式给出 `state.actions`,优先使用;
1325
+ * - 否则根据 status / nodeCode / retryable / skippable / errorIgnorable 推导。
1326
+ *
1327
+ * 不涵盖子流程节点(当前 schema 没有独立的 subprocess 节点类型),留待后续 PR。
1328
+ */
1329
+ declare function resolveExecutionActions(state: NodeExecutionState | undefined, nodeType: string): ExecutionNodeAction[];
1330
+
1249
1331
  declare const _default: {
1250
1332
  FlowView: () => Promise<typeof __view_vue>;
1251
1333
  FlowEdit: () => Promise<typeof __edit_vue>;
@@ -1254,5 +1336,5 @@ declare const _default: {
1254
1336
  FlowDebug: () => Promise<typeof __debug_vue>;
1255
1337
  };
1256
1338
 
1257
- export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, provideFlowApiConfig, provideSelectPanelConfig, random4, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useSelectPanelConfig, validatePipelineTree };
1258
- export type { Activity, DndNodeItem, FlowApiConfig, FlowEditExpose, FlowTemplate, Gateway, GatewayCondition, NodeExecutionState, NodeExecutionStatus, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };
1339
+ export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, provideFlowApiConfig, provideSelectPanelConfig, random4, resolveExecutionActions, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useSelectPanelConfig, validatePipelineTree };
1340
+ export type { Activity, DndNodeItem, ExecutionNodeAction, FlowApiConfig, FlowEditExpose, FlowTemplate, Gateway, GatewayCondition, NodeExecutionState, NodeExecutionStatus, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };