@kanonak-protocol/sdk 5.35.0 → 5.37.0
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/browser.d.ts +3 -1
- package/dist/browser.js +1 -1
- package/dist/{chunk-O35Y6QUW.js → chunk-2WUZKSLB.js} +1 -1
- package/dist/chunk-3353RWDC.js +1 -0
- package/dist/{chunk-2Y6R3K5A.js → chunk-4CXAZH3C.js} +1 -1
- package/dist/chunk-7JBKOJB4.js +1 -0
- package/dist/chunk-D2X6J77P.js +1 -0
- package/dist/chunk-D4QGPMRW.js +1 -0
- package/dist/chunk-DONOB6RA.js +1 -0
- package/dist/{chunk-ZYDJUGIA.js → chunk-ED35OFGD.js} +1 -1
- package/dist/chunk-EG47OOJC.js +155 -0
- package/dist/chunk-HKX27KBZ.js +1 -0
- package/dist/{chunk-26SO3A4B.js → chunk-LE26SEJU.js} +1 -1
- package/dist/chunk-NUTHBBDZ.js +1 -0
- package/dist/{chunk-BZ3YTI3C.js → chunk-OOYGILH4.js} +2 -2
- package/dist/chunk-R4QCVB5M.js +68 -0
- package/dist/chunk-VORVR5BZ.js +1 -0
- package/dist/chunk-W5AOJ5SJ.js +3 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +1 -1
- package/dist/kanonaks/DefinedKanonak.d.ts +11 -0
- package/dist/kanonaks/LiteralKanonak.d.ts +12 -0
- package/dist/kanonaks/ReferenceKanonak.d.ts +2 -0
- package/dist/kanonaks/walkDefinedKanonaks.d.ts +23 -18
- package/dist/lock/LockFile.d.ts +6 -0
- package/dist/lock/index.d.ts +1 -1
- package/dist/look/displayValue.d.ts +3 -0
- package/dist/look/index.d.ts +1 -1
- package/dist/parsing/KanonakObjectParser.d.ts +8 -0
- package/dist/parsing/findMarkdownLinkAt.d.ts +8 -0
- package/dist/parsing/index.d.ts +2 -0
- package/dist/parsing/index.js +1 -1
- package/dist/parsing/sourceSymbols.d.ts +54 -0
- package/dist/producer/index.js +1 -1
- package/dist/reasoning/KanonakVocabulary.d.ts +21 -0
- package/dist/reasoning/index.d.ts +1 -1
- package/dist/reasoning/index.js +1 -1
- package/dist/repositories/LockAwareRepository.d.ts +1 -1
- package/dist/repositories/browser.js +1 -1
- package/dist/repositories/index.js +1 -1
- package/dist/resolution/ResourceTypeClassifier.d.ts +8 -1
- package/dist/resolution/index.d.ts +1 -0
- package/dist/resolution/index.js +1 -1
- package/dist/resolution/referenceSpelling.d.ts +14 -0
- package/dist/search/index.js +1 -1
- package/dist/server/closure.d.ts +8 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +16 -16
- package/dist/server/requestRouter.d.ts +16 -0
- package/dist/statements/Statement.d.ts +9 -0
- package/dist/transformations/index.js +2 -2
- package/dist/transformations/v3/TransformationLoaderV3.d.ts +8 -2
- package/dist/uri-helpers/PropertyValues.d.ts +34 -3
- package/dist/uri-helpers/UriHelpers.d.ts +3 -0
- package/dist/uri-helpers/index.d.ts +1 -1
- package/dist/uri-helpers/index.js +1 -1
- package/dist/validation/KanonakObjectValidator.d.ts +7 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/rules/repository/MarkdownLinkRule.d.ts +1 -0
- package/package.json +2 -2
- package/dist/chunk-54D47DLS.js +0 -1
- package/dist/chunk-AVVLDZAZ.js +0 -68
- package/dist/chunk-D7QLWVPK.js +0 -155
- package/dist/chunk-HF5FJBS2.js +0 -1
- package/dist/chunk-IS3AQKB4.js +0 -1
- package/dist/chunk-JHQPXEMA.js +0 -1
- package/dist/chunk-KIBR3HAT.js +0 -1
- package/dist/chunk-MQBWSCNY.js +0 -1
- package/dist/chunk-V3DH67P3.js +0 -1
- package/dist/chunk-VEGFYZXG.js +0 -2
- package/dist/chunk-XK24CN3C.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as it,b as st,c as ct,d as ut,e as B}from"./chunk-26SO3A4B.js";import{a as In,b as Vn,c as Ln}from"./chunk-V3DH67P3.js";import{a as tt,b as rt,c as at,d as mr,e as hr,f as kr,g as Sr,h as yr,i as gr}from"./chunk-O35Y6QUW.js";import{a as br}from"./chunk-ZYDJUGIA.js";import{a as ur,b as dr,c as lr,d as G,e as pr,f as fr,g as xe,h as Er,i as Rr,j as Cr,k as Kr,l as xr}from"./chunk-2Y6R3K5A.js";import{a as lo,b as po,c as fo,d as mo,e as ho,f as _o,g as Po,h as vo,i as Io}from"./chunk-IS3AQKB4.js";import{a as ko,b as So,c as yo,d as go,e as bo,f as Eo,h as Ro,i as Ae,j as $e,k as Me,l as je,m as Co,n as xo}from"./chunk-BZ3YTI3C.js";import{a as lt,b as pt,c as ft,d as mt}from"./chunk-VEGFYZXG.js";import{a as ht}from"./chunk-XK24CN3C.js";import{a as Ko}from"./chunk-SC5M74NM.js";import{A as Tt,B as qt,C as Wt,D as Bt,E as Gt,F as zt,G as or,H as tr,I as rr,J as ar,K as ir,L as sr,M as cr,a as St,b as yt,c as gt,d as bt,e as Et,f as Rt,g as Ct,h as Kt,i as xt,j as _t,k as Pt,l as vt,m as It,n as Vt,o as Lt,p as Nt,q as Ot,r as wt,s as Ut,t as At,u as $t,v as Mt,w as jt,x as Dt,y as Ft,z as Ht}from"./chunk-AVVLDZAZ.js";import"./chunk-KIBR3HAT.js";import{c as _n,d as Qt,e as Xt,g as Yt,h as Jt,k as Zt,m as Ke,o as Pn,p as vn,r as er,s as nr}from"./chunk-D7QLWVPK.js";import"./chunk-QHABFCRC.js";import{a as fe}from"./chunk-6VIUXP4N.js";import{a as Ho,g as L,h as Ce,i as nt,j as ot,k as A}from"./chunk-JHQPXEMA.js";import{a as j}from"./chunk-HF5FJBS2.js";import{a as kt}from"./chunk-PEJALHXK.js";import{$ as ge,A as Ye,B as Je,C as Ze,D as en,E as nn,F as on,G as tn,H as rn,I as an,J as sn,K as cn,L as un,M as ye,N as dn,O as ln,P as pn,Q as fn,R as mn,S as hn,T as kn,U as Sn,V as yn,W as gn,X as bn,Y as En,Z as Rn,_ as Cn,a as To,aa as Kn,b as qo,ba as ae,c as Wo,ca as be,d as Bo,da as Ee,e as F,ea as ie,f as zo,fa as T,g as Qo,ga as q,i as Xo,j as oe,k as te,ka as Yo,l as De,m as H,ma as Jo,n as re,na as k,o as Fe,oa as Re,p as He,q as ke,r as Te,s as qe,t as We,ta as Zo,u as Be,ua as et,v as Se,va as U,w as Ge,x as ze,y as Qe,z as Xe}from"./chunk-MQBWSCNY.js";import{A as C,B as ne,C as h,D,E as he,F as W,G as xn,a as Vo,b as Lo,c as S,d as N,e as v,f as Oo,g as wo,h as Uo,i as Ao,j as $o,k as Mo,l as jo,m as Do,n as Fo,o as l,r as Go,s as O,t as me,u as ee,w as x,z as w}from"./chunk-54D47DLS.js";import{a as No}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{a as no,b as oo,c as Z,d as to,e as V,f as ro,g as ao,h as io,i as so,j as co,k as uo}from"./chunk-QILEJIFU.js";import{a as dt}from"./chunk-ODIECDN7.js";async function Nn(n){let e=await new A().parseKanonaks(n),t=await new B().reason(n);return{kind:"merged",catalog:e,reasoning:t}}function On(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function wn(n,e){let t=e??new fe(new j);return{kind:"standalone",catalog:await new A().parseKanonaks(new xn(n,t))}}function I(n){return typeof n=="number"?n:void 0}function _r(n){if(!n)return;let e=l(n);if(e===l(sn))return"IRI";if(e===l(cn))return"BlankNode";if(e===l(un))return"Literal"}function An(n){if(!n)return;let e=l(n);if(e===l(dn))return"Violation";if(e===l(ln))return"Warning";if(e===l(pn))return"Info"}function $n(n,e,t,o){let r=h(e,ke);if(!r)return;let a={path:r},u=I(C(e,Te)),s=I(C(e,qe));u!==void 0&&(a.minCount=u),s!==void 0&&(a.maxCount=s);let i=I(C(e,Qe)),d=I(C(e,Xe));i!==void 0&&(a.minLength=i),d!==void 0&&(a.maxLength=d);let c=I(C(e,Ye)),p=I(C(e,Je));c!==void 0&&(a.minInclusive=c),p!==void 0&&(a.maxInclusive=p);let f=ne(e,Ge);if(f!==void 0){let m=ne(e,ze);a.pattern=m!==void 0?{regex:f,flags:m}:{regex:f}}if(w(e,Se)){let m=[],P=[];for(let{item:y}of me(e,Se))"literal"in y?m.push(y.value):y instanceof v&&P.push(y.subject);m.length>0&&(a.inValues=m),P.length>0&&(a.inRefs=P)}let R=h(e,We);R&&(a.datatype=R);let $=h(e,Be);$&&(a.classRef=$);let M=_r(h(e,an));M&&(a.nodeKind=M);let Q=h(e,Kn);if(Q&&(a.hasValue=Q),w(e,ae)||w(e,be)||w(e,Ee)){let m={},P=I(C(e,be)),y=I(C(e,Ee));P!==void 0&&(m.minCount=P),y!==void 0&&(m.maxCount=y);let K=Pr(n,e,o);"problem"in K?m.problem=K.problem:m.shape=K.shape,a.qualified=m}let X=ne(e,Ze);X!==void 0&&(a.message=X);let Y=An(h(e,ye))??t;return Y&&(a.severity=Y),a}function Pr(n,e,t){let o=D(e,ae);if(o)return Un(n,o,void 0,t);let r=h(e,ae);if(!r)return{problem:"sh:qualifiedValueShape is missing"};let a=l(r);if(t.has(a))return{problem:`sh:qualifiedValueShape '${r.name}' leads back to itself (a cycle through named shapes)`};let u=x(n,r);return u?Un(n,u,a,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function Un(n,e,t,o){let r=t?new Set([...o,t]):o,a=ee(e,H);if((ee(e,re)||w(e,ke))&&!a){let i=$n(n,e,void 0,r);return i?{shape:{kind:"property",constraint:i}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof S&&!a?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:Mn(n,e,r)}}}function Mn(n,e,t){let o=An(h(e,ye)),r={name:e instanceof S?e.name:"(inline shape)",uri:e instanceof S?k(e):void 0,targetClass:h(e,Fe),targetNodes:O(e,en),targetSubjectsOf:O(e,nn),targetObjectsOf:O(e,on),closed:C(e,tn)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...O(e,rn));for(let{item:a}of me(e,He)){let u;if(a instanceof N?u=a:a instanceof v&&(u=x(n,a.subject)),!u)continue;let s=$n(n,u,o,t);s&&r.properties.push(s)}return r}function se(n){let e=[];for(let t of n){if(!(t instanceof S)||!ee(t,H))continue;let o=k(t);e.push(Mn(n,t,new Set(o?[l(o)]:[])))}return e}var b="kanonak.org/transformations",z="values";var ce="allowed",Pe="expected",g=n=>({type:`${b}/VarRef`,varName:n}),_e=n=>({type:`${b}/IntegerLiteral`,integerLiteral:n}),vr=n=>({type:`${b}/DecimalLiteral`,decimalLiteral:n}),jn=n=>Number.isInteger(n)?_e(n):vr(n),Dn=n=>({type:`${b}/Count`,source:n}),Fn=(n,e)=>({type:`${b}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),Hn=(n,e)=>({type:`${b}/LessThanOrEqual`,compareLeft:n,compareRight:e});function ve(n,e){if(!e||e.length===0)return n;let t=new Set(["i","m","s"]),o=[...new Set(e.split(""))];if(o.filter(a=>!t.has(a)).length>0)throw new Error(`sh:flags '${e}' is outside the pinned regex subset (supported: i, m, s)`);return`(?${o.sort().join("")})${n}`}function ue(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:Fn(Dn(g(z)),_e(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:Hn(Dn(g(z)),_e(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${b}/Contains`,haystack:g(z),needle:g(Pe)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${b}/Contains`,haystack:g(ce),needle:g("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:ve(n.pattern.regex,n.pattern.flags)}}),n.minLength!==void 0&&e.push({component:"minLength",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:`(?s)^.{${n.minLength},}$`}}),n.maxLength!==void 0&&e.push({component:"maxLength",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:`(?s)^.{0,${n.maxLength}}$`}}),n.minInclusive!==void 0&&e.push({component:"minInclusive",per:"value",expr:Fn(g("v"),jn(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:Hn(g("v"),jn(n.maxInclusive))}),e}import{evaluate as Vr,ExpressionError as Lr}from"@kanonak-protocol/expression";function qn(n,e){let t=Nr(e)?e:se(e),o=[],r=n.catalog.filter(s=>s instanceof S).map(de),a=new Map;for(let s of r)Wn(s,n.catalog,a);let u={scope:n,membership:new Ie(n),embeddedFocus:a};for(let s of t)for(let i of wr(u,s,r))Bn(u,s,i,o);return{conforms:!o.some(s=>s.severity==="Violation"),results:o}}function Nr(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function Le(n){let e=n.predicate;return e instanceof v?e:void 0}function de(n){let e=k(n);return{node:n,key:e?l(e):`${n.namespace}/${n.name}`,uri:e,label:n.name}}function Ne(n,e){return{node:n,key:e,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function Or(n){let e=new Map;for(let t of n.statement){let o=Le(t);o&&!e.has(l(o.subject))&&e.set(l(o.subject),o.subject)}return[...e.values()]}function Wn(n,e,t){if(n.node)for(let o of Or(n.node))for(let r of W(n.node,o,e,n.key)){if(r.kind!=="embedded"||t.has(r.node))continue;let a=Ne(r.node,r.address);t.set(r.node,a),Wn(a,e,t)}}var Ie=class{constructor(e){this.scope=e}scope;ancestors=new Map;isInstance(e,t){let o=l(t);return e.some(r=>l(r)===o||this.ancestorsOf(r).has(o))}ancestorsOf(e){let t=e.version&&typeof e.version.major=="number"?`${l(e)}@${V(e.version)}`:l(e),o=this.ancestors.get(t);return o||(o=this.scope.reasoning?new Set(this.scope.reasoning.getSuperclasses(e)):new Set(Re(this.scope.catalog,e).map(r=>l(r))),this.ancestors.set(t,o)),o}};function wr(n,e,t){let{scope:o}=n,r=new Map,a=s=>{r.set(s.key,s)},u=()=>[...t,...n.embeddedFocus.values()];if(e.targetClass){let s=e.targetClass;if(o.reasoning){let i=new Set(o.reasoning.getInstancesOfClass(s));for(let d of t)d.uri&&i.has(l(d.uri))&&a(d)}else for(let i of t)n.membership.isInstance(U(i.node),s)&&a(i);for(let i of n.embeddedFocus.values())n.membership.isInstance(U(i.node),s)&&a(i)}for(let s of e.targetNodes){let i=x(o.catalog,s);i instanceof S&&a(de(i))}for(let s of e.targetSubjectsOf){let i=l(s);for(let d of u())d.node.statement.some(c=>{let p=Le(c);return p&&l(p.subject)===i})&&a(d)}for(let s of e.targetObjectsOf)for(let i of u())for(let d of W(i.node,s,o.catalog,i.key))d.kind==="subject"?a(de(d.node)):d.kind==="embedded"&&a(n.embeddedFocus.get(d.node)??Ne(d.node,d.address));return[...r.values()]}function Ur(n,e,t){return e.node?W(e.node,t,n.scope.catalog,e.key).map(o=>Ar(n,o)):[]}function Ar(n,e){switch(e.kind){case"subject":return{kernel:{ref:l(e.uri)},kind:"reference",ref:e.uri,subject:e.node};case"unresolved":return{kernel:{ref:l(e.uri)},kind:"reference",ref:e.uri};case"embedded":{let t=n.embeddedFocus.get(e.node)??Ne(e.node,e.address);return{kernel:{ref:t.key},kind:"embedded",embedded:t}}case"literal":return typeof e.value=="boolean"?{kernel:e.value?1:0,kind:"boolean",literal:e.value}:{kernel:e.value,kind:typeof e.value=="number"?"number":"string",literal:e.value}}}function Bn(n,e,t,o){for(let r of e.properties)zn(n,e,t,r,o);e.closed&&Gr(e,t,o)}function Ve(n,e,t,o,r={},a){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:a??Gn(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function Gn(n){return n.severity??"Violation"}var $r={minCount:fn,maxCount:mn,hasValue:ie,in:Sn,pattern:yn,minLength:gn,maxLength:bn,minInclusive:En,maxInclusive:Rn};function zn(n,e,t,o,r){let a=Ur(n,t,o.path),u=o.severity??Gn(e),s=o.path.name,i=[...(o.inValues??[]).map(c=>typeof c=="boolean"?c?1:0:c),...(o.inRefs??[]).map(c=>({ref:l(c)}))],d=(c,p,f)=>{let R=Ve(e,t,c,o.message??p,{resultPath:o.path,value:f?.literal,valueRef:f?.ref},u);return r.push(R),R};for(let c of ue(o)){let p=$r[c.component];if(c.per==="node"){let f={[z]:a.map(R=>R.kernel),[ce]:i};o.hasValue&&(f[Pe]={ref:l(o.hasValue)}),Tn(c,f)||d(p,Mr(c,s,o,a.length));continue}for(let f of a){if((c.component==="pattern"||c.component==="minLength"||c.component==="maxLength")&&f.kind!=="string"){d(p,`'${s}' value is not a string; ${c.component} applies to string values.`,f);continue}Tn(c,{v:f.kernel,[ce]:i})||d(p,Tr(c,s,o,f),f)}}if(o.nodeKind)for(let c of a)qr(o.nodeKind,c)||d(Cn,`'${s}' value is ${c.kind}; nodeKind requires ${o.nodeKind}.`,c);if(o.datatype)for(let c of a){let p=Wr(o.datatype,c);p&&d(hn,`'${s}' ${p}`,c)}if(o.classRef)for(let c of a){let p=Br(n,o.classRef,c);p&&d(kn,`'${s}' ${p}`,c)}o.qualified&&jr(n,o,a,s,d)}function Mr(n,e,t,o){switch(n.component){case"minCount":return`'${e}' has ${o} value(s); minCount is ${t.minCount}.`;case"maxCount":return`'${e}' has ${o} value(s); maxCount is ${t.maxCount}.`;case"hasValue":return`'${e}' has no value equal to ${t.hasValue?l(t.hasValue):"(unset)"}.`;default:return`'${e}' violates ${n.component}.`}}function jr(n,e,t,o,r){let a=e.qualified,u=a.maxCount!==void 0?q:T,s=(d,c)=>{Qn.add(r(u,d,c))};if(!a.shape){s(`'${o}' qualified value shape cannot be evaluated: ${a.problem??"it could not be built"}.`);return}let i=0;for(let d of t){let c=d.ref?l(d.ref):d.embedded?d.embedded.label:JSON.stringify(d.literal),p=Dr(n,d);if(!p){s(`'${o}' value ${c} does not resolve in this scope; whether it conforms to the qualified shape cannot be decided.`,d);continue}let f=Hr(n,a.shape,p);if(f.kind==="undecided"){s(`'${o}' value ${c}: whether it conforms to the qualified shape cannot be decided \u2014 ${f.reason}`,d);continue}f.kind==="conforms"&&i++}a.minCount!==void 0&&i<a.minCount&&r(T,`'${o}' has ${i} value(s) that conform to the qualified shape; qualifiedMinCount is ${a.minCount}.`),a.maxCount!==void 0&&i>a.maxCount&&r(q,`'${o}' has ${i} value(s) that conform to the qualified shape; qualifiedMaxCount is ${a.maxCount}.`)}function Dr(n,e){switch(e.kind){case"reference":return e.subject?de(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var Fr={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},Qn=new WeakSet;function Hr(n,e,t){let o=[];e.kind==="property"?zn(n,Fr,t,e.constraint,o):Bn(n,e.shape,t,o);let r=o.find(a=>Qn.has(a));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function Tr(n,e,t,o){let r=o.ref?l(o.ref):o.embedded?o.embedded.label:JSON.stringify(o.literal);switch(n.component){case"in":return`'${e}' value ${r} is not in the permitted set.`;case"pattern":return`'${e}' value ${r} does not match pattern ${t.pattern?.regex}.`;case"minLength":return`'${e}' value ${r} is shorter than minLength ${t.minLength}.`;case"maxLength":return`'${e}' value ${r} is longer than maxLength ${t.maxLength}.`;case"minInclusive":return`'${e}' value ${r} is below minInclusive ${t.minInclusive} (or not numeric).`;case"maxInclusive":return`'${e}' value ${r} is above maxInclusive ${t.maxInclusive} (or not numeric).`;default:return`'${e}' value ${r} violates ${n.component}.`}}function Tn(n,e){let t=o=>{let r=o.varName;if(o.type==="kanonak.org/transformations/VarRef"&&typeof r=="string"&&r in e)return e[r];throw new Lr(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return Vr(n.expr,void 0,t)===1}function qr(n,e){switch(n){case"IRI":return e.kind==="reference";case"BlankNode":return e.kind==="embedded";case"Literal":return e.kind==="string"||e.kind==="number"||e.kind==="boolean"}}function Wr(n,e){if(e.kind==="reference"||e.kind==="embedded")return`value is a ${e.kind}; sh:datatype requires a literal of ${n.name}.`;let t=Ce(n);if(t!==void 0)switch(t){case L.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case L.Integer:return e.kind!=="number"?`value is not a number (${n.name}).`:Number.isInteger(e.literal)?void 0:`value is not an integer (${n.name}).`;case L.Decimal:case L.Double:case L.Float:return e.kind==="number"?void 0:`value is not a number (${n.name}).`;default:return e.kind==="string"?void 0:`value is not a string-carried literal (${n.name}).`}}function Br(n,e,t){if(t.kind==="embedded"&&t.embedded?.node){let r=U(t.embedded.node);return r.length===0?`value ${t.embedded.label} has no type; sh:class requires an instance of ${e.name}.`:n.membership.isInstance(r,e)?void 0:`value ${t.embedded.label} is not an instance of ${e.name}.`}if(t.kind!=="reference"||!t.ref)return`value is not a reference; sh:class requires an instance of ${e.name}.`;if(n.scope.reasoning)return n.scope.reasoning.isInstanceOf(t.ref,e)?void 0:`value ${l(t.ref)} is not an instance of ${e.name}.`;let o=t.subject;return o?n.membership.isInstance(U(o),e)?void 0:`value ${l(t.ref)} is not an instance of ${e.name}.`:`value ${l(t.ref)} does not resolve in this scope (sh:class ${e.name}).`}function Gr(n,e,t){if(!e.node)return;let o=new Set([...n.properties.map(a=>l(a.path)),...n.ignoredProperties.map(a=>l(a))]),r=new Set;for(let a of e.node.statement){let u=Le(a);if(!u)continue;let s=l(u.subject);o.has(s)||r.has(s)||(r.add(s),t.push(Ve(n,e,ge,`'${e.label}' carries undeclared property '${u.subject.name}' (closed shape).`,{resultPath:u.subject})))}for(let a of e.node.unresolvedPredicates)r.has(a.key)||(r.add(a.key),t.push(Ve(n,e,ge,`'${e.label}' carries unresolvable property '${a.key}' (closed shape).`,{value:a.key})))}var zr="1.1.0",Qr=new Set([ie,T,q].map(n=>n.name));async function Xn(n){let e=new G(n.repository),t=e.imports(),o=n.result.results.some(i=>Qr.has(i.constraintComponent.name))?"1.2.0":zr,r=t.ensure(oe,te,o,"sh"),a=(i,d)=>i&&i.version&&typeof i.version.major=="number"?`${t.ensure(i.publisher,i.package_,V(i.version),i.package_)}.${i.name}`:d,u={},s=[];return n.result.results.forEach((i,d)=>{let c=`result-${d+1}`;s.push(c);let p={type:`${r}.ValidationResult`,[`${r}.focusNode`]:a(i.focusUri,i.focusNode),[`${r}.resultMessage`]:i.message,[`${r}.resultSeverity`]:`${r}.${i.severity}`,[`${r}.sourceConstraintComponent`]:`${r}.${i.constraintComponent.name}`};i.resultPath&&(p[`${r}.resultPath`]=a(i.resultPath,l(i.resultPath))),i.sourceShapeUri&&(p[`${r}.sourceShape`]=a(i.sourceShapeUri,i.sourceShape)),i.valueRef?p[`${r}.value`]=a(i.valueRef,l(i.valueRef)):i.value!==void 0&&(p[`${r}.value`]=i.value),u[c]=p}),u.report={type:`${r}.ValidationReport`,[`${r}.conforms`]:n.result.conforms,...s.length>0?{[`${r}.result`]:s}:{}},e.buildContentAddressed({publisher:n.publisher,book:t,body:u,...n.header!==void 0?{header:n.header}:{},contentHashProperty:"contentHash"})}import{VersionOperator as Ki}from"@kanonak-protocol/types/document/models/enums";var E="kanonak.org",_="view",Yn="core-kanonak",Xr={publisher:E,package_:_,name:"rootView"},Yr={publisher:E,package_:_,name:"bind"},Jr={publisher:E,package_:_,name:"produces"},Zr={publisher:E,package_:_,name:"projections"},ea={publisher:E,package_:_,name:"where"},na={publisher:E,package_:_,name:"value"},oa={publisher:E,package_:_,name:"as"},le=class{constructor(e,t=new j){this.repository=e;this.parser=t;this.objectParser=new A(this.parser),this.builder=new G(this.repository,this.parser,this.objectParser)}repository;parser;objectParser;builder;async materialize(e,t={}){let o=await this.objectParser.parseKanonaks(this.repository),r=this.resolveView(o,e),a=h(r,Yr);if(!a)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let u=h(r,Jr);if(!u)throw new Error(`View ${r.namespace}/${r.name} is a selection view (no view.produces). In-graph materialization of selection views is not yet supported \u2014 declare a view.produces output class to reshape the result.`);let s=ta(r),i=Jn(o,E,Yn),d=Jn(o,E,_),c=this.builder.imports(),p=c.ensure(E,Yn,i,"ck"),f=c.ensure(E,_,d,"v"),R=c.ref(u),$=new vn(this.repository,this.parser,this.objectParser),M=new Pn($,o),Q=this.readProjections(o,r),X=ia(r,ea),Y=this.findInstances(o,a,await this.reason(t)),m={},P=new Set;for(let J of Y){if(!await this.passesWhere(M,o,X,J))continue;let pe={type:R};for(let we of Q){let eo=await this.evaluateValue(M,o,we.value,J),Ue=this.builder.serializeValue(Zn(eo),c);Ue!==void 0&&(pe[c.ref(we.as)]=Ue)}let Oe=k(J);Oe&&(pe[`${f}.derivedFrom`]=c.ref(Oe)),m[this.rowName(J,P)]=pe}let y={};t.resolvedAt&&(y[`${p}.resolvedAt`]=t.resolvedAt),t.invocationId&&(y[`${p}.id`]=t.invocationId);let K=await this.builder.buildContentAddressed({publisher:s,book:c,body:m,contentHashProperty:`${p}.contentHash`,header:y});return{yaml:K.yaml,contentHash:K.contentHash,packageName:K.packageName,publisher:K.publisher,rowCount:K.resourceCount}}resolveView(e,t){let o=x(e,t);if(!o)throw new Error(`View ${t.publisher}/${t.package_}/${t.name} not found in the catalog.`);let r=h(o,Xr);if(r){let a=x(e,r);if(!a)throw new Error(`ViewPackage ${t.name} names rootView ${r.name}, which is not in the catalog.`);return a}return o}readProjections(e,t){let o=[];for(let r of he(t,Zr)){let a=r instanceof N?r:r instanceof v?x(e,r.subject):void 0;if(!a)continue;let u=D(a,na),s=h(a,oa);u&&s&&o.push({value:u,as:s})}return o}async reason(e){return new B({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,t,o){let r=aa(e),a=[],u=new Set;for(let s of o.getInstancesOfClass(t)){if(u.has(s))continue;u.add(s);let i=r.get(s);i&&a.push(i)}return a.sort((s,i)=>{let d=F(k(s)),c=F(k(i));return d<c?-1:d>c?1:0}),a}async passesWhere(e,t,o,r){for(let a of o){let u=await this.evaluateValue(e,t,a,r);if(!sa(u))return!1}return!0}async evaluateValue(e,t,o,r){let a=_n(o,"view-projection",{catalog:t,depth:0}),u=new Map([["input",r]]);return e.evaluate(a,u)}rowName(e,t){let o=xe(e.name)||"row",r=o,a=2;for(;t.has(r);)r=`${o}-${a++}`;return t.add(r),r}};function Zn(n){return Ke(n)?n.value:Array.isArray(n)?n.map(Zn):n}function ta(n){let e=k(n);if(!e)throw new Error(`Could not derive a publisher from view ${n.namespace}/${n.name}.`);return e.publisher}function Jn(n,e,t){let o=ra(n,e,t);if(!o)throw new Error(`Package ${e}/${t} is not in the catalog; it must be importable to materialize a view.`);return o}function ra(n,e,t){let o;for(let r of n){if(!(r instanceof S))continue;let a=k(r);!a||a.publisher!==e||a.package_!==t||!a.version||(!o||Z(a.version,o)>0)&&(o=a.version)}return o?V(o):void 0}function aa(n){let e=new Map,t=new Map;for(let o of n){if(!(o instanceof S))continue;let r=k(o);if(!r||!r.version)continue;let a=F(r),u=t.get(a);(!u||Z(r.version,u)>0)&&(t.set(a,r.version),e.set(a,o))}return e}function ia(n,e){let t=D(n,e);return t?[t]:he(n,e).filter(o=>o instanceof N)}function sa(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Ke(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{Mt as AmbiguousReferenceRule,Mo as BooleanStatement,lr as CANONICAL_FORM_VERSION,L as Carrier,qt as ClassDefinitionRule,Lt as ClassHierarchyCycleRule,fo as CompositeKanonakDocumentRepository,hr as DEFAULT_CONSENT_BINDING_PARAM,Lo as DefinedKanonak,sr as DiamondNameClashRule,Bt as DisplayLensScopeRule,po as DocumentLocation,rt as EdgeType,N as EmbeddedKanonak,vt as EmbeddedKanonakTypeRule,Do as EmbeddedStatement,Kr as EntitlementDeniedError,xr as EntitlementProducer,lo as FileSystemKanonakDocumentRepository,dt as GitIgnoreFilter,at as GraphBuilder,xo as HttpKanonakDocumentRepository,Ae as INTEGRITY_PREFIX,fr as ImportBook,It as ImportExistenceRule,fe as InMemoryKanonakDocumentRepository,ko as KANONAK_USER_AGENT,Vo as Kanonak,pt as KanonakDocumentPositions,A as KanonakObjectParser,cr as KanonakObjectValidator,j as KanonakParser,No as KanonakUri,ht as KanonakUriBuilder,kt as KanonakUrlResolver,Yo as KanonakVocabulary,Xt as LINE_STYLES,Rt as LinkTargetRule,Fo as ListStatement,Oo as LiteralKanonak,_o as LocalFirstRepository,Po as LockAwareRepository,tr as LookBandPathRule,er as LookRenderer,Gt as LookSemanticSvgPathRule,Wt as MarkdownLinkRule,Ho as MarkdownStatement,At as NamespaceImportCycleRule,Ct as NamespacePrefixRule,tt as NodeType,$o as NumberStatement,kr as OAuthDiscovery,ct as OWL_RL_CLASSIFICATION_RULES,Dt as ObjectPropertyValueValidationRule,gt as OntologyValidationError,St as OntologyValidationResult,ir as OwlOneOfRule,G as PackageBuilder,Pt as PackageHeaderRule,Er as ProducerRepository,Ft as PropertyDomainRule,Nt as PropertyHierarchyCycleRule,Ht as PropertyKindRangeConsistencyRule,lt as PropertyMetadata,jt as PropertyRangeReferenceRule,Ot as PropertyRangeRequiredRule,xt as PropertyTypeSpecificityRule,Ro as PublisherConfigResolver,Co as PublisherIndex,st as RDFS_RULES,B as Reasoner,ut as ReasoningResult,v as ReferenceKanonak,jo as ReferenceStatement,ho as RepositoryFactory,Tt as ReservedNameShadowRule,Kt as ResourceNamingRule,To as ResourceResolver,Jo as ResourceTypeClassifier,te as SHACL_PACKAGE,oe as SHACL_PUBLISHER,H as SH_NODE_SHAPE,re as SH_PROPERTY_SHAPE,De as SH_SHAPE,Uo as ScalarStatement,or as SequenceNarrativeRule,ar as ShaclShapeRule,wo as Statement,Ao as StringStatement,wt as SubClassOfReferenceRule,Ut as SubPropertyOfReferenceRule,S as SubjectKanonak,_t as SubjectKanonakTypeRequiredRule,gr as TokenCredentialProvider,it as TripleStore,zt as TxExpressionCompilesRule,rr as TxExpressionPathRule,qo as TypeResolver,$t as UnresolvedPredicateRule,Vt as UnresolvedReferenceRule,Et as ValidationCache,bt as ValidationContext,yt as ValidationSeverity,Ki as VersionOperator,le as ViewMaterializer,Rr as allowAllPolicy,go as assertHttpsUrl,Ko as assertPackageIdentity,Io as buildLocalFirstRepository,Zt as buildOntologyModel,Xn as buildReportPackageAsync,se as buildShapesModel,ur as canonicalForm,dr as canonicalHash,Ce as carrierOf,vo as collectKanonakFiles,Z as compareVersions,Ln as computeIntegrity,je as computeIntegrityAsync,pr as contentAddressedName,U as contextTypesOf,yr as createCredentialedFetch,ro as createVersion,qn as evaluateConformance,ot as extractMarkdownLinks,br as findDerivation,nt as findMalformedReferences,mt as findMarkdownLinkAt,ve as foldFlagsIntoPattern,Bo as formatKanonakAddress,V as formatVersion,mo as getGlobalCachePath,yo as getKanonakUserAgent,io as isCompatibleVersion,so as isMajorCompatible,bo as kanonakFetch,In as loadLockFile,ue as lowerConstraint,zo as makeUriKey,Cr as noopMeter,mr as normalizeHost,Sr as parseAuthChallenge,Wo as parseKanonakAddress,$e as parseLockFile,ao as parseVersionString,ft as parseWithPositions,uo as pickHighestDocument,Zo as propertiesInScope,Yt as readSequenceConnectors,O as referenceUris,Qt as resolveDisplayValue,et as resolvePropertyStep,xe as sanitizeName,co as satisfiesVersionOperator,Vn as saveLockFile,On as scopeFromCatalog,wn as scopeFromDocumentAsync,Nn as scopeFromRepositoryAsync,Me as serializeLockFile,Eo as setKanonakFetchRetries,So as setKanonakUserAgent,k as subjectUri,Re as superClassChain,nr as supportedBandKeys,Qo as tripleKey,Go as typeReferenceUris,F as uriKey,Xo as uriTriple,W as valuesOf,no as versionOperatorFromChar,oo as versionOperatorToChar,to as versionsEqual,Jt as walkSequence};
|
|
1
|
+
import{a as pt,b as ft,c as mt,d as ht,e as W}from"./chunk-LE26SEJU.js";import{a as Vn,b as Nn,c as On}from"./chunk-DONOB6RA.js";import{a as ut,b as dt,c as lt,d as _r,e as xr,f as Pr,g as vr,h as Ir,i as Lr}from"./chunk-2WUZKSLB.js";import{a as Vr}from"./chunk-ED35OFGD.js";import{a as br,b as Er,c as Rr,d as B,e as Cr,f as Kr,g as Pe,h as Nr,i as Or,j as wr,k as Ar,l as Ur}from"./chunk-4CXAZH3C.js";import{a as fo,b as mo,c as ho,d as So,e as ko,f as vo,g as Io,h as Lo,i as Vo}from"./chunk-HKX27KBZ.js";import{a as yo,b as go,c as bo,d as Eo,e as Ro,f as Co,h as Ko,i as $e,j as Me,k as je,l as De,m as Fe,n as _o,o as Po}from"./chunk-OOYGILH4.js";import{a as kt,b as yt,c as gt,d as bt,e as Et,f as Rt}from"./chunk-W5AOJ5SJ.js";import{a as Ct,b as _t}from"./chunk-D2X6J77P.js";import{a as xo}from"./chunk-SC5M74NM.js";import{A as Jt,B as Zt,C as er,D as nr,E as or,F as tr,G as fr,H as mr,I as hr,J as Sr,K as kr,L as yr,M as gr,a as xt,b as Pt,c as vt,d as It,e as Lt,f as Vt,g as Nt,h as Ot,i as wt,j as At,k as Ut,l as $t,m as Mt,n as jt,o as Dt,p as Ft,q as Ht,r as Tt,s as qt,t as Wt,u as Bt,v as Gt,w as zt,x as Qt,y as Xt,z as Yt}from"./chunk-R4QCVB5M.js";import"./chunk-VORVR5BZ.js";import{c as vn,d as rr,e as ar,f as ir,g as sr,i as cr,j as ur,m as dr,o as xe,q as In,r as Ln,t as lr,u as pr}from"./chunk-EG47OOJC.js";import"./chunk-QHABFCRC.js";import{a as fe}from"./chunk-6VIUXP4N.js";import{a as Ke,f as N,g as _e,h as st,i as ct,j as U}from"./chunk-3353RWDC.js";import{a as j}from"./chunk-7JBKOJB4.js";import{a as Kt}from"./chunk-PEJALHXK.js";import{$ as re,A as nn,B as on,C as tn,D as rn,E as an,F as sn,G as cn,H as un,I as dn,J as ln,K as ye,L as pn,M as fn,N as mn,O as hn,P as Sn,Q as kn,R as yn,S as gn,T as bn,U as En,V as Rn,W as Cn,X as Kn,Y as _n,Z as ge,_ as xn,a as Wo,aa as be,b as Bo,ba as Ee,c as F,ca as ae,d as Xo,da as T,e as Yo,ea as q,g as Jo,h as ne,ha as Zo,i as oe,ia as et,j as He,k as H,ka as nt,l as te,m as Te,ma as ot,n as qe,na as S,o as Se,oa as Ce,p as We,pa as tt,q as Be,qa as rt,r as Ge,s as ze,t as ke,ta as at,u as Qe,ua as it,v as Xe,va as A,w as Ye,x as Je,y as Ze,z as en}from"./chunk-NUTHBBDZ.js";import{C as w,D as C,E as ee,F as h,G as D,H as he,I as ie,J as Re,L as Pn,a as No,b as Oo,c as k,d as v,e as I,f as Ao,g as Uo,h as $o,i as Mo,j as jo,k as Do,l as Fo,m as Ho,n as To,o as qo,p as Go,q as zo,r as l,u as Qo,v as O,w as me,x as Z,z as _}from"./chunk-D4QGPMRW.js";import{a as wo}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{a as to,b as ro,c as J,d as ao,e as V,f as io,g as so,h as co,i as uo,j as lo,k as po}from"./chunk-QILEJIFU.js";import{a as St}from"./chunk-ODIECDN7.js";async function wn(n){let e=await new U().parseKanonaks(n),t=await new W().reason(n);return{kind:"merged",catalog:e,reasoning:t}}function An(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function Un(n,e){let t=e??new fe(new j);return{kind:"standalone",catalog:await new U().parseKanonaks(new Pn(n,t))}}function L(n){return typeof n=="number"?n:void 0}function $r(n){if(!n)return;let e=l(n);if(e===l(un))return"IRI";if(e===l(dn))return"BlankNode";if(e===l(ln))return"Literal"}function Mn(n){if(!n)return;let e=l(n);if(e===l(pn))return"Violation";if(e===l(fn))return"Warning";if(e===l(mn))return"Info"}function jn(n,e,t,o){let r=h(e,Se);if(!r)return;let a={path:r},u=L(C(e,We)),s=L(C(e,Be));u!==void 0&&(a.minCount=u),s!==void 0&&(a.maxCount=s);let i=L(C(e,Ye)),d=L(C(e,Je));i!==void 0&&(a.minLength=i),d!==void 0&&(a.maxLength=d);let c=L(C(e,Ze)),p=L(C(e,en));c!==void 0&&(a.minInclusive=c),p!==void 0&&(a.maxInclusive=p);let f=ee(e,Qe);if(f!==void 0){let m=ee(e,Xe);a.pattern=m!==void 0?{regex:f,flags:m}:{regex:f}}if(w(e,ke)){let m=[],P=[];for(let{item:y}of me(e,ke))"literal"in y?m.push(y.value):y instanceof I&&P.push(y.subject);m.length>0&&(a.inValues=m),P.length>0&&(a.inRefs=P)}let R=h(e,Ge);R&&(a.datatype=R);let $=h(e,ze);$&&(a.classRef=$);let M=$r(h(e,cn));M&&(a.nodeKind=M);let z=h(e,xn);if(z&&(a.hasValue=z),w(e,re)||w(e,be)||w(e,Ee)){let m={},P=L(C(e,be)),y=L(C(e,Ee));P!==void 0&&(m.minCount=P),y!==void 0&&(m.maxCount=y);let K=Mr(n,e,o);"problem"in K?m.problem=K.problem:m.shape=K.shape,a.qualified=m}let Q=ee(e,nn);Q!==void 0&&(a.message=Q);let X=Mn(h(e,ye))??t;return X&&(a.severity=X),a}function Mr(n,e,t){let o=D(e,re);if(o)return $n(n,o,void 0,t);let r=h(e,re);if(!r)return{problem:"sh:qualifiedValueShape is missing"};let a=l(r);if(t.has(a))return{problem:`sh:qualifiedValueShape '${r.name}' leads back to itself (a cycle through named shapes)`};let u=_(n,r);return u?$n(n,u,a,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function $n(n,e,t,o){let r=t?new Set([...o,t]):o,a=Z(e,H);if((Z(e,te)||w(e,Se))&&!a){let i=jn(n,e,void 0,r);return i?{shape:{kind:"property",constraint:i}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof k&&!a?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:Dn(n,e,r)}}}function Dn(n,e,t){let o=Mn(h(e,ye)),r={name:e instanceof k?e.name:"(inline shape)",uri:e instanceof k?S(e):void 0,targetClass:h(e,Te),targetNodes:O(e,on),targetSubjectsOf:O(e,tn),targetObjectsOf:O(e,rn),closed:C(e,an)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...O(e,sn));for(let{item:a}of me(e,qe)){let u;if(a instanceof v?u=a:a instanceof I&&(u=_(n,a.subject)),!u)continue;let s=jn(n,u,o,t);s&&r.properties.push(s)}return r}function se(n){let e=[];for(let t of n){if(!(t instanceof k)||!Z(t,H))continue;let o=S(t);e.push(Dn(n,t,new Set(o?[l(o)]:[])))}return e}var b="kanonak.org/transformations",G="values";var ce="allowed",Ie="expected",g=n=>({type:`${b}/VarRef`,varName:n}),ve=n=>({type:`${b}/IntegerLiteral`,integerLiteral:n}),jr=n=>({type:`${b}/DecimalLiteral`,decimalLiteral:n}),Fn=n=>Number.isInteger(n)?ve(n):jr(n),Hn=n=>({type:`${b}/Count`,source:n}),Tn=(n,e)=>({type:`${b}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),qn=(n,e)=>({type:`${b}/LessThanOrEqual`,compareLeft:n,compareRight:e});function Le(n,e){if(!e||e.length===0)return n;let t=new Set(["i","m","s"]),o=[...new Set(e.split(""))];if(o.filter(a=>!t.has(a)).length>0)throw new Error(`sh:flags '${e}' is outside the pinned regex subset (supported: i, m, s)`);return`(?${o.sort().join("")})${n}`}function ue(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:Tn(Hn(g(G)),ve(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:qn(Hn(g(G)),ve(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${b}/Contains`,haystack:g(G),needle:g(Ie)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${b}/Contains`,haystack:g(ce),needle:g("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:Le(n.pattern.regex,n.pattern.flags)}}),n.minLength!==void 0&&e.push({component:"minLength",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:`(?s)^.{${n.minLength},}$`}}),n.maxLength!==void 0&&e.push({component:"maxLength",per:"value",expr:{type:`${b}/Matches`,matchSource:g("v"),pattern:`(?s)^.{0,${n.maxLength}}$`}}),n.minInclusive!==void 0&&e.push({component:"minInclusive",per:"value",expr:Tn(g("v"),Fn(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:qn(g("v"),Fn(n.maxInclusive))}),e}import{evaluate as Fr,ExpressionError as Hr}from"@kanonak-protocol/expression";function Bn(n,e){let t=Tr(e)?e:se(e),o=[],r=n.catalog.filter(s=>s instanceof k).map(de),a=new Map;qr(r,a);let u={scope:n,membership:new Ve(n),embeddedFocus:a};for(let s of t)for(let i of Wr(u,s,r))zn(u,s,i,o);return{conforms:!o.some(s=>s.severity==="Violation"),results:o}}function Tr(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function Gn(n){let e=n.predicate;return e instanceof I?e:void 0}function de(n){return{node:n,key:Re(n),uri:S(n),label:n.name}}function Oe(n,e){return{node:n,key:e,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function qr(n,e){Ke(n.map(t=>t.node),({kanonak:t,address:o})=>{t instanceof v&&!e.has(t)&&e.set(t,Oe(t,o))})}var Ve=class{constructor(e){this.scope=e}scope;ancestors=new Map;isInstance(e,t){let o=l(t);return e.some(r=>l(r)===o||this.ancestorsOf(r).has(o))}ancestorsOf(e){let t=e.version&&typeof e.version.major=="number"?`${l(e)}@${V(e.version)}`:l(e),o=this.ancestors.get(t);return o||(o=this.scope.reasoning?new Set(this.scope.reasoning.getSuperclasses(e)):new Set(Ce(this.scope.catalog,e).map(r=>l(r))),this.ancestors.set(t,o)),o}};function Wr(n,e,t){let{scope:o}=n,r=new Map,a=s=>{r.set(s.key,s)},u=()=>[...t,...n.embeddedFocus.values()];if(e.targetClass){let s=e.targetClass;if(o.reasoning){let i=new Set(o.reasoning.getInstancesOfClass(s));for(let d of t)d.uri&&i.has(l(d.uri))&&a(d)}else for(let i of t)n.membership.isInstance(A(i.node),s)&&a(i);for(let i of n.embeddedFocus.values())n.membership.isInstance(A(i.node),s)&&a(i)}for(let s of e.targetNodes){let i=_(o.catalog,s);i instanceof k&&a(de(i))}for(let s of e.targetSubjectsOf){let i=l(s);for(let d of u())d.node.statement.some(c=>{let p=Gn(c);return p&&l(p.subject)===i})&&a(d)}for(let s of e.targetObjectsOf)for(let i of u())for(let d of ie(i.node,s,o.catalog,i.key))d.kind==="subject"?a(de(d.node)):d.kind==="embedded"&&a(n.embeddedFocus.get(d.node)??Oe(d.node,d.address));return[...r.values()]}function Br(n,e,t){return e.node?ie(e.node,t,n.scope.catalog,e.key).map(o=>Gr(n,o)):[]}function Gr(n,e){switch(e.kind){case"subject":return{kernel:{ref:l(e.uri)},kind:"reference",ref:e.uri,subject:e.node};case"unresolved":return{kernel:{ref:l(e.uri)},kind:"reference",ref:e.uri};case"embedded":{let t=n.embeddedFocus.get(e.node)??Oe(e.node,e.address);return{kernel:{ref:t.key},kind:"embedded",embedded:t}}case"literal":return typeof e.value=="boolean"?{kernel:e.value?1:0,kind:"boolean",literal:e.value}:{kernel:e.value,kind:typeof e.value=="number"?"number":"string",literal:e.value}}}function zn(n,e,t,o){for(let r of e.properties)Xn(n,e,t,r,o);e.closed&&ra(e,t,o)}function Ne(n,e,t,o,r={},a){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:a??Qn(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function Qn(n){return n.severity??"Violation"}var zr={minCount:hn,maxCount:Sn,hasValue:ae,in:gn,pattern:bn,minLength:En,maxLength:Rn,minInclusive:Cn,maxInclusive:Kn};function Xn(n,e,t,o,r){let a=Br(n,t,o.path),u=o.severity??Qn(e),s=o.path.name,i=[...(o.inValues??[]).map(c=>typeof c=="boolean"?c?1:0:c),...(o.inRefs??[]).map(c=>({ref:l(c)}))],d=(c,p,f)=>{let R=Ne(e,t,c,o.message??p,{resultPath:o.path,value:f?.literal,valueRef:f?.ref},u);return r.push(R),R};for(let c of ue(o)){let p=zr[c.component];if(c.per==="node"){let f={[G]:a.map(R=>R.kernel),[ce]:i};o.hasValue&&(f[Ie]={ref:l(o.hasValue)}),Wn(c,f)||d(p,Qr(c,s,o,a.length));continue}for(let f of a){if((c.component==="pattern"||c.component==="minLength"||c.component==="maxLength")&&f.kind!=="string"){d(p,`'${s}' value is not a string; ${c.component} applies to string values.`,f);continue}Wn(c,{v:f.kernel,[ce]:i})||d(p,ea(c,s,o,f),f)}}if(o.nodeKind)for(let c of a)na(o.nodeKind,c)||d(_n,`'${s}' value is ${c.kind}; nodeKind requires ${o.nodeKind}.`,c);if(o.datatype)for(let c of a){let p=oa(o.datatype,c);p&&d(kn,`'${s}' ${p}`,c)}if(o.classRef)for(let c of a){let p=ta(n,o.classRef,c);p&&d(yn,`'${s}' ${p}`,c)}o.qualified&&Xr(n,o,a,s,d)}function Qr(n,e,t,o){switch(n.component){case"minCount":return`'${e}' has ${o} value(s); minCount is ${t.minCount}.`;case"maxCount":return`'${e}' has ${o} value(s); maxCount is ${t.maxCount}.`;case"hasValue":return`'${e}' has no value equal to ${t.hasValue?l(t.hasValue):"(unset)"}.`;default:return`'${e}' violates ${n.component}.`}}function Xr(n,e,t,o,r){let a=e.qualified,u=a.maxCount!==void 0?q:T,s=(d,c)=>{Yn.add(r(u,d,c))};if(!a.shape){s(`'${o}' qualified value shape cannot be evaluated: ${a.problem??"it could not be built"}.`);return}let i=0;for(let d of t){let c=d.ref?l(d.ref):d.embedded?d.embedded.label:JSON.stringify(d.literal),p=Yr(n,d);if(!p){s(`'${o}' value ${c} does not resolve in this scope; whether it conforms to the qualified shape cannot be decided.`,d);continue}let f=Zr(n,a.shape,p);if(f.kind==="undecided"){s(`'${o}' value ${c}: whether it conforms to the qualified shape cannot be decided \u2014 ${f.reason}`,d);continue}f.kind==="conforms"&&i++}a.minCount!==void 0&&i<a.minCount&&r(T,`'${o}' has ${i} value(s) that conform to the qualified shape; qualifiedMinCount is ${a.minCount}.`),a.maxCount!==void 0&&i>a.maxCount&&r(q,`'${o}' has ${i} value(s) that conform to the qualified shape; qualifiedMaxCount is ${a.maxCount}.`)}function Yr(n,e){switch(e.kind){case"reference":return e.subject?de(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var Jr={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},Yn=new WeakSet;function Zr(n,e,t){let o=[];e.kind==="property"?Xn(n,Jr,t,e.constraint,o):zn(n,e.shape,t,o);let r=o.find(a=>Yn.has(a));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function ea(n,e,t,o){let r=o.ref?l(o.ref):o.embedded?o.embedded.label:JSON.stringify(o.literal);switch(n.component){case"in":return`'${e}' value ${r} is not in the permitted set.`;case"pattern":return`'${e}' value ${r} does not match pattern ${t.pattern?.regex}.`;case"minLength":return`'${e}' value ${r} is shorter than minLength ${t.minLength}.`;case"maxLength":return`'${e}' value ${r} is longer than maxLength ${t.maxLength}.`;case"minInclusive":return`'${e}' value ${r} is below minInclusive ${t.minInclusive} (or not numeric).`;case"maxInclusive":return`'${e}' value ${r} is above maxInclusive ${t.maxInclusive} (or not numeric).`;default:return`'${e}' value ${r} violates ${n.component}.`}}function Wn(n,e){let t=o=>{let r=o.varName;if(o.type==="kanonak.org/transformations/VarRef"&&typeof r=="string"&&r in e)return e[r];throw new Hr(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return Fr(n.expr,void 0,t)===1}function na(n,e){switch(n){case"IRI":return e.kind==="reference";case"BlankNode":return e.kind==="embedded";case"Literal":return e.kind==="string"||e.kind==="number"||e.kind==="boolean"}}function oa(n,e){if(e.kind==="reference"||e.kind==="embedded")return`value is a ${e.kind}; sh:datatype requires a literal of ${n.name}.`;let t=_e(n);if(t!==void 0)switch(t){case N.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case N.Integer:return e.kind!=="number"?`value is not a number (${n.name}).`:Number.isInteger(e.literal)?void 0:`value is not an integer (${n.name}).`;case N.Decimal:case N.Double:case N.Float:return e.kind==="number"?void 0:`value is not a number (${n.name}).`;default:return e.kind==="string"?void 0:`value is not a string-carried literal (${n.name}).`}}function ta(n,e,t){if(t.kind==="embedded"&&t.embedded?.node){let r=A(t.embedded.node);return r.length===0?`value ${t.embedded.label} has no type; sh:class requires an instance of ${e.name}.`:n.membership.isInstance(r,e)?void 0:`value ${t.embedded.label} is not an instance of ${e.name}.`}if(t.kind!=="reference"||!t.ref)return`value is not a reference; sh:class requires an instance of ${e.name}.`;if(n.scope.reasoning)return n.scope.reasoning.isInstanceOf(t.ref,e)?void 0:`value ${l(t.ref)} is not an instance of ${e.name}.`;let o=t.subject;return o?n.membership.isInstance(A(o),e)?void 0:`value ${l(t.ref)} is not an instance of ${e.name}.`:`value ${l(t.ref)} does not resolve in this scope (sh:class ${e.name}).`}function ra(n,e,t){if(!e.node)return;let o=new Set([...n.properties.map(a=>l(a.path)),...n.ignoredProperties.map(a=>l(a))]),r=new Set;for(let a of e.node.statement){let u=Gn(a);if(!u)continue;let s=l(u.subject);o.has(s)||r.has(s)||(r.add(s),t.push(Ne(n,e,ge,`'${e.label}' carries undeclared property '${u.subject.name}' (closed shape).`,{resultPath:u.subject})))}for(let a of e.node.unresolvedPredicates)r.has(a.key)||(r.add(a.key),t.push(Ne(n,e,ge,`'${e.label}' carries unresolvable property '${a.key}' (closed shape).`,{value:a.key})))}var aa="1.1.0",ia=new Set([ae,T,q].map(n=>n.name));async function Jn(n){let e=new B(n.repository),t=e.imports(),o=n.result.results.some(i=>ia.has(i.constraintComponent.name))?"1.2.0":aa,r=t.ensure(ne,oe,o,"sh"),a=(i,d)=>i&&i.version&&typeof i.version.major=="number"?`${t.ensure(i.publisher,i.package_,V(i.version),i.package_)}.${i.name}`:d,u={},s=[];return n.result.results.forEach((i,d)=>{let c=`result-${d+1}`;s.push(c);let p={type:`${r}.ValidationResult`,[`${r}.focusNode`]:a(i.focusUri,i.focusNode),[`${r}.resultMessage`]:i.message,[`${r}.resultSeverity`]:`${r}.${i.severity}`,[`${r}.sourceConstraintComponent`]:`${r}.${i.constraintComponent.name}`};i.resultPath&&(p[`${r}.resultPath`]=a(i.resultPath,l(i.resultPath))),i.sourceShapeUri&&(p[`${r}.sourceShape`]=a(i.sourceShapeUri,i.sourceShape)),i.valueRef?p[`${r}.value`]=a(i.valueRef,l(i.valueRef)):i.value!==void 0&&(p[`${r}.value`]=i.value),u[c]=p}),u.report={type:`${r}.ValidationReport`,[`${r}.conforms`]:n.result.conforms,...s.length>0?{[`${r}.result`]:s}:{}},e.buildContentAddressed({publisher:n.publisher,book:t,body:u,...n.header!==void 0?{header:n.header}:{},contentHashProperty:"contentHash"})}import{VersionOperator as $i}from"@kanonak-protocol/types/document/models/enums";var E="kanonak.org",x="view",Zn="core-kanonak",sa={publisher:E,package_:x,name:"rootView"},ca={publisher:E,package_:x,name:"bind"},ua={publisher:E,package_:x,name:"produces"},da={publisher:E,package_:x,name:"projections"},la={publisher:E,package_:x,name:"where"},pa={publisher:E,package_:x,name:"value"},fa={publisher:E,package_:x,name:"as"},le=class{constructor(e,t=new j){this.repository=e;this.parser=t;this.objectParser=new U(this.parser),this.builder=new B(this.repository,this.parser,this.objectParser)}repository;parser;objectParser;builder;async materialize(e,t={}){let o=await this.objectParser.parseKanonaks(this.repository),r=this.resolveView(o,e),a=h(r,ca);if(!a)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let u=h(r,ua);if(!u)throw new Error(`View ${r.namespace}/${r.name} is a selection view (no view.produces). In-graph materialization of selection views is not yet supported \u2014 declare a view.produces output class to reshape the result.`);let s=ma(r),i=eo(o,E,Zn),d=eo(o,E,x),c=this.builder.imports(),p=c.ensure(E,Zn,i,"ck"),f=c.ensure(E,x,d,"v"),R=c.ref(u),$=new Ln(this.repository,this.parser,this.objectParser),M=new In($,o),z=this.readProjections(o,r),Q=ka(r,la),X=this.findInstances(o,a,await this.reason(t)),m={},P=new Set;for(let Y of X){if(!await this.passesWhere(M,o,Q,Y))continue;let pe={type:R};for(let Ae of z){let oo=await this.evaluateValue(M,o,Ae.value,Y),Ue=this.builder.serializeValue(no(oo),c);Ue!==void 0&&(pe[c.ref(Ae.as)]=Ue)}let we=S(Y);we&&(pe[`${f}.derivedFrom`]=c.ref(we)),m[this.rowName(Y,P)]=pe}let y={};t.resolvedAt&&(y[`${p}.resolvedAt`]=t.resolvedAt),t.invocationId&&(y[`${p}.id`]=t.invocationId);let K=await this.builder.buildContentAddressed({publisher:s,book:c,body:m,contentHashProperty:`${p}.contentHash`,header:y});return{yaml:K.yaml,contentHash:K.contentHash,packageName:K.packageName,publisher:K.publisher,rowCount:K.resourceCount}}resolveView(e,t){let o=_(e,t);if(!o)throw new Error(`View ${t.publisher}/${t.package_}/${t.name} not found in the catalog.`);let r=h(o,sa);if(r){let a=_(e,r);if(!a)throw new Error(`ViewPackage ${t.name} names rootView ${r.name}, which is not in the catalog.`);return a}return o}readProjections(e,t){let o=[];for(let r of he(t,da)){let a=r instanceof v?r:r instanceof I?_(e,r.subject):void 0;if(!a)continue;let u=D(a,pa),s=h(a,fa);u&&s&&o.push({value:u,as:s})}return o}async reason(e){return new W({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,t,o){let r=Sa(e),a=[],u=new Set;for(let s of o.getInstancesOfClass(t)){if(u.has(s))continue;u.add(s);let i=r.get(s);i&&a.push(i)}return a.sort((s,i)=>{let d=F(S(s)),c=F(S(i));return d<c?-1:d>c?1:0}),a}async passesWhere(e,t,o,r){for(let a of o){let u=await this.evaluateValue(e,t,a,r);if(!ya(u))return!1}return!0}async evaluateValue(e,t,o,r){let a=vn(o,"view-projection",{catalog:t,depth:0}),u=new Map([["input",r]]);return e.evaluate(a,u)}rowName(e,t){let o=Pe(e.name)||"row",r=o,a=2;for(;t.has(r);)r=`${o}-${a++}`;return t.add(r),r}};function no(n){return xe(n)?n.value:Array.isArray(n)?n.map(no):n}function ma(n){let e=S(n);if(!e)throw new Error(`Could not derive a publisher from view ${n.namespace}/${n.name}.`);return e.publisher}function eo(n,e,t){let o=ha(n,e,t);if(!o)throw new Error(`Package ${e}/${t} is not in the catalog; it must be importable to materialize a view.`);return o}function ha(n,e,t){let o;for(let r of n){if(!(r instanceof k))continue;let a=S(r);!a||a.publisher!==e||a.package_!==t||!a.version||(!o||J(a.version,o)>0)&&(o=a.version)}return o?V(o):void 0}function Sa(n){let e=new Map,t=new Map;for(let o of n){if(!(o instanceof k))continue;let r=S(o);if(!r||!r.version)continue;let a=F(r),u=t.get(a);(!u||J(r.version,u)>0)&&(t.set(a,r.version),e.set(a,o))}return e}function ka(n,e){let t=D(n,e);return t?[t]:he(n,e).filter(o=>o instanceof v)}function ya(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:xe(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{Gt as AmbiguousReferenceRule,Do as BooleanStatement,Rr as CANONICAL_FORM_VERSION,N as Carrier,Zt as ClassDefinitionRule,Dt as ClassHierarchyCycleRule,ho as CompositeKanonakDocumentRepository,xr as DEFAULT_CONSENT_BINDING_PARAM,Oo as DefinedKanonak,yr as DiamondNameClashRule,nr as DisplayLensScopeRule,mo as DocumentLocation,dt as EdgeType,v as EmbeddedKanonak,$t as EmbeddedKanonakTypeRule,Ho as EmbeddedStatement,Ar as EntitlementDeniedError,Ur as EntitlementProducer,fo as FileSystemKanonakDocumentRepository,St as GitIgnoreFilter,lt as GraphBuilder,Po as HttpKanonakDocumentRepository,Me as INTEGRITY_PREFIX,Kr as ImportBook,Mt as ImportExistenceRule,fe as InMemoryKanonakDocumentRepository,yo as KANONAK_USER_AGENT,No as Kanonak,yt as KanonakDocumentPositions,U as KanonakObjectParser,gr as KanonakObjectValidator,j as KanonakParser,wo as KanonakUri,Ct as KanonakUriBuilder,Kt as KanonakUrlResolver,nt as KanonakVocabulary,sr as LINE_STYLES,Vt as LinkTargetRule,To as ListStatement,Ao as LiteralKanonak,vo as LocalFirstRepository,Io as LockAwareRepository,mr as LookBandPathRule,lr as LookRenderer,or as LookSemanticSvgPathRule,er as MarkdownLinkRule,qo as MarkdownStatement,Wt as NamespaceImportCycleRule,Nt as NamespacePrefixRule,ut as NodeType,jo as NumberStatement,Pr as OAuthDiscovery,mt as OWL_RL_CLASSIFICATION_RULES,Qt as ObjectPropertyValueValidationRule,vt as OntologyValidationError,xt as OntologyValidationResult,kr as OwlOneOfRule,B as PackageBuilder,Ut as PackageHeaderRule,Nr as ProducerRepository,Xt as PropertyDomainRule,Ft as PropertyHierarchyCycleRule,Yt as PropertyKindRangeConsistencyRule,kt as PropertyMetadata,zt as PropertyRangeReferenceRule,Ht as PropertyRangeRequiredRule,wt as PropertyTypeSpecificityRule,Ko as PublisherConfigResolver,_o as PublisherIndex,ft as RDFS_RULES,W as Reasoner,ht as ReasoningResult,I as ReferenceKanonak,Fo as ReferenceStatement,ko as RepositoryFactory,Jt as ReservedNameShadowRule,Ot as ResourceNamingRule,Wo as ResourceResolver,ot as ResourceTypeClassifier,oe as SHACL_PACKAGE,ne as SHACL_PUBLISHER,H as SH_NODE_SHAPE,te as SH_PROPERTY_SHAPE,He as SH_SHAPE,$o as ScalarStatement,fr as SequenceNarrativeRule,Sr as ShaclShapeRule,Uo as Statement,Mo as StringStatement,Tt as SubClassOfReferenceRule,qt as SubPropertyOfReferenceRule,k as SubjectKanonak,At as SubjectKanonakTypeRequiredRule,Lr as TokenCredentialProvider,pt as TripleStore,tr as TxExpressionCompilesRule,hr as TxExpressionPathRule,Bo as TypeResolver,rr as URI_DISPLAY_LABEL,ar as URI_DISPLAY_SUMMARY,Bt as UnresolvedPredicateRule,jt as UnresolvedReferenceRule,Lt as ValidationCache,It as ValidationContext,Pt as ValidationSeverity,$i as VersionOperator,le as ViewMaterializer,Or as allowAllPolicy,Eo as assertHttpsUrl,xo as assertPackageIdentity,Vo as buildLocalFirstRepository,dr as buildOntologyModel,Jn as buildReportPackageAsync,se as buildShapesModel,Zo as builtinHomePackages,et as builtinUri,br as canonicalForm,Er as canonicalHash,_e as carrierOf,Lo as collectKanonakFiles,J as compareVersions,On as computeIntegrity,Fe as computeIntegrityAsync,Cr as contentAddressedName,A as contextTypesOf,Ir as createCredentialedFetch,io as createVersion,Bn as evaluateConformance,ct as extractMarkdownLinks,Vr as findDerivation,st as findMalformedReferences,bt as findMarkdownLinkAt,Le as foldFlagsIntoPattern,zo as formatKanonakAddress,V as formatVersion,So as getGlobalCachePath,bo as getKanonakUserAgent,co as isCompatibleVersion,uo as isMajorCompatible,rt as isPropertySubject,Ro as kanonakFetch,Vn as loadLockFile,$e as lockedVersion,ue as lowerConstraint,Xo as makeUriKey,wr as noopMeter,_r as normalizeHost,vr as parseAuthChallenge,Go as parseKanonakAddress,je as parseLockFile,so as parseVersionString,gt as parseWithPositions,po as pickHighestDocument,at as propertiesInScope,tt as propertyClassOf,cr as readSequenceConnectors,_t as referenceSpelling,O as referenceUris,ir as resolveDisplayValue,it as resolvePropertyStep,Pe as sanitizeName,lo as satisfiesVersionOperator,Nn as saveLockFile,An as scopeFromCatalog,Un as scopeFromDocumentAsync,wn as scopeFromRepositoryAsync,De as serializeLockFile,Co as setKanonakFetchRetries,go as setKanonakUserAgent,Rt as sourceSymbolAt,Et as sourceSymbols,Re as subjectAddress,S as subjectUri,Ce as superClassChain,pr as supportedBandKeys,Yo as tripleKey,Qo as typeReferenceUris,F as uriKey,Jo as uriTriple,ie as valuesOf,to as versionOperatorFromChar,ro as versionOperatorToChar,ao as versionsEqual,Ke as walkDefinedKanonaks,ur as walkSequence};
|
|
@@ -39,4 +39,15 @@ export declare abstract class DefinedKanonak extends Kanonak {
|
|
|
39
39
|
* hand-built kanonak the parser never stamped.
|
|
40
40
|
*/
|
|
41
41
|
sourceDoc: string;
|
|
42
|
+
/**
|
|
43
|
+
* The segment of the authored YAML path at which this node sits: a subject's
|
|
44
|
+
* entity key exactly as authored (`Agent`, or `rdfs.Resource` for an
|
|
45
|
+
* open-world augmentation), or a list item's index / a dict-keyed entry's key.
|
|
46
|
+
* Set by the parser on every node it builds from source; absent on a node it
|
|
47
|
+
* synthesized, and on a single embedded value, which sits at its statement's
|
|
48
|
+
* own key. A parse-time fact, not part of the graph: it changes no content
|
|
49
|
+
* hash or serialization. Read by `sourceSymbols` to tie the object model back
|
|
50
|
+
* to source positions.
|
|
51
|
+
*/
|
|
52
|
+
sourceKey?: string | number;
|
|
42
53
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Kanonak } from './Kanonak.js';
|
|
2
|
+
import type { MarkdownLink } from '../statements/MarkdownStatement.js';
|
|
2
3
|
/**
|
|
3
4
|
* A literal value (string, number, or boolean) that appears in the
|
|
4
5
|
* object position of a list-valued DatatypeProperty.
|
|
@@ -25,4 +26,15 @@ export declare class LiteralKanonak extends Kanonak {
|
|
|
25
26
|
carrier?: string;
|
|
26
27
|
/** Raw lexical token, the precise canonicalization input; `value` may be a lossy native projection. */
|
|
27
28
|
lexical?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The `[[reference]]` placeholders of a core-prose value (Markdown /
|
|
31
|
+
* SubstitutableString), resolved through the document's import closure —
|
|
32
|
+
* exactly what a single prose value carries on its `MarkdownStatement`.
|
|
33
|
+
* Present (possibly empty) only when the list's range is a prose datatype,
|
|
34
|
+
* so its presence marks a prose literal. Derived from the text, so it is not
|
|
35
|
+
* part of the value's canonical identity.
|
|
36
|
+
*/
|
|
37
|
+
links?: MarkdownLink[];
|
|
38
|
+
/** Its authored index in the list (see `DefinedKanonak.sourceKey`). */
|
|
39
|
+
sourceKey?: string | number;
|
|
28
40
|
}
|
|
@@ -2,5 +2,7 @@ import { Kanonak } from './Kanonak.js';
|
|
|
2
2
|
import { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
3
|
export declare class ReferenceKanonak extends Kanonak {
|
|
4
4
|
subject: KanonakUri;
|
|
5
|
+
/** As a list item: its authored index or dict key (see `DefinedKanonak.sourceKey`). */
|
|
6
|
+
sourceKey?: string | number;
|
|
5
7
|
static parse(subjectKanonakUri: string): ReferenceKanonak;
|
|
6
8
|
}
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import type { Kanonak } from './Kanonak.js';
|
|
2
2
|
import type { DefinedKanonak } from './DefinedKanonak.js';
|
|
3
|
-
/** A DefinedKanonak visited during a walk, with a
|
|
3
|
+
/** A DefinedKanonak visited during a walk, with its address and a locator path. */
|
|
4
4
|
export interface WalkNode {
|
|
5
5
|
readonly kanonak: DefinedKanonak;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* The node's address — exactly what `valuesOf` gives the same node: a
|
|
8
|
+
* subject's canonical key (`publisher/package/name`), an embedded value's
|
|
9
|
+
* key plus its uri-fragments path (`…/Position#look.bands[0].stats[0]`).
|
|
10
|
+
*/
|
|
11
|
+
readonly address: string;
|
|
12
|
+
/**
|
|
13
|
+
* The subject-relative locator the validation messages use: the subject's
|
|
14
|
+
* name, then the same fragment path (`Position.look.bands[0].stats[0]`).
|
|
15
|
+
* Derived from {@link address}, so the two never disagree.
|
|
15
16
|
*/
|
|
16
17
|
readonly path: string;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Depth-first visit of every DefinedKanonak reachable from `roots`: each
|
|
20
|
-
* subject, then every embedded
|
|
21
|
-
*
|
|
22
|
-
* at
|
|
23
|
-
* handles the recursion.
|
|
21
|
+
* subject, then every embedded value nested in it — single embeddeds, list
|
|
22
|
+
* items and dict-keyed entries, across every statement for each property —
|
|
23
|
+
* at any depth. The visitor sees one node at a time and should inspect only
|
|
24
|
+
* that node's OWN statements; the walk handles the recursion.
|
|
25
|
+
*
|
|
26
|
+
* Addresses come from `addressedValuesOf`, the computation `valuesOf` uses,
|
|
27
|
+
* so a node reached by this walk and the same node read through `valuesOf`
|
|
28
|
+
* have one address (typescript#124). A property carrying several statements
|
|
29
|
+
* (the open-world merge) gets addresses that stay unique across them.
|
|
24
30
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* it, so this stays the single walk.
|
|
31
|
+
* A pure object-model traversal: the parser uses it (its second-chance
|
|
32
|
+
* property pass scans `unresolvedPredicates` at every depth), the validation
|
|
33
|
+
* rules use it, and it is exported so a consumer never writes its own
|
|
34
|
+
* recursion over the statement model.
|
|
30
35
|
*/
|
|
31
36
|
export declare function walkDefinedKanonaks(roots: Kanonak[], visit: (node: WalkNode) => void): void;
|
package/dist/lock/LockFile.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export interface LockFile {
|
|
|
9
9
|
lastUpdated: string;
|
|
10
10
|
packages: Record<string, LockEntry>;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The version a lock pins for a package, or undefined when the lock has no
|
|
14
|
+
* entry for it — THE lookup of a package's lock entry, so no consumer spells
|
|
15
|
+
* the lock's key format out.
|
|
16
|
+
*/
|
|
17
|
+
export declare function lockedVersion(lock: LockFile, publisher: string, packageName: string): string | undefined;
|
|
12
18
|
/**
|
|
13
19
|
* The one integrity format every lock producer and consumer shares:
|
|
14
20
|
* `sha256:<lowercase hex digest>` of the resource's UTF-8 bytes. Both
|
package/dist/lock/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { loadLockFile, saveLockFile, computeIntegrity, } from './LockFileIO.js';
|
|
2
|
-
export { parseLockFile, serializeLockFile, computeIntegrityAsync, INTEGRITY_PREFIX, } from './LockFile.js';
|
|
2
|
+
export { parseLockFile, serializeLockFile, computeIntegrityAsync, lockedVersion, INTEGRITY_PREFIX, } from './LockFile.js';
|
|
3
3
|
export type { LockFile, LockEntry } from './LockFile.js';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
2
|
import type { SubjectKanonak } from '../kanonaks/SubjectKanonak.js';
|
|
3
|
+
import { type EntityUri } from '../uri-helpers/index.js';
|
|
4
|
+
export declare const URI_DISPLAY_LABEL: EntityUri;
|
|
5
|
+
export declare const URI_DISPLAY_SUMMARY: EntityUri;
|
|
3
6
|
export interface DisplayValue {
|
|
4
7
|
/** The resource's display name. Never empty — falls back to the local name. */
|
|
5
8
|
label: string;
|
package/dist/look/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { LookRenderer, supportedBandKeys, type ResolvedLook, type TokenProvenance, type BaseStylesheetStatus, type StylesheetExplanation, } from './LookRenderer.js';
|
|
2
|
-
export { resolveDisplayValue, type DisplayValue } from './displayValue.js';
|
|
2
|
+
export { resolveDisplayValue, URI_DISPLAY_LABEL, URI_DISPLAY_SUMMARY, type DisplayValue } from './displayValue.js';
|
|
3
3
|
export { walkSequence, readSequenceSource, readSequenceConnectors, readSequenceParticipants, edgeStyleFor, hasPropertyCharacteristic, LINE_STYLES, type LineStyle, type SequenceWalk, type SequenceMessage, type SequenceGap, type SequenceConnector, } from './sequenceWalk.js';
|
|
@@ -111,6 +111,14 @@ export declare class KanonakObjectParser implements IKanonakObjectParser {
|
|
|
111
111
|
* left undefined, so MarkdownLinkRule can report it.
|
|
112
112
|
*/
|
|
113
113
|
private parseSubstitutableValue;
|
|
114
|
+
/**
|
|
115
|
+
* Every `[[reference]]` placeholder in a prose value, resolved through the
|
|
116
|
+
* document's import closure — the ONE link resolution for a single prose
|
|
117
|
+
* value (its `MarkdownStatement`) and each prose list item (its
|
|
118
|
+
* `LiteralKanonak`). A placeholder that does not resolve is still recorded,
|
|
119
|
+
* with `target` left undefined, so MarkdownLinkRule can report it.
|
|
120
|
+
*/
|
|
121
|
+
private resolveMarkdownLinks;
|
|
114
122
|
private parseObjectValue;
|
|
115
123
|
/**
|
|
116
124
|
* Build the embedded `tx.StringLiteral` that a `tx.Expression`-ranged object
|
|
@@ -27,3 +27,11 @@
|
|
|
27
27
|
import type { MarkdownLink, MarkdownStatement } from '../statements/MarkdownStatement.js';
|
|
28
28
|
import type { SourcePosition } from './KanonakDocumentPositions.js';
|
|
29
29
|
export declare function findMarkdownLinkAt(stmt: MarkdownStatement, cursorLine: number, cursorColumn: number, valuePosition: SourcePosition, sourceText: string): MarkdownLink | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The source span of every `[[reference]]` in a prose value, in source order —
|
|
32
|
+
* the order the parser populated the value's resolved `links` in, so the i-th
|
|
33
|
+
* span belongs to the i-th link. Same source-slice approach as
|
|
34
|
+
* {@link findMarkdownLinkAt}. Undefined when the value's range falls outside
|
|
35
|
+
* `sourceText`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function markdownLinkSourceSpans(valuePosition: SourcePosition, sourceText: string): SourcePosition[] | undefined;
|
package/dist/parsing/index.d.ts
CHANGED
|
@@ -7,5 +7,7 @@ export type { SourcePosition, ImportPackageEntry } from './KanonakDocumentPositi
|
|
|
7
7
|
export { parseWithPositions } from './parseWithPositions.js';
|
|
8
8
|
export type { ParsedDocumentWithPositions } from './parseWithPositions.js';
|
|
9
9
|
export { findMarkdownLinkAt } from './findMarkdownLinkAt.js';
|
|
10
|
+
export { sourceSymbols, sourceSymbolAt } from './sourceSymbols.js';
|
|
11
|
+
export type { SourceSymbol, SourceSymbolRole } from './sourceSymbols.js';
|
|
10
12
|
export type { IKanonakParser } from '@kanonak-protocol/types/document/parsing';
|
|
11
13
|
export type { KanonakDocument, KanonakMetadata, Namespace, Import, Version, ParseResult, ParseError } from '@kanonak-protocol/types/document/models/types';
|
package/dist/parsing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f}from"../chunk-
|
|
1
|
+
import{a as c,b as d,c as e,d as f,e as g,f as h}from"../chunk-W5AOJ5SJ.js";import{j as b}from"../chunk-3353RWDC.js";import{a}from"../chunk-7JBKOJB4.js";import"../chunk-NUTHBBDZ.js";import"../chunk-D4QGPMRW.js";import"../chunk-FUUTGGJS.js";import"../chunk-F67UH4FD.js";import"../chunk-QILEJIFU.js";export{d as KanonakDocumentPositions,b as KanonakObjectParser,a as KanonakParser,c as PropertyMetadata,f as findMarkdownLinkAt,e as parseWithPositions,h as sourceSymbolAt,g as sourceSymbols};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
|
+
import type { KanonakDocumentPositions, SourcePosition } from './KanonakDocumentPositions.js';
|
|
4
|
+
/**
|
|
5
|
+
* What an authored token names:
|
|
6
|
+
* - `subject`: an entity key — the resource the block defines, or for an
|
|
7
|
+
* open-world augmentation (`rdfs.Resource:`) the imported resource it
|
|
8
|
+
* asserts about;
|
|
9
|
+
* - `predicate`: a property key, at any depth;
|
|
10
|
+
* - `reference`: a value that references a resource — a single value, a list
|
|
11
|
+
* item, a dict-keyed entry, or a `[[reference]]` inside a prose value.
|
|
12
|
+
*/
|
|
13
|
+
export type SourceSymbolRole = 'subject' | 'predicate' | 'reference';
|
|
14
|
+
/** One token of a document's source that names a resource, as the parser resolved it. */
|
|
15
|
+
export interface SourceSymbol {
|
|
16
|
+
readonly role: SourceSymbolRole;
|
|
17
|
+
/**
|
|
18
|
+
* The resource the token names: the subject's canonical URI, the property's
|
|
19
|
+
* URI, or the reference's target — exactly what the object model holds, so
|
|
20
|
+
* an alias, an open-world augmentation and a built-in all arrive resolved,
|
|
21
|
+
* versioned wherever the import resolved a version.
|
|
22
|
+
*/
|
|
23
|
+
readonly uri: KanonakUri;
|
|
24
|
+
/** The token's span in the source. */
|
|
25
|
+
readonly range: SourcePosition;
|
|
26
|
+
/** The authored YAML path of the node the token belongs to. */
|
|
27
|
+
readonly path: ReadonlyArray<string | number>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Every token in one document that names a resource, each tied to its source
|
|
31
|
+
* span — THE bridge from the object model to source positions, for editor
|
|
32
|
+
* navigation (definition, hover, references) and anything else that must
|
|
33
|
+
* answer "what does the text at this position name?".
|
|
34
|
+
*
|
|
35
|
+
* `authored` is the document's own pre-merge subjects: the `authored` view of
|
|
36
|
+
* the parse (`KanonakObjectParser.parseKanonaks(repo, out)`, or
|
|
37
|
+
* `ValidationCache.getAuthoredKanonaks()`) filtered by `sourceDoc` to this
|
|
38
|
+
* document. The merged catalog will not do — the open-world merge folds other
|
|
39
|
+
* documents' statements onto the same subjects. `positions` must come from
|
|
40
|
+
* the same source text the document was parsed from. Pass `sourceText` to
|
|
41
|
+
* include the `[[references]]` inside prose values.
|
|
42
|
+
*
|
|
43
|
+
* Nothing is matched by name: each node carries the key or index it was
|
|
44
|
+
* authored at (`sourceKey`), so a token's URI is the one the parser resolved
|
|
45
|
+
* for that exact node. A node the parser built from source that has no
|
|
46
|
+
* position is a disagreement between the two parsers, and throws.
|
|
47
|
+
*/
|
|
48
|
+
export declare function sourceSymbols(authored: Kanonak[], positions: KanonakDocumentPositions, sourceText?: string): SourceSymbol[];
|
|
49
|
+
/**
|
|
50
|
+
* The symbol whose span contains the position (0-based, end-inclusive so a
|
|
51
|
+
* cursor just past a token still names it), the tightest when spans nest;
|
|
52
|
+
* undefined when the position names no resource.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sourceSymbolAt(symbols: readonly SourceSymbol[], line: number, column: number): SourceSymbol | undefined;
|
package/dist/producer/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"../chunk-
|
|
1
|
+
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"../chunk-4CXAZH3C.js";import"../chunk-QHABFCRC.js";import"../chunk-3353RWDC.js";import"../chunk-7JBKOJB4.js";import"../chunk-NUTHBBDZ.js";import"../chunk-D4QGPMRW.js";import"../chunk-FUUTGGJS.js";import"../chunk-F67UH4FD.js";import"../chunk-QILEJIFU.js";export{h as EntitlementDeniedError,i as EntitlementProducer,c as ImportBook,a as PackageBuilder,e as ProducerRepository,f as allowAllPolicy,b as contentAddressedName,g as noopMeter,d as sanitizeName};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
2
2
|
import type { Version } from '@kanonak-protocol/types/document/models/types';
|
|
3
3
|
import type { Vocabulary } from './Vocabulary.js';
|
|
4
|
+
import type { EntityUri } from '../uri-helpers/UriHelpers.js';
|
|
4
5
|
/**
|
|
5
6
|
* True when `name` is a reserved built-in term (an RDF/RDFS/OWL/Kanonak
|
|
6
7
|
* structural predicate, annotation, class, or datatype — see
|
|
@@ -20,6 +21,26 @@ export declare function builtinHome(name: string): {
|
|
|
20
21
|
publisher: string;
|
|
21
22
|
package_: string;
|
|
22
23
|
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The packages that home the reserved built-in terms (core-rdf, core-owl,
|
|
26
|
+
* core-kanonak) — the implicit foundation every document can name without
|
|
27
|
+
* importing it. A consumer that must hold the documents a built-in reference
|
|
28
|
+
* resolves to (an editor scoping its catalog to an import closure, the
|
|
29
|
+
* parser stamping built-in versions) takes the list from here.
|
|
30
|
+
*/
|
|
31
|
+
export declare function builtinHomePackages(): {
|
|
32
|
+
publisher: string;
|
|
33
|
+
package_: string;
|
|
34
|
+
}[];
|
|
35
|
+
/**
|
|
36
|
+
* The canonical URI of a reserved built-in term — `subClassOf` →
|
|
37
|
+
* `kanonak.org/core-rdf/subClassOf`, `ObjectProperty` →
|
|
38
|
+
* `kanonak.org/core-owl/ObjectProperty` — from the one table of built-in
|
|
39
|
+
* homes, for a consumer that reads a built-in property by identity
|
|
40
|
+
* (`referenceUris(subject, builtinUri('subClassOf'))`) instead of spelling
|
|
41
|
+
* its coordinates out. Throws for a name that is not a built-in term.
|
|
42
|
+
*/
|
|
43
|
+
export declare function builtinUri(name: string): EntityUri;
|
|
23
44
|
/**
|
|
24
45
|
* Canonicalize a built-in URI in place against {@link BUILTIN_HOMES}.
|
|
25
46
|
*
|
|
@@ -22,7 +22,7 @@ export { Reasoner } from './Reasoner.js';
|
|
|
22
22
|
export type { ReasonerOptions, ReasoningProfile } from './Reasoner.js';
|
|
23
23
|
export { ReasoningResult } from './ReasoningResult.js';
|
|
24
24
|
export { TripleStore } from './TripleStore.js';
|
|
25
|
-
export { KanonakVocabulary, canonicalizeBuiltinUri } from './KanonakVocabulary.js';
|
|
25
|
+
export { KanonakVocabulary, canonicalizeBuiltinUri, builtinUri, builtinHomePackages } from './KanonakVocabulary.js';
|
|
26
26
|
export type { Vocabulary } from './Vocabulary.js';
|
|
27
27
|
export type { Triple, TripleObject, UriKey } from './Triple.js';
|
|
28
28
|
export { uriKey, makeUriKey, tripleKey, uriTriple } from './Triple.js';
|
package/dist/reasoning/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i,b as j,c as k,d as l,e as m}from"../chunk-LE26SEJU.js";import"../chunk-3353RWDC.js";import"../chunk-7JBKOJB4.js";import{c as a,d as b,e as c,g as d,ha as e,ia as f,ja as g,ka as h}from"../chunk-NUTHBBDZ.js";import"../chunk-D4QGPMRW.js";import"../chunk-FUUTGGJS.js";import"../chunk-F67UH4FD.js";import"../chunk-QILEJIFU.js";export{h as KanonakVocabulary,k as OWL_RL_CLASSIFICATION_RULES,j as RDFS_RULES,m as Reasoner,l as ReasoningResult,i as TripleStore,e as builtinHomePackages,f as builtinUri,g as canonicalizeBuiltinUri,b as makeUriKey,c as tripleKey,a as uriKey,d as uriTriple};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
2
2
|
import type { KanonakDocument, Import, DocumentReference } from '@kanonak-protocol/types/document/models/types';
|
|
3
|
-
import type
|
|
3
|
+
import { type LockFile } from '../lock/LockFile.js';
|
|
4
4
|
/**
|
|
5
5
|
* A repository decorator that resolves versions through a `kanonak.lock`, so a
|
|
6
6
|
* package's identity is computed over its LOCKED closure rather than a freshly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,
|
|
1
|
+
import{h as e,n as r,o as n}from"../chunk-OOYGILH4.js";import"../chunk-SC5M74NM.js";import{a as o}from"../chunk-6VIUXP4N.js";import"../chunk-7JBKOJB4.js";import"../chunk-F67UH4FD.js";import"../chunk-QILEJIFU.js";export{n as HttpKanonakDocumentRepository,o as InMemoryKanonakDocumentRepository,e as PublisherConfigResolver,r as PublisherIndex};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f,f as k,g as l,h as m,i as n}from"../chunk-
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as k,g as l,h as m,i as n}from"../chunk-HKX27KBZ.js";import{g,h,n as i,o as j}from"../chunk-OOYGILH4.js";import"../chunk-SC5M74NM.js";import{a}from"../chunk-6VIUXP4N.js";import"../chunk-7JBKOJB4.js";import"../chunk-F67UH4FD.js";import"../chunk-QILEJIFU.js";export{d as CompositeKanonakDocumentRepository,c as DocumentLocation,b as FileSystemKanonakDocumentRepository,j as HttpKanonakDocumentRepository,a as InMemoryKanonakDocumentRepository,k as LocalFirstRepository,l as LockAwareRepository,h as PublisherConfigResolver,i as PublisherIndex,f as RepositoryFactory,n as buildLocalFirstRepository,m as collectKanonakFiles,g as defaultPublisherConfig,e as getGlobalCachePath};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { SubjectKanonak } from '@kanonak-protocol/types/object/kanonaks/types';
|
|
1
|
+
import type { SubjectKanonak as SubjectKanonakShape } from '@kanonak-protocol/types/object/kanonaks/types';
|
|
2
|
+
import type { SubjectKanonak as ParsedSubjectKanonak } from '../kanonaks/SubjectKanonak.js';
|
|
3
|
+
/**
|
|
4
|
+
* A subject the classifier reads: the SDK's parsed `SubjectKanonak` or the
|
|
5
|
+
* types-package shape. Both are read the same way (their `type` statements).
|
|
6
|
+
*/
|
|
7
|
+
type SubjectKanonak = SubjectKanonakShape | ParsedSubjectKanonak;
|
|
2
8
|
/**
|
|
3
9
|
* The canonical RDF/OWL property classes — the roots of the property
|
|
4
10
|
* tree. A type is a property type when it IS one of these or descends
|
|
@@ -60,3 +66,4 @@ export declare class ResourceTypeClassifier {
|
|
|
60
66
|
static isSchemaDefinitionType(resource: SubjectKanonak): boolean;
|
|
61
67
|
static isInstanceOfKnownClass(resource: SubjectKanonak, knownClassNames: Set<string>): boolean;
|
|
62
68
|
}
|
|
69
|
+
export {};
|
|
@@ -10,6 +10,7 @@ export { KanonakUrlResolver } from './KanonakUrlResolver.js';
|
|
|
10
10
|
export type { UrlAddress, PublisherUrlAddress, PackageUrlAddress, ResourceUrlAddress, VersionSpec, UrlForm, } from './KanonakUrlResolver.js';
|
|
11
11
|
export type { ResourceResolutionResult } from './ResourceResolutionResult.js';
|
|
12
12
|
export { TypeResolver } from './TypeResolver.js';
|
|
13
|
+
export { referenceSpelling } from './referenceSpelling.js';
|
|
13
14
|
export { propertiesInScope, resolvePropertyStep, contextTypesOf, subjectUri, superClassChain, propertyClassOf, isPropertySubject, isObjectPropertySubject, isDatatypePropertySubject, } from './TypeDirectedResolver.js';
|
|
14
15
|
export type { PropertyDescriptor, PropertyKind, StepResolution } from './TypeDirectedResolver.js';
|
|
15
16
|
export { ResourceTypeClassifier, corePropertyClassOf } from './ResourceTypeClassifier.js';
|
package/dist/resolution/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F}from"../chunk-
|
|
1
|
+
import{a as F,b as H}from"../chunk-D2X6J77P.js";import{a as o}from"../chunk-SC5M74NM.js";import{a as G}from"../chunk-PEJALHXK.js";import{a as q,b as r,la as u,ma as v,na as w,oa as x,pa as y,qa as z,ra as A,sa as B,ta as C,ua as D,va as E}from"../chunk-NUTHBBDZ.js";import{p as s,q as t}from"../chunk-D4QGPMRW.js";import{a as p}from"../chunk-FUUTGGJS.js";import{a as l,b as m,c as n}from"../chunk-F67UH4FD.js";import{a,b,c,d,e,f,g,h,i,j,k}from"../chunk-QILEJIFU.js";export{l as IMPORT_MODES,p as KanonakUri,F as KanonakUriBuilder,G as KanonakUrlResolver,q as ResourceResolver,v as ResourceTypeClassifier,r as TypeResolver,o as assertPackageIdentity,c as compareVersions,E as contextTypesOf,u as corePropertyClassOf,f as createVersion,t as formatKanonakAddress,e as formatVersion,h as isCompatibleVersion,B as isDatatypePropertySubject,m as isLinkImport,i as isMajorCompatible,A as isObjectPropertySubject,z as isPropertySubject,n as linkedPackages,s as parseKanonakAddress,g as parseVersionString,k as pickHighestDocument,C as propertiesInScope,y as propertyClassOf,H as referenceSpelling,D as resolvePropertyStep,j as satisfiesVersionOperator,w as subjectUri,x as superClassChain,a as versionOperatorFromChar,b as versionOperatorToChar,d as versionsEqual};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KanonakDocument } from '@kanonak-protocol/types/document/models/types';
|
|
2
|
+
import type { ResourceResolver } from './ResourceResolver.js';
|
|
3
|
+
import { type EntityUri } from '../uri-helpers/UriHelpers.js';
|
|
4
|
+
/**
|
|
5
|
+
* How `document` names the resource `uri` — the inverse of resolution, for a
|
|
6
|
+
* tool that WRITES a reference (completion, quick fixes, generators): the bare
|
|
7
|
+
* name for the document's own resources, `alias.name` through the import that
|
|
8
|
+
* brings `uri`'s package in. Every candidate is resolved back through
|
|
9
|
+
* `resolver` in `document`'s scope and kept only if it names exactly `uri`
|
|
10
|
+
* (and not ambiguously), so the result is a spelling the parser resolves to
|
|
11
|
+
* `uri` — never a guess. Undefined when no spelling reaches `uri` from this
|
|
12
|
+
* document (its package is neither the document's own nor imported).
|
|
13
|
+
*/
|
|
14
|
+
export declare function referenceSpelling(uri: EntityUri, document: KanonakDocument, resolver: ResourceResolver): Promise<string | undefined>;
|
package/dist/search/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../chunk-
|
|
1
|
+
import"../chunk-D2X6J77P.js";import"../chunk-SC5M74NM.js";import{f as g}from"../chunk-EG47OOJC.js";import"../chunk-QHABFCRC.js";import"../chunk-6VIUXP4N.js";import"../chunk-3353RWDC.js";import"../chunk-7JBKOJB4.js";import"../chunk-PEJALHXK.js";import{na as m,va as S}from"../chunk-NUTHBBDZ.js";import{c as v,r as p,z as E}from"../chunk-D4QGPMRW.js";import"../chunk-FUUTGGJS.js";import"../chunk-F67UH4FD.js";import{c as x}from"../chunk-QILEJIFU.js";import{homedir as P}from"os";import{join as d}from"path";import{existsSync as M,mkdirSync as D,readFileSync as j,writeFileSync as O}from"fs";import{createHash as C}from"crypto";import{pathToFileURL as B}from"url";var h="Xenova/all-MiniLM-L6-v2",w="q8",b=32;async function F(r){let{pipeline:e,env:t}=r.transformers;t.cacheDir=r.modelCacheDir??d(P(),".kanonak","models");let n=await e("feature-extraction",h,{dtype:w});return async s=>(await n(s,{pooling:"mean",normalize:!0})).tolist()}async function z(r){let e=d(r,"node_modules","@huggingface","transformers"),t=JSON.parse(j(d(e,"package.json"),"utf-8")),n=I(t);if(!n)throw new Error(`@huggingface/transformers at ${e} exposes no resolvable ESM entry.`);let s=await import(B(d(e,n)).href);return typeof s.pipeline=="function"?s:s.default}function I(r){let e=r.exports,t=n=>typeof n=="string"?n:n?.default;return typeof e=="string"?e:t(e?.node?.import)??t(e?.import)??t(e?.default)??r.module??r.main}var y=null;async function U(){return y||(y=(async()=>{let r;try{r=await import("@huggingface/transformers")}catch(e){throw new Error(`Semantic search requires the embedding runtime, which is an optional dependency.
|
|
2
2
|
Install it with:
|
|
3
3
|
npm install @huggingface/transformers
|
|
4
4
|
(underlying import error: ${e.message})`)}return F({transformers:r})})()),y}function H(r,e){let t=0;for(let n=0;n<r.length;n++)t+=r[n]*e[n];return t}function R(r,e){return e?r.version?e.version?x(r.version,e.version)>0:!0:!1:!0}function K(r,e){let t=g(r,e),n=[t.label],s=S(e);if(s.length>0){let i=E(r,s[0]),a=i?g(r,i).label:s[0].name;a&&n.push(`\u2014 a ${a}.`)}return t.summary&&n.push(t.summary),n.join(" ")}function q(r){let e=new Map;for(let t of r){if(!(t instanceof v))continue;let n=m(t);if(!n)continue;let s=p(n),i=e.get(s);(!i||R(n,m(i)))&&e.set(s,t)}return[...e.values()].sort((t,n)=>{let s=m(t)?p(m(t)):t.name,i=m(n)?p(m(n)):n.name;return s.localeCompare(i)})}var k=class{entries=[];embedder;constructor(e={}){this.embedder=e.embedder}resolveEmbedder(){return this.embedder?Promise.resolve(this.embedder):U()}get size(){return this.entries.length}async build(e,t={}){let n=q(e);if(t.include&&(n=n.filter(t.include)),n.length===0)return this.entries=[],{size:0,cached:!1};let s=n.map(o=>K(e,o)),i=t.cacheDir,a;if(i){let o=C("sha256").update(h+"|"+w+`
|
package/dist/server/closure.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ export interface DeriveImportClosureOptions {
|
|
|
27
27
|
* `RenderStackReport.warnings`; silence is how typescript#91 shipped.
|
|
28
28
|
*/
|
|
29
29
|
onUnresolvedEdge?: (edge: UnresolvedImportEdge) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Called once per document the walk visits — each seed, then each resolved
|
|
32
|
+
* version of an import, in walk order. A caller that needs the closure's
|
|
33
|
+
* DOCUMENTS rather than its package keys (an editor holding exactly the
|
|
34
|
+
* resolved versions in memory) collects them here instead of walking the
|
|
35
|
+
* imports a second time.
|
|
36
|
+
*/
|
|
37
|
+
onDocument?: (doc: KanonakDocument) => void;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* The transitive import closure of `seedDocs`, as a set of `publisher/package`
|
package/dist/server/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { loadServerModel } from './loadServerModel.js';
|
|
|
2
2
|
export { loadResourceModel } from './loadResourceModel.js';
|
|
3
3
|
export type { LoadResourceModelOptions } from './loadResourceModel.js';
|
|
4
4
|
export { route } from './route.js';
|
|
5
|
-
export { RequestRouter, landingPage } from './requestRouter.js';
|
|
5
|
+
export { RequestRouter, landingPage, requestPathFor, addressForRequestPath } from './requestRouter.js';
|
|
6
6
|
export type { RequestRouterOptions } from './requestRouter.js';
|
|
7
7
|
export { deriveImportClosure, ClosureScopedRepository } from './closure.js';
|
|
8
8
|
export type { UnresolvedImportEdge, DeriveImportClosureOptions } from './closure.js';
|