@blueking/bkflow-canvas-editor 1.1.0-beta.1 → 1.1.0-beta.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
@@ -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,38 @@ 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;
1236
+ createVariable: (payload: {
1237
+ keyword: string;
1238
+ cursorIndex: number;
1239
+ }) => any;
1022
1240
  }, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{
1023
1241
  onBack?: (() => any) | undefined;
1024
1242
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
1243
+ onMockDebugCreated?: ((params: {
1244
+ taskId: number | string;
1245
+ templateId: number | string;
1246
+ }) => any) | undefined;
1025
1247
  onSaveSuccess?: (() => any) | undefined;
1026
1248
  onExitEdit?: (() => any) | undefined;
1027
1249
  onDebugBeforeClose?: (() => any) | undefined;
1250
+ onCreateVariable?: ((payload: {
1251
+ keyword: string;
1252
+ cursorIndex: number;
1253
+ }) => any) | undefined;
1028
1254
  }>, {
1029
1255
  quickAdd: QuickAddConfig;
1030
1256
  defaultZoom: number;
1257
+ enableVersion: boolean;
1031
1258
  permissions: {
1032
1259
  canSave?: boolean;
1033
1260
  };
1034
- enableVersion: boolean;
1035
1261
  enableDebug: boolean;
1036
1262
  useCustomDebugConfirm: boolean;
1037
1263
  enableThirdPlugin: boolean;
@@ -1064,6 +1290,12 @@ type __VLS_Slots$1 = {
1064
1290
  }[];
1065
1291
  updateInputParams: (data: Record<string, any>) => void;
1066
1292
  }) => any;
1293
+ debugCustomFormContent?: (props: {
1294
+ formData: {
1295
+ name: string;
1296
+ };
1297
+ variablesValue: Record<string, any>;
1298
+ }) => any;
1067
1299
  };
1068
1300
  type __VLS_Props$1 = {
1069
1301
  flowId: string;
@@ -1080,21 +1312,36 @@ type __VLS_Props$1 = {
1080
1312
  defaultZoom?: number;
1081
1313
  bkflowSaasUrl?: string;
1082
1314
  onExecuteSuccess?: (taskId: number, templateId: number) => void;
1315
+ memberSelectorConfig?: MemberSelectorConfig;
1316
+ enableDebug?: boolean;
1317
+ onMockDebugCreated?: (params: {
1318
+ taskId: number | string;
1319
+ templateId: number | string;
1320
+ }) => void;
1083
1321
  };
1084
1322
  declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1085
- back: () => any;
1086
1323
  edit: () => any;
1324
+ back: () => any;
1325
+ mockDebugCreated: (params: {
1326
+ taskId: number | string;
1327
+ templateId: number | string;
1328
+ }) => any;
1087
1329
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1088
- onBack?: (() => any) | undefined;
1089
1330
  onEdit?: (() => any) | undefined;
1331
+ onBack?: (() => any) | undefined;
1332
+ onMockDebugCreated?: ((params: {
1333
+ taskId: number | string;
1334
+ templateId: number | string;
1335
+ }) => any) | undefined;
1090
1336
  }>, {
1091
1337
  thumbnail: boolean;
1092
1338
  defaultZoom: number;
1339
+ enableVersion: boolean;
1093
1340
  permissions: {
1094
1341
  canEdit?: boolean;
1095
1342
  };
1096
- enableVersion: boolean;
1097
1343
  showHeaderActions: boolean;
1344
+ enableDebug: boolean;
1098
1345
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1099
1346
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1100
1347
  declare const _default$2: typeof __VLS_export$1;
@@ -1111,6 +1358,52 @@ declare namespace __view_vue {
1111
1358
  };
1112
1359
  }
1113
1360
 
1361
+ type SimulateDebugStage = 'edit' | 'mock-config' | 'mock-running';
1362
+ 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';
1363
+ interface MockOutputField extends PluginOutputItem {
1364
+ form_type?: string;
1365
+ options?: Array<{
1366
+ label: string;
1367
+ value: unknown;
1368
+ text?: string;
1369
+ }>;
1370
+ schema?: Record<string, unknown>;
1371
+ default?: unknown;
1372
+ }
1373
+ interface NodeMockConfig {
1374
+ nodeId: string;
1375
+ outputs: Record<string, unknown>;
1376
+ fieldSnapshots: Record<string, MockOutputField>;
1377
+ }
1378
+ interface SimulateDebugState {
1379
+ stage: SimulateDebugStage;
1380
+ selectedNodeIds: Set<string>;
1381
+ mockConfigs: Record<string, NodeMockConfig>;
1382
+ activeConfigNodeId?: string;
1383
+ activeRunningNodeId?: string;
1384
+ taskId?: number | string;
1385
+ taskStatus?: 'RUNNING' | 'FINISHED' | 'FAILED';
1386
+ taskStartedAt?: number;
1387
+ nodeStates?: TaskExecutionStates;
1388
+ resultDrawerOpen: boolean;
1389
+ }
1390
+ interface SimulateDebugCanvasContext {
1391
+ stage: Ref<SimulateDebugStage>;
1392
+ isMockSelected: (nodeId: string) => boolean;
1393
+ toggleMockSelected: (nodeId: string) => void;
1394
+ hasMockConfig: (nodeId: string) => boolean;
1395
+ isAllMockNodesSelected?: () => boolean;
1396
+ }
1397
+
1398
+ interface OutputNormalizeOptions {
1399
+ includeSystem?: boolean;
1400
+ }
1401
+ declare function mergeOutputs(...groups: Array<Array<PluginOutputItem | MockOutputField>>): MockOutputField[];
1402
+ declare function normalizePluginOutputItems(outputs: unknown, options?: OutputNormalizeOptions): MockOutputField[];
1403
+ declare function resolveMockFormControl(field: MockOutputField): MockFormControl;
1404
+
1405
+ declare function isMockableNode(node: NodeType | Activity | undefined | null): node is Activity;
1406
+
1114
1407
  declare const random4: () => string;
1115
1408
  declare const generateId: (group?: number) => string;
1116
1409
 
@@ -1127,6 +1420,12 @@ declare const getVariableDefaultConfig: () => Variable;
1127
1420
 
1128
1421
  declare const getUniformApiPluginFormValue: (config: UniformApiPluginInputsItem$1) => PluginInputDataItem["value"];
1129
1422
 
1423
+ type BkflowBusinessCanvasMode = 'edit' | 'view' | 'mock-config' | 'execute';
1424
+ interface BkflowSchemaOptions {
1425
+ getBusinessMode?: () => BkflowBusinessCanvasMode;
1426
+ }
1427
+ declare function createBkflowSchema(options?: BkflowSchemaOptions): CanvasSchema;
1428
+
1130
1429
  declare class BkFlowNodeAccessor {
1131
1430
  private node;
1132
1431
  constructor(node: FlowNodeModel);
@@ -1170,13 +1469,15 @@ declare class BkFlowModelAccessor {
1170
1469
 
1171
1470
  type __VLS_Props = {
1172
1471
  pipelineTree: PipelineTree;
1173
- mode?: 'edit' | 'view';
1472
+ mode?: BkflowBusinessCanvasMode;
1174
1473
  thumbnail?: boolean;
1175
1474
  defaultZoom?: number;
1176
1475
  nodeActions?: NodeActionsConfig;
1177
1476
  quickAdd?: QuickAddConfig;
1178
1477
  connectionValidator?: ConnectionValidator;
1179
1478
  additionalPlugins?: CanvasPlugin[];
1479
+ toolbarItems?: CanvasToolbarItem[];
1480
+ simulateDebugContext?: SimulateDebugCanvasContext;
1180
1481
  };
1181
1482
  declare var __VLS_8: {};
1182
1483
  declare var __VLS_22: {
@@ -1271,7 +1572,7 @@ declare const __VLS_base: vue.DefineComponent<__VLS_Props, {
1271
1572
  }) => any) | undefined;
1272
1573
  "onFormat-position"?: (() => any) | undefined;
1273
1574
  }>, {
1274
- mode: "edit" | "view";
1575
+ mode: BkflowBusinessCanvasMode;
1275
1576
  thumbnail: boolean;
1276
1577
  nodeActions: NodeActionsConfig;
1277
1578
  quickAdd: QuickAddConfig;
@@ -1303,8 +1604,6 @@ declare function importFromPipelineTree(tree: PipelineTree): FlowModel;
1303
1604
 
1304
1605
  declare function exportToPipelineTree(flowModel: FlowModel): PipelineTree;
1305
1606
 
1306
- declare function createBkflowSchema(): CanvasSchema;
1307
-
1308
1607
  /**
1309
1608
  * 创建 bkflow 业务插件实例。
1310
1609
  * 每次调用返回独立实例,避免多个画布共享模块级可变状态。
@@ -1346,7 +1645,8 @@ declare const _default: {
1346
1645
  FlowCreateTask: () => Promise<typeof __create_task_vue>;
1347
1646
  FlowExecute: () => Promise<typeof __execute_vue>;
1348
1647
  FlowDebug: () => Promise<typeof __debug_vue>;
1648
+ FlowMockDebug: () => Promise<typeof __mock_vue>;
1349
1649
  };
1350
1650
 
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 };
1651
+ 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 };
1652
+ 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 };