@yuku123/z-cognition-component 1.0.1 → 1.0.3
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/{ConceptsPage-C8nsSzRc.js → ConceptsPage-CLEcHolu.js} +11 -10
- package/dist/{ConceptsPage-BH4lEiVn.cjs → ConceptsPage-DfloraCZ.cjs} +1 -1
- package/dist/OntologyDetailPage-BIZLIZ23.js +192 -0
- package/dist/OntologyDetailPage-CEGX8Ykd.cjs +1 -0
- package/dist/OntologyInferPage-BhHrVjSM.js +114 -0
- package/dist/OntologyInferPage-Bzgd_iDk.cjs +4 -0
- package/dist/OntologyListPage-ClYfQsCI.cjs +1 -0
- package/dist/OntologyListPage-DJnVZ_19.js +118 -0
- package/dist/OntologyMaterializePage-CjrmDG7j.cjs +4 -0
- package/dist/OntologyMaterializePage-DxxtArEt.js +128 -0
- package/dist/OntologyNodesPage-CiGsZLSG.js +270 -0
- package/dist/OntologyNodesPage-Do8cnOwY.cjs +1 -0
- package/dist/OntologyValidatePage-Dqzp4hWg.cjs +4 -0
- package/dist/OntologyValidatePage-WX4sAfzY.js +136 -0
- package/dist/{TermDetailPage-BiF5UVM5.js → TermDetailPage-CPPzVMdp.js} +20 -20
- package/dist/{TermDetailPage-DQcYkPdm.cjs → TermDetailPage-Dbl2_C80.cjs} +1 -1
- package/dist/api-BVrIcAFp.js +67 -0
- package/dist/api-D5Hgcud4.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/ontology-graph.cjs +1 -0
- package/dist/ontology-graph.js +50 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +37 -19
- package/dist/use-g6-graph-2-Pr4oTs.js +1086 -0
- package/dist/use-g6-graph-B9K6IPJe.cjs +3 -0
- package/dist/z-cognition-component.css +1 -0
- package/package.json +9 -1
|
@@ -2,15 +2,15 @@ import { jsx as e, jsxs as o, Fragment as te } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as a, useCallback as ie, useEffect as ne } from "react";
|
|
3
3
|
import { useSearchParams as le, useNavigate as re } from "react-router-dom";
|
|
4
4
|
import { Input as d, Form as l, Alert as D, Spin as ae, Space as F, Button as p, Select as g, Descriptions as s, Typography as f, Tag as z, Table as x, Popconfirm as se, Modal as L, message as m } from "antd";
|
|
5
|
-
import { ArrowLeftOutlined as oe, ReloadOutlined as de, EditOutlined as ce, DiffOutlined as me
|
|
5
|
+
import { ArrowLeftOutlined as oe, ReloadOutlined as de, EditOutlined as ce, DiffOutlined as me } from "@ant-design/icons";
|
|
6
6
|
import { cognitionApi as u } from "./api.js";
|
|
7
|
-
import { S as
|
|
8
|
-
const { TextArea:
|
|
9
|
-
function
|
|
10
|
-
const [P] = le(), q = re(), r = P.get("key") || "", [i, j] = a(null), [S, H] = a([]), [E, _] = a([]), [M, $] = a(!0), [
|
|
7
|
+
import { S as ue, T as he, a as pe, t as fe } from "./EvidenceFormList-097ICr7D.js";
|
|
8
|
+
const { TextArea: ge } = d;
|
|
9
|
+
function Se() {
|
|
10
|
+
const [P] = le(), q = re(), r = P.get("key") || "", [i, j] = a(null), [S, H] = a([]), [E, _] = a([]), [M, $] = a(!0), [k, O] = a(""), [U, y] = a(!1), [V, C] = a(!1), [w] = l.useForm(), [v, A] = a(null), [I, N] = a(null), [G, K] = a(!1), [c, J] = a(null), h = ie(async () => {
|
|
11
11
|
var t, n;
|
|
12
12
|
if (r) {
|
|
13
|
-
$(!0),
|
|
13
|
+
$(!0), O("");
|
|
14
14
|
try {
|
|
15
15
|
const [b, Z, T] = await Promise.all([
|
|
16
16
|
u.getTerm(r),
|
|
@@ -21,7 +21,7 @@ function Ee() {
|
|
|
21
21
|
const B = (t = (T || [])[0]) == null ? void 0 : t.revisionNo, ee = (n = (T || [])[1]) == null ? void 0 : n.revisionNo;
|
|
22
22
|
N(B ?? null), A(ee ?? B ?? null);
|
|
23
23
|
} catch (b) {
|
|
24
|
-
|
|
24
|
+
O(b.message);
|
|
25
25
|
} finally {
|
|
26
26
|
$(!1);
|
|
27
27
|
}
|
|
@@ -35,7 +35,7 @@ function Ee() {
|
|
|
35
35
|
w.setFieldsValue({
|
|
36
36
|
...i,
|
|
37
37
|
aliases: i.aliases || [],
|
|
38
|
-
evidences:
|
|
38
|
+
evidences: fe(S)
|
|
39
39
|
}), y(!0);
|
|
40
40
|
}, W = async () => {
|
|
41
41
|
const t = await w.validateFields();
|
|
@@ -64,11 +64,11 @@ function Ee() {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
|
-
J(await u.diffTerm(r, v, I)),
|
|
67
|
+
J(await u.diffTerm(r, v, I)), K(!0);
|
|
68
68
|
} catch (t) {
|
|
69
69
|
m.error(t.message);
|
|
70
70
|
}
|
|
71
|
-
},
|
|
71
|
+
}, R = E.map((t) => ({
|
|
72
72
|
value: t.revisionNo,
|
|
73
73
|
label: `r${t.revisionNo} · ${t.createdAt} · ${t.actor || "-"} · ${t.note || ""}`
|
|
74
74
|
}));
|
|
@@ -77,17 +77,17 @@ function Ee() {
|
|
|
77
77
|
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(oe, {}), onClick: () => q("/cognition/terms"), children: "返回列表" }),
|
|
78
78
|
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(de, {}), onClick: h, children: "刷新" }),
|
|
79
79
|
/* @__PURE__ */ e(p, { type: "primary", icon: /* @__PURE__ */ e(ce, {}), disabled: !i, onClick: Q, children: "编辑(生成新版本)" }),
|
|
80
|
-
/* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "left", value: v, onChange: A, options:
|
|
81
|
-
/* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "right", value: I, onChange: N, options:
|
|
80
|
+
/* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "left", value: v, onChange: A, options: R }),
|
|
81
|
+
/* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "right", value: I, onChange: N, options: R }),
|
|
82
82
|
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(me, {}), onClick: Y, children: "版本对比" })
|
|
83
83
|
] }),
|
|
84
|
-
|
|
84
|
+
k ? /* @__PURE__ */ e(D, { type: "error", showIcon: !0, message: k, style: { marginBottom: 16 } }) : null,
|
|
85
85
|
i ? /* @__PURE__ */ o(te, { children: [
|
|
86
86
|
/* @__PURE__ */ o(s, { bordered: !0, size: "small", column: 2, style: { marginBottom: 16 }, children: [
|
|
87
87
|
/* @__PURE__ */ e(s.Item, { label: "termKey", children: /* @__PURE__ */ e(f.Text, { code: !0, children: i.termKey }) }),
|
|
88
88
|
/* @__PURE__ */ e(s.Item, { label: "规范名", children: i.canonical }),
|
|
89
89
|
/* @__PURE__ */ o(s.Item, { label: "状态", children: [
|
|
90
|
-
/* @__PURE__ */ e(z, { color:
|
|
90
|
+
/* @__PURE__ */ e(z, { color: ue[i.status] || "blue", children: i.status }),
|
|
91
91
|
i.supersededBy ? /* @__PURE__ */ o("span", { children: [
|
|
92
92
|
"→ ",
|
|
93
93
|
i.supersededBy
|
|
@@ -148,7 +148,7 @@ function Ee() {
|
|
|
148
148
|
title: `回滚到 r${n.revisionNo}?`,
|
|
149
149
|
description: "会以该版本内容生成一条新的 revision",
|
|
150
150
|
onConfirm: () => X(n.revisionNo),
|
|
151
|
-
children: /* @__PURE__ */ e(p, {
|
|
151
|
+
children: /* @__PURE__ */ e(p, { type: "link", size: "small", children: "回滚" })
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
154
|
}
|
|
@@ -169,7 +169,7 @@ function Ee() {
|
|
|
169
169
|
children: /* @__PURE__ */ o(l, { form: w, layout: "vertical", children: [
|
|
170
170
|
/* @__PURE__ */ o(F, { size: "large", wrap: !0, children: [
|
|
171
171
|
/* @__PURE__ */ e(l.Item, { name: "canonical", label: "规范名", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(d, { style: { width: 240 } }) }),
|
|
172
|
-
/* @__PURE__ */ e(l.Item, { name: "status", label: "状态", rules: [{ required: !0 }], children: /* @__PURE__ */ e(g, { style: { width: 140 }, options:
|
|
172
|
+
/* @__PURE__ */ e(l.Item, { name: "status", label: "状态", rules: [{ required: !0 }], children: /* @__PURE__ */ e(g, { style: { width: 140 }, options: he.map((t) => ({ value: t, label: t })) }) }),
|
|
173
173
|
/* @__PURE__ */ e(l.Item, { name: "supersededBy", label: "替代项(DEPRECATED 必填)", children: /* @__PURE__ */ e(d, { style: { width: 180 } }) }),
|
|
174
174
|
/* @__PURE__ */ e(l.Item, { name: "domain", label: "域", children: /* @__PURE__ */ e(d, { style: { width: 140 } }) }),
|
|
175
175
|
/* @__PURE__ */ e(l.Item, { name: "owner", label: "owner", children: /* @__PURE__ */ e(d, { style: { width: 140 } }) })
|
|
@@ -182,11 +182,11 @@ function Ee() {
|
|
|
182
182
|
name: "definition",
|
|
183
183
|
label: "定义",
|
|
184
184
|
rules: [{ required: !0, message: "必填" }],
|
|
185
|
-
children: /* @__PURE__ */ e(
|
|
185
|
+
children: /* @__PURE__ */ e(ge, { rows: 3 })
|
|
186
186
|
}
|
|
187
187
|
),
|
|
188
188
|
/* @__PURE__ */ e(l.Item, { name: "note", label: "变更说明", children: /* @__PURE__ */ e(d, { placeholder: "console update" }) }),
|
|
189
|
-
/* @__PURE__ */ e(l.Item, { label: "证据(至少一条;本次提交即本版本证据)", required: !0, children: /* @__PURE__ */ e(
|
|
189
|
+
/* @__PURE__ */ e(l.Item, { label: "证据(至少一条;本次提交即本版本证据)", required: !0, children: /* @__PURE__ */ e(pe, {}) })
|
|
190
190
|
] })
|
|
191
191
|
}
|
|
192
192
|
),
|
|
@@ -195,7 +195,7 @@ function Ee() {
|
|
|
195
195
|
{
|
|
196
196
|
title: c ? `${c.subjectKey}: r${c.leftRevision} → r${c.rightRevision}` : "版本对比",
|
|
197
197
|
open: G,
|
|
198
|
-
onCancel: () =>
|
|
198
|
+
onCancel: () => K(!1),
|
|
199
199
|
footer: null,
|
|
200
200
|
width: 720,
|
|
201
201
|
children: /* @__PURE__ */ e(
|
|
@@ -217,5 +217,5 @@ function Ee() {
|
|
|
217
217
|
] });
|
|
218
218
|
}
|
|
219
219
|
export {
|
|
220
|
-
|
|
220
|
+
Se as default
|
|
221
221
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),o=require("./api.cjs"),u=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:V}=t.Input;function G(){const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),o=require("./api.cjs"),u=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:V}=t.Input;function G(){const[$]=E.useSearchParams(),O=E.useNavigate(),l=$.get("key")||"",[i,k]=n.useState(null),[y,B]=n.useState([]),[f,C]=n.useState([]),[R,I]=n.useState(!0),[v,w]=n.useState(""),[q,m]=n.useState(!1),[N,b]=n.useState(!1),[h]=t.Form.useForm(),[p,T]=n.useState(null),[x,S]=n.useState(null),[K,D]=n.useState(!1),[a,L]=n.useState(null),c=n.useCallback(async()=>{var s,r;if(l){I(!0),w("");try{const[j,_,g]=await Promise.all([o.cognitionApi.getTerm(l),o.cognitionApi.listTermEvidence(l),o.cognitionApi.listTermRevisions(l)]);k(j),B(_||[]),C(g||[]);const A=(s=(g||[])[0])==null?void 0:s.revisionNo,U=(r=(g||[])[1])==null?void 0:r.revisionNo;S(A??null),T(U??A??null)}catch(j){w(j.message)}finally{I(!1)}}},[l]);if(n.useEffect(()=>{c()},[c]),!l)return e.jsx(t.Alert,{type:"warning",showIcon:!0,message:"缺少 ?key= 参数"});const z=()=>{h.setFieldsValue({...i,aliases:i.aliases||[],evidences:u.toEvidenceFormValues(y)}),m(!0)},P=async()=>{const s=await h.validateFields();b(!0);try{await o.cognitionApi.updateTerm(l,{...s,termKey:l,actor:s.actor||"console",note:s.note||"console update"}),t.message.success("已生成新 revision"),m(!1),await c()}catch(r){t.message.error(r.field?`${r.field}: ${r.message}`:r.message)}finally{b(!1)}},M=async s=>{try{await o.cognitionApi.rollbackTerm(l,s,`console rollback to r${s}`),t.message.success(`已回滚到 r${s}(生成新 revision,历史不改写)`),await c()}catch(r){t.message.error(r.message)}},H=async()=>{if(p==null||x==null){t.message.warning("先选两个 revision");return}try{L(await o.cognitionApi.diffTerm(l,p,x)),D(!0)}catch(s){t.message.error(s.message)}},F=f.map(s=>({value:s.revisionNo,label:`r${s.revisionNo} · ${s.createdAt} · ${s.actor||"-"} · ${s.note||""}`}));return e.jsxs(t.Spin,{spinning:R,children:[e.jsxs(t.Space,{style:{marginBottom:16},wrap:!0,children:[e.jsx(t.Button,{icon:e.jsx(d.ArrowLeftOutlined,{}),onClick:()=>O("/cognition/terms"),children:"返回列表"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:c,children:"刷新"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.EditOutlined,{}),disabled:!i,onClick:z,children:"编辑(生成新版本)"}),e.jsx(t.Select,{style:{width:300},placeholder:"left",value:p,onChange:T,options:F}),e.jsx(t.Select,{style:{width:300},placeholder:"right",value:x,onChange:S,options:F}),e.jsx(t.Button,{icon:e.jsx(d.DiffOutlined,{}),onClick:H,children:"版本对比"})]}),v?e.jsx(t.Alert,{type:"error",showIcon:!0,message:v,style:{marginBottom:16}}):null,i?e.jsxs(e.Fragment,{children:[e.jsxs(t.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(t.Descriptions.Item,{label:"termKey",children:e.jsx(t.Typography.Text,{code:!0,children:i.termKey})}),e.jsx(t.Descriptions.Item,{label:"规范名",children:i.canonical}),e.jsxs(t.Descriptions.Item,{label:"状态",children:[e.jsx(t.Tag,{color:u.STATUS_COLOR[i.status]||"blue",children:i.status}),i.supersededBy?e.jsxs("span",{children:["→ ",i.supersededBy]}):null]}),e.jsxs(t.Descriptions.Item,{label:"当前版本",children:["r",i.revisionNo]}),e.jsx(t.Descriptions.Item,{label:"域",children:i.domain||"—"}),e.jsx(t.Descriptions.Item,{label:"owner",children:i.owner||"—"}),e.jsx(t.Descriptions.Item,{label:"绑定概念",children:i.conceptKey||"—"}),e.jsx(t.Descriptions.Item,{label:"更新时间",children:i.updatedAt}),e.jsx(t.Descriptions.Item,{label:"别名",span:2,children:(i.aliases||[]).length?i.aliases.map(s=>e.jsx(t.Tag,{children:s},s)):"—"}),e.jsx(t.Descriptions.Item,{label:"定义",span:2,children:i.definition})]}),e.jsxs(t.Typography.Title,{level:5,children:["证据(当前版本 r",i.revisionNo,")"]}),e.jsx(t.Table,{rowKey:"id",size:"small",style:{marginBottom:24},dataSource:y,pagination:!1,columns:[{title:"类型",dataIndex:"evidenceType",width:140},{title:"refId",dataIndex:"refId"},{title:"snapshotHash",dataIndex:"snapshotHash",width:200},{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"采集时间",dataIndex:"capturedAt",width:190}]}),e.jsx(t.Typography.Title,{level:5,children:"版本历史(回滚不改写历史,只追加新 revision)"}),e.jsx(t.Table,{rowKey:"revisionNo",size:"small",dataSource:f,pagination:!1,columns:[{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"时间",dataIndex:"createdAt",width:190},{title:"操作人",dataIndex:"actor",width:140},{title:"说明",dataIndex:"note"},{title:"操作",width:120,render:(s,r)=>e.jsx(t.Popconfirm,{title:`回滚到 r${r.revisionNo}?`,description:"会以该版本内容生成一条新的 revision",onConfirm:()=>M(r.revisionNo),children:e.jsx(t.Button,{type:"link",size:"small",children:"回滚"})})}]})]}):null,e.jsx(t.Modal,{title:`编辑 ${l}`,open:q,onCancel:()=>m(!1),onOk:P,confirmLoading:N,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:h,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:240}})}),e.jsx(t.Form.Item,{name:"status",label:"状态",rules:[{required:!0}],children:e.jsx(t.Select,{style:{width:140},options:u.TERM_STATUSES.map(s=>({value:s,label:s}))})}),e.jsx(t.Form.Item,{name:"supersededBy",label:"替代项(DEPRECATED 必填)",children:e.jsx(t.Input,{style:{width:180}})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140}})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念",children:e.jsx(t.Input,{})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(V,{rows:3})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console update"})}),e.jsx(t.Form.Item,{label:"证据(至少一条;本次提交即本版本证据)",required:!0,children:e.jsx(u.EvidenceFormList,{})})]})}),e.jsx(t.Modal,{title:a?`${a.subjectKey}: r${a.leftRevision} → r${a.rightRevision}`:"版本对比",open:K,onCancel:()=>D(!1),footer:null,width:720,children:e.jsx(t.Table,{rowKey:s=>s.field,size:"small",pagination:!1,dataSource:a?a.changes:[],columns:[{title:"字段",dataIndex:"field",width:140},{title:"左",dataIndex:"left",render:s=>e.jsx(t.Typography.Text,{delete:s!=="",children:s??"—"})},{title:"右",dataIndex:"right",render:s=>e.jsx(t.Typography.Text,{strong:!0,children:s??"—"})}]})})]})}exports.default=G;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const $ = "/api/ontology", d = "token", T = "z_ctc_token";
|
|
2
|
+
class f extends Error {
|
|
3
|
+
constructor(t, n) {
|
|
4
|
+
super(n && (n.message || n.error) ? n.message || n.error : `HTTP ${t}`), this.status = t, this.body = n;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function h() {
|
|
8
|
+
try {
|
|
9
|
+
return localStorage.getItem(d) || localStorage.getItem(T) || "";
|
|
10
|
+
} catch {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function s(e, t, n) {
|
|
15
|
+
const i = { Accept: "application/json" };
|
|
16
|
+
n !== void 0 && (i["Content-Type"] = "application/json");
|
|
17
|
+
const o = h();
|
|
18
|
+
o && (i.Authorization = `Bearer ${o}`);
|
|
19
|
+
const l = await fetch(`${$}${t}`, {
|
|
20
|
+
method: e,
|
|
21
|
+
headers: i,
|
|
22
|
+
body: n === void 0 ? void 0 : JSON.stringify(n)
|
|
23
|
+
}), u = await l.text();
|
|
24
|
+
let c = null;
|
|
25
|
+
if (u)
|
|
26
|
+
try {
|
|
27
|
+
c = JSON.parse(u);
|
|
28
|
+
} catch {
|
|
29
|
+
c = { error: u };
|
|
30
|
+
}
|
|
31
|
+
if (!l.ok) throw new f(l.status, c);
|
|
32
|
+
return c;
|
|
33
|
+
}
|
|
34
|
+
const r = (e) => {
|
|
35
|
+
const t = Object.entries(e || {}).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(i)}`);
|
|
36
|
+
return t.length ? `?${t.join("&")}` : "";
|
|
37
|
+
}, a = encodeURIComponent;
|
|
38
|
+
function p(e, t, n) {
|
|
39
|
+
if (!e) return;
|
|
40
|
+
const i = n || t.replace(/[A-Z]/g, (o) => "_" + o.toLowerCase());
|
|
41
|
+
return e[t] !== void 0 ? e[t] : e[i];
|
|
42
|
+
}
|
|
43
|
+
const E = {
|
|
44
|
+
// --- schema 管理 ---
|
|
45
|
+
listSchemas: () => s("GET", "/schemas"),
|
|
46
|
+
getSchema: (e) => s("GET", `/schemas/${a(e)}`),
|
|
47
|
+
registerSchema: (e) => s("POST", "/schemas", e),
|
|
48
|
+
deleteSchema: (e) => s("DELETE", `/schemas/${a(e)}`),
|
|
49
|
+
// --- 运行时 / 图查询 ---
|
|
50
|
+
listSources: () => s("GET", "/sources"),
|
|
51
|
+
listClasses: (e, t) => s("GET", `/${a(e)}/classes${r({ workspace: t })}`),
|
|
52
|
+
listIndividuals: (e, t) => s("GET", `/${a(e)}/individuals${r({ workspace: t })}`),
|
|
53
|
+
listInstances: (e, t, n) => s("GET", `/${a(e)}/instances${r({ className: t, workspace: n })}`),
|
|
54
|
+
listNeighbors: (e, t, n, i) => s("GET", `/${a(e)}/neighbors${r({ key: t, depth: n, workspace: i })}`),
|
|
55
|
+
subgraph: (e, t, n, i) => s("GET", `/${a(e)}/subgraph${r({ keys: t, depth: n, workspace: i })}`),
|
|
56
|
+
stats: (e, t) => s("GET", `/${a(e)}/stats${r({ workspace: t })}`),
|
|
57
|
+
// --- 校验 / 推理 / 物化 ---
|
|
58
|
+
validate: (e, t) => s("POST", `/${a(e)}/validate`, t),
|
|
59
|
+
validateSource: (e, t, n) => s("GET", `/${a(e)}/validate-source${r({ source: t, workspace: n })}`),
|
|
60
|
+
infer: (e, t) => s("POST", `/${a(e)}/infer`, t),
|
|
61
|
+
materialize: (e, t, n) => s("POST", `/${a(e)}/materialize${r({ source: t, workspace: n })}`),
|
|
62
|
+
materializeInline: (e, t, n) => s("POST", `/${a(e)}/materialize-inline${r({ workspace: n })}`, t)
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
p as f,
|
|
66
|
+
E as o
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const $="/api/ontology",d="token",T="z_ctc_token";class f extends Error{constructor(t,n){super(n&&(n.message||n.error)?n.message||n.error:`HTTP ${t}`),this.status=t,this.body=n}}function h(){try{return localStorage.getItem(d)||localStorage.getItem(T)||""}catch{return""}}async function s(e,t,n){const r={Accept:"application/json"};n!==void 0&&(r["Content-Type"]="application/json");const o=h();o&&(r.Authorization=`Bearer ${o}`);const l=await fetch(`${$}${t}`,{method:e,headers:r,body:n===void 0?void 0:JSON.stringify(n)}),u=await l.text();let c=null;if(u)try{c=JSON.parse(u)}catch{c={error:u}}if(!l.ok)throw new f(l.status,c);return c}const a=e=>{const t=Object.entries(e||{}).filter(([,n])=>n!=null&&n!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(r)}`);return t.length?`?${t.join("&")}`:""},i=encodeURIComponent;function p(e,t,n){if(!e)return;const r=n||t.replace(/[A-Z]/g,o=>"_"+o.toLowerCase());return e[t]!==void 0?e[t]:e[r]}const E={listSchemas:()=>s("GET","/schemas"),getSchema:e=>s("GET",`/schemas/${i(e)}`),registerSchema:e=>s("POST","/schemas",e),deleteSchema:e=>s("DELETE",`/schemas/${i(e)}`),listSources:()=>s("GET","/sources"),listClasses:(e,t)=>s("GET",`/${i(e)}/classes${a({workspace:t})}`),listIndividuals:(e,t)=>s("GET",`/${i(e)}/individuals${a({workspace:t})}`),listInstances:(e,t,n)=>s("GET",`/${i(e)}/instances${a({className:t,workspace:n})}`),listNeighbors:(e,t,n,r)=>s("GET",`/${i(e)}/neighbors${a({key:t,depth:n,workspace:r})}`),subgraph:(e,t,n,r)=>s("GET",`/${i(e)}/subgraph${a({keys:t,depth:n,workspace:r})}`),stats:(e,t)=>s("GET",`/${i(e)}/stats${a({workspace:t})}`),validate:(e,t)=>s("POST",`/${i(e)}/validate`,t),validateSource:(e,t,n)=>s("GET",`/${i(e)}/validate-source${a({source:t,workspace:n})}`),infer:(e,t)=>s("POST",`/${i(e)}/infer`,t),materialize:(e,t,n)=>s("POST",`/${i(e)}/materialize${a({source:t,workspace:n})}`),materializeInline:(e,t,n)=>s("POST",`/${i(e)}/materialize-inline${a({workspace:n})}`,t)};exports.field=p;exports.ontologyApi=E;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./api.cjs"),t=require("./EvidenceFormList-CQNgMNCG.cjs"),r=require("./TermsPage-CE3E3fG-.cjs"),T=require("./TermDetailPage-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./api.cjs"),t=require("./EvidenceFormList-CQNgMNCG.cjs"),r=require("./TermsPage-CE3E3fG-.cjs"),T=require("./TermDetailPage-Dbl2_C80.cjs"),o=require("./ConceptsPage-DfloraCZ.cjs"),E=require("./ResolvePage-BDb56PdI.cjs"),a=require("./ImpactPage-BMvZUgTJ.cjs"),i=require("./DocsPage-CmGTg0A3.cjs");exports.ApiError=e.ApiError;exports.TOKEN_KEY=e.TOKEN_KEY;exports.cognitionApi=e.cognitionApi;exports.getToken=e.getToken;exports.setToken=e.setToken;exports.CONCEPT_TYPES=t.CONCEPT_TYPES;exports.EVIDENCE_TYPES=t.EVIDENCE_TYPES;exports.KEY_PATTERN=t.KEY_PATTERN;exports.STATUS_COLOR=t.STATUS_COLOR;exports.TERM_STATUSES=t.TERM_STATUSES;exports.TermsPage=r.default;exports.TermDetailPage=T.default;exports.ConceptsPage=o.default;exports.ResolvePage=E.default;exports.ImpactPage=a.default;exports.DocsPage=i.default;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ApiError as o, TOKEN_KEY as r, cognitionApi as t, getToken as s, setToken as T } from "./api.js";
|
|
2
2
|
import { C as E, E as p, K as m, S as P, T as g } from "./EvidenceFormList-097ICr7D.js";
|
|
3
3
|
import { default as x } from "./TermsPage-BJWfX1hw.js";
|
|
4
|
-
import { default as d } from "./TermDetailPage-
|
|
5
|
-
import { default as C } from "./ConceptsPage-
|
|
4
|
+
import { default as d } from "./TermDetailPage-CPPzVMdp.js";
|
|
5
|
+
import { default as C } from "./ConceptsPage-CLEcHolu.js";
|
|
6
6
|
import { default as i } from "./ResolvePage-CmrRVFkA.js";
|
|
7
7
|
import { default as A } from "./ImpactPage-BiajQqHA.js";
|
|
8
8
|
import { default as K } from "./DocsPage-DNkkd9Sm.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./use-g6-graph-B9K6IPJe.cjs"),h=1,m=3;function E(o){return Number.isFinite(o)?Math.min(m,Math.max(h,Math.round(o))):h}function _(o,t,c){return`${t}|${o}|${c}`}function d({roots:o,hops:t,direction:c,edges:u}){if(!o.length)return{tags:[],edgeKeys:[]};const e=new Set(o),T=E(t);let s=new Set(o);for(let n=0;n<T;n+=1){const i=new Set;if(u.forEach(r=>{if(!r.srcTag||!r.dstTag)return;const O=(c==="out"||c==="both")&&s.has(r.srcTag),f=(c==="in"||c==="both")&&s.has(r.dstTag);!O&&!f||(O&&!e.has(r.dstTag)&&(e.add(r.dstTag),i.add(r.dstTag)),f&&!e.has(r.srcTag)&&(e.add(r.srcTag),i.add(r.srcTag)))}),!i.size)break;s=i}const S=new Set;return u.forEach(n=>{!n.srcTag||!n.dstTag||e.has(n.srcTag)&&e.has(n.dstTag)&&S.add(_(n.edgeName,n.srcTag,n.dstTag))}),{tags:[...e].sort(),edgeKeys:[...S].sort()}}function g(o,t){const c=Math.min(t.x1,t.x2),u=Math.max(t.x1,t.x2),e=Math.min(t.y1,t.y2),T=Math.max(t.y1,t.y2);return Object.entries(o).filter(([,s])=>s.x>=c&&s.x<=u&&s.y>=e&&s.y<=T).map(([s])=>s).sort()}exports.GRAPH_BEHAVIORS=a.GRAPH_BEHAVIORS;exports.NODE_FILL=a.NODE_FILL;exports.NODE_STROKE=a.NODE_STROKE;exports.STATE_STYLES=a.STATE_STYLES;exports.UNCATEGORIZED_CAT_CODE=a.UNCATEGORIZED_CAT_CODE;exports.buildCategoryColorMap=a.buildCategoryColorMap;exports.computeForceLayout=a.computeForceLayout;exports.createLiveSimulation=a.createLiveSimulation;exports.toG6Data=a.toG6Data;exports.toInstanceG6Data=a.toInstanceG6Data;exports.useG6Graph=a.useG6Graph;exports.FOCUS_HOPS_MAX=m;exports.FOCUS_HOPS_MIN=h;exports.clampHops=E;exports.computeFocusNeighborhood=d;exports.edgeKeyOf=_;exports.nodesInRect=g;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { G as b, N as M, a as _, S as l, U as p, b as N, c as C, d as G, t as w, e as A, u as D } from "./use-g6-graph-2-Pr4oTs.js";
|
|
2
|
+
const m = 1, S = 3;
|
|
3
|
+
function d(t) {
|
|
4
|
+
return Number.isFinite(t) ? Math.min(S, Math.max(m, Math.round(t))) : m;
|
|
5
|
+
}
|
|
6
|
+
function g(t, a, c) {
|
|
7
|
+
return `${a}|${t}|${c}`;
|
|
8
|
+
}
|
|
9
|
+
function x({ roots: t, hops: a, direction: c, edges: u }) {
|
|
10
|
+
if (!t.length)
|
|
11
|
+
return { tags: [], edgeKeys: [] };
|
|
12
|
+
const r = new Set(t), h = d(a);
|
|
13
|
+
let s = new Set(t);
|
|
14
|
+
for (let n = 0; n < h; n += 1) {
|
|
15
|
+
const f = /* @__PURE__ */ new Set();
|
|
16
|
+
if (u.forEach((o) => {
|
|
17
|
+
if (!o.srcTag || !o.dstTag) return;
|
|
18
|
+
const i = (c === "out" || c === "both") && s.has(o.srcTag), e = (c === "in" || c === "both") && s.has(o.dstTag);
|
|
19
|
+
!i && !e || (i && !r.has(o.dstTag) && (r.add(o.dstTag), f.add(o.dstTag)), e && !r.has(o.srcTag) && (r.add(o.srcTag), f.add(o.srcTag)));
|
|
20
|
+
}), !f.size) break;
|
|
21
|
+
s = f;
|
|
22
|
+
}
|
|
23
|
+
const T = /* @__PURE__ */ new Set();
|
|
24
|
+
return u.forEach((n) => {
|
|
25
|
+
!n.srcTag || !n.dstTag || r.has(n.srcTag) && r.has(n.dstTag) && T.add(g(n.edgeName, n.srcTag, n.dstTag));
|
|
26
|
+
}), { tags: [...r].sort(), edgeKeys: [...T].sort() };
|
|
27
|
+
}
|
|
28
|
+
function y(t, a) {
|
|
29
|
+
const c = Math.min(a.x1, a.x2), u = Math.max(a.x1, a.x2), r = Math.min(a.y1, a.y2), h = Math.max(a.y1, a.y2);
|
|
30
|
+
return Object.entries(t).filter(([, s]) => s.x >= c && s.x <= u && s.y >= r && s.y <= h).map(([s]) => s).sort();
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
S as FOCUS_HOPS_MAX,
|
|
34
|
+
m as FOCUS_HOPS_MIN,
|
|
35
|
+
b as GRAPH_BEHAVIORS,
|
|
36
|
+
M as NODE_FILL,
|
|
37
|
+
_ as NODE_STROKE,
|
|
38
|
+
l as STATE_STYLES,
|
|
39
|
+
p as UNCATEGORIZED_CAT_CODE,
|
|
40
|
+
N as buildCategoryColorMap,
|
|
41
|
+
d as clampHops,
|
|
42
|
+
x as computeFocusNeighborhood,
|
|
43
|
+
C as computeForceLayout,
|
|
44
|
+
G as createLiveSimulation,
|
|
45
|
+
g as edgeKeyOf,
|
|
46
|
+
y as nodesInRect,
|
|
47
|
+
w as toG6Data,
|
|
48
|
+
A as toInstanceG6Data,
|
|
49
|
+
D as useG6Graph
|
|
50
|
+
};
|
package/dist/pages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),o=require("@ant-design/icons"),s=t.lazy(()=>Promise.resolve().then(()=>require("./TermsPage-CE3E3fG-.cjs"))),l=t.lazy(()=>Promise.resolve().then(()=>require("./TermDetailPage-Dbl2_C80.cjs"))),a=t.lazy(()=>Promise.resolve().then(()=>require("./ConceptsPage-DfloraCZ.cjs"))),r=t.lazy(()=>Promise.resolve().then(()=>require("./ResolvePage-BDb56PdI.cjs"))),c=t.lazy(()=>Promise.resolve().then(()=>require("./ImpactPage-BMvZUgTJ.cjs"))),m=t.lazy(()=>Promise.resolve().then(()=>require("./DocsPage-CmGTg0A3.cjs"))),g=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyListPage-ClYfQsCI.cjs"))),y=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyDetailPage-CEGX8Ykd.cjs"))),u=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyNodesPage-Do8cnOwY.cjs"))),d=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyValidatePage-Dqzp4hWg.cjs"))),p=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyInferPage-Bzgd_iDk.cjs"))),h=t.lazy(()=>Promise.resolve().then(()=>require("./OntologyMaterializePage-CjrmDG7j.cjs"))),P={title:"z-cognition 业务认知域",short:"z-cognition"},n=[{key:"/ontology/schemas",label:"本体列表",icon:e.jsx(o.ApartmentOutlined,{}),desc:"注册 / 查询 / 删除 schema"},{key:"/ontology/detail",label:"本体详情",icon:e.jsx(o.ReadOutlined,{}),desc:"类定义 / 属性 / 统计"},{key:"/ontology/nodes",label:"类与实例",icon:e.jsx(o.PartitionOutlined,{}),desc:"图侧节点浏览"},{key:"/ontology/validate",label:"校验",icon:e.jsx(o.CheckCircleOutlined,{}),desc:"来源 / 快照两套口径"},{key:"/ontology/infer",label:"推理",icon:e.jsx(o.ThunderboltOutlined,{}),desc:"隐含类型与陈述"},{key:"/ontology/materialize",label:"物化",icon:e.jsx(o.DatabaseOutlined,{}),desc:"落成图节点与边"}],i=[{key:"/cognition/terms",label:"术语",icon:e.jsx(o.TagsOutlined,{}),desc:"登记 / 版本 / 回滚"},{key:"/cognition/concepts",label:"概念",icon:e.jsx(o.PartitionOutlined,{}),desc:"六类概念与父子关系"},{key:"/cognition/resolve",label:"消歧",icon:e.jsx(o.SearchOutlined,{}),desc:"词 → 术语 + 证据"},{key:"/cognition/impact",label:"影响面",icon:e.jsx(o.BranchesOutlined,{}),desc:"改之前先看谁引用"},{key:"/cognition/docs",label:"说明",icon:e.jsx(o.ReadOutlined,{}),desc:"能力与 API 清单"}],O=[{title:"本体管理",icon:e.jsx(o.ApartmentOutlined,{}),items:n},{title:"业务认知",icon:e.jsx(o.BulbOutlined,{}),items:i}],v=[{path:"/cognition/terms",Component:s},{path:"/cognition/terms/detail",Component:l},{path:"/cognition/concepts",Component:a},{path:"/cognition/resolve",Component:r},{path:"/cognition/impact",Component:c},{path:"/cognition/docs",Component:m},{path:"/ontology/schemas",Component:g},{path:"/ontology/detail",Component:y},{path:"/ontology/nodes",Component:u},{path:"/ontology/validate",Component:d},{path:"/ontology/infer",Component:p},{path:"/ontology/materialize",Component:h}];exports.appMeta=P;exports.menuItems=i;exports.menuSections=O;exports.ontologyMenuItems=n;exports.routes=v;
|
package/dist/pages.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { lazy as
|
|
3
|
-
import { TagsOutlined as
|
|
4
|
-
const
|
|
5
|
-
{ key: "/
|
|
6
|
-
{ key: "/
|
|
7
|
-
{ key: "/
|
|
8
|
-
{ key: "/
|
|
9
|
-
{ key: "/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
{
|
|
16
|
-
{
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { lazy as t } from "react";
|
|
3
|
+
import { TagsOutlined as c, PartitionOutlined as e, SearchOutlined as l, BranchesOutlined as a, ReadOutlined as n, ApartmentOutlined as i, BulbOutlined as s, CheckCircleOutlined as m, ThunderboltOutlined as p, DatabaseOutlined as g } from "@ant-design/icons";
|
|
4
|
+
const r = t(() => import("./TermsPage-BJWfX1hw.js")), d = t(() => import("./TermDetailPage-CPPzVMdp.js")), y = t(() => import("./ConceptsPage-CLEcHolu.js")), h = t(() => import("./ResolvePage-CmrRVFkA.js")), u = t(() => import("./ImpactPage-BiajQqHA.js")), O = t(() => import("./DocsPage-DNkkd9Sm.js")), C = t(() => import("./OntologyListPage-DJnVZ_19.js")), b = t(() => import("./OntologyDetailPage-BIZLIZ23.js")), P = t(() => import("./OntologyNodesPage-CiGsZLSG.js")), k = t(() => import("./OntologyValidatePage-WX4sAfzY.js")), f = t(() => import("./OntologyInferPage-BhHrVjSM.js")), z = t(() => import("./OntologyMaterializePage-DxxtArEt.js")), x = { title: "z-cognition 业务认知域", short: "z-cognition" }, v = [
|
|
5
|
+
{ key: "/ontology/schemas", label: "本体列表", icon: /* @__PURE__ */ o(i, {}), desc: "注册 / 查询 / 删除 schema" },
|
|
6
|
+
{ key: "/ontology/detail", label: "本体详情", icon: /* @__PURE__ */ o(n, {}), desc: "类定义 / 属性 / 统计" },
|
|
7
|
+
{ key: "/ontology/nodes", label: "类与实例", icon: /* @__PURE__ */ o(e, {}), desc: "图侧节点浏览" },
|
|
8
|
+
{ key: "/ontology/validate", label: "校验", icon: /* @__PURE__ */ o(m, {}), desc: "来源 / 快照两套口径" },
|
|
9
|
+
{ key: "/ontology/infer", label: "推理", icon: /* @__PURE__ */ o(p, {}), desc: "隐含类型与陈述" },
|
|
10
|
+
{ key: "/ontology/materialize", label: "物化", icon: /* @__PURE__ */ o(g, {}), desc: "落成图节点与边" }
|
|
11
|
+
], I = [
|
|
12
|
+
{ key: "/cognition/terms", label: "术语", icon: /* @__PURE__ */ o(c, {}), desc: "登记 / 版本 / 回滚" },
|
|
13
|
+
{ key: "/cognition/concepts", label: "概念", icon: /* @__PURE__ */ o(e, {}), desc: "六类概念与父子关系" },
|
|
14
|
+
{ key: "/cognition/resolve", label: "消歧", icon: /* @__PURE__ */ o(l, {}), desc: "词 → 术语 + 证据" },
|
|
15
|
+
{ key: "/cognition/impact", label: "影响面", icon: /* @__PURE__ */ o(a, {}), desc: "改之前先看谁引用" },
|
|
16
|
+
{ key: "/cognition/docs", label: "说明", icon: /* @__PURE__ */ o(n, {}), desc: "能力与 API 清单" }
|
|
17
|
+
], A = [
|
|
18
|
+
{ title: "本体管理", icon: /* @__PURE__ */ o(i, {}), items: v },
|
|
19
|
+
{ title: "业务认知", icon: /* @__PURE__ */ o(s, {}), items: I }
|
|
20
|
+
], B = [
|
|
21
|
+
{ path: "/cognition/terms", Component: r },
|
|
22
|
+
{ path: "/cognition/terms/detail", Component: d },
|
|
23
|
+
{ path: "/cognition/concepts", Component: y },
|
|
24
|
+
{ path: "/cognition/resolve", Component: h },
|
|
25
|
+
{ path: "/cognition/impact", Component: u },
|
|
26
|
+
{ path: "/cognition/docs", Component: O },
|
|
27
|
+
{ path: "/ontology/schemas", Component: C },
|
|
28
|
+
{ path: "/ontology/detail", Component: b },
|
|
29
|
+
{ path: "/ontology/nodes", Component: P },
|
|
30
|
+
{ path: "/ontology/validate", Component: k },
|
|
31
|
+
{ path: "/ontology/infer", Component: f },
|
|
32
|
+
{ path: "/ontology/materialize", Component: z }
|
|
17
33
|
];
|
|
18
34
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
x as appMeta,
|
|
36
|
+
I as menuItems,
|
|
37
|
+
A as menuSections,
|
|
38
|
+
v as ontologyMenuItems,
|
|
39
|
+
B as routes
|
|
22
40
|
};
|