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

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
@@ -2,13 +2,78 @@ import * as vue from 'vue';
2
2
  import { ComputedRef, Ref } from 'vue';
3
3
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
4
4
  import * as _blueking_flow_canvas from '@blueking/flow-canvas';
5
- import { CanvasUiEvent, QuickAddConfig, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CommandEnvelope, CanvasSchema } from '@blueking/flow-canvas';
5
+ import { CanvasUiEvent, QuickAddConfig, CanvasSchema, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CanvasToolbarItem, CommandEnvelope } from '@blueking/flow-canvas';
6
6
  export { InsertDirection, QuickAddConfig, QuickAddInsertDirectionResolver, QuickAddPortResolver } from '@blueking/flow-canvas';
7
7
 
8
+ /**
9
+ * Flow API 配置接口
10
+ */
11
+ interface FlowApiConfig {
12
+ /** API 基础路径 */
13
+ baseURL?: string;
14
+ /** 自定义 axios 实例(可选,如果提供则优先使用) */
15
+ axiosInstance?: AxiosInstance;
16
+ /** axios 配置(可选,用于创建新的 axios 实例) */
17
+ axiosConfig?: AxiosRequestConfig;
18
+ /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
19
+ xsrfCookieName?: string;
20
+ /** 作用域数据(必需,由外部传入) */
21
+ scopeData: {
22
+ scope_type: string;
23
+ scope_value: number;
24
+ };
25
+ /**
26
+ * 用户查询 API 地址(可选)
27
+ * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
28
+ * 该字段仅保留向后兼容,未来版本会移除。
29
+ */
30
+ fetchUserApi?: string;
31
+ /** 是否启用第三方插件(可选,默认为 true) */
32
+ enableThirdPlugin?: boolean;
33
+ }
34
+
35
+ type __VLS_Slots$5 = {
36
+ header?: () => any;
37
+ extend?: () => any;
38
+ };
39
+ type __VLS_Props$6 = {
40
+ flowId: string;
41
+ taskId: string | number;
42
+ apiConfig: FlowApiConfig;
43
+ bkflowSaasUrl?: string;
44
+ defaultZoom?: number;
45
+ onBack?: () => void;
46
+ };
47
+ declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$6, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
48
+ back: () => any;
49
+ }, string, vue.PublicProps, Readonly<__VLS_Props$6> & Readonly<{
50
+ onBack?: (() => any) | undefined;
51
+ }>, {
52
+ defaultZoom: number;
53
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
54
+ declare const __VLS_export$6: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
55
+ declare const _default$7: typeof __VLS_export$6;
56
+
57
+ type __VLS_WithSlots$5<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
62
+
63
+ declare namespace __mock_vue {
64
+ export {
65
+ _default$7 as default,
66
+ };
67
+ }
68
+
8
69
  type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED';
9
70
  type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
10
71
  interface NodeExecutionState {
11
72
  status: NodeExecutionStatus;
73
+ version?: string;
74
+ start_time?: string;
75
+ finish_time?: string;
76
+ elapsed_time?: number;
12
77
  /** 旧版任务引擎的 task 状态,优先用于识别 REVOKED */
13
78
  taskState?: string;
14
79
  /** 兼容旧版 snake_case 字段 */
@@ -52,6 +117,8 @@ type PortOrientation = 'Top' | 'Right' | 'Bottom' | 'Left';
52
117
 
53
118
  type GatewayType = 'ExclusiveGateway' | 'ParallelGateway' | 'ConditionalParallelGateway' | 'ConvergeGateway';
54
119
 
120
+ type NodeType = StartEvent | EndEvent | Activity | Gateway;
121
+
55
122
  interface PluginInputDataItem {
56
123
  value:
57
124
  | string
@@ -507,6 +574,19 @@ interface DndNodeItem {
507
574
  disabledTip?: string;
508
575
  tipsImage?: string;
509
576
  }
577
+ interface UniformApiPluginOutputItem {
578
+ key: string;
579
+ name?: string;
580
+ type?: string;
581
+ description?: string;
582
+ schema?: Record<string, any>;
583
+ form_type?: string;
584
+ options?: Array<{
585
+ label?: string;
586
+ value?: unknown;
587
+ text?: string;
588
+ }>;
589
+ }
510
590
  interface UniformApiPluginDetail {
511
591
  alias: string;
512
592
  bk_tenant_id: string;
@@ -521,7 +601,7 @@ interface UniformApiPluginDetail {
521
601
  url: string;
522
602
  methods: string[];
523
603
  inputs: Record<string, any>;
524
- outputs: string[];
604
+ outputs?: Array<UniformApiPluginOutputItem | string>;
525
605
  scope_id: string;
526
606
  sign: string;
527
607
  updated_at: string;
@@ -622,29 +702,6 @@ interface FlowEditExpose {
622
702
  openGlobalVariables: () => void;
623
703
  }
624
704
 
625
- /**
626
- * Flow API 配置接口
627
- */
628
- interface FlowApiConfig {
629
- /** API 基础路径 */
630
- baseURL?: string;
631
- /** 自定义 axios 实例(可选,如果提供则优先使用) */
632
- axiosInstance?: AxiosInstance;
633
- /** axios 配置(可选,用于创建新的 axios 实例) */
634
- axiosConfig?: AxiosRequestConfig;
635
- /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
636
- xsrfCookieName?: string;
637
- /** 作用域数据(必需,由外部传入) */
638
- scopeData: {
639
- scope_type: string;
640
- scope_value: number;
641
- };
642
- /** 用户查询 API 地址(可选) */
643
- fetchUserApi?: string;
644
- /** 是否启用第三方插件(可选,默认为 true) */
645
- enableThirdPlugin?: boolean;
646
- }
647
-
648
705
  interface DrawPipelineParams {
649
706
  pipeline_tree: PipelineTree;
650
707
  canvas_width: number;
@@ -653,11 +710,73 @@ interface DrawPipelineParams {
653
710
  gateway_size?: [number, number];
654
711
  start?: [number, number];
655
712
  }
713
+ interface CreateMockDebugTaskParams {
714
+ template_id: number;
715
+ name: string;
716
+ pipeline_tree: PipelineTree;
717
+ mock_data: {
718
+ nodes: string[];
719
+ outputs: Record<string, Record<string, unknown>>;
720
+ mock_data_ids?: Record<string, number | string>;
721
+ };
722
+ creator?: string;
723
+ }
724
+ interface StopMockDebugTaskParams {
725
+ task_id: number | string;
726
+ }
727
+ interface FetchTaskStateParams {
728
+ task_id: number | string;
729
+ }
730
+ interface FetchTaskNodeDetailParams {
731
+ task_id: number | string;
732
+ node_id: string;
733
+ }
734
+ interface FetchTaskNodeSnapshotParams {
735
+ task_id: number | string;
736
+ node_id: string;
737
+ }
738
+ interface FetchTaskNodeLogParams {
739
+ task_id: number | string;
740
+ node_id: string;
741
+ version: string;
742
+ }
743
+ interface OperateTaskNodeParams {
744
+ task_id: number | string;
745
+ node_id: string;
746
+ action: ExecutionNodeAction;
747
+ data?: Record<string, unknown>;
748
+ /** 自定义 operation,优先级高于 action 默认映射 */
749
+ operation?: string;
750
+ }
751
+ interface GetFlowTaskDetailParams {
752
+ task_id: number | string;
753
+ }
754
+ interface FlowTaskDetail {
755
+ id: number | string;
756
+ template_id: number;
757
+ pipeline_tree: PipelineTree;
758
+ [key: string]: unknown;
759
+ }
760
+ interface TaskStateResult {
761
+ state?: string;
762
+ status?: string;
763
+ node_states?: TaskExecutionStates;
764
+ states?: Record<string, unknown>;
765
+ children?: Record<string, unknown> | unknown[];
766
+ nodes?: Record<string, unknown> | unknown[];
767
+ activities?: Record<string, unknown>;
768
+ gateways?: Record<string, unknown>;
769
+ [key: string]: unknown;
770
+ }
656
771
 
657
772
  interface FlowViewApiConfig {
658
773
  fetchFlowDetail: (id: string) => Promise<FlowTemplate>;
659
774
  fetchSpaceFlowConfig: (id: string) => Promise<SpaceFlowConfig>;
660
775
  fetchSystemVariables: (id: string) => Promise<Variable[]>;
776
+ /**
777
+ * 用户查询 API 地址
778
+ * @deprecated 请改用 memberSelectorConfig.fetchUserApi(顶层组件 prop)
779
+ */
661
780
  fetchUserApi?: string;
662
781
  /** 作用域数据(必需,由外部传入) */
663
782
  scopeData: {
@@ -694,12 +813,30 @@ interface FlowViewApiConfig {
694
813
  };
695
814
  }>;
696
815
  executeFlowTask?: (params: {
697
- task_id: number;
698
- action: string;
816
+ task_id: number | string;
699
817
  resource_type: string;
700
- resource_id: number;
818
+ resource_id: number | string;
701
819
  permission_type: string;
702
820
  }) => Promise<any>;
821
+ revokeFlowTask?: (params: {
822
+ task_id: number | string;
823
+ resource_type: string;
824
+ resource_id: number | string;
825
+ permission_type: string;
826
+ }) => Promise<any>;
827
+ createMockDebugTask?: (params: CreateMockDebugTaskParams) => Promise<{
828
+ data: {
829
+ id: number | string;
830
+ template_id: number;
831
+ };
832
+ }>;
833
+ stopMockDebugTask?: (params: StopMockDebugTaskParams) => Promise<void>;
834
+ fetchTaskState?: (params: FetchTaskStateParams) => Promise<TaskStateResult>;
835
+ fetchTaskNodeDetail?: (params: FetchTaskNodeDetailParams) => Promise<unknown>;
836
+ fetchTaskNodeSnapshot?: (params: FetchTaskNodeSnapshotParams) => Promise<unknown>;
837
+ fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
838
+ operateTaskNode?: (params: OperateTaskNodeParams) => Promise<unknown>;
839
+ getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
703
840
  fetchControlConfig?: () => Promise<Record<string, any>>;
704
841
  checkSpaceConfig?: (scopeValue: number, params: {
705
842
  name: string;
@@ -749,14 +886,122 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
749
886
  };
750
887
  }>;
751
888
  executeFlowTask?: (params: {
752
- task_id: number;
753
- action: string;
889
+ task_id: number | string;
754
890
  resource_type: string;
755
- resource_id: number;
891
+ resource_id: number | string;
756
892
  permission_type: string;
757
893
  }) => Promise<any>;
894
+ revokeFlowTask?: (params: {
895
+ task_id: number | string;
896
+ resource_type: string;
897
+ resource_id: number | string;
898
+ permission_type: string;
899
+ }) => Promise<any>;
900
+ createMockDebugTask?: (params: CreateMockDebugTaskParams) => Promise<{
901
+ data: {
902
+ id: number | string;
903
+ template_id: number;
904
+ };
905
+ }>;
906
+ stopMockDebugTask?: (params: StopMockDebugTaskParams) => Promise<void>;
907
+ fetchTaskState?: (params: FetchTaskStateParams) => Promise<TaskStateResult>;
908
+ fetchTaskNodeDetail?: (params: FetchTaskNodeDetailParams) => Promise<unknown>;
909
+ fetchTaskNodeSnapshot?: (params: FetchTaskNodeSnapshotParams) => Promise<unknown>;
910
+ fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
911
+ getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
758
912
  }
759
913
 
914
+ /**
915
+ * 插件分组选择面板配置
916
+ */
917
+ interface SelectPanelConfig {
918
+ agentApplyUrl?: string;
919
+ agentResourceUrl?: string;
920
+ agentButtonText?: string;
921
+ knowledgebaseResourceUrl?: string;
922
+ }
923
+ /**
924
+ * 人员选择器配置
925
+ * 采用判别联合(discriminated union):
926
+ * - mode 缺省或为 'legacy':使用组件内置的 UserSelector,依赖 fetchUserApi
927
+ * - mode 为 'tenant':使用多租户人员选择器 @blueking/bk-user-selector,
928
+ * tenantId 与 apiBaseUrl 在类型上即为必填
929
+ * 接入方需自行安装 npm 包 @blueking/bk-user-selector
930
+ */
931
+ type MemberSelectorConfig = {
932
+ mode?: 'legacy';
933
+ /** 用户查询 API 地址 */
934
+ fetchUserApi?: string;
935
+ } | {
936
+ mode: 'tenant';
937
+ /** 租户 ID */
938
+ tenantId: string;
939
+ /** bk-user 服务的 API 基础地址 */
940
+ apiBaseUrl: string;
941
+ /** 当前登录用户 ID,开启后可在下拉中快捷选择"我" */
942
+ currentUserId?: string;
943
+ /** 是否启用跨租户搜索,默认 false */
944
+ enableMultiTenantMode?: boolean;
945
+ /** 是否展示头像,默认 false */
946
+ hasAvatar?: boolean;
947
+ /** 头像 CDN 基础地址 */
948
+ avatarBaseUrl?: string;
949
+ /** 最近选择的用户 ID 列表 */
950
+ recentUserIds?: string[];
951
+ };
952
+ /**
953
+ * 在顶层组件中提供 FlowApiConfig
954
+ * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
955
+ * @returns 返回处理后的 API 配置对象
956
+ */
957
+ declare function provideFlowApiConfig(config: FlowApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowEditApiConfig | FlowViewApiConfig;
958
+ /**
959
+ * 在子组件中注入 FlowApiConfig(通用版本)
960
+ * @returns FlowEditApiConfig
961
+ * @throws 如果 apiConfig 未提供则抛出错误
962
+ */
963
+ declare function useFlowApiConfig(): FlowEditApiConfig;
964
+ /**
965
+ * 在子组件中注入 FlowEditApiConfig(类型化版本)
966
+ * @returns FlowEditApiConfig
967
+ */
968
+ declare function useFlowEditApiConfig(): FlowEditApiConfig;
969
+ /**
970
+ * 在子组件中注入 FlowViewApiConfig(类型化版本)
971
+ * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
972
+ * @returns FlowViewApiConfig
973
+ */
974
+ declare function useFlowViewApiConfig(): FlowViewApiConfig;
975
+ /**
976
+ * 在顶层组件中提供 SelectPanelConfig
977
+ * @param config SelectPanelConfig 配置对象
978
+ */
979
+ declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
980
+ /**
981
+ * 在子组件中注入 SelectPanelConfig
982
+ * @returns SelectPanelConfig 或 null(如果未提供配置)
983
+ */
984
+ declare function useSelectPanelConfig(): SelectPanelConfig | null;
985
+ /**
986
+ * 在顶层组件中提供 MemberSelectorConfig
987
+ *
988
+ * 注意:当 `config` 为 undefined 时,**不会调用 provide**,从而不会遮蔽
989
+ * 父级(如外层 FlowView/FlowEdit)已经 provide 的配置。
990
+ * 例如 `FlowView` 内部渲染 `FlowCreateTask` 时,如果调用方仅在 `FlowView`
991
+ * 上传入 `memberSelectorConfig`,则 `FlowCreateTask` 不会因为自己未收到 prop
992
+ * 而把 tenant 配置覆盖回 legacy。
993
+ *
994
+ * 若调用方主动传入 `{ mode: 'legacy' }`,则视为显式覆盖,按正常 provide。
995
+ *
996
+ * @param config MemberSelectorConfig 配置对象;为 undefined 时跳过 provide
997
+ */
998
+ declare function provideMemberSelectorConfig(config?: MemberSelectorConfig): void;
999
+ /**
1000
+ * 在子组件中注入 MemberSelectorConfig
1001
+ * @returns MemberSelectorConfig,未提供时返回 { mode: 'legacy' }
1002
+ */
1003
+ declare function useMemberSelectorConfig(): MemberSelectorConfig;
1004
+
760
1005
  type __VLS_Props$5 = {
761
1006
  flowId: string;
762
1007
  show: boolean;
@@ -768,10 +1013,12 @@ type __VLS_Props$5 = {
768
1013
  variablesValue: Record<string, any>;
769
1014
  }) => Promise<void> | void;
770
1015
  useCustomConfirm?: boolean;
771
- onExecuteSuccess?: (taskId: number, templateId: number) => void;
1016
+ mockData?: CreateMockDebugTaskParams['mock_data'];
1017
+ onExecuteSuccess?: (taskId: number | string, templateId: number) => void;
772
1018
  bkflowSaasUrl?: string;
773
1019
  enableVersion?: boolean;
774
1020
  flowVersion?: string;
1021
+ memberSelectorConfig?: MemberSelectorConfig;
775
1022
  };
776
1023
  declare var __VLS_72: {
777
1024
  formData: {
@@ -795,8 +1042,8 @@ declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, v
795
1042
  }>, {
796
1043
  editable: boolean;
797
1044
  showFlowEntry: boolean;
798
- enableVersion: boolean;
799
1045
  useCustomConfirm: boolean;
1046
+ enableVersion: boolean;
800
1047
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
801
1048
  declare const __VLS_export$5: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
802
1049
  declare const _default$6: typeof __VLS_export$5;
@@ -833,8 +1080,8 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
833
1080
  approve: (nodeId: string) => any;
834
1081
  forceFail: (nodeId: string) => any;
835
1082
  gatewaySkip: (nodeId: string) => any;
836
- back: () => any;
837
1083
  "ui-event": (event: CanvasUiEvent) => any;
1084
+ back: () => any;
838
1085
  "node-click": (event: {
839
1086
  type: "node.click";
840
1087
  nodeId: string;
@@ -852,8 +1099,8 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
852
1099
  onApprove?: ((nodeId: string) => any) | undefined;
853
1100
  onForceFail?: ((nodeId: string) => any) | undefined;
854
1101
  onGatewaySkip?: ((nodeId: string) => any) | undefined;
855
- onBack?: (() => any) | undefined;
856
1102
  "onUi-event"?: ((event: CanvasUiEvent) => any) | undefined;
1103
+ onBack?: (() => any) | undefined;
857
1104
  "onNode-click"?: ((event: {
858
1105
  type: "node.click";
859
1106
  nodeId: string;
@@ -892,6 +1139,7 @@ type __VLS_Props$3 = {
892
1139
  apiConfig: FlowApiConfig;
893
1140
  onExecuteSuccess?: (taskId: number, templateId: number) => void;
894
1141
  bkflowSaasUrl?: string;
1142
+ memberSelectorConfig?: MemberSelectorConfig;
895
1143
  };
896
1144
  declare const __VLS_export$3: vue.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
897
1145
  close: (...args: any[]) => void;
@@ -917,49 +1165,6 @@ declare namespace __create_task_vue {
917
1165
  };
918
1166
  }
919
1167
 
920
- /**
921
- * 插件分组选择面板配置
922
- */
923
- interface SelectPanelConfig {
924
- agentApplyUrl?: string;
925
- agentResourceUrl?: string;
926
- agentButtonText?: string;
927
- knowledgebaseResourceUrl?: string;
928
- }
929
- /**
930
- * 在顶层组件中提供 FlowApiConfig
931
- * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
932
- * @returns 返回处理后的 API 配置对象
933
- */
934
- declare function provideFlowApiConfig(config: FlowApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowEditApiConfig | FlowViewApiConfig;
935
- /**
936
- * 在子组件中注入 FlowApiConfig(通用版本)
937
- * @returns FlowEditApiConfig
938
- * @throws 如果 apiConfig 未提供则抛出错误
939
- */
940
- declare function useFlowApiConfig(): FlowEditApiConfig;
941
- /**
942
- * 在子组件中注入 FlowEditApiConfig(类型化版本)
943
- * @returns FlowEditApiConfig
944
- */
945
- declare function useFlowEditApiConfig(): FlowEditApiConfig;
946
- /**
947
- * 在子组件中注入 FlowViewApiConfig(类型化版本)
948
- * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
949
- * @returns FlowViewApiConfig
950
- */
951
- declare function useFlowViewApiConfig(): FlowViewApiConfig;
952
- /**
953
- * 在顶层组件中提供 SelectPanelConfig
954
- * @param config SelectPanelConfig 配置对象
955
- */
956
- declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
957
- /**
958
- * 在子组件中注入 SelectPanelConfig
959
- * @returns SelectPanelConfig 或 null(如果未提供配置)
960
- */
961
- declare function useSelectPanelConfig(): SelectPanelConfig | null;
962
-
963
1168
  type __VLS_Slots$2 = {
964
1169
  header?: () => any;
965
1170
  inputParams?: (props: {
@@ -997,11 +1202,16 @@ type __VLS_Props$2 = {
997
1202
  }) => Promise<void> | void;
998
1203
  useCustomDebugConfirm?: boolean;
999
1204
  selectPanelConfig?: SelectPanelConfig;
1205
+ memberSelectorConfig?: MemberSelectorConfig;
1000
1206
  onSave?: (flowData: FlowTemplate) => void;
1001
1207
  onSaveSuccess?: () => void;
1002
1208
  onBack?: () => void;
1003
1209
  onExitEdit?: () => void;
1004
1210
  onBeforeLeave?: (isEdited: boolean) => Promise<boolean>;
1211
+ onMockDebugCreated?: (params: {
1212
+ taskId: number | string;
1213
+ templateId: number | string;
1214
+ }) => void;
1005
1215
  enableVersion?: boolean;
1006
1216
  flowVersion?: string;
1007
1217
  defaultZoom?: number;
@@ -1016,22 +1226,30 @@ declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$2, {
1016
1226
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1017
1227
  back: () => any;
1018
1228
  save: (flowData: FlowTemplate) => any;
1229
+ mockDebugCreated: (params: {
1230
+ taskId: number | string;
1231
+ templateId: number | string;
1232
+ }) => any;
1019
1233
  saveSuccess: () => any;
1020
1234
  exitEdit: () => any;
1021
1235
  debugBeforeClose: () => any;
1022
1236
  }, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{
1023
1237
  onBack?: (() => any) | undefined;
1024
1238
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
1239
+ onMockDebugCreated?: ((params: {
1240
+ taskId: number | string;
1241
+ templateId: number | string;
1242
+ }) => any) | undefined;
1025
1243
  onSaveSuccess?: (() => any) | undefined;
1026
1244
  onExitEdit?: (() => any) | undefined;
1027
1245
  onDebugBeforeClose?: (() => any) | undefined;
1028
1246
  }>, {
1029
1247
  quickAdd: QuickAddConfig;
1030
1248
  defaultZoom: number;
1249
+ enableVersion: boolean;
1031
1250
  permissions: {
1032
1251
  canSave?: boolean;
1033
1252
  };
1034
- enableVersion: boolean;
1035
1253
  enableDebug: boolean;
1036
1254
  useCustomDebugConfirm: boolean;
1037
1255
  enableThirdPlugin: boolean;
@@ -1064,6 +1282,12 @@ type __VLS_Slots$1 = {
1064
1282
  }[];
1065
1283
  updateInputParams: (data: Record<string, any>) => void;
1066
1284
  }) => any;
1285
+ debugCustomFormContent?: (props: {
1286
+ formData: {
1287
+ name: string;
1288
+ };
1289
+ variablesValue: Record<string, any>;
1290
+ }) => any;
1067
1291
  };
1068
1292
  type __VLS_Props$1 = {
1069
1293
  flowId: string;
@@ -1080,21 +1304,36 @@ type __VLS_Props$1 = {
1080
1304
  defaultZoom?: number;
1081
1305
  bkflowSaasUrl?: string;
1082
1306
  onExecuteSuccess?: (taskId: number, templateId: number) => void;
1307
+ memberSelectorConfig?: MemberSelectorConfig;
1308
+ enableDebug?: boolean;
1309
+ onMockDebugCreated?: (params: {
1310
+ taskId: number | string;
1311
+ templateId: number | string;
1312
+ }) => void;
1083
1313
  };
1084
1314
  declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1085
- back: () => any;
1086
1315
  edit: () => any;
1316
+ back: () => any;
1317
+ mockDebugCreated: (params: {
1318
+ taskId: number | string;
1319
+ templateId: number | string;
1320
+ }) => any;
1087
1321
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1088
- onBack?: (() => any) | undefined;
1089
1322
  onEdit?: (() => any) | undefined;
1323
+ onBack?: (() => any) | undefined;
1324
+ onMockDebugCreated?: ((params: {
1325
+ taskId: number | string;
1326
+ templateId: number | string;
1327
+ }) => any) | undefined;
1090
1328
  }>, {
1091
1329
  thumbnail: boolean;
1092
1330
  defaultZoom: number;
1331
+ enableVersion: boolean;
1093
1332
  permissions: {
1094
1333
  canEdit?: boolean;
1095
1334
  };
1096
- enableVersion: boolean;
1097
1335
  showHeaderActions: boolean;
1336
+ enableDebug: boolean;
1098
1337
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1099
1338
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1100
1339
  declare const _default$2: typeof __VLS_export$1;
@@ -1111,6 +1350,52 @@ declare namespace __view_vue {
1111
1350
  };
1112
1351
  }
1113
1352
 
1353
+ type SimulateDebugStage = 'edit' | 'mock-config' | 'mock-running';
1354
+ type MockFormControl = 'bk-input' | 'bk-input-number' | 'bk-textarea' | 'json-editor' | 'bk-select' | 'bk-checkbox-group' | 'bk-radio-group' | 'bk-switcher' | 'bk-date-picker' | 'bk-date-range-picker' | 'data-table';
1355
+ interface MockOutputField extends PluginOutputItem {
1356
+ form_type?: string;
1357
+ options?: Array<{
1358
+ label: string;
1359
+ value: unknown;
1360
+ text?: string;
1361
+ }>;
1362
+ schema?: Record<string, unknown>;
1363
+ default?: unknown;
1364
+ }
1365
+ interface NodeMockConfig {
1366
+ nodeId: string;
1367
+ outputs: Record<string, unknown>;
1368
+ fieldSnapshots: Record<string, MockOutputField>;
1369
+ }
1370
+ interface SimulateDebugState {
1371
+ stage: SimulateDebugStage;
1372
+ selectedNodeIds: Set<string>;
1373
+ mockConfigs: Record<string, NodeMockConfig>;
1374
+ activeConfigNodeId?: string;
1375
+ activeRunningNodeId?: string;
1376
+ taskId?: number | string;
1377
+ taskStatus?: 'RUNNING' | 'FINISHED' | 'FAILED';
1378
+ taskStartedAt?: number;
1379
+ nodeStates?: TaskExecutionStates;
1380
+ resultDrawerOpen: boolean;
1381
+ }
1382
+ interface SimulateDebugCanvasContext {
1383
+ stage: Ref<SimulateDebugStage>;
1384
+ isMockSelected: (nodeId: string) => boolean;
1385
+ toggleMockSelected: (nodeId: string) => void;
1386
+ hasMockConfig: (nodeId: string) => boolean;
1387
+ isAllMockNodesSelected?: () => boolean;
1388
+ }
1389
+
1390
+ interface OutputNormalizeOptions {
1391
+ includeSystem?: boolean;
1392
+ }
1393
+ declare function mergeOutputs(...groups: Array<Array<PluginOutputItem | MockOutputField>>): MockOutputField[];
1394
+ declare function normalizePluginOutputItems(outputs: unknown, options?: OutputNormalizeOptions): MockOutputField[];
1395
+ declare function resolveMockFormControl(field: MockOutputField): MockFormControl;
1396
+
1397
+ declare function isMockableNode(node: NodeType | Activity | undefined | null): node is Activity;
1398
+
1114
1399
  declare const random4: () => string;
1115
1400
  declare const generateId: (group?: number) => string;
1116
1401
 
@@ -1127,6 +1412,12 @@ declare const getVariableDefaultConfig: () => Variable;
1127
1412
 
1128
1413
  declare const getUniformApiPluginFormValue: (config: UniformApiPluginInputsItem$1) => PluginInputDataItem["value"];
1129
1414
 
1415
+ type BkflowBusinessCanvasMode = 'edit' | 'view' | 'mock-config' | 'execute';
1416
+ interface BkflowSchemaOptions {
1417
+ getBusinessMode?: () => BkflowBusinessCanvasMode;
1418
+ }
1419
+ declare function createBkflowSchema(options?: BkflowSchemaOptions): CanvasSchema;
1420
+
1130
1421
  declare class BkFlowNodeAccessor {
1131
1422
  private node;
1132
1423
  constructor(node: FlowNodeModel);
@@ -1170,13 +1461,15 @@ declare class BkFlowModelAccessor {
1170
1461
 
1171
1462
  type __VLS_Props = {
1172
1463
  pipelineTree: PipelineTree;
1173
- mode?: 'edit' | 'view';
1464
+ mode?: BkflowBusinessCanvasMode;
1174
1465
  thumbnail?: boolean;
1175
1466
  defaultZoom?: number;
1176
1467
  nodeActions?: NodeActionsConfig;
1177
1468
  quickAdd?: QuickAddConfig;
1178
1469
  connectionValidator?: ConnectionValidator;
1179
1470
  additionalPlugins?: CanvasPlugin[];
1471
+ toolbarItems?: CanvasToolbarItem[];
1472
+ simulateDebugContext?: SimulateDebugCanvasContext;
1180
1473
  };
1181
1474
  declare var __VLS_8: {};
1182
1475
  declare var __VLS_22: {
@@ -1271,7 +1564,7 @@ declare const __VLS_base: vue.DefineComponent<__VLS_Props, {
1271
1564
  }) => any) | undefined;
1272
1565
  "onFormat-position"?: (() => any) | undefined;
1273
1566
  }>, {
1274
- mode: "edit" | "view";
1567
+ mode: BkflowBusinessCanvasMode;
1275
1568
  thumbnail: boolean;
1276
1569
  nodeActions: NodeActionsConfig;
1277
1570
  quickAdd: QuickAddConfig;
@@ -1303,8 +1596,6 @@ declare function importFromPipelineTree(tree: PipelineTree): FlowModel;
1303
1596
 
1304
1597
  declare function exportToPipelineTree(flowModel: FlowModel): PipelineTree;
1305
1598
 
1306
- declare function createBkflowSchema(): CanvasSchema;
1307
-
1308
1599
  /**
1309
1600
  * 创建 bkflow 业务插件实例。
1310
1601
  * 每次调用返回独立实例,避免多个画布共享模块级可变状态。
@@ -1346,7 +1637,8 @@ declare const _default: {
1346
1637
  FlowCreateTask: () => Promise<typeof __create_task_vue>;
1347
1638
  FlowExecute: () => Promise<typeof __execute_vue>;
1348
1639
  FlowDebug: () => Promise<typeof __debug_vue>;
1640
+ FlowMockDebug: () => Promise<typeof __mock_vue>;
1349
1641
  };
1350
1642
 
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 };
1643
+ export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$7 as FlowMockDebug, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, isMockableNode, mergeOutputs, normalizePluginOutputItems, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, random4, resolveExecutionActions, resolveMockFormControl, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
1644
+ export type { Activity, DndNodeItem, ExecutionNodeAction, FlowApiConfig, FlowEditExpose, FlowTemplate, Gateway, GatewayCondition, MemberSelectorConfig, MockOutputField, NodeExecutionState, NodeExecutionStatus, NodeMockConfig, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SimulateDebugCanvasContext, SimulateDebugStage, SimulateDebugState, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };