@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/README.md +96 -4
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +303 -28
- package/dist/advanced.esm.js +5 -2
- package/dist/context-CRk9vKJC.js +1621 -0
- package/dist/context-DhrPIIhQ.cjs +6 -0
- package/dist/index-6rNDFrb4.cjs +1 -0
- package/dist/index-8pQzq3Ur.js +73 -0
- package/dist/index-AG8VS7s1.js +63948 -0
- package/dist/index-B23-CKGW.js +137 -0
- package/dist/index-Bfi8TnAs.cjs +1 -0
- package/dist/index-BixpBxnO.cjs +1 -0
- package/dist/index-Bqf2hF4V.js +236 -0
- package/dist/index-BxgXAWVo.cjs +2 -0
- package/dist/index-C9br9kc6.js +127 -0
- package/dist/index-CKRWpad1.cjs +1 -0
- package/dist/index-CM38Ngjr.cjs +101 -0
- package/dist/index-CwRfChg0.cjs +1 -0
- package/dist/index-RHH-xjOH.js +647 -0
- package/dist/index-kieIlAaW.js +168 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +403 -27
- package/dist/index.esm.js +38 -28
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/context-Bj442dps.cjs +0 -1
- package/dist/context-CdSU0w5S.js +0 -633
- package/dist/index-C1XiYW6i.cjs +0 -93
- package/dist/index-ClFOndkK.js +0 -162
- package/dist/index-CoM_iLar.cjs +0 -1
- package/dist/index-D9tWoY5i.js +0 -514
- package/dist/index-DV2Z3oiJ.js +0 -58627
- package/dist/index-DwS9cgRG.cjs +0 -1
- package/dist/index-Dzam0n1k.js +0 -234
- package/dist/index-g6e2NJbw.cjs +0 -1
package/README.md
CHANGED
|
@@ -208,7 +208,7 @@ npm install @blueking/bkflow-canvas-editor @blueking/flow-canvas
|
|
|
208
208
|
|
|
209
209
|
### SelectPanelConfig 类型
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
插件选择面板配置类型,用于配置插件选择面板中的按钮跳转链接、文本以及标准运维插件分类白名单。
|
|
212
212
|
|
|
213
213
|
#### 类型定义
|
|
214
214
|
|
|
@@ -218,6 +218,7 @@ interface SelectPanelConfig {
|
|
|
218
218
|
agentResourceUrl?: string; // "智能体" 按钮跳转链接(可选)
|
|
219
219
|
agentButtonText?: string; // "智能体" 按钮文本(可选,默认为 "智能体")
|
|
220
220
|
knowledgebaseResourceUrl?: string; // 知识库插件分组,"知识库" 按钮跳转链接(可选)
|
|
221
|
+
sopsCategoryWhitelist?: string; // 「标准运维插件」分组的分类白名单,分号分隔(可选)
|
|
221
222
|
}
|
|
222
223
|
```
|
|
223
224
|
|
|
@@ -233,6 +234,7 @@ interface SelectPanelConfig {
|
|
|
233
234
|
agentResourceUrl: 'https://example.com/agent',
|
|
234
235
|
agentButtonText: '创建智能体',
|
|
235
236
|
knowledgebaseResourceUrl: 'https://example.com/knowledgebase',
|
|
237
|
+
sopsCategoryWhitelist: '作业平台(JOB);配置平台(CMDB)',
|
|
236
238
|
}" />
|
|
237
239
|
</template>
|
|
238
240
|
```
|
|
@@ -243,6 +245,20 @@ interface SelectPanelConfig {
|
|
|
243
245
|
- `agentButtonText` 默认值为 "智能体"
|
|
244
246
|
- 配置通过 Vue 的 provide/inject 机制全局提供,子组件可以直接通过 `useSelectPanelConfig()` 获取
|
|
245
247
|
|
|
248
|
+
##### sopsCategoryWhitelist
|
|
249
|
+
|
|
250
|
+
只有命中白名单的标准运维插件分类才会出现在插件选择面板里,白名单外的分类及其插件对用户不可见。宿主一般由环境变量下发(例如 bk-incident 的 `BUITIN_PLUGINS_FILTERS` 经 html 注入到前端):
|
|
251
|
+
|
|
252
|
+
```vue
|
|
253
|
+
<FlowEdit :select-panel-config="{ sopsCategoryWhitelist: window.BUITIN_PLUGINS_FILTERS }" />
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
- 多个分类用半角分号 `;` 分隔(全角 `;` 也可识别),每项与分类名或分类 id 精确相等(前后空格会被忽略)即命中
|
|
257
|
+
- 不传或传空串时展示全部分类,行为与改动前一致
|
|
258
|
+
- 「内置插件」与「第三方插件」两个来源共用同一份白名单
|
|
259
|
+
- 分类被全部过滤时该来源下展示「暂无插件分类」空态,分组和来源 tab 本身仍然显示
|
|
260
|
+
- 白名单只控制可选范围,已配置了白名单外插件的历史节点照常展示和编辑
|
|
261
|
+
|
|
246
262
|
---
|
|
247
263
|
|
|
248
264
|
### FlowCreateTask 组件
|
|
@@ -395,7 +411,8 @@ interface SelectPanelConfig {
|
|
|
395
411
|
| `apiConfig` | `FlowApiConfig \| FlowDetailApiConfig` | - | **必需**,API 配置对象;`canDebug=true` 时需一并提供调试方法(见下) |
|
|
396
412
|
| `permissions` | `Partial<FlowDetailPermissions>` | `{ canEdit: false, canDebug: false, canExecute: false }` | 权限配置,**默认全部拒绝**,需显式开启 |
|
|
397
413
|
| `onExecuteSuccess` | `(result: FlowTaskExecuteSuccessResult) => void` | - | 执行成功回调,参数与 `FlowView` 一致 |
|
|
398
|
-
| `enableVersion` / `flowVersion` | `boolean` / `string` | `false` / - | 流程版本功能,语义与 FlowView/FlowEdit
|
|
414
|
+
| `enableVersion` / `flowVersion` | `boolean` / `string` | `false` / - | 流程版本功能,语义与 FlowView/FlowEdit 一致;`flowVersion` 支持 `v-model` |
|
|
415
|
+
| `enableVersionManagement` | `boolean` | `false` | 是否启用版本管理 UI(版本选择器 + 版本历史 + 发布 + 回滚),见下 |
|
|
399
416
|
| `defaultZoom` / `quickAdd` / `hideTrigger` / `bkflowSaasUrl` | 同 FlowEdit | - | 透传给内部画布与信息侧滑 |
|
|
400
417
|
|
|
401
418
|
#### Events
|
|
@@ -406,6 +423,16 @@ interface SelectPanelConfig {
|
|
|
406
423
|
| `saveSuccess` | - | 显式保存成功后触发 |
|
|
407
424
|
| `back` | - | 返回按钮点击时触发 |
|
|
408
425
|
| `createVariable` | `{ keyword, cursorIndex }` | 请求新建全局变量时触发 |
|
|
426
|
+
| `update:flowVersion` | `version: string \| undefined` | 内部切换查看版本时触发;`undefined` 表示回到草稿。宿主可用 `v-model:flowVersion` 同步 URL,也可以不接 |
|
|
427
|
+
|
|
428
|
+
#### Slots
|
|
429
|
+
|
|
430
|
+
| 插槽名 | 作用域参数 | 说明 |
|
|
431
|
+
| ------------------ | ------------------------------------------- | ---------------------------------------------------------------------- |
|
|
432
|
+
| `header` | - | 自定义头部左侧标题区 |
|
|
433
|
+
| `headerActions` | `{ savePending, canMutateFlow }` | 头部右侧操作区追加宿主自定义按钮,排在内置「保存」「执行流程」之后 |
|
|
434
|
+
| `inputParams` | 见 `FlowView` | 自定义节点输入参数表单 |
|
|
435
|
+
| `customFormContent`| 见 `FlowView` | 自定义创建任务侧滑表单内容 |
|
|
409
436
|
|
|
410
437
|
#### 权限矩阵
|
|
411
438
|
|
|
@@ -418,7 +445,17 @@ interface SelectPanelConfig {
|
|
|
418
445
|
| `false` | `true` | 只读画布 + 全流程/单节点调试(调试期间流程本就不可编辑) |
|
|
419
446
|
| `true` | `true` | 可编辑、保存与完整调试;调试运行中锁定编辑(画布转 `view`)|
|
|
420
447
|
|
|
421
|
-
`permissions.canExecute`
|
|
448
|
+
`permissions.canExecute` 独立控制头部“执行流程”按钮的显示,为 `false` 时按钮不渲染。流程存在未保存修改时,确认保存成功后才会打开创建任务侧滑;`customFormContent` 插槽与 `FlowView` 一致。
|
|
449
|
+
|
|
450
|
+
头部右侧按钮区在 `canEdit`、`canExecute` 均为 `false` 且未传 `headerActions` 插槽时整体不渲染。宿主若要按状态控制自定义按钮的显隐,可在插槽模板上直接加 `v-if`,插槽未传入时按钮区不会留下空白:
|
|
451
|
+
|
|
452
|
+
```vue
|
|
453
|
+
<FlowDetail :flow-id="flowId" :api-config="apiConfig" :permissions="permissions">
|
|
454
|
+
<template v-if="permissions.canEdit" #headerActions>
|
|
455
|
+
<bk-button @click="handleExitEdit">退出编辑</bk-button>
|
|
456
|
+
</template>
|
|
457
|
+
</FlowDetail>
|
|
458
|
+
```
|
|
422
459
|
|
|
423
460
|
#### 调试能力
|
|
424
461
|
|
|
@@ -427,7 +464,22 @@ interface SelectPanelConfig {
|
|
|
427
464
|
- **单节点 Mock**:配置 Mock 输出结果后执行(内部顺序:保存 Mock → 单步执行 mock);执行时跳过该节点并以 Mock 输出替代实际输出,Mock 节点在后续全流程中保留 `MOCK` 标签。
|
|
428
465
|
- **取消 Mock**:清除节点的持久 Mock 配置。
|
|
429
466
|
- **终止**:全流程终止不传 `node_id`;单步调试进入运行/等待态时,传当前 `active_node_id` 终止该节点。
|
|
430
|
-
- **保存联动**:`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()` 时自动获得。
|
|
431
483
|
|
|
432
484
|
#### 调试 API 契约(`canDebug=true` 必需)
|
|
433
485
|
|
|
@@ -1367,6 +1419,46 @@ resolve: {
|
|
|
1367
1419
|
- FlowEdit 会自动将版本相关 props 透传给内嵌的 FlowDebug 组件
|
|
1368
1420
|
- 版本功能依赖 `fetchFlowDraftDetail` 和 `fetchFlowDetailByVersion` 两个 API 方法
|
|
1369
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
|
+
|
|
1370
1462
|
## License
|
|
1371
1463
|
|
|
1372
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-DhrPIIhQ.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;
|
|
@@ -81,13 +81,26 @@ interface ActivityComponent {
|
|
|
81
81
|
api_meta?: {
|
|
82
82
|
id: string;
|
|
83
83
|
name: string;
|
|
84
|
+
/** 项目内 uniform_api 仍可能写入;标准运维 V4 对齐 bkflow,不再落这个字段 */
|
|
84
85
|
alias?: string;
|
|
85
|
-
meta_url
|
|
86
|
+
/** 目录项有 meta_url 才写;V4 开放插件通常只有 meta_url_template */
|
|
87
|
+
meta_url?: string;
|
|
86
88
|
api_key: string;
|
|
87
89
|
category: {
|
|
88
90
|
id: string;
|
|
89
91
|
name: string;
|
|
90
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;
|
|
91
104
|
};
|
|
92
105
|
}
|
|
93
106
|
|
|
@@ -572,15 +585,20 @@ interface FlowListItem {
|
|
|
572
585
|
creator: string;
|
|
573
586
|
update_at: string;
|
|
574
587
|
}
|
|
588
|
+
interface SpaceUniformApiEntry {
|
|
589
|
+
meta_apis: string;
|
|
590
|
+
api_categories?: string;
|
|
591
|
+
display_name?: string;
|
|
592
|
+
source_key?: string;
|
|
593
|
+
catalog_mode?: 'remote' | 'cache_first' | 'cache_only';
|
|
594
|
+
headers?: Record<string, string>;
|
|
595
|
+
}
|
|
575
596
|
interface SpaceFlowConfig {
|
|
576
597
|
gateway_expression?: 'boolrule' | 'FEEL' | 'MAKO';
|
|
577
|
-
|
|
578
|
-
api
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
meta_apis: string;
|
|
582
|
-
}>;
|
|
583
|
-
};
|
|
598
|
+
uniform_api?: {
|
|
599
|
+
api?: Record<string, SpaceUniformApiEntry | null>;
|
|
600
|
+
common?: SpaceUniformApiEntry | null;
|
|
601
|
+
} | null;
|
|
584
602
|
}
|
|
585
603
|
interface UpdateFlowParams {
|
|
586
604
|
name: string;
|
|
@@ -610,6 +628,88 @@ interface PluginMetaItem {
|
|
|
610
628
|
icon?: string;
|
|
611
629
|
category_id: string;
|
|
612
630
|
}
|
|
631
|
+
interface SopsPluginSourceItem {
|
|
632
|
+
id: string;
|
|
633
|
+
name: string;
|
|
634
|
+
/** 空间配置 uniform_api.api[api_name].source_key,缺省时等于 api_name */
|
|
635
|
+
source_key?: string;
|
|
636
|
+
}
|
|
637
|
+
interface SopsPluginCategory {
|
|
638
|
+
id: string;
|
|
639
|
+
name: string;
|
|
640
|
+
}
|
|
641
|
+
interface SopsPluginItem {
|
|
642
|
+
id: string;
|
|
643
|
+
name: string;
|
|
644
|
+
category?: string;
|
|
645
|
+
category_name?: string;
|
|
646
|
+
description?: string;
|
|
647
|
+
meta_url?: string;
|
|
648
|
+
meta_url_template?: string;
|
|
649
|
+
plugin_source?: string;
|
|
650
|
+
plugin_code?: string;
|
|
651
|
+
source_key?: string;
|
|
652
|
+
wrapper_version?: string;
|
|
653
|
+
default_version?: string;
|
|
654
|
+
latest_version?: string;
|
|
655
|
+
versions?: string[];
|
|
656
|
+
}
|
|
657
|
+
interface SopsPluginListResult {
|
|
658
|
+
total: number;
|
|
659
|
+
apis: SopsPluginItem[];
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* 统一插件详情里的表单描述符(bkflow V4 开放插件协议)。
|
|
663
|
+
* component_js / renderform(string) 走 $.atoms 注册链路,key 即注册用的 atom key;
|
|
664
|
+
* is_embedded 为 false 时 data 是脚本地址,否则 data 是脚本源码。
|
|
665
|
+
*/
|
|
666
|
+
type SopsPluginFormDescriptor = {
|
|
667
|
+
type: 'component_js';
|
|
668
|
+
key: string;
|
|
669
|
+
data: string;
|
|
670
|
+
base?: string;
|
|
671
|
+
is_embedded?: boolean;
|
|
672
|
+
} | {
|
|
673
|
+
type: 'renderform';
|
|
674
|
+
key?: string;
|
|
675
|
+
data: string | RenderformInputsItem[] | Record<string, unknown>;
|
|
676
|
+
base?: string;
|
|
677
|
+
is_embedded?: boolean;
|
|
678
|
+
} | {
|
|
679
|
+
type: 'jsonschema';
|
|
680
|
+
data: JsonschemaformInputs;
|
|
681
|
+
} | {
|
|
682
|
+
type: 'api_plugin_json';
|
|
683
|
+
data?: Record<string, unknown>;
|
|
684
|
+
};
|
|
685
|
+
interface SopsPluginDetail {
|
|
686
|
+
plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
|
|
687
|
+
plugin_code: string;
|
|
688
|
+
plugin_version: string;
|
|
689
|
+
source_key: string;
|
|
690
|
+
plugin_source?: string;
|
|
691
|
+
protocol?: string;
|
|
692
|
+
wrapper_version?: string;
|
|
693
|
+
name: string;
|
|
694
|
+
description?: string;
|
|
695
|
+
inputs?: UniformApiPluginInputsItem[];
|
|
696
|
+
outputs?: PluginOutputItem[];
|
|
697
|
+
credentials?: Record<string, unknown> | null;
|
|
698
|
+
forms?: {
|
|
699
|
+
input?: SopsPluginFormDescriptor | null;
|
|
700
|
+
output?: SopsPluginFormDescriptor | null;
|
|
701
|
+
} | null;
|
|
702
|
+
form_schema?: Record<string, unknown> | null;
|
|
703
|
+
/** 表单脚本运行所需的上下文(site_url / project 等),由插件提供方下发 */
|
|
704
|
+
form_context?: Record<string, unknown> | null;
|
|
705
|
+
execution_kind?: string;
|
|
706
|
+
url?: string;
|
|
707
|
+
methods?: string[];
|
|
708
|
+
response_data_path?: string;
|
|
709
|
+
polling?: Record<string, any> | null;
|
|
710
|
+
callback?: Record<string, any> | null;
|
|
711
|
+
credential_key?: string;
|
|
712
|
+
}
|
|
613
713
|
interface BkflowThirdPartyPluginGroupItem {
|
|
614
714
|
code_name: string;
|
|
615
715
|
id: number;
|
|
@@ -693,7 +793,7 @@ interface BkflowThirdPartyPluginAppDetail {
|
|
|
693
793
|
};
|
|
694
794
|
}
|
|
695
795
|
interface GroupsPluginItem extends PluginGroupConfig {
|
|
696
|
-
children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem)[];
|
|
796
|
+
children: (PluginMetaItem | BkflowThirdPartyPluginGroupItem | SopsPluginSourceItem)[];
|
|
697
797
|
}
|
|
698
798
|
interface UniformApiPluginOutputItem {
|
|
699
799
|
key: string;
|
|
@@ -745,6 +845,29 @@ interface UniformApiPluginConfig {
|
|
|
745
845
|
}>;
|
|
746
846
|
};
|
|
747
847
|
}
|
|
848
|
+
interface RenderformInputsItem {
|
|
849
|
+
name?: string;
|
|
850
|
+
tag_code: string;
|
|
851
|
+
type: string;
|
|
852
|
+
attrs: Record<string, any>;
|
|
853
|
+
events?: Record<string, any>[];
|
|
854
|
+
validation?: Record<string, any>[];
|
|
855
|
+
}
|
|
856
|
+
interface JsonschemaformInputs {
|
|
857
|
+
type: string;
|
|
858
|
+
properties: Record<string, any>;
|
|
859
|
+
required?: string[];
|
|
860
|
+
definitions?: Record<string, {
|
|
861
|
+
type: string;
|
|
862
|
+
title: string;
|
|
863
|
+
description?: string;
|
|
864
|
+
default?: string | boolean | number | string[] | boolean[] | number[] | Record<string, any>;
|
|
865
|
+
enum?: string[];
|
|
866
|
+
items?: Record<string, any>;
|
|
867
|
+
'ui:props'?: Record<string, any>;
|
|
868
|
+
'ui:component'?: Record<string, any>;
|
|
869
|
+
}>;
|
|
870
|
+
}
|
|
748
871
|
interface UniformApiPluginInputsItem {
|
|
749
872
|
desc: string;
|
|
750
873
|
form_type?: string;
|
|
@@ -780,6 +903,60 @@ interface CustomVariableType {
|
|
|
780
903
|
code: string;
|
|
781
904
|
}
|
|
782
905
|
|
|
906
|
+
interface VariableOption {
|
|
907
|
+
key: string;
|
|
908
|
+
name: string;
|
|
909
|
+
source_type?: string;
|
|
910
|
+
custom_type?: string;
|
|
911
|
+
}
|
|
912
|
+
interface CreateVariablePayload {
|
|
913
|
+
keyword?: string;
|
|
914
|
+
cursorIndex?: number;
|
|
915
|
+
defaultCustomType?: string;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* 宿主自定义的候选项来源标识。
|
|
919
|
+
*
|
|
920
|
+
* 编辑器**不解释**它的内容,只做原样存储与回传:`key` 用于让宿主找到自己的加载器,
|
|
921
|
+
* `params` 放宿主拉取时需要的补充信息。
|
|
922
|
+
*
|
|
923
|
+
* 之所以由宿主带进来而不是编辑器从 pipeline_tree 反查关联节点的插件:节点配置尚未
|
|
924
|
+
* 保存时,`activities[nodeId].component` 还是换插件之前的那个,反查会拿到错的插件。
|
|
925
|
+
*/
|
|
926
|
+
interface SelectRelatedOptionSourceRef {
|
|
927
|
+
key: string;
|
|
928
|
+
params?: Record<string, unknown>;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* select 变量「关联数据」的来源,由宿主在节点表单里发起受控创建时锁定。
|
|
932
|
+
* 与 filter 的 FilterVariableSourceContext 平行。
|
|
933
|
+
*/
|
|
934
|
+
interface SelectRelatedSourceContext {
|
|
935
|
+
sourceNodeId: string;
|
|
936
|
+
/**
|
|
937
|
+
* 关联来源在「关联数据」栏展示的名字,由宿主决定放什么(bk-incident 放当前选中的插件名)。
|
|
938
|
+
*
|
|
939
|
+
* 它**优先于**画布实时解析的节点名:select 的关联源连同候选项来源一起冻结在创建时刻,
|
|
940
|
+
* 展示名跟着来源走而不是跟着节点实例走。不传则回落实时节点名、再回落裸 nodeId——
|
|
941
|
+
* 而空节点选插件后配置尚未写回 pipeline_tree,实时节点名恰恰是空的。
|
|
942
|
+
*/
|
|
943
|
+
sourceNodeName?: string;
|
|
944
|
+
/** 关联表单项稳定 KEY,例如 index_set_id */
|
|
945
|
+
sourceFieldKey: string;
|
|
946
|
+
/**
|
|
947
|
+
* 关联表单项的展示名,例如「查询条件」——即节点表单上那一栏的标题,不是 fieldKey 本身。
|
|
948
|
+
* 全局变量侧滑没有加载插件 schema 的时机,不带进来就只能显示裸 fieldKey。
|
|
949
|
+
*/
|
|
950
|
+
sourceFieldName?: string;
|
|
951
|
+
/** 候选项从哪来。缺省则该变量没有可拉取的候选项 */
|
|
952
|
+
optionSource?: SelectRelatedOptionSourceRef;
|
|
953
|
+
}
|
|
954
|
+
interface CreateVariableRequest extends CreateVariablePayload {
|
|
955
|
+
/** 缺省时 select 仍按「手动输入」初始化,普通「新建变量」入口不受影响 */
|
|
956
|
+
selectRelatedContext?: SelectRelatedSourceContext;
|
|
957
|
+
onCreated: (option: VariableOption) => void;
|
|
958
|
+
}
|
|
959
|
+
|
|
783
960
|
type DebugContextStatus = 'idle' | 'running' | 'terminating';
|
|
784
961
|
type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'revoked' | 'suspended' | 'skipped';
|
|
785
962
|
type DebugExecutionMode = 'real' | 'mock';
|
|
@@ -814,9 +991,13 @@ interface DebugConditionResult {
|
|
|
814
991
|
}
|
|
815
992
|
interface DebugContextNode {
|
|
816
993
|
node_id: string;
|
|
994
|
+
/** 节点显示名称;后端逐步补齐,旧版本可能缺失。 */
|
|
995
|
+
node_name?: string;
|
|
817
996
|
node_type: string;
|
|
818
997
|
execution_mode: DebugExecutionMode;
|
|
819
998
|
status: DebugNodeStatus;
|
|
999
|
+
/** 节点配置变更后,已有调试结果是否失效。 */
|
|
1000
|
+
config_changed?: boolean;
|
|
820
1001
|
can_step: boolean;
|
|
821
1002
|
missing_vars: DebugMissingVar[];
|
|
822
1003
|
waiting_reason?: string | null;
|
|
@@ -840,6 +1021,26 @@ interface DebugContextNode {
|
|
|
840
1021
|
/** 条件网关每个分支的表达式与命中结果。 */
|
|
841
1022
|
condition_results?: DebugConditionResult[];
|
|
842
1023
|
}
|
|
1024
|
+
interface DebugSnapshotNode {
|
|
1025
|
+
node_id: string;
|
|
1026
|
+
node_name: string;
|
|
1027
|
+
node_type: string;
|
|
1028
|
+
execution_mode: DebugExecutionMode;
|
|
1029
|
+
status: DebugNodeStatus;
|
|
1030
|
+
waiting_reason?: string | null;
|
|
1031
|
+
inputs: Record<string, unknown>;
|
|
1032
|
+
outputs: Record<string, unknown>;
|
|
1033
|
+
duration_ms?: number | null;
|
|
1034
|
+
error_detail?: DebugErrorDetail | string | null;
|
|
1035
|
+
log_ref?: DebugContextNode['log_ref'];
|
|
1036
|
+
operator: string;
|
|
1037
|
+
last_run_at?: string | null;
|
|
1038
|
+
config_changed: boolean;
|
|
1039
|
+
node_deleted: boolean;
|
|
1040
|
+
}
|
|
1041
|
+
interface DebugSnapshot {
|
|
1042
|
+
nodes: DebugSnapshotNode[];
|
|
1043
|
+
}
|
|
843
1044
|
/**
|
|
844
1045
|
* /debug_context/ 顶层结构。
|
|
845
1046
|
*
|
|
@@ -863,6 +1064,7 @@ interface DebugContext {
|
|
|
863
1064
|
global_vars: Record<string, unknown>;
|
|
864
1065
|
missing_vars?: DebugMissingVar[];
|
|
865
1066
|
nodes: DebugContextNode[];
|
|
1067
|
+
debug_snapshot: DebugSnapshot | null;
|
|
866
1068
|
}
|
|
867
1069
|
interface DebugInputSchemaField {
|
|
868
1070
|
key: string;
|
|
@@ -959,6 +1161,45 @@ interface DebugApiServices {
|
|
|
959
1161
|
resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
|
|
960
1162
|
}
|
|
961
1163
|
|
|
1164
|
+
/** 版本列表条目。列表接口不返回 pipeline_tree,取流程内容要走 preview_task_tree。 */
|
|
1165
|
+
interface FlowVersionSnapshot {
|
|
1166
|
+
id: number;
|
|
1167
|
+
template_id: number;
|
|
1168
|
+
/** 草稿行为 null;已发布行为 semver 字符串 */
|
|
1169
|
+
version: string | null;
|
|
1170
|
+
desc: string | null;
|
|
1171
|
+
draft: boolean;
|
|
1172
|
+
creator: string;
|
|
1173
|
+
operator: string;
|
|
1174
|
+
/** pipeline 内容指纹 */
|
|
1175
|
+
md5sum: string;
|
|
1176
|
+
create_time: string;
|
|
1177
|
+
update_time: string;
|
|
1178
|
+
}
|
|
1179
|
+
interface FlowVersionListResult {
|
|
1180
|
+
count: number;
|
|
1181
|
+
results: FlowVersionSnapshot[];
|
|
1182
|
+
}
|
|
1183
|
+
interface ReleaseFlowVersionParams {
|
|
1184
|
+
version: string;
|
|
1185
|
+
desc?: string;
|
|
1186
|
+
}
|
|
1187
|
+
interface RollbackFlowVersionParams {
|
|
1188
|
+
version: string;
|
|
1189
|
+
}
|
|
1190
|
+
interface FlowVersionApiServices {
|
|
1191
|
+
/** 版本列表。固定以 limit=-1 请求全量,不做分页 UI */
|
|
1192
|
+
fetchFlowVersionList: (templateId: string) => Promise<FlowVersionListResult>;
|
|
1193
|
+
/** 计算下一个建议版本号。基于当前线上版本 bump,无历史版本时返回 1.0.0 */
|
|
1194
|
+
calculateNextFlowVersion: (templateId: string) => Promise<{
|
|
1195
|
+
version: string;
|
|
1196
|
+
}>;
|
|
1197
|
+
/** 发布上线。作用于 DB 里的草稿行,调用前必须确保草稿已落库 */
|
|
1198
|
+
releaseFlowVersion: (templateId: string, params: ReleaseFlowVersionParams) => Promise<FlowTemplate>;
|
|
1199
|
+
/** 把历史版本加载至草稿,会覆盖当前草稿内容 */
|
|
1200
|
+
rollbackFlowVersion: (templateId: string, params: RollbackFlowVersionParams) => Promise<unknown>;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
962
1203
|
/**
|
|
963
1204
|
* Flow API 配置接口
|
|
964
1205
|
*/
|
|
@@ -1039,10 +1280,38 @@ interface OperateTaskNodeParams {
|
|
|
1039
1280
|
interface GetFlowTaskDetailParams {
|
|
1040
1281
|
task_id: number | string;
|
|
1041
1282
|
}
|
|
1283
|
+
interface SopsPluginCategoryParams {
|
|
1284
|
+
template_id: number | string;
|
|
1285
|
+
/** 空间 uniform_api 配置里的 api_name,如 sops_builtin / sops_third_party */
|
|
1286
|
+
api_name: string;
|
|
1287
|
+
}
|
|
1288
|
+
interface SopsPluginListParams extends SopsPluginCategoryParams {
|
|
1289
|
+
category?: string;
|
|
1290
|
+
/** 插件名称搜索关键字 */
|
|
1291
|
+
key?: string;
|
|
1292
|
+
limit?: number;
|
|
1293
|
+
offset?: number;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* 统一插件详情请求参数。
|
|
1297
|
+
* 后端 serializer 会拒绝契约外字段(不是静默忽略),调用方不要附加额外参数;
|
|
1298
|
+
* space_id / scope_type / scope_value 由 service 从 scopeData 补齐。
|
|
1299
|
+
*/
|
|
1300
|
+
interface SopsPluginDetailParams {
|
|
1301
|
+
template_id: number | string;
|
|
1302
|
+
plugin_type: 'component' | 'remote_plugin' | 'uniform_api';
|
|
1303
|
+
/** 标准运维网关 plugin id:内置为 `builtin__<code>`,第三方即裸 code */
|
|
1304
|
+
plugin_code: string;
|
|
1305
|
+
plugin_version: string;
|
|
1306
|
+
/** uniform_api 必填,缺失时后端直接 400 */
|
|
1307
|
+
source_key?: string;
|
|
1308
|
+
}
|
|
1042
1309
|
interface FlowTaskDetail {
|
|
1043
1310
|
id: number | string;
|
|
1044
1311
|
template_id: number;
|
|
1045
1312
|
pipeline_tree: PipelineTree;
|
|
1313
|
+
/** 调试任务执行人。 */
|
|
1314
|
+
executor?: string;
|
|
1046
1315
|
/** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
|
|
1047
1316
|
elapsed_time?: number;
|
|
1048
1317
|
[key: string]: unknown;
|
|
@@ -1198,6 +1467,9 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
|
|
|
1198
1467
|
count: number;
|
|
1199
1468
|
}>;
|
|
1200
1469
|
enableThirdPlugin?: boolean;
|
|
1470
|
+
fetchSopsPluginCategories?: (params: SopsPluginCategoryParams) => Promise<SopsPluginCategory[]>;
|
|
1471
|
+
fetchSopsPluginList?: (params: SopsPluginListParams) => Promise<SopsPluginListResult>;
|
|
1472
|
+
fetchSopsPluginDetail?: (params: SopsPluginDetailParams) => Promise<SopsPluginDetail>;
|
|
1201
1473
|
fetchPluginDetail?: (id: string) => Promise<UniformApiPluginDetail>;
|
|
1202
1474
|
fetchApplyInstructionData?: (params: any) => Promise<any>;
|
|
1203
1475
|
drawPipeline?: (params: DrawPipelineParams) => Promise<{
|
|
@@ -1229,35 +1501,38 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
|
|
|
1229
1501
|
fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
|
|
1230
1502
|
getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
|
|
1231
1503
|
}
|
|
1232
|
-
interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
|
|
1504
|
+
interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices>, Partial<FlowVersionApiServices> {
|
|
1233
1505
|
}
|
|
1234
1506
|
|
|
1507
|
+
declare const SOPS_PLUGIN_GROUP_NAME = "sops";
|
|
1235
1508
|
declare const PLUGIN_GROUP_ICON_MAP: Record<string, string>;
|
|
1236
1509
|
|
|
1510
|
+
/** 目录查询接口由宿主注入,三个都要有才能走完「来源 -> 分类 -> 插件 -> 详情」 */
|
|
1511
|
+
type SopsPluginCatalogApi = Pick<FlowEditApiConfig, 'fetchSopsPluginCategories' | 'fetchSopsPluginList' | 'fetchSopsPluginDetail'>;
|
|
1512
|
+
interface SopsPluginGroupOptions {
|
|
1513
|
+
spaceConfig?: SpaceFlowConfig | null;
|
|
1514
|
+
api: SopsPluginCatalogApi;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* 从 `get_space_related_configs` 的 `uniform_api.api` 里取出标准运维来源。
|
|
1518
|
+
* id 即后续请求分类/插件列表要带的 `api_name`,顺序沿用配置里的顺序。
|
|
1519
|
+
*/
|
|
1520
|
+
declare function resolveSopsPluginSources(config?: SpaceFlowConfig | null): SopsPluginSourceItem[];
|
|
1521
|
+
/**
|
|
1522
|
+
* 空间接入了标准运维、且宿主实现了目录查询接口时,在插件分组末尾补上「标准运维插件」分组;
|
|
1523
|
+
* 否则原样返回。两个条件都要满足:少了接口,分组点开也只是一个永远空着的列表。
|
|
1524
|
+
*/
|
|
1525
|
+
declare function withSopsPluginGroup(groups: GroupsPluginItem[], options: SopsPluginGroupOptions): GroupsPluginItem[];
|
|
1526
|
+
|
|
1237
1527
|
/**
|
|
1238
1528
|
* 使用 Flow API 的 composable
|
|
1239
1529
|
* 返回所有 API 方法,兼容 FlowDetailApiConfig 接口(含调试 API)
|
|
1240
1530
|
*/
|
|
1241
1531
|
declare function useFlowApi(config: FlowApiConfig): FlowDetailApiConfig;
|
|
1242
1532
|
|
|
1243
|
-
interface VariableOption {
|
|
1244
|
-
key: string;
|
|
1245
|
-
name: string;
|
|
1246
|
-
source_type?: string;
|
|
1247
|
-
custom_type?: string;
|
|
1248
|
-
}
|
|
1249
|
-
interface CreateVariablePayload {
|
|
1250
|
-
keyword?: string;
|
|
1251
|
-
cursorIndex?: number;
|
|
1252
|
-
defaultCustomType?: string;
|
|
1253
|
-
}
|
|
1254
|
-
interface CreateVariableRequest extends CreateVariablePayload {
|
|
1255
|
-
onCreated: (option: VariableOption) => void;
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
1533
|
type VariableInputCreateVariableHandler = (request: CreateVariableRequest) => void;
|
|
1259
1534
|
declare const provideVariableInputCreateVariable: (handler: VariableInputCreateVariableHandler) => void;
|
|
1260
1535
|
declare const useVariableInputCreateVariable: () => VariableInputCreateVariableHandler | null;
|
|
1261
1536
|
|
|
1262
|
-
export { PLUGIN_GROUP_ICON_MAP, provideVariableInputCreateVariable, useFlowApi, useVariableInputCreateVariable };
|
|
1263
|
-
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, StartEvent, TemplateConfigs, UniformApiPluginConfig, UniformApiPluginInputsItem, VariableInputCreateVariableHandler, VariableOption, VariableRefRequestParams };
|
|
1537
|
+
export { PLUGIN_GROUP_ICON_MAP, SOPS_PLUGIN_GROUP_NAME, provideVariableInputCreateVariable, resolveSopsPluginSources, useFlowApi, useVariableInputCreateVariable, withSopsPluginGroup };
|
|
1538
|
+
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
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { P as r, p as i, u as p, a as
|
|
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-CRk9vKJC.js";
|
|
2
2
|
export {
|
|
3
3
|
r as PLUGIN_GROUP_ICON_MAP,
|
|
4
|
+
s as SOPS_PLUGIN_GROUP_NAME,
|
|
4
5
|
i as provideVariableInputCreateVariable,
|
|
6
|
+
o as resolveSopsPluginSources,
|
|
5
7
|
p as useFlowApi,
|
|
6
|
-
|
|
8
|
+
u as useVariableInputCreateVariable,
|
|
9
|
+
P as withSopsPluginGroup
|
|
7
10
|
};
|