@arronqzy/vue-blueprint 0.1.17 → 0.1.18
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
CHANGED
|
@@ -47,6 +47,19 @@ const selectedNodeId = ref<string | null>(null);
|
|
|
47
47
|
import "@arronqzy/vue-blueprint/blueprint.css";
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## 本地存储
|
|
51
|
+
|
|
52
|
+
蓝图库、执行日志、接口集合存在 IndexedDB,函数最后一个参数都是 `nameSpace`:
|
|
53
|
+
|
|
54
|
+
| 数据 | 函数 |
|
|
55
|
+
|------|------|
|
|
56
|
+
| 蓝图库 | `listBlueprintLibrary` / `getBlueprintLibraryRecord` / `putBlueprintLibraryRecord` / `deleteBlueprintLibraryRecord` / `clearBlueprintLibrary` |
|
|
57
|
+
| 执行日志 | `listExecutionRunRecords` / `getExecutionRunRecord` / `putExecutionRunRecord` / `deleteExecutionRunRecord` / `clearAllExecutionRunRecords` / `purgeExecutionRunsOlderThan` / `trimExecutionRunRecordsToMax` / `downloadExecutionRunExport` |
|
|
58
|
+
| 执行日志保留策略 | `readExecutionLogSettings` / `writeExecutionLogSettings` / `DEFAULT_EXECUTION_LOG_SETTINGS` |
|
|
59
|
+
| 接口集合 | `listApiCollectionRecords` / `deleteApiCollection` / `clearApiCollections`(同时更新内存中的接口列表) |
|
|
60
|
+
|
|
61
|
+
这一层不负责通知已挂载的视图面板。宿主清理数据请用 `@arronqzy/abuilder` / `@arronqzy/abuilder-vue` 导出的同名函数,删除蓝图库后面板会自动刷新。
|
|
62
|
+
|
|
50
63
|
## 和 React 版
|
|
51
64
|
|
|
52
65
|
图数据结构(`BlueprintGraph`、文档同步)是独立 TypeScript 实现,形状与 `react-blueprint` 对齐,所以同一份蓝图 JSON 两边都能打开。画布实现不共享。长期可以抽一层 `blueprint-core`,目前还没有。
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -29,6 +29,8 @@ export {
|
|
|
29
29
|
getApiCollectionListItems,
|
|
30
30
|
upsertApiCollectionFromJson,
|
|
31
31
|
removeApiCollection,
|
|
32
|
+
deleteApiCollection,
|
|
33
|
+
clearApiCollections,
|
|
32
34
|
subscribeApiCollections,
|
|
33
35
|
useApiCollections,
|
|
34
36
|
useApiCollectionListItems,
|
|
@@ -42,7 +44,23 @@ export {
|
|
|
42
44
|
getApiCollectionRecord,
|
|
43
45
|
putApiCollectionRecord,
|
|
44
46
|
deleteApiCollectionRecord,
|
|
47
|
+
clearApiCollectionRecords,
|
|
45
48
|
} from "./library/api-collection-db";
|
|
49
|
+
export {
|
|
50
|
+
listExecutionRunRecords,
|
|
51
|
+
getExecutionRunRecord,
|
|
52
|
+
putExecutionRunRecord,
|
|
53
|
+
deleteExecutionRunRecord,
|
|
54
|
+
purgeExecutionRunsOlderThan,
|
|
55
|
+
clearAllExecutionRunRecords,
|
|
56
|
+
trimExecutionRunRecordsToMax,
|
|
57
|
+
downloadExecutionRunExport,
|
|
58
|
+
} from "./library/execution-log-db";
|
|
59
|
+
export {
|
|
60
|
+
DEFAULT_EXECUTION_LOG_SETTINGS,
|
|
61
|
+
readExecutionLogSettings,
|
|
62
|
+
writeExecutionLogSettings,
|
|
63
|
+
} from "./library/execution-log-settings";
|
|
46
64
|
export { default as BlueprintNodeSwitchTaskDialog } from "./components/BlueprintNodeSwitchTaskDialog.vue";
|
|
47
65
|
export type { BlueprintNodeSwitchTaskDialogProps } from "./components/BlueprintNodeSwitchTaskDialog.vue";
|
|
48
66
|
export type { ExecutionLogSettings } from "./library/execution-log-settings";
|
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
type ApiCollectionDocument,
|
|
7
7
|
type ApiCollectionListItem,
|
|
8
8
|
type ApiCollectionRecord,
|
|
9
|
+
normalizeAppNameSpace,
|
|
9
10
|
} from "@arronqzy/blueprint-dsl";
|
|
10
11
|
|
|
11
12
|
import {
|
|
13
|
+
clearApiCollectionRecords,
|
|
12
14
|
deleteApiCollectionRecord,
|
|
13
15
|
listApiCollectionRecords,
|
|
14
16
|
putApiCollectionRecord,
|
|
@@ -127,6 +129,34 @@ export async function removeApiCollection(id: string): Promise<void> {
|
|
|
127
129
|
emit();
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
function isCurrentNameSpace(nameSpace?: string | null): boolean {
|
|
133
|
+
return normalizeAppNameSpace(nameSpace) === normalizeAppNameSpace(nameSpaceRef);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 按 nameSpace 删除接口集合;若该 nameSpace 正在被编辑器使用,内存列表同步移除 */
|
|
137
|
+
export async function deleteApiCollection(
|
|
138
|
+
id: string,
|
|
139
|
+
nameSpace?: string | null
|
|
140
|
+
): Promise<void> {
|
|
141
|
+
await deleteApiCollectionRecord(id, nameSpace);
|
|
142
|
+
if (!isCurrentNameSpace(nameSpace)) return;
|
|
143
|
+
records = records.filter((item) => item.id !== id);
|
|
144
|
+
emit();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** 清空该 nameSpace 下的接口集合(含仅存内存的集合),返回删除数量 */
|
|
148
|
+
export async function clearApiCollections(nameSpace?: string | null): Promise<number> {
|
|
149
|
+
const persisted = await listApiCollectionRecords(nameSpace);
|
|
150
|
+
await clearApiCollectionRecords(nameSpace);
|
|
151
|
+
const removedIds = new Set(persisted.map((item) => item.id));
|
|
152
|
+
if (isCurrentNameSpace(nameSpace)) {
|
|
153
|
+
records.forEach((item) => removedIds.add(item.id));
|
|
154
|
+
records = [];
|
|
155
|
+
emit();
|
|
156
|
+
}
|
|
157
|
+
return removedIds.size;
|
|
158
|
+
}
|
|
159
|
+
|
|
130
160
|
/** Vue composable:返回响应式集合列表 */
|
|
131
161
|
export function useApiCollections(): Ref<ApiCollectionRecord[]> {
|
|
132
162
|
const list = ref<ApiCollectionRecord[]>([...records]);
|
|
@@ -124,3 +124,10 @@ export async function deleteBlueprintLibraryRecord(
|
|
|
124
124
|
): Promise<void> {
|
|
125
125
|
await runTransaction<undefined>("readwrite", (store) => store.delete(id), nameSpace);
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
/** 清空该 nameSpace 下的蓝图库,返回删除数量 */
|
|
129
|
+
export async function clearBlueprintLibrary(nameSpace?: string | null): Promise<number> {
|
|
130
|
+
const count = await runTransaction<number>("readonly", (store) => store.count(), nameSpace);
|
|
131
|
+
await runTransaction<undefined>("readwrite", (store) => store.clear(), nameSpace);
|
|
132
|
+
return count;
|
|
133
|
+
}
|