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

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,166 @@ 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
+ /**
708
+ * /debug_terminate/ 返回。
709
+ *
710
+ * 全局终止返回 `terminating`,需要继续轮询 /debug_context/ 直到 idle + last_run_status=revoked;
711
+ * 单节点终止直接返回 `idle`,并用 reset_node_ids 告知哪些节点被恢复为「未调试」。
712
+ */
713
+ interface TerminateDebugResult {
714
+ status?: DebugContextStatus;
715
+ /** 单节点终止:被恢复为 not_run 的节点,本地需同步清空输入、输出、耗时、错误与日志。 */
716
+ reset_node_ids?: string[];
717
+ [key: string]: unknown;
718
+ }
719
+ interface DebugResetResult {
720
+ reset_node_ids?: string[];
721
+ [key: string]: unknown;
722
+ }
723
+ interface UpdateNodeDebugMockParams {
724
+ templateId: string | number;
725
+ nodeId: string;
726
+ enable: boolean;
727
+ mockResult?: 'success' | 'fail';
728
+ mockOutputs?: Record<string, unknown>;
729
+ mockError?: string;
730
+ }
731
+ interface RunNodeDebugStepParams {
732
+ templateId: string | number;
733
+ nodeId: string;
734
+ mode: 'real' | 'mock';
735
+ inputOverrides?: Record<string, unknown>;
736
+ mockResult?: 'success' | 'fail';
737
+ mockOutputs?: Record<string, unknown>;
738
+ mockError?: string;
739
+ }
740
+ interface RunGlobalDebugParams {
741
+ templateId: string | number;
742
+ inputs: Record<string, unknown>;
743
+ }
744
+ interface TerminateDebugParams {
745
+ templateId: string | number;
746
+ nodeId?: string;
747
+ }
748
+ interface ResetDebugResultParams {
749
+ templateId: string | number;
750
+ nodeIds?: string[];
751
+ }
752
+ interface DebugApiServices {
753
+ fetchDebugContext(templateId: string | number): Promise<DebugContext>;
754
+ fetchDebugInputSchema(templateId: string | number): Promise<DebugInputSchema>;
755
+ fetchDebugResetImpact(templateId: string | number): Promise<DebugResetImpact>;
756
+ updateNodeDebugMock(params: UpdateNodeDebugMockParams): Promise<UpdateNodeDebugMockResult>;
757
+ runNodeDebugStep(params: RunNodeDebugStepParams): Promise<RunNodeDebugStepResult>;
758
+ runGlobalDebug(params: RunGlobalDebugParams): Promise<RunGlobalDebugResult>;
759
+ terminateDebug(params: TerminateDebugParams): Promise<TerminateDebugResult>;
760
+ resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
761
+ }
762
+
603
763
  /**
604
764
  * Flow API 配置接口
605
765
  */
@@ -613,10 +773,7 @@ interface FlowApiConfig {
613
773
  /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
614
774
  xsrfCookieName?: string;
615
775
  /** 作用域数据(必需,由外部传入) */
616
- scopeData: {
617
- scope_type: string;
618
- scope_value: number;
619
- };
776
+ scopeData: ScopeData;
620
777
  /**
621
778
  * 用户查询 API 地址(可选)
622
779
  * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
@@ -626,6 +783,12 @@ interface FlowApiConfig {
626
783
  /** 是否启用第三方插件(可选,默认为 true) */
627
784
  enableThirdPlugin?: boolean;
628
785
  }
786
+ interface ScopeData {
787
+ scope_type: string;
788
+ scope_value: number;
789
+ /** 业务方传入的空间 ID,语义独立于 scope_value。 */
790
+ space_id: number;
791
+ }
629
792
 
630
793
  interface DrawPipelineParams {
631
794
  pipeline_tree: PipelineTree;
@@ -655,6 +818,7 @@ interface FetchTaskStateParams {
655
818
  interface FetchTaskNodeDetailParams {
656
819
  task_id: number | string;
657
820
  node_id: string;
821
+ component_code?: string;
658
822
  }
659
823
  interface FetchTaskNodeSnapshotParams {
660
824
  task_id: number | string;
@@ -680,6 +844,37 @@ interface FlowTaskDetail {
680
844
  id: number | string;
681
845
  template_id: number;
682
846
  pipeline_tree: PipelineTree;
847
+ /** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
848
+ elapsed_time?: number;
849
+ [key: string]: unknown;
850
+ }
851
+ interface CreateFlowTaskParams {
852
+ template_id: number;
853
+ name: string;
854
+ creator: string;
855
+ constants: Record<string, any>;
856
+ label_ids?: number[];
857
+ [key: string]: unknown;
858
+ }
859
+ interface CreateFlowTaskResult {
860
+ data: {
861
+ id: number | string;
862
+ template_id?: number;
863
+ [key: string]: unknown;
864
+ };
865
+ [key: string]: unknown;
866
+ }
867
+ interface ExecuteFlowTaskResult {
868
+ result?: boolean;
869
+ code?: number;
870
+ data?: {
871
+ /** 任务详情页跳转地址(含正确的 bkflow task id 与 templateId) */
872
+ url?: string;
873
+ [key: string]: unknown;
874
+ };
875
+ message?: string | null;
876
+ request_id?: string;
877
+ trace_id?: string | null;
683
878
  [key: string]: unknown;
684
879
  }
685
880
  interface TaskStateResult {
@@ -707,6 +902,8 @@ interface FlowViewApiConfig {
707
902
  scopeData: {
708
903
  scope_type: string;
709
904
  scope_value: number;
905
+ /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
906
+ space_id: number;
710
907
  };
711
908
  fetchFlowDraftDetail?: (id: string) => Promise<FlowDraftDetail>;
712
909
  fetchFlowDetailByVersion?: (id: string, version: string) => Promise<FlowDetailByVersion>;
@@ -726,23 +923,13 @@ interface FlowViewApiConfig {
726
923
  data: any[];
727
924
  };
728
925
  }>;
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
- }>;
926
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
740
927
  executeFlowTask?: (params: {
741
928
  task_id: number | string;
742
929
  resource_type: string;
743
930
  resource_id: number | string;
744
931
  permission_type: string;
745
- }) => Promise<any>;
932
+ }) => Promise<ExecuteFlowTaskResult>;
746
933
  revokeFlowTask?: (params: {
747
934
  task_id: number | string;
748
935
  resource_type: string;
@@ -789,7 +976,7 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
789
976
  fetchBkFlowThirdPartyPluginTags: () => Promise<BkflowThirdPartyPluginGroupItem[]>;
790
977
  fetchBkFlowThirdPartyPluginMeta: (plugin_code: string) => Promise<BkflowThirdPartyPluginMetaDetail>;
791
978
  fetchBkFlowThirdPartyPluginDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginDetail>;
792
- fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string) => Promise<BkflowThirdPartyPluginAppDetail>;
979
+ fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginAppDetail>;
793
980
  fetchPluginGroupList: () => Promise<PluginGroupConfig[]>;
794
981
  fetchCategoryPlugins: (category: string) => Promise<PluginMetaItem[]>;
795
982
  fetchAllPluginGroups: () => Promise<GroupsPluginItem[]>;
@@ -799,23 +986,13 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
799
986
  drawPipeline?: (params: DrawPipelineParams) => Promise<{
800
987
  pipeline_tree: PipelineTree;
801
988
  }>;
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
- }>;
989
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
813
990
  executeFlowTask?: (params: {
814
991
  task_id: number | string;
815
992
  resource_type: string;
816
993
  resource_id: number | string;
817
994
  permission_type: string;
818
- }) => Promise<any>;
995
+ }) => Promise<ExecuteFlowTaskResult>;
819
996
  revokeFlowTask?: (params: {
820
997
  task_id: number | string;
821
998
  resource_type: string;
@@ -835,14 +1012,35 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
835
1012
  fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
836
1013
  getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
837
1014
  }
1015
+ interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
1016
+ }
838
1017
 
839
1018
  declare const PLUGIN_GROUP_ICON_MAP: Record<string, string>;
840
1019
 
841
1020
  /**
842
1021
  * 使用 Flow API 的 composable
843
- * 返回所有 API 方法,兼容 FlowEditApiConfig 接口
1022
+ * 返回所有 API 方法,兼容 FlowDetailApiConfig 接口(含调试 API)
844
1023
  */
845
- declare function useFlowApi(config: FlowApiConfig): FlowEditApiConfig;
1024
+ declare function useFlowApi(config: FlowApiConfig): FlowDetailApiConfig;
1025
+
1026
+ interface VariableOption {
1027
+ key: string;
1028
+ name: string;
1029
+ source_type?: string;
1030
+ custom_type?: string;
1031
+ }
1032
+ interface CreateVariablePayload {
1033
+ keyword?: string;
1034
+ cursorIndex?: number;
1035
+ defaultCustomType?: string;
1036
+ }
1037
+ interface CreateVariableRequest extends CreateVariablePayload {
1038
+ onCreated: (option: VariableOption) => void;
1039
+ }
1040
+
1041
+ type VariableInputCreateVariableHandler = (request: CreateVariableRequest) => void;
1042
+ declare const provideVariableInputCreateVariable: (handler: VariableInputCreateVariableHandler) => void;
1043
+ declare const useVariableInputCreateVariable: () => VariableInputCreateVariableHandler | null;
846
1044
 
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 };
1045
+ export { PLUGIN_GROUP_ICON_MAP, provideVariableInputCreateVariable, useFlowApi, useVariableInputCreateVariable };
1046
+ 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
+ };