@blueking/bkflow-canvas-editor 1.1.0-beta.4 → 1.1.0-beta.41

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;
@@ -44,6 +44,11 @@ interface NodeExecutionState {
44
44
  actions?: ExecutionNodeAction[];
45
45
  /** 兼容旧版后端直接透出的动作数组字段 */
46
46
  action_list?: ExecutionNodeAction[];
47
+ /**
48
+ * 条件网关命中的出边 flow_id。
49
+ * 有值时执行态连线优先按它着色,不要求目标节点已经执行(网关单步不会跑下游)。
50
+ */
51
+ selectedFlowIds?: string[];
47
52
  }
48
53
  type TaskExecutionStates = Record<string, NodeExecutionState>;
49
54
 
@@ -76,13 +81,26 @@ interface ActivityComponent {
76
81
  api_meta?: {
77
82
  id: string;
78
83
  name: string;
84
+ /** 项目内 uniform_api 仍可能写入;标准运维 V4 对齐 bkflow,不再落这个字段 */
79
85
  alias?: string;
80
- meta_url: string;
86
+ /** 目录项有 meta_url 才写;V4 开放插件通常只有 meta_url_template */
87
+ meta_url?: string;
81
88
  api_key: string;
82
89
  category: {
83
90
  id: string;
84
91
  name: string;
85
92
  };
93
+ // 标准运维 V4 开放插件的落库字段,对齐 bkflow NodeConfig.vue `if (isV4)` 保存分支
94
+ plugin_source?: string;
95
+ plugin_code?: string;
96
+ plugin_version?: string;
97
+ wrapper_version?: string;
98
+ versions?: string[];
99
+ meta_url_template?: string;
100
+ latest_version?: string;
101
+ default_version?: string;
102
+ desc?: string;
103
+ source_key?: string;
86
104
  };
87
105
  }
88
106
 
@@ -392,15 +410,20 @@ interface FlowListItem {
392
410
  creator: string;
393
411
  update_at: string;
394
412
  }
413
+ interface SpaceUniformApiEntry {
414
+ meta_apis: string;
415
+ api_categories?: string;
416
+ display_name?: string;
417
+ source_key?: string;
418
+ catalog_mode?: 'remote' | 'cache_first' | 'cache_only';
419
+ headers?: Record<string, string>;
420
+ }
395
421
  interface SpaceFlowConfig {
396
422
  gateway_expression?: 'boolrule' | 'FEEL' | 'MAKO';
397
- uiform_api?: {
398
- api: Record<string, {
399
- api_category: string;
400
- display_name: string;
401
- meta_apis: string;
402
- }>;
403
- };
423
+ uniform_api?: {
424
+ api?: Record<string, SpaceUniformApiEntry | null>;
425
+ common?: SpaceUniformApiEntry | null;
426
+ } | null;
404
427
  }
405
428
  interface UpdateFlowParams {
406
429
  name: string;
@@ -430,6 +453,88 @@ interface PluginMetaItem {
430
453
  icon?: string;
431
454
  category_id: string;
432
455
  }
456
+ interface SopsPluginSourceItem {
457
+ id: string;
458
+ name: string;
459
+ /** 空间配置 uniform_api.api[api_name].source_key,缺省时等于 api_name */
460
+ source_key?: string;
461
+ }
462
+ interface SopsPluginCategory {
463
+ id: string;
464
+ name: string;
465
+ }
466
+ interface SopsPluginItem {
467
+ id: string;
468
+ name: string;
469
+ category?: string;
470
+ category_name?: string;
471
+ description?: string;
472
+ meta_url?: string;
473
+ meta_url_template?: string;
474
+ plugin_source?: string;
475
+ plugin_code?: string;
476
+ source_key?: string;
477
+ wrapper_version?: string;
478
+ default_version?: string;
479
+ latest_version?: string;
480
+ versions?: string[];
481
+ }
482
+ interface SopsPluginListResult {
483
+ total: number;
484
+ apis: SopsPluginItem[];
485
+ }
486
+ /**
487
+ * 统一插件详情里的表单描述符(bkflow V4 开放插件协议)。
488
+ * component_js / renderform(string) 走 $.atoms 注册链路,key 即注册用的 atom key;
489
+ * is_embedded 为 false 时 data 是脚本地址,否则 data 是脚本源码。
490
+ */
491
+ type SopsPluginFormDescriptor = {
492
+ type: 'component_js';
493
+ key: string;
494
+ data: string;
495
+ base?: string;
496
+ is_embedded?: boolean;
497
+ } | {
498
+ type: 'renderform';
499
+ key?: string;
500
+ data: string | RenderformInputsItem[] | Record<string, unknown>;
501
+ base?: string;
502
+ is_embedded?: boolean;
503
+ } | {
504
+ type: 'jsonschema';
505
+ data: JsonschemaformInputs;
506
+ } | {
507
+ type: 'api_plugin_json';
508
+ data?: Record<string, unknown>;
509
+ };
510
+ interface SopsPluginDetail {
511
+ plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
512
+ plugin_code: string;
513
+ plugin_version: string;
514
+ source_key: string;
515
+ plugin_source?: string;
516
+ protocol?: string;
517
+ wrapper_version?: string;
518
+ name: string;
519
+ description?: string;
520
+ inputs?: UniformApiPluginInputsItem[];
521
+ outputs?: PluginOutputItem[];
522
+ credentials?: Record<string, unknown> | null;
523
+ forms?: {
524
+ input?: SopsPluginFormDescriptor | null;
525
+ output?: SopsPluginFormDescriptor | null;
526
+ } | null;
527
+ form_schema?: Record<string, unknown> | null;
528
+ /** 表单脚本运行所需的上下文(site_url / project 等),由插件提供方下发 */
529
+ form_context?: Record<string, unknown> | null;
530
+ execution_kind?: string;
531
+ url?: string;
532
+ methods?: string[];
533
+ response_data_path?: string;
534
+ polling?: Record<string, any> | null;
535
+ callback?: Record<string, any> | null;
536
+ credential_key?: string;
537
+ }
433
538
  interface BkflowThirdPartyPluginGroupItem {
434
539
  code_name: string;
435
540
  id: number;
@@ -513,7 +618,7 @@ interface BkflowThirdPartyPluginAppDetail {
513
618
  };
514
619
  }
515
620
  interface GroupsPluginItem extends PluginGroupConfig {
516
- children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem)[];
621
+ children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem | SopsPluginSourceItem)[];
517
622
  }
518
623
  interface UniformApiPluginOutputItem {
519
624
  key: string;
@@ -565,6 +670,29 @@ interface UniformApiPluginConfig {
565
670
  }>;
566
671
  };
567
672
  }
673
+ interface RenderformInputsItem {
674
+ name?: string;
675
+ tag_code: string;
676
+ type: string;
677
+ attrs: Record<string, any>;
678
+ events?: Record<string, any>[];
679
+ validation?: Record<string, any>[];
680
+ }
681
+ interface JsonschemaformInputs {
682
+ type: string;
683
+ properties: Record<string, any>;
684
+ required?: string[];
685
+ definitions?: Record<string, {
686
+ type: string;
687
+ title: string;
688
+ description?: string;
689
+ default?: string | boolean | number | string[] | boolean[] | number[] | Record<string, any>;
690
+ enum?: string[];
691
+ items?: Record<string, any>;
692
+ 'ui:props'?: Record<string, any>;
693
+ 'ui:component'?: Record<string, any>;
694
+ }>;
695
+ }
568
696
  interface UniformApiPluginInputsItem {
569
697
  desc: string;
570
698
  form_type?: string;
@@ -600,6 +728,239 @@ interface CustomVariableType {
600
728
  code: string;
601
729
  }
602
730
 
731
+ interface VariableOption {
732
+ key: string;
733
+ name: string;
734
+ source_type?: string;
735
+ custom_type?: string;
736
+ }
737
+ interface CreateVariablePayload {
738
+ keyword?: string;
739
+ cursorIndex?: number;
740
+ defaultCustomType?: string;
741
+ }
742
+ /**
743
+ * 宿主自定义的候选项来源标识。
744
+ *
745
+ * 编辑器**不解释**它的内容,只做原样存储与回传:`key` 用于让宿主找到自己的加载器,
746
+ * `params` 放宿主拉取时需要的补充信息。
747
+ *
748
+ * 之所以由宿主带进来而不是编辑器从 pipeline_tree 反查关联节点的插件:节点配置尚未
749
+ * 保存时,`activities[nodeId].component` 还是换插件之前的那个,反查会拿到错的插件。
750
+ */
751
+ interface SelectRelatedOptionSourceRef {
752
+ key: string;
753
+ params?: Record<string, unknown>;
754
+ }
755
+ /**
756
+ * select 变量「关联数据」的来源,由宿主在节点表单里发起受控创建时锁定。
757
+ * 与 filter 的 FilterVariableSourceContext 平行。
758
+ */
759
+ interface SelectRelatedSourceContext {
760
+ sourceNodeId: string;
761
+ /**
762
+ * 关联来源在「关联数据」栏展示的名字,由宿主决定放什么(bk-incident 放当前选中的插件名)。
763
+ *
764
+ * 它**优先于**画布实时解析的节点名:select 的关联源连同候选项来源一起冻结在创建时刻,
765
+ * 展示名跟着来源走而不是跟着节点实例走。不传则回落实时节点名、再回落裸 nodeId——
766
+ * 而空节点选插件后配置尚未写回 pipeline_tree,实时节点名恰恰是空的。
767
+ */
768
+ sourceNodeName?: string;
769
+ /** 关联表单项稳定 KEY,例如 index_set_id */
770
+ sourceFieldKey: string;
771
+ /**
772
+ * 关联表单项的展示名,例如「查询条件」——即节点表单上那一栏的标题,不是 fieldKey 本身。
773
+ * 全局变量侧滑没有加载插件 schema 的时机,不带进来就只能显示裸 fieldKey。
774
+ */
775
+ sourceFieldName?: string;
776
+ /** 候选项从哪来。缺省则该变量没有可拉取的候选项 */
777
+ optionSource?: SelectRelatedOptionSourceRef;
778
+ }
779
+ interface CreateVariableRequest extends CreateVariablePayload {
780
+ /** 缺省时 select 仍按「手动输入」初始化,普通「新建变量」入口不受影响 */
781
+ selectRelatedContext?: SelectRelatedSourceContext;
782
+ onCreated: (option: VariableOption) => void;
783
+ }
784
+
785
+ type DebugContextStatus = 'idle' | 'running' | 'terminating';
786
+ type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'revoked' | 'suspended' | 'skipped';
787
+ type DebugExecutionMode = 'real' | 'mock';
788
+ interface DebugMissingVar {
789
+ key: string;
790
+ source_node_id: string | null;
791
+ }
792
+ type DebugRunType = 'global' | 'step';
793
+ type DebugRunStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'terminating' | 'finished' | 'failed' | 'revoked';
794
+ /** 运行级 / 节点级错误详情(last_error_detail、nodes[].error_detail)。 */
795
+ interface DebugErrorFailure {
796
+ message: string;
797
+ node_id?: string;
798
+ template_node_id?: string;
799
+ [key: string]: unknown;
800
+ }
801
+ interface DebugErrorDetail {
802
+ type?: string;
803
+ message?: string;
804
+ task_id?: number | string;
805
+ failures?: DebugErrorFailure[];
806
+ [key: string]: unknown;
807
+ }
808
+ /** 条件网关分支求值结果(`debug_context.nodes[].condition_results`)。 */
809
+ interface DebugConditionResult {
810
+ flow_id: string;
811
+ name?: string;
812
+ expression?: string;
813
+ resolved_expression?: string;
814
+ matched?: boolean;
815
+ [key: string]: unknown;
816
+ }
817
+ interface DebugContextNode {
818
+ node_id: string;
819
+ node_type: string;
820
+ execution_mode: DebugExecutionMode;
821
+ status: DebugNodeStatus;
822
+ can_step: boolean;
823
+ missing_vars: DebugMissingVar[];
824
+ waiting_reason?: string | null;
825
+ /** 是否支持单步调试;并行/汇聚网关为 false,仅用于展示全局调试状态。 */
826
+ supports_step?: boolean;
827
+ /** 是否支持 Mock;全部网关为 false。 */
828
+ supports_mock?: boolean;
829
+ mock_result?: 'success' | 'fail' | null;
830
+ error_detail?: DebugErrorDetail | string | null;
831
+ duration_ms?: number | null;
832
+ log_ref?: {
833
+ instance_id: number | string;
834
+ node_id: string;
835
+ version: string;
836
+ } | null;
837
+ mock_outputs?: Record<string, unknown> | null;
838
+ mock_error?: string | null;
839
+ outputs?: Record<string, unknown> | null;
840
+ /** 条件网关命中的出边 flow_id;画布用它把命中连线标绿。 */
841
+ selected_flow_ids?: string[];
842
+ /** 条件网关每个分支的表达式与命中结果。 */
843
+ condition_results?: DebugConditionResult[];
844
+ }
845
+ /**
846
+ * /debug_context/ 顶层结构。
847
+ *
848
+ * 前端按 status 分支:
849
+ * - running:任务定位用 active_*,进度用 last_run_status
850
+ * - terminating:继续用 active_*,UI 展示「终止中」并轮询
851
+ * - idle:active_* 为空,结果摘要用 last_*;last_task_id=null 表示尚无调试记录
852
+ */
853
+ interface DebugContext {
854
+ template_id: number;
855
+ status: DebugContextStatus;
856
+ locked_by: string;
857
+ active_task_id: number | string | null;
858
+ active_run_type: DebugRunType | null;
859
+ active_node_id: string | null;
860
+ last_task_id: number | string | null;
861
+ last_run_type: DebugRunType | null;
862
+ last_run_status: DebugRunStatus | null;
863
+ last_error_detail?: DebugErrorDetail | null;
864
+ last_inputs?: Record<string, unknown>;
865
+ global_vars: Record<string, unknown>;
866
+ missing_vars?: DebugMissingVar[];
867
+ nodes: DebugContextNode[];
868
+ }
869
+ interface DebugInputSchemaField {
870
+ key: string;
871
+ name: string;
872
+ type: string;
873
+ default?: unknown;
874
+ required?: boolean;
875
+ [key: string]: unknown;
876
+ }
877
+ interface DebugInputSchema {
878
+ fields?: DebugInputSchemaField[];
879
+ constants?: Record<string, unknown>;
880
+ [key: string]: unknown;
881
+ }
882
+ interface DebugResetImpact {
883
+ reset_node_ids: string[];
884
+ reasons?: Record<string, string>;
885
+ }
886
+ interface UpdateNodeDebugMockResult {
887
+ node_id: string;
888
+ execution_mode: DebugExecutionMode;
889
+ updated_global_vars?: Record<string, unknown>;
890
+ [key: string]: unknown;
891
+ }
892
+ interface RunNodeDebugStepResult {
893
+ node_id: string;
894
+ status: DebugNodeStatus;
895
+ outputs?: Record<string, unknown> | null;
896
+ error_detail?: unknown;
897
+ updated_global_vars?: Record<string, unknown>;
898
+ log_ref?: DebugContextNode['log_ref'];
899
+ selected_flow_ids?: string[];
900
+ condition_results?: DebugConditionResult[];
901
+ [key: string]: unknown;
902
+ }
903
+ interface RunGlobalDebugResult {
904
+ task_id: number | string;
905
+ status: DebugContextStatus;
906
+ [key: string]: unknown;
907
+ }
908
+ /**
909
+ * /debug_terminate/ 返回。
910
+ *
911
+ * 全局终止返回 `terminating`,需要继续轮询 /debug_context/ 直到 idle + last_run_status=revoked;
912
+ * 单节点终止直接返回 `idle`,并用 reset_node_ids 告知哪些节点被恢复为「未调试」。
913
+ */
914
+ interface TerminateDebugResult {
915
+ status?: DebugContextStatus;
916
+ /** 单节点终止:被恢复为 not_run 的节点,本地需同步清空输入、输出、耗时、错误与日志。 */
917
+ reset_node_ids?: string[];
918
+ [key: string]: unknown;
919
+ }
920
+ interface DebugResetResult {
921
+ reset_node_ids?: string[];
922
+ [key: string]: unknown;
923
+ }
924
+ interface UpdateNodeDebugMockParams {
925
+ templateId: string | number;
926
+ nodeId: string;
927
+ enable: boolean;
928
+ mockResult?: 'success' | 'fail';
929
+ mockOutputs?: Record<string, unknown>;
930
+ mockError?: string;
931
+ }
932
+ interface RunNodeDebugStepParams {
933
+ templateId: string | number;
934
+ nodeId: string;
935
+ mode: 'real' | 'mock';
936
+ inputOverrides?: Record<string, unknown>;
937
+ mockResult?: 'success' | 'fail';
938
+ mockOutputs?: Record<string, unknown>;
939
+ mockError?: string;
940
+ }
941
+ interface RunGlobalDebugParams {
942
+ templateId: string | number;
943
+ inputs: Record<string, unknown>;
944
+ }
945
+ interface TerminateDebugParams {
946
+ templateId: string | number;
947
+ nodeId?: string;
948
+ }
949
+ interface ResetDebugResultParams {
950
+ templateId: string | number;
951
+ nodeIds?: string[];
952
+ }
953
+ interface DebugApiServices {
954
+ fetchDebugContext(templateId: string | number): Promise<DebugContext>;
955
+ fetchDebugInputSchema(templateId: string | number): Promise<DebugInputSchema>;
956
+ fetchDebugResetImpact(templateId: string | number): Promise<DebugResetImpact>;
957
+ updateNodeDebugMock(params: UpdateNodeDebugMockParams): Promise<UpdateNodeDebugMockResult>;
958
+ runNodeDebugStep(params: RunNodeDebugStepParams): Promise<RunNodeDebugStepResult>;
959
+ runGlobalDebug(params: RunGlobalDebugParams): Promise<RunGlobalDebugResult>;
960
+ terminateDebug(params: TerminateDebugParams): Promise<TerminateDebugResult>;
961
+ resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
962
+ }
963
+
603
964
  /**
604
965
  * Flow API 配置接口
605
966
  */
@@ -613,10 +974,7 @@ interface FlowApiConfig {
613
974
  /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
614
975
  xsrfCookieName?: string;
615
976
  /** 作用域数据(必需,由外部传入) */
616
- scopeData: {
617
- scope_type: string;
618
- scope_value: number;
619
- };
977
+ scopeData: ScopeData;
620
978
  /**
621
979
  * 用户查询 API 地址(可选)
622
980
  * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
@@ -626,6 +984,12 @@ interface FlowApiConfig {
626
984
  /** 是否启用第三方插件(可选,默认为 true) */
627
985
  enableThirdPlugin?: boolean;
628
986
  }
987
+ interface ScopeData {
988
+ scope_type: string;
989
+ scope_value: number;
990
+ /** 业务方传入的空间 ID,语义独立于 scope_value。 */
991
+ space_id: number;
992
+ }
629
993
 
630
994
  interface DrawPipelineParams {
631
995
  pipeline_tree: PipelineTree;
@@ -655,6 +1019,7 @@ interface FetchTaskStateParams {
655
1019
  interface FetchTaskNodeDetailParams {
656
1020
  task_id: number | string;
657
1021
  node_id: string;
1022
+ component_code?: string;
658
1023
  }
659
1024
  interface FetchTaskNodeSnapshotParams {
660
1025
  task_id: number | string;
@@ -676,10 +1041,67 @@ interface OperateTaskNodeParams {
676
1041
  interface GetFlowTaskDetailParams {
677
1042
  task_id: number | string;
678
1043
  }
1044
+ interface SopsPluginCategoryParams {
1045
+ template_id: number | string;
1046
+ /** 空间 uniform_api 配置里的 api_name,如 sops_builtin / sops_third_party */
1047
+ api_name: string;
1048
+ }
1049
+ interface SopsPluginListParams extends SopsPluginCategoryParams {
1050
+ category?: string;
1051
+ /** 插件名称搜索关键字 */
1052
+ key?: string;
1053
+ limit?: number;
1054
+ offset?: number;
1055
+ }
1056
+ /**
1057
+ * 统一插件详情请求参数。
1058
+ * 后端 serializer 会拒绝契约外字段(不是静默忽略),调用方不要附加额外参数;
1059
+ * space_id / scope_type / scope_value 由 service 从 scopeData 补齐。
1060
+ */
1061
+ interface SopsPluginDetailParams {
1062
+ template_id: number | string;
1063
+ plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
1064
+ /** 标准运维网关 plugin id:内置为 `builtin__<code>`,第三方即裸 code */
1065
+ plugin_code: string;
1066
+ plugin_version: string;
1067
+ /** uniform_api 必填,缺失时后端直接 400 */
1068
+ source_key?: string;
1069
+ }
679
1070
  interface FlowTaskDetail {
680
1071
  id: number | string;
681
1072
  template_id: number;
682
1073
  pipeline_tree: PipelineTree;
1074
+ /** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
1075
+ elapsed_time?: number;
1076
+ [key: string]: unknown;
1077
+ }
1078
+ interface CreateFlowTaskParams {
1079
+ template_id: number;
1080
+ name: string;
1081
+ creator: string;
1082
+ constants: Record<string, any>;
1083
+ label_ids?: number[];
1084
+ [key: string]: unknown;
1085
+ }
1086
+ interface CreateFlowTaskResult {
1087
+ data: {
1088
+ id: number | string;
1089
+ template_id?: number;
1090
+ [key: string]: unknown;
1091
+ };
1092
+ [key: string]: unknown;
1093
+ }
1094
+ interface ExecuteFlowTaskResult {
1095
+ result?: boolean;
1096
+ code?: number;
1097
+ data?: {
1098
+ /** 任务详情页跳转地址(含正确的 bkflow task id 与 templateId) */
1099
+ url?: string;
1100
+ [key: string]: unknown;
1101
+ };
1102
+ message?: string | null;
1103
+ request_id?: string;
1104
+ trace_id?: string | null;
683
1105
  [key: string]: unknown;
684
1106
  }
685
1107
  interface TaskStateResult {
@@ -707,6 +1129,8 @@ interface FlowViewApiConfig {
707
1129
  scopeData: {
708
1130
  scope_type: string;
709
1131
  scope_value: number;
1132
+ /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
1133
+ space_id: number;
710
1134
  };
711
1135
  fetchFlowDraftDetail?: (id: string) => Promise<FlowDraftDetail>;
712
1136
  fetchFlowDetailByVersion?: (id: string, version: string) => Promise<FlowDetailByVersion>;
@@ -726,23 +1150,13 @@ interface FlowViewApiConfig {
726
1150
  data: any[];
727
1151
  };
728
1152
  }>;
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
- }>;
1153
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
740
1154
  executeFlowTask?: (params: {
741
1155
  task_id: number | string;
742
1156
  resource_type: string;
743
1157
  resource_id: number | string;
744
1158
  permission_type: string;
745
- }) => Promise<any>;
1159
+ }) => Promise<ExecuteFlowTaskResult>;
746
1160
  revokeFlowTask?: (params: {
747
1161
  task_id: number | string;
748
1162
  resource_type: string;
@@ -794,28 +1208,21 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
794
1208
  fetchCategoryPlugins: (category: string) => Promise<PluginMetaItem[]>;
795
1209
  fetchAllPluginGroups: () => Promise<GroupsPluginItem[]>;
796
1210
  enableThirdPlugin?: boolean;
1211
+ fetchSopsPluginCategories?: (params: SopsPluginCategoryParams) => Promise<SopsPluginCategory[]>;
1212
+ fetchSopsPluginList?: (params: SopsPluginListParams) => Promise<SopsPluginListResult>;
1213
+ fetchSopsPluginDetail?: (params: SopsPluginDetailParams) => Promise<SopsPluginDetail>;
797
1214
  fetchPluginDetail?: (id: string) => Promise<UniformApiPluginDetail>;
798
1215
  fetchApplyInstructionData?: (params: any) => Promise<any>;
799
1216
  drawPipeline?: (params: DrawPipelineParams) => Promise<{
800
1217
  pipeline_tree: PipelineTree;
801
1218
  }>;
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
- }>;
1219
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
813
1220
  executeFlowTask?: (params: {
814
1221
  task_id: number | string;
815
1222
  resource_type: string;
816
1223
  resource_id: number | string;
817
1224
  permission_type: string;
818
- }) => Promise<any>;
1225
+ }) => Promise<ExecuteFlowTaskResult>;
819
1226
  revokeFlowTask?: (params: {
820
1227
  task_id: number | string;
821
1228
  resource_type: string;
@@ -835,14 +1242,38 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
835
1242
  fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
836
1243
  getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
837
1244
  }
1245
+ interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
1246
+ }
838
1247
 
1248
+ declare const SOPS_PLUGIN_GROUP_NAME = "sops";
839
1249
  declare const PLUGIN_GROUP_ICON_MAP: Record<string, string>;
840
1250
 
1251
+ /** 目录查询接口由宿主注入,三个都要有才能走完「来源 -> 分类 -> 插件 -> 详情」 */
1252
+ type SopsPluginCatalogApi = Pick<FlowEditApiConfig, 'fetchSopsPluginCategories' | 'fetchSopsPluginList' | 'fetchSopsPluginDetail'>;
1253
+ interface SopsPluginGroupOptions {
1254
+ spaceConfig?: SpaceFlowConfig | null;
1255
+ api: SopsPluginCatalogApi;
1256
+ }
1257
+ /**
1258
+ * 从 `get_space_related_configs` 的 `uniform_api.api` 里取出标准运维来源。
1259
+ * id 即后续请求分类/插件列表要带的 `api_name`,顺序沿用配置里的顺序。
1260
+ */
1261
+ declare function resolveSopsPluginSources(config?: SpaceFlowConfig | null): SopsPluginSourceItem[];
1262
+ /**
1263
+ * 空间接入了标准运维、且宿主实现了目录查询接口时,在插件分组末尾补上「标准运维插件」分组;
1264
+ * 否则原样返回。两个条件都要满足:少了接口,分组点开也只是一个永远空着的列表。
1265
+ */
1266
+ declare function withSopsPluginGroup(groups: GroupsPluginItem[], options: SopsPluginGroupOptions): GroupsPluginItem[];
1267
+
841
1268
  /**
842
1269
  * 使用 Flow API 的 composable
843
- * 返回所有 API 方法,兼容 FlowEditApiConfig 接口
1270
+ * 返回所有 API 方法,兼容 FlowDetailApiConfig 接口(含调试 API)
844
1271
  */
845
- declare function useFlowApi(config: FlowApiConfig): FlowEditApiConfig;
1272
+ declare function useFlowApi(config: FlowApiConfig): FlowDetailApiConfig;
1273
+
1274
+ type VariableInputCreateVariableHandler = (request: CreateVariableRequest) => void;
1275
+ declare const provideVariableInputCreateVariable: (handler: VariableInputCreateVariableHandler) => void;
1276
+ declare const useVariableInputCreateVariable: () => VariableInputCreateVariableHandler | null;
846
1277
 
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 };
1278
+ export { PLUGIN_GROUP_ICON_MAP, SOPS_PLUGIN_GROUP_NAME, provideVariableInputCreateVariable, resolveSopsPluginSources, useFlowApi, useVariableInputCreateVariable, withSopsPluginGroup };
1279
+ export type { CreateVariablePayload, CreateVariableRequest, CustomVariableType, DebugApiServices, DebugConditionResult, 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, SelectRelatedSourceContext, SopsPluginCategory, SopsPluginCategoryParams, SopsPluginDetail, SopsPluginDetailParams, SopsPluginFormDescriptor, SopsPluginItem, SopsPluginListParams, SopsPluginListResult, SopsPluginSourceItem, SpaceUniformApiEntry, StartEvent, TemplateConfigs, UniformApiPluginConfig, UniformApiPluginInputsItem, VariableInputCreateVariableHandler, VariableOption, VariableRefRequestParams };
@@ -1,5 +1,10 @@
1
- import { P as s, u as _ } from "./composable-CmXOtkXh.js";
1
+ import { P as r, S as s, p as i, r as o, u as p, a as u, w as P } from "./context-De9a4Qek.js";
2
2
  export {
3
- s as PLUGIN_GROUP_ICON_MAP,
4
- _ as useFlowApi
3
+ r as PLUGIN_GROUP_ICON_MAP,
4
+ s as SOPS_PLUGIN_GROUP_NAME,
5
+ i as provideVariableInputCreateVariable,
6
+ o as resolveSopsPluginSources,
7
+ p as useFlowApi,
8
+ u as useVariableInputCreateVariable,
9
+ P as withSopsPluginGroup
5
10
  };