@blueking/bkflow-canvas-editor 1.2.0-beta.5 → 1.2.0-beta.6

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
@@ -1,8 +1,10 @@
1
1
  import * as vue from 'vue';
2
- import { Component, ComputedRef, Ref } from 'vue';
2
+ import { Component, ComputedRef, Ref, App } from 'vue';
3
3
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
4
4
  import * as _blueking_flow_canvas from '@blueking/flow-canvas';
5
5
  import { ZoomToFitOptions, CanvasUiEvent, QuickAddConfig, CanvasSchema, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CanvasToolbarItem, CommandEnvelope } from '@blueking/flow-canvas';
6
+ export { Locale, MessageTree, Translator, getLocale, registerMessages, setLocale, setTranslator, t } from '@blueking/flow-canvas';
7
+ import { defaultRootConfig } from 'bkui-vue/lib/config-provider';
6
8
 
7
9
  /**
8
10
  * Flow API 配置接口
@@ -68,7 +70,7 @@ declare namespace __mock_vue {
68
70
  };
69
71
  }
70
72
 
71
- type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'SKIP';
73
+ type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'INVALID' | 'SKIP';
72
74
  type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
73
75
  interface NodeExecutionState {
74
76
  status: NodeExecutionStatus;
@@ -149,13 +151,26 @@ interface ActivityComponent {
149
151
  api_meta?: {
150
152
  id: string;
151
153
  name: string;
154
+ /** 项目内 uniform_api 仍可能写入;标准运维 V4 对齐 bkflow,不再落这个字段 */
152
155
  alias?: string;
153
- meta_url: string;
156
+ /** 目录项有 meta_url 才写;V4 开放插件通常只有 meta_url_template */
157
+ meta_url?: string;
154
158
  api_key: string;
155
159
  category: {
156
160
  id: string;
157
161
  name: string;
158
162
  };
163
+ // 标准运维 V4 开放插件的落库字段,对齐 bkflow NodeConfig.vue `if (isV4)` 保存分支
164
+ plugin_source?: string;
165
+ plugin_code?: string;
166
+ plugin_version?: string;
167
+ wrapper_version?: string;
168
+ versions?: string[];
169
+ meta_url_template?: string;
170
+ latest_version?: string;
171
+ default_version?: string;
172
+ desc?: string;
173
+ source_key?: string;
159
174
  };
160
175
  }
161
176
 
@@ -635,15 +650,20 @@ interface FlowDraftDetail {
635
650
  md5sum: string;
636
651
  pipeline_tree: PipelineTree;
637
652
  }
653
+ interface SpaceUniformApiEntry {
654
+ meta_apis: string;
655
+ api_categories?: string;
656
+ display_name?: string;
657
+ source_key?: string;
658
+ catalog_mode?: 'remote' | 'cache_first' | 'cache_only';
659
+ headers?: Record<string, string>;
660
+ }
638
661
  interface SpaceFlowConfig {
639
662
  gateway_expression?: 'boolrule' | 'FEEL' | 'MAKO';
640
- uiform_api?: {
641
- api: Record<string, {
642
- api_category: string;
643
- display_name: string;
644
- meta_apis: string;
645
- }>;
646
- };
663
+ uniform_api?: {
664
+ api?: Record<string, SpaceUniformApiEntry | null>;
665
+ common?: SpaceUniformApiEntry | null;
666
+ } | null;
647
667
  }
648
668
  interface UpdateFlowParams {
649
669
  name: string;
@@ -673,6 +693,88 @@ interface PluginMetaItem {
673
693
  icon?: string;
674
694
  category_id: string;
675
695
  }
696
+ interface SopsPluginSourceItem {
697
+ id: string;
698
+ name: string;
699
+ /** 空间配置 uniform_api.api[api_name].source_key,缺省时等于 api_name */
700
+ source_key?: string;
701
+ }
702
+ interface SopsPluginCategory {
703
+ id: string;
704
+ name: string;
705
+ }
706
+ interface SopsPluginItem {
707
+ id: string;
708
+ name: string;
709
+ category?: string;
710
+ category_name?: string;
711
+ description?: string;
712
+ meta_url?: string;
713
+ meta_url_template?: string;
714
+ plugin_source?: string;
715
+ plugin_code?: string;
716
+ source_key?: string;
717
+ wrapper_version?: string;
718
+ default_version?: string;
719
+ latest_version?: string;
720
+ versions?: string[];
721
+ }
722
+ interface SopsPluginListResult {
723
+ total: number;
724
+ apis: SopsPluginItem[];
725
+ }
726
+ /**
727
+ * 统一插件详情里的表单描述符(bkflow V4 开放插件协议)。
728
+ * component_js / renderform(string) 走 $.atoms 注册链路,key 即注册用的 atom key;
729
+ * is_embedded 为 false 时 data 是脚本地址,否则 data 是脚本源码。
730
+ */
731
+ type SopsPluginFormDescriptor = {
732
+ type: 'component_js';
733
+ key: string;
734
+ data: string;
735
+ base?: string;
736
+ is_embedded?: boolean;
737
+ } | {
738
+ type: 'renderform';
739
+ key?: string;
740
+ data: string | RenderformInputsItem[] | Record<string, unknown>;
741
+ base?: string;
742
+ is_embedded?: boolean;
743
+ } | {
744
+ type: 'jsonschema';
745
+ data: JsonschemaformInputs;
746
+ } | {
747
+ type: 'api_plugin_json';
748
+ data?: Record<string, unknown>;
749
+ };
750
+ interface SopsPluginDetail {
751
+ plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
752
+ plugin_code: string;
753
+ plugin_version: string;
754
+ source_key: string;
755
+ plugin_source?: string;
756
+ protocol?: string;
757
+ wrapper_version?: string;
758
+ name: string;
759
+ description?: string;
760
+ inputs?: UniformApiPluginInputsItem[];
761
+ outputs?: PluginOutputItem[];
762
+ credentials?: Record<string, unknown> | null;
763
+ forms?: {
764
+ input?: SopsPluginFormDescriptor | null;
765
+ output?: SopsPluginFormDescriptor | null;
766
+ } | null;
767
+ form_schema?: Record<string, unknown> | null;
768
+ /** 表单脚本运行所需的上下文(site_url / project 等),由插件提供方下发 */
769
+ form_context?: Record<string, unknown> | null;
770
+ execution_kind?: string;
771
+ url?: string;
772
+ methods?: string[];
773
+ response_data_path?: string;
774
+ polling?: Record<string, any> | null;
775
+ callback?: Record<string, any> | null;
776
+ credential_key?: string;
777
+ }
676
778
  interface BkflowThirdPartyPluginGroupItem {
677
779
  code_name: string;
678
780
  id: number;
@@ -756,7 +858,7 @@ interface BkflowThirdPartyPluginAppDetail {
756
858
  };
757
859
  }
758
860
  interface GroupsPluginItem extends PluginGroupConfig {
759
- children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem)[];
861
+ children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem | SopsPluginSourceItem)[];
760
862
  }
761
863
  interface DndNodeItem {
762
864
  type: string;
@@ -859,14 +961,29 @@ interface PluginOutputItem {
859
961
  type: string;
860
962
  name: string;
861
963
  }
862
- interface PluginDetailCommon {
964
+ /**
965
+ * 输入表单的渲染方式与表单项数据。
966
+ *
967
+ * 两者必须配对:renderform 的表单项以 tag_code 标识、uniformApiForm 用 key,jsonschemaform
968
+ * 给的则是一个 schema 对象而非数组。做成判别联合,取默认值、取字段名、选渲染组件这些地方
969
+ * 就必须先按 inputParamsFormType 收窄,漏掉一种由编译器报出来,而不是在遍历时崩掉。
970
+ */
971
+ type PluginInputForm = {
972
+ inputParamsFormType: 'renderform';
973
+ inputs: RenderformInputsItem[];
974
+ } | {
975
+ inputParamsFormType: 'jsonschemaform';
976
+ inputs: JsonschemaformInputs;
977
+ } | {
978
+ inputParamsFormType: 'uniformApiForm';
979
+ inputs: UniformApiPluginInputsItem[];
980
+ };
981
+ interface PluginDetailBase {
863
982
  code: string;
864
983
  name: string;
865
984
  desc: string;
866
985
  version: string;
867
- inputs: UniformApiPluginInputsItem[] | RenderformInputsItem[] | JsonschemaformInputs;
868
986
  outputs: PluginOutputItem[];
869
- inputParamsFormType: string;
870
987
  versions?: string[];
871
988
  category?: string;
872
989
  group?: string;
@@ -874,10 +991,20 @@ interface PluginDetailCommon {
874
991
  methods?: string[];
875
992
  uniformApiName?: string;
876
993
  polling?: Record<string, any>;
994
+ callback?: Record<string, any>;
995
+ response_data_path?: string;
877
996
  credential_key?: string;
997
+ /** V4 开放插件身份,执行时引擎从 component.data 的同名隐藏字段读取 */
998
+ openPluginIdentity?: {
999
+ pluginId: string;
1000
+ pluginVersion: string;
1001
+ sourceKey: string;
1002
+ wrapperVersion: string;
1003
+ };
878
1004
  component_type?: string;
879
1005
  displayGroupName?: string;
880
1006
  }
1007
+ type PluginDetailCommon = PluginDetailBase & PluginInputForm;
881
1008
  interface CustomVariableType {
882
1009
  name: string;
883
1010
  form: string;
@@ -903,8 +1030,10 @@ interface CustomVariableType {
903
1030
  */
904
1031
  interface FilterVariableSourceNodeComponent {
905
1032
  code?: string;
1033
+ /** `name` 是插件的稳定标识(如 log_plugin);`id` 随环境变化,不能用来做判断 */
906
1034
  api_meta?: {
907
1035
  id?: string;
1036
+ name?: string;
908
1037
  };
909
1038
  data?: Record<string, {
910
1039
  value?: unknown;
@@ -982,6 +1111,49 @@ interface FilterVariableConfig {
982
1111
  */
983
1112
  declare function provideFilterVariableConfig(config?: FilterVariableConfig): void;
984
1113
 
1114
+ interface CreateVariablePayload {
1115
+ keyword?: string;
1116
+ cursorIndex?: number;
1117
+ defaultCustomType?: string;
1118
+ }
1119
+ /**
1120
+ * 宿主自定义的候选项来源标识。
1121
+ *
1122
+ * 编辑器**不解释**它的内容,只做原样存储与回传:`key` 用于让宿主找到自己的加载器,
1123
+ * `params` 放宿主拉取时需要的补充信息。
1124
+ *
1125
+ * 之所以由宿主带进来而不是编辑器从 pipeline_tree 反查关联节点的插件:节点配置尚未
1126
+ * 保存时,`activities[nodeId].component` 还是换插件之前的那个,反查会拿到错的插件。
1127
+ */
1128
+ interface SelectRelatedOptionSourceRef {
1129
+ key: string;
1130
+ params?: Record<string, unknown>;
1131
+ }
1132
+ /**
1133
+ * select 变量「关联数据」的来源,由宿主在节点表单里发起受控创建时锁定。
1134
+ * 与 filter 的 FilterVariableSourceContext 平行。
1135
+ */
1136
+ interface SelectRelatedSourceContext {
1137
+ sourceNodeId: string;
1138
+ /**
1139
+ * 关联来源在「关联数据」栏展示的名字,由宿主决定放什么(bk-incident 放当前选中的插件名)。
1140
+ *
1141
+ * 它**优先于**画布实时解析的节点名:select 的关联源连同候选项来源一起冻结在创建时刻,
1142
+ * 展示名跟着来源走而不是跟着节点实例走。不传则回落实时节点名、再回落裸 nodeId——
1143
+ * 而空节点选插件后配置尚未写回 pipeline_tree,实时节点名恰恰是空的。
1144
+ */
1145
+ sourceNodeName?: string;
1146
+ /** 关联表单项稳定 KEY,例如 index_set_id */
1147
+ sourceFieldKey: string;
1148
+ /**
1149
+ * 关联表单项的展示名,例如「查询条件」——即节点表单上那一栏的标题,不是 fieldKey 本身。
1150
+ * 全局变量侧滑没有加载插件 schema 的时机,不带进来就只能显示裸 fieldKey。
1151
+ */
1152
+ sourceFieldName?: string;
1153
+ /** 候选项从哪来。缺省则该变量没有可拉取的候选项 */
1154
+ optionSource?: SelectRelatedOptionSourceRef;
1155
+ }
1156
+
985
1157
  /**
986
1158
  * filter(复合条件选择)变量的领域逻辑。
987
1159
  *
@@ -1029,12 +1201,16 @@ type FilterWhereValue = FilterWhereItem[];
1029
1201
  *
1030
1202
  * filter 变量不能从普通「新建变量」入口创建——它必须携带关联节点与关联字段,
1031
1203
  * 所以对外只暴露这一个方法,由宿主在节点表单里发起。
1204
+ *
1205
+ * select 的「关联数据」态同样只能受控创建(`selectRelatedContext`),但它是**可选**的:
1206
+ * select 缺少关联源时退化为「手动输入」,仍是一个可用的变量,不像 filter 那样必须锁定。
1032
1207
  */
1033
1208
 
1034
1209
  interface OpenFilterVariableCreateRequest {
1035
1210
  defaultCustomType: 'filter';
1036
1211
  /** 关联来源,filter 场景必填 */
1037
1212
  filterContext: FilterVariableSourceContext;
1213
+ selectRelatedContext?: never;
1038
1214
  keyword?: string;
1039
1215
  /**
1040
1216
  * 可选:把宿主表单里已配好的真实维度条件带进来作为默认值。
@@ -1046,6 +1222,11 @@ interface OpenFilterVariableCreateRequest {
1046
1222
  interface OpenStandardVariableCreateRequest {
1047
1223
  defaultCustomType?: string;
1048
1224
  filterContext?: never;
1225
+ /**
1226
+ * 可选:把 select 变量初始化成「关联数据」态并锁定关联源。
1227
+ * 不传则 select 按「手动输入」初始化。
1228
+ */
1229
+ selectRelatedContext?: SelectRelatedSourceContext;
1049
1230
  keyword?: string;
1050
1231
  cursorIndex?: number;
1051
1232
  onCreated?: (variable: Variable) => void;
@@ -1112,9 +1293,13 @@ interface DebugConditionResult {
1112
1293
  }
1113
1294
  interface DebugContextNode {
1114
1295
  node_id: string;
1296
+ /** 节点显示名称;后端逐步补齐,旧版本可能缺失。 */
1297
+ node_name?: string;
1115
1298
  node_type: string;
1116
1299
  execution_mode: DebugExecutionMode;
1117
1300
  status: DebugNodeStatus;
1301
+ /** 节点配置变更后,已有调试结果是否失效。 */
1302
+ config_changed?: boolean;
1118
1303
  can_step: boolean;
1119
1304
  missing_vars: DebugMissingVar[];
1120
1305
  waiting_reason?: string | null;
@@ -1138,6 +1323,26 @@ interface DebugContextNode {
1138
1323
  /** 条件网关每个分支的表达式与命中结果。 */
1139
1324
  condition_results?: DebugConditionResult[];
1140
1325
  }
1326
+ interface DebugSnapshotNode {
1327
+ node_id: string;
1328
+ node_name: string;
1329
+ node_type: string;
1330
+ execution_mode: DebugExecutionMode;
1331
+ status: DebugNodeStatus;
1332
+ waiting_reason?: string | null;
1333
+ inputs: Record<string, unknown>;
1334
+ outputs: Record<string, unknown>;
1335
+ duration_ms?: number | null;
1336
+ error_detail?: DebugErrorDetail | string | null;
1337
+ log_ref?: DebugContextNode['log_ref'];
1338
+ operator: string;
1339
+ last_run_at?: string | null;
1340
+ config_changed: boolean;
1341
+ node_deleted: boolean;
1342
+ }
1343
+ interface DebugSnapshot {
1344
+ nodes: DebugSnapshotNode[];
1345
+ }
1141
1346
  /**
1142
1347
  * /debug_context/ 顶层结构。
1143
1348
  *
@@ -1161,6 +1366,7 @@ interface DebugContext {
1161
1366
  global_vars: Record<string, unknown>;
1162
1367
  missing_vars?: DebugMissingVar[];
1163
1368
  nodes: DebugContextNode[];
1369
+ debug_snapshot: DebugSnapshot | null;
1164
1370
  }
1165
1371
  interface DebugInputSchemaField {
1166
1372
  key: string;
@@ -1257,6 +1463,45 @@ interface DebugApiServices {
1257
1463
  resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
1258
1464
  }
1259
1465
 
1466
+ /** 版本列表条目。列表接口不返回 pipeline_tree,取流程内容要走 preview_task_tree。 */
1467
+ interface FlowVersionSnapshot {
1468
+ id: number;
1469
+ template_id: number;
1470
+ /** 草稿行为 null;已发布行为 semver 字符串 */
1471
+ version: string | null;
1472
+ desc: string | null;
1473
+ draft: boolean;
1474
+ creator: string;
1475
+ operator: string;
1476
+ /** pipeline 内容指纹 */
1477
+ md5sum: string;
1478
+ create_time: string;
1479
+ update_time: string;
1480
+ }
1481
+ interface FlowVersionListResult {
1482
+ count: number;
1483
+ results: FlowVersionSnapshot[];
1484
+ }
1485
+ interface ReleaseFlowVersionParams {
1486
+ version: string;
1487
+ desc?: string;
1488
+ }
1489
+ interface RollbackFlowVersionParams {
1490
+ version: string;
1491
+ }
1492
+ interface FlowVersionApiServices {
1493
+ /** 版本列表。固定以 limit=-1 请求全量,不做分页 UI */
1494
+ fetchFlowVersionList: (templateId: string) => Promise<FlowVersionListResult>;
1495
+ /** 计算下一个建议版本号。基于当前线上版本 bump,无历史版本时返回 1.0.0 */
1496
+ calculateNextFlowVersion: (templateId: string) => Promise<{
1497
+ version: string;
1498
+ }>;
1499
+ /** 发布上线。作用于 DB 里的草稿行,调用前必须确保草稿已落库 */
1500
+ releaseFlowVersion: (templateId: string, params: ReleaseFlowVersionParams) => Promise<FlowTemplate>;
1501
+ /** 把历史版本加载至草稿,会覆盖当前草稿内容 */
1502
+ rollbackFlowVersion: (templateId: string, params: RollbackFlowVersionParams) => Promise<unknown>;
1503
+ }
1504
+
1260
1505
  interface DrawPipelineParams {
1261
1506
  pipeline_tree: PipelineTree;
1262
1507
  canvas_width: number;
@@ -1307,10 +1552,38 @@ interface OperateTaskNodeParams {
1307
1552
  interface GetFlowTaskDetailParams {
1308
1553
  task_id: number | string;
1309
1554
  }
1555
+ interface SopsPluginCategoryParams {
1556
+ template_id: number | string;
1557
+ /** 空间 uniform_api 配置里的 api_name,如 sops_builtin / sops_third_party */
1558
+ api_name: string;
1559
+ }
1560
+ interface SopsPluginListParams extends SopsPluginCategoryParams {
1561
+ category?: string;
1562
+ /** 插件名称搜索关键字 */
1563
+ key?: string;
1564
+ limit?: number;
1565
+ offset?: number;
1566
+ }
1567
+ /**
1568
+ * 统一插件详情请求参数。
1569
+ * 后端 serializer 会拒绝契约外字段(不是静默忽略),调用方不要附加额外参数;
1570
+ * space_id / scope_type / scope_value 由 service 从 scopeData 补齐。
1571
+ */
1572
+ interface SopsPluginDetailParams {
1573
+ template_id: number | string;
1574
+ plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
1575
+ /** 标准运维网关 plugin id:内置为 `builtin__<code>`,第三方即裸 code */
1576
+ plugin_code: string;
1577
+ plugin_version: string;
1578
+ /** uniform_api 必填,缺失时后端直接 400 */
1579
+ source_key?: string;
1580
+ }
1310
1581
  interface FlowTaskDetail {
1311
1582
  id: number | string;
1312
1583
  template_id: number;
1313
1584
  pipeline_tree: PipelineTree;
1585
+ /** 调试任务执行人。 */
1586
+ executor?: string;
1314
1587
  /** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
1315
1588
  elapsed_time?: number;
1316
1589
  [key: string]: unknown;
@@ -1472,6 +1745,9 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
1472
1745
  count: number;
1473
1746
  }>;
1474
1747
  enableThirdPlugin?: boolean;
1748
+ fetchSopsPluginCategories?: (params: SopsPluginCategoryParams) => Promise<SopsPluginCategory[]>;
1749
+ fetchSopsPluginList?: (params: SopsPluginListParams) => Promise<SopsPluginListResult>;
1750
+ fetchSopsPluginDetail?: (params: SopsPluginDetailParams) => Promise<SopsPluginDetail>;
1475
1751
  fetchPluginDetail?: (id: string) => Promise<UniformApiPluginDetail>;
1476
1752
  fetchApplyInstructionData?: (params: any) => Promise<any>;
1477
1753
  drawPipeline?: (params: DrawPipelineParams) => Promise<{
@@ -1503,7 +1779,7 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
1503
1779
  fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
1504
1780
  getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
1505
1781
  }
1506
- interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
1782
+ interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices>, Partial<FlowVersionApiServices> {
1507
1783
  }
1508
1784
 
1509
1785
  /**
@@ -1514,6 +1790,7 @@ interface SelectPanelConfig {
1514
1790
  agentResourceUrl?: string;
1515
1791
  agentButtonText?: string;
1516
1792
  knowledgebaseResourceUrl?: string;
1793
+ sopsCategoryWhitelist?: string;
1517
1794
  }
1518
1795
  /**
1519
1796
  * 人员选择器配置
@@ -1752,6 +2029,68 @@ declare namespace __execute_vue {
1752
2029
  };
1753
2030
  }
1754
2031
 
2032
+ /**
2033
+ * select 变量「关联数据」候选来源的领域逻辑。
2034
+ *
2035
+ * 关联标识落在 `meta.related` 的 `node_id` / `field_key` 上,不复用 `source_info`——
2036
+ * 那里表达的是「哪些节点表单项 hook 了本变量」,两种语义混在一起会让节点删除时的
2037
+ * 清理逻辑误伤。
2038
+ *
2039
+ * 与 filter 的差异是刻意的:filter 脱离关联节点就无法执行,所以它锁定类型、并在
2040
+ * 节点删除时连变量一起清理;select 关联失效后退回「手动输入」就能继续用,而且可能
2041
+ * 已被多处引用,因此这里既不锁类型也不做清理,只把「关联节点已不存在」暴露给配置态。
2042
+ */
2043
+
2044
+ /** 关联标识。select 恒为单节点单表单项 */
2045
+ interface SelectRelatedSource {
2046
+ nodeId: string;
2047
+ fieldKey: string;
2048
+ }
2049
+ /** 关联来源的完整信息:标识 + 宿主自定义的来源引用 */
2050
+ interface SelectRelatedSourceInfo extends SelectRelatedSource {
2051
+ optionSource?: SelectRelatedOptionSourceRef;
2052
+ }
2053
+
2054
+ /**
2055
+ * 关联态 select 的候选项来源:由宿主注入。
2056
+ *
2057
+ * 编辑器不认识具体插件与接口,只要 `{ id, name }[]`——「调哪条指令、响应怎么解析」
2058
+ * 是宿主的知识,放进来就得在编辑器里写死插件名。
2059
+ *
2060
+ * 契约刻意比 FilterVariableConfig 小:filter 需要注入依赖组件、字段与候选值三件套,
2061
+ * select 只需要一次列表拉取。
2062
+ */
2063
+
2064
+ interface SelectRelatedOptionItem {
2065
+ id: string;
2066
+ name: string;
2067
+ }
2068
+ interface SelectRelatedOptionSource extends SelectRelatedSourceInfo {
2069
+ /**
2070
+ * 关联节点当前 component,仅在节点配置**已写回** pipeline_tree 时才反映真实插件。
2071
+ * 从节点配置面板发起创建时它还是换插件之前的那个,所以宿主必须核对后再用,
2072
+ * 不能把它当作插件标识的唯一来源。
2073
+ */
2074
+ nodeComponent?: FilterVariableSourceNodeComponent;
2075
+ }
2076
+ interface SelectRelatedOptionConfig {
2077
+ getOptions(source: SelectRelatedOptionSource): Promise<SelectRelatedOptionItem[]>;
2078
+ /**
2079
+ * 关联来源在「关联数据」栏的展示名(如「查询条件」)。
2080
+ *
2081
+ * 由宿主实时提供而不是沿用创建时的快照:那个文案属于宿主的节点表单,改了之后已存
2082
+ * 变量也该跟着显示新的。不实现或返回空时回落快照。
2083
+ */
2084
+ resolveSourceLabel?(source: SelectRelatedSourceInfo): string | undefined;
2085
+ }
2086
+ /**
2087
+ * 在顶层组件中提供候选项来源。
2088
+ *
2089
+ * 与 `provideFilterVariableConfig` 一致:config 为 undefined 时不调用 provide,
2090
+ * 避免遮蔽父级已提供的配置。
2091
+ */
2092
+ declare function provideSelectRelatedOptionConfig(config?: SelectRelatedOptionConfig): void;
2093
+
1755
2094
  type __VLS_Slots$4 = {
1756
2095
  customFormContent?: (props: {
1757
2096
  customFormData: Record<string, any>;
@@ -1771,6 +2110,8 @@ type __VLS_Props$4 = {
1771
2110
  memberSelectorConfig?: MemberSelectorConfig;
1772
2111
  /** 执行时填写 filter 变量条件所需的能力;不传则这类变量退化为只读文本 */
1773
2112
  filterVariableConfig?: FilterVariableConfig;
2113
+ /** 执行时关联态 select 变量的候选项来源;不传则这类变量的下拉为空 */
2114
+ selectRelatedOptionConfig?: SelectRelatedOptionConfig;
1774
2115
  };
1775
2116
  declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1776
2117
  close: (...args: any[]) => void;
@@ -1803,18 +2144,12 @@ declare namespace __create_task_vue {
1803
2144
  };
1804
2145
  }
1805
2146
 
1806
- interface CreateVariablePayload {
1807
- keyword?: string;
1808
- cursorIndex?: number;
1809
- defaultCustomType?: string;
1810
- }
1811
-
1812
2147
  type __VLS_Slots$3 = {
1813
2148
  header?: () => any;
1814
2149
  inputParams?: (props: {
1815
2150
  node: any;
1816
2151
  pluginDetail: PluginDetailCommon | null;
1817
- inputs: any[];
2152
+ inputs: PluginInputForm['inputs'];
1818
2153
  editable: boolean;
1819
2154
  fullVariableList: {
1820
2155
  key: string;
@@ -1849,6 +2184,8 @@ type __VLS_Props$3 = {
1849
2184
  memberSelectorConfig?: MemberSelectorConfig;
1850
2185
  /** 复合条件选择(filter)变量的宿主配置;不传则该类型变量不可用,其余功能不受影响 */
1851
2186
  filterVariableConfig?: FilterVariableConfig;
2187
+ /** 关联态 select 变量的候选项来源;不传则这类变量的下拉为空,其余功能不受影响 */
2188
+ selectRelatedOptionConfig?: SelectRelatedOptionConfig;
1852
2189
  onSave?: (flowData: FlowTemplate) => void;
1853
2190
  onSaveSuccess?: () => void;
1854
2191
  onBack?: () => void;
@@ -1933,7 +2270,7 @@ type __VLS_Slots$2 = {
1933
2270
  inputParams?: (props: {
1934
2271
  node: any;
1935
2272
  pluginDetail: PluginDetailCommon | null;
1936
- inputs: any[];
2273
+ inputs: PluginInputForm['inputs'];
1937
2274
  editable: boolean;
1938
2275
  fullVariableList: {
1939
2276
  key: string;
@@ -2036,10 +2373,15 @@ interface FlowDetailPermissions {
2036
2373
 
2037
2374
  type __VLS_Slots$1 = {
2038
2375
  header?: () => any;
2376
+ /** 头部右侧操作区追加宿主自定义按钮,位于内置「保存」「执行流程」之后 */
2377
+ headerActions?: (props: {
2378
+ savePending: boolean;
2379
+ canMutateFlow: boolean;
2380
+ }) => any;
2039
2381
  inputParams?: (props: {
2040
2382
  node: any;
2041
2383
  pluginDetail: PluginDetailCommon | null;
2042
- inputs: any[];
2384
+ inputs: PluginInputForm['inputs'];
2043
2385
  editable: boolean;
2044
2386
  fullVariableList: {
2045
2387
  key: string;
@@ -2064,6 +2406,13 @@ type __VLS_Props$1 = {
2064
2406
  permissions?: Partial<FlowDetailPermissions>;
2065
2407
  enableVersion?: boolean;
2066
2408
  flowVersion?: string;
2409
+ /**
2410
+ * 是否启用版本管理 UI(头部版本选择器 + 版本历史 + 发布 + 回滚),默认 false。
2411
+ *
2412
+ * 开启即隐含 `enableVersion` 的数据加载语义(草稿/指定版本读取),消费方只需传这一个。
2413
+ * 组件无法自检空间的 flow_versioning 开关,由消费方保证只在开启版本管理的空间传 true。
2414
+ */
2415
+ enableVersionManagement?: boolean;
2067
2416
  defaultZoom?: number;
2068
2417
  bkflowSaasUrl?: string;
2069
2418
  enableThirdPlugin?: boolean;
@@ -2073,6 +2422,8 @@ type __VLS_Props$1 = {
2073
2422
  memberSelectorConfig?: MemberSelectorConfig;
2074
2423
  /** 复合条件选择(filter)变量的宿主配置;不传则该类型变量不可用,其余功能不受影响 */
2075
2424
  filterVariableConfig?: FilterVariableConfig;
2425
+ /** 关联态 select 变量的候选项来源;不传则这类变量的下拉为空,其余功能不受影响 */
2426
+ selectRelatedOptionConfig?: SelectRelatedOptionConfig;
2076
2427
  onSave?: (flowData: FlowTemplate) => void;
2077
2428
  onSaveSuccess?: () => void;
2078
2429
  onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
@@ -2094,18 +2445,21 @@ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {
2094
2445
  saveSuccess: () => any;
2095
2446
  createVariable: (payload: CreateVariablePayload) => any;
2096
2447
  executeSuccess: (result: FlowTaskExecuteSuccessResult) => any;
2448
+ "update:flowVersion": (version: string | undefined) => any;
2097
2449
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
2098
2450
  onBack?: (() => any) | undefined;
2099
2451
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
2100
2452
  onSaveSuccess?: (() => any) | undefined;
2101
2453
  onCreateVariable?: ((payload: CreateVariablePayload) => any) | undefined;
2102
2454
  onExecuteSuccess?: ((result: FlowTaskExecuteSuccessResult) => any) | undefined;
2455
+ "onUpdate:flowVersion"?: ((version: string | undefined) => any) | undefined;
2103
2456
  }>, {
2104
2457
  quickAdd: QuickAddConfig;
2105
2458
  enableThirdPlugin: boolean;
2106
2459
  hideTrigger: boolean;
2107
2460
  defaultZoom: number;
2108
2461
  enableVersion: boolean;
2462
+ enableVersionManagement: boolean;
2109
2463
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
2110
2464
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
2111
2465
  declare const _default$2: typeof __VLS_export$1;
@@ -2421,7 +2775,7 @@ declare function exportToPipelineTree(flowModel: FlowModel): PipelineTree;
2421
2775
  * - edge.reconnect:若源从条件网关迁出,清理旧条件
2422
2776
  * - node.remove:主动查找将被级联删除的边,清理对应网关条件;
2423
2777
  * 若删除的是分支网关,级联删除关联的 placeholder 节点;
2424
- * 同时清理全局变量中对被删除节点的 source_info 引用,并删除已无引用的变量
2778
+ * 同时清理全局变量中对被删除节点的 source_info 引用,并删除已无引用的派生变量
2425
2779
  * - node.move / node.set-extensions(parentId):循环容器大小自适应(子节点移动后容器包住内容)
2426
2780
  */
2427
2781
  declare function createBkflowPlugin(): CanvasPlugin;
@@ -2445,6 +2799,28 @@ declare function createExecutionStatusPlugin(stateRef: Ref<TaskExecutionStates>)
2445
2799
  */
2446
2800
  declare function resolveExecutionActions(state: NodeExecutionState | undefined, nodeType: string): ExecutionNodeAction[];
2447
2801
 
2802
+ type BkuiLocale = typeof defaultRootConfig.locale;
2803
+ /** 取当前语言对应的 bkui-vue 语言包;消费方注册的第三语言从 registry 取。 */
2804
+ declare function resolveBkuiLocale(locale: string): BkuiLocale | undefined;
2805
+ /**
2806
+ * 顶层 Flow 组件 setup 内调用:在本组件子树内应用语言(含 Teleport 弹层),
2807
+ * 并改写 defaultRootConfig 覆盖脱离组件树的命令式 Message / InfoBox。
2808
+ *
2809
+ * 约束 1:必须先读 useGlobalConfig() 再合并。provideGlobalConfig 内部是
2810
+ * merge(defaultRootConfig, config),直接传 { locale } 会拿 defaultRootConfig.prefix
2811
+ * 覆盖宿主自定义的 prefix。
2812
+ * 约束 2:zh-cn 时整段跳过,保证现有消费方零行为变化,也不会把已设为英文的宿主拽回中文。
2813
+ * 代价是不会把 defaultRootConfig 改回中文——语言切换本就要求宿主刷新页面。
2814
+ *
2815
+ * 注意 defaultRootConfig 是 bkui-vue 的模块级单例,这一行的**影响范围是整个宿主应用**,
2816
+ * 不限于本组件子树:宿主在别处调用的 bkui-vue 命令式弹窗语言也会随之变化。
2817
+ * 这是覆盖命令式组件的唯一手段(它们没有组件上下文可供 inject),已在
2818
+ * docs/usage.md「对宿主 bkui-vue 全局配置的影响」中对消费方说明。
2819
+ */
2820
+ declare function applyBkuiLocaleToTree(): void;
2821
+ /** 自建 createApp 调用:该 app 脱离宿主 provide 链,从 defaultRootConfig 起步合并。 */
2822
+ declare function applyBkuiLocale(app: App): void;
2823
+
2448
2824
  declare const _default: {
2449
2825
  FlowView: () => Promise<typeof __view_vue>;
2450
2826
  FlowEdit: () => Promise<typeof __edit_vue>;
@@ -2458,5 +2834,5 @@ declare const _default: {
2458
2834
  FlowMockDebug: () => Promise<typeof __mock_vue>;
2459
2835
  };
2460
2836
 
2461
- export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$5 as FlowCreateTask, _default$7 as FlowDebug, _default$2 as FlowDetail, _default$4 as FlowEdit, _default$6 as FlowExecute, _default$8 as FlowMockDebug, _default$3 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, isMockableNode, mergeOutputs, normalizePluginOutputItems, provideFilterVariableConfig, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, random4, resolveExecutionActions, resolveMockFormControl, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
2462
- export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FilterCandidateQuery, FilterConditionOptions, FilterConditionValue, FilterVariableConfig, FilterVariableSourceContext, FilterVariableSourceNodeComponent, FilterWhereItem, FilterWhereValue, FlowApiConfig, FlowDetailExpose, FlowDetailPermissions, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, GlobalVariableCreateExpose, MemberSelectorConfig, MockOutputField, NodeExecutionState, NodeExecutionStatus, NodeMockConfig, NotifyConfig, OpenFilterVariableCreateRequest, OpenGlobalVariableCreateRequest, OpenStandardVariableCreateRequest, PipelineTree, PluginDetailCommon, PluginInputDataItem, RetrievalFilterField, SelectPanelConfig, SimulateDebugCanvasContext, SimulateDebugStage, SimulateDebugState, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };
2837
+ export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$5 as FlowCreateTask, _default$7 as FlowDebug, _default$2 as FlowDetail, _default$4 as FlowEdit, _default$6 as FlowExecute, _default$8 as FlowMockDebug, _default$3 as FlowView, applyBkuiLocale, applyBkuiLocaleToTree, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, isMockableNode, mergeOutputs, normalizePluginOutputItems, provideFilterVariableConfig, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, provideSelectRelatedOptionConfig, random4, resolveBkuiLocale, resolveExecutionActions, resolveMockFormControl, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
2838
+ export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FilterCandidateQuery, FilterConditionOptions, FilterConditionValue, FilterVariableConfig, FilterVariableSourceContext, FilterVariableSourceNodeComponent, FilterWhereItem, FilterWhereValue, FlowApiConfig, FlowDetailExpose, FlowDetailPermissions, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, GlobalVariableCreateExpose, MemberSelectorConfig, MockOutputField, NodeExecutionState, NodeExecutionStatus, NodeMockConfig, NotifyConfig, OpenFilterVariableCreateRequest, OpenGlobalVariableCreateRequest, OpenStandardVariableCreateRequest, PipelineTree, PluginDetailCommon, PluginInputDataItem, RetrievalFilterField, SelectPanelConfig, SelectRelatedOptionConfig, SelectRelatedOptionItem, SelectRelatedOptionSource, SelectRelatedOptionSourceRef, SelectRelatedSourceContext, SimulateDebugCanvasContext, SimulateDebugStage, SimulateDebugState, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };