@blueking/bkflow-canvas-editor 1.0.2 → 1.1.0-beta.0

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 {
@@ -160,13 +207,25 @@ interface Variable {
160
207
  show_type: 'show' | 'hide';
161
208
  source_info: Record<string, string[]>;
162
209
  source_tag: string;
163
- source_type: 'custom' | 'component_inputs' | 'component_outputs' | 'system';
210
+ source_type: 'custom' | 'component_inputs' | 'component_outputs' | 'system' | 'space';
164
211
  validation: string;
165
- value?: string | number | boolean | Record<string, any>;
212
+ value?: string | number | boolean | Record<string, any> | any[];
166
213
  version?: string;
167
214
  form_schema?: Record<string, any>;
168
215
  pre_render_mako?: boolean;
169
216
  plugin_code?: string;
217
+ /**
218
+ * 全局变量改版后新增字段,前端自管。
219
+ * 用于存储「组件配置」区域的扩展字段(如 required、data_type、placeholder、validation_error_msg),
220
+ * 后端原样透传即可。
221
+ */
222
+ meta?: {
223
+ required?: boolean;
224
+ data_type?: string;
225
+ placeholder?: string;
226
+ validation_error_msg?: string;
227
+ [key: string]: any;
228
+ };
170
229
  }
171
230
 
172
231
  interface PipelineTree {
@@ -714,14 +773,14 @@ type __VLS_Props$5 = {
714
773
  enableVersion?: boolean;
715
774
  flowVersion?: string;
716
775
  };
717
- declare var __VLS_65: {
776
+ declare var __VLS_72: {
718
777
  formData: {
719
778
  name: string;
720
779
  };
721
780
  variablesValue: Record<string, any>;
722
781
  };
723
782
  type __VLS_Slots$4 = {} & {
724
- 'custom-form-content'?: (props: typeof __VLS_65) => any;
783
+ 'custom-form-content'?: (props: typeof __VLS_72) => any;
725
784
  };
726
785
  declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
727
786
  close: (...args: any[]) => void;
@@ -768,6 +827,12 @@ type __VLS_Props$4 = {
768
827
  onBack?: () => void;
769
828
  };
770
829
  declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
830
+ retry: (nodeId: string) => any;
831
+ skip: (nodeId: string) => any;
832
+ resume: (nodeId: string) => any;
833
+ approve: (nodeId: string) => any;
834
+ forceFail: (nodeId: string) => any;
835
+ gatewaySkip: (nodeId: string) => any;
771
836
  back: () => any;
772
837
  "ui-event": (event: CanvasUiEvent) => any;
773
838
  "node-click": (event: {
@@ -776,7 +841,17 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
776
841
  } & {
777
842
  type: "node.click";
778
843
  }) => any;
844
+ "execution-action": (payload: {
845
+ nodeId: string;
846
+ action: ExecutionNodeAction;
847
+ }) => any;
779
848
  }, string, vue.PublicProps, Readonly<__VLS_Props$4> & Readonly<{
849
+ onRetry?: ((nodeId: string) => any) | undefined;
850
+ onSkip?: ((nodeId: string) => any) | undefined;
851
+ onResume?: ((nodeId: string) => any) | undefined;
852
+ onApprove?: ((nodeId: string) => any) | undefined;
853
+ onForceFail?: ((nodeId: string) => any) | undefined;
854
+ onGatewaySkip?: ((nodeId: string) => any) | undefined;
780
855
  onBack?: (() => any) | undefined;
781
856
  "onUi-event"?: ((event: CanvasUiEvent) => any) | undefined;
782
857
  "onNode-click"?: ((event: {
@@ -785,6 +860,10 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
785
860
  } & {
786
861
  type: "node.click";
787
862
  }) => any) | undefined;
863
+ "onExecution-action"?: ((payload: {
864
+ nodeId: string;
865
+ action: ExecutionNodeAction;
866
+ }) => any) | undefined;
788
867
  }>, {
789
868
  showHeader: boolean;
790
869
  defaultZoom: number;
@@ -1246,6 +1325,21 @@ declare const bkflowConnectionValidator: ConnectionValidator;
1246
1325
 
1247
1326
  declare function createExecutionStatusPlugin(stateRef: Ref<TaskExecutionStates>): CanvasPlugin;
1248
1327
 
1328
+ /**
1329
+ * 执行态动作 resolver。
1330
+ *
1331
+ * 输入的 nodeType 必须是 canvas-adapter schema 层的节点类型(例如 `task` /
1332
+ * `exclusive-gateway` / `parallel-gateway`),不要直接传 pipelineTree 的
1333
+ * `ServiceActivity` / `ExclusiveGateway` 等原始类型。
1334
+ *
1335
+ * 行为:
1336
+ * - 如果上游显式给出 `state.actions`,优先使用;
1337
+ * - 否则根据 status / nodeCode / retryable / skippable / errorIgnorable 推导。
1338
+ *
1339
+ * 不涵盖子流程节点(当前 schema 没有独立的 subprocess 节点类型),留待后续 PR。
1340
+ */
1341
+ declare function resolveExecutionActions(state: NodeExecutionState | undefined, nodeType: string): ExecutionNodeAction[];
1342
+
1249
1343
  declare const _default: {
1250
1344
  FlowView: () => Promise<typeof __view_vue>;
1251
1345
  FlowEdit: () => Promise<typeof __edit_vue>;
@@ -1254,5 +1348,5 @@ declare const _default: {
1254
1348
  FlowDebug: () => Promise<typeof __debug_vue>;
1255
1349
  };
1256
1350
 
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 };
1351
+ 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 };
1352
+ 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 };