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

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,6 +1,6 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
 
3
- type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED';
3
+ type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'SKIP';
4
4
  type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
5
5
  interface NodeExecutionState {
6
6
  status: NodeExecutionStatus;
@@ -600,6 +600,158 @@ interface CustomVariableType {
600
600
  code: string;
601
601
  }
602
602
 
603
+ type DebugContextStatus = 'idle' | 'running' | 'terminating';
604
+ type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'revoked' | 'suspended' | 'skipped';
605
+ type DebugExecutionMode = 'real' | 'mock';
606
+ interface DebugMissingVar {
607
+ key: string;
608
+ source_node_id: string | null;
609
+ }
610
+ type DebugRunType = 'global' | 'step';
611
+ type DebugRunStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'terminating' | 'finished' | 'failed' | 'revoked';
612
+ /** 运行级 / 节点级错误详情(last_error_detail、nodes[].error_detail)。 */
613
+ interface DebugErrorFailure {
614
+ message: string;
615
+ node_id?: string;
616
+ template_node_id?: string;
617
+ [key: string]: unknown;
618
+ }
619
+ interface DebugErrorDetail {
620
+ type?: string;
621
+ message?: string;
622
+ task_id?: number | string;
623
+ failures?: DebugErrorFailure[];
624
+ [key: string]: unknown;
625
+ }
626
+ interface DebugContextNode {
627
+ node_id: string;
628
+ node_type: string;
629
+ execution_mode: DebugExecutionMode;
630
+ status: DebugNodeStatus;
631
+ can_step: boolean;
632
+ missing_vars: DebugMissingVar[];
633
+ waiting_reason?: string | null;
634
+ mock_result?: 'success' | 'fail' | null;
635
+ error_detail?: DebugErrorDetail | string | null;
636
+ duration_ms?: number | null;
637
+ log_ref?: {
638
+ instance_id: number | string;
639
+ node_id: string;
640
+ version: string;
641
+ } | null;
642
+ mock_outputs?: Record<string, unknown> | null;
643
+ mock_error?: string | null;
644
+ outputs?: Record<string, unknown> | null;
645
+ }
646
+ /**
647
+ * /debug_context/ 顶层结构。
648
+ *
649
+ * 前端按 status 分支:
650
+ * - running:任务定位用 active_*,进度用 last_run_status
651
+ * - terminating:继续用 active_*,UI 展示「终止中」并轮询
652
+ * - idle:active_* 为空,结果摘要用 last_*;last_task_id=null 表示尚无调试记录
653
+ */
654
+ interface DebugContext {
655
+ template_id: number;
656
+ status: DebugContextStatus;
657
+ locked_by: string;
658
+ active_task_id: number | string | null;
659
+ active_run_type: DebugRunType | null;
660
+ active_node_id: string | null;
661
+ last_task_id: number | string | null;
662
+ last_run_type: DebugRunType | null;
663
+ last_run_status: DebugRunStatus | null;
664
+ last_error_detail?: DebugErrorDetail | null;
665
+ last_inputs?: Record<string, unknown>;
666
+ global_vars: Record<string, unknown>;
667
+ missing_vars?: DebugMissingVar[];
668
+ nodes: DebugContextNode[];
669
+ }
670
+ interface DebugInputSchemaField {
671
+ key: string;
672
+ name: string;
673
+ type: string;
674
+ default?: unknown;
675
+ required?: boolean;
676
+ [key: string]: unknown;
677
+ }
678
+ interface DebugInputSchema {
679
+ fields?: DebugInputSchemaField[];
680
+ constants?: Record<string, unknown>;
681
+ [key: string]: unknown;
682
+ }
683
+ interface DebugResetImpact {
684
+ reset_node_ids: string[];
685
+ reasons?: Record<string, string>;
686
+ }
687
+ interface UpdateNodeDebugMockResult {
688
+ node_id: string;
689
+ execution_mode: DebugExecutionMode;
690
+ updated_global_vars?: Record<string, unknown>;
691
+ [key: string]: unknown;
692
+ }
693
+ interface RunNodeDebugStepResult {
694
+ node_id: string;
695
+ status: DebugNodeStatus;
696
+ outputs?: Record<string, unknown> | null;
697
+ error_detail?: unknown;
698
+ updated_global_vars?: Record<string, unknown>;
699
+ log_ref?: DebugContextNode['log_ref'];
700
+ [key: string]: unknown;
701
+ }
702
+ interface RunGlobalDebugResult {
703
+ task_id: number | string;
704
+ status: DebugContextStatus;
705
+ [key: string]: unknown;
706
+ }
707
+ interface TerminateDebugResult {
708
+ status?: DebugContextStatus;
709
+ [key: string]: unknown;
710
+ }
711
+ interface DebugResetResult {
712
+ reset_node_ids?: string[];
713
+ [key: string]: unknown;
714
+ }
715
+ interface UpdateNodeDebugMockParams {
716
+ templateId: string | number;
717
+ nodeId: string;
718
+ enable: boolean;
719
+ mockResult?: 'success' | 'fail';
720
+ mockOutputs?: Record<string, unknown>;
721
+ mockError?: string;
722
+ }
723
+ interface RunNodeDebugStepParams {
724
+ templateId: string | number;
725
+ nodeId: string;
726
+ mode: 'real' | 'mock';
727
+ inputOverrides?: Record<string, unknown>;
728
+ mockResult?: 'success' | 'fail';
729
+ mockOutputs?: Record<string, unknown>;
730
+ mockError?: string;
731
+ }
732
+ interface RunGlobalDebugParams {
733
+ templateId: string | number;
734
+ inputs: Record<string, unknown>;
735
+ }
736
+ interface TerminateDebugParams {
737
+ templateId: string | number;
738
+ nodeId?: string;
739
+ }
740
+ interface ResetDebugResultParams {
741
+ templateId: string | number;
742
+ nodeIds?: string[];
743
+ }
744
+ interface DebugApiServices {
745
+ fetchDebugContext(templateId: string | number): Promise<DebugContext>;
746
+ fetchDebugInputSchema(templateId: string | number): Promise<DebugInputSchema>;
747
+ fetchDebugResetImpact(templateId: string | number): Promise<DebugResetImpact>;
748
+ updateNodeDebugMock(params: UpdateNodeDebugMockParams): Promise<UpdateNodeDebugMockResult>;
749
+ runNodeDebugStep(params: RunNodeDebugStepParams): Promise<RunNodeDebugStepResult>;
750
+ runGlobalDebug(params: RunGlobalDebugParams): Promise<RunGlobalDebugResult>;
751
+ terminateDebug(params: TerminateDebugParams): Promise<TerminateDebugResult>;
752
+ resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
753
+ }
754
+
603
755
  /**
604
756
  * Flow API 配置接口
605
757
  */
@@ -613,10 +765,7 @@ interface FlowApiConfig {
613
765
  /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
614
766
  xsrfCookieName?: string;
615
767
  /** 作用域数据(必需,由外部传入) */
616
- scopeData: {
617
- scope_type: string;
618
- scope_value: number;
619
- };
768
+ scopeData: ScopeData;
620
769
  /**
621
770
  * 用户查询 API 地址(可选)
622
771
  * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
@@ -626,6 +775,12 @@ interface FlowApiConfig {
626
775
  /** 是否启用第三方插件(可选,默认为 true) */
627
776
  enableThirdPlugin?: boolean;
628
777
  }
778
+ interface ScopeData {
779
+ scope_type: string;
780
+ scope_value: number;
781
+ /** 业务方传入的空间 ID,语义独立于 scope_value。 */
782
+ space_id: number;
783
+ }
629
784
 
630
785
  interface DrawPipelineParams {
631
786
  pipeline_tree: PipelineTree;
@@ -655,6 +810,7 @@ interface FetchTaskStateParams {
655
810
  interface FetchTaskNodeDetailParams {
656
811
  task_id: number | string;
657
812
  node_id: string;
813
+ component_code?: string;
658
814
  }
659
815
  interface FetchTaskNodeSnapshotParams {
660
816
  task_id: number | string;
@@ -680,6 +836,37 @@ interface FlowTaskDetail {
680
836
  id: number | string;
681
837
  template_id: number;
682
838
  pipeline_tree: PipelineTree;
839
+ /** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
840
+ elapsed_time?: number;
841
+ [key: string]: unknown;
842
+ }
843
+ interface CreateFlowTaskParams {
844
+ template_id: number;
845
+ name: string;
846
+ creator: string;
847
+ constants: Record<string, any>;
848
+ label_ids?: number[];
849
+ [key: string]: unknown;
850
+ }
851
+ interface CreateFlowTaskResult {
852
+ data: {
853
+ id: number | string;
854
+ template_id?: number;
855
+ [key: string]: unknown;
856
+ };
857
+ [key: string]: unknown;
858
+ }
859
+ interface ExecuteFlowTaskResult {
860
+ result?: boolean;
861
+ code?: number;
862
+ data?: {
863
+ /** 任务详情页跳转地址(含正确的 bkflow task id 与 templateId) */
864
+ url?: string;
865
+ [key: string]: unknown;
866
+ };
867
+ message?: string | null;
868
+ request_id?: string;
869
+ trace_id?: string | null;
683
870
  [key: string]: unknown;
684
871
  }
685
872
  interface TaskStateResult {
@@ -707,6 +894,8 @@ interface FlowViewApiConfig {
707
894
  scopeData: {
708
895
  scope_type: string;
709
896
  scope_value: number;
897
+ /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
898
+ space_id: number;
710
899
  };
711
900
  fetchFlowDraftDetail?: (id: string) => Promise<FlowDraftDetail>;
712
901
  fetchFlowDetailByVersion?: (id: string, version: string) => Promise<FlowDetailByVersion>;
@@ -726,23 +915,13 @@ interface FlowViewApiConfig {
726
915
  data: any[];
727
916
  };
728
917
  }>;
729
- createFlowTask?: (params: {
730
- template_id: number;
731
- name: string;
732
- creator: string;
733
- constants: Record<string, any>;
734
- }) => Promise<{
735
- data: {
736
- id: number;
737
- template_id: number;
738
- };
739
- }>;
918
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
740
919
  executeFlowTask?: (params: {
741
920
  task_id: number | string;
742
921
  resource_type: string;
743
922
  resource_id: number | string;
744
923
  permission_type: string;
745
- }) => Promise<any>;
924
+ }) => Promise<ExecuteFlowTaskResult>;
746
925
  revokeFlowTask?: (params: {
747
926
  task_id: number | string;
748
927
  resource_type: string;
@@ -789,7 +968,7 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
789
968
  fetchBkFlowThirdPartyPluginTags: () => Promise<BkflowThirdPartyPluginGroupItem[]>;
790
969
  fetchBkFlowThirdPartyPluginMeta: (plugin_code: string) => Promise<BkflowThirdPartyPluginMetaDetail>;
791
970
  fetchBkFlowThirdPartyPluginDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginDetail>;
792
- fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string) => Promise<BkflowThirdPartyPluginAppDetail>;
971
+ fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginAppDetail>;
793
972
  fetchPluginGroupList: () => Promise<PluginGroupConfig[]>;
794
973
  fetchCategoryPlugins: (category: string) => Promise<PluginMetaItem[]>;
795
974
  fetchAllPluginGroups: () => Promise<GroupsPluginItem[]>;
@@ -799,23 +978,13 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
799
978
  drawPipeline?: (params: DrawPipelineParams) => Promise<{
800
979
  pipeline_tree: PipelineTree;
801
980
  }>;
802
- createFlowTask?: (params: {
803
- template_id: number;
804
- name: string;
805
- creator: string;
806
- constants: Record<string, any>;
807
- }) => Promise<{
808
- data: {
809
- id: number;
810
- template_id: number;
811
- };
812
- }>;
981
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
813
982
  executeFlowTask?: (params: {
814
983
  task_id: number | string;
815
984
  resource_type: string;
816
985
  resource_id: number | string;
817
986
  permission_type: string;
818
- }) => Promise<any>;
987
+ }) => Promise<ExecuteFlowTaskResult>;
819
988
  revokeFlowTask?: (params: {
820
989
  task_id: number | string;
821
990
  resource_type: string;
@@ -835,14 +1004,35 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
835
1004
  fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
836
1005
  getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
837
1006
  }
1007
+ interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
1008
+ }
838
1009
 
839
1010
  declare const PLUGIN_GROUP_ICON_MAP: Record<string, string>;
840
1011
 
841
1012
  /**
842
1013
  * 使用 Flow API 的 composable
843
- * 返回所有 API 方法,兼容 FlowEditApiConfig 接口
1014
+ * 返回所有 API 方法,兼容 FlowDetailApiConfig 接口(含调试 API)
844
1015
  */
845
- declare function useFlowApi(config: FlowApiConfig): FlowEditApiConfig;
1016
+ declare function useFlowApi(config: FlowApiConfig): FlowDetailApiConfig;
1017
+
1018
+ interface VariableOption {
1019
+ key: string;
1020
+ name: string;
1021
+ source_type?: string;
1022
+ custom_type?: string;
1023
+ }
1024
+ interface CreateVariablePayload {
1025
+ keyword?: string;
1026
+ cursorIndex?: number;
1027
+ defaultCustomType?: string;
1028
+ }
1029
+ interface CreateVariableRequest extends CreateVariablePayload {
1030
+ onCreated: (option: VariableOption) => void;
1031
+ }
1032
+
1033
+ type VariableInputCreateVariableHandler = (request: CreateVariableRequest) => void;
1034
+ declare const provideVariableInputCreateVariable: (handler: VariableInputCreateVariableHandler) => void;
1035
+ declare const useVariableInputCreateVariable: () => VariableInputCreateVariableHandler | null;
846
1036
 
847
- export { PLUGIN_GROUP_ICON_MAP, useFlowApi };
848
- export type { CustomVariableType, EndEvent, Flow, FlowEditApiConfig, FlowListItem, FlowViewApiConfig, GatewayType, Line, Location, NodeConfigData, NodeType, NotifyConfig, PluginGroupConfig, PluginOutputItem, PortOrientation, StartEvent, TemplateConfigs, UniformApiPluginConfig, UniformApiPluginInputsItem, VariableRefRequestParams };
1037
+ export { PLUGIN_GROUP_ICON_MAP, provideVariableInputCreateVariable, useFlowApi, useVariableInputCreateVariable };
1038
+ export type { CreateVariablePayload, CreateVariableRequest, CustomVariableType, DebugApiServices, DebugContext, DebugContextNode, DebugContextStatus, DebugErrorDetail, DebugExecutionMode, DebugInputSchema, DebugMissingVar, DebugNodeStatus, DebugRunStatus, DebugRunType, EndEvent, Flow, FlowDetailApiConfig, FlowEditApiConfig, FlowListItem, FlowViewApiConfig, GatewayType, Line, Location, NodeConfigData, NodeType, NotifyConfig, PluginGroupConfig, PluginOutputItem, PortOrientation, StartEvent, TemplateConfigs, UniformApiPluginConfig, UniformApiPluginInputsItem, VariableInputCreateVariableHandler, VariableOption, VariableRefRequestParams };
@@ -1,5 +1,7 @@
1
- import { P as s, u as _ } from "./composable-gqC5C2k8.js";
1
+ import { P as r, p as i, u as p, a as s } from "./context-DFzO6khC.js";
2
2
  export {
3
- s as PLUGIN_GROUP_ICON_MAP,
4
- _ as useFlowApi
3
+ r as PLUGIN_GROUP_ICON_MAP,
4
+ i as provideVariableInputCreateVariable,
5
+ p as useFlowApi,
6
+ s as useVariableInputCreateVariable
5
7
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={};throw new Error('Could not resolve "@blueking/bk-user-selector/vue3/vue3.css" imported by "@blueking/bkflow-canvas-editor".');exports.default=e;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={};throw new Error('Could not resolve "@blueking/bk-user-selector" imported by "@blueking/bkflow-canvas-editor".');exports.default=e;
@@ -0,0 +1,5 @@
1
+ const e = {};
2
+ throw new Error('Could not resolve "@blueking/bk-user-selector/vue3/vue3.css" imported by "@blueking/bkflow-canvas-editor".');
3
+ export {
4
+ e as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const e = {};
2
+ throw new Error('Could not resolve "@blueking/bk-user-selector" imported by "@blueking/bkflow-canvas-editor".');
3
+ export {
4
+ e as default
5
+ };