@kanonak-protocol/sdk 6.4.0 → 6.6.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.
Files changed (42) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunk-6WOPXTIL.js +1 -0
  4. package/dist/{chunk-GXEKJFXG.js → chunk-CPENAANM.js} +27 -27
  5. package/dist/{chunk-AAYMTPG7.js → chunk-DQGXJDQU.js} +1 -1
  6. package/dist/{chunk-7TNZ7ICK.js → chunk-FS7UGDEX.js} +1 -1
  7. package/dist/{chunk-Q57XCPAQ.js → chunk-I2T6ORSG.js} +1 -1
  8. package/dist/{chunk-5AMN6MW7.js → chunk-IWPCPQQY.js} +1 -1
  9. package/dist/{chunk-X4V6DEZL.js → chunk-LIN5SG5I.js} +1 -1
  10. package/dist/chunk-LK5SHY4B.js +1 -0
  11. package/dist/{chunk-FB5QKDNM.js → chunk-OHF4RIKS.js} +1 -1
  12. package/dist/{chunk-LKJVNKCN.js → chunk-SBWD7EOG.js} +1 -1
  13. package/dist/{chunk-MSOUPUUB.js → chunk-TF23WBSZ.js} +1 -1
  14. package/dist/chunk-VJUZKHQU.js +1 -0
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +4 -2
  17. package/dist/look/LookRenderer.d.ts +10 -4
  18. package/dist/parsing/index.js +1 -1
  19. package/dist/producer/index.js +1 -1
  20. package/dist/reasoning/KanonakVocabulary.d.ts +9 -0
  21. package/dist/reasoning/Reasoner.d.ts +6 -0
  22. package/dist/reasoning/index.d.ts +1 -1
  23. package/dist/reasoning/index.js +1 -1
  24. package/dist/resolution/index.js +1 -1
  25. package/dist/search/index.js +1 -1
  26. package/dist/server/closure.d.ts +11 -6
  27. package/dist/server/index.js +5 -5
  28. package/dist/shacl/ConformanceEvaluator.d.ts +8 -3
  29. package/dist/shacl/ConformanceScope.d.ts +32 -4
  30. package/dist/shacl/ShapesModel.d.ts +23 -0
  31. package/dist/shacl/index.d.ts +3 -3
  32. package/dist/shacl/uris.d.ts +1 -0
  33. package/dist/transformations/index.js +2 -2
  34. package/dist/transformations/v3/ExpressionEngineV3.d.ts +15 -0
  35. package/dist/uri-helpers/UriHelpers.d.ts +8 -0
  36. package/dist/uri-helpers/index.d.ts +1 -1
  37. package/dist/uri-helpers/index.js +1 -1
  38. package/dist/validation/index.js +1 -1
  39. package/package.json +2 -2
  40. package/dist/chunk-A224OOBZ.js +0 -1
  41. package/dist/chunk-PC3MYDGL.js +0 -1
  42. package/dist/chunk-WXUMROTA.js +0 -1
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
- import{a as Ut,b as $t,c as Mt,d as jt,e as z}from"./chunk-AAYMTPG7.js";import{a as Bn,b as Gn,c as zn}from"./chunk-BDTJIUS4.js";import{a as Ot,b as It,c as Vt,d as Qr,e as Xr,f as Yr,g as Jr,h as Zr,i as ei,j as Ue,k as ni,l as $e,m as Me,n as oi,o as ti,p as ri,q as le,r as ii,s as je}from"./chunk-MSOUPUUB.js";import{a as ai}from"./chunk-5AMN6MW7.js";import{a as Wr,b as qr,c as Br,d as Q,e as Gr,f as zr,g as Ve,h as si,i as ci,j as di,k as ui,l as li}from"./chunk-7TNZ7ICK.js";import{a as Lo,b as Ao,c as Oo,d as Io,e as Vo,f as nt,g as ot,h as tt,i as rt}from"./chunk-K76UUREI.js";import{a as Do,b as To,c as Ho,d as Fo,e as Wo,f as qo,g as ye,h as Ee,i as be,j as Qo,k as Xo,m as Yo,n as Ye,o as Je,p as Ze,q as en,r as nn,s as on,t as Jo,u as et}from"./chunk-Z2444SWM.js";import{a as Tt,b as Ht,c as Ft,d as Wt,e as qt,f as Bt}from"./chunk-FB5QKDNM.js";import{a as Gt,b as Qt}from"./chunk-X4V6DEZL.js";import{a as Zo}from"./chunk-SC5M74NM.js";import{A as Cr,B as Rr,C as Pr,D as vr,E as _r,F as xr,G as $r,H as Mr,I as jr,J as Dr,K as Tr,L as Hr,M as Fr,a as Xt,b as Yt,c as Jt,d as Zt,e as er,f as nr,g as or,h as tr,i as rr,j as ir,k as ar,l as sr,m as cr,n as dr,o as ur,p as lr,q as pr,r as fr,s as mr,t as hr,u as gr,v as kr,w as Sr,x as yr,y as Er,z as br}from"./chunk-Q57XCPAQ.js";import"./chunk-A224OOBZ.js";import{c as Fn,d as wr,e as Kr,f as Nr,g as Lr,i as Ar,j as Or,m as Ir,o as Ie,q as Wn,r as qn,t as Vr,u as Ur}from"./chunk-GXEKJFXG.js";import"./chunk-QHABFCRC.js";import{a as Uo,b as $o,c as Mo,d as jo,e as N}from"./chunk-5FVUBF7N.js";import{a as Se}from"./chunk-WXXZOJ4O.js";import{a as Ae,g as U,h as Oe,i as Lt,j as At,k as D}from"./chunk-LKJVNKCN.js";import{a as T}from"./chunk-5ZRVFYCP.js";import{a as zt}from"./chunk-PEJALHXK.js";import{$ as ce,A as kn,B as Sn,C as yn,D as En,E as bn,F as Cn,G as Rn,H as Pn,I as vn,J as _n,K as _e,L as xn,M as wn,N as Kn,O as Nn,P as Ln,Q as An,R as On,S as In,T as Vn,U as Un,V as $n,W as Mn,X as jn,Y as Dn,Z as xe,_ as Tn,a as kt,aa as we,b as St,ba as Ke,c as F,ca as de,d as Et,da as q,e as bt,ea as B,g as Ct,h as ie,ha as Rt,i as ae,ia as Pt,j as tn,k as W,ka as vt,l as se,m as rn,ma as _t,n as an,na as k,o as Pe,oa as Le,p as sn,pa as xt,q as cn,qa as wt,r as dn,s as un,t as ve,ta as Kt,u as ln,ua as Nt,v as pn,va as G,w as fn,x as mn,y as hn,z as gn}from"./chunk-WXUMROTA.js";import{A as j,B as R,C as re,D as g,E as H,F as Re,G as ue,H as Ne,J as Hn,a as it,b as at,c as S,d as L,e as A,f as st,g as ct,h as dt,i as ut,j as lt,k as pt,l as ft,m as mt,n as ht,o as gt,p as l,s as yt,t as M,u as Ce,v as te,x as _}from"./chunk-PC3MYDGL.js";import"./chunk-F67UH4FD.js";import{a as Co,b as Ro,c as oe,d as Po,e as V,f as vo,g as _o,h as xo,i as wo,j as Ko,k as No,l as Go,m as zo}from"./chunk-GGK6A6QK.js";import{a as Bo}from"./chunk-FUUTGGJS.js";import{a as Dt}from"./chunk-ODIECDN7.js";async function Qn(n){let e=await new D().parseKanonaks(n),t=await new z().reason(n);return{kind:"merged",catalog:e,reasoning:t}}function Xn(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function Yn(n,e){let t=e??new Se(new T);return{kind:"standalone",catalog:await new D().parseKanonaks(new Hn(n,t))}}function O(n){return typeof n=="number"?n:void 0}function pi(n){if(!n)return;let e=l(n);if(e===l(Pn))return"IRI";if(e===l(vn))return"BlankNode";if(e===l(_n))return"Literal"}function Zn(n){if(!n)return;let e=l(n);if(e===l(xn))return"Violation";if(e===l(wn))return"Warning";if(e===l(Kn))return"Info"}function eo(n,e,t,o){let r=g(e,Pe);if(!r)return;let i={path:r},d=O(R(e,sn)),s=O(R(e,cn));d!==void 0&&(i.minCount=d),s!==void 0&&(i.maxCount=s);let a=O(R(e,fn)),u=O(R(e,mn));a!==void 0&&(i.minLength=a),u!==void 0&&(i.maxLength=u);let c=O(R(e,hn)),p=O(R(e,gn));c!==void 0&&(i.minInclusive=c),p!==void 0&&(i.maxInclusive=p);let m=re(e,ln);if(m!==void 0){let h=re(e,pn);i.pattern=h!==void 0?{regex:m,flags:h}:{regex:m}}if(j(e,ve)){let h=[],K=[];for(let{item:y}of Ce(e,ve))"literal"in y?h.push(y.value):y instanceof A&&K.push(y.subject);h.length>0&&(i.inValues=h),K.length>0&&(i.inRefs=K)}let f=g(e,dn);f&&(i.datatype=f);let I=g(e,un);I&&(i.classRef=I);let P=pi(g(e,Rn));P&&(i.nodeKind=P);let $=g(e,Tn);if($&&(i.hasValue=$),j(e,ce)||j(e,we)||j(e,Ke)){let h={},K=O(R(e,we)),y=O(R(e,Ke));K!==void 0&&(h.minCount=K),y!==void 0&&(h.maxCount=y);let v=fi(n,e,o);"problem"in v?h.problem=v.problem:h.shape=v.shape,i.qualified=h}let w=re(e,kn);w!==void 0&&(i.message=w);let ee=Zn(g(e,_e))??t;return ee&&(i.severity=ee),i}function fi(n,e,t){let o=H(e,ce);if(o)return Jn(n,o,void 0,t);let r=g(e,ce);if(!r)return{problem:"sh:qualifiedValueShape is missing"};let i=l(r);if(t.has(i))return{problem:`sh:qualifiedValueShape '${r.name}' leads back to itself (a cycle through named shapes)`};let d=_(n,r);return d?Jn(n,d,i,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function Jn(n,e,t,o){let r=t?new Set([...o,t]):o,i=te(e,W);if((te(e,se)||j(e,Pe))&&!i){let a=eo(n,e,void 0,r);return a?{shape:{kind:"property",constraint:a}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof S&&!i?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:no(n,e,r)}}}function no(n,e,t){let o=Zn(g(e,_e)),r={name:e instanceof S?e.name:"(inline shape)",uri:e instanceof S?k(e):void 0,targetClass:g(e,rn),targetNodes:M(e,Sn),targetSubjectsOf:M(e,yn),targetObjectsOf:M(e,En),closed:R(e,bn)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...M(e,Cn));for(let{item:i}of Ce(e,an)){let d;if(i instanceof L?d=i:i instanceof A&&(d=_(n,i.subject)),!d)continue;let s=eo(n,d,o,t);s&&r.properties.push(s)}return r}function pe(n){let e=[];for(let t of n){if(!(t instanceof S)||!te(t,W))continue;let o=k(t);e.push(no(n,t,new Set(o?[l(o)]:[])))}return e}var b="kanonak.org/transformations",X="values";var fe="allowed",Te="expected",E=n=>({type:`${b}/VarRef`,varName:n}),De=n=>({type:`${b}/IntegerLiteral`,integerLiteral:n}),mi=n=>({type:`${b}/DecimalLiteral`,decimalLiteral:n}),oo=n=>Number.isInteger(n)?De(n):mi(n),to=n=>({type:`${b}/Count`,source:n}),ro=(n,e)=>({type:`${b}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),io=(n,e)=>({type:`${b}/LessThanOrEqual`,compareLeft:n,compareRight:e});function He(n,e){if(!e||e.length===0)return n;let t=new Set(["i","m","s"]),o=[...new Set(e.split(""))];if(o.filter(i=>!t.has(i)).length>0)throw new Error(`sh:flags '${e}' is outside the pinned regex subset (supported: i, m, s)`);return`(?${o.sort().join("")})${n}`}function me(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:ro(to(E(X)),De(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:io(to(E(X)),De(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${b}/Contains`,haystack:E(X),needle:E(Te)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${b}/Contains`,haystack:E(fe),needle:E("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${b}/Matches`,matchSource:E("v"),pattern:He(n.pattern.regex,n.pattern.flags)}}),n.minLength!==void 0&&e.push({component:"minLength",per:"value",expr:{type:`${b}/Matches`,matchSource:E("v"),pattern:`(?s)^.{${n.minLength},}$`}}),n.maxLength!==void 0&&e.push({component:"maxLength",per:"value",expr:{type:`${b}/Matches`,matchSource:E("v"),pattern:`(?s)^.{0,${n.maxLength}}$`}}),n.minInclusive!==void 0&&e.push({component:"minInclusive",per:"value",expr:ro(E("v"),oo(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:io(E("v"),oo(n.maxInclusive))}),e}import{evaluate as gi,ExpressionError as ki}from"@kanonak-protocol/expression";function so(n,e){let t=Si(e)?e:pe(e),o=[],r=n.catalog.filter(s=>s instanceof S).map(he),i=new Map;yi(r,i);let d={scope:n,membership:new Fe(n),embeddedFocus:i};for(let s of t)for(let a of Ei(d,s,r))uo(d,s,a,o);return{conforms:!o.some(s=>s.severity==="Violation"),results:o}}function Si(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function co(n){let e=n.predicate;return e instanceof A?e:void 0}function he(n){return{node:n,key:Ne(n),uri:k(n),label:n.name}}function qe(n,e){return{node:n,key:e,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function yi(n,e){Ae(n.map(t=>t.node),({kanonak:t,address:o})=>{t instanceof L&&!e.has(t)&&e.set(t,qe(t,o))})}var Fe=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(Le(this.scope.catalog,e).map(r=>l(r))),this.ancestors.set(t,o)),o}};function Ei(n,e,t){let{scope:o}=n,r=new Map,i=s=>{r.set(s.key,s)},d=()=>[...t,...n.embeddedFocus.values()];if(e.targetClass){let s=e.targetClass;for(let a of d())n.membership.isInstance(G(a.node),s)&&i(a)}for(let s of e.targetNodes){let a=_(o.catalog,s);a instanceof S&&i(he(a))}for(let s of e.targetSubjectsOf){let a=l(s);for(let u of d())u.node.statement.some(c=>{let p=co(c);return p&&l(p.subject)===a})&&i(u)}for(let s of e.targetObjectsOf)for(let a of d())for(let u of ue(a.node,s,o.catalog,a.key))u.kind==="subject"?i(he(u.node)):u.kind==="embedded"&&i(n.embeddedFocus.get(u.node)??qe(u.node,u.address));return[...r.values()]}function bi(n,e,t){return e.node?ue(e.node,t,n.scope.catalog,e.key).map(o=>Ci(n,o)):[]}function Ci(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)??qe(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 uo(n,e,t,o){for(let r of e.properties)po(n,e,t,r,o);e.closed&&Oi(e,t,o)}function We(n,e,t,o,r={},i){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:i??lo(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function lo(n){return n.severity??"Violation"}var Ri={minCount:Nn,maxCount:Ln,hasValue:de,in:In,pattern:Vn,minLength:Un,maxLength:$n,minInclusive:Mn,maxInclusive:jn};function po(n,e,t,o,r){let i=bi(n,t,o.path),d=o.severity??lo(e),s=o.path.name,a=[...(o.inValues??[]).map(c=>typeof c=="boolean"?c?1:0:c),...(o.inRefs??[]).map(c=>({ref:l(c)}))],u=(c,p,m)=>{let f=We(e,t,c,o.message??p,{resultPath:o.path,value:m?.literal,valueRef:m?.ref},d);return r.push(f),f};for(let c of me(o)){let p=Ri[c.component];if(c.per==="node"){let m={[X]:i.map(f=>f.kernel),[fe]:a};o.hasValue&&(m[Te]={ref:l(o.hasValue)}),ao(c,m)||u(p,Pi(c,s,o,i.length));continue}for(let m of i){if((c.component==="pattern"||c.component==="minLength"||c.component==="maxLength")&&m.kind!=="string"){u(p,`'${s}' value is not a string; ${c.component} applies to string values.`,m);continue}ao(c,{v:m.kernel,[fe]:a})||u(p,Ki(c,s,o,m),m)}}if(o.nodeKind)for(let c of i)Ni(o.nodeKind,c)||u(Dn,`'${s}' value is ${c.kind}; nodeKind requires ${o.nodeKind}.`,c);if(o.datatype)for(let c of i){let p=Li(o.datatype,c);p&&u(An,`'${s}' ${p}`,c)}if(o.classRef)for(let c of i){let p=Ai(n,o.classRef,c);p&&u(On,`'${s}' ${p}`,c)}o.qualified&&vi(n,o,i,s,u)}function Pi(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 vi(n,e,t,o,r){let i=e.qualified,d=i.maxCount!==void 0?B:q,s=(u,c)=>{fo.add(r(d,u,c))};if(!i.shape){s(`'${o}' qualified value shape cannot be evaluated: ${i.problem??"it could not be built"}.`);return}let a=0;for(let u of t){let c=u.ref?l(u.ref):u.embedded?u.embedded.label:JSON.stringify(u.literal),p=_i(n,u);if(!p){s(`'${o}' value ${c} does not resolve in this scope; whether it conforms to the qualified shape cannot be decided.`,u);continue}let m=wi(n,i.shape,p);if(m.kind==="undecided"){s(`'${o}' value ${c}: whether it conforms to the qualified shape cannot be decided \u2014 ${m.reason}`,u);continue}m.kind==="conforms"&&a++}i.minCount!==void 0&&a<i.minCount&&r(q,`'${o}' has ${a} value(s) that conform to the qualified shape; qualifiedMinCount is ${i.minCount}.`),i.maxCount!==void 0&&a>i.maxCount&&r(B,`'${o}' has ${a} value(s) that conform to the qualified shape; qualifiedMaxCount is ${i.maxCount}.`)}function _i(n,e){switch(e.kind){case"reference":return e.subject?he(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var xi={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},fo=new WeakSet;function wi(n,e,t){let o=[];e.kind==="property"?po(n,xi,t,e.constraint,o):uo(n,e.shape,t,o);let r=o.find(i=>fo.has(i));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function Ki(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 ao(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 ki(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return gi(n.expr,void 0,t)===1}function Ni(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 Li(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=Oe(n);if(t!==void 0)switch(t){case U.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case U.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 U.Decimal:case U.Double:case U.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 Ai(n,e,t){if(t.kind==="embedded"&&t.embedded?.node){let r=G(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}.`;let o=t.subject;return o?n.membership.isInstance(G(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 Oi(n,e,t){if(!e.node)return;let o=new Set([...n.properties.map(i=>l(i.path)),...n.ignoredProperties.map(i=>l(i))]),r=new Set;for(let i of e.node.statement){let d=co(i);if(!d)continue;let s=l(d.subject);o.has(s)||r.has(s)||(r.add(s),t.push(We(n,e,xe,`'${e.label}' carries undeclared property '${d.subject.name}' (closed shape).`,{resultPath:d.subject})))}for(let i of e.node.unresolvedPredicates)r.has(i.key)||(r.add(i.key),t.push(We(n,e,xe,`'${e.label}' carries unresolvable property '${i.key}' (closed shape).`,{value:i.key})))}var Ii="1.1.0",Vi=new Set([de,q,B].map(n=>n.name));async function mo(n){let e=new Q(n.repository),t=e.imports(),o=n.result.results.some(a=>Vi.has(a.constraintComponent.name))?"1.2.0":Ii,r=t.ensure(ie,ae,o,"sh"),i=(a,u)=>a&&a.version&&typeof a.version.major=="number"?`${t.ensure(a.publisher,a.package_,V(a.version),a.package_)}.${a.name}`:u,d={},s=[];return n.result.results.forEach((a,u)=>{let c=`result-${u+1}`;s.push(c);let p={type:`${r}.ValidationResult`,[`${r}.focusNode`]:i(a.focusUri,a.focusNode),[`${r}.resultMessage`]:a.message,[`${r}.resultSeverity`]:`${r}.${a.severity}`,[`${r}.sourceConstraintComponent`]:`${r}.${a.constraintComponent.name}`};a.resultPath&&(p[`${r}.resultPath`]=i(a.resultPath,l(a.resultPath))),a.sourceShapeUri&&(p[`${r}.sourceShape`]=i(a.sourceShapeUri,a.sourceShape)),a.valueRef?p[`${r}.value`]=i(a.valueRef,l(a.valueRef)):a.value!==void 0&&(p[`${r}.value`]=a.value),d[c]=p}),d.report={type:`${r}.ValidationReport`,[`${r}.conforms`]:n.result.conforms,...s.length>0?{[`${r}.result`]:s}:{}},e.buildContentAddressed({publisher:n.publisher,book:t,body:d,...n.header!==void 0?{header:n.header}:{},contentHashProperty:"contentHash"})}import{VersionOperator as Us}from"@kanonak-protocol/types/document/models/enums";import{spawn as Ui}from"child_process";var go=12e4,$i=4096,Y=class{argv;interactive;timeoutMs;stderr;now;constructor(e){this.argv=ko(e.command),this.interactive=e.interactive??!1,this.timeoutMs=e.timeoutMs??go,this.stderr=e.stderr??process.stderr,this.now=e.nowSeconds??(()=>Date.now()/1e3)}get command(){return this.argv.join(" ")}async get(e){let t=await this.run("get",this.wireRequest("get",e)),o=$e(e,t,this.now());if(!o.ok)throw new N(`credential helper '${this.command}' answered get for ${e.resource} outside the protocol (${o.problem}): ${o.message}`);return o.answer}async erase(e){let t=await this.run("erase",{...this.wireRequest("erase",e),scope:e.scope}),o=Me(t);if(!o.ok)throw new N(`credential helper '${this.command}' answered erase for ${e.resource} outside the protocol (${o.problem}): ${o.message}`)}wireRequest(e,t){let o={version:Ue,operation:e,resource:t.resource,method:t.method};return t.challenges&&(o.challenges=t.challenges),o.interactive=this.interactive,o}run(e,t){let o=`credential helper '${this.command}' ${e}`;return new Promise((r,i)=>{let d=!1,s=f=>{d||(d=!0,f())},a;try{a=Ui(this.argv[0],[...this.argv.slice(1),e],{stdio:["pipe","pipe","pipe"],shell:!1,windowsHide:!0})}catch(f){i(ho(o,f));return}let u=[],c="",p=!1,m=setTimeout(()=>{p=!0,a.kill()},this.timeoutMs);a.stdout.on("data",f=>u.push(f)),a.stderr.on("data",f=>{this.stderr.write(f),c=(c+f.toString("utf8")).slice(-$i)}),a.on("error",f=>{clearTimeout(m),s(()=>i(ho(o,f)))}),a.on("close",(f,I)=>{clearTimeout(m);let P=c.trim()?`: ${c.trim()}`:"";if(p){s(()=>i(new N(`${o} did not finish within ${Math.round(this.timeoutMs/1e3)}s${P}`)));return}if(f!==0){let w=f!==null?`exit ${f}`:`signal ${I}`;s(()=>i(new N(`${o} failed (${w})${P}`)));return}let $=Buffer.concat(u).toString("utf8").trim();try{let w=JSON.parse($);s(()=>r(w))}catch{s(()=>i(new N(`${o} exited 0 without printing one JSON answer${P}`)))}}),a.stdin.on("error",()=>{}),a.stdin.end(`${JSON.stringify(t)}
2
- `)})}};function ko(n){let e=n.trim().split(/\s+/).filter(t=>t!=="");if(e.length===0)throw new Error("the credential helper command is empty");return e}function ho(n,e){let t=e.code,o="";return t==="ENOENT"&&(o=" (not found: give its path, or put it on PATH)"),t==="EINVAL"&&process.platform==="win32"&&(o=" (a .cmd or .bat file cannot run without a shell: configure an executable, e.g. `node path/to/helper.js`)"),new N(`${n} could not be started: ${e.message}${o}`)}import{existsSync as Mi,readFileSync as ji}from"fs";import{homedir as Di}from"os";import{join as Ti}from"path";function J(){return Ti(Di(),".kanonak","config.json")}function Z(n){if(!Mi(n))return;let e;try{e=JSON.parse(ji(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`${n} must hold a JSON object`);return e}var Be="KANONAK_CREDENTIAL_HELPER";function Hi(n={}){let e=n.env??process.env,t=n.configPath??J(),o=Fi(e,t);if(o){let i=Object.keys(e).filter(d=>(d===le||d.startsWith(`${le}_`))&&(e[d]??"").trim()!=="").sort();if(i.length>0)throw new Error(`A credential helper is configured (${o.source}: ${o.command}) and so is ${i.join(", ")}. Configure one or the other.`);return new Y({command:o.command,interactive:n.interactive??!1})}let r={env:e};return n.discovery&&(r.discovery=n.discovery),new je(r)}function Fi(n,e){let t=(n[Be]??"").trim();if(t)return{command:t,source:Be};let o=Z(e)?.credentialHelper;if(o!==void 0){if(typeof o!="string"||o.trim()==="")throw new Error(`"credentialHelper" in ${e} must be a non-empty command line`);return{command:o.trim(),source:e}}}var Ge="KANONAK_PACKAGE_URL_TEMPLATE";function Wi(n={}){let e=n.env??process.env,t=n.configPath??J(),o=Z(t)?.packageUrlTemplates,r=o===void 0?{}:{...Ee(o,"packageUrlTemplates",t)},i=(e[Ge]??"").trim();return i&&(r[ye]=be(i,Ge,!0)),Object.keys(r).length>0?Object.freeze(r):void 0}var C="kanonak.org",x="view",So="core-kanonak",qi={publisher:C,package_:x,name:"rootView"},Bi={publisher:C,package_:x,name:"bind"},Gi={publisher:C,package_:x,name:"produces"},zi={publisher:C,package_:x,name:"projections"},Qi={publisher:C,package_:x,name:"where"},Xi={publisher:C,package_:x,name:"value"},Yi={publisher:C,package_:x,name:"as"},ge=class{constructor(e,t=new T){this.repository=e;this.parser=t;this.objectParser=new D(this.parser),this.builder=new Q(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),i=g(r,Bi);if(!i)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let d=g(r,Gi);if(!d)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=Ji(r),a=yo(o,C,So),u=yo(o,C,x),c=this.builder.imports(),p=c.ensure(C,So,a,"ck"),m=c.ensure(C,x,u,"v"),f=c.ref(d),I=new qn(this.repository,this.parser,this.objectParser),P=new Wn(I,o),$=this.readProjections(o,r),w=na(r,Qi),ee=this.findInstances(o,i,await this.reason(t)),h={},K=new Set;for(let ne of ee){if(!await this.passesWhere(P,o,w,ne))continue;let ke={type:f};for(let Qe of $){let bo=await this.evaluateValue(P,o,Qe.value,ne),Xe=this.builder.serializeValue(Eo(bo),c);Xe!==void 0&&(ke[c.ref(Qe.as)]=Xe)}let ze=k(ne);ze&&(ke[`${m}.derivedFrom`]=c.ref(ze)),h[this.rowName(ne,K)]=ke}let y={};t.resolvedAt&&(y[`${p}.resolvedAt`]=t.resolvedAt),t.invocationId&&(y[`${p}.id`]=t.invocationId);let v=await this.builder.buildContentAddressed({publisher:s,book:c,body:h,contentHashProperty:`${p}.contentHash`,header:y});return{yaml:v.yaml,contentHash:v.contentHash,packageName:v.packageName,publisher:v.publisher,rowCount:v.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=g(o,qi);if(r){let i=_(e,r);if(!i)throw new Error(`ViewPackage ${t.name} names rootView ${r.name}, which is not in the catalog.`);return i}return o}readProjections(e,t){let o=[];for(let r of Re(t,zi)){let i=r instanceof L?r:r instanceof A?_(e,r.subject):void 0;if(!i)continue;let d=H(i,Xi),s=g(i,Yi);d&&s&&o.push({value:d,as:s})}return o}async reason(e){return new z({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,t,o){let r=ea(e),i=[],d=new Set;for(let s of o.getInstancesOfClass(t)){if(d.has(s))continue;d.add(s);let a=r.get(s);a&&i.push(a)}return i.sort((s,a)=>{let u=F(k(s)),c=F(k(a));return u<c?-1:u>c?1:0}),i}async passesWhere(e,t,o,r){for(let i of o){let d=await this.evaluateValue(e,t,i,r);if(!oa(d))return!1}return!0}async evaluateValue(e,t,o,r){let i=Fn(o,"view-projection",{catalog:t,depth:0}),d=new Map([["input",r]]);return e.evaluate(i,d)}rowName(e,t){let o=Ve(e.name)||"row",r=o,i=2;for(;t.has(r);)r=`${o}-${i++}`;return t.add(r),r}};function Eo(n){return Ie(n)?n.value:Array.isArray(n)?n.map(Eo):n}function Ji(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 yo(n,e,t){let o=Zi(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 Zi(n,e,t){let o;for(let r of n){if(!(r instanceof S))continue;let i=k(r);!i||i.publisher!==e||i.package_!==t||!i.version||(!o||oe(i.version,o)>0)&&(o=i.version)}return o?V(o):void 0}function ea(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 i=F(r),d=t.get(i);(!d||oe(r.version,d)>0)&&(t.set(i,r.version),e.set(i,o))}return e}function na(n,e){let t=H(n,e);return t?[t]:Re(n,e).filter(o=>o instanceof L)}function oa(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Ie(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{ye as ANY_PUBLISHER,kr as AmbiguousReferenceRule,pt as BooleanStatement,Br as CANONICAL_FORM_VERSION,ti as CREDENTIAL_EXPIRY_SKEW_SECONDS,Be as CREDENTIAL_HELPER_ENV,Ue as CREDENTIAL_HELPER_PROTOCOL_VERSION,go as CREDENTIAL_HELPER_TIMEOUT_MS,U as Carrier,Rr as ClassDefinitionRule,ur as ClassHierarchyCycleRule,Oo as CompositeKanonakDocumentRepository,N as CredentialError,Zr as DEFAULT_CONSENT_BINDING_PARAM,at as DefinedKanonak,Hr as DiamondNameClashRule,vr as DisplayLensScopeRule,Ao as DocumentLocation,It as EdgeType,L as EmbeddedKanonak,sr as EmbeddedKanonakTypeRule,mt as EmbeddedStatement,ui as EntitlementDeniedError,li as EntitlementProducer,Y as ExecCredentialProvider,Lo as FileSystemKanonakDocumentRepository,Dt as GitIgnoreFilter,Vt as GraphBuilder,et as HttpKanonakDocumentRepository,Je as INTEGRITY_PREFIX,zr as ImportBook,cr as ImportExistenceRule,Se as InMemoryKanonakDocumentRepository,Do as KANONAK_USER_AGENT,it as Kanonak,Ht as KanonakDocumentPositions,Uo as KanonakHttpError,D as KanonakObjectParser,Fr as KanonakObjectValidator,T as KanonakParser,Bo as KanonakUri,Gt as KanonakUriBuilder,zt as KanonakUrlResolver,vt as KanonakVocabulary,Lr as LINE_STYLES,nr as LinkTargetRule,ht as ListStatement,st as LiteralKanonak,nt as LocalFirstRepository,ot as LockAwareRepository,Mr as LookBandPathRule,Vr as LookRenderer,_r as LookSemanticSvgPathRule,Pr as MarkdownLinkRule,gt as MarkdownStatement,hr as NamespaceImportCycleRule,or as NamespacePrefixRule,Ot as NodeType,lt as NumberStatement,ei as OAuthDiscovery,Mt as OWL_RL_CLASSIFICATION_RULES,yr as ObjectPropertyValueValidationRule,Jt as OntologyValidationError,Xt as OntologyValidationResult,Tr as OwlOneOfRule,Ge as PACKAGE_URL_TEMPLATE_ENV,Q as PackageBuilder,ar as PackageHeaderRule,si as ProducerRepository,Er as PropertyDomainRule,lr as PropertyHierarchyCycleRule,br as PropertyKindRangeConsistencyRule,Tt as PropertyMetadata,Sr as PropertyRangeReferenceRule,pr as PropertyRangeRequiredRule,rr as PropertyTypeSpecificityRule,Yo as PublisherConfigResolver,Jo as PublisherIndex,$t as RDFS_RULES,z as Reasoner,jt as ReasoningResult,A as ReferenceKanonak,ft as ReferenceStatement,Vo as RepositoryFactory,Cr as ReservedNameShadowRule,tr as ResourceNamingRule,kt as ResourceResolver,_t as ResourceTypeClassifier,ae as SHACL_PACKAGE,ie as SHACL_PUBLISHER,W as SH_NODE_SHAPE,se as SH_PROPERTY_SHAPE,tn as SH_SHAPE,dt as ScalarStatement,$r as SequenceNarrativeRule,Dr as ShaclShapeRule,ct as Statement,ut as StringStatement,fr as SubClassOfReferenceRule,mr as SubPropertyOfReferenceRule,S as SubjectKanonak,ir as SubjectKanonakTypeRequiredRule,le as TOKEN_ENV,je as TokenCredentialProvider,Ut as TripleStore,xr as TxExpressionCompilesRule,jr as TxExpressionPathRule,St as TypeResolver,wr as URI_DISPLAY_LABEL,Kr as URI_DISPLAY_SUMMARY,gr as UnresolvedPredicateRule,dr as UnresolvedReferenceRule,er as ValidationCache,Zt as ValidationContext,Yt as ValidationSeverity,Us as VersionOperator,ge as ViewMaterializer,ci as allowAllPolicy,Fo as assertHttpsUrl,on as assertIntegrityAsync,Zo as assertPackageIdentity,rt as buildLocalFirstRepository,Ir as buildOntologyModel,mo as buildReportPackageAsync,pe as buildShapesModel,Rt as builtinHomePackages,Pt as builtinUri,Wr as canonicalForm,qr as canonicalHash,Oe as carrierOf,ni as checkCredentialAnswer,$e as checkHelperAnswer,Me as checkHelperEraseAnswer,be as checkPackageUrlTemplate,Ee as checkPackageUrlTemplates,tt as collectKanonakFiles,oe as compareVersions,zn as computeIntegrity,nn as computeIntegrityAsync,Gr as contentAddressedName,G as contextTypesOf,ri as createCredentialedFetch,vo as createVersion,Hi as credentialProviderFromConfig,Mo as describeResponse,so as evaluateConformance,At as extractMarkdownLinks,Xo as fillPackageUrlTemplate,ai as findDerivation,Lt as findMalformedReferences,Wt as findMarkdownLinkAt,He as foldFlagsIntoPattern,zo as formatKanonakAddress,V as formatVersion,Io as getGlobalCachePath,Ho as getKanonakUserAgent,$o as httpError,xo as isCompatibleVersion,wo as isMajorCompatible,wt as isPropertySubject,Wo as kanonakFetch,Bn as loadLockFile,Ye as lockedVersion,me as lowerConstraint,Et as makeUriKey,Jr as narrowestScope,di as noopMeter,Qr as normalizeHost,Qo as packageUrlTemplateFor,Wi as packageUrlTemplatesFromConfig,Go as parseKanonakAddress,Ze as parseLockFile,Xr as parseScope,_o as parseVersionString,Ft as parseWithPositions,oi as parseWwwAuthenticate,No as pickHighestDocument,Kt as propertiesInScope,xt as propertyClassOf,Ar as readSequenceConnectors,Z as readUserConfig,Qt as referenceSpelling,M as referenceUris,Nr as resolveDisplayValue,Nt as resolvePropertyStep,jo as retryAfterSecondsOf,Ve as sanitizeName,Ko as satisfiesVersionOperator,Gn as saveLockFile,Yr as scopeContains,Xn as scopeFromCatalog,Yn as scopeFromDocumentAsync,Qn as scopeFromRepositoryAsync,en as serializeLockFile,qo as setKanonakFetchRetries,To as setKanonakUserAgent,Bt as sourceSymbolAt,qt as sourceSymbols,ko as splitCommandLine,Ne as subjectAddress,k as subjectUri,Le as superClassChain,Ur as supportedBandKeys,ii as tokenEnvKeyFor,bt as tripleKey,yt as typeReferenceUris,F as uriKey,Ct as uriTriple,J as userConfigPath,ue as valuesOf,Co as versionOperatorFromChar,Ro as versionOperatorToChar,Po as versionsEqual,Ae as walkDefinedKanonaks,Or as walkSequence};
1
+ import{a as Bt,b as Gt,c as zt,d as Yt,e as F}from"./chunk-DQGXJDQU.js";import{a as no,b as oo,c as to}from"./chunk-BDTJIUS4.js";import{a as Ft,b as Wt,c as qt,d as aa,e as ia,f as sa,g as ca,h as da,i as ua,j as De,k as la,l as Te,m as He,n as pa,o as fa,p as ma,q as fe,r as ha,s as Fe}from"./chunk-TF23WBSZ.js";import{a as ga}from"./chunk-IWPCPQQY.js";import{a as ea,b as na,c as oa,d as J,e as ta,f as ra,g as je,h as ka,i as ya,j as Sa,k as Ea,l as ba}from"./chunk-FS7UGDEX.js";import{a as Ho,b as Fo,c as Wo,d as qo,e as Bo,f as pt,g as ft,h as mt,i as ht}from"./chunk-K76UUREI.js";import{a as Xo,b as Jo,c as Zo,d as et,e as nt,f as ot,g as Ce,h as Re,i as ve,j as it,k as st,m as ct,n as tn,o as rn,p as an,q as sn,r as cn,s as dn,t as dt,u as lt}from"./chunk-Z2444SWM.js";import{a as Xt,b as Jt,c as Zt,d as er,e as nr,f as or}from"./chunk-OHF4RIKS.js";import{a as tr,b as ar}from"./chunk-LIN5SG5I.js";import{a as ut}from"./chunk-SC5M74NM.js";import{A as Or,B as Lr,C as Ir,D as Ur,E as Vr,F as $r,G as Gr,H as zr,I as Yr,J as Qr,K as Xr,L as Jr,M as Zr,a as ir,b as sr,c as cr,d as dr,e as ur,f as lr,g as pr,h as fr,i as mr,j as hr,k as gr,l as kr,m as yr,n as Sr,o as Er,p as br,q as Cr,r as Rr,s as vr,t as Pr,u as wr,v as _r,w as Kr,x as xr,y as Nr,z as Ar}from"./chunk-I2T6ORSG.js";import{a as Qn,b as Xn}from"./chunk-VJUZKHQU.js";import{c as Jn,d as Mr,e as jr,f as Dr,g as Tr,i as Hr,j as Fr,m as Wr,o as Me,q as Zn,s as eo,u as qr,v as Br}from"./chunk-CPENAANM.js";import"./chunk-QHABFCRC.js";import{a as Go,b as zo,c as Yo,d as Qo,e as I}from"./chunk-5FVUBF7N.js";import{a as be}from"./chunk-WXXZOJ4O.js";import{a as Ve,g as M,h as $e,i as Tt,j as Ht,k as j}from"./chunk-SBWD7EOG.js";import{a as W}from"./chunk-5ZRVFYCP.js";import{a as rr}from"./chunk-PEJALHXK.js";import{$ as ue,A as vn,B as Pn,C as wn,D as _n,E as Kn,F as xn,G as Nn,H as An,I as On,J as Ln,K as xe,L as In,M as Un,N as Vn,O as $n,P as Mn,Q as jn,R as Dn,S as Tn,T as Hn,U as Fn,V as Wn,W as qn,X as Bn,Y as Gn,Z as Ne,_ as zn,a as Kt,aa as Ae,b as xt,ba as Oe,c as B,ca as le,d as At,da as z,e as Ot,ea as Y,fa as pe,g as Lt,ga as Le,h as se,i as ce,j as ln,ja as It,k as G,ka as Ut,l as de,m as pn,ma as Vt,n as fn,o as _e,oa as $t,p as mn,pa as S,q as hn,qa as Ie,r as gn,ra as Mt,s as kn,sa as Ue,t as Ke,u as yn,v as Sn,va as jt,w as En,wa as Dt,x as bn,xa as H,y as Cn,z as Rn}from"./chunk-6WOPXTIL.js";import{B as T,C as A,D as ie,E as k,F as q,G as we,H as Q,I as X,K as Yn,a as gt,b as kt,c as g,d as U,e as x,f as yt,g as St,h as Et,i as bt,j as Ct,k as Rt,l as vt,m as Pt,n as wt,o as _t,p,s as Nt,t as D,u as Pe,v as un,w as ae,y as N}from"./chunk-LK5SHY4B.js";import"./chunk-F67UH4FD.js";import{a as Lo,b as Io,c as re,d as Uo,e as $,f as Vo,g as $o,h as Mo,i as jo,j as Do,k as To,l as rt,m as at}from"./chunk-GGK6A6QK.js";import{a as tt}from"./chunk-FUUTGGJS.js";import{a as Qt}from"./chunk-ODIECDN7.js";async function ro(n){let e=await new j().parseKanonaks(n);return{kind:"merged",catalog:e,reasoning:new F().reasonOver(e)}}async function ao(n,e){let t=new Set(n.map(We)),o=new Set,r=[];if(await Qn(n,e,{onDocument:l=>o.add(We(l)),onUnresolvedEdge:l=>r.push(l)}),r.length>0){let l=r.map(f=>`${f.fromNamespace} imports ${f.publisher}/${f.packageName} ${f.constraint} (${f.reason})`);throw new Error(`Cannot build the conformance scope: ${r.length} import(s) did not resolve:
2
+ ${l.join(`
3
+ `)}`)}let a=new Xn(e,o),d=new Set((await a.getAllDocumentsAsync()).map(We)),i=[...t].filter(l=>!d.has(l));if(i.length>0)throw new Error(`scopeFromClosureAsync: ${i.join(", ")} is not a document of the repository the closure is resolved through.`);let c={},u=await new j().parseKanonaks(a,c),s=new Set(c.authored.filter(l=>l instanceof g&&t.has(l.sourceDoc)).map(X));return{kind:"merged",catalog:u,reasoning:new F().reasonOver(u),focus:s}}function We(n){let e=n.metadata?.namespace_;if(!e)throw new Error("scopeFromClosureAsync: a document has no namespace, so it cannot be identified.");return e.toString()}function io(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function so(n,e){let t=e??new be(new W);return{kind:"standalone",catalog:await new j().parseKanonaks(new Yn(n,t))}}function V(n){return typeof n=="number"?n:void 0}function Ca(n){if(!n)return;let e=p(n);if(e===p(An))return"IRI";if(e===p(On))return"BlankNode";if(e===p(Ln))return"Literal"}function uo(n){if(!n)return;let e=p(n);if(e===p(In))return"Violation";if(e===p(Un))return"Warning";if(e===p(Vn))return"Info"}function lo(n,e,t,o){let r=k(e,_e);if(!r)return;let a={path:r},d=V(A(e,mn)),i=V(A(e,hn));d!==void 0&&(a.minCount=d),i!==void 0&&(a.maxCount=i);let c=V(A(e,En)),u=V(A(e,bn));c!==void 0&&(a.minLength=c),u!==void 0&&(a.maxLength=u);let s=V(A(e,Cn)),l=V(A(e,Rn));s!==void 0&&(a.minInclusive=s),l!==void 0&&(a.maxInclusive=l);let f=ie(e,yn);if(f!==void 0){let h=ie(e,Sn);a.pattern=h!==void 0?{regex:f,flags:h}:{regex:f}}if(T(e,Ke)){let h=[],K=[];for(let{item:E}of Pe(e,Ke))"literal"in E?h.push(E.value):E instanceof x&&K.push(E.subject);h.length>0&&(a.inValues=h),K.length>0&&(a.inRefs=K)}let m=k(e,gn);m&&(a.datatype=m);let v=k(e,kn);v&&(a.classRef=v);let y=Ca(k(e,Nn));y&&(a.nodeKind=y);let P=k(e,zn);if(P&&(a.hasValue=P),T(e,ue)||T(e,Ae)||T(e,Oe)){let h={},K=V(A(e,Ae)),E=V(A(e,Oe));K!==void 0&&(h.minCount=K),E!==void 0&&(h.maxCount=E);let O=Ra(n,e,o);"problem"in O?h.problem=O.problem:h.shape=O.shape,a.qualified=h}let w=ie(e,vn);w!==void 0&&(a.message=w);let _=uo(k(e,xe))??t;return _&&(a.severity=_),a}function Ra(n,e,t){let o=q(e,ue);if(o)return co(n,o,void 0,t);let r=k(e,ue);if(!r)return{problem:"sh:qualifiedValueShape is missing"};let a=p(r);if(t.has(a))return{problem:`sh:qualifiedValueShape '${r.name}' leads back to itself (a cycle through named shapes)`};let d=N(n,r);return d?co(n,d,a,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function co(n,e,t,o){let r=t?new Set([...o,t]):o,a=ae(e,G);if((ae(e,de)||T(e,_e))&&!a){let c=lo(n,e,void 0,r);return c?{shape:{kind:"property",constraint:c}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof g&&!a?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:po(n,e,r)}}}function po(n,e,t){let o=uo(k(e,xe)),r={name:e instanceof g?e.name:"(inline shape)",uri:e instanceof g?S(e):void 0,targetClass:k(e,pn),targetNodes:D(e,Pn),targetSubjectsOf:D(e,wn),targetObjectsOf:D(e,_n),closed:A(e,Kn)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...D(e,xn));for(let{item:a}of Pe(e,fn)){let d;if(a instanceof U?d=a:a instanceof x&&(d=N(n,a.subject)),!d)continue;let i=lo(n,d,o,t);i&&r.properties.push(i)}return r}function me(n){let e=[];for(let t of n){if(!(t instanceof g)||!ae(t,G))continue;let o=S(t);e.push(po(n,t,new Set(o?[p(o)]:[])))}return e}function he(n){let e=new Map;for(let t of n)if(t instanceof g)for(let o of un(t,Le)){let r=S(t);if(!r)throw new Error(`owl.hasKey on '${t.namespace}/${t.name}': the class has no resolvable URI.`);if(o.length===0)throw new Error(`owl.hasKey on '${t.name}' lists no properties; a key needs at least one.`);let a=o.map(({item:d})=>{let i=d instanceof x?N(n,d.subject):void 0;if(!i||!Ue(n,i)){let c=d instanceof x?`'${p(d.subject)}'`:"a value that is not a reference";throw new Error(`owl.hasKey on '${t.name}' lists ${c}, which is not a property defined in scope; a key lists properties.`)}return d.subject});e.set(`${p(r)}|${a.map(p).join(",")}`,{classUri:r,className:t.name,properties:a})}return[...e.values()]}var C="kanonak.org/transformations",Z="values";var ge="allowed",Be="expected",b=n=>({type:`${C}/VarRef`,varName:n}),qe=n=>({type:`${C}/IntegerLiteral`,integerLiteral:n}),va=n=>({type:`${C}/DecimalLiteral`,decimalLiteral:n}),fo=n=>Number.isInteger(n)?qe(n):va(n),mo=n=>({type:`${C}/Count`,source:n}),ho=(n,e)=>({type:`${C}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),go=(n,e)=>({type:`${C}/LessThanOrEqual`,compareLeft:n,compareRight:e});function Ge(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 ke(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:ho(mo(b(Z)),qe(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:go(mo(b(Z)),qe(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${C}/Contains`,haystack:b(Z),needle:b(Be)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${C}/Contains`,haystack:b(ge),needle:b("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${C}/Matches`,matchSource:b("v"),pattern:Ge(n.pattern.regex,n.pattern.flags)}}),n.minLength!==void 0&&e.push({component:"minLength",per:"value",expr:{type:`${C}/Matches`,matchSource:b("v"),pattern:`(?s)^.{${n.minLength},}$`}}),n.maxLength!==void 0&&e.push({component:"maxLength",per:"value",expr:{type:`${C}/Matches`,matchSource:b("v"),pattern:`(?s)^.{0,${n.maxLength}}$`}}),n.minInclusive!==void 0&&e.push({component:"minInclusive",per:"value",expr:ho(b("v"),fo(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:go(b("v"),fo(n.maxInclusive))}),e}import{evaluate as wa,ExpressionError as _a}from"@kanonak-protocol/expression";function So(n,e){let t=ko(e)?e:me(e),o=[],r=n.catalog.filter(i=>i instanceof g).map(ye),a=new Map;Ka(r,a);let d={scope:n,membership:new Ye(n),embeddedFocus:a};for(let i of t)for(let c of xa(d,i,r))ze(n,c)&&bo(d,i,c,o);if(!ko(e))for(let i of he(e))Na(d,i,r,o);return{conforms:!o.some(i=>i.severity==="Violation"),results:o}}function ko(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function Eo(n){let e=n.predicate;return e instanceof x?e:void 0}function ze(n,e){return!n.focus||e.subject!==void 0&&n.focus.has(e.subject)}function ye(n){let e=X(n);return{node:n,key:e,uri:S(n),subject:e,label:n.name}}function Xe(n,e,t){return{node:n,key:e,subject:t,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function Ka(n,e){for(let t of n)Ve([t.node],({kanonak:o,address:r})=>{o instanceof U&&!e.has(o)&&e.set(o,Xe(o,r,t.subject))})}var Ye=class{constructor(e){this.scope=e}scope;ancestors=new Map;isInstance(e,t){let o=p(t);return e.some(r=>p(r)===o||this.ancestorsOf(r).has(o))}ancestorsOf(e){let t=e.version&&typeof e.version.major=="number"?`${p(e)}@${$(e.version)}`:p(e),o=this.ancestors.get(t);return o||(o=this.scope.reasoning?new Set(this.scope.reasoning.getSuperclasses(e)):new Set(Ie(this.scope.catalog,e).map(r=>p(r))),this.ancestors.set(t,o)),o}};function xa(n,e,t){let{scope:o}=n,r=new Map,a=i=>{r.set(i.key,i)},d=()=>[...t,...n.embeddedFocus.values()];if(e.targetClass){let i=e.targetClass;for(let c of d())n.membership.isInstance(H(c.node),i)&&a(c)}for(let i of e.targetNodes){let c=N(o.catalog,i);c instanceof g&&a(ye(c))}for(let i of e.targetSubjectsOf){let c=p(i);for(let u of d())u.node.statement.some(s=>{let l=Eo(s);return l&&p(l.subject)===c})&&a(u)}for(let i of e.targetObjectsOf)for(let c of d())for(let u of Q(c.node,i,o.catalog,c.key))u.kind==="subject"?a(ye(u.node)):u.kind==="embedded"&&a(n.embeddedFocus.get(u.node)??Xe(u.node,u.address,c.subject));return[...r.values()]}function Na(n,e,t,o){let r=new Map;for(let c of t)n.membership.isInstance(H(c.node),e.classUri)&&r.set(c.key,c);let a=[];for(let c of[...r.values()].sort((u,s)=>u.key<s.key?-1:u.key>s.key?1:0)){let u=e.properties.map(s=>Aa(n,c,s));u.every(s=>s.size>0)&&a.push({focus:c,values:u})}let d=new Map;a.forEach(({values:c},u)=>{for(let s of c[0].keys()){let l=d.get(s);l?l.push(u):d.set(s,[u])}});let i=new Set;for(let c of d.values())for(let u=0;u<c.length;u++)for(let s=u+1;s<c.length;s++){let l=`${c[u]}:${c[s]}`;if(i.has(l))continue;let f=a[c[u]],m=a[c[s]],v=f.values.map((_,h)=>[..._.keys()].find(K=>m.values[h].has(K)));if(v.some(_=>_===void 0))continue;i.add(l);let[y,P]=ze(n.scope,f.focus)?[f.focus,m.focus]:ze(n.scope,m.focus)?[m.focus,f.focus]:[void 0,void 0];if(!y||!P)continue;let w=e.properties.map((_,h)=>`${_.name} = ${f.values[h].get(v[h])}`).join(", ");o.push({focusNode:y.key,focusUri:y.uri,valueRef:P.uri,constraintComponent:pe,severity:"Violation",message:`'${y.label}' and '${P.label}' are distinct instances of ${e.className} with the same key (${w}); its owl.hasKey makes the key unique.`})}}function Aa(n,e,t){let o=new Map;for(let r of Q(e.node,t,n.scope.catalog,e.key))switch(r.kind){case"subject":case"unresolved":o.set(`ref:${p(r.uri)}`,r.uri.name);break;case"literal":o.set(`${typeof r.value}:${String(r.value)}`,JSON.stringify(r.value));break;case"embedded":break}return o}function Oa(n,e,t){return e.node?Q(e.node,t,n.scope.catalog,e.key).map(o=>La(n,o,e.subject)):[]}function La(n,e,t){switch(e.kind){case"subject":return{kernel:{ref:p(e.uri)},kind:"reference",ref:e.uri,subject:e.node};case"unresolved":return{kernel:{ref:p(e.uri)},kind:"reference",ref:e.uri};case"embedded":{let o=n.embeddedFocus.get(e.node)??Xe(e.node,e.address,t);return{kernel:{ref:o.key},kind:"embedded",embedded:o}}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 bo(n,e,t,o){for(let r of e.properties)Ro(n,e,t,r,o);e.closed&&Wa(e,t,o)}function Qe(n,e,t,o,r={},a){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:a??Co(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function Co(n){return n.severity??"Violation"}var Ia={minCount:$n,maxCount:Mn,hasValue:le,in:Tn,pattern:Hn,minLength:Fn,maxLength:Wn,minInclusive:qn,maxInclusive:Bn};function Ro(n,e,t,o,r){let a=Oa(n,t,o.path),d=o.severity??Co(e),i=o.path.name,c=[...(o.inValues??[]).map(s=>typeof s=="boolean"?s?1:0:s),...(o.inRefs??[]).map(s=>({ref:p(s)}))],u=(s,l,f)=>{let m=Qe(e,t,s,o.message??l,{resultPath:o.path,value:f?.literal,valueRef:f?.ref},d);return r.push(m),m};for(let s of ke(o)){let l=Ia[s.component];if(s.per==="node"){let f={[Z]:a.map(m=>m.kernel),[ge]:c};o.hasValue&&(f[Be]={ref:p(o.hasValue)}),yo(s,f)||u(l,Ua(s,i,o,a.length));continue}for(let f of a){if((s.component==="pattern"||s.component==="minLength"||s.component==="maxLength")&&f.kind!=="string"){u(l,`'${i}' value is not a string; ${s.component} applies to string values.`,f);continue}yo(s,{v:f.kernel,[ge]:c})||u(l,Da(s,i,o,f),f)}}if(o.nodeKind)for(let s of a)Ta(o.nodeKind,s)||u(Gn,`'${i}' value is ${s.kind}; nodeKind requires ${o.nodeKind}.`,s);if(o.datatype)for(let s of a){let l=Ha(o.datatype,s);l&&u(jn,`'${i}' ${l}`,s)}if(o.classRef)for(let s of a){let l=Fa(n,o.classRef,s);l&&u(Dn,`'${i}' ${l}`,s)}o.qualified&&Va(n,o,a,i,u)}function Ua(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?p(t.hasValue):"(unset)"}.`;default:return`'${e}' violates ${n.component}.`}}function Va(n,e,t,o,r){let a=e.qualified,d=a.maxCount!==void 0?Y:z,i=(u,s)=>{vo.add(r(d,u,s))};if(!a.shape){i(`'${o}' qualified value shape cannot be evaluated: ${a.problem??"it could not be built"}.`);return}let c=0;for(let u of t){let s=u.ref?p(u.ref):u.embedded?u.embedded.label:JSON.stringify(u.literal),l=$a(n,u);if(!l){i(`'${o}' value ${s} does not resolve in this scope; whether it conforms to the qualified shape cannot be decided.`,u);continue}let f=ja(n,a.shape,l);if(f.kind==="undecided"){i(`'${o}' value ${s}: whether it conforms to the qualified shape cannot be decided \u2014 ${f.reason}`,u);continue}f.kind==="conforms"&&c++}a.minCount!==void 0&&c<a.minCount&&r(z,`'${o}' has ${c} value(s) that conform to the qualified shape; qualifiedMinCount is ${a.minCount}.`),a.maxCount!==void 0&&c>a.maxCount&&r(Y,`'${o}' has ${c} value(s) that conform to the qualified shape; qualifiedMaxCount is ${a.maxCount}.`)}function $a(n,e){switch(e.kind){case"reference":return e.subject?ye(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var Ma={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},vo=new WeakSet;function ja(n,e,t){let o=[];e.kind==="property"?Ro(n,Ma,t,e.constraint,o):bo(n,e.shape,t,o);let r=o.find(a=>vo.has(a));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function Da(n,e,t,o){let r=o.ref?p(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 yo(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 _a(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return wa(n.expr,void 0,t)===1}function Ta(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 Ha(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 M.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case M.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 M.Decimal:case M.Double:case M.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 Fa(n,e,t){if(t.kind==="embedded"&&t.embedded?.node){let r=H(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}.`;let o=t.subject;return o?n.membership.isInstance(H(o),e)?void 0:`value ${p(t.ref)} is not an instance of ${e.name}.`:`value ${p(t.ref)} does not resolve in this scope (sh:class ${e.name}).`}function Wa(n,e,t){if(!e.node)return;let o=new Set([...n.properties.map(a=>p(a.path)),...n.ignoredProperties.map(a=>p(a))]),r=new Set;for(let a of e.node.statement){let d=Eo(a);if(!d)continue;let i=p(d.subject);o.has(i)||r.has(i)||(r.add(i),t.push(Qe(n,e,Ne,`'${e.label}' carries undeclared property '${d.subject.name}' (closed shape).`,{resultPath:d.subject})))}for(let a of e.node.unresolvedPredicates)r.has(a.key)||(r.add(a.key),t.push(Qe(n,e,Ne,`'${e.label}' carries unresolvable property '${a.key}' (closed shape).`,{value:a.key})))}var qa="1.1.0",Ba=new Set([le,z,Y].map(n=>n.name)),Ga=new Set([pe].map(n=>n.name));function za(n){let e=new Set(n.results.map(t=>t.constraintComponent.name));return[...e].some(t=>Ga.has(t))?"1.3.0":[...e].some(t=>Ba.has(t))?"1.2.0":qa}async function Po(n){let e=new J(n.repository),t=e.imports(),o=t.ensure(se,ce,za(n.result),"sh"),r=(i,c)=>i&&i.version&&typeof i.version.major=="number"?`${t.ensure(i.publisher,i.package_,$(i.version),i.package_)}.${i.name}`:c,a={},d=[];return n.result.results.forEach((i,c)=>{let u=`result-${c+1}`;d.push(u);let s={type:`${o}.ValidationResult`,[`${o}.focusNode`]:r(i.focusUri,i.focusNode),[`${o}.resultMessage`]:i.message,[`${o}.resultSeverity`]:`${o}.${i.severity}`,[`${o}.sourceConstraintComponent`]:`${o}.${i.constraintComponent.name}`};i.resultPath&&(s[`${o}.resultPath`]=r(i.resultPath,p(i.resultPath))),i.sourceShapeUri&&i.sourceShape!==void 0&&(s[`${o}.sourceShape`]=r(i.sourceShapeUri,i.sourceShape)),i.valueRef?s[`${o}.value`]=r(i.valueRef,p(i.valueRef)):i.value!==void 0&&(s[`${o}.value`]=i.value),a[u]=s}),a.report={type:`${o}.ValidationReport`,[`${o}.conforms`]:n.result.conforms,...d.length>0?{[`${o}.result`]:d}:{}},e.buildContentAddressed({publisher:n.publisher,book:t,body:a,...n.header!==void 0?{header:n.header}:{},contentHashProperty:"contentHash"})}import{VersionOperator as Zs}from"@kanonak-protocol/types/document/models/enums";import{spawn as Ya}from"child_process";var _o=12e4,Qa=4096,ee=class{argv;interactive;timeoutMs;stderr;now;constructor(e){this.argv=Ko(e.command),this.interactive=e.interactive??!1,this.timeoutMs=e.timeoutMs??_o,this.stderr=e.stderr??process.stderr,this.now=e.nowSeconds??(()=>Date.now()/1e3)}get command(){return this.argv.join(" ")}async get(e){let t=await this.run("get",this.wireRequest("get",e)),o=Te(e,t,this.now());if(!o.ok)throw new I(`credential helper '${this.command}' answered get for ${e.resource} outside the protocol (${o.problem}): ${o.message}`);return o.answer}async erase(e){let t=await this.run("erase",{...this.wireRequest("erase",e),scope:e.scope}),o=He(t);if(!o.ok)throw new I(`credential helper '${this.command}' answered erase for ${e.resource} outside the protocol (${o.problem}): ${o.message}`)}wireRequest(e,t){let o={version:De,operation:e,resource:t.resource,method:t.method};return t.challenges&&(o.challenges=t.challenges),o.interactive=this.interactive,o}run(e,t){let o=`credential helper '${this.command}' ${e}`;return new Promise((r,a)=>{let d=!1,i=m=>{d||(d=!0,m())},c;try{c=Ya(this.argv[0],[...this.argv.slice(1),e],{stdio:["pipe","pipe","pipe"],shell:!1,windowsHide:!0})}catch(m){a(wo(o,m));return}let u=[],s="",l=!1,f=setTimeout(()=>{l=!0,c.kill()},this.timeoutMs);c.stdout.on("data",m=>u.push(m)),c.stderr.on("data",m=>{this.stderr.write(m),s=(s+m.toString("utf8")).slice(-Qa)}),c.on("error",m=>{clearTimeout(f),i(()=>a(wo(o,m)))}),c.on("close",(m,v)=>{clearTimeout(f);let y=s.trim()?`: ${s.trim()}`:"";if(l){i(()=>a(new I(`${o} did not finish within ${Math.round(this.timeoutMs/1e3)}s${y}`)));return}if(m!==0){let w=m!==null?`exit ${m}`:`signal ${v}`;i(()=>a(new I(`${o} failed (${w})${y}`)));return}let P=Buffer.concat(u).toString("utf8").trim();try{let w=JSON.parse(P);i(()=>r(w))}catch{i(()=>a(new I(`${o} exited 0 without printing one JSON answer${y}`)))}}),c.stdin.on("error",()=>{}),c.stdin.end(`${JSON.stringify(t)}
4
+ `)})}};function Ko(n){let e=n.trim().split(/\s+/).filter(t=>t!=="");if(e.length===0)throw new Error("the credential helper command is empty");return e}function wo(n,e){let t=e.code,o="";return t==="ENOENT"&&(o=" (not found: give its path, or put it on PATH)"),t==="EINVAL"&&process.platform==="win32"&&(o=" (a .cmd or .bat file cannot run without a shell: configure an executable, e.g. `node path/to/helper.js`)"),new I(`${n} could not be started: ${e.message}${o}`)}import{existsSync as Xa,readFileSync as Ja}from"fs";import{homedir as Za}from"os";import{join as ei}from"path";function ne(){return ei(Za(),".kanonak","config.json")}function oe(n){if(!Xa(n))return;let e;try{e=JSON.parse(Ja(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`${n} must hold a JSON object`);return e}var Je="KANONAK_CREDENTIAL_HELPER";function ni(n={}){let e=n.env??process.env,t=n.configPath??ne(),o=oi(e,t);if(o){let a=Object.keys(e).filter(d=>(d===fe||d.startsWith(`${fe}_`))&&(e[d]??"").trim()!=="").sort();if(a.length>0)throw new Error(`A credential helper is configured (${o.source}: ${o.command}) and so is ${a.join(", ")}. Configure one or the other.`);return new ee({command:o.command,interactive:n.interactive??!1})}let r={env:e};return n.discovery&&(r.discovery=n.discovery),new Fe(r)}function oi(n,e){let t=(n[Je]??"").trim();if(t)return{command:t,source:Je};let o=oe(e)?.credentialHelper;if(o!==void 0){if(typeof o!="string"||o.trim()==="")throw new Error(`"credentialHelper" in ${e} must be a non-empty command line`);return{command:o.trim(),source:e}}}var Ze="KANONAK_PACKAGE_URL_TEMPLATE";function ti(n={}){let e=n.env??process.env,t=n.configPath??ne(),o=oe(t)?.packageUrlTemplates,r=o===void 0?{}:{...Re(o,"packageUrlTemplates",t)},a=(e[Ze]??"").trim();return a&&(r[Ce]=ve(a,Ze,!0)),Object.keys(r).length>0?Object.freeze(r):void 0}var R="kanonak.org",L="view",xo="core-kanonak",ri={publisher:R,package_:L,name:"rootView"},ai={publisher:R,package_:L,name:"bind"},ii={publisher:R,package_:L,name:"produces"},si={publisher:R,package_:L,name:"projections"},ci={publisher:R,package_:L,name:"where"},di={publisher:R,package_:L,name:"value"},ui={publisher:R,package_:L,name:"as"},Se=class{constructor(e,t=new W){this.repository=e;this.parser=t;this.objectParser=new j(this.parser),this.builder=new J(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=k(r,ai);if(!a)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let d=k(r,ii);if(!d)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 i=li(r),c=No(o,R,xo),u=No(o,R,L),s=this.builder.imports(),l=s.ensure(R,xo,c,"ck"),f=s.ensure(R,L,u,"v"),m=s.ref(d),v=new eo(this.repository,this.parser,this.objectParser),y=new Zn(v,o),P=this.readProjections(o,r),w=mi(r,ci),_=this.findInstances(o,a,await this.reason(t)),h={},K=new Set;for(let te of _){if(!await this.passesWhere(y,o,w,te))continue;let Ee={type:m};for(let nn of P){let Oo=await this.evaluateValue(y,o,nn.value,te),on=this.builder.serializeValue(Ao(Oo),s);on!==void 0&&(Ee[s.ref(nn.as)]=on)}let en=S(te);en&&(Ee[`${f}.derivedFrom`]=s.ref(en)),h[this.rowName(te,K)]=Ee}let E={};t.resolvedAt&&(E[`${l}.resolvedAt`]=t.resolvedAt),t.invocationId&&(E[`${l}.id`]=t.invocationId);let O=await this.builder.buildContentAddressed({publisher:i,book:s,body:h,contentHashProperty:`${l}.contentHash`,header:E});return{yaml:O.yaml,contentHash:O.contentHash,packageName:O.packageName,publisher:O.publisher,rowCount:O.resourceCount}}resolveView(e,t){let o=N(e,t);if(!o)throw new Error(`View ${t.publisher}/${t.package_}/${t.name} not found in the catalog.`);let r=k(o,ri);if(r){let a=N(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 we(t,si)){let a=r instanceof U?r:r instanceof x?N(e,r.subject):void 0;if(!a)continue;let d=q(a,di),i=k(a,ui);d&&i&&o.push({value:d,as:i})}return o}async reason(e){return new F({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,t,o){let r=fi(e),a=[],d=new Set;for(let i of o.getInstancesOfClass(t)){if(d.has(i))continue;d.add(i);let c=r.get(i);c&&a.push(c)}return a.sort((i,c)=>{let u=B(S(i)),s=B(S(c));return u<s?-1:u>s?1:0}),a}async passesWhere(e,t,o,r){for(let a of o){let d=await this.evaluateValue(e,t,a,r);if(!hi(d))return!1}return!0}async evaluateValue(e,t,o,r){let a=Jn(o,"view-projection",{catalog:t,depth:0}),d=new Map([["input",r]]);return e.evaluate(a,d)}rowName(e,t){let o=je(e.name)||"row",r=o,a=2;for(;t.has(r);)r=`${o}-${a++}`;return t.add(r),r}};function Ao(n){return Me(n)?n.value:Array.isArray(n)?n.map(Ao):n}function li(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 No(n,e,t){let o=pi(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 pi(n,e,t){let o;for(let r of n){if(!(r instanceof g))continue;let a=S(r);!a||a.publisher!==e||a.package_!==t||!a.version||(!o||re(a.version,o)>0)&&(o=a.version)}return o?$(o):void 0}function fi(n){let e=new Map,t=new Map;for(let o of n){if(!(o instanceof g))continue;let r=S(o);if(!r||!r.version)continue;let a=B(r),d=t.get(a);(!d||re(r.version,d)>0)&&(t.set(a,r.version),e.set(a,o))}return e}function mi(n,e){let t=q(n,e);return t?[t]:we(n,e).filter(o=>o instanceof U)}function hi(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Me(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{Ce as ANY_PUBLISHER,_r as AmbiguousReferenceRule,Rt as BooleanStatement,oa as CANONICAL_FORM_VERSION,fa as CREDENTIAL_EXPIRY_SKEW_SECONDS,Je as CREDENTIAL_HELPER_ENV,De as CREDENTIAL_HELPER_PROTOCOL_VERSION,_o as CREDENTIAL_HELPER_TIMEOUT_MS,M as Carrier,Lr as ClassDefinitionRule,Er as ClassHierarchyCycleRule,Wo as CompositeKanonakDocumentRepository,I as CredentialError,da as DEFAULT_CONSENT_BINDING_PARAM,kt as DefinedKanonak,Jr as DiamondNameClashRule,Ur as DisplayLensScopeRule,Fo as DocumentLocation,Wt as EdgeType,U as EmbeddedKanonak,kr as EmbeddedKanonakTypeRule,Pt as EmbeddedStatement,Ea as EntitlementDeniedError,ba as EntitlementProducer,ee as ExecCredentialProvider,Ho as FileSystemKanonakDocumentRepository,Qt as GitIgnoreFilter,qt as GraphBuilder,lt as HttpKanonakDocumentRepository,rn as INTEGRITY_PREFIX,ra as ImportBook,yr as ImportExistenceRule,be as InMemoryKanonakDocumentRepository,Xo as KANONAK_USER_AGENT,gt as Kanonak,Jt as KanonakDocumentPositions,Go as KanonakHttpError,j as KanonakObjectParser,Zr as KanonakObjectValidator,W as KanonakParser,tt as KanonakUri,tr as KanonakUriBuilder,rr as KanonakUrlResolver,Vt as KanonakVocabulary,Tr as LINE_STYLES,lr as LinkTargetRule,wt as ListStatement,yt as LiteralKanonak,pt as LocalFirstRepository,ft as LockAwareRepository,zr as LookBandPathRule,qr as LookRenderer,Vr as LookSemanticSvgPathRule,Ir as MarkdownLinkRule,_t as MarkdownStatement,Pr as NamespaceImportCycleRule,pr as NamespacePrefixRule,Ft as NodeType,Ct as NumberStatement,ua as OAuthDiscovery,Le as OWL_HAS_KEY,zt as OWL_RL_CLASSIFICATION_RULES,xr as ObjectPropertyValueValidationRule,cr as OntologyValidationError,ir as OntologyValidationResult,Xr as OwlOneOfRule,Ze as PACKAGE_URL_TEMPLATE_ENV,J as PackageBuilder,gr as PackageHeaderRule,ka as ProducerRepository,Nr as PropertyDomainRule,br as PropertyHierarchyCycleRule,Ar as PropertyKindRangeConsistencyRule,Xt as PropertyMetadata,Kr as PropertyRangeReferenceRule,Cr as PropertyRangeRequiredRule,mr as PropertyTypeSpecificityRule,ct as PublisherConfigResolver,dt as PublisherIndex,Gt as RDFS_RULES,F as Reasoner,Yt as ReasoningResult,x as ReferenceKanonak,vt as ReferenceStatement,Bo as RepositoryFactory,Or as ReservedNameShadowRule,fr as ResourceNamingRule,Kt as ResourceResolver,$t as ResourceTypeClassifier,ce as SHACL_PACKAGE,se as SHACL_PUBLISHER,G as SH_NODE_SHAPE,de as SH_PROPERTY_SHAPE,ln as SH_SHAPE,Et as ScalarStatement,Gr as SequenceNarrativeRule,Qr as ShaclShapeRule,St as Statement,bt as StringStatement,Rr as SubClassOfReferenceRule,vr as SubPropertyOfReferenceRule,g as SubjectKanonak,hr as SubjectKanonakTypeRequiredRule,fe as TOKEN_ENV,Fe as TokenCredentialProvider,Bt as TripleStore,$r as TxExpressionCompilesRule,Yr as TxExpressionPathRule,xt as TypeResolver,Mr as URI_DISPLAY_LABEL,jr as URI_DISPLAY_SUMMARY,wr as UnresolvedPredicateRule,Sr as UnresolvedReferenceRule,ur as ValidationCache,dr as ValidationContext,sr as ValidationSeverity,Zs as VersionOperator,Se as ViewMaterializer,ya as allowAllPolicy,et as assertHttpsUrl,dn as assertIntegrityAsync,ut as assertPackageIdentity,he as buildKeysModel,ht as buildLocalFirstRepository,Wr as buildOntologyModel,Po as buildReportPackageAsync,me as buildShapesModel,It as builtinHomePackages,Ut as builtinUri,ea as canonicalForm,na as canonicalHash,$e as carrierOf,la as checkCredentialAnswer,Te as checkHelperAnswer,He as checkHelperEraseAnswer,ve as checkPackageUrlTemplate,Re as checkPackageUrlTemplates,mt as collectKanonakFiles,re as compareVersions,to as computeIntegrity,cn as computeIntegrityAsync,ta as contentAddressedName,H as contextTypesOf,ma as createCredentialedFetch,Vo as createVersion,ni as credentialProviderFromConfig,Yo as describeResponse,So as evaluateConformance,Ht as extractMarkdownLinks,st as fillPackageUrlTemplate,ga as findDerivation,Tt as findMalformedReferences,er as findMarkdownLinkAt,Ge as foldFlagsIntoPattern,at as formatKanonakAddress,$ as formatVersion,qo as getGlobalCachePath,Zo as getKanonakUserAgent,zo as httpError,Mo as isCompatibleVersion,jo as isMajorCompatible,Ue as isPropertySubject,nt as kanonakFetch,no as loadLockFile,tn as lockedVersion,ke as lowerConstraint,At as makeUriKey,ca as narrowestScope,Sa as noopMeter,aa as normalizeHost,it as packageUrlTemplateFor,ti as packageUrlTemplatesFromConfig,rt as parseKanonakAddress,an as parseLockFile,ia as parseScope,$o as parseVersionString,Zt as parseWithPositions,pa as parseWwwAuthenticate,To as pickHighestDocument,jt as propertiesInScope,Mt as propertyClassOf,Hr as readSequenceConnectors,oe as readUserConfig,ar as referenceSpelling,D as referenceUris,Dr as resolveDisplayValue,Dt as resolvePropertyStep,Qo as retryAfterSecondsOf,je as sanitizeName,Do as satisfiesVersionOperator,oo as saveLockFile,sa as scopeContains,io as scopeFromCatalog,ao as scopeFromClosureAsync,so as scopeFromDocumentAsync,ro as scopeFromRepositoryAsync,sn as serializeLockFile,ot as setKanonakFetchRetries,Jo as setKanonakUserAgent,or as sourceSymbolAt,nr as sourceSymbols,Ko as splitCommandLine,X as subjectAddress,S as subjectUri,Ie as superClassChain,Br as supportedBandKeys,ha as tokenEnvKeyFor,Ot as tripleKey,Nt as typeReferenceUris,B as uriKey,Lt as uriTriple,ne as userConfigPath,Q as valuesOf,Lo as versionOperatorFromChar,Io as versionOperatorToChar,Uo as versionsEqual,Ve as walkDefinedKanonaks,Fr as walkSequence};
@@ -94,11 +94,17 @@ export interface StylesheetExplanation {
94
94
  /** Human-readable warnings: condition, consequence, and fix. */
95
95
  readonly warnings: readonly string[];
96
96
  }
97
- /** An expression carrier that failed to compile during a render (#107 A1). */
97
+ /**
98
+ * An expression carrier that failed during a render: it did not compile
99
+ * (#107 A1), or it compiled and failed to evaluate, e.g. a part with no value
100
+ * (#133).
101
+ */
98
102
  export interface ExpressionCarrierFailure {
99
103
  /** Which carrier slot it was — e.g. `look.semanticSvg tier`. */
100
104
  readonly carrier: string;
101
- /** The loader's own message, naming the unrecognized node. */
105
+ /** Whether the expression did not compile, or failed to evaluate. */
106
+ readonly stage: 'compile' | 'evaluate';
107
+ /** The loader's or the engine's own message, naming the node at fault. */
102
108
  readonly reason: string;
103
109
  }
104
110
  export declare class LookRenderer {
@@ -149,8 +155,8 @@ export declare class LookRenderer {
149
155
  */
150
156
  expressionFailures(): readonly ExpressionCarrierFailure[];
151
157
  /**
152
- * Record a carrier compile failure and return the comment to emit in its
153
- * place. Visible three ways: in the page (View Source), in the render
158
+ * Record a carrier failure and return the comment to emit in its place.
159
+ * Visible three ways: in the page (View Source), in the render
154
160
  * diagnostics, and — because the message names the carrier and the reason
155
161
  * — actionable without a debugger.
156
162
  */
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f,e as g,f as h}from"../chunk-FB5QKDNM.js";import{k as b}from"../chunk-LKJVNKCN.js";import{a}from"../chunk-5ZRVFYCP.js";import"../chunk-WXUMROTA.js";import"../chunk-PC3MYDGL.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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};
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h}from"../chunk-OHF4RIKS.js";import{k as b}from"../chunk-SBWD7EOG.js";import{a}from"../chunk-5ZRVFYCP.js";import"../chunk-6WOPXTIL.js";import"../chunk-LK5SHY4B.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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};
@@ -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-7TNZ7ICK.js";import"../chunk-QHABFCRC.js";import"../chunk-LKJVNKCN.js";import"../chunk-5ZRVFYCP.js";import"../chunk-WXUMROTA.js";import"../chunk-PC3MYDGL.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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
+ 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-FS7UGDEX.js";import"../chunk-QHABFCRC.js";import"../chunk-SBWD7EOG.js";import"../chunk-5ZRVFYCP.js";import"../chunk-6WOPXTIL.js";import"../chunk-LK5SHY4B.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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};
@@ -2,6 +2,14 @@ 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
4
  import type { EntityUri } from '../uri-helpers/UriHelpers.js';
5
+ /**
6
+ * `owl:hasKey` (core-owl 2.1.0+): the properties whose values jointly identify
7
+ * an instance of a class. A role binding, not a reserved built-in term, so it
8
+ * is deliberately NOT in `BUILTIN_HOMES` (`hasKey` is a plausible local name).
9
+ * Exported as an `EntityUri` so a consumer reads a class's key by identity:
10
+ * `referenceUris(classSubject, OWL_HAS_KEY)` (kanonak-protocol/typescript#136).
11
+ */
12
+ export declare const OWL_HAS_KEY: EntityUri;
5
13
  /**
6
14
  * True when `name` is a reserved built-in term (an RDF/RDFS/OWL/Kanonak
7
15
  * structural predicate, annotation, class, or datatype — see
@@ -103,6 +111,7 @@ export declare class KanonakVocabulary implements Vocabulary {
103
111
  readonly objectProperty: string;
104
112
  readonly datatypeProperty: string;
105
113
  readonly annotationProperty: string;
114
+ readonly hasKey: string;
106
115
  readonly package_: string;
107
116
  readonly shape: string;
108
117
  readonly nodeShape: string;
@@ -1,4 +1,5 @@
1
1
  import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
2
+ import { Kanonak } from '../kanonaks/Kanonak.js';
2
3
  import type { Vocabulary } from './Vocabulary.js';
3
4
  import { ReasoningResult } from './ReasoningResult.js';
4
5
  /**
@@ -49,6 +50,11 @@ export declare class Reasoner {
49
50
  private readonly maxIterations;
50
51
  constructor(options?: ReasonerOptions);
51
52
  reason(repository: IKanonakDocumentRepository): Promise<ReasoningResult>;
53
+ /**
54
+ * Reason over a catalog the caller has already parsed (`parseKanonaks`), so
55
+ * a caller holding the catalog does not parse the repository a second time.
56
+ */
57
+ reasonOver(kanonaks: Kanonak[]): ReasoningResult;
52
58
  /**
53
59
  * Emit triples from a single statement on a subject.
54
60
  *
@@ -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, builtinUri, builtinHomePackages } from './KanonakVocabulary.js';
25
+ export { KanonakVocabulary, OWL_HAS_KEY, 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';
@@ -1 +1 @@
1
- import{a as i,b as j,c as k,d as l,e as m}from"../chunk-AAYMTPG7.js";import"../chunk-LKJVNKCN.js";import"../chunk-5ZRVFYCP.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-WXUMROTA.js";import"../chunk-PC3MYDGL.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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
+ import{a as j,b as k,c as l,d as m,e as n}from"../chunk-DQGXJDQU.js";import"../chunk-SBWD7EOG.js";import"../chunk-5ZRVFYCP.js";import{c as a,d as b,e as c,g as d,ga as e,ja as f,ka as g,la as h,ma as i}from"../chunk-6WOPXTIL.js";import"../chunk-LK5SHY4B.js";import"../chunk-F67UH4FD.js";import"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.js";export{i as KanonakVocabulary,e as OWL_HAS_KEY,l as OWL_RL_CLASSIFICATION_RULES,k as RDFS_RULES,n as Reasoner,m as ReasoningResult,j as TripleStore,f as builtinHomePackages,g as builtinUri,h as canonicalizeBuiltinUri,b as makeUriKey,c as tripleKey,a as uriKey,d as uriTriple};
@@ -1 +1 @@
1
- import{a as F,b as H}from"../chunk-X4V6DEZL.js";import{a as r}from"../chunk-SC5M74NM.js";import{a as G}from"../chunk-PEJALHXK.js";import{a as s,b as t,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-WXUMROTA.js";import"../chunk-PC3MYDGL.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,l as p,m as q}from"../chunk-GGK6A6QK.js";import{a as o}from"../chunk-FUUTGGJS.js";export{l as IMPORT_MODES,o as KanonakUri,F as KanonakUriBuilder,G as KanonakUrlResolver,s as ResourceResolver,v as ResourceTypeClassifier,t as TypeResolver,r as assertPackageIdentity,c as compareVersions,E as contextTypesOf,u as corePropertyClassOf,f as createVersion,q 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,p 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};
1
+ import{a as F,b as H}from"../chunk-LIN5SG5I.js";import{a as r}from"../chunk-SC5M74NM.js";import{a as G}from"../chunk-PEJALHXK.js";import{a as s,b as t,na as u,oa as v,pa as w,qa as x,ra as y,sa as z,ta as A,ua as B,va as C,wa as D,xa as E}from"../chunk-6WOPXTIL.js";import"../chunk-LK5SHY4B.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,l as p,m as q}from"../chunk-GGK6A6QK.js";import{a as o}from"../chunk-FUUTGGJS.js";export{l as IMPORT_MODES,o as KanonakUri,F as KanonakUriBuilder,G as KanonakUrlResolver,s as ResourceResolver,v as ResourceTypeClassifier,t as TypeResolver,r as assertPackageIdentity,c as compareVersions,E as contextTypesOf,u as corePropertyClassOf,f as createVersion,q 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,p 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};
@@ -1,4 +1,4 @@
1
- import"../chunk-X4V6DEZL.js";import"../chunk-SC5M74NM.js";import{f as g}from"../chunk-GXEKJFXG.js";import"../chunk-QHABFCRC.js";import"../chunk-WXXZOJ4O.js";import"../chunk-LKJVNKCN.js";import"../chunk-5ZRVFYCP.js";import"../chunk-PEJALHXK.js";import{na as m,va as S}from"../chunk-WXUMROTA.js";import{c as v,p,x as E}from"../chunk-PC3MYDGL.js";import"../chunk-F67UH4FD.js";import{c as x}from"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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.
1
+ import"../chunk-LIN5SG5I.js";import"../chunk-SC5M74NM.js";import{f as g}from"../chunk-CPENAANM.js";import"../chunk-QHABFCRC.js";import"../chunk-WXXZOJ4O.js";import"../chunk-SBWD7EOG.js";import"../chunk-5ZRVFYCP.js";import"../chunk-PEJALHXK.js";import{pa as m,xa as S}from"../chunk-6WOPXTIL.js";import{c as v,p,y as E}from"../chunk-LK5SHY4B.js";import"../chunk-F67UH4FD.js";import{c as x}from"../chunk-GGK6A6QK.js";import"../chunk-FUUTGGJS.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+`
@@ -56,13 +56,18 @@ export interface DeriveImportClosureOptions {
56
56
  export declare function deriveImportClosure(seedDocs: KanonakDocument[], repo: IKanonakDocumentRepository, options?: DeriveImportClosureOptions): Promise<Set<string>>;
57
57
  /**
58
58
  * Wraps a repository so the catalog enumeration (`getAllDocumentsAsync`) yields
59
- * ONLY documents whose `publisher/package` is in `scope` — a render's resolved
60
- * closure (its import closure ∪ the ambient render stack). Every OTHER method
61
- * delegates unchanged, so reference resolution during parse still sees the full
62
- * repository. This stops a polluted global cache (stray packages from other
63
- * workspaces' installs) from leaking into a render via the open-world merge —
64
- * the merge only happens over the documents this method returns. See
59
+ * ONLY the documents `scope` names — a render's resolved closure (its import
60
+ * closure ∪ the ambient render stack). Every OTHER method delegates unchanged,
61
+ * so reference resolution during parse still sees the full repository. This
62
+ * stops a polluted global cache (stray packages from other workspaces'
63
+ * installs) from leaking into a render via the open-world merge — the merge
64
+ * only happens over the documents this method returns. See
65
65
  * kanonak-protocol/typescript#42.
66
+ *
67
+ * A scope entry names a package, `publisher/package` (every version of it),
68
+ * or one version of it, `publisher/package@1.2.0` (its `namespace_.toString()`).
69
+ * A conformance scope names exact versions, so that a version of a package the
70
+ * data did not resolve cannot merge in (typescript#135).
66
71
  */
67
72
  export declare class ClosureScopedRepository implements IKanonakDocumentRepository {
68
73
  private readonly inner;
@@ -1,7 +1,7 @@
1
- import{c as xe}from"../chunk-BDTJIUS4.js";import{a as ye,d as J,f as Se,h as Z}from"../chunk-K76UUREI.js";import{l as $e,t as X,u as Q}from"../chunk-Z2444SWM.js";import"../chunk-X4V6DEZL.js";import"../chunk-SC5M74NM.js";import{a as O,b as W}from"../chunk-A224OOBZ.js";import{t as te}from"../chunk-GXEKJFXG.js";import"../chunk-QHABFCRC.js";import"../chunk-5FVUBF7N.js";import{a as fe}from"../chunk-WXXZOJ4O.js";import{k as re}from"../chunk-LKJVNKCN.js";import{a as B}from"../chunk-5ZRVFYCP.js";import{a as Re}from"../chunk-PEJALHXK.js";import"../chunk-WXUMROTA.js";import{c as we,y as ee}from"../chunk-PC3MYDGL.js";import"../chunk-F67UH4FD.js";import{c as V,e as j,f as L,g as Y,l as ve}from"../chunk-GGK6A6QK.js";import{a as be}from"../chunk-FUUTGGJS.js";import{readFileSync as le,writeFileSync as Ie,mkdirSync as Fe}from"fs";import{join as ne}from"path";import Me from"js-yaml";var Pe=[{publisher:"kanonak.org",package_:"core-kanonak"},{publisher:"kanonak.org",package_:"site"},{publisher:"kanonak.org",package_:"link"},{publisher:"kanonak.org",package_:"look-tokens"},{publisher:"kanonak.org",package_:"look-styles"},{publisher:"kanonak.org",package_:"look"},{publisher:"kanonak.org",package_:"universal-look"}];function q(r){return Pe}function C(r){return`${r.publisher}/${r.package_}`}function H(r,e=[]){let i={"kanonak.org/look-styles":"pages render UNSTYLED \u2014 generated CSS stops at the :root token block","kanonak.org/look-tokens":"the :root block loses the universal design-token floor (colors, fonts, spacing)","kanonak.org/universal-look":"resources without their own look render as an empty HTML comment","kanonak.org/look":"band vocabulary (Hero, PropertyList, \u2026) is unresolvable \u2014 declared looks cannot render","kanonak.org/site":"the site vocabulary (content, navigation) is unresolvable \u2014 the base stylesheet cannot bind","kanonak.org/core-kanonak":"the Package/Publisher classes are unresolvable \u2014 package and publisher pages degrade","kanonak.org/link":"link vocabulary is unresolvable \u2014 cross-reference styling degrades"},t=[];for(let o of r)if(o.origin==="missing"){let a=C(o),u=i[a]??"whatever this package contributes to rendering is lost";t.push(`Render-stack package ${a} is MISSING (${o.reason??"unknown reason"}) \u2014 ${u}. Fix: kanonak install ${a} (as the user running the render), or restore network access to ${o.publisher}.`)}else o.resolvedButNotInCatalog&&t.push(`Render-stack package ${C(o)} resolved (${o.origin}) but is NOT in the parsed catalog \u2014 this is a closure-scoping bug; please report it.`);for(let o of e)t.push(`Import edge ${o.fromNamespace} \u2192 ${o.publisher}/${o.packageName} ${o.constraint} did NOT resolve (${o.reason==="no-compatible-version"?"no compatible version in the repository":"resolution threw"}) \u2014 every statement ${o.fromNamespace} authors against ${o.publisher}/${o.packageName} entities is dropped from the parse as an unresolved predicate (a look declaration loses its bands and pages render empty; see typescript#91). Fix: add a ${o.constraint}-compatible version of ${o.publisher}/${o.packageName} to the workspace or cache (kanonak install ${o.publisher}/${o.packageName}), or bump the import in ${o.fromNamespace}.`);return t}function oe(r){let{publisher:e,availablePublishers:i,catalog:t,lookRenderer:o,localNamespaces:a,rawByNsKey:u,renderStack:d,producers:f,lockSource:y,configSource:s}=r,l=new Map,k=new Map,p=new Map,h=new Set;for(let S of t){if(!(S instanceof we))continue;let w=S.namespace||"";if(!a.has(w))continue;l.set(`${w}/${S.name}`,S);let P=w.split("/")[1]??"",[_,M]=P.split("@");if(!_||!M)continue;let E=Y(M);E&&(h.has(P)||(h.add(P),k.has(_)||k.set(_,[]),k.get(_).push({verStr:M,version:E})),S.name===_&&p.set(P,S))}for(let S of k.values())S.sort((w,P)=>V(P.version,w.version));return{publisher:e,availablePublishers:i,catalog:t,lookRenderer:o,localNamespaces:a,rawByNsKey:u,bySubject:l,pkgVersions:k,pkgSelfByVer:p,renderStack:d,...f?{producers:f}:{},...y?{lockSource:y}:{},...s?{configSource:s}:{}}}async function de(r,e={}){let i=new B,t=new fe(i),o=[],a=[];for(let c of Z(r)){let m;try{m=le(c,"utf-8")}catch{continue}let n;try{n=i.parse(m).metadata?.namespace_}catch{continue}if(!n?.version)continue;let g=n.version;a.push({publisher:n.publisher,package_:n.package_,verStr:j(g),version:g,source:m})}a.sort((c,m)=>V(m.version,c.version));for(let c of a)await t.saveDocumentAsync(i.parse(c.source),`${c.publisher}/${c.package_}@${c.verStr}`),o.push({publisher:c.publisher,package_:c.package_,verStr:c.verStr,source:c.source});let u=[...new Set(o.map(c=>c.publisher))].sort(),d=e.publisher;if(d){if(!u.includes(d))throw new Error(`Publisher "${d}" not found in workspace. Available: ${u.join(", ")||"(none)"}`)}else if(u.length===1)d=u[0];else throw u.length===0?new Error(`No Kanonak packages found under ${r}`):new Error(`Workspace has multiple publishers (${u.join(", ")}). Pass --publisher <domain> to choose which one to serve.`);let f=new Set,y=new Map;for(let c of o)c.publisher===d&&(f.add(`${c.publisher}/${c.package_}@${c.verStr}`),y.set(`${c.package_}@${c.verStr}`,c.source));let s=J(),l=new ye(s,!0,i),k={};e.httpCache&&(k.getFromCache=e.httpCache.getFromCache,k.onFetch=e.httpCache.onFetch),e.fetchFn&&(k.fetchFn=e.fetchFn),e.packageUrlTemplates&&(k.packageUrlTemplates=e.packageUrlTemplates);let p=e.repository??new Se(t,l,new Q(k)),h=e.log??(()=>{}),S=q(void 0),w=[],P=c=>c.map(m=>m.metadata.namespace_?.version).filter(m=>m!==void 0).sort((m,n)=>V(n,m)).map(j);if(!e.repository){h(`[render-stack] resolving ${S.length} ambient look-stack package(s); cache: ${s}`);let c=new X({...e.fetchFn?{fetchFn:e.fetchFn}:{},...e.packageUrlTemplates?{packageUrlTemplates:e.packageUrlTemplates}:{}});for(let m of S){let n=C(m),g=await t.getDocumentsByNamespaceAsync(m.publisher,m.package_);if(g.length>0){let v=P(g);w.push({...m,origin:"workspace",versions:v}),h(`[render-stack] ${n} \u2014 workspace (${v.join(", ")})`);continue}let b=await l.getDocumentsByNamespaceAsync(m.publisher,m.package_);if(b.length>0){let v=P(b);w.push({...m,origin:"cache",versions:v}),h(`[render-stack] ${n} \u2014 cache (${v.join(", ")})`);continue}try{let $=(await c.getLock(m.publisher))?.packages[`${m.publisher}/${m.package_}`];if(!$){let K=`publisher ${m.publisher} reachable but its lock does not pin ${m.package_}`;w.push({...m,origin:"missing",reason:K}),h(`[render-stack] ${n} \u2014 MISSING: ${K}`);continue}let I=$.version,{url:he,content:ke}=await c.fetchLockedSource(m.publisher,m.package_,$);await t.saveDocumentAsync(i.parse(ke),`${m.publisher}/${m.package_}@${I}`);try{let K=ne(s,m.publisher);Fe(K,{recursive:!0}),Ie(ne(K,`${m.package_}@${I}.kan.yml`),ke,"utf-8"),w.push({...m,origin:"fetched",versions:[I]}),h(`[render-stack] ${n}@${I} \u2014 fetched from ${he}, installed to cache`)}catch(K){w.push({...m,origin:"fetched",versions:[I]}),h(`[render-stack] ${n}@${I} \u2014 fetched from ${he}, but cache ${s} is NOT WRITABLE (${K.message}); usable for this load only \u2014 every load will re-fetch it`)}}catch(v){let $=`fetch failed: ${v.message}`;w.push({...m,origin:"missing",reason:$}),h(`[render-stack] ${n} \u2014 MISSING: ${$}`)}}}let _=(await t.getAllDocumentsAsync()).filter(c=>c.metadata.namespace_?.publisher===d);for(let c of S)_.push(...await p.getDocumentsByNamespaceAsync(c.publisher,c.package_));let M=[],E=await O(_,p,{onUnresolvedEdge:c=>M.push(c)}),A=p;if(!e.repository){for(let c of S)E.add(C(c));A=new W(p,E)}let T=await new re(i).parseKanonaks(A),ie=new te(T),ce=(c,m)=>ee(T,{publisher:c,package_:m,name:m}).length>0,N;if(e.repository){N=[];for(let c of S){let m=await p.getDocumentsByNamespaceAsync(c.publisher,c.package_);N.push(m.length>0?{...c,origin:"repository",versions:P(m)}:{...c,origin:"missing",reason:"not present in the caller-supplied repository"})}}else N=w.map(c=>c.origin==="missing"||ce(c.publisher,c.package_)?c:{...c,resolvedButNotInCatalog:!0});let G=H(N,M);for(let c of G)h(`[render-stack] WARNING: ${c}`);let z={contractSource:"universal-default",cachePath:s,packages:N,warnings:G},D;try{D=le(ne(r,"kanonak.lock"),"utf-8")}catch{D=Ee(d,o,i)}let U;try{U=le(ne(r,".well-known","kanonak.json"),"utf-8")}catch{U=void 0}return oe({publisher:d,availablePublishers:u,catalog:T,lookRenderer:ie,localNamespaces:f,rawByNsKey:y,renderStack:z,...D?{lockSource:D}:{},...U?{configSource:U}:{}})}function Ee(r,e,i){let t=new Map;for(let a of e)a.publisher===r&&(t.has(a.package_)||t.set(a.package_,{verStr:a.verStr,source:a.source}));if(t.size===0)return;let o={};for(let a of[...t.keys()].sort()){let{verStr:u,source:d}=t.get(a),f={},y;try{y=i.parse(d).metadata?.imports}catch{y=void 0}for(let l of y?.[r]??[]){let k=t.get(l.packageName);k&&(f[`${r}/${l.packageName}`]=k.verStr)}let s={};for(let l of Object.keys(f).sort())s[l]=f[l];o[`${r}/${a}`]={version:u,resolved:`https://${r}/${a}/${u}.kan.yml`,integrity:xe(d),dependencies:s}}return Me.dump({version:"1",lastUpdated:"",packages:o},{lineWidth:-1,sortKeys:!1,quotingType:'"'})}import{existsSync as De,readFileSync as Ke,writeFileSync as Ve,mkdirSync as Ae}from"fs";import{join as _e}from"path";async function pe(r,e={}){let i=new B,t=ve(r),o=t.kind==="resource"?t.uri.publisher:t.publisher,a=e.log??(()=>{}),u=e.cacheRoot??J(),d=(n,g,b)=>_e(u,n,`${g}@${b}.kan.yml`),f=new Set,y=new Set,s=new Map,l=new Q({getFromCache:(n,g,b)=>{let v=d(n,g,b),$=De(v)?Ke(v,"utf-8"):null;return $!==null&&f.add(`${n}/${g}`),$},onFetch:(n,g,b,v)=>{y.add(`${n}/${g}`);try{let $=_e(u,n);Ae($,{recursive:!0}),Ve(d(n,g,b),v,"utf-8")}catch($){s.set(`${n}/${g}`,$.message),a(`[render] fetched ${n}/${g}@${b} but cache ${u} is NOT WRITABLE (${$.message}); usable for this load only \u2014 every load will re-fetch it`)}},...e.fetchFn?{fetchFn:e.fetchFn}:{},...e.packageUrlTemplates?{packageUrlTemplates:e.packageUrlTemplates}:{}}),k=new X(e.fetchFn?{fetchFn:e.fetchFn}:void 0),p;if(t.kind==="resource"){let n=t.uri.version;p=[n?{package_:t.uri.package_,version:`${n.major}.${n.minor}.${n.patch}`}:{package_:t.uri.package_}]}else if(t.kind==="package"){let n=t.version;p=[n?{package_:t.package_,version:`${n.major}.${n.minor}.${n.patch}`}:{package_:t.package_}]}else p=((await k.getConfig(o)).featured_packages??[]).map(g=>({package_:g}));let h=async(n,g,b)=>{try{let v=b?i.buildImport(g,"=",b,n):i.buildImport(g,"*","0.0.0",n),$=await l.getHighestCompatibleVersionAsync(n,v);return $?{doc:$}:{doc:null,error:`${n} did not resolve ${g}${b?`@${b}`:""} (not in its index, or unreachable)`}}catch(v){return{doc:null,error:v.message}}},S=[],w=[];for(let n of p){let{doc:g,error:b}=await h(o,n.package_,n.version);g?S.push(g):b&&w.push(b)}if(S.length===0)throw new Error(`Could not fetch any package for address "${r}" from publisher "${o}".`+(w.length>0?` Reasons: ${w.join("; ")}`:""));let P=q(),_="universal-default",M=n=>n.map(g=>g.metadata.namespace_?.version).filter(g=>g!==void 0).sort((g,b)=>V(b,g)).map(j);a(`[render-stack] resolving ${P.length} ambient look-stack package(s) (contract: ${_}); cache: ${u}`);let E=[],A=[];for(let n of P){let g=C(n),{doc:b,error:v}=await h(n.publisher,n.package_,void 0);if(b){E.push(b);let $=M([b]),I=y.has(g)?"fetched":f.has(g)?"cache":"fetched";A.push({...n,origin:I,versions:$}),a(`[render-stack] ${g} \u2014 ${I} (${$.join(", ")})`+(s.has(g)?" [cache write FAILED \u2014 will re-fetch next load]":""))}else A.push({...n,origin:"missing",reason:v??"unresolved"}),a(`[render-stack] ${g} \u2014 MISSING: ${v??"unresolved"}`)}let T=[],ie=await O([...S,...E],l,{onUnresolvedEdge:n=>T.push(n)}),ce=new W(l,ie),N=await new re(i).parseKanonaks(ce),G=new te(N),z=A.map(n=>n.origin==="missing"||ee(N,{publisher:n.publisher,package_:n.package_,name:n.package_}).length>0?n:{...n,resolvedButNotInCatalog:!0}),D=H(z,T);for(let n of D)a(`[render-stack] WARNING: ${n}`);let U={contractSource:_,cachePath:u,packages:z,warnings:D},c=new Set,m=new Map;for(let n of await l.getAllDocumentsAsync()){let g=n.metadata.namespace_;if(!g?.version||g.publisher!==o)continue;let b=j(g.version),v=`${g.publisher}/${g.package_}@${b}`;c.add(v);let $=await l.getDocumentContentAsync(v);$!==null&&m.set(`${g.package_}@${b}`,$)}return oe({publisher:o,availablePublishers:[o],catalog:N,lookRenderer:G,localNamespaces:c,rawByNsKey:m,renderStack:U})}import{VersionOperator as ae}from"@kanonak-protocol/types/document/models/enums";function se(r){let{lookRenderer:e,publisher:i,renderStack:t,catalog:o}=r,a=e.explainStylesheet(e.publisherSubject(i)),u=[...a.tokens.entries()].map(([p,h])=>({name:p,value:h.value,source:`${h.sourceNamespace}/${h.sourceName}`,level:h.level})),d=a.baseStylesheet,f={present:d.css!==void 0,...d.sourceNamespace!==void 0?{source:d.sourceNamespace}:{},...d.scope!==void 0?{scope:d.scope}:{},...d.css!==void 0?{bytes:d.css.length}:{},...d.problem!==void 0?{problem:d.problem}:{},candidates:d.candidates},y=new Map;for(let p of o){let h=p.namespace;h&&y.set(h,(y.get(h)??0)+1)}let s=[...y.entries()].map(([p,h])=>({namespace:p,resources:h})).sort((p,h)=>p.namespace.localeCompare(h.namespace)),l=e.expressionFailures().map(p=>({carrier:p.carrier,reason:p.reason})),k=l.map(p=>`Expression carrier "${p.carrier}" did not compile: ${p.reason} Consequence: that value renders as nothing (and a parent operation consuming it may drop its whole tier). Fix: use a tx.Expression node class the runner implements, or remove the carrier.`);return{publisher:i,renderStack:{contractSource:t.contractSource,cachePath:t.cachePath,packages:t.packages.map(p=>({package_:C(p),origin:p.origin,...p.versions!==void 0?{versions:p.versions}:{},...p.reason!==void 0?{reason:p.reason}:{},...p.resolvedButNotInCatalog!==void 0?{resolvedButNotInCatalog:p.resolvedButNotInCatalog}:{}}))},stylesheet:{tokens:u,baseStylesheet:f,...a.look?{look:{sourceClass:`${a.look.sourceClass.publisher}/${a.look.sourceClass.package_}/${a.look.sourceClass.name}`}}:{}},expressionCarriers:l,catalog:s,warnings:[...t.warnings,...a.warnings.filter(p=>!t.warnings.includes(p)),...k]}}function Te(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ue(r){let e=Te,i=r.warnings.length===0,t=r.expressionCarriers.map(s=>`<tr><td><code>${e(s.carrier)}</code></td><td>${e(s.reason)}</td></tr>`).join(`
1
+ import{c as xe}from"../chunk-BDTJIUS4.js";import{a as ye,d as J,f as Se,h as Z}from"../chunk-K76UUREI.js";import{l as $e,t as X,u as Q}from"../chunk-Z2444SWM.js";import"../chunk-LIN5SG5I.js";import"../chunk-SC5M74NM.js";import{a as O,b as W}from"../chunk-VJUZKHQU.js";import{u as te}from"../chunk-CPENAANM.js";import"../chunk-QHABFCRC.js";import"../chunk-5FVUBF7N.js";import{a as fe}from"../chunk-WXXZOJ4O.js";import{k as re}from"../chunk-SBWD7EOG.js";import{a as B}from"../chunk-5ZRVFYCP.js";import{a as Re}from"../chunk-PEJALHXK.js";import"../chunk-6WOPXTIL.js";import{c as we,z as ee}from"../chunk-LK5SHY4B.js";import"../chunk-F67UH4FD.js";import{c as V,e as j,f as L,g as Y,l as ve}from"../chunk-GGK6A6QK.js";import{a as be}from"../chunk-FUUTGGJS.js";import{readFileSync as le,writeFileSync as Ie,mkdirSync as Fe}from"fs";import{join as ne}from"path";import Me from"js-yaml";var Pe=[{publisher:"kanonak.org",package_:"core-kanonak"},{publisher:"kanonak.org",package_:"site"},{publisher:"kanonak.org",package_:"link"},{publisher:"kanonak.org",package_:"look-tokens"},{publisher:"kanonak.org",package_:"look-styles"},{publisher:"kanonak.org",package_:"look"},{publisher:"kanonak.org",package_:"universal-look"}];function q(r){return Pe}function C(r){return`${r.publisher}/${r.package_}`}function H(r,e=[]){let i={"kanonak.org/look-styles":"pages render UNSTYLED \u2014 generated CSS stops at the :root token block","kanonak.org/look-tokens":"the :root block loses the universal design-token floor (colors, fonts, spacing)","kanonak.org/universal-look":"resources without their own look render as an empty HTML comment","kanonak.org/look":"band vocabulary (Hero, PropertyList, \u2026) is unresolvable \u2014 declared looks cannot render","kanonak.org/site":"the site vocabulary (content, navigation) is unresolvable \u2014 the base stylesheet cannot bind","kanonak.org/core-kanonak":"the Package/Publisher classes are unresolvable \u2014 package and publisher pages degrade","kanonak.org/link":"link vocabulary is unresolvable \u2014 cross-reference styling degrades"},t=[];for(let o of r)if(o.origin==="missing"){let a=C(o),u=i[a]??"whatever this package contributes to rendering is lost";t.push(`Render-stack package ${a} is MISSING (${o.reason??"unknown reason"}) \u2014 ${u}. Fix: kanonak install ${a} (as the user running the render), or restore network access to ${o.publisher}.`)}else o.resolvedButNotInCatalog&&t.push(`Render-stack package ${C(o)} resolved (${o.origin}) but is NOT in the parsed catalog \u2014 this is a closure-scoping bug; please report it.`);for(let o of e)t.push(`Import edge ${o.fromNamespace} \u2192 ${o.publisher}/${o.packageName} ${o.constraint} did NOT resolve (${o.reason==="no-compatible-version"?"no compatible version in the repository":"resolution threw"}) \u2014 every statement ${o.fromNamespace} authors against ${o.publisher}/${o.packageName} entities is dropped from the parse as an unresolved predicate (a look declaration loses its bands and pages render empty; see typescript#91). Fix: add a ${o.constraint}-compatible version of ${o.publisher}/${o.packageName} to the workspace or cache (kanonak install ${o.publisher}/${o.packageName}), or bump the import in ${o.fromNamespace}.`);return t}function oe(r){let{publisher:e,availablePublishers:i,catalog:t,lookRenderer:o,localNamespaces:a,rawByNsKey:u,renderStack:p,producers:f,lockSource:y,configSource:s}=r,d=new Map,k=new Map,l=new Map,h=new Set;for(let S of t){if(!(S instanceof we))continue;let w=S.namespace||"";if(!a.has(w))continue;d.set(`${w}/${S.name}`,S);let P=w.split("/")[1]??"",[_,M]=P.split("@");if(!_||!M)continue;let E=Y(M);E&&(h.has(P)||(h.add(P),k.has(_)||k.set(_,[]),k.get(_).push({verStr:M,version:E})),S.name===_&&l.set(P,S))}for(let S of k.values())S.sort((w,P)=>V(P.version,w.version));return{publisher:e,availablePublishers:i,catalog:t,lookRenderer:o,localNamespaces:a,rawByNsKey:u,bySubject:d,pkgVersions:k,pkgSelfByVer:l,renderStack:p,...f?{producers:f}:{},...y?{lockSource:y}:{},...s?{configSource:s}:{}}}async function de(r,e={}){let i=new B,t=new fe(i),o=[],a=[];for(let c of Z(r)){let m;try{m=le(c,"utf-8")}catch{continue}let n;try{n=i.parse(m).metadata?.namespace_}catch{continue}if(!n?.version)continue;let g=n.version;a.push({publisher:n.publisher,package_:n.package_,verStr:j(g),version:g,source:m})}a.sort((c,m)=>V(m.version,c.version));for(let c of a)await t.saveDocumentAsync(i.parse(c.source),`${c.publisher}/${c.package_}@${c.verStr}`),o.push({publisher:c.publisher,package_:c.package_,verStr:c.verStr,source:c.source});let u=[...new Set(o.map(c=>c.publisher))].sort(),p=e.publisher;if(p){if(!u.includes(p))throw new Error(`Publisher "${p}" not found in workspace. Available: ${u.join(", ")||"(none)"}`)}else if(u.length===1)p=u[0];else throw u.length===0?new Error(`No Kanonak packages found under ${r}`):new Error(`Workspace has multiple publishers (${u.join(", ")}). Pass --publisher <domain> to choose which one to serve.`);let f=new Set,y=new Map;for(let c of o)c.publisher===p&&(f.add(`${c.publisher}/${c.package_}@${c.verStr}`),y.set(`${c.package_}@${c.verStr}`,c.source));let s=J(),d=new ye(s,!0,i),k={};e.httpCache&&(k.getFromCache=e.httpCache.getFromCache,k.onFetch=e.httpCache.onFetch),e.fetchFn&&(k.fetchFn=e.fetchFn),e.packageUrlTemplates&&(k.packageUrlTemplates=e.packageUrlTemplates);let l=e.repository??new Se(t,d,new Q(k)),h=e.log??(()=>{}),S=q(void 0),w=[],P=c=>c.map(m=>m.metadata.namespace_?.version).filter(m=>m!==void 0).sort((m,n)=>V(n,m)).map(j);if(!e.repository){h(`[render-stack] resolving ${S.length} ambient look-stack package(s); cache: ${s}`);let c=new X({...e.fetchFn?{fetchFn:e.fetchFn}:{},...e.packageUrlTemplates?{packageUrlTemplates:e.packageUrlTemplates}:{}});for(let m of S){let n=C(m),g=await t.getDocumentsByNamespaceAsync(m.publisher,m.package_);if(g.length>0){let v=P(g);w.push({...m,origin:"workspace",versions:v}),h(`[render-stack] ${n} \u2014 workspace (${v.join(", ")})`);continue}let b=await d.getDocumentsByNamespaceAsync(m.publisher,m.package_);if(b.length>0){let v=P(b);w.push({...m,origin:"cache",versions:v}),h(`[render-stack] ${n} \u2014 cache (${v.join(", ")})`);continue}try{let $=(await c.getLock(m.publisher))?.packages[`${m.publisher}/${m.package_}`];if(!$){let K=`publisher ${m.publisher} reachable but its lock does not pin ${m.package_}`;w.push({...m,origin:"missing",reason:K}),h(`[render-stack] ${n} \u2014 MISSING: ${K}`);continue}let I=$.version,{url:he,content:ke}=await c.fetchLockedSource(m.publisher,m.package_,$);await t.saveDocumentAsync(i.parse(ke),`${m.publisher}/${m.package_}@${I}`);try{let K=ne(s,m.publisher);Fe(K,{recursive:!0}),Ie(ne(K,`${m.package_}@${I}.kan.yml`),ke,"utf-8"),w.push({...m,origin:"fetched",versions:[I]}),h(`[render-stack] ${n}@${I} \u2014 fetched from ${he}, installed to cache`)}catch(K){w.push({...m,origin:"fetched",versions:[I]}),h(`[render-stack] ${n}@${I} \u2014 fetched from ${he}, but cache ${s} is NOT WRITABLE (${K.message}); usable for this load only \u2014 every load will re-fetch it`)}}catch(v){let $=`fetch failed: ${v.message}`;w.push({...m,origin:"missing",reason:$}),h(`[render-stack] ${n} \u2014 MISSING: ${$}`)}}}let _=(await t.getAllDocumentsAsync()).filter(c=>c.metadata.namespace_?.publisher===p);for(let c of S)_.push(...await l.getDocumentsByNamespaceAsync(c.publisher,c.package_));let M=[],E=await O(_,l,{onUnresolvedEdge:c=>M.push(c)}),A=l;if(!e.repository){for(let c of S)E.add(C(c));A=new W(l,E)}let T=await new re(i).parseKanonaks(A),ie=new te(T),ce=(c,m)=>ee(T,{publisher:c,package_:m,name:m}).length>0,N;if(e.repository){N=[];for(let c of S){let m=await l.getDocumentsByNamespaceAsync(c.publisher,c.package_);N.push(m.length>0?{...c,origin:"repository",versions:P(m)}:{...c,origin:"missing",reason:"not present in the caller-supplied repository"})}}else N=w.map(c=>c.origin==="missing"||ce(c.publisher,c.package_)?c:{...c,resolvedButNotInCatalog:!0});let G=H(N,M);for(let c of G)h(`[render-stack] WARNING: ${c}`);let z={contractSource:"universal-default",cachePath:s,packages:N,warnings:G},D;try{D=le(ne(r,"kanonak.lock"),"utf-8")}catch{D=Ee(p,o,i)}let U;try{U=le(ne(r,".well-known","kanonak.json"),"utf-8")}catch{U=void 0}return oe({publisher:p,availablePublishers:u,catalog:T,lookRenderer:ie,localNamespaces:f,rawByNsKey:y,renderStack:z,...D?{lockSource:D}:{},...U?{configSource:U}:{}})}function Ee(r,e,i){let t=new Map;for(let a of e)a.publisher===r&&(t.has(a.package_)||t.set(a.package_,{verStr:a.verStr,source:a.source}));if(t.size===0)return;let o={};for(let a of[...t.keys()].sort()){let{verStr:u,source:p}=t.get(a),f={},y;try{y=i.parse(p).metadata?.imports}catch{y=void 0}for(let d of y?.[r]??[]){let k=t.get(d.packageName);k&&(f[`${r}/${d.packageName}`]=k.verStr)}let s={};for(let d of Object.keys(f).sort())s[d]=f[d];o[`${r}/${a}`]={version:u,resolved:`https://${r}/${a}/${u}.kan.yml`,integrity:xe(p),dependencies:s}}return Me.dump({version:"1",lastUpdated:"",packages:o},{lineWidth:-1,sortKeys:!1,quotingType:'"'})}import{existsSync as De,readFileSync as Ke,writeFileSync as Ve,mkdirSync as Ae}from"fs";import{join as _e}from"path";async function pe(r,e={}){let i=new B,t=ve(r),o=t.kind==="resource"?t.uri.publisher:t.publisher,a=e.log??(()=>{}),u=e.cacheRoot??J(),p=(n,g,b)=>_e(u,n,`${g}@${b}.kan.yml`),f=new Set,y=new Set,s=new Map,d=new Q({getFromCache:(n,g,b)=>{let v=p(n,g,b),$=De(v)?Ke(v,"utf-8"):null;return $!==null&&f.add(`${n}/${g}`),$},onFetch:(n,g,b,v)=>{y.add(`${n}/${g}`);try{let $=_e(u,n);Ae($,{recursive:!0}),Ve(p(n,g,b),v,"utf-8")}catch($){s.set(`${n}/${g}`,$.message),a(`[render] fetched ${n}/${g}@${b} but cache ${u} is NOT WRITABLE (${$.message}); usable for this load only \u2014 every load will re-fetch it`)}},...e.fetchFn?{fetchFn:e.fetchFn}:{},...e.packageUrlTemplates?{packageUrlTemplates:e.packageUrlTemplates}:{}}),k=new X(e.fetchFn?{fetchFn:e.fetchFn}:void 0),l;if(t.kind==="resource"){let n=t.uri.version;l=[n?{package_:t.uri.package_,version:`${n.major}.${n.minor}.${n.patch}`}:{package_:t.uri.package_}]}else if(t.kind==="package"){let n=t.version;l=[n?{package_:t.package_,version:`${n.major}.${n.minor}.${n.patch}`}:{package_:t.package_}]}else l=((await k.getConfig(o)).featured_packages??[]).map(g=>({package_:g}));let h=async(n,g,b)=>{try{let v=b?i.buildImport(g,"=",b,n):i.buildImport(g,"*","0.0.0",n),$=await d.getHighestCompatibleVersionAsync(n,v);return $?{doc:$}:{doc:null,error:`${n} did not resolve ${g}${b?`@${b}`:""} (not in its index, or unreachable)`}}catch(v){return{doc:null,error:v.message}}},S=[],w=[];for(let n of l){let{doc:g,error:b}=await h(o,n.package_,n.version);g?S.push(g):b&&w.push(b)}if(S.length===0)throw new Error(`Could not fetch any package for address "${r}" from publisher "${o}".`+(w.length>0?` Reasons: ${w.join("; ")}`:""));let P=q(),_="universal-default",M=n=>n.map(g=>g.metadata.namespace_?.version).filter(g=>g!==void 0).sort((g,b)=>V(b,g)).map(j);a(`[render-stack] resolving ${P.length} ambient look-stack package(s) (contract: ${_}); cache: ${u}`);let E=[],A=[];for(let n of P){let g=C(n),{doc:b,error:v}=await h(n.publisher,n.package_,void 0);if(b){E.push(b);let $=M([b]),I=y.has(g)?"fetched":f.has(g)?"cache":"fetched";A.push({...n,origin:I,versions:$}),a(`[render-stack] ${g} \u2014 ${I} (${$.join(", ")})`+(s.has(g)?" [cache write FAILED \u2014 will re-fetch next load]":""))}else A.push({...n,origin:"missing",reason:v??"unresolved"}),a(`[render-stack] ${g} \u2014 MISSING: ${v??"unresolved"}`)}let T=[],ie=await O([...S,...E],d,{onUnresolvedEdge:n=>T.push(n)}),ce=new W(d,ie),N=await new re(i).parseKanonaks(ce),G=new te(N),z=A.map(n=>n.origin==="missing"||ee(N,{publisher:n.publisher,package_:n.package_,name:n.package_}).length>0?n:{...n,resolvedButNotInCatalog:!0}),D=H(z,T);for(let n of D)a(`[render-stack] WARNING: ${n}`);let U={contractSource:_,cachePath:u,packages:z,warnings:D},c=new Set,m=new Map;for(let n of await d.getAllDocumentsAsync()){let g=n.metadata.namespace_;if(!g?.version||g.publisher!==o)continue;let b=j(g.version),v=`${g.publisher}/${g.package_}@${b}`;c.add(v);let $=await d.getDocumentContentAsync(v);$!==null&&m.set(`${g.package_}@${b}`,$)}return oe({publisher:o,availablePublishers:[o],catalog:N,lookRenderer:G,localNamespaces:c,rawByNsKey:m,renderStack:U})}import{VersionOperator as ae}from"@kanonak-protocol/types/document/models/enums";function se(r){let{lookRenderer:e,publisher:i,renderStack:t,catalog:o}=r,a=e.explainStylesheet(e.publisherSubject(i)),u=[...a.tokens.entries()].map(([l,h])=>({name:l,value:h.value,source:`${h.sourceNamespace}/${h.sourceName}`,level:h.level})),p=a.baseStylesheet,f={present:p.css!==void 0,...p.sourceNamespace!==void 0?{source:p.sourceNamespace}:{},...p.scope!==void 0?{scope:p.scope}:{},...p.css!==void 0?{bytes:p.css.length}:{},...p.problem!==void 0?{problem:p.problem}:{},candidates:p.candidates},y=new Map;for(let l of o){let h=l.namespace;h&&y.set(h,(y.get(h)??0)+1)}let s=[...y.entries()].map(([l,h])=>({namespace:l,resources:h})).sort((l,h)=>l.namespace.localeCompare(h.namespace)),d=e.expressionFailures().map(l=>({carrier:l.carrier,stage:l.stage,reason:l.reason})),k=d.map(l=>l.stage==="compile"?`Expression carrier "${l.carrier}" did not compile: ${l.reason} Consequence: that value renders as nothing (and a parent operation consuming it may drop its whole tier). Fix: use a tx.Expression node class the runner implements, or remove the carrier.`:`Expression carrier "${l.carrier}" failed to evaluate: ${l.reason} Consequence: that value renders as nothing. Fix: correct the expression, or make a value that may be absent explicitly optional.`);return{publisher:i,renderStack:{contractSource:t.contractSource,cachePath:t.cachePath,packages:t.packages.map(l=>({package_:C(l),origin:l.origin,...l.versions!==void 0?{versions:l.versions}:{},...l.reason!==void 0?{reason:l.reason}:{},...l.resolvedButNotInCatalog!==void 0?{resolvedButNotInCatalog:l.resolvedButNotInCatalog}:{}}))},stylesheet:{tokens:u,baseStylesheet:f,...a.look?{look:{sourceClass:`${a.look.sourceClass.publisher}/${a.look.sourceClass.package_}/${a.look.sourceClass.name}`}}:{}},expressionCarriers:d,catalog:s,warnings:[...t.warnings,...a.warnings.filter(l=>!t.warnings.includes(l)),...k]}}function Te(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ue(r){let e=Te,i=r.warnings.length===0,t=r.expressionCarriers.map(s=>`<tr><td><code>${e(s.carrier)}</code></td><td>${e(s.reason)}</td></tr>`).join(`
2
2
  `),o=r.warnings.length===0?'<p class="ok">\u2713 No problems detected \u2014 the render stack is fully resolved and pages should be styled.</p>':r.warnings.map(s=>`<div class="warn">\u26A0 ${e(s)}</div>`).join(`
3
- `),a=r.renderStack.packages.map(s=>{let l=s.origin!=="missing"&&!s.resolvedButNotInCatalog,k=s.origin==="missing"?'<span class="bad">MISSING</span>':s.resolvedButNotInCatalog?`<span class="bad">${e(s.origin)} (not in catalog)</span>`:`<span class="good">${e(s.origin)}</span>`,p=s.reason?e(s.reason):e((s.versions??[]).join(", "));return`<tr class="${l?"":"row-bad"}"><td><code>${e(s.package_)}</code></td><td>${k}</td><td>${p}</td></tr>`}).join(`
4
- `),u=r.stylesheet.baseStylesheet,d=u.present?`<p><span class="good">\u2713 present</span> \u2014 <code>${e(u.source??"")}</code> (${u.bytes} bytes, ${e(u.scope??"")})</p>`:`<p><span class="bad">\u2717 MISSING</span>${u.problem?` \u2014 ${e(u.problem)}`:""}${u.candidates.length>0?`<br>candidates considered: ${u.candidates.map(s=>`<code>${e(s)}</code>`).join(", ")}`:""}</p><p>Without the base stylesheet, generated CSS stops at the <code>:root</code> token block and pages appear unstyled.</p>`,f=r.stylesheet.tokens.map(s=>`<tr><td><code>--kan-${e(s.name)}</code></td><td><code>${e(s.value)}</code></td><td><code>${e(s.source)}</code></td><td>${e(s.level)}</td></tr>`).join(`
3
+ `),a=r.renderStack.packages.map(s=>{let d=s.origin!=="missing"&&!s.resolvedButNotInCatalog,k=s.origin==="missing"?'<span class="bad">MISSING</span>':s.resolvedButNotInCatalog?`<span class="bad">${e(s.origin)} (not in catalog)</span>`:`<span class="good">${e(s.origin)}</span>`,l=s.reason?e(s.reason):e((s.versions??[]).join(", "));return`<tr class="${d?"":"row-bad"}"><td><code>${e(s.package_)}</code></td><td>${k}</td><td>${l}</td></tr>`}).join(`
4
+ `),u=r.stylesheet.baseStylesheet,p=u.present?`<p><span class="good">\u2713 present</span> \u2014 <code>${e(u.source??"")}</code> (${u.bytes} bytes, ${e(u.scope??"")})</p>`:`<p><span class="bad">\u2717 MISSING</span>${u.problem?` \u2014 ${e(u.problem)}`:""}${u.candidates.length>0?`<br>candidates considered: ${u.candidates.map(s=>`<code>${e(s)}</code>`).join(", ")}`:""}</p><p>Without the base stylesheet, generated CSS stops at the <code>:root</code> token block and pages appear unstyled.</p>`,f=r.stylesheet.tokens.map(s=>`<tr><td><code>--kan-${e(s.name)}</code></td><td><code>${e(s.value)}</code></td><td><code>${e(s.source)}</code></td><td>${e(s.level)}</td></tr>`).join(`
5
5
  `),y=r.catalog.map(s=>`<tr><td><code>${e(s.namespace)}</code></td><td>${s.resources}</td></tr>`).join(`
6
6
  `);return`<!doctype html>
7
7
  <html lang="en">
@@ -43,7 +43,7 @@ ${a}
43
43
 
44
44
  <h2>Base stylesheet</h2>
45
45
  <p class="meta">Everything after the <code>:root</code> block in generated CSS comes from a <code>look-styles/base-stylesheet</code> asset in the render catalog.</p>
46
- ${d}
46
+ ${p}
47
47
 
48
48
  <h2>Design tokens (:root)</h2>
49
49
  <p class="meta">Resolved for the publisher landing page. Each token shows which resource in the cascade supplied it.</p>
@@ -69,4 +69,4 @@ ${t}
69
69
  ${y}
70
70
  </table>
71
71
  </body>
72
- </html>`}var R={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".svg":"image/svg+xml",".md":"text/markdown; charset=utf-8",".kan.yml":"application/yaml; charset=utf-8",".txt":"text/plain; charset=utf-8",".json":"application/json; charset=utf-8"},x=(r,e,i,t)=>({status:r,headers:{"Content-Type":e,...t||{}},body:i}),F=r=>x(404,R[".html"],`<!doctype html><meta charset=utf-8><title>404</title><h1>404</h1><p>Not found: ${r}</p>`),Ue=r=>({status:301,headers:{Location:r},body:""}),Be=r=>({status:302,headers:{Location:r},body:""});function Le(r){switch(r.kind){case"exact":return{operator:ae.Exact,version:L(r.major,r.minor,r.patch)};case"minor-pin":return{operator:ae.Compatible,version:L(r.major,r.minor,0)};case"major-pin":return{operator:ae.Major,version:L(r.major,0,0)};default:return{operator:ae.Any,version:L(0,0,0)}}}async function Oe(r,e,i,t){if(!t)return null;let o=r.producers?.find(f=>f.canProduce(r.publisher,e));if(!o)return null;let a=await o.resolveVersion(r.publisher,e,Le(i));if(!a)return null;let u=j(a);if(i.kind!=="exact")return Be(`/${e}/${u}.kan.yml`);let{source:d}=await o.produce(r.publisher,e,a);return x(200,R[".kan.yml"],d)}function je(r,e,i){let t=r.pkgVersions.get(e);if(!t||t.length===0)return null;switch(i.kind){case"any":return t[0].verStr;case"major-pin":return t.find(o=>o.version.major===i.major)?.verStr??null;case"minor-pin":return t.find(o=>o.version.major===i.major&&o.version.minor===i.minor)?.verStr??null;case"exact":return t.find(o=>o.version.major===i.major&&o.version.minor===i.minor&&o.version.patch===i.patch)?.verStr??null;default:return null}}async function ge(r,e,i=""){let{lookRenderer:t,publisher:o}=r;if(e==="/.well-known/kanonak.json")return r.configSource?x(200,R[".json"],r.configSource):x(200,R[".json"],JSON.stringify($e(),null,2));if(e==="/kanonak.lock")return r.lockSource?x(200,R[".kan.yml"],r.lockSource):F(e);if(e==="/.well-known/kanonak-render.json")return x(200,R[".json"],JSON.stringify(se(r),null,2));if(e==="/.well-known/kanonak-render")return x(200,R[".html"],ue(se(r)));if(e==="/"||e==="/index.html"||e==="/index.css"){let l=t.publisherSubject(o);return e==="/index.css"?x(200,R[".css"],t.renderStylesheet(l)):x(200,R[".html"],await t.renderDocument(l,{rootIndex:!0}))}let a=".html",u=!1,d=e;for(let l of[".kan.yml",".css",".svg",".md",".html"])if(e.endsWith(l)){a=l,u=!0,d=e.slice(0,-l.length);break}let f=!u&&/application\/yaml|text\/yaml/i.test(i),y=d.endsWith("/");y&&d!=="/"&&(d=d.slice(0,-1));let s=Re.parse(d,o);if(!s)return F(e);if(s.kind==="package"){let l=je(r,s.package_,s.versionSpec);if(!l)return await Oe(r,s.package_,s.versionSpec,a===".kan.yml"||f)??F(e);if(a===".kan.yml"||f){let h=r.rawByNsKey.get(`${s.package_}@${l}`);return h!==void 0?x(200,R[".kan.yml"],h):F(e)}let k=r.pkgSelfByVer.get(`${s.package_}@${l}`);if(!k)return F(e);if(a===".css")return x(200,R[".css"],t.renderStylesheet(k));if(!y)return Ue(d+"/");let p=s.versionSpec.kind==="any";if(p&&!t.hasDeclaredView(k)){let h=(r.pkgVersions.get(s.package_)||[]).map(S=>S.verStr);return x(200,R[".html"],t.renderPackageVersionList(s.package_,h,k))}return x(200,R[".html"],await t.renderDocument(k,p?{bareOverview:!0}:void 0))}if(s.kind==="resource"){let l=je(r,s.package_,s.versionSpec);if(!l)return F(e);let k=r.bySubject.get(`${o}/${s.package_}@${l}/${s.name}`);if(!k)return F(e);switch(a){case".css":return x(200,R[".css"],t.renderStylesheet(k));case".svg":return x(200,R[".svg"],await t.renderSvg(k));case".md":{let p=t.renderRawMarkdown(k);return p===void 0?F(e):x(200,R[".md"],p)}default:return x(200,R[".html"],await t.renderDocument(k))}}return F(e)}import{readFileSync as We}from"fs";var Ce=/^\d+\.\d+\.\d+$/,me=class{constructor(e={}){this.options=e}options;models=new Map;workspaceIndex;clearCache(){this.models.clear(),this.workspaceIndex=void 0}getWorkspaceIndex(){if(this.workspaceIndex)return this.workspaceIndex;let e=new Set,i=new Set;if(this.options.root!==void 0){let t=new B;for(let o of Z(this.options.root))try{let a=t.parse(We(o,"utf-8")).metadata?.namespace_;if(!a?.version)continue;let u=a.version;e.add(`${a.publisher}/${a.package_}@${u.major}.${u.minor}.${u.patch}`),i.add(`${a.publisher}/${a.package_}`)}catch{}}return this.workspaceIndex={exact:e,pkgs:i},this.workspaceIndex}async modelFor(e,i,t){let o=this.getWorkspaceIndex(),a={...this.options.fetchFn?{fetchFn:this.options.fetchFn}:{},...this.options.packageUrlTemplates?{packageUrlTemplates:this.options.packageUrlTemplates}:{},...this.options.log?{log:this.options.log}:{}},u=i?t?o.exact.has(`${e}/${i}@${t}`):o.pkgs.has(`${e}/${i}`):[...o.pkgs].some(l=>l.startsWith(`${e}/`)),d,f;if(u&&this.options.root!==void 0){let l=this.options.root;d=`ws:${e}`,f=()=>de(l,{publisher:e,...a})}else{let l=i?t?`${e}/${i}@${t}`:`${e}/${i}`:e;d=`rm:${l}`,f=()=>pe(l,a)}let y=this.models.get(d);if(y)return y;let s=await f();return s.lookRenderer.setLinkMode("open-world"),this.models.set(d,s),s}async handle(e,i=""){let t=e.split("/").filter(Boolean);if(t.length===0)return{status:200,headers:{"Content-Type":"text/html; charset=utf-8"},body:Ne()};let o=t[0];if(!o.includes("."))return{status:404,headers:{"Content-Type":"text/html; charset=utf-8"},body:"<!doctype html><meta charset=utf-8><title>404</title><h1>404</h1><p>Expected a publisher domain as the first path segment: <code>/{publisher}/{package}/{version}/{resource}</code></p>"};let a=t.length>=2&&(t[1]==="index.html"||t[1]==="index.css"||t[1]==="kanonak.lock"||t[1]===".well-known"),u=!a&&t.length>=2?t[1]:void 0,d=!a&&t.length>=3&&Ce.test(t[2])?t[2]:void 0,f=await this.modelFor(o,u,d),y=e.endsWith("/")&&t.length>1?"/":"",s="/"+t.slice(1).join("/")+y,l=await ge(f,s,i);return l.headers.Location?{...l,headers:{...l.headers,Location:`/${o}${l.headers.Location}`}}:l}};function qe(r){switch(r.kind){case"publisher":return`/${r.publisher}/`;case"package":return r.version?`/${r.publisher}/${r.package_}/${j(r.version)}/`:`/${r.publisher}/${r.package_}/`;case"resource":{let e=r.uri;return e.version?`/${e.publisher}/${e.package_}/${j(e.version)}/${e.name}`:`/${e.publisher}/${e.package_}/${e.name}`}}}function He(r){let e=r.split("/").filter(Boolean),i=e[0];if(!i||!i.includes("."))return;let t=e[1];if(!t)return{kind:"publisher",publisher:i};let o=e[2]&&Ce.test(e[2])?Y(e[2])??void 0:void 0,a=o?e[3]:e[2];return a?{kind:"resource",uri:new be(i,t,a,o)}:o?{kind:"package",publisher:i,package_:t,version:o}:{kind:"package",publisher:i,package_:t}}function Ne(){return'<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Kanonak origin</title></head><body style="font-family:system-ui;max-width:40rem;margin:4rem auto;padding:0 1rem"><h1>Kanonak request-driven origin</h1><p>Open a resource by its address:</p><p><code>/{publisher}/{package}/{version}/{resource}</code></p><p>e.g. <code>/kanonak.org/capabilities/2.0.0/Capability</code></p></body></html>'}export{W as ClosureScopedRepository,me as RequestRouter,Pe as UNIVERSAL_RENDER_BASE,He as addressForRequestPath,se as buildRenderDiagnostics,H as buildRenderStackWarnings,O as deriveImportClosure,Ne as landingPage,pe as loadResourceModel,de as loadServerModel,ue as renderDiagnosticsHtml,C as renderRefKey,qe as requestPathFor,q as resolveRenderContract,ge as route};
72
+ </html>`}var R={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".svg":"image/svg+xml",".md":"text/markdown; charset=utf-8",".kan.yml":"application/yaml; charset=utf-8",".txt":"text/plain; charset=utf-8",".json":"application/json; charset=utf-8"},x=(r,e,i,t)=>({status:r,headers:{"Content-Type":e,...t||{}},body:i}),F=r=>x(404,R[".html"],`<!doctype html><meta charset=utf-8><title>404</title><h1>404</h1><p>Not found: ${r}</p>`),Ue=r=>({status:301,headers:{Location:r},body:""}),Be=r=>({status:302,headers:{Location:r},body:""});function Le(r){switch(r.kind){case"exact":return{operator:ae.Exact,version:L(r.major,r.minor,r.patch)};case"minor-pin":return{operator:ae.Compatible,version:L(r.major,r.minor,0)};case"major-pin":return{operator:ae.Major,version:L(r.major,0,0)};default:return{operator:ae.Any,version:L(0,0,0)}}}async function Oe(r,e,i,t){if(!t)return null;let o=r.producers?.find(f=>f.canProduce(r.publisher,e));if(!o)return null;let a=await o.resolveVersion(r.publisher,e,Le(i));if(!a)return null;let u=j(a);if(i.kind!=="exact")return Be(`/${e}/${u}.kan.yml`);let{source:p}=await o.produce(r.publisher,e,a);return x(200,R[".kan.yml"],p)}function je(r,e,i){let t=r.pkgVersions.get(e);if(!t||t.length===0)return null;switch(i.kind){case"any":return t[0].verStr;case"major-pin":return t.find(o=>o.version.major===i.major)?.verStr??null;case"minor-pin":return t.find(o=>o.version.major===i.major&&o.version.minor===i.minor)?.verStr??null;case"exact":return t.find(o=>o.version.major===i.major&&o.version.minor===i.minor&&o.version.patch===i.patch)?.verStr??null;default:return null}}async function ge(r,e,i=""){let{lookRenderer:t,publisher:o}=r;if(e==="/.well-known/kanonak.json")return r.configSource?x(200,R[".json"],r.configSource):x(200,R[".json"],JSON.stringify($e(),null,2));if(e==="/kanonak.lock")return r.lockSource?x(200,R[".kan.yml"],r.lockSource):F(e);if(e==="/.well-known/kanonak-render.json")return x(200,R[".json"],JSON.stringify(se(r),null,2));if(e==="/.well-known/kanonak-render")return x(200,R[".html"],ue(se(r)));if(e==="/"||e==="/index.html"||e==="/index.css"){let d=t.publisherSubject(o);return e==="/index.css"?x(200,R[".css"],t.renderStylesheet(d)):x(200,R[".html"],await t.renderDocument(d,{rootIndex:!0}))}let a=".html",u=!1,p=e;for(let d of[".kan.yml",".css",".svg",".md",".html"])if(e.endsWith(d)){a=d,u=!0,p=e.slice(0,-d.length);break}let f=!u&&/application\/yaml|text\/yaml/i.test(i),y=p.endsWith("/");y&&p!=="/"&&(p=p.slice(0,-1));let s=Re.parse(p,o);if(!s)return F(e);if(s.kind==="package"){let d=je(r,s.package_,s.versionSpec);if(!d)return await Oe(r,s.package_,s.versionSpec,a===".kan.yml"||f)??F(e);if(a===".kan.yml"||f){let h=r.rawByNsKey.get(`${s.package_}@${d}`);return h!==void 0?x(200,R[".kan.yml"],h):F(e)}let k=r.pkgSelfByVer.get(`${s.package_}@${d}`);if(!k)return F(e);if(a===".css")return x(200,R[".css"],t.renderStylesheet(k));if(!y)return Ue(p+"/");let l=s.versionSpec.kind==="any";if(l&&!t.hasDeclaredView(k)){let h=(r.pkgVersions.get(s.package_)||[]).map(S=>S.verStr);return x(200,R[".html"],t.renderPackageVersionList(s.package_,h,k))}return x(200,R[".html"],await t.renderDocument(k,l?{bareOverview:!0}:void 0))}if(s.kind==="resource"){let d=je(r,s.package_,s.versionSpec);if(!d)return F(e);let k=r.bySubject.get(`${o}/${s.package_}@${d}/${s.name}`);if(!k)return F(e);switch(a){case".css":return x(200,R[".css"],t.renderStylesheet(k));case".svg":return x(200,R[".svg"],await t.renderSvg(k));case".md":{let l=t.renderRawMarkdown(k);return l===void 0?F(e):x(200,R[".md"],l)}default:return x(200,R[".html"],await t.renderDocument(k))}}return F(e)}import{readFileSync as We}from"fs";var Ce=/^\d+\.\d+\.\d+$/,me=class{constructor(e={}){this.options=e}options;models=new Map;workspaceIndex;clearCache(){this.models.clear(),this.workspaceIndex=void 0}getWorkspaceIndex(){if(this.workspaceIndex)return this.workspaceIndex;let e=new Set,i=new Set;if(this.options.root!==void 0){let t=new B;for(let o of Z(this.options.root))try{let a=t.parse(We(o,"utf-8")).metadata?.namespace_;if(!a?.version)continue;let u=a.version;e.add(`${a.publisher}/${a.package_}@${u.major}.${u.minor}.${u.patch}`),i.add(`${a.publisher}/${a.package_}`)}catch{}}return this.workspaceIndex={exact:e,pkgs:i},this.workspaceIndex}async modelFor(e,i,t){let o=this.getWorkspaceIndex(),a={...this.options.fetchFn?{fetchFn:this.options.fetchFn}:{},...this.options.packageUrlTemplates?{packageUrlTemplates:this.options.packageUrlTemplates}:{},...this.options.log?{log:this.options.log}:{}},u=i?t?o.exact.has(`${e}/${i}@${t}`):o.pkgs.has(`${e}/${i}`):[...o.pkgs].some(d=>d.startsWith(`${e}/`)),p,f;if(u&&this.options.root!==void 0){let d=this.options.root;p=`ws:${e}`,f=()=>de(d,{publisher:e,...a})}else{let d=i?t?`${e}/${i}@${t}`:`${e}/${i}`:e;p=`rm:${d}`,f=()=>pe(d,a)}let y=this.models.get(p);if(y)return y;let s=await f();return s.lookRenderer.setLinkMode("open-world"),this.models.set(p,s),s}async handle(e,i=""){let t=e.split("/").filter(Boolean);if(t.length===0)return{status:200,headers:{"Content-Type":"text/html; charset=utf-8"},body:Ne()};let o=t[0];if(!o.includes("."))return{status:404,headers:{"Content-Type":"text/html; charset=utf-8"},body:"<!doctype html><meta charset=utf-8><title>404</title><h1>404</h1><p>Expected a publisher domain as the first path segment: <code>/{publisher}/{package}/{version}/{resource}</code></p>"};let a=t.length>=2&&(t[1]==="index.html"||t[1]==="index.css"||t[1]==="kanonak.lock"||t[1]===".well-known"),u=!a&&t.length>=2?t[1]:void 0,p=!a&&t.length>=3&&Ce.test(t[2])?t[2]:void 0,f=await this.modelFor(o,u,p),y=e.endsWith("/")&&t.length>1?"/":"",s="/"+t.slice(1).join("/")+y,d=await ge(f,s,i);return d.headers.Location?{...d,headers:{...d.headers,Location:`/${o}${d.headers.Location}`}}:d}};function qe(r){switch(r.kind){case"publisher":return`/${r.publisher}/`;case"package":return r.version?`/${r.publisher}/${r.package_}/${j(r.version)}/`:`/${r.publisher}/${r.package_}/`;case"resource":{let e=r.uri;return e.version?`/${e.publisher}/${e.package_}/${j(e.version)}/${e.name}`:`/${e.publisher}/${e.package_}/${e.name}`}}}function He(r){let e=r.split("/").filter(Boolean),i=e[0];if(!i||!i.includes("."))return;let t=e[1];if(!t)return{kind:"publisher",publisher:i};let o=e[2]&&Ce.test(e[2])?Y(e[2])??void 0:void 0,a=o?e[3]:e[2];return a?{kind:"resource",uri:new be(i,t,a,o)}:o?{kind:"package",publisher:i,package_:t,version:o}:{kind:"package",publisher:i,package_:t}}function Ne(){return'<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Kanonak origin</title></head><body style="font-family:system-ui;max-width:40rem;margin:4rem auto;padding:0 1rem"><h1>Kanonak request-driven origin</h1><p>Open a resource by its address:</p><p><code>/{publisher}/{package}/{version}/{resource}</code></p><p>e.g. <code>/kanonak.org/capabilities/2.0.0/Capability</code></p></body></html>'}export{W as ClosureScopedRepository,me as RequestRouter,Pe as UNIVERSAL_RENDER_BASE,He as addressForRequestPath,se as buildRenderDiagnostics,H as buildRenderStackWarnings,O as deriveImportClosure,Ne as landingPage,pe as loadResourceModel,de as loadServerModel,ue as renderDiagnosticsHtml,C as renderRefKey,qe as requestPathFor,q as resolveRenderContract,ge as route};
@@ -46,8 +46,11 @@ export interface ShaclFinding {
46
46
  constraintComponent: EntityUri;
47
47
  severity: ShaclSeverity;
48
48
  message: string;
49
- /** The NodeShape that produced this finding. */
50
- sourceShape: string;
49
+ /**
50
+ * The NodeShape that produced this finding. Absent for a key violation,
51
+ * which comes from a class's `owl:hasKey`, not a shape.
52
+ */
53
+ sourceShape?: string | undefined;
51
54
  sourceShapeUri?: KanonakUri | undefined;
52
55
  }
53
56
  export interface ShaclConformanceResult {
@@ -58,6 +61,8 @@ export interface ShaclConformanceResult {
58
61
  /**
59
62
  * Evaluate every NodeShape in `shapes` against the scope. `shapes` may be a
60
63
  * pre-built model or a catalog to read shapes from (commonly the scope's own
61
- * catalog: shapes travel as packages like everything else).
64
+ * catalog: shapes travel as packages like everything else). A catalog also
65
+ * supplies its classes' keys (`owl:hasKey`), each evaluated as uniqueness
66
+ * over the scope (typescript#134); a pre-built model carries shapes only.
62
67
  */
63
68
  export declare function evaluateConformance(scope: ConformanceScope, shapes: ShaclNodeShapeModel[] | Kanonak[]): ShaclConformanceResult;
@@ -35,15 +35,43 @@ export interface ConformanceScope {
35
35
  * payload gets no inference.
36
36
  */
37
37
  reasoning?: ReasoningResult | undefined;
38
+ /**
39
+ * The subjects the evaluation judges, by subject address, when the catalog
40
+ * holds more than the data being judged. A closure scope judges the
41
+ * documents it was built from, while the rest of their import closure only
42
+ * supplies the shapes, classes and referenced subjects (typescript#135).
43
+ * Embedded values are judged with the subject they sit under. Absent: every
44
+ * node in the catalog is judged.
45
+ */
46
+ focus?: ReadonlySet<string> | undefined;
38
47
  }
39
48
  /**
40
49
  * Build a merged scope from a repository — the pinned load-set. One parse
41
- * (the same open-world merge every SDK consumer sees) + one reasoning pass
42
- * over the same repository, so targeting and class checks are
43
- * closure-aware. The caller owns WHAT is in the repository; that is the
44
- * authorization boundary.
50
+ * (the same open-world merge every SDK consumer sees), reasoned over, so
51
+ * targeting and class checks are closure-aware. The caller owns WHAT is in
52
+ * the repository; that is the authorization boundary. Every document the
53
+ * repository enumerates is in scope: a workspace repository backed by the
54
+ * global cache brings in every cached version of every package. To judge
55
+ * documents against what they import, use {@link scopeFromClosureAsync}.
45
56
  */
46
57
  export declare function scopeFromRepositoryAsync(repository: IKanonakDocumentRepository): Promise<ConformanceScope>;
58
+ /**
59
+ * Build a merged scope that judges `seeds` against their own import closure,
60
+ * at the exact versions it resolves to through `repository` (typescript#135).
61
+ *
62
+ * The catalog is the closure and nothing else: a version of a package that no
63
+ * import resolved to does not enter it, wherever it is stored (the workspace,
64
+ * the global cache), so its shapes cannot bind the seeds' nodes. Names still
65
+ * resolve through the whole repository, so a `mode: link` target resolves
66
+ * without joining the closure. Only the seeds' own nodes are judged
67
+ * ({@link ConformanceScope.focus}), including subjects of other packages that
68
+ * a seed augments; the rest of the closure supplies their contracts.
69
+ *
70
+ * Every seed must be a document of `repository`, and every import in the
71
+ * closure must resolve. A partial closure would judge the seeds against fewer
72
+ * contracts than they declare, so an unresolved import is an error.
73
+ */
74
+ export declare function scopeFromClosureAsync(seeds: KanonakDocument[], repository: IKanonakDocumentRepository): Promise<ConformanceScope>;
47
75
  /**
48
76
  * Build a merged scope from an already-parsed catalog (e.g. a validation
49
77
  * pass's single-parse `ValidationCache.getKanonaks()`), optionally with an
@@ -85,3 +85,26 @@ export interface ShaclNodeShapeModel {
85
85
  * definition validator warns about it separately).
86
86
  */
87
87
  export declare function buildShapesModel(shapesCatalog: Kanonak[]): ShaclNodeShapeModel[];
88
+ /**
89
+ * A class's key, `owl:hasKey` (typescript#134): properties whose values
90
+ * jointly identify a named instance of the class or of its subclasses.
91
+ */
92
+ export interface ShaclClassKeyModel {
93
+ /** The keyed class. */
94
+ classUri: KanonakUri;
95
+ /** How messages name the class. */
96
+ className: string;
97
+ /** The key's properties, in authored order. */
98
+ properties: KanonakUri[];
99
+ }
100
+ /**
101
+ * The keys the classes in a catalog declare. A key is part of the contract
102
+ * the data is held to, like a shape, so conformance reads keys from the same
103
+ * catalog it reads shapes from. Each `owl:hasKey` statement on a class is a
104
+ * key of its own; two never merge into one composite key.
105
+ *
106
+ * A key that lists nothing, or lists anything but a property defined in the
107
+ * catalog, is an error: every instance would be unkeyed, and the uniqueness
108
+ * check would pass by construction.
109
+ */
110
+ export declare function buildKeysModel(catalog: Kanonak[]): ShaclClassKeyModel[];
@@ -1,7 +1,7 @@
1
- export { scopeFromRepositoryAsync, scopeFromCatalog, scopeFromDocumentAsync, } from './ConformanceScope.js';
1
+ export { scopeFromRepositoryAsync, scopeFromClosureAsync, scopeFromCatalog, scopeFromDocumentAsync, } from './ConformanceScope.js';
2
2
  export type { ConformanceScope } from './ConformanceScope.js';
3
- export { buildShapesModel } from './ShapesModel.js';
4
- export type { ShaclNodeShapeModel, ShaclPropertyConstraint, ShaclNodeKind, ShaclSeverity, } from './ShapesModel.js';
3
+ export { buildShapesModel, buildKeysModel } from './ShapesModel.js';
4
+ export type { ShaclNodeShapeModel, ShaclClassKeyModel, ShaclPropertyConstraint, ShaclNodeKind, ShaclSeverity, } from './ShapesModel.js';
5
5
  export { lowerConstraint, foldFlagsIntoPattern } from './lowering.js';
6
6
  export type { LoweredCheck, LoweredExprNode } from './lowering.js';
7
7
  export { evaluateConformance } from './ConformanceEvaluator.js';
@@ -70,3 +70,4 @@ export declare const SH_QUALIFIED_MAX_COUNT: EntityUri;
70
70
  export declare const SH_COMP_HAS_VALUE: EntityUri;
71
71
  export declare const SH_COMP_QUALIFIED_MIN_COUNT: EntityUri;
72
72
  export declare const SH_COMP_QUALIFIED_MAX_COUNT: EntityUri;
73
+ export declare const SH_COMP_HAS_KEY: EntityUri;