@kanonak-protocol/sdk 5.18.0 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/{chunk-UNSWF3UN.js → chunk-5TI4E6M7.js} +2 -2
- package/dist/{chunk-3O7CRE6J.js → chunk-UYSEO3OT.js} +5 -5
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/shacl/ConformanceEvaluator.d.ts +53 -0
- package/dist/shacl/ConformanceScope.d.ts +72 -0
- package/dist/shacl/ReportBuilder.d.ts +28 -0
- package/dist/shacl/ShapesModel.d.ts +59 -0
- package/dist/shacl/index.d.ts +9 -0
- package/dist/shacl/lowering.d.ts +26 -0
- package/dist/shacl/uris.d.ts +64 -0
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +4 -3
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,b as _,c as q,d as Ie,
|
|
1
|
+
import{a as B,b as _,c as q,d as Ie,e as Ke,f as Se,g as be,i as je,j as Oe,k as De,l as Ve,m as Ee}from"./chunk-5TI4E6M7.js";import{a as ve}from"./chunk-LYSCTQC2.js";import"./chunk-QHABFCRC.js";import{a as c,b as m,c as u,e as d,h as y,i as R,j as f,k,l as x,m as P,n as g}from"./chunk-W35FCNM7.js";import{a as p}from"./chunk-4NO7MHS7.js";import{a as w,b as z,c as W}from"./chunk-5NH5XDGO.js";import{a as X,b as Y}from"./chunk-PEUTCG3B.js";import"./chunk-PEJALHXK.js";import"./chunk-SC5M74NM.js";import{A as ge,B as Ce,L as he,a as J,b as Q,c as Z,d as $,f as ee,g as oe,h as te,i as re,k as ne,l as ae,m as ie,n as se,o as pe,p as le,q as ce,r as me,s as ue,t as de,u as ye,v as Re,w as fe,x as ke,y as xe,z as Pe}from"./chunk-UYSEO3OT.js";import"./chunk-M443OYKT.js";import{a as K,c as A,i as U,j as G,m as H}from"./chunk-V6KIDED2.js";import{a as l}from"./chunk-NJ3AZYQD.js";import{a as F,b as L,o as M}from"./chunk-SVUMCLK5.js";import{a as C,b as h,c as I,d as b,e as j,f as O,g as D,h as V,i as v,j as E,k as N,l as T}from"./chunk-YW6P24RF.js";import{a as S}from"./chunk-FUUTGGJS.js";import{c as e,d as o,e as t,f as r,g as n,h as a,i,j as s}from"./chunk-2ACBWC7K.js";export{ye as AmbiguousReferenceRule,v as BooleanStatement,Se as CANONICAL_FORM_VERSION,U as Carrier,ge as ClassDefinitionRule,se as ClassHierarchyCycleRule,h as DefinedKanonak,_ as EdgeType,K as EmbeddedKanonak,ne as EmbeddedKanonakTypeRule,N as EmbeddedStatement,q as GraphBuilder,g as HttpKanonakDocumentRepository,R as INTEGRITY_PREFIX,ae as ImportExistenceRule,p as InMemoryKanonakDocumentRepository,c as KANONAK_USER_AGENT,C as Kanonak,z as KanonakDocumentPositions,H as KanonakObjectParser,he as KanonakObjectValidator,l as KanonakParser,S as KanonakUri,X as KanonakUriBuilder,T as ListStatement,Ce as MarkdownLinkRule,A as MarkdownStatement,ue as NamespaceImportCycleRule,ee as NamespacePrefixRule,B as NodeType,V as NumberStatement,je as OAuthDiscovery,fe as ObjectPropertyValueValidationRule,Z as OntologyValidationError,J as OntologyValidationResult,ke as PropertyDomainRule,pe as PropertyHierarchyCycleRule,xe as PropertyKindRangeConsistencyRule,w as PropertyMetadata,Re as PropertyRangeReferenceRule,le as PropertyRangeRequiredRule,te as PropertyTypeSpecificityRule,y as PublisherConfigResolver,P as PublisherIndex,b as ReferenceKanonak,E as ReferenceStatement,Pe as ReservedNameShadowRule,oe as ResourceNamingRule,F as ResourceResolver,M as ResourceTypeClassifier,O as ScalarStatement,j as Statement,D as StringStatement,ce as SubClassOfReferenceRule,me as SubPropertyOfReferenceRule,I as SubjectKanonak,re as SubjectKanonakTypeRequiredRule,Ve as TokenCredentialProvider,L as TypeResolver,de as UnresolvedPredicateRule,ie as UnresolvedReferenceRule,$ as ValidationContext,Q as ValidationSeverity,Ee as buildOntologyModel,Ie as canonicalForm,Ke as canonicalHash,G as carrierOf,e as compareVersions,x as computeIntegrityAsync,De as createCredentialedFetch,r as createVersion,ve as findDerivation,Y as findInstancesByType,t as formatVersion,u as getKanonakUserAgent,a as isCompatibleVersion,i as isMajorCompatible,d as kanonakFetch,be as normalizeHost,Oe as parseAuthChallenge,f as parseLockFile,n as parseVersionString,W as parseWithPositions,s as pickHighestDocument,k as serializeLockFile,m as setKanonakUserAgent,o as versionsEqual};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as F}from"./chunk-W35FCNM7.js";import{
|
|
2
|
-
`)||e.startsWith("http://")||e.startsWith("https://")||/^\d{4}-\d{2}/.test(e)||/^\d+(\.\d+)?$/.test(e))}function v(e,n,t,r){if(e.includes("@")&&e.includes("/"))return e;if(e.includes(".")){let o=e.indexOf("."),s=e.substring(0,o),c=e.substring(o+1);if(r){let a=r.get(s);if(a)return`${a.publisher}/${a.package_}/${c}@${a.version}`}return n&&t?`${n}/${c}@${t}`:c}return n&&t?`${n}/${e}@${t}`:e}function A(e){let n=e.replace(/^https?:\/\//,"").replace(/^git:\/\//,"").replace(/\/+$/,"").trim();if(!n)throw new Error("Publisher host cannot be empty");return n}var Ve="key_thumbprint",N=class{cache=new Map;prCache=new Map;async discoverProtectedResource(n){let t=A(n);if(this.prCache.has(t))return this.prCache.get(t);let r=`https://${t}/.well-known/oauth-protected-resource`,o=await Be(r),s=o&&Array.isArray(o.authorization_servers)?o.authorization_servers.filter(a=>typeof a=="string"):[],c=s.length>0?s:null;return this.prCache.set(t,c),c}async discover(n){let t=A(n);if(this.cache.has(t))return this.cache.get(t);let r=`https://${t}/.well-known/oauth-authorization-server`,o=await this.tryEndpoint(r);if(!o){let s=`https://${t}/.well-known/openid-configuration`;o=await this.tryEndpoint(s)}return this.cache.set(t,o),o}async supportsOAuth(n){return await this.discover(n)!==null}static supportsPkceS256(n){return n.codeChallengeMethodsSupported?.some(t=>t.toUpperCase()==="S256")??!1}static supportsDynamicRegistration(n){return!!n.registrationEndpoint}static supportsAuthorizationCode(n){return n.responseTypesSupported?.some(t=>t.toLowerCase()==="code")??!1}static supportsEnrollment(n){return!!n.enrollmentEndpoint}static supportsSession(n){return!!n.sessionEndpoint}async tryEndpoint(n){let t;try{t=await fetch(n)}catch(o){let s=o instanceof Error?o.message:String(o);return s.includes("ENOTFOUND")||s.includes("ECONNREFUSED")?(console.error(` OAuth discovery: ${n} \u2014 host unreachable (${s})`),console.error(" If the server is behind a VPN, ensure you are connected.")):s.includes("CERT")||s.includes("SSL")||s.includes("TLS")?(console.error(` OAuth discovery: ${n} \u2014 TLS error (${s})`),console.error(" If using a custom CA certificate, set NODE_EXTRA_CA_CERTS=/path/to/ca.pem")):console.error(` OAuth discovery: ${n} \u2014 network error: ${s}`),null}if(!t.ok)return t.status===404||(t.status===403?(console.error(` OAuth discovery: ${n} \u2014 HTTP 403 Forbidden`),console.error(" Access may be blocked by a firewall, proxy, or WAF.")):t.status>=500&&(console.error(` OAuth discovery: ${n} \u2014 HTTP ${t.status} server error`),console.error(" The authorization server returned an internal error. Contact your IDP administrator."))),null;let r;try{r=await t.json()}catch{return console.error(` OAuth discovery: ${n} \u2014 response is not valid JSON`),console.error(" The endpoint may be returning HTML instead of JSON. Check IDP configuration."),null}return{issuer:w(r.issuer),authorizationEndpoint:w(r.authorization_endpoint),tokenEndpoint:w(r.token_endpoint),registrationEndpoint:w(r.registration_endpoint),revocationEndpoint:w(r.revocation_endpoint),scopesSupported:P(r.scopes_supported),responseTypesSupported:P(r.response_types_supported),grantTypesSupported:P(r.grant_types_supported),codeChallengeMethodsSupported:P(r.code_challenge_methods_supported),tokenEndpointAuthMethodsSupported:P(r.token_endpoint_auth_methods_supported),dpopSigningAlgValuesSupported:P(r.dpop_signing_alg_values_supported),enrollmentEndpoint:w(r.enrollment_endpoint),enrollmentIssuanceProtocols:P(r.enrollment_issuance_protocols),enrollmentKeyTypes:P(r.enrollment_key_types),enrollmentScopesSupported:P(r.enrollment_scopes_supported),enrollmentConsentBindingParam:w(r.enrollment_consent_binding_param),sessionEndpoint:w(r.session_endpoint),sessionEndpointAuthMethod:w(r.session_endpoint_auth_method)}}};async function Be(e){try{let n=await fetch(e);return n.ok?await n.json():null}catch{return null}}function w(e){return typeof e=="string"?e:null}function P(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):null}function we(e){let n=e.headers.get("WWW-Authenticate")??void 0,t=e.headers.get("DPoP-Nonce")??void 0;if(!n&&!t)return;let r={wwwAuthenticate:n??""};if(t&&(r.nonce=t),n){let o=n.match(/acr_values\s*=\s*"([^"]*)"/i);o&&(r.acrValues=o[1])}return r}function ze(e){try{return new URL(e).host}catch{return null}}function He(e,n={}){let t=n.discovery??new N,r=new Map,o=new Map,s=async i=>{let d=r.get(i);if(d!==void 0)return d;let f=null,p=await t.discoverProtectedResource(i).catch(()=>null);return p&&p.length>0&&(f=ze(p[0])),r.set(i,f),f},c=async(i,d)=>{if(!e)return null;if(!(d.forceRefresh||d.challenge)&&o.has(i))return o.get(i);let p=await e.resolve(i,d).catch(()=>null);return o.set(i,p),p},a=async(i,d,f,p)=>{let g=await s(d);if(!g)return{res:await F(i,{method:f,redirect:"manual"}),authed:!1};let u=await c(g,{method:f,url:i,...p}),l=u?.headers??{};return{res:await F(i,{method:f,redirect:"manual",headers:l}),authed:!!u}};return async(i,d,f="GET")=>{let p=await a(i,d,f,{});if((p.res.status===401||p.res.status===403)&&p.authed){let g=we(p.res),u={forceRefresh:g===void 0};return g&&(u.challenge=g),(await a(i,d,f,u)).res}return p.res}}var Pe="KANONAK_TOKEN";function qe(){return typeof process<"u"&&process.env?process.env:{}}function We(e){return`${Pe}_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}var X=class{tokens;env;constructor(n={}){this.tokens=n.tokens??{},this.env=n.env??qe()}async resolve(n,t){let r=A(n),o=this.tokens[r]??this.env[We(r)]??this.env[Pe];return o?{headers:{Authorization:`Bearer ${o}`}}:null}};import{canonicalForm as Xe,canonicalHash as Ye}from"@kanonak-protocol/canonical";function Y(e){return typeof e=="object"&&e!==null&&Array.isArray(e.subjects)}import{CANONICAL_FORM_VERSION as an}from"@kanonak-protocol/canonical";function Je(e){return Xe(Y(e)?e:Te(e))}function Qe(e){return Ye(Y(e)?e:Te(e))}function Te(e){let n=[];for(let t of e)t instanceof T&&n.push({uri:sn(t),statements:J(t.statement)});return{subjects:n}}function J(e){let n=[];for(let t of e){let r=on(t);if(!r)continue;if(t instanceof L&&Ze(t.predicate.subject)){n.push(...nn(t,r));continue}let o=tn(t);o&&n.push({predicate:r,value:o})}return n}function Ze(e){let n=ue("type");return n!==void 0&&e.name==="type"&&e.publisher===n.publisher&&e.package_===n.package_}var je=new TextEncoder;function en(e,n){let t=je.encode(e),r=je.encode(n),o=Math.min(t.length,r.length);for(let s=0;s<o;s++)if(t[s]!==r[s])return t[s]-r[s];return t.length-r.length}function nn(e,n){let t=[];for(let r of e.object){if(!(r instanceof _))throw new Error(`canonicalForm: a multi-valued type statement must contain only entity references, got ${r.constructor?.name??typeof r}`);t.push(Q(r))}t.sort(en);for(let r=1;r<t.length;r++)if(t[r-1]===t[r])throw new Error(`canonicalForm: duplicate type ${t[r]} in a multi-valued type statement`);return t.map(r=>({predicate:n,value:{ref:r}}))}function tn(e){if(e instanceof oe&&e.carrier)return{lit:e.lexical??String(e.object),datatype:Re(e.carrier)};if(e instanceof se)return{raw:e.object};if(e instanceof ae)return{raw:e.lexical??String(e.object)};if(e instanceof ie)return{raw:e.lexical??String(e.object)};if(e instanceof ce)return{ref:Q(e.object)};if(e instanceof pe)return Ee(e.object);if(e instanceof L)return{list:e.object.map(rn)}}function Ee(e){let n=J(e.statement);return e.name&&e.name.length>0?{embed:{name:e.name,statements:n}}:{embed:{statements:n}}}function rn(e){if(e instanceof _)return{ref:Q(e)};if(e instanceof te)return Ee(e);if(e instanceof $){if(e.carrier)return{lit:e.lexical??String(e.value),datatype:Re(e.carrier)};let n=e.value;if(typeof n=="string")return{raw:n};if(typeof n=="number")return{raw:String(n)};if(typeof n=="boolean")return{raw:String(n)}}if(e instanceof ne)return{embed:{statements:J(e.statement)}};throw new Error(`canonicalForm: list item of unrecognized kind (${e.constructor?.name??typeof e}); add canonicalization support before hashing data that contains it`)}function Re(e){return e===z.LangString?"kanonak.org/core-rdf/langString":`kanonak.org/core-xsd/${e}`}function on(e){let n=e.predicate;if(n)return _e(n.subject)}function sn(e){let n=e.namespace??"",t=e.name??"";return`${n}/${t}`}function Q(e){return _e(e.subject)}function _e(e){let n=e.version;return n&&typeof n.major=="number"?`${e.publisher}/${e.package_}@${n.major}.${n.minor}.${n.patch}/${e.name}`:`${e.publisher}/${e.package_}/${e.name}`}var E="kanonak.org",U="core-rdf",Ie="core-xsd",Ae={publisher:E,package_:U,name:"subClassOf"},Ne={publisher:E,package_:U,name:"label"},$e={publisher:E,package_:U,name:"comment"},Ke={publisher:E,package_:"core-owl",name:"oneOf"},xe=e=>e;function cn(e){let n=fe(e,Ae);if(n)return[n];let t=[];for(let r of V(e,Ae))r instanceof _&&t.push(r.subject);return t}function pn(e,n,t){if(n.publisher===E&&n.package_===U&&n.name==="Literal")return{kind:"datatype",uri:n};let o=G(e,n);if(o){let s=xe(o);if(O.isDatatypeType(s))return{kind:"datatype",uri:n};if(O.isClassType(s))return{kind:"class",uri:x(o)??n,localName:o.name}}return n.publisher===E&&n.package_===Ie?{kind:"datatype",uri:n}:t==="datatype"?{kind:"datatype",uri:n}:{kind:"class",uri:n,localName:n.name}}function ln(e,n,t){if(!n.range)throw new Error(`Property ${n.uri.publisher}/${n.uri.package_}/${n.uri.name} has no rdfs.range; every property must declare a range. Validate the ontology before introspecting it.`);let r=pn(e,n.range,n.kind),o=n.kind==="object"?"object":n.kind==="datatype"?"datatype":r.kind==="class"?"object":"datatype";return{uri:n.uri,localName:n.uri.name,kind:o,range:r,...n.label!==void 0?{label:n.label}:{},...n.comment!==void 0?{comment:n.comment}:{},...t??{}}}var M=e=>new re(E,Ie,e);function un(e){return typeof e=="boolean"?M("boolean"):typeof e=="number"?Number.isInteger(e)?M("integer"):M("decimal"):M("string")}function dn(e,n){let t=[];for(let r of V(n,Ke))if(r instanceof _){let o=G(e,r.subject),s=(o?x(o):void 0)??r.subject,c=o?I(o,Ne):void 0,a=o?I(o,$e):void 0;t.push({kind:"individual",uri:s,localName:s.name,...c!==void 0?{label:c}:{},...a!==void 0?{comment:a}:{}})}else r instanceof $&&t.push({kind:"literal",value:r.value,datatype:un(r.value)});return t}function fn(e,n,t,r){let o=ge(e,n),s=K(n);return ye(e,n).filter(a=>t?!0:a.domains.some(i=>K(i)===s)).map(a=>ln(e,a,he(r,o,a.uri)))}async function gn(e,n,t){let r=e.metadata?.namespace_;if(!r)throw new Error("buildOntologyModel: document has no namespace (publisher/package/version).");let o=t?.includeInherited??!1,s=await new D().parseKanonaks(n),c=me(s),a=[],i=[],d=new Set;for(let f of s){if(!(f instanceof T)||!O.isClassType(xe(f)))continue;let p=x(f);if(!p||p.publisher!==r.publisher||p.package_!==r.package_||p.version&&r.version&&!ee(p.version,r.version))continue;let g=K(p);if(d.has(g))continue;d.add(g);let u=cn(f).map(b=>({uri:b,localName:b.name})),l=I(f,Ne),m=I(f,$e);a.push({uri:p,localName:p.name,superClasses:u,properties:fn(s,p,o,c),...l!==void 0?{label:l}:{},...m!==void 0?{comment:m}:{}}),de(f,Ke)&&i.push({uri:p,localName:p.name,members:dn(s,f),...l!==void 0?{label:l}:{},...m!==void 0?{comment:m}:{}})}return{classes:a,enums:i}}export{Ce as a,Se as b,H as c,A as d,Ve as e,N as f,we as g,He as h,X as i,Je as j,Qe as k,an as l,gn as m};
|
|
1
|
+
import{e as F}from"./chunk-W35FCNM7.js";import{I as me,J as he}from"./chunk-UYSEO3OT.js";import{a as te,b as $,c as le,i as z,m as D}from"./chunk-V6KIDED2.js";import{k as ue,o as O,p as x,q as ge,r as B,v as ye}from"./chunk-SVUMCLK5.js";import{b as ne,c as T,d as _,f as oe,g as se,h as ae,i as ie,j as ce,k as pe,l as L,m as K,r as G,t as de,v as I,w as fe,y as V}from"./chunk-YW6P24RF.js";import{a as re}from"./chunk-FUUTGGJS.js";import{d as ee}from"./chunk-2ACBWC7K.js";var Ce=(a=>(a.Class="Class",a.DatatypeProperty="DatatypeProperty",a.ObjectProperty="ObjectProperty",a.AnnotationProperty="AnnotationProperty",a.Instance="Instance",a.Datatype="Datatype",a.Unknown="Unknown",a))(Ce||{}),Se=(i=>(i.InstanceOf="instanceOf",i.SubClassOf="subClassOf",i.Domain="domain",i.Range="range",i.ObjectRelationship="objectRelationship",i.SubPropertyOf="subPropertyOf",i.PropertyValue="propertyValue",i.EmbeddedLink="embeddedLink",i))(Se||{}),H=class{static async buildFromRepository(n,t){let o=await new D().parseKanonaks(n),s=await n.getAllDocumentsAsync(),c=[],a=[],i=new Set,d=new Set,f=new Map;for(let g of o){let u=g;if(u.name&&(O.isClassType(u)&&i.add(u.name),g instanceof T)){let l=B(o,g);(l==="ObjectProperty"||l==="Property")&&d.add(u.name)}}for(let g of s)for(let[u,l]of Object.entries(g.body))d.has(u)&&l?.range&&typeof l.range=="string"&&f.set(u,l.range);let p=new Map;for(let g of o){let u=g;u.name&&p.set(u.name,u)}for(let g of s){let u=g.metadata.namespace_,l=u?`${u.publisher}/${u.package_}`:"",m=u?.version?`${u.version.major}.${u.version.minor}.${u.version.patch}`:"",b=ke(g);for(let[h,y]of Object.entries(g.body)){if(!y||typeof y!="object")continue;let C=p.get(h),k="Unknown";if(C){let R=C,j=C instanceof T?B(o,C):void 0;O.isClassType(R)?k="Class":j==="ObjectProperty"?k="ObjectProperty":j==="DatatypeProperty"?k="DatatypeProperty":j==="AnnotationProperty"?k="AnnotationProperty":O.isDatatypeType(R)?k="Datatype":j==="Property"?k="ObjectProperty":O.isInstanceOfKnownClass(R,i)&&(k="Instance")}let S=l&&m?`${l}/${h}@${m}`:h,Z={};for(let[R,j]of Object.entries(y))R!=="type"&&(typeof j!="object"||j===null)&&(Z[R]=j);c.push({id:S,label:y.label??h,type:k,namespace:l,properties:Z}),be(S,y,k,i,d,a,l,m,b,t),q(S,y,d,f,c,a,l,m,b),Le(S,C,a)}}return{nodes:c,edges:a}}static buildFromDocument(n,t){let r=[],o=[],s=n.metadata.namespace_,c=s?.version?`${s.version.major}.${s.version.minor}.${s.version.patch}`:"",a=s?`${s.publisher}/${s.package_}`:"",i=new Set,d=new Set,f=new Map,p=ke(n);for(let[l,m]of Object.entries(n.body)){let b=m?.type;b&&(Me(b,p)&&i.add(l),Ue(b,p)&&(d.add(l),m.range&&typeof m.range=="string"&&f.set(l,m.range)))}for(let[l,m]of Object.entries(n.body)){if(!m||typeof m!="object")continue;let b=m.type,h=Fe(b,l,i,p),y=a&&c?`${a}/${l}@${c}`:l,C={};for(let[k,S]of Object.entries(m))k!=="type"&&(typeof S!="object"||S===null)&&(C[k]=S);r.push({id:y,label:m.label??l,type:h,namespace:a,properties:C}),be(y,m,h,i,d,o,a,c,p,t),q(y,m,d,f,r,o,a,c,p)}let g=new Set(r.map(l=>l.id)),u=o.filter(l=>g.has(l.source)&&g.has(l.target));return{nodes:r,edges:u}}};function ke(e,n){let t=new Map;if(e.metadata?.imports)for(let[r,o]of Object.entries(e.metadata.imports))for(let s of o){let c=s.alias??s.packageName,a=s.version,i=`${a.major}.${a.minor}.${a.patch}`;t.set(c,{publisher:r,package_:s.packageName,version:i})}return t}var Oe={"kanonak.org/core-rdf/Class":"Class","kanonak.org/core-owl/Class":"Class","kanonak.org/core-rdfs/Class":"Class","kanonak.org/core-owl/ObjectProperty":"ObjectProperty","kanonak.org/core-owl/DatatypeProperty":"DatatypeProperty","kanonak.org/core-owl/AnnotationProperty":"AnnotationProperty","kanonak.org/core-rdf/Property":"ObjectProperty","kanonak.org/core-rdfs/Datatype":"Datatype"},De=new Set(["kanonak.org/core-owl/ObjectProperty","kanonak.org/core-owl/DatatypeProperty","kanonak.org/core-owl/AnnotationProperty","kanonak.org/core-rdf/Property"]);function W(e,n){if(e.includes(".")){let t=e.indexOf("."),r=e.substring(0,t),o=e.substring(t+1),s=n.get(r);if(s)return`${s.publisher}/${s.package_}/${o}`}return null}function Me(e,n){let t=W(e,n);return t?Oe[t]==="Class":!1}function Ue(e,n){let t=W(e,n);return t?De.has(t):!1}function Fe(e,n,t,r){if(!e||e==="Package")return"Unknown";let o=W(e,r);if(o){let c=Oe[o];if(c)return c;let a=o.split("/").pop()?.split("@")[0]??"";return t.has(a)?"Instance":"Unknown"}let s=e.split(".").pop()??e;return t.has(s)?"Instance":"Unknown"}var ve=new Set(["type","label","comment","version","publisher","imports","license","match","alias","package"]);function be(e,n,t,r,o,s,c,a,i,d){let f=n.type,p=n.subClassOf;if(p){let h=Array.isArray(p)?p:[p];for(let y of h)typeof y=="string"&&s.push({source:e,target:v(y,c,a,i),type:"subClassOf",label:"subClassOf"})}let g=n.subPropertyOf;if(g){let h=Array.isArray(g)?g:[g];for(let y of h)typeof y=="string"&&s.push({source:e,target:v(y,c,a,i),type:"subPropertyOf",label:"subPropertyOf"})}let u=n.domain,l=n.range;if(d?.includePropertyEdges){let h=[[u,"domain","domain"],[l,"range","range"]];for(let[y,C,k]of h)if(y!=null)for(let S of Array.isArray(y)?y:[y])typeof S=="string"&&s.push({source:e,target:v(S,c,a,i),type:C,label:k})}if(t==="Instance"&&f){let h=f.split(".").pop()??f;s.push({source:e,target:v(h,c,a,i),type:"instanceOf",label:"type"})}if(t==="Instance")for(let[h,y]of Object.entries(n)){if(ve.has(h)||!o.has(h))continue;let C=Array.isArray(y)?y:[y];for(let k of C)typeof k=="string"&&Ge(k)&&s.push({source:e,target:v(k,c,a,i),type:"propertyValue",label:h,propertyId:v(h,c,a,i)})}if((t==="ObjectProperty"||t==="DatatypeProperty"||u&&l)&&u&&l){let h=typeof u=="string"?u:null,y=typeof l=="string"?l:null;h&&y&&s.push({source:v(h,c,a,i),target:v(y,c,a,i),type:"objectRelationship",label:n.label??e.split("/").pop()??"",propertyId:e})}}function q(e,n,t,r,o,s,c,a,i){for(let[d,f]of Object.entries(n)){if(ve.has(d)||typeof f!="object"||f===null||Array.isArray(f))continue;let p=f,g=`${e}/${d}`,u=r.get(d),l=u?u.split(".").pop()??u:"Unknown",m={};for(let[h,y]of Object.entries(p))(typeof y!="object"||y===null)&&(m[h]=y);o.push({id:g,label:`${l} (embedded)`,type:"Instance",namespace:c,properties:m});let b=c&&a?`${c}/${d}@${a}`:d;s.push({source:e,target:g,type:"propertyValue",label:d,propertyId:t.has(d)?b:void 0}),u&&s.push({source:g,target:v(l,c,a,i),type:"instanceOf",label:"type (inferred)"}),q(g,p,t,r,o,s,c,a,i)}}function Le(e,n,t){let r=n?.statement;if(Array.isArray(r))for(let o of r){if(!(o instanceof le))continue;let s=o.predicate?.subject?.name??"";for(let c of o.links){let a=c.target?.subject;if(!a)continue;let i=a.version,d=i&&typeof i.major=="number"?`@${i.major}.${i.minor}.${i.patch}`:"";t.push({source:e,target:`${a.publisher}/${a.package_}/${a.name}${d}`,type:"embeddedLink",label:s})}}}function Ge(e){return!(!e||e.includes(" ")||e.includes(`
|
|
2
|
+
`)||e.startsWith("http://")||e.startsWith("https://")||/^\d{4}-\d{2}/.test(e)||/^\d+(\.\d+)?$/.test(e))}function v(e,n,t,r){if(e.includes("@")&&e.includes("/"))return e;if(e.includes(".")){let o=e.indexOf("."),s=e.substring(0,o),c=e.substring(o+1);if(r){let a=r.get(s);if(a)return`${a.publisher}/${a.package_}/${c}@${a.version}`}return n&&t?`${n}/${c}@${t}`:c}return n&&t?`${n}/${e}@${t}`:e}import{canonicalForm as Ve,canonicalHash as Be}from"@kanonak-protocol/canonical";function X(e){return typeof e=="object"&&e!==null&&Array.isArray(e.subjects)}import{CANONICAL_FORM_VERSION as en}from"@kanonak-protocol/canonical";function ze(e){return Ve(X(e)?e:Pe(e))}function He(e){return Be(X(e)?e:Pe(e))}function Pe(e){let n=[];for(let t of e)t instanceof T&&n.push({uri:Ze(t),statements:Y(t.statement)});return{subjects:n}}function Y(e){let n=[];for(let t of e){let r=Qe(t);if(!r)continue;if(t instanceof L&&qe(t.predicate.subject)){n.push(...Xe(t,r));continue}let o=Ye(t);o&&n.push({predicate:r,value:o})}return n}function qe(e){let n=ue("type");return n!==void 0&&e.name==="type"&&e.publisher===n.publisher&&e.package_===n.package_}var we=new TextEncoder;function We(e,n){let t=we.encode(e),r=we.encode(n),o=Math.min(t.length,r.length);for(let s=0;s<o;s++)if(t[s]!==r[s])return t[s]-r[s];return t.length-r.length}function Xe(e,n){let t=[];for(let r of e.object){if(!(r instanceof _))throw new Error(`canonicalForm: a multi-valued type statement must contain only entity references, got ${r.constructor?.name??typeof r}`);t.push(J(r))}t.sort(We);for(let r=1;r<t.length;r++)if(t[r-1]===t[r])throw new Error(`canonicalForm: duplicate type ${t[r]} in a multi-valued type statement`);return t.map(r=>({predicate:n,value:{ref:r}}))}function Ye(e){if(e instanceof oe&&e.carrier)return{lit:e.lexical??String(e.object),datatype:Te(e.carrier)};if(e instanceof se)return{raw:e.object};if(e instanceof ae)return{raw:e.lexical??String(e.object)};if(e instanceof ie)return{raw:e.lexical??String(e.object)};if(e instanceof ce)return{ref:J(e.object)};if(e instanceof pe)return je(e.object);if(e instanceof L)return{list:e.object.map(Je)}}function je(e){let n=Y(e.statement);return e.name&&e.name.length>0?{embed:{name:e.name,statements:n}}:{embed:{statements:n}}}function Je(e){if(e instanceof _)return{ref:J(e)};if(e instanceof te)return je(e);if(e instanceof $){if(e.carrier)return{lit:e.lexical??String(e.value),datatype:Te(e.carrier)};let n=e.value;if(typeof n=="string")return{raw:n};if(typeof n=="number")return{raw:String(n)};if(typeof n=="boolean")return{raw:String(n)}}if(e instanceof ne)return{embed:{statements:Y(e.statement)}};throw new Error(`canonicalForm: list item of unrecognized kind (${e.constructor?.name??typeof e}); add canonicalization support before hashing data that contains it`)}function Te(e){return e===z.LangString?"kanonak.org/core-rdf/langString":`kanonak.org/core-xsd/${e}`}function Qe(e){let n=e.predicate;if(n)return Ee(n.subject)}function Ze(e){let n=e.namespace??"",t=e.name??"";return`${n}/${t}`}function J(e){return Ee(e.subject)}function Ee(e){let n=e.version;return n&&typeof n.major=="number"?`${e.publisher}/${e.package_}@${n.major}.${n.minor}.${n.patch}/${e.name}`:`${e.publisher}/${e.package_}/${e.name}`}function A(e){let n=e.replace(/^https?:\/\//,"").replace(/^git:\/\//,"").replace(/\/+$/,"").trim();if(!n)throw new Error("Publisher host cannot be empty");return n}var nn="key_thumbprint",N=class{cache=new Map;prCache=new Map;async discoverProtectedResource(n){let t=A(n);if(this.prCache.has(t))return this.prCache.get(t);let r=`https://${t}/.well-known/oauth-protected-resource`,o=await tn(r),s=o&&Array.isArray(o.authorization_servers)?o.authorization_servers.filter(a=>typeof a=="string"):[],c=s.length>0?s:null;return this.prCache.set(t,c),c}async discover(n){let t=A(n);if(this.cache.has(t))return this.cache.get(t);let r=`https://${t}/.well-known/oauth-authorization-server`,o=await this.tryEndpoint(r);if(!o){let s=`https://${t}/.well-known/openid-configuration`;o=await this.tryEndpoint(s)}return this.cache.set(t,o),o}async supportsOAuth(n){return await this.discover(n)!==null}static supportsPkceS256(n){return n.codeChallengeMethodsSupported?.some(t=>t.toUpperCase()==="S256")??!1}static supportsDynamicRegistration(n){return!!n.registrationEndpoint}static supportsAuthorizationCode(n){return n.responseTypesSupported?.some(t=>t.toLowerCase()==="code")??!1}static supportsEnrollment(n){return!!n.enrollmentEndpoint}static supportsSession(n){return!!n.sessionEndpoint}async tryEndpoint(n){let t;try{t=await fetch(n)}catch(o){let s=o instanceof Error?o.message:String(o);return s.includes("ENOTFOUND")||s.includes("ECONNREFUSED")?(console.error(` OAuth discovery: ${n} \u2014 host unreachable (${s})`),console.error(" If the server is behind a VPN, ensure you are connected.")):s.includes("CERT")||s.includes("SSL")||s.includes("TLS")?(console.error(` OAuth discovery: ${n} \u2014 TLS error (${s})`),console.error(" If using a custom CA certificate, set NODE_EXTRA_CA_CERTS=/path/to/ca.pem")):console.error(` OAuth discovery: ${n} \u2014 network error: ${s}`),null}if(!t.ok)return t.status===404||(t.status===403?(console.error(` OAuth discovery: ${n} \u2014 HTTP 403 Forbidden`),console.error(" Access may be blocked by a firewall, proxy, or WAF.")):t.status>=500&&(console.error(` OAuth discovery: ${n} \u2014 HTTP ${t.status} server error`),console.error(" The authorization server returned an internal error. Contact your IDP administrator."))),null;let r;try{r=await t.json()}catch{return console.error(` OAuth discovery: ${n} \u2014 response is not valid JSON`),console.error(" The endpoint may be returning HTML instead of JSON. Check IDP configuration."),null}return{issuer:w(r.issuer),authorizationEndpoint:w(r.authorization_endpoint),tokenEndpoint:w(r.token_endpoint),registrationEndpoint:w(r.registration_endpoint),revocationEndpoint:w(r.revocation_endpoint),scopesSupported:P(r.scopes_supported),responseTypesSupported:P(r.response_types_supported),grantTypesSupported:P(r.grant_types_supported),codeChallengeMethodsSupported:P(r.code_challenge_methods_supported),tokenEndpointAuthMethodsSupported:P(r.token_endpoint_auth_methods_supported),dpopSigningAlgValuesSupported:P(r.dpop_signing_alg_values_supported),enrollmentEndpoint:w(r.enrollment_endpoint),enrollmentIssuanceProtocols:P(r.enrollment_issuance_protocols),enrollmentKeyTypes:P(r.enrollment_key_types),enrollmentScopesSupported:P(r.enrollment_scopes_supported),enrollmentConsentBindingParam:w(r.enrollment_consent_binding_param),sessionEndpoint:w(r.session_endpoint),sessionEndpointAuthMethod:w(r.session_endpoint_auth_method)}}};async function tn(e){try{let n=await fetch(e);return n.ok?await n.json():null}catch{return null}}function w(e){return typeof e=="string"?e:null}function P(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):null}function Re(e){let n=e.headers.get("WWW-Authenticate")??void 0,t=e.headers.get("DPoP-Nonce")??void 0;if(!n&&!t)return;let r={wwwAuthenticate:n??""};if(t&&(r.nonce=t),n){let o=n.match(/acr_values\s*=\s*"([^"]*)"/i);o&&(r.acrValues=o[1])}return r}function rn(e){try{return new URL(e).host}catch{return null}}function on(e,n={}){let t=n.discovery??new N,r=new Map,o=new Map,s=async i=>{let d=r.get(i);if(d!==void 0)return d;let f=null,p=await t.discoverProtectedResource(i).catch(()=>null);return p&&p.length>0&&(f=rn(p[0])),r.set(i,f),f},c=async(i,d)=>{if(!e)return null;if(!(d.forceRefresh||d.challenge)&&o.has(i))return o.get(i);let p=await e.resolve(i,d).catch(()=>null);return o.set(i,p),p},a=async(i,d,f,p)=>{let g=await s(d);if(!g)return{res:await F(i,{method:f,redirect:"manual"}),authed:!1};let u=await c(g,{method:f,url:i,...p}),l=u?.headers??{};return{res:await F(i,{method:f,redirect:"manual",headers:l}),authed:!!u}};return async(i,d,f="GET")=>{let p=await a(i,d,f,{});if((p.res.status===401||p.res.status===403)&&p.authed){let g=Re(p.res),u={forceRefresh:g===void 0};return g&&(u.challenge=g),(await a(i,d,f,u)).res}return p.res}}var _e="KANONAK_TOKEN";function sn(){return typeof process<"u"&&process.env?process.env:{}}function an(e){return`${_e}_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}var Q=class{tokens;env;constructor(n={}){this.tokens=n.tokens??{},this.env=n.env??sn()}async resolve(n,t){let r=A(n),o=this.tokens[r]??this.env[an(r)]??this.env[_e];return o?{headers:{Authorization:`Bearer ${o}`}}:null}};var E="kanonak.org",U="core-rdf",Ie="core-xsd",Ae={publisher:E,package_:U,name:"subClassOf"},Ne={publisher:E,package_:U,name:"label"},$e={publisher:E,package_:U,name:"comment"},Ke={publisher:E,package_:"core-owl",name:"oneOf"},xe=e=>e;function cn(e){let n=fe(e,Ae);if(n)return[n];let t=[];for(let r of V(e,Ae))r instanceof _&&t.push(r.subject);return t}function pn(e,n,t){if(n.publisher===E&&n.package_===U&&n.name==="Literal")return{kind:"datatype",uri:n};let o=G(e,n);if(o){let s=xe(o);if(O.isDatatypeType(s))return{kind:"datatype",uri:n};if(O.isClassType(s))return{kind:"class",uri:x(o)??n,localName:o.name}}return n.publisher===E&&n.package_===Ie?{kind:"datatype",uri:n}:t==="datatype"?{kind:"datatype",uri:n}:{kind:"class",uri:n,localName:n.name}}function ln(e,n,t){if(!n.range)throw new Error(`Property ${n.uri.publisher}/${n.uri.package_}/${n.uri.name} has no rdfs.range; every property must declare a range. Validate the ontology before introspecting it.`);let r=pn(e,n.range,n.kind),o=n.kind==="object"?"object":n.kind==="datatype"?"datatype":r.kind==="class"?"object":"datatype";return{uri:n.uri,localName:n.uri.name,kind:o,range:r,...n.label!==void 0?{label:n.label}:{},...n.comment!==void 0?{comment:n.comment}:{},...t??{}}}var M=e=>new re(E,Ie,e);function un(e){return typeof e=="boolean"?M("boolean"):typeof e=="number"?Number.isInteger(e)?M("integer"):M("decimal"):M("string")}function dn(e,n){let t=[];for(let r of V(n,Ke))if(r instanceof _){let o=G(e,r.subject),s=(o?x(o):void 0)??r.subject,c=o?I(o,Ne):void 0,a=o?I(o,$e):void 0;t.push({kind:"individual",uri:s,localName:s.name,...c!==void 0?{label:c}:{},...a!==void 0?{comment:a}:{}})}else r instanceof $&&t.push({kind:"literal",value:r.value,datatype:un(r.value)});return t}function fn(e,n,t,r){let o=ge(e,n),s=K(n);return ye(e,n).filter(a=>t?!0:a.domains.some(i=>K(i)===s)).map(a=>ln(e,a,he(r,o,a.uri)))}async function gn(e,n,t){let r=e.metadata?.namespace_;if(!r)throw new Error("buildOntologyModel: document has no namespace (publisher/package/version).");let o=t?.includeInherited??!1,s=await new D().parseKanonaks(n),c=me(s),a=[],i=[],d=new Set;for(let f of s){if(!(f instanceof T)||!O.isClassType(xe(f)))continue;let p=x(f);if(!p||p.publisher!==r.publisher||p.package_!==r.package_||p.version&&r.version&&!ee(p.version,r.version))continue;let g=K(p);if(d.has(g))continue;d.add(g);let u=cn(f).map(b=>({uri:b,localName:b.name})),l=I(f,Ne),m=I(f,$e);a.push({uri:p,localName:p.name,superClasses:u,properties:fn(s,p,o,c),...l!==void 0?{label:l}:{},...m!==void 0?{comment:m}:{}}),de(f,Ke)&&i.push({uri:p,localName:p.name,members:dn(s,f),...l!==void 0?{label:l}:{},...m!==void 0?{comment:m}:{}})}return{classes:a,enums:i}}export{Ce as a,Se as b,H as c,ze as d,He as e,en as f,A as g,nn as h,N as i,Re as j,on as k,Q as l,gn as m};
|
|
@@ -36,17 +36,17 @@ line (let the line run long), or check for an unterminated [[.`,n}};var bt="kano
|
|
|
36
36
|
Possible solutions:
|
|
37
37
|
\u2022 Point ${t} at a property declared on this class (or an ancestor / rdfs.Resource)
|
|
38
38
|
\u2022 Set the property's domain to this class if it should apply here
|
|
39
|
-
\u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function po(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}function Z(c,e,t){let o=[];return
|
|
39
|
+
\u2022 Use rdfs.label / rdfs.comment for the universal default`,n}};function po(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}function Z(c,e,t){let o=[];return Le(c,t,{input:e},o),o}function Le(c,e,t,o){if(P(e,M.VarRef)){let a=F(e,M.varName);return a?t[a]:void 0}if(P(e,M.PropertyRead)){let a=$(e,M.readSource),i=a?Le(c,a,t,o):void 0,s=y(e,M.readProp);if(!i||!s)return;let p=L(c,i,s);if(!p.ok){o.push({contextClass:i,propertyUri:s,via:"PropertyRead"});return}return p.descriptor?.range}if(P(e,M.Traverse)){let a=$(e,M.traverseSource),i=a?Le(c,a,t,o):void 0,s=y(e,M.through),p;if(i&&s){let m=L(c,i,s);m.ok?p=m.descriptor?.range:o.push({contextClass:i,propertyUri:s,via:"Traverse"})}let l=$(e,M.step);return l?Le(c,l,{...t,input:p},o):void 0}let n=F(e,M.loopVar),r=n?{...t,[n]:void 0}:t;for(let a of lo(e))Le(c,a,r,o)}function lo(c){let e=[];for(let t of c.statement){let o=t.object;if(o instanceof I)e.push(o);else if(Array.isArray(o))for(let n of o)n instanceof I&&e.push(n)}return e}var Me="kanonak.org",Be="look",mo={publisher:Me,package_:Be,name:"semanticSvg"},uo={publisher:Me,package_:Be,name:"tierChip"},fo={publisher:Me,package_:Be,name:"tierIcon"},yo={publisher:Me,package_:Be,name:"tierCard"},go={publisher:Me,package_:Be,name:"tierFull"},ko=[uo,fo,yo,go],je=class{ruleName="LookSemanticSvgPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new q(e,t));let a=ho(e);if(!a)return n;for(let i of r)i instanceof f&&i.namespace===a&&this.checkSemanticSvg(r,i,n);return n}checkSemanticSvg(e,t,o){let n=$(t,mo);if(!n)return;let r=w(t);if(r)for(let a of ko){let i=$(n,a);if(i)for(let s of Z(e,r,i))o.push(this.toError(t.name,a.name,s))}}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=r===e?`'${e}' (the class this SemanticSvg is declared on)`:`'${r}', reached by traversal from '${e}' (the class this SemanticSvg is declared on)`,i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=`look.semanticSvg.${t}`,i.actualValue=n,i.message=`tx.${o.via} reads property '${o.propertyUri.name}' off the rendered instance, but its domain is not in scope for ${a}. The read would silently return undefined at render time.`,i.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,i.suggestion=`Property '${n}' is not in scope for '${r}'.
|
|
40
40
|
|
|
41
41
|
Possible solutions:
|
|
42
42
|
\u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
|
|
43
43
|
\u2022 If the property should apply to '${r}', adjust its domain
|
|
44
|
-
\u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function ho(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Ro="kanonak.org",K=(c,e)=>({publisher:Ro,package_:c,name:e}),Ko=K("derivation","look"),bo=K("look","bands"),Vo=K("look","Distribution"),Eo=K("look","StatRow"),vo=K("look","VersionDelta"),Do=K("look","Timeline"),Io=K("look","VersionDiff"),Co=K("look","TimePlot"),So=K("look","ReferenceList"),Po=K("look","Diagram"),jo=K("look","alphaPath"),Oo=K("look","betaPath"),tt=K("look","metricPath"),Et=K("look","lowerPath"),vt=K("look","upperPath"),Dt=K("look","hueBy"),$o=K("look","statPath"),Uo=K("look","laneBy"),It=K("look","labelPath"),wo=K("look","badgePath"),Ao=K("look","mapPath"),xo=K("look","nodeNote"),No=K("look","edgeValue"),To=K("look","stats"),_o=K("look","facets"),Lo=K("look","channels"),Mo=K("look","track"),Bo=K("look","source"),Fo=K("look","relation"),Ho=K("look","entries"),
|
|
44
|
+
\u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i}};function ho(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Ro="kanonak.org",K=(c,e)=>({publisher:Ro,package_:c,name:e}),Ko=K("derivation","look"),bo=K("look","bands"),Vo=K("look","Distribution"),Eo=K("look","StatRow"),vo=K("look","VersionDelta"),Do=K("look","Timeline"),Io=K("look","VersionDiff"),Co=K("look","TimePlot"),So=K("look","ReferenceList"),Po=K("look","Diagram"),jo=K("look","alphaPath"),Oo=K("look","betaPath"),tt=K("look","metricPath"),Et=K("look","lowerPath"),vt=K("look","upperPath"),Dt=K("look","hueBy"),$o=K("look","statPath"),Uo=K("look","laneBy"),It=K("look","labelPath"),wo=K("look","badgePath"),Ao=K("look","mapPath"),xo=K("look","nodeNote"),No=K("look","edgeValue"),To=K("look","stats"),_o=K("look","facets"),Lo=K("look","channels"),Mo=K("look","track"),Bo=K("look","source"),Fo=K("look","relation"),Ho=K("look","entries"),Oe=class{ruleName="LookBandPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new q(e,t));let a=Go(e);if(!a)return n;for(let i of r)i instanceof f&&i.namespace===a&&this.checkDeclaration(r,i,n);return n}checkDeclaration(e,t,o){let n=$(t,Ko);if(!n)return;let r=w(t);if(!r)return;let a=b(n,bo).filter(i=>i instanceof I);for(let i of a)for(let s of this.carriersOf(e,i,r))for(let p of Z(e,s.context,s.expr))o.push(this.toError(t.name,s.slot,p))}carriersOf(e,t,o){let n=[],r=(a,i)=>{let s=$(t,a);s&&n.push({slot:`look.${a.name}`,context:i,expr:s})};if(P(t,Vo))for(let a of[jo,Oo,tt,Et,vt,Dt])r(a,o);if(P(t,vo)&&r(tt,o),P(t,Eo)){let a=b(t,To).filter(i=>i instanceof I);for(let i of a){let s=$(i,$o);s&&n.push({slot:"look.stats[].statPath",context:o,expr:s})}}if(P(t,Do)||P(t,Io)){let a=this.rangeOf(e,o,y(t,Mo));if(a)for(let i of[tt,Et,vt,Dt])r(i,a)}if(P(t,Co)){let a=this.rangeOf(e,o,y(t,Bo));if(a)for(let i of[Uo,It])r(i,a)}if(P(t,So))for(let a of b(t,Ho)){let i=a instanceof I?void 0:Wo(a),s=this.rangeOf(e,o,i);if(s)for(let p of[It,wo])r(p,s)}if(P(t,Po)){let a=b(t,_o).filter(i=>i instanceof I);for(let i of a){let s=this.rangeOf(e,o,y(i,Fo));if(!s)continue;let p=$(i,xo);p&&n.push({slot:"look.facets[].nodeNote",context:s,expr:p});let l=$(i,No);l&&n.push({slot:"look.facets[].edgeValue",context:s,expr:l});let m=b(i,Lo).filter(d=>d instanceof I);for(let d of m){let h=$(d,Ao);h&&n.push({slot:"look.facets[].channels[].mapPath",context:s,expr:h})}}}return n}rangeOf(e,t,o){if(!o)return;let n=L(e,t,o);return n.ok?n.descriptor?.range:void 0}toError(e,t,o){let n=`${o.propertyUri.publisher}/${o.propertyUri.package_}/${o.propertyUri.name}`,r=o.contextClass.name,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=t,a.actualValue=n,a.message=`tx.${o.via} reads property '${o.propertyUri.name}', but its domain is not in scope for '${r}' (the class this band carrier is evaluated against). The read would silently return undefined at render time and the band would render empty.`,a.expectedValue=`A property whose domain is '${r}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${n}' is not in scope for '${r}'.
|
|
45
45
|
|
|
46
46
|
Possible solutions:
|
|
47
47
|
\u2022 Read a property declared on '${r}' (or an ancestor / rdfs.Resource)
|
|
48
48
|
\u2022 If the property should apply to '${r}', adjust its domain
|
|
49
|
-
\u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Wo(c){let e=c.subject;return e&&typeof e.name=="string"?e:void 0}function Go(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var
|
|
49
|
+
\u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,a}};function Wo(c){let e=c.subject;return e&&typeof e.name=="string"?e:void 0}function Go(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Ue="kanonak.org",we="view",Yo={publisher:Ue,package_:we,name:"bind"},qo={publisher:Ue,package_:we,name:"produces"},zo={publisher:Ue,package_:we,name:"projections"},Xo={publisher:Ue,package_:we,name:"where"},Zo={publisher:Ue,package_:we,name:"value"},Jo={publisher:Ue,package_:we,name:"as"},$e=class{ruleName="TxExpressionPath";async validateAsync(e,t,o){let n=[],r;o?r=await o.getKanonaks():r=await new S().parseKanonaks(new q(e,t));let a=tn(e);if(!a)return n;for(let i of r)i instanceof f&&i.namespace===a&&this.checkView(r,i,n);return n}checkView(e,t,o){let n=y(t,Yo);if(!n)return;let r=y(t,qo),a=0;for(let s of en(e,b(t,zo))){let p=$(s,Zo);if(p)for(let m of Z(e,n,p))o.push(this.toError(t.name,`view.projections[${a}].value`,n,m));let l=y(s,Jo);l&&r&&(L(e,r,l).ok||o.push(this.asError(t.name,a,r,l))),a+=1}let i=0;for(let s of Qo(t,Xo)){for(let p of Z(e,n,s))o.push(this.toError(t.name,`view.where[${i}]`,n,p));i+=1}}asError(e,t,o,n){let r=`${n.publisher}/${n.package_}/${n.name}`,a=new u;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=e,a.propertyName=`view.projections[${t}].as`,a.actualValue=r,a.message=`Projection stores its value under property '${n.name}', but that property's domain is not in scope for the view's produces class '${o.name}'. The materialized result instance could not carry this value.`,a.expectedValue=`A property whose domain is '${o.name}', an ancestor, or rdfs.Resource`,a.suggestion=`Property '${r}' is not in scope for produces class '${o.name}'.
|
|
50
50
|
|
|
51
51
|
Possible solutions:
|
|
52
52
|
\u2022 Use an output property whose domain covers '${o.name}'
|
|
@@ -56,8 +56,8 @@ Possible solutions:
|
|
|
56
56
|
Possible solutions:
|
|
57
57
|
\u2022 Read a property declared on '${a}' (or an ancestor / rdfs.Resource)
|
|
58
58
|
\u2022 If the property should apply to '${a}', adjust its domain
|
|
59
|
-
\u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,s}};function Qo(c,e){let t=$(c,e);return t?[t]:b(c,e).filter(o=>o instanceof I)}function en(c,e){let t=[];for(let o of e)if(o instanceof I)t.push(o);else if(o instanceof D){let n=k(c,o.subject);n&&t.push(n)}return t}function tn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var ze="kanonak.org",on="core-shacl",A=c=>({publisher:ze,package_:on,name:c}),nn=A("NodeShape"),rn=A("PropertyShape"),an=A("targetClass"),sn=A("property"),cn=A("path"),pn=A("minCount"),ln=A("maxCount"),mn=A("datatype"),un=A("class"),Ct=A("in"),dn=A("pattern"),fn=A("flags"),yn=A("minLength"),gn=A("maxLength"),kn=A("minInclusive"),hn=A("maxInclusive"),Rn=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),St=c=>c,Ae=class{ruleName="ShaclShape";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Kn(e);if(!a)return n;let i=new Set;for(let s of r){if(!(s instanceof f)||s.namespace!==a||!P(s,nn))continue;let p=y(s,an);p?this.resolvesToClass(r,p)||n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' sh:targetClass '${p.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(p))):n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of b(s,sn)){let m;if(l instanceof I)m=l;else if(l instanceof D){let d=k(r,l.subject);d&&(m=d,i.add(R(l.subject)))}m&&this.checkPropertyShape(r,s.name,m,p??void 0,n)}}for(let s of r){if(!(s instanceof f)||s.namespace!==a||!P(s,rn))continue;let p=w(s);p&&i.has(R(p))||this.checkPropertyShape(r,s.name,s,void 0,n)}return n}checkPropertyShape(e,t,o,n,r){let a=y(o,cn);if(!a){r.push(this.err(t,"property.path","Error",`A PropertyShape on '${t}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=k(e,a),s=i?W(e,i):!1;s?n&&(L(e,n,a).ok||r.push(this.err(t,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,J(a)))):r.push(this.err(t,"property.path","Error",`sh:path '${a.name}' on '${t}' does not resolve to a property.`,"Reference a defined or imported property.",J(a)));let p=y(o,mn),l=y(o,un);p&&l&&r.push(this.err(t,"property","Error",`A PropertyShape on '${t}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),p&&!this.resolvesToDatatype(e,p)&&r.push(this.err(t,"datatype","Error",`sh:datatype '${p.name}' on '${t}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",J(p))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(t,"class","Error",`sh:class '${l.name}' on '${t}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(l)));let m=we(x(o,pn)),d=we(x(o,ln));this.checkOrder(t,"minCount",m,"maxCount",d,r);let h=we(x(o,yn)),V=we(x(o,gn));this.checkOrder(t,"minLength",h,"maxLength",V,r);let T=we(x(o,kn)),j=we(x(o,hn));this.checkOrder(t,"minInclusive",T,"maxInclusive",j,r);let O=F(o,dn);if(O!==void 0){let B=F(o,fn);try{new RegExp(O,B)}catch{r.push(this.err(t,"pattern","Error",`sh:pattern on '${t}' is not a valid regular expression`+(B!==void 0?` (with flags '${B}')`:"")+`: ${O}`,"Provide a valid regular expression and flags.",O))}}if(ee(o,Ct)&&b(o,Ct).length===0&&r.push(this.err(t,"in","Error",`sh:in on '${t}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),s&&n){let _=L(e,n,a).descriptor;_&&((O!==void 0||h!==void 0||V!==void 0)&&_.kind==="object"&&r.push(this.err(t,"pattern/minLength/maxLength","Warning",`String facets on '${t}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",J(a))),(T!==void 0||j!==void 0)&&!this.isNumericDatatypeRange(_.range)&&r.push(this.err(t,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${t}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",J(a))))}}checkOrder(e,t,o,n,r,a){o!==void 0&&r!==void 0&&o>r&&a.push(this.err(e,`${t}/${n}`,"Error",`${t} (${o}) exceeds ${n} (${r}) on '${e}'.`,`Set ${t} <= ${n}.`))}resolvesToClass(e,t){let o=k(e,t);return o?v.isClassType(St(o)):!1}resolvesToDatatype(e,t){if(t.publisher===ze&&t.package_==="core-rdf"&&t.name==="Literal")return!0;let o=k(e,t);return o?v.isDatatypeType(St(o)):!1}isNumericDatatypeRange(e){return!e||e.publisher===ze&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===ze&&e.package_==="core-xsd"&&Rn.has(e.name)}err(e,t,o,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=o,i.entityName=e,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function we(c){return typeof c=="number"?c:void 0}function J(c){return`${c.publisher}/${c.package_}/${c.name}`}function Kn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Pt={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},bn=c=>c,xe=class{ruleName="OwlOneOf";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Vn(e);if(!a)return n;for(let i of r){if(!(i instanceof f)||i.namespace!==a||!ee(i,Pt))continue;let s=b(i,Pt);if(s.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let p of s)if(p instanceof Fe)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(p.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(p.value)));else if(p instanceof D){let l=k(r,p.subject);l&&v.isSchemaDefinitionType(bn(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${p.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${p.subject.publisher}/${p.subject.package_}/${p.subject.name}`))}}return n}err(e,t,o,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=t,a.entityName=e,a.propertyName="oneOf",a.message=o,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function Vn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var En="kanonak.org",vn="core-shacl",N=c=>({publisher:En,package_:vn,name:c}),Dn=N("NodeShape"),In=N("targetClass"),Cn=N("property"),Sn=N("path"),Pn=N("minCount"),jn=N("maxCount"),On=N("in"),$n=N("pattern"),Un=N("flags"),wn=N("minLength"),An=N("maxLength"),xn=N("minInclusive"),Nn=N("maxInclusive"),Tn=N("message");function Ne(c){return typeof c=="number"?c:void 0}function _n(c){let e={},t=Ne(x(c,Pn)),o=Ne(x(c,jn));t!==void 0&&(e.minCount=t),o!==void 0&&(e.maxCount=o);let n=Ne(x(c,wn)),r=Ne(x(c,An));n!==void 0&&(e.minLength=n),r!==void 0&&(e.maxLength=r);let a=Ne(x(c,xn)),i=Ne(x(c,Nn));a!==void 0&&(e.minInclusive=a),i!==void 0&&(e.maxInclusive=i);let s=F(c,$n);if(s!==void 0){let m=F(c,Un);e.pattern=m!==void 0?{regex:s,flags:m}:{regex:s}}let p=b(c,On).filter(m=>m instanceof Fe).map(m=>m.value);p.length>0&&(e.enumValues=p);let l=F(c,Tn);return l!==void 0&&(e.message=l),e}function Ln(c,e){let t=[];for(let o of b(e,Cn))if(o instanceof I)t.push(o);else if(o instanceof D){let n=k(c,o.subject);n&&t.push(n)}return t}function jt(c){let e=new Map;for(let t of c){if(!(t instanceof f)||!P(t,Dn))continue;let o=y(t,In);if(!o)continue;let n=R(o);for(let r of Ln(c,t)){let a=y(r,Sn);if(!a)continue;let i={pathKey:R(a),constraints:_n(r)},s=e.get(n);s?s.push(i):e.set(n,[i])}}return e}function Mn(c,e){e.minCount!==void 0&&(c.minCount=e.minCount),e.maxCount!==void 0&&(c.maxCount=e.maxCount),e.minLength!==void 0&&(c.minLength=e.minLength),e.maxLength!==void 0&&(c.maxLength=e.maxLength),e.minInclusive!==void 0&&(c.minInclusive=e.minInclusive),e.maxInclusive!==void 0&&(c.maxInclusive=e.maxInclusive),e.pattern!==void 0&&(c.pattern=e.pattern),e.enumValues!==void 0&&(c.enumValues=e.enumValues),e.message!==void 0&&(c.message=e.message)}function Ot(c,e,t){let o=R(t),n=!1,r={};for(let a=e.length-1;a>=0;a--){let i=c.get(R(e[a]));if(i)for(let s of i)s.pathKey===o&&(n=!0,Mn(r,s.constraints))}if(n)return r.cardinality=r.maxCount===1?"single":"list",r.required=(r.minCount??0)>=1,r}var Bn=c=>c,Fn=new rt("kanonak.org","core-rdf","Resource"),Te=class{ruleName="DiamondNameClash";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Hn(e);if(!a)return n;let i=jt(r);for(let s of r){if(!(s instanceof f)||s.namespace!==a||!v.isClassType(Bn(s)))continue;let p=w(s);if(!p)continue;let l=z(r,p),m=R(p),d=new Set(l.map(V=>R(V)));d.delete(m),d.delete(R(Fn));let h=new Map;for(let V of st(r,p)){if(!V.domains.some(O=>d.has(R(O))))continue;let j=h.get(V.uri.name);j?j.push(V):h.set(V.uri.name,[V])}for(let[V,T]of h){if(T.length<2)continue;let j=_=>Ot(i,l,_.uri)?.cardinality,O=new Set(T.map(_=>_.range?R(_.range):void 0).filter(_=>_!==void 0)),B=new Set(T.map(j).filter(_=>_!==void 0));O.size<=1&&B.size<=1||n.push(this.toError(s.name,V,T,j))}}return n}toError(e,t,o,n){let r=s=>{let p=`${s.uri.publisher}/${s.uri.package_}/${s.uri.name}`,l=s.range?`${s.range.publisher}/${s.range.package_}/${s.range.name}`:"no range",m=n(s);return`${p} (range ${l}${m?`, ${m}`:""})`},a=o.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=t,i.actualValue=a,i.message=`Class '${e}' inherits ${o.length} distinct properties named '${t}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${t}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${t}':
|
|
59
|
+
\u2022 If the path is wrong, correct the tx.PropertyRead/tx.Traverse chain`,s}};function Qo(c,e){let t=$(c,e);return t?[t]:b(c,e).filter(o=>o instanceof I)}function en(c,e){let t=[];for(let o of e)if(o instanceof I)t.push(o);else if(o instanceof D){let n=k(c,o.subject);n&&t.push(n)}return t}function tn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var ze="kanonak.org",on="core-shacl",A=c=>({publisher:ze,package_:on,name:c}),nn=A("NodeShape"),rn=A("PropertyShape"),an=A("targetClass"),sn=A("property"),cn=A("path"),pn=A("minCount"),ln=A("maxCount"),mn=A("datatype"),un=A("class"),Ct=A("in"),dn=A("pattern"),fn=A("flags"),yn=A("minLength"),gn=A("maxLength"),kn=A("minInclusive"),hn=A("maxInclusive"),Rn=new Set(["decimal","integer","int","long","short","byte","float","double","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte"]),St=c=>c,xe=class{ruleName="ShaclShape";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Kn(e);if(!a)return n;let i=new Set;for(let s of r){if(!(s instanceof f)||s.namespace!==a||!P(s,nn))continue;let p=y(s,an);p?this.resolvesToClass(r,p)||n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' sh:targetClass '${p.name}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(p))):n.push(this.err(s.name,"targetClass","Error",`NodeShape '${s.name}' has no sh:targetClass; it constrains nothing.`,"Add sh:targetClass naming the class this shape applies to."));for(let l of b(s,sn)){let m;if(l instanceof I)m=l;else if(l instanceof D){let d=k(r,l.subject);d&&(m=d,i.add(R(l.subject)))}m&&this.checkPropertyShape(r,s.name,m,p??void 0,n)}}for(let s of r){if(!(s instanceof f)||s.namespace!==a||!P(s,rn))continue;let p=w(s);p&&i.has(R(p))||this.checkPropertyShape(r,s.name,s,void 0,n)}return n}checkPropertyShape(e,t,o,n,r){let a=y(o,cn);if(!a){r.push(this.err(t,"property.path","Error",`A PropertyShape on '${t}' has no sh:path; a PropertyShape must name the property it constrains.`,"Add sh:path naming a property."));return}let i=k(e,a),s=i?W(e,i):!1;s?n&&(L(e,n,a).ok||r.push(this.err(t,"property.path","Warning",`sh:path '${a.name}' is not in scope for sh:targetClass '${n.name}'; the constraint would never bind a value.`,`Constrain a property whose domain is '${n.name}', an ancestor, or rdfs.Resource.`,J(a)))):r.push(this.err(t,"property.path","Error",`sh:path '${a.name}' on '${t}' does not resolve to a property.`,"Reference a defined or imported property.",J(a)));let p=y(o,mn),l=y(o,un);p&&l&&r.push(this.err(t,"property","Error",`A PropertyShape on '${t}' sets both sh:datatype and sh:class; a value is a literal or a node, not both.`,"Keep sh:datatype (literal values) or sh:class (node values), not both.")),p&&!this.resolvesToDatatype(e,p)&&r.push(this.err(t,"datatype","Error",`sh:datatype '${p.name}' on '${t}' does not resolve to a datatype.`,"Reference an xsd datatype or rdfs.Datatype.",J(p))),l&&!this.resolvesToClass(e,l)&&r.push(this.err(t,"class","Error",`sh:class '${l.name}' on '${t}' does not resolve to a class.`,"Reference a defined or imported rdfs.Class.",J(l)));let m=Ae(x(o,pn)),d=Ae(x(o,ln));this.checkOrder(t,"minCount",m,"maxCount",d,r);let h=Ae(x(o,yn)),V=Ae(x(o,gn));this.checkOrder(t,"minLength",h,"maxLength",V,r);let T=Ae(x(o,kn)),j=Ae(x(o,hn));this.checkOrder(t,"minInclusive",T,"maxInclusive",j,r);let O=F(o,dn);if(O!==void 0){let B=F(o,fn);try{new RegExp(O,B)}catch{r.push(this.err(t,"pattern","Error",`sh:pattern on '${t}' is not a valid regular expression`+(B!==void 0?` (with flags '${B}')`:"")+`: ${O}`,"Provide a valid regular expression and flags.",O))}}if(ee(o,Ct)&&b(o,Ct).length===0&&r.push(this.err(t,"in","Error",`sh:in on '${t}' is empty; an enumeration must list at least one permitted value.`,"List the permitted literal values, or remove sh:in.")),s&&n){let _=L(e,n,a).descriptor;_&&((O!==void 0||h!==void 0||V!==void 0)&&_.kind==="object"&&r.push(this.err(t,"pattern/minLength/maxLength","Warning",`String facets on '${t}' apply to '${a.name}', which is an object property; string facets constrain literal values.`,"Apply string facets to a datatype property, or use sh:class for node values.",J(a))),(T!==void 0||j!==void 0)&&!this.isNumericDatatypeRange(_.range)&&r.push(this.err(t,"minInclusive/maxInclusive","Warning",`Numeric bounds on '${t}' apply to '${a.name}', whose range is not a numeric datatype.`,"Apply numeric bounds to a numeric datatype property.",J(a))))}}checkOrder(e,t,o,n,r,a){o!==void 0&&r!==void 0&&o>r&&a.push(this.err(e,`${t}/${n}`,"Error",`${t} (${o}) exceeds ${n} (${r}) on '${e}'.`,`Set ${t} <= ${n}.`))}resolvesToClass(e,t){let o=k(e,t);return o?v.isClassType(St(o)):!1}resolvesToDatatype(e,t){if(t.publisher===ze&&t.package_==="core-rdf"&&t.name==="Literal")return!0;let o=k(e,t);return o?v.isDatatypeType(St(o)):!1}isNumericDatatypeRange(e){return!e||e.publisher===ze&&e.package_==="core-rdf"&&e.name==="Literal"?!0:e.publisher===ze&&e.package_==="core-xsd"&&Rn.has(e.name)}err(e,t,o,n,r,a){let i=new u;return i.ruleType=this.ruleName,i.severity=o,i.entityName=e,i.propertyName=t,i.message=n,i.suggestion=r,a!==void 0&&(i.actualValue=a),i}};function Ae(c){return typeof c=="number"?c:void 0}function J(c){return`${c.publisher}/${c.package_}/${c.name}`}function Kn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var Pt={publisher:"kanonak.org",package_:"core-owl",name:"oneOf"},bn=c=>c,Ne=class{ruleName="OwlOneOf";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Vn(e);if(!a)return n;for(let i of r){if(!(i instanceof f)||i.namespace!==a||!ee(i,Pt))continue;let s=b(i,Pt);if(s.length===0){n.push(this.err(i.name,"Warning",`owl:oneOf on '${i.name}' is empty; a closed enumeration must list at least one individual.`,"List the individuals that make up the enumeration, or remove owl:oneOf."));continue}for(let p of s)if(p instanceof Fe)n.push(this.err(i.name,"Error",`owl:oneOf member '${String(p.value)}' on '${i.name}' is not a named individual; a class enumeration is of individuals (a misspelled or unimported individual reads as a literal). For a closed set of literal VALUES, constrain a property with sh:in instead.`,"Reference a defined or imported individual, or move literal value sets to a property sh:in.",String(p.value)));else if(p instanceof D){let l=k(r,p.subject);l&&v.isSchemaDefinitionType(bn(l))&&n.push(this.err(i.name,"Error",`owl:oneOf member '${p.subject.name}' on '${i.name}' is a class/property/datatype, not an individual.`,"List named individuals (instances), not schema definitions.",`${p.subject.publisher}/${p.subject.package_}/${p.subject.name}`))}}return n}err(e,t,o,n,r){let a=new u;return a.ruleType=this.ruleName,a.severity=t,a.entityName=e,a.propertyName="oneOf",a.message=o,a.suggestion=n,r!==void 0&&(a.actualValue=r),a}};function Vn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var En="kanonak.org",vn="core-shacl",N=c=>({publisher:En,package_:vn,name:c}),Dn=N("NodeShape"),In=N("targetClass"),Cn=N("property"),Sn=N("path"),Pn=N("minCount"),jn=N("maxCount"),On=N("in"),$n=N("pattern"),Un=N("flags"),wn=N("minLength"),An=N("maxLength"),xn=N("minInclusive"),Nn=N("maxInclusive"),Tn=N("message");function Te(c){return typeof c=="number"?c:void 0}function _n(c){let e={},t=Te(x(c,Pn)),o=Te(x(c,jn));t!==void 0&&(e.minCount=t),o!==void 0&&(e.maxCount=o);let n=Te(x(c,wn)),r=Te(x(c,An));n!==void 0&&(e.minLength=n),r!==void 0&&(e.maxLength=r);let a=Te(x(c,xn)),i=Te(x(c,Nn));a!==void 0&&(e.minInclusive=a),i!==void 0&&(e.maxInclusive=i);let s=F(c,$n);if(s!==void 0){let m=F(c,Un);e.pattern=m!==void 0?{regex:s,flags:m}:{regex:s}}let p=b(c,On).filter(m=>m instanceof Fe).map(m=>m.value);p.length>0&&(e.enumValues=p);let l=F(c,Tn);return l!==void 0&&(e.message=l),e}function Ln(c,e){let t=[];for(let o of b(e,Cn))if(o instanceof I)t.push(o);else if(o instanceof D){let n=k(c,o.subject);n&&t.push(n)}return t}function jt(c){let e=new Map;for(let t of c){if(!(t instanceof f)||!P(t,Dn))continue;let o=y(t,In);if(!o)continue;let n=R(o);for(let r of Ln(c,t)){let a=y(r,Sn);if(!a)continue;let i={pathKey:R(a),constraints:_n(r)},s=e.get(n);s?s.push(i):e.set(n,[i])}}return e}function Mn(c,e){e.minCount!==void 0&&(c.minCount=e.minCount),e.maxCount!==void 0&&(c.maxCount=e.maxCount),e.minLength!==void 0&&(c.minLength=e.minLength),e.maxLength!==void 0&&(c.maxLength=e.maxLength),e.minInclusive!==void 0&&(c.minInclusive=e.minInclusive),e.maxInclusive!==void 0&&(c.maxInclusive=e.maxInclusive),e.pattern!==void 0&&(c.pattern=e.pattern),e.enumValues!==void 0&&(c.enumValues=e.enumValues),e.message!==void 0&&(c.message=e.message)}function Ot(c,e,t){let o=R(t),n=!1,r={};for(let a=e.length-1;a>=0;a--){let i=c.get(R(e[a]));if(i)for(let s of i)s.pathKey===o&&(n=!0,Mn(r,s.constraints))}if(n)return r.cardinality=r.maxCount===1?"single":"list",r.required=(r.minCount??0)>=1,r}var Bn=c=>c,Fn=new rt("kanonak.org","core-rdf","Resource"),_e=class{ruleName="DiamondNameClash";async validateAsync(e,t,o){let n=[],r=o?await o.getKanonaks():await new S().parseKanonaks(t),a=Hn(e);if(!a)return n;let i=jt(r);for(let s of r){if(!(s instanceof f)||s.namespace!==a||!v.isClassType(Bn(s)))continue;let p=w(s);if(!p)continue;let l=z(r,p),m=R(p),d=new Set(l.map(V=>R(V)));d.delete(m),d.delete(R(Fn));let h=new Map;for(let V of st(r,p)){if(!V.domains.some(O=>d.has(R(O))))continue;let j=h.get(V.uri.name);j?j.push(V):h.set(V.uri.name,[V])}for(let[V,T]of h){if(T.length<2)continue;let j=_=>Ot(i,l,_.uri)?.cardinality,O=new Set(T.map(_=>_.range?R(_.range):void 0).filter(_=>_!==void 0)),B=new Set(T.map(j).filter(_=>_!==void 0));O.size<=1&&B.size<=1||n.push(this.toError(s.name,V,T,j))}}return n}toError(e,t,o,n){let r=s=>{let p=`${s.uri.publisher}/${s.uri.package_}/${s.uri.name}`,l=s.range?`${s.range.publisher}/${s.range.package_}/${s.range.name}`:"no range",m=n(s);return`${p} (range ${l}${m?`, ${m}`:""})`},a=o.map(r).join("; "),i=new u;return i.ruleType=this.ruleName,i.severity="Error",i.entityName=e,i.propertyName=t,i.actualValue=a,i.message=`Class '${e}' inherits ${o.length} distinct properties named '${t}' with incompatible range or cardinality: ${a}. The generated interface would multiply-inherit '${t}' with conflicting types and could not compile.`,i.suggestion=`Disambiguate the diamond name-clash on '${t}':
|
|
60
60
|
\u2022 rename one of the properties, or
|
|
61
61
|
\u2022 re-domain one so it is not inherited by '${e}', or
|
|
62
62
|
\u2022 restructure the hierarchy so '${e}' inherits only one '${t}', or
|
|
63
|
-
\u2022 make the ranges/cardinalities compatible (identical) if they are meant to be the same property.`,i}};function Hn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var ot=class{parser;documentRules;repositoryRules;includeWarnings=!0;constructor(e){this.parser=e??new nt,this.documentRules=[new ae,new ie,new se,new ce,new pe],this.repositoryRules=[new le,new me,new ue,new de,new fe,new ye,new ge,new ke,new he,new Re,new Ke,new be,new Ee,new ve,new De,new Ie,new Ce,new Se,new Pe,new je,new
|
|
63
|
+
\u2022 make the ranges/cardinalities compatible (identical) if they are meant to be the same property.`,i}};function Hn(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var ot=class{parser;documentRules;repositoryRules;includeWarnings=!0;constructor(e){this.parser=e??new nt,this.documentRules=[new ae,new ie,new se,new ce,new pe],this.repositoryRules=[new le,new me,new ue,new de,new fe,new ye,new ge,new ke,new he,new Re,new Ke,new be,new Ee,new ve,new De,new Ie,new Ce,new Se,new Pe,new je,new Oe,new $e,new xe,new Ne,new _e]}async validateAsync(e,t,o){let n=new te;for(let r of this.documentRules)try{let a=r.validate(e);this.addErrorsToResult(n,a)}catch(a){let i=new u;i.ruleType=r.ruleName,i.severity="Error",i.message=`Validation rule '${r.ruleName}' failed: ${a instanceof Error?a.message:String(a)}`,n.errors.push(i)}if(t){let r=[],a=o??new oe(new ne(e,t)),i=a.repository;for(let s of this.repositoryRules)try{let p=await s.validateAsync(e,i,a);this.addErrorsToResult(n,p)}catch(p){let l=p instanceof Error?p.message:String(p);r.push({ruleName:s.ruleName,cause:l})}if(r.length>0){let s=new Map;for(let{ruleName:p,cause:l}of r){let m=s.get(l);m?m.push(p):s.set(l,[p])}for(let[p,l]of s){let m=new u;m.ruleType=l[0],m.severity="Error",l.length===1?m.message=`Validation rule '${l[0]}' failed: ${p}`:m.message=`${p} (affects ${l.length} rules: ${l.join(", ")})`,n.errors.push(m)}}}return n.isValid=n.errors.length===0,n}async validateDocumentsAsync(e,t){let o=new oe(t),n=[];for(let r of e){let a=await this.validateAsync(r,o.repository,o);n.push({document:r,result:a})}return n}async validateYamlAsync(e,t,o){let n=this.parser.parseWithErrors(e);if(!n.isValid){let r=new te;r.isValid=!1;for(let a of n.errors){let i=new u;i.ruleType="ParseError",i.severity="Error",i.lineNumber=a.line,i.column=a.column,i.message=a.message,a.keyName&&(i.entityName=a.keyName),a.errorType==="DuplicateKey"&&(i.suggestion="All property names must be unique across the entire document. Rename one of the duplicate properties to make them unique."),r.errors.push(i)}return r}return await this.validateAsync(n.document,t,o)}addDocumentRule(e){this.documentRules.push(e)}addRepositoryRule(e){this.repositoryRules.push(e)}removeDocumentRule(e){let t=this.documentRules.findIndex(o=>o instanceof e);t>=0&&this.documentRules.splice(t,1)}removeRepositoryRule(e){let t=this.repositoryRules.findIndex(o=>o instanceof e);t>=0&&this.repositoryRules.splice(t,1)}addErrorsToResult(e,t){for(let o of t)o.severity==="Error"?e.errors.push(o):o.severity==="Info"?this.includeWarnings&&e.infos.push(o):this.includeWarnings&&e.warnings.push(o)}};export{te as a,g as b,u as c,Xe as d,oe as e,ae as f,ie as g,se as h,ce as i,pe as j,le as k,me as l,ue as m,de as n,fe as o,ye as p,ge as q,ke as r,he as s,Re as t,Ke as u,be as v,Ee as w,ve as x,De as y,Ie as z,Ce as A,Se as B,Pe as C,je as D,Oe as E,$e as F,xe as G,Ne as H,jt as I,Ot as J,_e as K,ot as L};
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export type { IStatement } from './statements/index.js';
|
|
|
15
15
|
export type { MarkdownLink } from './statements/index.js';
|
|
16
16
|
export { Statement, ScalarStatement, StringStatement, NumberStatement, BooleanStatement, ReferenceStatement, EmbeddedStatement, ListStatement, MarkdownStatement } from './statements/index.js';
|
|
17
17
|
export { extractMarkdownLinks, findMalformedReferences, type RawMarkdownLink, type MalformedMarkdownLink, } from './parsing/extractMarkdownLinks.js';
|
|
18
|
-
export { OntologyValidationResult, OntologyValidationError, ValidationSeverity, ValidationContext, ValidationCache, KanonakObjectValidator, NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule, EmbeddedKanonakTypeRule, ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, MarkdownLinkRule } from './validation/index.js';
|
|
18
|
+
export { OntologyValidationResult, OntologyValidationError, ValidationSeverity, ValidationContext, ValidationCache, KanonakObjectValidator, NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule, EmbeddedKanonakTypeRule, ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, MarkdownLinkRule, DisplayLensScopeRule, LookSemanticSvgPathRule, LookBandPathRule, TxExpressionPathRule, ShaclShapeRule, OwlOneOfRule, DiamondNameClashRule } from './validation/index.js';
|
|
19
|
+
export { scopeFromRepositoryAsync, scopeFromCatalog, scopeFromDocumentAsync, buildShapesModel, lowerConstraint, foldFlagsIntoPattern, evaluateConformance, buildReportPackageAsync, } from './shacl/index.js';
|
|
20
|
+
export type { ConformanceScope, ShaclNodeShapeModel, ShaclPropertyConstraint, ShaclNodeKind, ShaclSeverity, LoweredCheck, LoweredExprNode, ShaclConformanceResult, ShaclFinding, } from './shacl/index.js';
|
|
19
21
|
export type { IKanonakObjectValidator, DocumentValidationResult, IDocumentValidationRule, IRepositoryValidationRule } from './validation/index.js';
|
|
20
22
|
export type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
21
23
|
export type { IKanonakParser } from '@kanonak-protocol/types/document/parsing';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as jr,b as Ar,c as Cr,d as Sr,e as L}from"./chunk-V3IPBWWU.js";import{a as te,b as oe,c as ae}from"./chunk-35A2VF5S.js";import{a as xn,c as F,e as ie,h as se,i as ce,j as Kn}from"./chunk-P36E2UV6.js";import{a as Ir,b as vr,c as Vr,d as gn,e as hn,f as Pn,g as bn,h as Rn,i as wn,j as In,k as T,l as vn,m as Vn}from"./chunk-UNSWF3UN.js";import{a as En}from"./chunk-LYSCTQC2.js";import"./chunk-QHABFCRC.js";import{a as Se,b as De,c as Ue,d as Oe,e as _e,f as qe,g as Ge,h as Xe,i as Ye}from"./chunk-RLQFTA5D.js";import{a as Me,b as Ne,c as $e,d as Le,e as Fe,f as Te,h as ze,i as Z,j as Q,k as ee,l as re,m as Be,n as We}from"./chunk-W35FCNM7.js";import{a as Ce}from"./chunk-4NO7MHS7.js";import{a as Ur,b as Or,c as _r,d as Mr}from"./chunk-5NH5XDGO.js";import{a as Nr,b as Lr}from"./chunk-PEUTCG3B.js";import{a as $r}from"./chunk-PEJALHXK.js";import{a as He}from"./chunk-SC5M74NM.js";import{A as yn,B as kn,K as fn,a as Fr,b as Tr,c as zr,d as Br,e as Hr,f as Wr,g as qr,h as Gr,i as Xr,j as Yr,k as Jr,l as Zr,m as Qr,n as en,o as rn,p as nn,q as tn,r as on,s as an,t as sn,u as cn,v as pn,w as un,x as ln,y as dn,z as mn}from"./chunk-3O7CRE6J.js";import"./chunk-M443OYKT.js";import{a as f,b as er,c as pr,i as wr,j as Er,k as xr,l as Kr,m as E}from"./chunk-V6KIDED2.js";import{a as P}from"./chunk-NJ3AZYQD.js";import{a as ur,b as lr,c as M,d as dr,e as R,f as mr,g as yr,i as kr,m as fr,o as gr,p as m,q as hr,v as Pr,w as br,x as Rr}from"./chunk-SVUMCLK5.js";import{a as Je,b as Ze,c as k,d as b,e as rr,f as nr,g as tr,h as or,i as ar,j as ir,k as sr,l as cr,r as j,w,x as N,y as $,z as ne}from"./chunk-YW6P24RF.js";import{a as Qe}from"./chunk-FUUTGGJS.js";import{a as xe,b as _,c as V,d as Ke,e as y,f as Ie,g as ve,h as Ve,i as je,j as Ae}from"./chunk-2ACBWC7K.js";import{a as Dr}from"./chunk-ODIECDN7.js";import{VersionOperator as $t}from"@kanonak-protocol/types/document/models/enums";import*as z from"js-yaml";import{VersionOperator as pe}from"@kanonak-protocol/types/document/models/enums";var jn="0.0.0",g=class{constructor(e,r=new P,n){this.repository=e;this.parser=r;this.objectParser=n??new E(this.parser)}repository;parser;objectParser;imports(){return new x}serializeValue(e,r){return de(e,r)}async buildContentAddressed(e){let r=e.book.toImports(),n=await this.hashBody(e.publisher,r,e.body),t=B(n),a={type:"EphemeralPackage",publisher:e.publisher,imports:r};e.contentHashProperty&&(a[e.contentHashProperty]=n),Object.assign(a,e.header??{}),a.imports=r;let i={[t]:a,...e.body},s=this.dump(i);return{yaml:s,byteCount:le(s),contentHash:n,packageName:t,publisher:e.publisher,resourceCount:Object.keys(e.body).length}}async buildNamed(e){let r=e.book.toImports(),n={type:e.type??"Package",publisher:e.publisher,version:e.version,imports:r},t;e.contentHashProperty&&(t=await this.hashBody(e.publisher,r,e.body),n[e.contentHashProperty]=t),Object.assign(n,e.header??{}),n.imports=r;let a={[e.name]:n,...e.body},i=this.dump(a),s={yaml:i,byteCount:le(i),packageName:e.name,publisher:e.publisher,resourceCount:Object.keys(e.body).length};return t!==void 0&&(s.contentHash=t),s}dump(e){return z.dump(e,{lineWidth:-1})}async hashBody(e,r,n){let t={[ue]:{type:"EphemeralPackage",publisher:e,imports:r},...n},a=this.parser.parse(z.dump(t,{lineWidth:-1})),i=a.metadata.namespace_?.toString(),c=(await this.objectParser.parseKanonaks(new ne(a,this.repository))).filter(u=>u instanceof k&&u.namespace===i&&u.name!==ue);for(let u of c)u.namespace="ephemeral";return T(c)}},ue="__pkgbuilder_probe__";function le(o){return new TextEncoder().encode(o).length}function B(o){let e="sha256:",r=o.startsWith(e)?e.length:0;return`q-${o.slice(r,r+16)}`}var x=class{byKey=new Map;aliases=new Set;ensure(e,r,n,t,a=pe.Major){let i=`${e}/${r}@${n}`,s=this.byKey.get(i);if(s)return s.alias;let c=this.uniqueAlias(t);return this.byKey.set(i,{publisher:e,package_:r,version:n,alias:c,match:a}),c}ref(e){if(!e.version||typeof e.version.major!="number")throw new Error(`Cannot serialize a reference to ${e.publisher}/${e.package_}/${e.name} without a version.`);return`${this.ensure(e.publisher,e.package_,y(e.version),e.package_)}.${e.name}`}refLatest(e,r,n,t){return`${this.ensure(e,r,jn,t??r,pe.Any)}.${n}`}toImports(){let e=new Map;for(let n of this.byKey.values()){let t=e.get(n.publisher)??[];t.push(n),e.set(n.publisher,t)}return[...e.keys()].sort().map(n=>({publisher:n,packages:e.get(n).sort((t,a)=>t.package_<a.package_?-1:1).map(t=>({package:t.package_,match:_(t.match),version:t.version,alias:t.alias}))}))}uniqueAlias(e){let r=K(e)||"pkg",n=r,t=2;for(;this.aliases.has(n);)n=`${r}${t++}`;return this.aliases.add(n),n}};function de(o,e){if(o!=null){if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o;if(o instanceof b)return e.ref(o.subject);if(Array.isArray(o)){let r=o.map(n=>de(n,e)).filter(n=>n!==void 0);return r.length>0?r:void 0}if(o instanceof f)throw new Error("Embedded values are not yet supported by PackageBuilder. Produce a literal or a reference, or compose the embedded shape into the output class.");if(An(o))throw new Error(`Value produced a bare URI without a version (${o.publisher}/${o.package_}/${o.name}); cannot serialize it as a reference.`)}}function K(o){return o.replace(/[^A-Za-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function An(o){return typeof o=="object"&&o!==null&&typeof o.publisher=="string"&&typeof o.package_=="string"&&typeof o.name=="string"}var A=class{constructor(e){this.producers=e}producers;produced=new Map;producerFor(e,r){return this.producers.find(n=>n.canProduce(e,r))}async produceCached(e,r,n,t){let a=`${r}/${n}@${y(t)}`,i=this.produced.get(a);if(i)return i;let{document:s}=await e.produce(r,n,t);return this.produced.set(a,s),s}async getHighestCompatibleVersionAsync(e,r){let n=this.producerFor(e,r.packageName);if(!n)return null;let t={operator:r.versionOperator,version:r.version},a=await n.resolveVersion(e,r.packageName,t);return a?this.produceCached(n,e,r.packageName,a):null}async getDocumentAsync(e){let r;try{r=M(e)}catch{return null}if(r.kind!=="package"||!r.version)return null;let n=this.producerFor(r.publisher,r.package_);return n?this.produceCached(n,r.publisher,r.package_,r.version):null}async getDocumentsByNamespaceAsync(e,r){return Array.from(this.produced.values()).filter(n=>{let t=n.metadata.namespace_;return t!=null&&t.publisher===e&&t.package_===r})}async getAllDocumentsAsync(){return Array.from(this.produced.values())}async saveDocumentAsync(e,r){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async deleteDocumentAsync(e){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async clearNamespaceAsync(e,r){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async getAllDocumentReferencesAsync(){return[]}async getDocumentContentAsync(e){return null}async getDocumentUriAsync(e){return null}};var H={async authorize(){return{allowed:!0}}},W={async record(){}},I=class extends Error{constructor(r,n){let t=`${r.publisher}/${r.package_}${r.version?`@${r.version.major}.${r.version.minor}.${r.version.patch}`:""}`;super(`Not entitled to produce ${t}${n?`: ${n}`:""}`);this.address=r;this.reason=n;this.name="EntitlementDeniedError"}address;reason},C=class{inner;ctx;policy;meter;constructor(e,r,n=H,t=W){this.inner=e,this.ctx=r,this.policy=n,this.meter=t}canProduce(e,r){return this.inner.canProduce(e,r)}async resolveVersion(e,r,n){return await this.assertAllowed({publisher:e,package_:r,version:n.version}),this.inner.resolveVersion(e,r,n)}async produce(e,r,n){let t={publisher:e,package_:r,version:n};await this.assertAllowed(t);let a=await this.inner.produce(e,r,n);return await this.meter.record(this.ctx,t,a),a}async assertAllowed(e){let r=await this.policy.authorize(this.ctx,e);if(!r.allowed)throw new I(e,r.reason)}};var p="kanonak.org",d="view",me="core-kanonak",Cn={publisher:p,package_:d,name:"rootView"},Sn={publisher:p,package_:d,name:"bind"},Dn={publisher:p,package_:d,name:"produces"},Un={publisher:p,package_:d,name:"projections"},On={publisher:p,package_:d,name:"where"},_n={publisher:p,package_:d,name:"value"},Mn={publisher:p,package_:d,name:"as"},S=class{constructor(e,r=new P){this.repository=e;this.parser=r;this.objectParser=new E(this.parser),this.builder=new g(this.repository,this.parser,this.objectParser)}repository;parser;objectParser;builder;async materialize(e,r={}){let n=await this.objectParser.parseKanonaks(this.repository),t=this.resolveView(n,e),a=w(t,Sn);if(!a)throw new Error(`View ${t.namespace}/${t.name} declares no view.bind; cannot materialize.`);let i=w(t,Dn);if(!i)throw new Error(`View ${t.namespace}/${t.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=Nn(t),c=ye(n,p,me),u=ye(n,p,d),l=this.builder.imports(),D=l.ensure(p,me,c,"ck"),fe=l.ensure(p,d,u,"v"),ge=l.ref(i),he=new ce(this.repository,this.parser,this.objectParser),q=new ie(he,n),Pe=this.readProjections(n,t),be=Fn(t,On),Re=this.findInstances(n,a,await this.reason(r)),G={},we=new Set;for(let v of Re){if(!await this.passesWhere(q,n,be,v))continue;let O={type:ge};for(let Y of Pe){let Ee=await this.evaluateValue(q,n,Y.value,v),J=this.builder.serializeValue(ke(Ee),l);J!==void 0&&(O[l.ref(Y.as)]=J)}let X=m(v);X&&(O[`${fe}.derivedFrom`]=l.ref(X)),G[this.rowName(v,we)]=O}let U={};r.resolvedAt&&(U[`${D}.resolvedAt`]=r.resolvedAt),r.invocationId&&(U[`${D}.id`]=r.invocationId);let h=await this.builder.buildContentAddressed({publisher:s,book:l,body:G,contentHashProperty:`${D}.contentHash`,header:U});return{yaml:h.yaml,contentHash:h.contentHash,packageName:h.packageName,publisher:h.publisher,rowCount:h.resourceCount}}resolveView(e,r){let n=j(e,r);if(!n)throw new Error(`View ${r.publisher}/${r.package_}/${r.name} not found in the catalog.`);let t=w(n,Cn);if(t){let a=j(e,t);if(!a)throw new Error(`ViewPackage ${r.name} names rootView ${t.name}, which is not in the catalog.`);return a}return n}readProjections(e,r){let n=[];for(let t of $(r,Un)){let a=t instanceof f?t:t instanceof b?j(e,t.subject):void 0;if(!a)continue;let i=N(a,_n),s=w(a,Mn);i&&s&&n.push({value:i,as:s})}return n}async reason(e){return new L({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,r,n){let t=Ln(e),a=[],i=new Set;for(let s of n.getInstancesOfClass(r)){if(i.has(s))continue;i.add(s);let c=t.get(s);c&&a.push(c)}return a.sort((s,c)=>{let u=R(m(s)),l=R(m(c));return u<l?-1:u>l?1:0}),a}async passesWhere(e,r,n,t){for(let a of n){let i=await this.evaluateValue(e,r,a,t);if(!Tn(i))return!1}return!0}async evaluateValue(e,r,n,t){let a=se(n,"view-projection",{catalog:r,depth:0}),i=new Map([["input",t]]);return e.evaluate(a,i)}rowName(e,r){let n=K(e.name)||"row",t=n,a=2;for(;r.has(t);)t=`${n}-${a++}`;return r.add(t),t}};function ke(o){return F(o)?o.value:Array.isArray(o)?o.map(ke):o}function Nn(o){let e=m(o);if(!e)throw new Error(`Could not derive a publisher from view ${o.namespace}/${o.name}.`);return e.publisher}function ye(o,e,r){let n=$n(o,e,r);if(!n)throw new Error(`Package ${e}/${r} is not in the catalog; it must be importable to materialize a view.`);return n}function $n(o,e,r){let n;for(let t of o){if(!(t instanceof k))continue;let a=m(t);!a||a.publisher!==e||a.package_!==r||!a.version||(!n||V(a.version,n)>0)&&(n=a.version)}return n?y(n):void 0}function Ln(o){let e=new Map,r=new Map;for(let n of o){if(!(n instanceof k))continue;let t=m(n);if(!t||!t.version)continue;let a=R(t),i=r.get(a);(!i||V(t.version,i)>0)&&(r.set(a,t.version),e.set(a,n))}return e}function Fn(o,e){let r=N(o,e);return r?[r]:$(o,e).filter(n=>n instanceof f)}function Tn(o){return o===!0?!0:o===!1||o===void 0||o===null?!1:typeof o=="string"?o.length>0:typeof o=="number"?o!==0:F(o)?o.value.length>0:Array.isArray(o)?o.length>0:!!o}export{cn as AmbiguousReferenceRule,ar as BooleanStatement,vn as CANONICAL_FORM_VERSION,wr as Carrier,yn as ClassDefinitionRule,en as ClassHierarchyCycleRule,Ue as CompositeKanonakDocumentRepository,hn as DEFAULT_CONSENT_BINDING_PARAM,Ze as DefinedKanonak,De as DocumentLocation,vr as EdgeType,f as EmbeddedKanonak,Jr as EmbeddedKanonakTypeRule,sr as EmbeddedStatement,I as EntitlementDeniedError,C as EntitlementProducer,Se as FileSystemKanonakDocumentRepository,Dr as GitIgnoreFilter,Vr as GraphBuilder,We as HttpKanonakDocumentRepository,Z as INTEGRITY_PREFIX,x as ImportBook,Zr as ImportExistenceRule,Ce as InMemoryKanonakDocumentRepository,Me as KANONAK_USER_AGENT,Je as Kanonak,Or as KanonakDocumentPositions,E as KanonakObjectParser,fn as KanonakObjectValidator,P as KanonakParser,Qe as KanonakUri,Nr as KanonakUriBuilder,$r as KanonakUrlResolver,fr as KanonakVocabulary,cr as ListStatement,er as LiteralKanonak,qe as LocalFirstRepository,Ge as LockAwareRepository,Kn as LookRenderer,kn as MarkdownLinkRule,pr as MarkdownStatement,an as NamespaceImportCycleRule,Wr as NamespacePrefixRule,Ir as NodeType,or as NumberStatement,Pn as OAuthDiscovery,Cr as OWL_RL_CLASSIFICATION_RULES,un as ObjectPropertyValueValidationRule,zr as OntologyValidationError,Fr as OntologyValidationResult,g as PackageBuilder,Yr as PackageHeaderRule,A as ProducerRepository,ln as PropertyDomainRule,rn as PropertyHierarchyCycleRule,dn as PropertyKindRangeConsistencyRule,Ur as PropertyMetadata,pn as PropertyRangeReferenceRule,nn as PropertyRangeRequiredRule,Gr as PropertyTypeSpecificityRule,ze as PublisherConfigResolver,Be as PublisherIndex,Ar as RDFS_RULES,L as Reasoner,Sr as ReasoningResult,b as ReferenceKanonak,ir as ReferenceStatement,_e as RepositoryFactory,mn as ReservedNameShadowRule,qr as ResourceNamingRule,ur as ResourceResolver,gr as ResourceTypeClassifier,nr as ScalarStatement,rr as Statement,tr as StringStatement,tn as SubClassOfReferenceRule,on as SubPropertyOfReferenceRule,k as SubjectKanonak,Xr as SubjectKanonakTypeRequiredRule,wn as TokenCredentialProvider,jr as TripleStore,lr as TypeResolver,sn as UnresolvedPredicateRule,Qr as UnresolvedReferenceRule,Hr as ValidationCache,Br as ValidationContext,Tr as ValidationSeverity,$t as VersionOperator,S as ViewMaterializer,H as allowAllPolicy,Le as assertHttpsUrl,He as assertPackageIdentity,Ye as buildLocalFirstRepository,Vn as buildOntologyModel,In as canonicalForm,T as canonicalHash,Er as carrierOf,Xe as collectKanonakFiles,V as compareVersions,ae as computeIntegrity,re as computeIntegrityAsync,B as contentAddressedName,Rr as contextTypesOf,Rn as createCredentialedFetch,Ie as createVersion,Kr as extractMarkdownLinks,En as findDerivation,Lr as findInstancesByType,xr as findMalformedReferences,Mr as findMarkdownLinkAt,dr as formatKanonakAddress,y as formatVersion,Oe as getGlobalCachePath,$e as getKanonakUserAgent,Ve as isCompatibleVersion,je as isMajorCompatible,Fe as kanonakFetch,te as loadLockFile,mr as makeUriKey,W as noopMeter,gn as normalizeHost,bn as parseAuthChallenge,M as parseKanonakAddress,Q as parseLockFile,ve as parseVersionString,_r as parseWithPositions,Ae as pickHighestDocument,Pr as propertiesInScope,xn as resolveDisplayValue,br as resolvePropertyStep,K as sanitizeName,oe as saveLockFile,ee as serializeLockFile,Te as setKanonakFetchRetries,Ne as setKanonakUserAgent,m as subjectUri,hr as superClassChain,yr as tripleKey,R as uriKey,kr as uriTriple,xe as versionOperatorFromChar,_ as versionOperatorToChar,Ke as versionsEqual};
|
|
1
|
+
import{a as Yt,b as Jt,c as Zt,d as Qt,e as T}from"./chunk-V3IPBWWU.js";import{a as Ge,b as We,c as ze}from"./chunk-35A2VF5S.js";import{a as er,c as Ee,e as qe,h as Xe,i as Ye,j as nr}from"./chunk-P36E2UV6.js";import{a as zt,b as qt,c as Xt,d as Go,e as be,f as Wo,g as zo,h as qo,i as Xo,j as Yo,k as Jo,l as Zo,m as tr}from"./chunk-5TI4E6M7.js";import{a as Qo}from"./chunk-LYSCTQC2.js";import"./chunk-QHABFCRC.js";import{a as lt,b as dt,c as mt,d as ft,e as yt,f as Ct,g as It,h as Kt,i as vt}from"./chunk-RLQFTA5D.js";import{a as kt,b as ht,c as gt,d as St,e as bt,f as Et,h as Pt,i as Me,j as De,k as $e,l as Te,m as Rt,n as _t}from"./chunk-W35FCNM7.js";import{a as le}from"./chunk-4NO7MHS7.js";import{a as no,b as to,c as oo,d as ro}from"./chunk-5NH5XDGO.js";import{a as ao,b as so}from"./chunk-PEUTCG3B.js";import{a as io}from"./chunk-PEJALHXK.js";import{a as xt}from"./chunk-SC5M74NM.js";import{A as Vo,B as jo,C as Uo,D as Ho,E as Mo,F as Do,G as $o,H as To,K as Fo,L as Bo,a as co,b as uo,c as po,d as lo,e as mo,f as fo,g as yo,h as ko,i as ho,j as go,k as So,l as bo,m as Eo,n as Po,o as Ro,p as xo,q as _o,r as Co,s as Io,t as Ko,u as vo,v as wo,w as No,x as Oo,y as Ao,z as Lo}from"./chunk-UYSEO3OT.js";import"./chunk-M443OYKT.js";import{a as x,b as D,c as ke,i as V,j as Se,k as Gt,l as Wt,m as O}from"./chunk-V6KIDED2.js";import{a as L}from"./chunk-NJ3AZYQD.js";import{a as Vt,b as jt,c as he,d as Ut,e as $,f as Ht,g as Mt,i as Dt,m as $t,o as Tt,p as g,q as Z,v as Ft,w as Bt,x as Q}from"./chunk-SVUMCLK5.js";import{a as wt,b as Nt,c as S,d as k,e as At,f as Lt,g as de,h as me,i as fe,j as q,k as ye,l as X,m as p,p as Fe,r as _,t as Be,u as w,v as Y,w as h,x as ge,y as N,z as J}from"./chunk-YW6P24RF.js";import{a as Ot}from"./chunk-FUUTGGJS.js";import{a as rt,b as pe,c as z,d as at,e as I,f as it,g as st,h as ct,i as ut,j as pt}from"./chunk-2ACBWC7K.js";import{a as eo}from"./chunk-ODIECDN7.js";async function Je(n){let e=await new O().parseKanonaks(n),o=await new T().reason(n);return{kind:"merged",catalog:e,reasoning:o}}function Ze(n,e){return{kind:"merged",catalog:n,reasoning:e}}async function Qe(n,e){let o=e??new le(new L);return{kind:"standalone",catalog:await new O().parseKanonaks(new J(n,o))}}var Pe="kanonak.org",Re="core-shacl",c=n=>({publisher:Pe,package_:Re,name:n}),en=c("NodeShape"),Tr=c("PropertyShape"),nn=c("targetClass"),tn=c("property"),on=c("path"),rn=c("minCount"),an=c("maxCount"),sn=c("datatype"),cn=c("class"),xe=c("in"),un=c("pattern"),pn=c("flags"),ln=c("minLength"),dn=c("maxLength"),mn=c("minInclusive"),fn=c("maxInclusive"),yn=c("message"),kn=c("targetNode"),hn=c("targetSubjectsOf"),gn=c("targetObjectsOf"),Sn=c("closed"),bn=c("ignoredProperties"),En=c("nodeKind"),Pn=c("IRI"),Rn=c("BlankNode"),xn=c("Literal"),_e=c("severity"),_n=c("Violation"),Cn=c("Warning"),In=c("Info"),Fr=c("ValidationReport"),Br=c("conforms"),Gr=c("result"),Wr=c("ValidationResult"),zr=c("focusNode"),qr=c("resultPath"),Xr=c("resultMessage"),Yr=c("resultSeverity"),Jr=c("sourceShape"),Zr=c("value"),Qr=c("sourceConstraintComponent"),Kn=c("MinCountConstraintComponent"),vn=c("MaxCountConstraintComponent"),wn=c("DatatypeConstraintComponent"),Nn=c("ClassConstraintComponent"),On=c("InConstraintComponent"),An=c("PatternConstraintComponent"),Ln=c("MinLengthConstraintComponent"),Vn=c("MaxLengthConstraintComponent"),jn=c("MinInclusiveConstraintComponent"),Un=c("MaxInclusiveConstraintComponent"),Hn=c("NodeKindConstraintComponent"),Ce=c("ClosedConstraintComponent");function H(n){return typeof n=="number"?n:void 0}function or(n){if(!n)return;let e=p(n);if(e===p(Pn))return"IRI";if(e===p(Rn))return"BlankNode";if(e===p(xn))return"Literal"}function Mn(n){if(!n)return;let e=p(n);if(e===p(_n))return"Violation";if(e===p(Cn))return"Warning";if(e===p(In))return"Info"}function Ie(n,e){let o=h(n,e);if(o)return[o];let t=[];for(let r of N(n,e))r instanceof k&&t.push(r.subject);return t}function rr(n,e){let o=h(n,on);if(!o)return;let t={path:o},r=H(w(n,rn)),a=H(w(n,an));r!==void 0&&(t.minCount=r),a!==void 0&&(t.maxCount=a);let s=H(w(n,ln)),i=H(w(n,dn));s!==void 0&&(t.minLength=s),i!==void 0&&(t.maxLength=i);let u=H(w(n,mn)),d=H(w(n,fn));u!==void 0&&(t.minInclusive=u),d!==void 0&&(t.maxInclusive=d);let m=Y(n,un);if(m!==void 0){let P=Y(n,pn);t.pattern=P!==void 0?{regex:m,flags:P}:{regex:m}}if(Be(n,xe)){let P=[],j=[];for(let U of N(n,xe))U instanceof D?P.push(U.value):U instanceof k&&j.push(U.subject);P.length>0&&(t.inValues=P),j.length>0&&(t.inRefs=j)}let b=h(n,sn);b&&(t.datatype=b);let E=h(n,cn);E&&(t.classRef=E);let l=or(h(n,En));l&&(t.nodeKind=l);let f=Y(n,yn);f!==void 0&&(t.message=f);let y=Mn(h(n,_e))??e;return y&&(t.severity=y),t}function ee(n){let e=[];for(let o of n){if(!(o instanceof S)||!Fe(o,en))continue;let t=Mn(h(o,_e)),r={name:o.name,uri:g(o),targetClass:h(o,nn),targetNodes:Ie(o,kn),targetSubjectsOf:Ie(o,hn),targetObjectsOf:Ie(o,gn),closed:w(o,Sn)===!0,ignoredProperties:[],severity:t,properties:[]};for(let a of N(o,bn))a instanceof k&&r.ignoredProperties.push(a.subject);for(let a of N(o,tn)){let s;if(a instanceof x?s=a:a instanceof k&&(s=_(n,a.subject)),!s)continue;let i=rr(s,t);i&&r.properties.push(i)}e.push(r)}return e}var C="kanonak.org/transformations",ne="values";var te="allowed",K=n=>({type:`${C}/VarRef`,varName:n}),Ke=n=>({type:`${C}/IntegerLiteral`,integerLiteral:n}),ar=n=>({type:`${C}/DecimalLiteral`,decimalLiteral:n}),Dn=n=>Number.isInteger(n)?Ke(n):ar(n),$n=n=>({type:`${C}/Count`,source:n}),Tn=(n,e)=>({type:`${C}/GreaterThanOrEqual`,compareLeft:n,compareRight:e}),Fn=(n,e)=>({type:`${C}/LessThanOrEqual`,compareLeft:n,compareRight:e});function ve(n,e){if(!e||e.length===0)return n;let o=new Set(["i","m","s"]),t=[...new Set(e.split(""))];if(t.filter(a=>!o.has(a)).length>0)throw new Error(`sh:flags '${e}' is outside the pinned regex subset (supported: i, m, s)`);return`(?${t.sort().join("")})${n}`}function oe(n){let e=[];return n.minCount!==void 0&&e.push({component:"minCount",per:"node",expr:Tn($n(K(ne)),Ke(n.minCount))}),n.maxCount!==void 0&&e.push({component:"maxCount",per:"node",expr:Fn($n(K(ne)),Ke(n.maxCount))}),(n.inValues!==void 0||n.inRefs!==void 0)&&e.push({component:"in",per:"value",expr:{type:`${C}/Contains`,haystack:K(te),needle:K("v")}}),n.pattern!==void 0&&e.push({component:"pattern",per:"value",expr:{type:`${C}/Matches`,matchSource:K("v"),pattern:ve(n.pattern.regex,n.pattern.flags)}}),n.minLength!==void 0&&e.push({component:"minLength",per:"value",expr:{type:`${C}/Matches`,matchSource:K("v"),pattern:`(?s)^.{${n.minLength},}$`}}),n.maxLength!==void 0&&e.push({component:"maxLength",per:"value",expr:{type:`${C}/Matches`,matchSource:K("v"),pattern:`(?s)^.{0,${n.maxLength}}$`}}),n.minInclusive!==void 0&&e.push({component:"minInclusive",per:"value",expr:Tn(K("v"),Dn(n.minInclusive))}),n.maxInclusive!==void 0&&e.push({component:"maxInclusive",per:"value",expr:Fn(K("v"),Dn(n.maxInclusive))}),e}import{evaluate as sr,ExpressionError as cr}from"@kanonak-protocol/expression";function Wn(n,e){let o=ur(e)?e:ee(e),t=[];for(let r of o)for(let a of pr(n,r))mr(n,r,a,t);return{conforms:!t.some(r=>r.severity==="Violation"),results:t}}function ur(n){return n.length>0&&!(n[0]instanceof Object&&"statement"in n[0])&&typeof n[0].name=="string"&&"properties"in n[0]}function re(n){let e=n.predicate;return e instanceof k?e:void 0}function pr(n,e){let o=new Map,t=n.catalog.filter(a=>a instanceof S),r=a=>{let s=g(a);o.set(s?p(s):`${a.namespace}/${a.name}`,a)};if(e.targetClass){let a=p(e.targetClass);if(n.reasoning){let s=new Set(n.reasoning.getInstancesOfClass(e.targetClass));for(let i of t){let u=g(i);u&&s.has(p(u))&&r(i)}}else for(let s of t)Q(s).some(u=>p(u)===a||Z(n.catalog,u).some(d=>p(d)===a))&&r(s)}for(let a of e.targetNodes){let s=_(n.catalog,a);s instanceof S&&r(s)}for(let a of e.targetSubjectsOf){let s=p(a);for(let i of t)i.statement.some(u=>{let d=re(u);return d&&p(d.subject)===s})&&r(i)}for(let a of e.targetObjectsOf){let s=p(a);for(let i of t)for(let u of i.statement){let d=re(u);if(!(!d||p(d.subject)!==s))for(let m of lr(u)){let b=_(n.catalog,m);b instanceof S&&r(b)}}}return[...o.values()]}function lr(n){return n instanceof q?[n.object.subject]:n instanceof X?(n.object??[]).filter(e=>e instanceof k).map(e=>e.subject):[]}function dr(n,e,o){let t=[];for(let r of n.statement){let a=re(r);if(!(!a||p(a.subject)!==e)){if(r instanceof de||r instanceof ke)t.push({kernel:r.object,kind:"string",literal:r.object});else if(r instanceof me)t.push({kernel:r.object,kind:"number",literal:r.object});else if(r instanceof fe)t.push({kernel:r.object?1:0,kind:"boolean",literal:r.object});else if(r instanceof q)t.push({kernel:{ref:p(r.object.subject)},kind:"reference",ref:r.object.subject});else if(r instanceof ye)t.push(Bn(r.object,o,t.length));else if(r instanceof X){for(let s of r.object??[])if(s instanceof k)t.push({kernel:{ref:p(s.subject)},kind:"reference",ref:s.subject});else if(s instanceof x)t.push(Bn(s,o,t.length));else if(s instanceof D){let i=s.value;typeof i=="boolean"?t.push({kernel:i?1:0,kind:"boolean",literal:i}):t.push({kernel:i,kind:typeof i=="number"?"number":"string",literal:i})}}}}return t}function Bn(n,e,o){let t=n.name&&n.name.length>0?n.name:String(o);return{kernel:{ref:`${e}#${t}`},kind:"embedded"}}function mr(n,e,o,t){let r=g(o),a=r?p(r):`${o.namespace}/${o.name}`;for(let s of e.properties)yr(n,e,o,a,r,s,t);e.closed&&br(e,o,a,r,t)}function we(n,e,o,t,r,a={},s){return{focusNode:e,focusUri:o,constraintComponent:t,severity:s??zn(n),message:r,sourceShape:n.name,sourceShapeUri:n.uri,...a}}function zn(n){return n.severity??"Violation"}var fr={minCount:Kn,maxCount:vn,in:On,pattern:An,minLength:Ln,maxLength:Vn,minInclusive:jn,maxInclusive:Un};function yr(n,e,o,t,r,a,s){let i=p(a.path),u=dr(o,i,t),d=a.severity??zn(e),m=a.path.name,b=[...(a.inValues??[]).map(l=>typeof l=="boolean"?l?1:0:l),...(a.inRefs??[]).map(l=>({ref:p(l)}))],E=(l,f,y)=>{s.push(we(e,t,r,l,a.message??f,{resultPath:a.path,value:y?.literal,valueRef:y?.ref},d))};for(let l of oe(a)){let f=fr[l.component];if(l.per==="node"){Gn(l,{[ne]:u.map(P=>P.kernel),[te]:b})||E(f,l.component==="minCount"?`'${m}' has ${u.length} value(s); minCount is ${a.minCount}.`:`'${m}' has ${u.length} value(s); maxCount is ${a.maxCount}.`);continue}for(let y of u){if((l.component==="pattern"||l.component==="minLength"||l.component==="maxLength")&&y.kind!=="string"){E(f,`'${m}' value is not a string; ${l.component} applies to string values.`,y);continue}Gn(l,{v:y.kernel,[te]:b})||E(f,kr(l,m,a,y),y)}}if(a.nodeKind)for(let l of u)hr(a.nodeKind,l)||E(Hn,`'${m}' value is ${l.kind}; nodeKind requires ${a.nodeKind}.`,l);if(a.datatype)for(let l of u){let f=gr(a.datatype,l);f&&E(wn,`'${m}' ${f}`,l)}if(a.classRef)for(let l of u){let f=Sr(n,a.classRef,l);f&&E(Nn,`'${m}' ${f}`,l)}}function kr(n,e,o,t){let r=t.ref?p(t.ref):JSON.stringify(t.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 ${o.pattern?.regex}.`;case"minLength":return`'${e}' value ${r} is shorter than minLength ${o.minLength}.`;case"maxLength":return`'${e}' value ${r} is longer than maxLength ${o.maxLength}.`;case"minInclusive":return`'${e}' value ${r} is below minInclusive ${o.minInclusive} (or not numeric).`;case"maxInclusive":return`'${e}' value ${r} is above maxInclusive ${o.maxInclusive} (or not numeric).`;default:return`'${e}' value ${r} violates ${n.component}.`}}function Gn(n,e){let o=t=>{let r=t.varName;if(t.type==="kanonak.org/transformations/VarRef"&&typeof r=="string"&&r in e)return e[r];throw new cr(`Conformance lowering produced an unexpected leaf '${t.type}'`)};return sr(n.expr,void 0,o)===1}function hr(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 gr(n,e){if(e.kind==="reference"||e.kind==="embedded")return`value is a ${e.kind}; sh:datatype requires a literal of ${n.name}.`;let o=Se(n);if(o!==void 0)switch(o){case V.Boolean:return e.kind==="boolean"?void 0:`value is not a boolean (${n.name}).`;case V.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 V.Decimal:case V.Double:case V.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 Sr(n,e,o){if(o.kind!=="reference"||!o.ref)return`value is not a reference; sh:class requires an instance of ${e.name}.`;let t=p(e);if(n.reasoning)return n.reasoning.isInstanceOf(o.ref,e)?void 0:`value ${p(o.ref)} is not an instance of ${e.name}.`;let r=_(n.catalog,o.ref);return r instanceof S?Q(r).some(s=>p(s)===t||Z(n.catalog,s).some(i=>p(i)===t))?void 0:`value ${p(o.ref)} is not an instance of ${e.name}.`:`value ${p(o.ref)} does not resolve in this scope (sh:class ${e.name}).`}function br(n,e,o,t,r){let a=new Set([...n.properties.map(i=>p(i.path)),...n.ignoredProperties.map(i=>p(i))]),s=new Set;for(let i of e.statement){let u=re(i);if(!u)continue;let d=p(u.subject);a.has(d)||s.has(d)||(s.add(d),r.push(we(n,o,t,Ce,`'${e.name}' carries undeclared property '${u.subject.name}' (closed shape).`,{resultPath:u.subject})))}for(let i of e.unresolvedPredicates)s.has(i.key)||(s.add(i.key),r.push(we(n,o,t,Ce,`'${e.name}' carries unresolvable property '${i.key}' (closed shape).`,{value:i.key})))}import*as Ne from"js-yaml";import{VersionOperator as qn}from"@kanonak-protocol/types/document/models/enums";var Er="0.0.0",A=class{constructor(e,o=new L,t){this.repository=e;this.parser=o;this.objectParser=t??new O(this.parser)}repository;parser;objectParser;imports(){return new F}serializeValue(e,o){return Jn(e,o)}async buildContentAddressed(e){let o=e.book.toImports(),t=await this.hashBody(e.publisher,o,e.body),r=Oe(t),a={type:"EphemeralPackage",publisher:e.publisher,imports:o};e.contentHashProperty&&(a[e.contentHashProperty]=t),Object.assign(a,e.header??{}),a.imports=o;let s={[r]:a,...e.body},i=this.dump(s);return{yaml:i,byteCount:Yn(i),contentHash:t,packageName:r,publisher:e.publisher,resourceCount:Object.keys(e.body).length}}async buildNamed(e){let o=e.book.toImports(),t={type:e.type??"Package",publisher:e.publisher,version:e.version,imports:o},r;e.contentHashProperty&&(r=await this.hashBody(e.publisher,o,e.body),t[e.contentHashProperty]=r),Object.assign(t,e.header??{}),t.imports=o;let a={[e.name]:t,...e.body},s=this.dump(a),i={yaml:s,byteCount:Yn(s),packageName:e.name,publisher:e.publisher,resourceCount:Object.keys(e.body).length};return r!==void 0&&(i.contentHash=r),i}dump(e){return Ne.dump(e,{lineWidth:-1})}async hashBody(e,o,t){let r={[Xn]:{type:"EphemeralPackage",publisher:e,imports:o},...t},a=this.parser.parse(Ne.dump(r,{lineWidth:-1})),s=a.metadata.namespace_?.toString(),u=(await this.objectParser.parseKanonaks(new J(a,this.repository))).filter(d=>d instanceof S&&d.namespace===s&&d.name!==Xn);for(let d of u)d.namespace="ephemeral";return be(u)}},Xn="__pkgbuilder_probe__";function Yn(n){return new TextEncoder().encode(n).length}function Oe(n){let e="sha256:",o=n.startsWith(e)?e.length:0;return`q-${n.slice(o,o+16)}`}var F=class{byKey=new Map;aliases=new Set;ensure(e,o,t,r,a=qn.Major){let s=`${e}/${o}@${t}`,i=this.byKey.get(s);if(i)return i.alias;let u=this.uniqueAlias(r);return this.byKey.set(s,{publisher:e,package_:o,version:t,alias:u,match:a}),u}ref(e){if(!e.version||typeof e.version.major!="number")throw new Error(`Cannot serialize a reference to ${e.publisher}/${e.package_}/${e.name} without a version.`);return`${this.ensure(e.publisher,e.package_,I(e.version),e.package_)}.${e.name}`}refLatest(e,o,t,r){return`${this.ensure(e,o,Er,r??o,qn.Any)}.${t}`}toImports(){let e=new Map;for(let t of this.byKey.values()){let r=e.get(t.publisher)??[];r.push(t),e.set(t.publisher,r)}return[...e.keys()].sort().map(t=>({publisher:t,packages:e.get(t).sort((r,a)=>r.package_<a.package_?-1:1).map(r=>({package:r.package_,match:pe(r.match),version:r.version,alias:r.alias}))}))}uniqueAlias(e){let o=B(e)||"pkg",t=o,r=2;for(;this.aliases.has(t);)t=`${o}${r++}`;return this.aliases.add(t),t}};function Jn(n,e){if(n!=null){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(n instanceof k)return e.ref(n.subject);if(Array.isArray(n)){let o=n.map(t=>Jn(t,e)).filter(t=>t!==void 0);return o.length>0?o:void 0}if(n instanceof x)throw new Error("Embedded values are not yet supported by PackageBuilder. Produce a literal or a reference, or compose the embedded shape into the output class.");if(Pr(n))throw new Error(`Value produced a bare URI without a version (${n.publisher}/${n.package_}/${n.name}); cannot serialize it as a reference.`)}}function B(n){return n.replace(/[^A-Za-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Pr(n){return typeof n=="object"&&n!==null&&typeof n.publisher=="string"&&typeof n.package_=="string"&&typeof n.name=="string"}var Rr="1.1.0";async function Zn(n){let e=new A(n.repository),o=e.imports(),t=o.ensure(Pe,Re,Rr,"sh"),r=(i,u)=>i&&i.version&&typeof i.version.major=="number"?`${o.ensure(i.publisher,i.package_,I(i.version),i.package_)}.${i.name}`:u,a={},s=[];return n.result.results.forEach((i,u)=>{let d=`result-${u+1}`;s.push(d);let m={type:`${t}.ValidationResult`,[`${t}.focusNode`]:r(i.focusUri,i.focusNode),[`${t}.resultMessage`]:i.message,[`${t}.resultSeverity`]:`${t}.${i.severity}`,[`${t}.sourceConstraintComponent`]:`${t}.${i.constraintComponent.name}`};i.resultPath&&(m[`${t}.resultPath`]=r(i.resultPath,p(i.resultPath))),i.sourceShapeUri&&(m[`${t}.sourceShape`]=r(i.sourceShapeUri,i.sourceShape)),i.valueRef?m[`${t}.value`]=r(i.valueRef,p(i.valueRef)):i.value!==void 0&&(m[`${t}.value`]=i.value),a[d]=m}),a.report={type:`${t}.ValidationReport`,[`${t}.conforms`]:n.result.conforms,...s.length>0?{[`${t}.result`]:s}:{}},e.buildContentAddressed({publisher:n.publisher,book:o,body:a,...n.header!==void 0?{header:n.header}:{},contentHashProperty:"contentHash"})}import{VersionOperator as Ui}from"@kanonak-protocol/types/document/models/enums";var ae=class{constructor(e){this.producers=e}producers;produced=new Map;producerFor(e,o){return this.producers.find(t=>t.canProduce(e,o))}async produceCached(e,o,t,r){let a=`${o}/${t}@${I(r)}`,s=this.produced.get(a);if(s)return s;let{document:i}=await e.produce(o,t,r);return this.produced.set(a,i),i}async getHighestCompatibleVersionAsync(e,o){let t=this.producerFor(e,o.packageName);if(!t)return null;let r={operator:o.versionOperator,version:o.version},a=await t.resolveVersion(e,o.packageName,r);return a?this.produceCached(t,e,o.packageName,a):null}async getDocumentAsync(e){let o;try{o=he(e)}catch{return null}if(o.kind!=="package"||!o.version)return null;let t=this.producerFor(o.publisher,o.package_);return t?this.produceCached(t,o.publisher,o.package_,o.version):null}async getDocumentsByNamespaceAsync(e,o){return Array.from(this.produced.values()).filter(t=>{let r=t.metadata.namespace_;return r!=null&&r.publisher===e&&r.package_===o})}async getAllDocumentsAsync(){return Array.from(this.produced.values())}async saveDocumentAsync(e,o){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async deleteDocumentAsync(e){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async clearNamespaceAsync(e,o){throw new Error("ProducerRepository is read-only: a producer is a source, not a store.")}async getAllDocumentReferencesAsync(){return[]}async getDocumentContentAsync(e){return null}async getDocumentUriAsync(e){return null}};var Ae={async authorize(){return{allowed:!0}}},Le={async record(){}},G=class extends Error{constructor(o,t){let r=`${o.publisher}/${o.package_}${o.version?`@${o.version.major}.${o.version.minor}.${o.version.patch}`:""}`;super(`Not entitled to produce ${r}${t?`: ${t}`:""}`);this.address=o;this.reason=t;this.name="EntitlementDeniedError"}address;reason},ie=class{inner;ctx;policy;meter;constructor(e,o,t=Ae,r=Le){this.inner=e,this.ctx=o,this.policy=t,this.meter=r}canProduce(e,o){return this.inner.canProduce(e,o)}async resolveVersion(e,o,t){return await this.assertAllowed({publisher:e,package_:o,version:t.version}),this.inner.resolveVersion(e,o,t)}async produce(e,o,t){let r={publisher:e,package_:o,version:t};await this.assertAllowed(r);let a=await this.inner.produce(e,o,t);return await this.meter.record(this.ctx,r,a),a}async assertAllowed(e){let o=await this.policy.authorize(this.ctx,e);if(!o.allowed)throw new G(e,o.reason)}};var R="kanonak.org",v="view",Qn="core-kanonak",xr={publisher:R,package_:v,name:"rootView"},_r={publisher:R,package_:v,name:"bind"},Cr={publisher:R,package_:v,name:"produces"},Ir={publisher:R,package_:v,name:"projections"},Kr={publisher:R,package_:v,name:"where"},vr={publisher:R,package_:v,name:"value"},wr={publisher:R,package_:v,name:"as"},se=class{constructor(e,o=new L){this.repository=e;this.parser=o;this.objectParser=new O(this.parser),this.builder=new A(this.repository,this.parser,this.objectParser)}repository;parser;objectParser;builder;async materialize(e,o={}){let t=await this.objectParser.parseKanonaks(this.repository),r=this.resolveView(t,e),a=h(r,_r);if(!a)throw new Error(`View ${r.namespace}/${r.name} declares no view.bind; cannot materialize.`);let s=h(r,Cr);if(!s)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=Nr(r),u=et(t,R,Qn),d=et(t,R,v),m=this.builder.imports(),b=m.ensure(R,Qn,u,"ck"),E=m.ensure(R,v,d,"v"),l=m.ref(s),f=new Ye(this.repository,this.parser,this.objectParser),y=new qe(f,t),P=this.readProjections(t,r),j=Lr(r,Kr),U=this.findInstances(t,a,await this.reason(o)),Ve={},tt=new Set;for(let W of U){if(!await this.passesWhere(y,t,j,W))continue;let ue={type:l};for(let Ue of P){let ot=await this.evaluateValue(y,t,Ue.value,W),He=this.builder.serializeValue(nt(ot),m);He!==void 0&&(ue[m.ref(Ue.as)]=He)}let je=g(W);je&&(ue[`${E}.derivedFrom`]=m.ref(je)),Ve[this.rowName(W,tt)]=ue}let ce={};o.resolvedAt&&(ce[`${b}.resolvedAt`]=o.resolvedAt),o.invocationId&&(ce[`${b}.id`]=o.invocationId);let M=await this.builder.buildContentAddressed({publisher:i,book:m,body:Ve,contentHashProperty:`${b}.contentHash`,header:ce});return{yaml:M.yaml,contentHash:M.contentHash,packageName:M.packageName,publisher:M.publisher,rowCount:M.resourceCount}}resolveView(e,o){let t=_(e,o);if(!t)throw new Error(`View ${o.publisher}/${o.package_}/${o.name} not found in the catalog.`);let r=h(t,xr);if(r){let a=_(e,r);if(!a)throw new Error(`ViewPackage ${o.name} names rootView ${r.name}, which is not in the catalog.`);return a}return t}readProjections(e,o){let t=[];for(let r of N(o,Ir)){let a=r instanceof x?r:r instanceof k?_(e,r.subject):void 0;if(!a)continue;let s=ge(a,vr),i=h(a,wr);s&&i&&t.push({value:s,as:i})}return t}async reason(e){return new T({profile:e.reasoningProfile??"owl-rl-classification"}).reason(this.repository)}findInstances(e,o,t){let r=Ar(e),a=[],s=new Set;for(let i of t.getInstancesOfClass(o)){if(s.has(i))continue;s.add(i);let u=r.get(i);u&&a.push(u)}return a.sort((i,u)=>{let d=$(g(i)),m=$(g(u));return d<m?-1:d>m?1:0}),a}async passesWhere(e,o,t,r){for(let a of t){let s=await this.evaluateValue(e,o,a,r);if(!Vr(s))return!1}return!0}async evaluateValue(e,o,t,r){let a=Xe(t,"view-projection",{catalog:o,depth:0}),s=new Map([["input",r]]);return e.evaluate(a,s)}rowName(e,o){let t=B(e.name)||"row",r=t,a=2;for(;o.has(r);)r=`${t}-${a++}`;return o.add(r),r}};function nt(n){return Ee(n)?n.value:Array.isArray(n)?n.map(nt):n}function Nr(n){let e=g(n);if(!e)throw new Error(`Could not derive a publisher from view ${n.namespace}/${n.name}.`);return e.publisher}function et(n,e,o){let t=Or(n,e,o);if(!t)throw new Error(`Package ${e}/${o} is not in the catalog; it must be importable to materialize a view.`);return t}function Or(n,e,o){let t;for(let r of n){if(!(r instanceof S))continue;let a=g(r);!a||a.publisher!==e||a.package_!==o||!a.version||(!t||z(a.version,t)>0)&&(t=a.version)}return t?I(t):void 0}function Ar(n){let e=new Map,o=new Map;for(let t of n){if(!(t instanceof S))continue;let r=g(t);if(!r||!r.version)continue;let a=$(r),s=o.get(a);(!s||z(r.version,s)>0)&&(o.set(a,r.version),e.set(a,t))}return e}function Lr(n,e){let o=ge(n,e);return o?[o]:N(n,e).filter(t=>t instanceof x)}function Vr(n){return n===!0?!0:n===!1||n===void 0||n===null?!1:typeof n=="string"?n.length>0:typeof n=="number"?n!==0:Ee(n)?n.value.length>0:Array.isArray(n)?n.length>0:!!n}export{vo as AmbiguousReferenceRule,fe as BooleanStatement,Wo as CANONICAL_FORM_VERSION,V as Carrier,Vo as ClassDefinitionRule,Po as ClassHierarchyCycleRule,mt as CompositeKanonakDocumentRepository,qo as DEFAULT_CONSENT_BINDING_PARAM,Nt as DefinedKanonak,Fo as DiamondNameClashRule,Uo as DisplayLensScopeRule,dt as DocumentLocation,qt as EdgeType,x as EmbeddedKanonak,So as EmbeddedKanonakTypeRule,ye as EmbeddedStatement,G as EntitlementDeniedError,ie as EntitlementProducer,lt as FileSystemKanonakDocumentRepository,eo as GitIgnoreFilter,Xt as GraphBuilder,_t as HttpKanonakDocumentRepository,Me as INTEGRITY_PREFIX,F as ImportBook,bo as ImportExistenceRule,le as InMemoryKanonakDocumentRepository,kt as KANONAK_USER_AGENT,wt as Kanonak,to as KanonakDocumentPositions,O as KanonakObjectParser,Bo as KanonakObjectValidator,L as KanonakParser,Ot as KanonakUri,ao as KanonakUriBuilder,io as KanonakUrlResolver,$t as KanonakVocabulary,X as ListStatement,D as LiteralKanonak,Ct as LocalFirstRepository,It as LockAwareRepository,Mo as LookBandPathRule,nr as LookRenderer,Ho as LookSemanticSvgPathRule,jo as MarkdownLinkRule,ke as MarkdownStatement,Io as NamespaceImportCycleRule,fo as NamespacePrefixRule,zt as NodeType,me as NumberStatement,Xo as OAuthDiscovery,Zt as OWL_RL_CLASSIFICATION_RULES,No as ObjectPropertyValueValidationRule,po as OntologyValidationError,co as OntologyValidationResult,To as OwlOneOfRule,A as PackageBuilder,go as PackageHeaderRule,ae as ProducerRepository,Oo as PropertyDomainRule,Ro as PropertyHierarchyCycleRule,Ao as PropertyKindRangeConsistencyRule,no as PropertyMetadata,wo as PropertyRangeReferenceRule,xo as PropertyRangeRequiredRule,ko as PropertyTypeSpecificityRule,Pt as PublisherConfigResolver,Rt as PublisherIndex,Jt as RDFS_RULES,T as Reasoner,Qt as ReasoningResult,k as ReferenceKanonak,q as ReferenceStatement,yt as RepositoryFactory,Lo as ReservedNameShadowRule,yo as ResourceNamingRule,Vt as ResourceResolver,Tt as ResourceTypeClassifier,Lt as ScalarStatement,$o as ShaclShapeRule,At as Statement,de as StringStatement,_o as SubClassOfReferenceRule,Co as SubPropertyOfReferenceRule,S as SubjectKanonak,ho as SubjectKanonakTypeRequiredRule,Zo as TokenCredentialProvider,Yt as TripleStore,Do as TxExpressionPathRule,jt as TypeResolver,Ko as UnresolvedPredicateRule,Eo as UnresolvedReferenceRule,mo as ValidationCache,lo as ValidationContext,uo as ValidationSeverity,Ui as VersionOperator,se as ViewMaterializer,Ae as allowAllPolicy,St as assertHttpsUrl,xt as assertPackageIdentity,vt as buildLocalFirstRepository,tr as buildOntologyModel,Zn as buildReportPackageAsync,ee as buildShapesModel,Go as canonicalForm,be as canonicalHash,Se as carrierOf,Kt as collectKanonakFiles,z as compareVersions,ze as computeIntegrity,Te as computeIntegrityAsync,Oe as contentAddressedName,Q as contextTypesOf,Jo as createCredentialedFetch,it as createVersion,Wn as evaluateConformance,Wt as extractMarkdownLinks,Qo as findDerivation,so as findInstancesByType,Gt as findMalformedReferences,ro as findMarkdownLinkAt,ve as foldFlagsIntoPattern,Ut as formatKanonakAddress,I as formatVersion,ft as getGlobalCachePath,gt as getKanonakUserAgent,ct as isCompatibleVersion,ut as isMajorCompatible,bt as kanonakFetch,Ge as loadLockFile,oe as lowerConstraint,Ht as makeUriKey,Le as noopMeter,zo as normalizeHost,Yo as parseAuthChallenge,he as parseKanonakAddress,De as parseLockFile,st as parseVersionString,oo as parseWithPositions,pt as pickHighestDocument,Ft as propertiesInScope,er as resolveDisplayValue,Bt as resolvePropertyStep,B as sanitizeName,We as saveLockFile,Ze as scopeFromCatalog,Qe as scopeFromDocumentAsync,Je as scopeFromRepositoryAsync,$e as serializeLockFile,Et as setKanonakFetchRetries,ht as setKanonakUserAgent,g as subjectUri,Z as superClassChain,Mt as tripleKey,$ as uriKey,Dt as uriTriple,rt as versionOperatorFromChar,pe as versionOperatorToChar,at as versionsEqual};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
|
+
import { type EntityUri } from '../uri-helpers/index.js';
|
|
4
|
+
import type { ConformanceScope } from './ConformanceScope.js';
|
|
5
|
+
import { type ShaclNodeShapeModel, type ShaclSeverity } from './ShapesModel.js';
|
|
6
|
+
/**
|
|
7
|
+
* SHACL conformance over an explicit {@link ConformanceScope} — the evaluator
|
|
8
|
+
* half of the settled division:
|
|
9
|
+
*
|
|
10
|
+
* - TARGETING is a host-side graph query (this module, over the scope
|
|
11
|
+
* catalog + optional reasoning);
|
|
12
|
+
* - kernel-expressible constraints evaluate through the PUBLISHED expression
|
|
13
|
+
* runtime via the lowering (`Count`/`Contains`/`Matches`/ordering
|
|
14
|
+
* comparisons) — this module never re-implements an operator;
|
|
15
|
+
* - constraints whose evidence exists only in the host object model are
|
|
16
|
+
* HOST PROJECTIONS: `sh:datatype` (the typed statement + the canonical
|
|
17
|
+
* layer's carrier routing), `sh:class` (resolution + type closure),
|
|
18
|
+
* `sh:nodeKind` (statement kind), `sh:closed` (the focus node's predicate
|
|
19
|
+
* set vs. the shape's declared paths, over the scope).
|
|
20
|
+
*
|
|
21
|
+
* Every finding names its focus node, path, offending value, and constraint
|
|
22
|
+
* component — the material a ValidationReport is assembled from.
|
|
23
|
+
*/
|
|
24
|
+
export interface ShaclFinding {
|
|
25
|
+
/** Canonical URI key of the focus node (`publisher/package/name`). */
|
|
26
|
+
focusNode: string;
|
|
27
|
+
/** The focus node's full URI when it carries a resolvable version. */
|
|
28
|
+
focusUri?: KanonakUri | undefined;
|
|
29
|
+
/** The constrained property, for property-level findings. */
|
|
30
|
+
resultPath?: KanonakUri | undefined;
|
|
31
|
+
/** The offending literal value, when one exists. */
|
|
32
|
+
value?: string | number | boolean | undefined;
|
|
33
|
+
/** The offending reference value, when the value is a reference. */
|
|
34
|
+
valueRef?: KanonakUri | undefined;
|
|
35
|
+
/** WHICH constraint failed — a core-shacl ConstraintComponent member. */
|
|
36
|
+
constraintComponent: EntityUri;
|
|
37
|
+
severity: ShaclSeverity;
|
|
38
|
+
message: string;
|
|
39
|
+
/** The NodeShape that produced this finding. */
|
|
40
|
+
sourceShape: string;
|
|
41
|
+
sourceShapeUri?: KanonakUri | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface ShaclConformanceResult {
|
|
44
|
+
/** True when no finding carries Violation severity. */
|
|
45
|
+
conforms: boolean;
|
|
46
|
+
results: ShaclFinding[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Evaluate every NodeShape in `shapes` against the scope. `shapes` may be a
|
|
50
|
+
* pre-built model or a catalog to read shapes from (commonly the scope's own
|
|
51
|
+
* catalog: shapes travel as packages like everything else).
|
|
52
|
+
*/
|
|
53
|
+
export declare function evaluateConformance(scope: ConformanceScope, shapes: ShaclNodeShapeModel[] | Kanonak[]): ShaclConformanceResult;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
2
|
+
import type { KanonakDocument } from '@kanonak-protocol/types/document/models/types';
|
|
3
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
4
|
+
import type { ReasoningResult } from '../reasoning/ReasoningResult.js';
|
|
5
|
+
/**
|
|
6
|
+
* The EXPLICIT data scope a conformance evaluation runs over — the answer to
|
|
7
|
+
* "which statements count as the statements about this node." Conformance —
|
|
8
|
+
* and `sh:closed` in particular — is never evaluated against the ambient open
|
|
9
|
+
* world: closed means closed over THIS scope, an authorized graph handle the
|
|
10
|
+
* caller constructs deliberately.
|
|
11
|
+
*
|
|
12
|
+
* Two modes:
|
|
13
|
+
*
|
|
14
|
+
* - `merged` — the open-world merge over a pinned load-set (a repository
|
|
15
|
+
* the caller controls: a workspace, a locked closure, a governance
|
|
16
|
+
* load-set). Augmentations WITHIN the load-set are honored — that is what
|
|
17
|
+
* the merge is for — and the reasoner's saturation is available so
|
|
18
|
+
* `targetClass` sees subclass/equivalentClass closure.
|
|
19
|
+
*
|
|
20
|
+
* - `standalone` — one document judged ON ITS OWN STATEMENTS, its imports
|
|
21
|
+
* deliberately NOT resolved into data: the ingress case, where the
|
|
22
|
+
* document is an untrusted payload and nothing it declares may pull more
|
|
23
|
+
* graph into scope. References to entities outside the document stay
|
|
24
|
+
* unresolved, which is exactly what a closed-world boundary check wants
|
|
25
|
+
* (unknown = reject, fail closed).
|
|
26
|
+
*/
|
|
27
|
+
export interface ConformanceScope {
|
|
28
|
+
kind: 'merged' | 'standalone';
|
|
29
|
+
/** The statements in scope, as the parsed object model. */
|
|
30
|
+
catalog: Kanonak[];
|
|
31
|
+
/**
|
|
32
|
+
* The reasoned view of the scope, when the mode reasons (merged). Used for
|
|
33
|
+
* closure-aware `targetClass` and `sh:class` checks; absent in standalone
|
|
34
|
+
* mode, where checks fall back to the direct statements — an untrusted
|
|
35
|
+
* payload gets no inference.
|
|
36
|
+
*/
|
|
37
|
+
reasoning?: ReasoningResult | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 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.
|
|
45
|
+
*/
|
|
46
|
+
export declare function scopeFromRepositoryAsync(repository: IKanonakDocumentRepository): Promise<ConformanceScope>;
|
|
47
|
+
/**
|
|
48
|
+
* Build a merged scope from an already-parsed catalog (e.g. a validation
|
|
49
|
+
* pass's single-parse `ValidationCache.getKanonaks()`), optionally with an
|
|
50
|
+
* existing reasoning result — so a batch caller adds conformance without a
|
|
51
|
+
* second parse or reason.
|
|
52
|
+
*/
|
|
53
|
+
export declare function scopeFromCatalog(catalog: Kanonak[], reasoning?: ReasoningResult): ConformanceScope;
|
|
54
|
+
/**
|
|
55
|
+
* Build a standalone scope from a single document — the ingress case. The
|
|
56
|
+
* split is DATA vs IDENTITY:
|
|
57
|
+
*
|
|
58
|
+
* - DATA: only the payload's own subjects enter the scope
|
|
59
|
+
* (`SingleDocumentRepository` exposes exactly this document), so the
|
|
60
|
+
* payload cannot pull additional statements into what is judged — its
|
|
61
|
+
* imports are not honored as data, and no reasoning runs (an untrusted
|
|
62
|
+
* payload gets no inference).
|
|
63
|
+
* - IDENTITY: the payload's predicates and type references resolve through
|
|
64
|
+
* `identityRepository` — the TRUSTED closure the caller authorizes
|
|
65
|
+
* (typically the same pinned load-set the shapes come from). Without
|
|
66
|
+
* this, an adversarial payload's statements would fail to resolve and
|
|
67
|
+
* silently vanish from the judged data — a fail-OPEN closed-shape check.
|
|
68
|
+
* An import naming a package outside the trusted repository stays
|
|
69
|
+
* unresolved, and its unresolvable statements are exactly what a closed
|
|
70
|
+
* shape rejects.
|
|
71
|
+
*/
|
|
72
|
+
export declare function scopeFromDocumentAsync(document: KanonakDocument, identityRepository?: IKanonakDocumentRepository): Promise<ConformanceScope>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
2
|
+
import { type BuiltPackage } from '../producer/PackageBuilder.js';
|
|
3
|
+
import type { ShaclConformanceResult } from './ConformanceEvaluator.js';
|
|
4
|
+
/**
|
|
5
|
+
* Assemble a {@link ShaclConformanceResult} into an AUTHORED
|
|
6
|
+
* `sh:ValidationReport` package — graph data, not tool prose — via the
|
|
7
|
+
* EphemeralPackage pattern: versionless, content-addressed (`q-<hex16>`),
|
|
8
|
+
* produced per invocation, and therefore hashable and signable into a
|
|
9
|
+
* provenance chain. This is the report half of the settled division:
|
|
10
|
+
* `explain()` is the evaluation MECHANISM; the report is authored vocabulary
|
|
11
|
+
* (`core-shacl@1.1.0`) any SHACL-aware tool can round-trip.
|
|
12
|
+
*
|
|
13
|
+
* Reference serialization is honest about what can be imported: a focus node
|
|
14
|
+
* (or path/shape/value) whose package carries a resolvable version is
|
|
15
|
+
* serialized as a true reference through the ImportBook; an entity from a
|
|
16
|
+
* versionless, content-addressed scope (an ingress EphemeralPackage) cannot
|
|
17
|
+
* be imported by version, so it is recorded as its canonical URI string —
|
|
18
|
+
* stated in the property's value rather than silently dropped.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildReportPackageAsync(args: {
|
|
21
|
+
result: ShaclConformanceResult;
|
|
22
|
+
/** The publisher the report package is authored under (the evaluator's operator). */
|
|
23
|
+
publisher: string;
|
|
24
|
+
/** Resolution context for content-hashing the report body. */
|
|
25
|
+
repository: IKanonakDocumentRepository;
|
|
26
|
+
/** Out-of-body provenance (e.g. `resolvedAt`, `id`) — never hashed. */
|
|
27
|
+
header?: Record<string, unknown> | undefined;
|
|
28
|
+
}): Promise<BuiltPackage>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
|
+
/**
|
|
4
|
+
* The parsed, resolved model of the core-shacl shapes a catalog declares —
|
|
5
|
+
* the CONFORMANCE side's view (the introspection side keeps its own
|
|
6
|
+
* codegen-shaped `PropertyConstraints`; both read the same vocabulary through
|
|
7
|
+
* the shared `shacl/uris` identities). Everything resolves through the object
|
|
8
|
+
* model: shapes are recognized by durable core-shacl URI identity, references
|
|
9
|
+
* arrive as `KanonakUri`, and nothing matches on alias or local-name shape.
|
|
10
|
+
*/
|
|
11
|
+
/** The three node kinds, mapped from the sh:NodeKind members. */
|
|
12
|
+
export type ShaclNodeKind = 'IRI' | 'BlankNode' | 'Literal';
|
|
13
|
+
/** Result severity, mapped from the sh:Severity members. */
|
|
14
|
+
export type ShaclSeverity = 'Violation' | 'Warning' | 'Info';
|
|
15
|
+
export interface ShaclPropertyConstraint {
|
|
16
|
+
/** The constrained property's canonical URI (`sh:path`). */
|
|
17
|
+
path: KanonakUri;
|
|
18
|
+
minCount?: number | undefined;
|
|
19
|
+
maxCount?: number | undefined;
|
|
20
|
+
minLength?: number | undefined;
|
|
21
|
+
maxLength?: number | undefined;
|
|
22
|
+
minInclusive?: number | undefined;
|
|
23
|
+
maxInclusive?: number | undefined;
|
|
24
|
+
pattern?: {
|
|
25
|
+
regex: string;
|
|
26
|
+
flags?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
/** `sh:in` literal members. */
|
|
29
|
+
inValues?: (string | number | boolean)[] | undefined;
|
|
30
|
+
/** `sh:in` reference members (named individuals). */
|
|
31
|
+
inRefs?: KanonakUri[] | undefined;
|
|
32
|
+
datatype?: KanonakUri | undefined;
|
|
33
|
+
classRef?: KanonakUri | undefined;
|
|
34
|
+
nodeKind?: ShaclNodeKind | undefined;
|
|
35
|
+
message?: string | undefined;
|
|
36
|
+
severity?: ShaclSeverity | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface ShaclNodeShapeModel {
|
|
39
|
+
/** The shape's local name (diagnostics + `sh:sourceShape`). */
|
|
40
|
+
name: string;
|
|
41
|
+
/** The shape's canonical URI, when it is a named subject. */
|
|
42
|
+
uri?: KanonakUri | undefined;
|
|
43
|
+
targetClass?: KanonakUri | undefined;
|
|
44
|
+
targetNodes: KanonakUri[];
|
|
45
|
+
targetSubjectsOf: KanonakUri[];
|
|
46
|
+
targetObjectsOf: KanonakUri[];
|
|
47
|
+
closed: boolean;
|
|
48
|
+
ignoredProperties: KanonakUri[];
|
|
49
|
+
severity?: ShaclSeverity | undefined;
|
|
50
|
+
properties: ShaclPropertyConstraint[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse every `sh:NodeShape` in the shapes catalog into its resolved model.
|
|
54
|
+
* PropertyShapes are collected inline-embedded or by reference (resolved in
|
|
55
|
+
* the same catalog). A shape with no target of any kind constrains nothing
|
|
56
|
+
* and is still returned — the evaluator simply finds an empty focus set (the
|
|
57
|
+
* definition validator warns about it separately).
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildShapesModel(shapesCatalog: Kanonak[]): ShaclNodeShapeModel[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { scopeFromRepositoryAsync, scopeFromCatalog, scopeFromDocumentAsync, } from './ConformanceScope.js';
|
|
2
|
+
export type { ConformanceScope } from './ConformanceScope.js';
|
|
3
|
+
export { buildShapesModel } from './ShapesModel.js';
|
|
4
|
+
export type { ShaclNodeShapeModel, ShaclPropertyConstraint, ShaclNodeKind, ShaclSeverity, } from './ShapesModel.js';
|
|
5
|
+
export { lowerConstraint, foldFlagsIntoPattern } from './lowering.js';
|
|
6
|
+
export type { LoweredCheck, LoweredExprNode } from './lowering.js';
|
|
7
|
+
export { evaluateConformance } from './ConformanceEvaluator.js';
|
|
8
|
+
export type { ShaclConformanceResult, ShaclFinding } from './ConformanceEvaluator.js';
|
|
9
|
+
export { buildReportPackageAsync } from './ReportBuilder.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ShaclPropertyConstraint } from './ShapesModel.js';
|
|
2
|
+
/** A node in the expression runtime's tree format (its `ExprNode`). */
|
|
3
|
+
export interface LoweredExprNode {
|
|
4
|
+
type: string;
|
|
5
|
+
[operandOrValue: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
/** The variable names the evaluator binds when running lowered checks. */
|
|
8
|
+
export declare const LOWERED_VALUES_VAR = "values";
|
|
9
|
+
export declare const LOWERED_VALUE_VAR = "v";
|
|
10
|
+
export declare const LOWERED_ALLOWED_VAR = "allowed";
|
|
11
|
+
export interface LoweredCheck {
|
|
12
|
+
/** Which constraint this check enforces (the report's discriminant). */
|
|
13
|
+
component: 'minCount' | 'maxCount' | 'in' | 'pattern' | 'minLength' | 'maxLength' | 'minInclusive' | 'maxInclusive';
|
|
14
|
+
/** `node` = once per focus node (binds `values`); `value` = once per value (binds `v`, and `allowed` for `in`). */
|
|
15
|
+
per: 'node' | 'value';
|
|
16
|
+
expr: LoweredExprNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `sh:flags` folds into the runtime's whole-pattern flag prefix — the only
|
|
20
|
+
* flag mechanism in the pinned subset. Only `i`, `m`, `s` exist there; any
|
|
21
|
+
* other flag is outside the subset and must fail loudly rather than be
|
|
22
|
+
* silently dropped.
|
|
23
|
+
*/
|
|
24
|
+
export declare function foldFlagsIntoPattern(regex: string, flags: string | undefined): string;
|
|
25
|
+
/** Lower one PropertyShape's kernel-expressible constraints. */
|
|
26
|
+
export declare function lowerConstraint(c: ShaclPropertyConstraint): LoweredCheck[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { EntityUri } from '../uri-helpers/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* THE canonical URI constants for the `kanonak.org/core-shacl` vocabulary —
|
|
4
|
+
* shared by the conformance layer, the constraint-enrichment index
|
|
5
|
+
* (`introspection/ShaclConstraints`), and the definition-validation rule
|
|
6
|
+
* (`ShaclShapeRule`), so the vocabulary's identity lives in exactly one
|
|
7
|
+
* module. Hardcoded URIs are the canonical-ontology contract (never
|
|
8
|
+
* alias/local-name heuristics).
|
|
9
|
+
*/
|
|
10
|
+
export declare const SHACL_PUBLISHER = "kanonak.org";
|
|
11
|
+
export declare const SHACL_PACKAGE = "core-shacl";
|
|
12
|
+
export declare const SH_NODE_SHAPE: EntityUri;
|
|
13
|
+
export declare const SH_PROPERTY_SHAPE: EntityUri;
|
|
14
|
+
export declare const SH_TARGET_CLASS: EntityUri;
|
|
15
|
+
export declare const SH_PROPERTY: EntityUri;
|
|
16
|
+
export declare const SH_PATH: EntityUri;
|
|
17
|
+
export declare const SH_MIN_COUNT: EntityUri;
|
|
18
|
+
export declare const SH_MAX_COUNT: EntityUri;
|
|
19
|
+
export declare const SH_DATATYPE: EntityUri;
|
|
20
|
+
export declare const SH_CLASS: EntityUri;
|
|
21
|
+
export declare const SH_IN: EntityUri;
|
|
22
|
+
export declare const SH_PATTERN: EntityUri;
|
|
23
|
+
export declare const SH_FLAGS: EntityUri;
|
|
24
|
+
export declare const SH_MIN_LENGTH: EntityUri;
|
|
25
|
+
export declare const SH_MAX_LENGTH: EntityUri;
|
|
26
|
+
export declare const SH_MIN_INCLUSIVE: EntityUri;
|
|
27
|
+
export declare const SH_MAX_INCLUSIVE: EntityUri;
|
|
28
|
+
export declare const SH_MESSAGE: EntityUri;
|
|
29
|
+
export declare const SH_TARGET_NODE: EntityUri;
|
|
30
|
+
export declare const SH_TARGET_SUBJECTS_OF: EntityUri;
|
|
31
|
+
export declare const SH_TARGET_OBJECTS_OF: EntityUri;
|
|
32
|
+
export declare const SH_CLOSED: EntityUri;
|
|
33
|
+
export declare const SH_IGNORED_PROPERTIES: EntityUri;
|
|
34
|
+
export declare const SH_NODE_KIND: EntityUri;
|
|
35
|
+
export declare const SH_NODEKIND_IRI: EntityUri;
|
|
36
|
+
export declare const SH_NODEKIND_BLANK_NODE: EntityUri;
|
|
37
|
+
export declare const SH_NODEKIND_LITERAL: EntityUri;
|
|
38
|
+
export declare const SH_SEVERITY: EntityUri;
|
|
39
|
+
export declare const SH_VIOLATION: EntityUri;
|
|
40
|
+
export declare const SH_WARNING: EntityUri;
|
|
41
|
+
export declare const SH_INFO: EntityUri;
|
|
42
|
+
export declare const SH_VALIDATION_REPORT: EntityUri;
|
|
43
|
+
export declare const SH_CONFORMS: EntityUri;
|
|
44
|
+
export declare const SH_RESULT: EntityUri;
|
|
45
|
+
export declare const SH_VALIDATION_RESULT: EntityUri;
|
|
46
|
+
export declare const SH_FOCUS_NODE: EntityUri;
|
|
47
|
+
export declare const SH_RESULT_PATH: EntityUri;
|
|
48
|
+
export declare const SH_RESULT_MESSAGE: EntityUri;
|
|
49
|
+
export declare const SH_RESULT_SEVERITY: EntityUri;
|
|
50
|
+
export declare const SH_SOURCE_SHAPE: EntityUri;
|
|
51
|
+
export declare const SH_VALUE: EntityUri;
|
|
52
|
+
export declare const SH_SOURCE_CONSTRAINT_COMPONENT: EntityUri;
|
|
53
|
+
export declare const SH_COMP_MIN_COUNT: EntityUri;
|
|
54
|
+
export declare const SH_COMP_MAX_COUNT: EntityUri;
|
|
55
|
+
export declare const SH_COMP_DATATYPE: EntityUri;
|
|
56
|
+
export declare const SH_COMP_CLASS: EntityUri;
|
|
57
|
+
export declare const SH_COMP_IN: EntityUri;
|
|
58
|
+
export declare const SH_COMP_PATTERN: EntityUri;
|
|
59
|
+
export declare const SH_COMP_MIN_LENGTH: EntityUri;
|
|
60
|
+
export declare const SH_COMP_MAX_LENGTH: EntityUri;
|
|
61
|
+
export declare const SH_COMP_MIN_INCLUSIVE: EntityUri;
|
|
62
|
+
export declare const SH_COMP_MAX_INCLUSIVE: EntityUri;
|
|
63
|
+
export declare const SH_COMP_NODE_KIND: EntityUri;
|
|
64
|
+
export declare const SH_COMP_CLOSED: EntityUri;
|
|
@@ -8,4 +8,4 @@ export { KanonakObjectValidator } from './KanonakObjectValidator.js';
|
|
|
8
8
|
export type { IDocumentValidationRule } from './rules/document/IDocumentValidationRule.js';
|
|
9
9
|
export type { IRepositoryValidationRule } from './rules/repository/IRepositoryValidationRule.js';
|
|
10
10
|
export { NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule } from './rules/document/index.js';
|
|
11
|
-
export { ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, EmbeddedKanonakTypeRule, MarkdownLinkRule, DisplayLensScopeRule, LookSemanticSvgPathRule, TxExpressionPathRule, ShaclShapeRule, OwlOneOfRule, DiamondNameClashRule } from './rules/repository/index.js';
|
|
11
|
+
export { ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, EmbeddedKanonakTypeRule, MarkdownLinkRule, DisplayLensScopeRule, LookSemanticSvgPathRule, LookBandPathRule, TxExpressionPathRule, ShaclShapeRule, OwlOneOfRule, DiamondNameClashRule } from './rules/repository/index.js';
|
package/dist/validation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,
|
|
1
|
+
import{A,B,C,D,E,F,G,H,K as I,L as J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-UYSEO3OT.js";import"../chunk-M443OYKT.js";import"../chunk-V6KIDED2.js";import"../chunk-NJ3AZYQD.js";import"../chunk-SVUMCLK5.js";import"../chunk-YW6P24RF.js";import"../chunk-FUUTGGJS.js";import"../chunk-2ACBWC7K.js";export{u as AmbiguousReferenceRule,A as ClassDefinitionRule,n as ClassHierarchyCycleRule,I as DiamondNameClashRule,C as DisplayLensScopeRule,k as EmbeddedKanonakTypeRule,l as ImportExistenceRule,J as KanonakObjectValidator,E as LookBandPathRule,D as LookSemanticSvgPathRule,B as MarkdownLinkRule,s as NamespaceImportCycleRule,f as NamespacePrefixRule,w as ObjectPropertyValueValidationRule,c as OntologyValidationError,a as OntologyValidationResult,H as OwlOneOfRule,j as PackageHeaderRule,x as PropertyDomainRule,o as PropertyHierarchyCycleRule,y as PropertyKindRangeConsistencyRule,v as PropertyRangeReferenceRule,p as PropertyRangeRequiredRule,h as PropertyTypeSpecificityRule,z as ReservedNameShadowRule,g as ResourceNamingRule,G as ShaclShapeRule,q as SubClassOfReferenceRule,r as SubPropertyOfReferenceRule,i as SubjectKanonakTypeRequiredRule,F as TxExpressionPathRule,t as UnresolvedPredicateRule,m as UnresolvedReferenceRule,e as ValidationCache,d as ValidationContext,b as ValidationSeverity};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.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",
|
|
@@ -126,10 +126,11 @@
|
|
|
126
126
|
],
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@kanonak-protocol/canonical": "^0.1.3",
|
|
129
|
-
"@kanonak-protocol/types": "^5.
|
|
129
|
+
"@kanonak-protocol/types": "^5.19.0",
|
|
130
130
|
"ignore": "^7.0.5",
|
|
131
131
|
"js-yaml": "^4.1.0",
|
|
132
|
-
"yaml": "^2.7.0"
|
|
132
|
+
"yaml": "^2.7.0",
|
|
133
|
+
"@kanonak-protocol/expression": "^0.3.0"
|
|
133
134
|
},
|
|
134
135
|
"optionalDependencies": {
|
|
135
136
|
"@huggingface/transformers": "^3.8.1"
|