@kanonak-protocol/sdk 6.2.0 → 6.3.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 (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as xt,b as Kt,c as Nt,d as Lt,e as z}from"./chunk-A3HRXFVX.js";import{a as Dn,b as jn,c as Hn}from"./chunk-R4LVLXAC.js";import{a as Pt,b as _t,c as wt,d as Hr,e as Fr,f as Tr,g as Wr,h as qr,i as Br,j as Le,k as Gr,l as Ie,m as Oe,n as zr,o as Qr,p as Xr,q as de,r as Yr,s as Ae}from"./chunk-EKD2ZLKQ.js";import{a as Jr}from"./chunk-ED35OFGD.js";import{a as $r,b as Ur,c as Mr,d as Q,e as Dr,f as jr,g as Ne,h as Zr,i as ei,j as ni,k as oi,l as ti}from"./chunk-ADSDFJUO.js";import{a as Po,b as _o,c as wo,d as xo,e as Ko,f as Wo,g as qo,h as Bo,i as Go}from"./chunk-66GZUKYS.js";import{a as Ao,b as Vo,c as $o,d as Uo,e as Mo,f as Do,h as jo,i as qe,j as Be,k as Ge,l as ze,m as Qe,n as Ho,o as To}from"./chunk-MD4CAJIO.js";import{a as Ot,b as At,c as Vt,d as $t,e as Ut,f as Mt}from"./chunk-GKIX3OD6.js";import{a as Dt,b as Ht}from"./chunk-D2X6J77P.js";import{a as Fo}from"./chunk-SC5M74NM.js";import{A as mr,B as hr,C as Sr,D as kr,E as gr,F as yr,G as Kr,H as Nr,I as Lr,J as Ir,K as Or,L as Ar,M as Vr,a as Ft,b as Tt,c as Wt,d as qt,e as Bt,f as Gt,g as zt,h as Qt,i as Xt,j as Yt,k as Jt,l as Zt,m as er,n as nr,o as or,p as tr,q as rr,r as ir,s as ar,t as sr,u as cr,v as dr,w as ur,x as lr,y as pr,z as fr}from"./chunk-MWJSYONH.js";import"./chunk-VORVR5BZ.js";import{c as $n,d as Er,e as br,f as Cr,g as Rr,i as vr,j as Pr,m as _r,o as Ke,q as Un,r as Mn,t as wr,u as xr}from"./chunk-TYVZXABI.js";import"./chunk-QHABFCRC.js";import{a as No,b as Lo,c as Io,d as Oo,e as N}from"./chunk-5FVUBF7N.js";import{a as Se}from"./chunk-6VIUXP4N.js";import{a as we,g as $,h as xe,i as Rt,j as vt,k as H}from"./chunk-22DSABP6.js";import{a as F}from"./chunk-7JBKOJB4.js";import{a as jt}from"./chunk-PEJALHXK.js";import{$ as ae,A as un,B as ln,C as pn,D as fn,E as mn,F as hn,G as Sn,H as kn,I as gn,J as yn,K as be,L as En,M as bn,N as Cn,O as Rn,P as vn,Q as Pn,R as _n,S as wn,T as xn,U as Kn,V as Nn,W as Ln,X as In,Y as On,Z as Ce,_ as An,a as st,aa as Re,b as ct,ba as ve,c as W,ca as se,d as pt,da as B,e as ft,ea as G,g as mt,h as te,ha as ht,i as re,ia as St,j as Xe,k as q,ka as kt,l as ie,m as Ye,ma as gt,n as Je,na as k,o as ye,oa as _e,p as Ze,pa as yt,q as en,qa as Et,r as nn,s as on,t as Ee,ta as bt,u as tn,ua as Ct,v as rn,va as j,w as an,x as sn,y as cn,z as dn}from"./chunk-NUTHBBDZ.js";import{C as D,D as R,E as oe,F as S,G as T,H as ge,I as ce,J as Pe,L as Vn,a as zo,b as Qo,c as g,d as L,e as I,f as Yo,g as Jo,h as Zo,i as et,j as nt,k as ot,l as tt,m as rt,n as it,o as at,p as dt,q as ut,r as l,u as lt,v as M,w as ke,x as ne,z as _}from"./chunk-D4QGPMRW.js";import{a as Xo}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{a as So,b as ko,c as ee,d as go,e as V,f as yo,g as Eo,h as bo,i as Co,j as Ro,k as vo}from"./chunk-QILEJIFU.js";import{a as It}from"./chunk-ODIECDN7.js";async function Fn(n){let e=await new H().parseKanonaks(n),t=await new z().reason(n);return{kind:"merged",catalog:e,reasoning:t}}function Tn(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function Wn(n,e){let t=e??new Se(new F);return{kind:"standalone",catalog:await new H().parseKanonaks(new Vn(n,t))}}function O(n){return typeof n=="number"?n:void 0}function ri(n){if(!n)return;let e=l(n);if(e===l(kn))return"IRI";if(e===l(gn))return"BlankNode";if(e===l(yn))return"Literal"}function Bn(n){if(!n)return;let e=l(n);if(e===l(En))return"Violation";if(e===l(bn))return"Warning";if(e===l(Cn))return"Info"}function Gn(n,e,t,o){let r=S(e,ye);if(!r)return;let i={path:r},d=O(R(e,Ze)),s=O(R(e,en));d!==void 0&&(i.minCount=d),s!==void 0&&(i.maxCount=s);let a=O(R(e,an)),u=O(R(e,sn));a!==void 0&&(i.minLength=a),u!==void 0&&(i.maxLength=u);let c=O(R(e,cn)),p=O(R(e,dn));c!==void 0&&(i.minInclusive=c),p!==void 0&&(i.maxInclusive=p);let m=oe(e,tn);if(m!==void 0){let h=oe(e,rn);i.pattern=h!==void 0?{regex:m,flags:h}:{regex:m}}if(D(e,Ee)){let h=[],K=[];for(let{item:y}of ke(e,Ee))"literal"in y?h.push(y.value):y instanceof I&&K.push(y.subject);h.length>0&&(i.inValues=h),K.length>0&&(i.inRefs=K)}let f=S(e,nn);f&&(i.datatype=f);let A=S(e,on);A&&(i.classRef=A);let v=ri(S(e,Sn));v&&(i.nodeKind=v);let U=S(e,An);if(U&&(i.hasValue=U),D(e,ae)||D(e,Re)||D(e,ve)){let h={},K=O(R(e,Re)),y=O(R(e,ve));K!==void 0&&(h.minCount=K),y!==void 0&&(h.maxCount=y);let P=ii(n,e,o);"problem"in P?h.problem=P.problem:h.shape=P.shape,i.qualified=h}let x=oe(e,un);x!==void 0&&(i.message=x);let J=Bn(S(e,be))??t;return J&&(i.severity=J),i}function ii(n,e,t){let o=T(e,ae);if(o)return qn(n,o,void 0,t);let r=S(e,ae);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?qn(n,d,i,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function qn(n,e,t,o){let r=t?new Set([...o,t]):o,i=ne(e,q);if((ne(e,ie)||D(e,ye))&&!i){let a=Gn(n,e,void 0,r);return a?{shape:{kind:"property",constraint:a}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof g&&!i?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:zn(n,e,r)}}}function zn(n,e,t){let o=Bn(S(e,be)),r={name:e instanceof g?e.name:"(inline shape)",uri:e instanceof g?k(e):void 0,targetClass:S(e,Ye),targetNodes:M(e,ln),targetSubjectsOf:M(e,pn),targetObjectsOf:M(e,fn),closed:R(e,mn)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...M(e,hn));for(let{item:i}of ke(e,Je)){let d;if(i instanceof L?d=i:i instanceof I&&(d=_(n,i.subject)),!d)continue;let s=Gn(n,d,o,t);s&&r.properties.push(s)}return r}function ue(n){let e=[];for(let t of n){if(!(t instanceof g)||!ne(t,q))continue;let o=k(t);e.push(zn(n,t,new Set(o?[l(o)]:[])))}return e}var b="kanonak.org/transformations",X="values";var le="allowed",$e="expected",E=n=>({type:`${b}/VarRef`,varName:n}),Ve=n=>({type:`${b}/IntegerLiteral`,integerLiteral:n}),ai=n=>({type:`${b}/DecimalLiteral`,decimalLiteral:n}),Qn=n=>Number.isInteger(n)?Ve(n):ai(n),Xn=n=>({type:`${b}/Count`,source:n}),Yn=(n,e)=>({type:`${b}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),Jn=(n,e)=>({type:`${b}/LessThanOrEqual`,compareLeft:n,compareRight:e});function Ue(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 pe(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:Yn(Xn(E(X)),Ve(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:Jn(Xn(E(X)),Ve(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${b}/Contains`,haystack:E(X),needle:E($e)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${b}/Contains`,haystack:E(le),needle:E("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${b}/Matches`,matchSource:E("v"),pattern:Ue(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:Yn(E("v"),Qn(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:Jn(E("v"),Qn(n.maxInclusive))}),e}import{evaluate as ci,ExpressionError as di}from"@kanonak-protocol/expression";function eo(n,e){let t=ui(e)?e:ue(e),o=[],r=n.catalog.filter(s=>s instanceof g).map(fe),i=new Map;li(r,i);let d={scope:n,membership:new Me(n),embeddedFocus:i};for(let s of t)for(let a of pi(d,s,r))oo(d,s,a,o);return{conforms:!o.some(s=>s.severity==="Violation"),results:o}}function ui(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function no(n){let e=n.predicate;return e instanceof I?e:void 0}function fe(n){return{node:n,key:Pe(n),uri:k(n),label:n.name}}function je(n,e){return{node:n,key:e,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function li(n,e){we(n.map(t=>t.node),({kanonak:t,address:o})=>{t instanceof L&&!e.has(t)&&e.set(t,je(t,o))})}var Me=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(_e(this.scope.catalog,e).map(r=>l(r))),this.ancestors.set(t,o)),o}};function pi(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;if(o.reasoning){let a=new Set(o.reasoning.getInstancesOfClass(s));for(let u of t)u.uri&&a.has(l(u.uri))&&i(u)}else for(let a of t)n.membership.isInstance(j(a.node),s)&&i(a);for(let a of n.embeddedFocus.values())n.membership.isInstance(j(a.node),s)&&i(a)}for(let s of e.targetNodes){let a=_(o.catalog,s);a instanceof g&&i(fe(a))}for(let s of e.targetSubjectsOf){let a=l(s);for(let u of d())u.node.statement.some(c=>{let p=no(c);return p&&l(p.subject)===a})&&i(u)}for(let s of e.targetObjectsOf)for(let a of d())for(let u of ce(a.node,s,o.catalog,a.key))u.kind==="subject"?i(fe(u.node)):u.kind==="embedded"&&i(n.embeddedFocus.get(u.node)??je(u.node,u.address));return[...r.values()]}function fi(n,e,t){return e.node?ce(e.node,t,n.scope.catalog,e.key).map(o=>mi(n,o)):[]}function mi(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)??je(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 oo(n,e,t,o){for(let r of e.properties)ro(n,e,t,r,o);e.closed&&Pi(e,t,o)}function De(n,e,t,o,r={},i){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:i??to(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function to(n){return n.severity??"Violation"}var hi={minCount:Rn,maxCount:vn,hasValue:se,in:wn,pattern:xn,minLength:Kn,maxLength:Nn,minInclusive:Ln,maxInclusive:In};function ro(n,e,t,o,r){let i=fi(n,t,o.path),d=o.severity??to(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=De(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 pe(o)){let p=hi[c.component];if(c.per==="node"){let m={[X]:i.map(f=>f.kernel),[le]:a};o.hasValue&&(m[$e]={ref:l(o.hasValue)}),Zn(c,m)||u(p,Si(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}Zn(c,{v:m.kernel,[le]:a})||u(p,bi(c,s,o,m),m)}}if(o.nodeKind)for(let c of i)Ci(o.nodeKind,c)||u(On,`'${s}' value is ${c.kind}; nodeKind requires ${o.nodeKind}.`,c);if(o.datatype)for(let c of i){let p=Ri(o.datatype,c);p&&u(Pn,`'${s}' ${p}`,c)}if(o.classRef)for(let c of i){let p=vi(n,o.classRef,c);p&&u(_n,`'${s}' ${p}`,c)}o.qualified&&ki(n,o,i,s,u)}function Si(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 ki(n,e,t,o,r){let i=e.qualified,d=i.maxCount!==void 0?G:B,s=(u,c)=>{io.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=gi(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=Ei(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(B,`'${o}' has ${a} value(s) that conform to the qualified shape; qualifiedMinCount is ${i.minCount}.`),i.maxCount!==void 0&&a>i.maxCount&&r(G,`'${o}' has ${a} value(s) that conform to the qualified shape; qualifiedMaxCount is ${i.maxCount}.`)}function gi(n,e){switch(e.kind){case"reference":return e.subject?fe(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var yi={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},io=new WeakSet;function Ei(n,e,t){let o=[];e.kind==="property"?ro(n,yi,t,e.constraint,o):oo(n,e.shape,t,o);let r=o.find(i=>io.has(i));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function bi(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 Zn(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 di(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return ci(n.expr,void 0,t)===1}function Ci(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 Ri(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=xe(n);if(t!==void 0)switch(t){case $.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case $.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 $.Decimal:case $.Double:case $.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 vi(n,e,t){if(t.kind==="embedded"&&t.embedded?.node){let r=j(t.embedded.node);return r.length===0?`value ${t.embedded.label} has no type; sh:class requires an instance of ${e.name}.`:n.membership.isInstance(r,e)?void 0:`value ${t.embedded.label} is not an instance of ${e.name}.`}if(t.kind!=="reference"||!t.ref)return`value is not a reference; sh:class requires an instance of ${e.name}.`;if(n.scope.reasoning)return n.scope.reasoning.isInstanceOf(t.ref,e)?void 0:`value ${l(t.ref)} is not an instance of ${e.name}.`;let o=t.subject;return o?n.membership.isInstance(j(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 Pi(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=no(i);if(!d)continue;let s=l(d.subject);o.has(s)||r.has(s)||(r.add(s),t.push(De(n,e,Ce,`'${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(De(n,e,Ce,`'${e.label}' carries unresolvable property '${i.key}' (closed shape).`,{value:i.key})))}var _i="1.1.0",wi=new Set([se,B,G].map(n=>n.name));async function ao(n){let e=new Q(n.repository),t=e.imports(),o=n.result.results.some(a=>wi.has(a.constraintComponent.name))?"1.2.0":_i,r=t.ensure(te,re,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 Cs}from"@kanonak-protocol/types/document/models/enums";import{spawn as xi}from"child_process";var co=12e4,Ki=4096,Y=class{argv;interactive;timeoutMs;stderr;now;constructor(e){this.argv=uo(e.command),this.interactive=e.interactive??!1,this.timeoutMs=e.timeoutMs??co,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=Ie(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=Oe(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:Le,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=xi(this.argv[0],[...this.argv.slice(1),e],{stdio:["pipe","pipe","pipe"],shell:!1,windowsHide:!0})}catch(f){i(so(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(-Ki)}),a.on("error",f=>{clearTimeout(m),s(()=>i(so(o,f)))}),a.on("close",(f,A)=>{clearTimeout(m);let v=c.trim()?`: ${c.trim()}`:"";if(p){s(()=>i(new N(`${o} did not finish within ${Math.round(this.timeoutMs/1e3)}s${v}`)));return}if(f!==0){let x=f!==null?`exit ${f}`:`signal ${A}`;s(()=>i(new N(`${o} failed (${x})${v}`)));return}let U=Buffer.concat(u).toString("utf8").trim();try{let x=JSON.parse(U);s(()=>r(x))}catch{s(()=>i(new N(`${o} exited 0 without printing one JSON answer${v}`)))}}),a.stdin.on("error",()=>{}),a.stdin.end(`${JSON.stringify(t)}
2
- `)})}};function uo(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 so(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 Ni,readFileSync as Li}from"fs";import{homedir as Ii}from"os";import{join as Oi}from"path";var He="KANONAK_CREDENTIAL_HELPER";function lo(){return Oi(Ii(),".kanonak","config.json")}function Ai(n={}){let e=n.env??process.env,t=n.configPath??lo(),o=Vi(e,t);if(o){let i=Object.keys(e).filter(d=>(d===de||d.startsWith(`${de}_`))&&(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 Ae(r)}function Vi(n,e){let t=(n[He]??"").trim();if(t)return{command:t,source:He};if(!Ni(e))return;let o;try{o=JSON.parse(Li(e,"utf-8"))}catch(i){throw new Error(`${e} is not valid JSON: ${i.message}`)}if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`${e} must hold a JSON object`);let r=o.credentialHelper;if(r!==void 0){if(typeof r!="string"||r.trim()==="")throw new Error(`"credentialHelper" in ${e} must be a non-empty command line`);return{command:r.trim(),source:e}}}var C="kanonak.org",w="view",po="core-kanonak",$i={publisher:C,package_:w,name:"rootView"},Ui={publisher:C,package_:w,name:"bind"},Mi={publisher:C,package_:w,name:"produces"},Di={publisher:C,package_:w,name:"projections"},ji={publisher:C,package_:w,name:"where"},Hi={publisher:C,package_:w,name:"value"},Fi={publisher:C,package_:w,name:"as"},me=class{constructor(e,t=new F){this.repository=e;this.parser=t;this.objectParser=new H(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=S(r,Ui);if(!i)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let d=S(r,Mi);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=Ti(r),a=fo(o,C,po),u=fo(o,C,w),c=this.builder.imports(),p=c.ensure(C,po,a,"ck"),m=c.ensure(C,w,u,"v"),f=c.ref(d),A=new Mn(this.repository,this.parser,this.objectParser),v=new Un(A,o),U=this.readProjections(o,r),x=Bi(r,ji),J=this.findInstances(o,i,await this.reason(t)),h={},K=new Set;for(let Z of J){if(!await this.passesWhere(v,o,x,Z))continue;let he={type:f};for(let Te of U){let ho=await this.evaluateValue(v,o,Te.value,Z),We=this.builder.serializeValue(mo(ho),c);We!==void 0&&(he[c.ref(Te.as)]=We)}let Fe=k(Z);Fe&&(he[`${m}.derivedFrom`]=c.ref(Fe)),h[this.rowName(Z,K)]=he}let y={};t.resolvedAt&&(y[`${p}.resolvedAt`]=t.resolvedAt),t.invocationId&&(y[`${p}.id`]=t.invocationId);let P=await this.builder.buildContentAddressed({publisher:s,book:c,body:h,contentHashProperty:`${p}.contentHash`,header:y});return{yaml:P.yaml,contentHash:P.contentHash,packageName:P.packageName,publisher:P.publisher,rowCount:P.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=S(o,$i);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 ge(t,Di)){let i=r instanceof L?r:r instanceof I?_(e,r.subject):void 0;if(!i)continue;let d=T(i,Hi),s=S(i,Fi);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=qi(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=W(k(s)),c=W(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(!Gi(d))return!1}return!0}async evaluateValue(e,t,o,r){let i=$n(o,"view-projection",{catalog:t,depth:0}),d=new Map([["input",r]]);return e.evaluate(i,d)}rowName(e,t){let o=Ne(e.name)||"row",r=o,i=2;for(;t.has(r);)r=`${o}-${i++}`;return t.add(r),r}};function mo(n){return Ke(n)?n.value:Array.isArray(n)?n.map(mo):n}function Ti(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 fo(n,e,t){let o=Wi(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 Wi(n,e,t){let o;for(let r of n){if(!(r instanceof g))continue;let i=k(r);!i||i.publisher!==e||i.package_!==t||!i.version||(!o||ee(i.version,o)>0)&&(o=i.version)}return o?V(o):void 0}function qi(n){let e=new Map,t=new Map;for(let o of n){if(!(o instanceof g))continue;let r=k(o);if(!r||!r.version)continue;let i=W(r),d=t.get(i);(!d||ee(r.version,d)>0)&&(t.set(i,r.version),e.set(i,o))}return e}function Bi(n,e){let t=T(n,e);return t?[t]:ge(n,e).filter(o=>o instanceof L)}function Gi(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Ke(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{dr as AmbiguousReferenceRule,ot as BooleanStatement,Mr as CANONICAL_FORM_VERSION,Qr as CREDENTIAL_EXPIRY_SKEW_SECONDS,He as CREDENTIAL_HELPER_ENV,Le as CREDENTIAL_HELPER_PROTOCOL_VERSION,co as CREDENTIAL_HELPER_TIMEOUT_MS,$ as Carrier,hr as ClassDefinitionRule,or as ClassHierarchyCycleRule,wo as CompositeKanonakDocumentRepository,N as CredentialError,qr as DEFAULT_CONSENT_BINDING_PARAM,Qo as DefinedKanonak,Ar as DiamondNameClashRule,kr as DisplayLensScopeRule,_o as DocumentLocation,_t as EdgeType,L as EmbeddedKanonak,Zt as EmbeddedKanonakTypeRule,rt as EmbeddedStatement,oi as EntitlementDeniedError,ti as EntitlementProducer,Y as ExecCredentialProvider,Po as FileSystemKanonakDocumentRepository,It as GitIgnoreFilter,wt as GraphBuilder,To as HttpKanonakDocumentRepository,Be as INTEGRITY_PREFIX,jr as ImportBook,er as ImportExistenceRule,Se as InMemoryKanonakDocumentRepository,Ao as KANONAK_USER_AGENT,zo as Kanonak,At as KanonakDocumentPositions,No as KanonakHttpError,H as KanonakObjectParser,Vr as KanonakObjectValidator,F as KanonakParser,Xo as KanonakUri,Dt as KanonakUriBuilder,jt as KanonakUrlResolver,kt as KanonakVocabulary,Rr as LINE_STYLES,Gt as LinkTargetRule,it as ListStatement,Yo as LiteralKanonak,Wo as LocalFirstRepository,qo as LockAwareRepository,Nr as LookBandPathRule,wr as LookRenderer,gr as LookSemanticSvgPathRule,Sr as MarkdownLinkRule,at as MarkdownStatement,sr as NamespaceImportCycleRule,zt as NamespacePrefixRule,Pt as NodeType,nt as NumberStatement,Br as OAuthDiscovery,Nt as OWL_RL_CLASSIFICATION_RULES,lr as ObjectPropertyValueValidationRule,Wt as OntologyValidationError,Ft as OntologyValidationResult,Or as OwlOneOfRule,Q as PackageBuilder,Jt as PackageHeaderRule,Zr as ProducerRepository,pr as PropertyDomainRule,tr as PropertyHierarchyCycleRule,fr as PropertyKindRangeConsistencyRule,Ot as PropertyMetadata,ur as PropertyRangeReferenceRule,rr as PropertyRangeRequiredRule,Xt as PropertyTypeSpecificityRule,jo as PublisherConfigResolver,Ho as PublisherIndex,Kt as RDFS_RULES,z as Reasoner,Lt as ReasoningResult,I as ReferenceKanonak,tt as ReferenceStatement,Ko as RepositoryFactory,mr as ReservedNameShadowRule,Qt as ResourceNamingRule,st as ResourceResolver,gt as ResourceTypeClassifier,re as SHACL_PACKAGE,te as SHACL_PUBLISHER,q as SH_NODE_SHAPE,ie as SH_PROPERTY_SHAPE,Xe as SH_SHAPE,Zo as ScalarStatement,Kr as SequenceNarrativeRule,Ir as ShaclShapeRule,Jo as Statement,et as StringStatement,ir as SubClassOfReferenceRule,ar as SubPropertyOfReferenceRule,g as SubjectKanonak,Yt as SubjectKanonakTypeRequiredRule,de as TOKEN_ENV,Ae as TokenCredentialProvider,xt as TripleStore,yr as TxExpressionCompilesRule,Lr as TxExpressionPathRule,ct as TypeResolver,Er as URI_DISPLAY_LABEL,br as URI_DISPLAY_SUMMARY,cr as UnresolvedPredicateRule,nr as UnresolvedReferenceRule,Bt as ValidationCache,qt as ValidationContext,Tt as ValidationSeverity,Cs as VersionOperator,me as ViewMaterializer,ei as allowAllPolicy,Uo as assertHttpsUrl,Fo as assertPackageIdentity,Go as buildLocalFirstRepository,_r as buildOntologyModel,ao as buildReportPackageAsync,ue as buildShapesModel,ht as builtinHomePackages,St as builtinUri,$r as canonicalForm,Ur as canonicalHash,xe as carrierOf,Gr as checkCredentialAnswer,Ie as checkHelperAnswer,Oe as checkHelperEraseAnswer,Bo as collectKanonakFiles,ee as compareVersions,Hn as computeIntegrity,Qe as computeIntegrityAsync,Dr as contentAddressedName,j as contextTypesOf,Xr as createCredentialedFetch,yo as createVersion,Ai as credentialProviderFromConfig,Io as describeResponse,eo as evaluateConformance,vt as extractMarkdownLinks,Jr as findDerivation,Rt as findMalformedReferences,$t as findMarkdownLinkAt,Ue as foldFlagsIntoPattern,ut as formatKanonakAddress,V as formatVersion,xo as getGlobalCachePath,$o as getKanonakUserAgent,Lo as httpError,bo as isCompatibleVersion,Co as isMajorCompatible,Et as isPropertySubject,Mo as kanonakFetch,Dn as loadLockFile,qe as lockedVersion,pe as lowerConstraint,pt as makeUriKey,Wr as narrowestScope,ni as noopMeter,Hr as normalizeHost,dt as parseKanonakAddress,Ge as parseLockFile,Fr as parseScope,Eo as parseVersionString,Vt as parseWithPositions,zr as parseWwwAuthenticate,vo as pickHighestDocument,bt as propertiesInScope,yt as propertyClassOf,vr as readSequenceConnectors,Ht as referenceSpelling,M as referenceUris,Cr as resolveDisplayValue,Ct as resolvePropertyStep,Oo as retryAfterSecondsOf,Ne as sanitizeName,Ro as satisfiesVersionOperator,jn as saveLockFile,Tr as scopeContains,Tn as scopeFromCatalog,Wn as scopeFromDocumentAsync,Fn as scopeFromRepositoryAsync,ze as serializeLockFile,Do as setKanonakFetchRetries,Vo as setKanonakUserAgent,Mt as sourceSymbolAt,Ut as sourceSymbols,uo as splitCommandLine,Pe as subjectAddress,k as subjectUri,_e as superClassChain,xr as supportedBandKeys,Yr as tokenEnvKeyFor,ft as tripleKey,lt as typeReferenceUris,W as uriKey,mt as uriTriple,lo as userConfigPath,ce as valuesOf,So as versionOperatorFromChar,ko as versionOperatorToChar,go as versionsEqual,we as walkDefinedKanonaks,Pr as walkSequence};
1
+ import{a as wt,b as Kt,c as Nt,d as Lt,e as z}from"./chunk-A3HRXFVX.js";import{a as jn,b as Dn,c as Hn}from"./chunk-R4LVLXAC.js";import{a as Pt,b as xt,c as _t,d as Hr,e as Fr,f as Tr,g as Wr,h as qr,i as Br,j as Le,k as Gr,l as Oe,m as Ie,n as zr,o as Qr,p as Xr,q as de,r as Yr,s as Ae}from"./chunk-EKD2ZLKQ.js";import{a as Jr}from"./chunk-ED35OFGD.js";import{a as $r,b as Ur,c as Mr,d as Q,e as jr,f as Dr,g as Ne,h as Zr,i as ei,j as ni,k as oi,l as ti}from"./chunk-ADSDFJUO.js";import{a as Po,b as xo,c as _o,d as wo,e as Ko,f as Wo,g as qo,h as Bo,i as Go}from"./chunk-66GZUKYS.js";import{a as Ao,b as Vo,c as $o,d as Uo,e as Mo,f as jo,h as Do,i as qe,j as Be,k as Ge,l as ze,m as Qe,n as Ho,o as To}from"./chunk-MD4CAJIO.js";import{a as It,b as At,c as Vt,d as $t,e as Ut,f as Mt}from"./chunk-GKIX3OD6.js";import{a as jt,b as Ht}from"./chunk-D2X6J77P.js";import{a as Fo}from"./chunk-SC5M74NM.js";import{A as mr,B as hr,C as Sr,D as kr,E as yr,F as gr,G as Kr,H as Nr,I as Lr,J as Or,K as Ir,L as Ar,M as Vr,a as Ft,b as Tt,c as Wt,d as qt,e as Bt,f as Gt,g as zt,h as Qt,i as Xt,j as Yt,k as Jt,l as Zt,m as er,n as nr,o as or,p as tr,q as rr,r as ir,s as ar,t as sr,u as cr,v as dr,w as ur,x as lr,y as pr,z as fr}from"./chunk-MWJSYONH.js";import"./chunk-VORVR5BZ.js";import{c as $n,d as Er,e as br,f as Cr,g as Rr,i as vr,j as Pr,m as xr,o as Ke,q as Un,r as Mn,t as _r,u as wr}from"./chunk-TYVZXABI.js";import"./chunk-QHABFCRC.js";import{a as No,b as Lo,c as Oo,d as Io,e as N}from"./chunk-5FVUBF7N.js";import{a as Se}from"./chunk-6VIUXP4N.js";import{a as _e,g as $,h as we,i as Rt,j as vt,k as D}from"./chunk-22DSABP6.js";import{a as H}from"./chunk-7JBKOJB4.js";import{a as Dt}from"./chunk-PEJALHXK.js";import{$ as ae,A as un,B as ln,C as pn,D as fn,E as mn,F as hn,G as Sn,H as kn,I as yn,J as gn,K as be,L as En,M as bn,N as Cn,O as Rn,P as vn,Q as Pn,R as xn,S as _n,T as wn,U as Kn,V as Nn,W as Ln,X as On,Y as In,Z as Ce,_ as An,a as st,aa as Re,b as ct,ba as ve,c as T,ca as se,d as pt,da as q,e as ft,ea as B,g as mt,h as te,ha as ht,i as re,ia as St,j as Xe,k as W,ka as kt,l as ie,m as Ye,ma as yt,n as Je,na as k,o as ge,oa as xe,p as Ze,pa as gt,q as en,qa as Et,r as nn,s as on,t as Ee,ta as bt,u as tn,ua as Ct,v as rn,va as G,w as an,x as sn,y as cn,z as dn}from"./chunk-NUTHBBDZ.js";import{C as j,D as R,E as oe,F as S,G as F,H as ye,I as ce,J as Pe,L as Vn,a as zo,b as Qo,c as y,d as L,e as O,f as Yo,g as Jo,h as Zo,i as et,j as nt,k as ot,l as tt,m as rt,n as it,o as at,p as dt,q as ut,r as l,u as lt,v as M,w as ke,x as ne,z as x}from"./chunk-D4QGPMRW.js";import{a as Xo}from"./chunk-FUUTGGJS.js";import"./chunk-F67UH4FD.js";import{a as So,b as ko,c as ee,d as yo,e as V,f as go,g as Eo,h as bo,i as Co,j as Ro,k as vo}from"./chunk-QILEJIFU.js";import{a as Ot}from"./chunk-ODIECDN7.js";async function Fn(n){let e=await new D().parseKanonaks(n),t=await new z().reason(n);return{kind:"merged",catalog:e,reasoning:t}}function Tn(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function Wn(n,e){let t=e??new Se(new H);return{kind:"standalone",catalog:await new D().parseKanonaks(new Vn(n,t))}}function I(n){return typeof n=="number"?n:void 0}function ri(n){if(!n)return;let e=l(n);if(e===l(kn))return"IRI";if(e===l(yn))return"BlankNode";if(e===l(gn))return"Literal"}function Bn(n){if(!n)return;let e=l(n);if(e===l(En))return"Violation";if(e===l(bn))return"Warning";if(e===l(Cn))return"Info"}function Gn(n,e,t,o){let r=S(e,ge);if(!r)return;let i={path:r},d=I(R(e,Ze)),s=I(R(e,en));d!==void 0&&(i.minCount=d),s!==void 0&&(i.maxCount=s);let a=I(R(e,an)),u=I(R(e,sn));a!==void 0&&(i.minLength=a),u!==void 0&&(i.maxLength=u);let c=I(R(e,cn)),p=I(R(e,dn));c!==void 0&&(i.minInclusive=c),p!==void 0&&(i.maxInclusive=p);let m=oe(e,tn);if(m!==void 0){let h=oe(e,rn);i.pattern=h!==void 0?{regex:m,flags:h}:{regex:m}}if(j(e,Ee)){let h=[],K=[];for(let{item:g}of ke(e,Ee))"literal"in g?h.push(g.value):g instanceof O&&K.push(g.subject);h.length>0&&(i.inValues=h),K.length>0&&(i.inRefs=K)}let f=S(e,nn);f&&(i.datatype=f);let A=S(e,on);A&&(i.classRef=A);let v=ri(S(e,Sn));v&&(i.nodeKind=v);let U=S(e,An);if(U&&(i.hasValue=U),j(e,ae)||j(e,Re)||j(e,ve)){let h={},K=I(R(e,Re)),g=I(R(e,ve));K!==void 0&&(h.minCount=K),g!==void 0&&(h.maxCount=g);let P=ii(n,e,o);"problem"in P?h.problem=P.problem:h.shape=P.shape,i.qualified=h}let w=oe(e,un);w!==void 0&&(i.message=w);let J=Bn(S(e,be))??t;return J&&(i.severity=J),i}function ii(n,e,t){let o=F(e,ae);if(o)return qn(n,o,void 0,t);let r=S(e,ae);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=x(n,r);return d?qn(n,d,i,t):{problem:`sh:qualifiedValueShape '${r.name}' does not resolve`}}function qn(n,e,t,o){let r=t?new Set([...o,t]):o,i=ne(e,W);if((ne(e,ie)||j(e,ge))&&!i){let a=Gn(n,e,void 0,r);return a?{shape:{kind:"property",constraint:a}}:{problem:"the qualified property shape has no sh:path"}}return e instanceof y&&!i?{problem:`sh:qualifiedValueShape '${e.name}' is not a shape`}:{shape:{kind:"node",shape:zn(n,e,r)}}}function zn(n,e,t){let o=Bn(S(e,be)),r={name:e instanceof y?e.name:"(inline shape)",uri:e instanceof y?k(e):void 0,targetClass:S(e,Ye),targetNodes:M(e,ln),targetSubjectsOf:M(e,pn),targetObjectsOf:M(e,fn),closed:R(e,mn)===!0,ignoredProperties:[],severity:o,properties:[]};r.ignoredProperties.push(...M(e,hn));for(let{item:i}of ke(e,Je)){let d;if(i instanceof L?d=i:i instanceof O&&(d=x(n,i.subject)),!d)continue;let s=Gn(n,d,o,t);s&&r.properties.push(s)}return r}function ue(n){let e=[];for(let t of n){if(!(t instanceof y)||!ne(t,W))continue;let o=k(t);e.push(zn(n,t,new Set(o?[l(o)]:[])))}return e}var b="kanonak.org/transformations",X="values";var le="allowed",$e="expected",E=n=>({type:`${b}/VarRef`,varName:n}),Ve=n=>({type:`${b}/IntegerLiteral`,integerLiteral:n}),ai=n=>({type:`${b}/DecimalLiteral`,decimalLiteral:n}),Qn=n=>Number.isInteger(n)?Ve(n):ai(n),Xn=n=>({type:`${b}/Count`,source:n}),Yn=(n,e)=>({type:`${b}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),Jn=(n,e)=>({type:`${b}/LessThanOrEqual`,compareLeft:n,compareRight:e});function Ue(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 pe(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:Yn(Xn(E(X)),Ve(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:Jn(Xn(E(X)),Ve(n.maxCount))}),n.hasValue!==void 0&&e.push({component:"hasValue",per:"node",expr:{type:`${b}/Contains`,haystack:E(X),needle:E($e)}}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${b}/Contains`,haystack:E(le),needle:E("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${b}/Matches`,matchSource:E("v"),pattern:Ue(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:Yn(E("v"),Qn(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:Jn(E("v"),Qn(n.maxInclusive))}),e}import{evaluate as ci,ExpressionError as di}from"@kanonak-protocol/expression";function eo(n,e){let t=ui(e)?e:ue(e),o=[],r=n.catalog.filter(s=>s instanceof y).map(fe),i=new Map;li(r,i);let d={scope:n,membership:new Me(n),embeddedFocus:i};for(let s of t)for(let a of pi(d,s,r))oo(d,s,a,o);return{conforms:!o.some(s=>s.severity==="Violation"),results:o}}function ui(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function no(n){let e=n.predicate;return e instanceof O?e:void 0}function fe(n){return{node:n,key:Pe(n),uri:k(n),label:n.name}}function De(n,e){return{node:n,key:e,label:e.includes("#")?e.slice(e.indexOf("#")):e}}function li(n,e){_e(n.map(t=>t.node),({kanonak:t,address:o})=>{t instanceof L&&!e.has(t)&&e.set(t,De(t,o))})}var Me=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(xe(this.scope.catalog,e).map(r=>l(r))),this.ancestors.set(t,o)),o}};function pi(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=x(o.catalog,s);a instanceof y&&i(fe(a))}for(let s of e.targetSubjectsOf){let a=l(s);for(let u of d())u.node.statement.some(c=>{let p=no(c);return p&&l(p.subject)===a})&&i(u)}for(let s of e.targetObjectsOf)for(let a of d())for(let u of ce(a.node,s,o.catalog,a.key))u.kind==="subject"?i(fe(u.node)):u.kind==="embedded"&&i(n.embeddedFocus.get(u.node)??De(u.node,u.address));return[...r.values()]}function fi(n,e,t){return e.node?ce(e.node,t,n.scope.catalog,e.key).map(o=>mi(n,o)):[]}function mi(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)??De(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 oo(n,e,t,o){for(let r of e.properties)ro(n,e,t,r,o);e.closed&&Pi(e,t,o)}function je(n,e,t,o,r={},i){return{focusNode:e.key,focusUri:e.uri,constraintComponent:t,severity:i??to(n),message:o,sourceShape:n.name,sourceShapeUri:n.uri,...r}}function to(n){return n.severity??"Violation"}var hi={minCount:Rn,maxCount:vn,hasValue:se,in:_n,pattern:wn,minLength:Kn,maxLength:Nn,minInclusive:Ln,maxInclusive:On};function ro(n,e,t,o,r){let i=fi(n,t,o.path),d=o.severity??to(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=je(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 pe(o)){let p=hi[c.component];if(c.per==="node"){let m={[X]:i.map(f=>f.kernel),[le]:a};o.hasValue&&(m[$e]={ref:l(o.hasValue)}),Zn(c,m)||u(p,Si(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}Zn(c,{v:m.kernel,[le]:a})||u(p,bi(c,s,o,m),m)}}if(o.nodeKind)for(let c of i)Ci(o.nodeKind,c)||u(In,`'${s}' value is ${c.kind}; nodeKind requires ${o.nodeKind}.`,c);if(o.datatype)for(let c of i){let p=Ri(o.datatype,c);p&&u(Pn,`'${s}' ${p}`,c)}if(o.classRef)for(let c of i){let p=vi(n,o.classRef,c);p&&u(xn,`'${s}' ${p}`,c)}o.qualified&&ki(n,o,i,s,u)}function Si(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 ki(n,e,t,o,r){let i=e.qualified,d=i.maxCount!==void 0?B:q,s=(u,c)=>{io.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=yi(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=Ei(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 yi(n,e){switch(e.kind){case"reference":return e.subject?fe(e.subject):void 0;case"embedded":return e.embedded;default:{let t=JSON.stringify(e.literal);return{key:t,label:t}}}}var gi={name:"(qualified value shape)",targetNodes:[],targetSubjectsOf:[],targetObjectsOf:[],closed:!1,ignoredProperties:[],properties:[]},io=new WeakSet;function Ei(n,e,t){let o=[];e.kind==="property"?ro(n,gi,t,e.constraint,o):oo(n,e.shape,t,o);let r=o.find(i=>io.has(i));return r?{kind:"undecided",reason:r.message}:o.length===0?{kind:"conforms"}:{kind:"fails"}}function bi(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 Zn(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 di(`Conformance lowering produced an unexpected leaf '${o.type}'`)};return ci(n.expr,void 0,t)===1}function Ci(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 Ri(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=we(n);if(t!==void 0)switch(t){case $.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case $.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 $.Decimal:case $.Double:case $.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 vi(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 Pi(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=no(i);if(!d)continue;let s=l(d.subject);o.has(s)||r.has(s)||(r.add(s),t.push(je(n,e,Ce,`'${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(je(n,e,Ce,`'${e.label}' carries unresolvable property '${i.key}' (closed shape).`,{value:i.key})))}var xi="1.1.0",_i=new Set([se,q,B].map(n=>n.name));async function ao(n){let e=new Q(n.repository),t=e.imports(),o=n.result.results.some(a=>_i.has(a.constraintComponent.name))?"1.2.0":xi,r=t.ensure(te,re,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 Cs}from"@kanonak-protocol/types/document/models/enums";import{spawn as wi}from"child_process";var co=12e4,Ki=4096,Y=class{argv;interactive;timeoutMs;stderr;now;constructor(e){this.argv=uo(e.command),this.interactive=e.interactive??!1,this.timeoutMs=e.timeoutMs??co,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=Oe(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=Ie(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:Le,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=wi(this.argv[0],[...this.argv.slice(1),e],{stdio:["pipe","pipe","pipe"],shell:!1,windowsHide:!0})}catch(f){i(so(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(-Ki)}),a.on("error",f=>{clearTimeout(m),s(()=>i(so(o,f)))}),a.on("close",(f,A)=>{clearTimeout(m);let v=c.trim()?`: ${c.trim()}`:"";if(p){s(()=>i(new N(`${o} did not finish within ${Math.round(this.timeoutMs/1e3)}s${v}`)));return}if(f!==0){let w=f!==null?`exit ${f}`:`signal ${A}`;s(()=>i(new N(`${o} failed (${w})${v}`)));return}let U=Buffer.concat(u).toString("utf8").trim();try{let w=JSON.parse(U);s(()=>r(w))}catch{s(()=>i(new N(`${o} exited 0 without printing one JSON answer${v}`)))}}),a.stdin.on("error",()=>{}),a.stdin.end(`${JSON.stringify(t)}
2
+ `)})}};function uo(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 so(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 Ni,readFileSync as Li}from"fs";import{homedir as Oi}from"os";import{join as Ii}from"path";var He="KANONAK_CREDENTIAL_HELPER";function lo(){return Ii(Oi(),".kanonak","config.json")}function Ai(n={}){let e=n.env??process.env,t=n.configPath??lo(),o=Vi(e,t);if(o){let i=Object.keys(e).filter(d=>(d===de||d.startsWith(`${de}_`))&&(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 Ae(r)}function Vi(n,e){let t=(n[He]??"").trim();if(t)return{command:t,source:He};if(!Ni(e))return;let o;try{o=JSON.parse(Li(e,"utf-8"))}catch(i){throw new Error(`${e} is not valid JSON: ${i.message}`)}if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`${e} must hold a JSON object`);let r=o.credentialHelper;if(r!==void 0){if(typeof r!="string"||r.trim()==="")throw new Error(`"credentialHelper" in ${e} must be a non-empty command line`);return{command:r.trim(),source:e}}}var C="kanonak.org",_="view",po="core-kanonak",$i={publisher:C,package_:_,name:"rootView"},Ui={publisher:C,package_:_,name:"bind"},Mi={publisher:C,package_:_,name:"produces"},ji={publisher:C,package_:_,name:"projections"},Di={publisher:C,package_:_,name:"where"},Hi={publisher:C,package_:_,name:"value"},Fi={publisher:C,package_:_,name:"as"},me=class{constructor(e,t=new H){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=S(r,Ui);if(!i)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let d=S(r,Mi);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=Ti(r),a=fo(o,C,po),u=fo(o,C,_),c=this.builder.imports(),p=c.ensure(C,po,a,"ck"),m=c.ensure(C,_,u,"v"),f=c.ref(d),A=new Mn(this.repository,this.parser,this.objectParser),v=new Un(A,o),U=this.readProjections(o,r),w=Bi(r,Di),J=this.findInstances(o,i,await this.reason(t)),h={},K=new Set;for(let Z of J){if(!await this.passesWhere(v,o,w,Z))continue;let he={type:f};for(let Te of U){let ho=await this.evaluateValue(v,o,Te.value,Z),We=this.builder.serializeValue(mo(ho),c);We!==void 0&&(he[c.ref(Te.as)]=We)}let Fe=k(Z);Fe&&(he[`${m}.derivedFrom`]=c.ref(Fe)),h[this.rowName(Z,K)]=he}let g={};t.resolvedAt&&(g[`${p}.resolvedAt`]=t.resolvedAt),t.invocationId&&(g[`${p}.id`]=t.invocationId);let P=await this.builder.buildContentAddressed({publisher:s,book:c,body:h,contentHashProperty:`${p}.contentHash`,header:g});return{yaml:P.yaml,contentHash:P.contentHash,packageName:P.packageName,publisher:P.publisher,rowCount:P.resourceCount}}resolveView(e,t){let o=x(e,t);if(!o)throw new Error(`View ${t.publisher}/${t.package_}/${t.name} not found in the catalog.`);let r=S(o,$i);if(r){let i=x(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 ye(t,ji)){let i=r instanceof L?r:r instanceof O?x(e,r.subject):void 0;if(!i)continue;let d=F(i,Hi),s=S(i,Fi);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=qi(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=T(k(s)),c=T(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(!Gi(d))return!1}return!0}async evaluateValue(e,t,o,r){let i=$n(o,"view-projection",{catalog:t,depth:0}),d=new Map([["input",r]]);return e.evaluate(i,d)}rowName(e,t){let o=Ne(e.name)||"row",r=o,i=2;for(;t.has(r);)r=`${o}-${i++}`;return t.add(r),r}};function mo(n){return Ke(n)?n.value:Array.isArray(n)?n.map(mo):n}function Ti(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 fo(n,e,t){let o=Wi(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 Wi(n,e,t){let o;for(let r of n){if(!(r instanceof y))continue;let i=k(r);!i||i.publisher!==e||i.package_!==t||!i.version||(!o||ee(i.version,o)>0)&&(o=i.version)}return o?V(o):void 0}function qi(n){let e=new Map,t=new Map;for(let o of n){if(!(o instanceof y))continue;let r=k(o);if(!r||!r.version)continue;let i=T(r),d=t.get(i);(!d||ee(r.version,d)>0)&&(t.set(i,r.version),e.set(i,o))}return e}function Bi(n,e){let t=F(n,e);return t?[t]:ye(n,e).filter(o=>o instanceof L)}function Gi(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Ke(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{dr as AmbiguousReferenceRule,ot as BooleanStatement,Mr as CANONICAL_FORM_VERSION,Qr as CREDENTIAL_EXPIRY_SKEW_SECONDS,He as CREDENTIAL_HELPER_ENV,Le as CREDENTIAL_HELPER_PROTOCOL_VERSION,co as CREDENTIAL_HELPER_TIMEOUT_MS,$ as Carrier,hr as ClassDefinitionRule,or as ClassHierarchyCycleRule,_o as CompositeKanonakDocumentRepository,N as CredentialError,qr as DEFAULT_CONSENT_BINDING_PARAM,Qo as DefinedKanonak,Ar as DiamondNameClashRule,kr as DisplayLensScopeRule,xo as DocumentLocation,xt as EdgeType,L as EmbeddedKanonak,Zt as EmbeddedKanonakTypeRule,rt as EmbeddedStatement,oi as EntitlementDeniedError,ti as EntitlementProducer,Y as ExecCredentialProvider,Po as FileSystemKanonakDocumentRepository,Ot as GitIgnoreFilter,_t as GraphBuilder,To as HttpKanonakDocumentRepository,Be as INTEGRITY_PREFIX,Dr as ImportBook,er as ImportExistenceRule,Se as InMemoryKanonakDocumentRepository,Ao as KANONAK_USER_AGENT,zo as Kanonak,At as KanonakDocumentPositions,No as KanonakHttpError,D as KanonakObjectParser,Vr as KanonakObjectValidator,H as KanonakParser,Xo as KanonakUri,jt as KanonakUriBuilder,Dt as KanonakUrlResolver,kt as KanonakVocabulary,Rr as LINE_STYLES,Gt as LinkTargetRule,it as ListStatement,Yo as LiteralKanonak,Wo as LocalFirstRepository,qo as LockAwareRepository,Nr as LookBandPathRule,_r as LookRenderer,yr as LookSemanticSvgPathRule,Sr as MarkdownLinkRule,at as MarkdownStatement,sr as NamespaceImportCycleRule,zt as NamespacePrefixRule,Pt as NodeType,nt as NumberStatement,Br as OAuthDiscovery,Nt as OWL_RL_CLASSIFICATION_RULES,lr as ObjectPropertyValueValidationRule,Wt as OntologyValidationError,Ft as OntologyValidationResult,Ir as OwlOneOfRule,Q as PackageBuilder,Jt as PackageHeaderRule,Zr as ProducerRepository,pr as PropertyDomainRule,tr as PropertyHierarchyCycleRule,fr as PropertyKindRangeConsistencyRule,It as PropertyMetadata,ur as PropertyRangeReferenceRule,rr as PropertyRangeRequiredRule,Xt as PropertyTypeSpecificityRule,Do as PublisherConfigResolver,Ho as PublisherIndex,Kt as RDFS_RULES,z as Reasoner,Lt as ReasoningResult,O as ReferenceKanonak,tt as ReferenceStatement,Ko as RepositoryFactory,mr as ReservedNameShadowRule,Qt as ResourceNamingRule,st as ResourceResolver,yt as ResourceTypeClassifier,re as SHACL_PACKAGE,te as SHACL_PUBLISHER,W as SH_NODE_SHAPE,ie as SH_PROPERTY_SHAPE,Xe as SH_SHAPE,Zo as ScalarStatement,Kr as SequenceNarrativeRule,Or as ShaclShapeRule,Jo as Statement,et as StringStatement,ir as SubClassOfReferenceRule,ar as SubPropertyOfReferenceRule,y as SubjectKanonak,Yt as SubjectKanonakTypeRequiredRule,de as TOKEN_ENV,Ae as TokenCredentialProvider,wt as TripleStore,gr as TxExpressionCompilesRule,Lr as TxExpressionPathRule,ct as TypeResolver,Er as URI_DISPLAY_LABEL,br as URI_DISPLAY_SUMMARY,cr as UnresolvedPredicateRule,nr as UnresolvedReferenceRule,Bt as ValidationCache,qt as ValidationContext,Tt as ValidationSeverity,Cs as VersionOperator,me as ViewMaterializer,ei as allowAllPolicy,Uo as assertHttpsUrl,Fo as assertPackageIdentity,Go as buildLocalFirstRepository,xr as buildOntologyModel,ao as buildReportPackageAsync,ue as buildShapesModel,ht as builtinHomePackages,St as builtinUri,$r as canonicalForm,Ur as canonicalHash,we as carrierOf,Gr as checkCredentialAnswer,Oe as checkHelperAnswer,Ie as checkHelperEraseAnswer,Bo as collectKanonakFiles,ee as compareVersions,Hn as computeIntegrity,Qe as computeIntegrityAsync,jr as contentAddressedName,G as contextTypesOf,Xr as createCredentialedFetch,go as createVersion,Ai as credentialProviderFromConfig,Oo as describeResponse,eo as evaluateConformance,vt as extractMarkdownLinks,Jr as findDerivation,Rt as findMalformedReferences,$t as findMarkdownLinkAt,Ue as foldFlagsIntoPattern,ut as formatKanonakAddress,V as formatVersion,wo as getGlobalCachePath,$o as getKanonakUserAgent,Lo as httpError,bo as isCompatibleVersion,Co as isMajorCompatible,Et as isPropertySubject,Mo as kanonakFetch,jn as loadLockFile,qe as lockedVersion,pe as lowerConstraint,pt as makeUriKey,Wr as narrowestScope,ni as noopMeter,Hr as normalizeHost,dt as parseKanonakAddress,Ge as parseLockFile,Fr as parseScope,Eo as parseVersionString,Vt as parseWithPositions,zr as parseWwwAuthenticate,vo as pickHighestDocument,bt as propertiesInScope,gt as propertyClassOf,vr as readSequenceConnectors,Ht as referenceSpelling,M as referenceUris,Cr as resolveDisplayValue,Ct as resolvePropertyStep,Io as retryAfterSecondsOf,Ne as sanitizeName,Ro as satisfiesVersionOperator,Dn as saveLockFile,Tr as scopeContains,Tn as scopeFromCatalog,Wn as scopeFromDocumentAsync,Fn as scopeFromRepositoryAsync,ze as serializeLockFile,jo as setKanonakFetchRetries,Vo as setKanonakUserAgent,Mt as sourceSymbolAt,Ut as sourceSymbols,uo as splitCommandLine,Pe as subjectAddress,k as subjectUri,xe as superClassChain,wr as supportedBandKeys,Yr as tokenEnvKeyFor,ft as tripleKey,lt as typeReferenceUris,T as uriKey,mt as uriTriple,lo as userConfigPath,ce as valuesOf,So as versionOperatorFromChar,ko as versionOperatorToChar,yo as versionsEqual,_e as walkDefinedKanonaks,Pr as walkSequence};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanonak-protocol/sdk",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "TypeScript SDK for the Kanonak Protocol — parse, resolve, validate, reason over, and render .kan.yml packages.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -135,7 +135,7 @@
135
135
  ],
136
136
  "dependencies": {
137
137
  "@kanonak-protocol/canonical": "^0.1.3",
138
- "@kanonak-protocol/types": "^6.2.0",
138
+ "@kanonak-protocol/types": "^6.3.0",
139
139
  "ignore": "^7.0.5",
140
140
  "js-yaml": "^4.1.0",
141
141
  "yaml": "^2.7.0",