@blueking/bkflow-canvas-editor 1.1.0-beta.43 → 1.1.0-beta.45
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/README.md +59 -2
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +69 -3
- package/dist/advanced.esm.js +1 -1
- package/dist/bkflow-canvas-editor_false-B70uLuHL.cjs +1 -0
- package/dist/bkflow-canvas-editor_false-BlC281Zg.cjs +1 -0
- package/dist/bkflow-canvas-editor_false-Casww7p4.js +5 -0
- package/dist/bkflow-canvas-editor_false-i9G8sqQi.js +5 -0
- package/dist/context-Bu4mmo1Q.js +1593 -0
- package/dist/context-bUpcrt8M.cjs +6 -0
- package/dist/index-Bb8gt0ZM.cjs +2 -0
- package/dist/index-BynYn4VD.cjs +1 -0
- package/dist/index-C1q_QVHM.cjs +1 -0
- package/dist/index-C8XJMS_J.js +236 -0
- package/dist/index-CddPhY6u.cjs +1 -0
- package/dist/{index-Bqm08e7H.js → index-CgRqOi-E.js} +28172 -28252
- package/dist/index-Ci_fP1q2.js +127 -0
- package/dist/index-ClbXmmTg.js +168 -0
- package/dist/index-DQG9J2SZ.js +137 -0
- package/dist/index-FcnoAxWL.cjs +82 -0
- package/dist/index-Htumo8sH.cjs +1 -0
- package/dist/index-_LhW2Gn_.js +647 -0
- package/dist/index-pYNKHhNh.js +73 -0
- package/dist/index-rLG78MgZ.cjs +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +104 -4
- package/dist/index.esm.js +43 -34
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/context-Bg6nsbrK.js +0 -688
- package/dist/context-iqnF_HqS.cjs +0 -1
- package/dist/index-B0DQFaEe.cjs +0 -82
- package/dist/index-BBNwbryo.cjs +0 -1
- package/dist/index-BSJC2Tb-.js +0 -512
- package/dist/index-BycpBKMO.cjs +0 -1
- package/dist/index-Ckij2Mxn.cjs +0 -1
- package/dist/index-D7t1wcMU.js +0 -234
- package/dist/index-DgQ-ScE5.js +0 -162
- package/dist/index.es.min-BpHMrg2Y.cjs +0 -2
- package/dist/index.es.min-DYp0DL9J.js +0 -3543
package/README.md
CHANGED
|
@@ -411,7 +411,8 @@ interface SelectPanelConfig {
|
|
|
411
411
|
| `apiConfig` | `FlowApiConfig \| FlowDetailApiConfig` | - | **必需**,API 配置对象;`canDebug=true` 时需一并提供调试方法(见下) |
|
|
412
412
|
| `permissions` | `Partial<FlowDetailPermissions>` | `{ canEdit: false, canDebug: false, canExecute: false }` | 权限配置,**默认全部拒绝**,需显式开启 |
|
|
413
413
|
| `onExecuteSuccess` | `(result: FlowTaskExecuteSuccessResult) => void` | - | 执行成功回调,参数与 `FlowView` 一致 |
|
|
414
|
-
| `enableVersion` / `flowVersion` | `boolean` / `string` | `false` / - | 流程版本功能,语义与 FlowView/FlowEdit
|
|
414
|
+
| `enableVersion` / `flowVersion` | `boolean` / `string` | `false` / - | 流程版本功能,语义与 FlowView/FlowEdit 一致;`flowVersion` 支持 `v-model` |
|
|
415
|
+
| `enableVersionManagement` | `boolean` | `false` | 是否启用版本管理 UI(版本选择器 + 版本历史 + 发布 + 回滚),见下 |
|
|
415
416
|
| `defaultZoom` / `quickAdd` / `hideTrigger` / `bkflowSaasUrl` | 同 FlowEdit | - | 透传给内部画布与信息侧滑 |
|
|
416
417
|
|
|
417
418
|
#### Events
|
|
@@ -422,6 +423,7 @@ interface SelectPanelConfig {
|
|
|
422
423
|
| `saveSuccess` | - | 显式保存成功后触发 |
|
|
423
424
|
| `back` | - | 返回按钮点击时触发 |
|
|
424
425
|
| `createVariable` | `{ keyword, cursorIndex }` | 请求新建全局变量时触发 |
|
|
426
|
+
| `update:flowVersion` | `version: string \| undefined` | 内部切换查看版本时触发;`undefined` 表示回到草稿。宿主可用 `v-model:flowVersion` 同步 URL,也可以不接 |
|
|
425
427
|
|
|
426
428
|
#### Slots
|
|
427
429
|
|
|
@@ -462,7 +464,22 @@ interface SelectPanelConfig {
|
|
|
462
464
|
- **单节点 Mock**:配置 Mock 输出结果后执行(内部顺序:保存 Mock → 单步执行 mock);执行时跳过该节点并以 Mock 输出替代实际输出,Mock 节点在后续全流程中保留 `MOCK` 标签。
|
|
463
465
|
- **取消 Mock**:清除节点的持久 Mock 配置。
|
|
464
466
|
- **终止**:全流程终止不传 `node_id`;单步调试进入运行/等待态时,传当前 `active_node_id` 终止该节点。
|
|
465
|
-
- **保存联动**:`canDebug`
|
|
467
|
+
- **保存联动**:`canDebug` 时保存成功后刷新 `debug_context`;最后一次 `debug_snapshot` 会保留,直接修改或删除的节点分别由 `config_changed` / `node_deleted` 标记为已失效。
|
|
468
|
+
|
|
469
|
+
#### 版本管理(`enableVersionManagement=true`)
|
|
470
|
+
|
|
471
|
+
开启后头部流程名右侧出现版本选择器,头部图标区新增「版本历史」入口。草稿态右侧操作区依次展示主按钮「发布」和浅蓝次按钮「暂存草稿」,不展示「执行流程」;历史版本只读态只展示「执行流程」。
|
|
472
|
+
|
|
473
|
+
- **数据加载**:`enableVersionManagement=true` 隐含 `enableVersion` 的语义,消费方只需传这一个。查看的版本由组件内部持有,初值取 `flowVersion`。
|
|
474
|
+
- **草稿切换**:版本下拉首项固定为「草稿」;`flowVersion` 为空时默认选中草稿,选中该项可从历史版本预览切回当前草稿。
|
|
475
|
+
- **查看历史版本**:选中历史版本后画布转为只读预览(走 `preview_task_tree`),不展示保存与发布,**调试域整体不挂载** —— 后端调试端点只读 DB 里的草稿,在历史版本视图下调试会跑在草稿上,结果与画面不符。
|
|
476
|
+
- **草稿自动保存**:完整版本管理开启后,画布结构/配置、节点配置、全局变量和基础信息的编辑结果会按顺序自动保存全量流程;保存草稿不做完整性校验,允许暂存未完成流程。
|
|
477
|
+
- **发布上线**:发布前会全量校验并确保草稿已落库(后端 `release_template` 转正的是 DB 里的 draft 行,不接受请求体里的 pipeline)。发布成功后刷新版本列表,并从新发布版本初始化草稿。版本号默认取 `calculate_version` 的建议值,失败原因内联展示在版本号字段上并保留输入。
|
|
478
|
+
- **加载至草稿**:入口仅在版本历史条目 hover 中展示,二次确认后用所选历史版本覆盖当前草稿,随后回到草稿态重载。
|
|
479
|
+
- **权限**:发布与回滚都收敛到 `permissions.canEdit`,不引入额外权限位;调试运行中(`debugLocked`)全部禁用。
|
|
480
|
+
- **空间开关**:组件无法自检空间的 `flow_versioning` 配置(后端 `get_space_related_configs` 不返回该字段),由消费方保证只在已开启版本管理的空间传 `true`。
|
|
481
|
+
|
|
482
|
+
`enableVersionManagement=true` 且消费方传入完整 api 配置对象时,需一并提供 `fetchFlowVersionList`、`calculateNextFlowVersion`、`releaseFlowVersion`、`rollbackFlowVersion`(签名见 `FlowVersionApiServices`)。走内置 `useFlowApi()` 时自动获得。
|
|
466
483
|
|
|
467
484
|
#### 调试 API 契约(`canDebug=true` 必需)
|
|
468
485
|
|
|
@@ -1402,6 +1419,46 @@ resolve: {
|
|
|
1402
1419
|
- FlowEdit 会自动将版本相关 props 透传给内嵌的 FlowDebug 组件
|
|
1403
1420
|
- 版本功能依赖 `fetchFlowDraftDetail` 和 `fetchFlowDetailByVersion` 两个 API 方法
|
|
1404
1421
|
|
|
1422
|
+
## 国际化
|
|
1423
|
+
|
|
1424
|
+
包内自带 `zh-cn` 与 `en` 词条,默认 `zh-cn`。宿主在挂载前调用一次 `setLocale` 即可:
|
|
1425
|
+
|
|
1426
|
+
```typescript
|
|
1427
|
+
import { setLocale } from '@blueking/bkflow-canvas-editor';
|
|
1428
|
+
|
|
1429
|
+
setLocale('en');
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
语言是进程级全局状态,切换后需由宿主刷新页面;不支持同一页面内两个画布实例使用不同语言。
|
|
1433
|
+
|
|
1434
|
+
组件库(bkui-vue / element-plus)的文案由包内自动联动,宿主无需在 `app.use(bkui)` 时额外配置。
|
|
1435
|
+
|
|
1436
|
+
`setLocale` 只管前端文案。**后端下发的内容(插件名称、插件表单 schema 标签、接口报错)
|
|
1437
|
+
不受它影响**——bkflow 后端按 `blueking_language` Cookie(`zh-cn` / `en`)判定语言,
|
|
1438
|
+
不读 `Accept-Language` 请求头,宿主需自行设置该 Cookie。
|
|
1439
|
+
|
|
1440
|
+
locale 非 `zh-cn` 时本包会改写 bkui-vue 的 `defaultRootConfig.locale` 以覆盖命令式
|
|
1441
|
+
`Message` / `InfoBox`,**影响范围是整个宿主应用**。详见
|
|
1442
|
+
[docs/usage.md 的国际化章节](./docs/usage.md#国际化)。
|
|
1443
|
+
|
|
1444
|
+
进阶用法:
|
|
1445
|
+
|
|
1446
|
+
| API | 用途 |
|
|
1447
|
+
| --- | --- |
|
|
1448
|
+
| `registerMessages(locale, messages, options?)` | 深合并覆盖个别词条,或注册包内没有的新语言 |
|
|
1449
|
+
| `setTranslator(fn)` | 完全接管翻译,桥接宿主已有的 i18n;返回 `undefined` 时回落包内词条 |
|
|
1450
|
+
| `getLocale()` | 读取当前语言 |
|
|
1451
|
+
|
|
1452
|
+
注册新语言时可一并提供 bkui-vue 语言包:
|
|
1453
|
+
|
|
1454
|
+
```typescript
|
|
1455
|
+
import { registerMessages } from '@blueking/bkflow-canvas-editor';
|
|
1456
|
+
import jaMessages from './ja';
|
|
1457
|
+
import { jp } from 'bkui-vue/lib/locale';
|
|
1458
|
+
|
|
1459
|
+
registerMessages('ja', jaMessages, { bkuiLocale: jp });
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1405
1462
|
## License
|
|
1406
1463
|
|
|
1407
1464
|
MIT
|
package/dist/advanced.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context-bUpcrt8M.cjs");exports.PLUGIN_GROUP_ICON_MAP=e.PLUGIN_GROUP_ICON_MAP;exports.SOPS_PLUGIN_GROUP_NAME=e.SOPS_PLUGIN_GROUP_NAME;exports.provideVariableInputCreateVariable=e.provideVariableInputCreateVariable;exports.resolveSopsPluginSources=e.resolveSopsPluginSources;exports.useFlowApi=e.useFlowApi;exports.useVariableInputCreateVariable=e.useVariableInputCreateVariable;exports.withSopsPluginGroup=e.withSopsPluginGroup;
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
2
|
|
|
3
|
-
type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'SKIP';
|
|
3
|
+
type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'INVALID' | 'SKIP';
|
|
4
4
|
type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
|
|
5
5
|
interface NodeExecutionState {
|
|
6
6
|
status: NodeExecutionStatus;
|
|
@@ -816,9 +816,13 @@ interface DebugConditionResult {
|
|
|
816
816
|
}
|
|
817
817
|
interface DebugContextNode {
|
|
818
818
|
node_id: string;
|
|
819
|
+
/** 节点显示名称;后端逐步补齐,旧版本可能缺失。 */
|
|
820
|
+
node_name?: string;
|
|
819
821
|
node_type: string;
|
|
820
822
|
execution_mode: DebugExecutionMode;
|
|
821
823
|
status: DebugNodeStatus;
|
|
824
|
+
/** 节点配置变更后,已有调试结果是否失效。 */
|
|
825
|
+
config_changed?: boolean;
|
|
822
826
|
can_step: boolean;
|
|
823
827
|
missing_vars: DebugMissingVar[];
|
|
824
828
|
waiting_reason?: string | null;
|
|
@@ -842,6 +846,26 @@ interface DebugContextNode {
|
|
|
842
846
|
/** 条件网关每个分支的表达式与命中结果。 */
|
|
843
847
|
condition_results?: DebugConditionResult[];
|
|
844
848
|
}
|
|
849
|
+
interface DebugSnapshotNode {
|
|
850
|
+
node_id: string;
|
|
851
|
+
node_name: string;
|
|
852
|
+
node_type: string;
|
|
853
|
+
execution_mode: DebugExecutionMode;
|
|
854
|
+
status: DebugNodeStatus;
|
|
855
|
+
waiting_reason?: string | null;
|
|
856
|
+
inputs: Record<string, unknown>;
|
|
857
|
+
outputs: Record<string, unknown>;
|
|
858
|
+
duration_ms?: number | null;
|
|
859
|
+
error_detail?: DebugErrorDetail | string | null;
|
|
860
|
+
log_ref?: DebugContextNode['log_ref'];
|
|
861
|
+
operator: string;
|
|
862
|
+
last_run_at?: string | null;
|
|
863
|
+
config_changed: boolean;
|
|
864
|
+
node_deleted: boolean;
|
|
865
|
+
}
|
|
866
|
+
interface DebugSnapshot {
|
|
867
|
+
nodes: DebugSnapshotNode[];
|
|
868
|
+
}
|
|
845
869
|
/**
|
|
846
870
|
* /debug_context/ 顶层结构。
|
|
847
871
|
*
|
|
@@ -865,6 +889,7 @@ interface DebugContext {
|
|
|
865
889
|
global_vars: Record<string, unknown>;
|
|
866
890
|
missing_vars?: DebugMissingVar[];
|
|
867
891
|
nodes: DebugContextNode[];
|
|
892
|
+
debug_snapshot: DebugSnapshot | null;
|
|
868
893
|
}
|
|
869
894
|
interface DebugInputSchemaField {
|
|
870
895
|
key: string;
|
|
@@ -961,6 +986,45 @@ interface DebugApiServices {
|
|
|
961
986
|
resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
|
|
962
987
|
}
|
|
963
988
|
|
|
989
|
+
/** 版本列表条目。列表接口不返回 pipeline_tree,取流程内容要走 preview_task_tree。 */
|
|
990
|
+
interface FlowVersionSnapshot {
|
|
991
|
+
id: number;
|
|
992
|
+
template_id: number;
|
|
993
|
+
/** 草稿行为 null;已发布行为 semver 字符串 */
|
|
994
|
+
version: string | null;
|
|
995
|
+
desc: string | null;
|
|
996
|
+
draft: boolean;
|
|
997
|
+
creator: string;
|
|
998
|
+
operator: string;
|
|
999
|
+
/** pipeline 内容指纹 */
|
|
1000
|
+
md5sum: string;
|
|
1001
|
+
create_time: string;
|
|
1002
|
+
update_time: string;
|
|
1003
|
+
}
|
|
1004
|
+
interface FlowVersionListResult {
|
|
1005
|
+
count: number;
|
|
1006
|
+
results: FlowVersionSnapshot[];
|
|
1007
|
+
}
|
|
1008
|
+
interface ReleaseFlowVersionParams {
|
|
1009
|
+
version: string;
|
|
1010
|
+
desc?: string;
|
|
1011
|
+
}
|
|
1012
|
+
interface RollbackFlowVersionParams {
|
|
1013
|
+
version: string;
|
|
1014
|
+
}
|
|
1015
|
+
interface FlowVersionApiServices {
|
|
1016
|
+
/** 版本列表。固定以 limit=-1 请求全量,不做分页 UI */
|
|
1017
|
+
fetchFlowVersionList: (templateId: string) => Promise<FlowVersionListResult>;
|
|
1018
|
+
/** 计算下一个建议版本号。基于当前线上版本 bump,无历史版本时返回 1.0.0 */
|
|
1019
|
+
calculateNextFlowVersion: (templateId: string) => Promise<{
|
|
1020
|
+
version: string;
|
|
1021
|
+
}>;
|
|
1022
|
+
/** 发布上线。作用于 DB 里的草稿行,调用前必须确保草稿已落库 */
|
|
1023
|
+
releaseFlowVersion: (templateId: string, params: ReleaseFlowVersionParams) => Promise<FlowTemplate>;
|
|
1024
|
+
/** 把历史版本加载至草稿,会覆盖当前草稿内容 */
|
|
1025
|
+
rollbackFlowVersion: (templateId: string, params: RollbackFlowVersionParams) => Promise<unknown>;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
964
1028
|
/**
|
|
965
1029
|
* Flow API 配置接口
|
|
966
1030
|
*/
|
|
@@ -1071,6 +1135,8 @@ interface FlowTaskDetail {
|
|
|
1071
1135
|
id: number | string;
|
|
1072
1136
|
template_id: number;
|
|
1073
1137
|
pipeline_tree: PipelineTree;
|
|
1138
|
+
/** 调试任务执行人。 */
|
|
1139
|
+
executor?: string;
|
|
1074
1140
|
/** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
|
|
1075
1141
|
elapsed_time?: number;
|
|
1076
1142
|
[key: string]: unknown;
|
|
@@ -1242,7 +1308,7 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
|
|
|
1242
1308
|
fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
|
|
1243
1309
|
getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
|
|
1244
1310
|
}
|
|
1245
|
-
interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
|
|
1311
|
+
interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices>, Partial<FlowVersionApiServices> {
|
|
1246
1312
|
}
|
|
1247
1313
|
|
|
1248
1314
|
declare const SOPS_PLUGIN_GROUP_NAME = "sops";
|
|
@@ -1276,4 +1342,4 @@ declare const provideVariableInputCreateVariable: (handler: VariableInputCreateV
|
|
|
1276
1342
|
declare const useVariableInputCreateVariable: () => VariableInputCreateVariableHandler | null;
|
|
1277
1343
|
|
|
1278
1344
|
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 };
|
|
1345
|
+
export type { CreateVariablePayload, CreateVariableRequest, CustomVariableType, DebugApiServices, DebugConditionResult, DebugContext, DebugContextNode, DebugContextStatus, DebugErrorDetail, DebugExecutionMode, DebugInputSchema, DebugMissingVar, DebugNodeStatus, DebugRunStatus, DebugRunType, DebugSnapshot, DebugSnapshotNode, EndEvent, Flow, FlowDetailApiConfig, FlowEditApiConfig, FlowListItem, FlowVersionApiServices, FlowVersionListResult, FlowVersionSnapshot, FlowViewApiConfig, GatewayType, Line, Location, NodeConfigData, NodeType, NotifyConfig, PluginGroupConfig, PluginOutputItem, PortOrientation, ReleaseFlowVersionParams, RollbackFlowVersionParams, SelectRelatedSourceContext, SopsPluginCategory, SopsPluginCategoryParams, SopsPluginDetail, SopsPluginDetailParams, SopsPluginFormDescriptor, SopsPluginItem, SopsPluginListParams, SopsPluginListResult, SopsPluginSourceItem, SpaceUniformApiEntry, StartEvent, TemplateConfigs, UniformApiPluginConfig, UniformApiPluginInputsItem, VariableInputCreateVariableHandler, VariableOption, VariableRefRequestParams };
|
package/dist/advanced.esm.js
CHANGED
|
@@ -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;
|