@kanonak-protocol/sdk 3.69.0 → 3.70.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-2OXZDBHX.js +1 -0
- package/dist/chunk-4NO7MHS7.js +1 -0
- package/dist/{chunk-7JZUJ2K4.js → chunk-6T2XFOMU.js} +1 -1
- package/dist/chunk-7ZCFYITD.js +2 -0
- package/dist/chunk-C5NKFT7W.js +148 -0
- package/dist/chunk-EOMKFFKU.js +1 -0
- package/dist/chunk-PODBS4IU.js +1 -0
- package/dist/chunk-SHDHMKMJ.js +1 -0
- package/dist/chunk-U75VPNYW.js +2 -0
- package/dist/chunk-W4LPC6VM.js +1 -0
- package/dist/{chunk-OIVACCMQ.js → chunk-XEFBKQY5.js} +17 -12
- package/dist/index.js +1 -1
- package/dist/look/LookRenderer.d.ts +29 -1
- package/dist/parsing/index.js +1 -1
- package/dist/reasoning/index.js +1 -1
- package/dist/repositories/browser.js +1 -1
- package/dist/repositories/index.js +1 -1
- package/dist/search/index.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/route.d.ts +1 -1
- package/dist/transformations/index.js +47 -47
- package/dist/transformations/v3/CompiledTransformationV3.d.ts +6 -2
- package/dist/transformations/v3/ExpressionEngineV3.d.ts +13 -1
- package/dist/transformations/v3/TransformationLoaderV3.d.ts +19 -2
- package/dist/transformations/v3/TransformationUriConstantsV3.d.ts +5 -0
- package/dist/validation/index.js +1 -1
- package/dist/validation/rules/repository/LookSemanticSvgPathRule.d.ts +36 -0
- package/dist/validation/rules/repository/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/chunk-767XYRNU.js +0 -1
- package/dist/chunk-CA2EATJR.js +0 -1
- package/dist/chunk-FXKT6OI4.js +0 -148
- package/dist/chunk-H2LEQLVD.js +0 -1
- package/dist/chunk-KSTGTV35.js +0 -2
- package/dist/chunk-Q6QTQWR2.js +0 -1
- package/dist/chunk-QHJ6EY3Y.js +0 -1
- package/dist/chunk-RSIZQAFL.js +0 -2
- /package/dist/{chunk-3NEUHF7E.js → chunk-QHABFCRC.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as v}from"./chunk-U75VPNYW.js";import{a as A}from"./chunk-4NO7MHS7.js";import{a as f}from"./chunk-ORFSMEMM.js";import{c as w,d as I,h as R,i as F}from"./chunk-2ACBWC7K.js";import*as i from"fs/promises";import*as c from"path";import{pathToFileURL as b}from"url";import{VersionOperator as P}from"@kanonak-protocol/types/document/models/enums";var y=class{rootPath;recursive;parser;documentCache;filePathsByIdentifier;cacheInitialized=!1;cacheInitPromise=null;parsingErrors=new Map;constructor(e,t=!0,n){if(!e||e.trim().length===0)throw new Error("Root path cannot be null or empty");this.rootPath=c.resolve(e),this.recursive=t,this.parser=n??new f,this.documentCache=new Map,this.filePathsByIdentifier=new Map}async getAllDocumentsAsync(){await this.ensureCacheInitialized();let e=new Set(this.documentCache.values());return Array.from(e)}async getDocumentAsync(e){await this.ensureCacheInitialized();let t=this.documentCache.get(e);if(t)return t;let n=c.join(this.rootPath,e);if(t=this.documentCache.get(n),t)return t;for(let o of[".kan.yml",".yml",".yaml"])if(!e.endsWith(o)){let s=e+o;if(t=this.documentCache.get(s),t)return t;let a=c.join(this.rootPath,s);if(t=this.documentCache.get(a),t)return t}return null}async getDocumentsByNamespaceAsync(e,t){await this.ensureCacheInitialized();let n=new Set(this.documentCache.values());return Array.from(n).filter(o=>o.metadata.namespace_?.publisher===e&&o.metadata.namespace_?.package_===t)}async getHighestCompatibleVersionAsync(e,t){await this.ensureCacheInitialized();let n=new Set(this.documentCache.values()),o=Array.from(n).filter(a=>a.metadata?.namespace_?.publisher===e&&a.metadata?.namespace_?.package_===t.packageName&&a.metadata?.namespace_?.version!==void 0);if(o.length===0)return null;let s=o.filter(a=>{let r=a.metadata.namespace_.version;switch(t.versionOperator){case P.Exact:return I(r,t.version);case P.Compatible:return R(r,t.version);case P.Major:return F(r,t.version);case P.Any:return w(r,t.minVersion)>=0;default:return!1}});return s.length===0?null:(s.sort((a,r)=>{let m=a.metadata.namespace_.version,l=r.metadata.namespace_.version;return w(l,m)}),s[0])}async saveDocumentAsync(e,t){let n,o=e.metadata.namespace_?.toString();if(o&&o.includes("@")&&o.includes("/")){let m=o.split("/"),l=m[0],p=m[1].replace("@","@")+".kan.yml";n=c.join(this.rootPath,l,p)}else n=c.join(this.rootPath,t),!n.endsWith(".yml")&&!n.endsWith(".yaml")&&!n.endsWith(".kan.yml")&&(n+=".kan.yml");let s=c.dirname(n);await i.mkdir(s,{recursive:!0});let a=this.parser.save(e);await i.writeFile(n,a,"utf8"),o&&this.documentCache.set(o,e),this.documentCache.set(n,e);let r=c.relative(this.rootPath,n);this.documentCache.set(r,e)}async deleteDocumentAsync(e){let t=await this.getDocumentAsync(e);if(!t)return;let n=this.filePathsByIdentifier.get(e);if(!n)return;try{await i.unlink(n)}catch{}let o=t.metadata.namespace_?.toString();o&&this.documentCache.delete(o),this.documentCache.delete(e),this.documentCache.delete(n);let s=c.relative(this.rootPath,n);this.documentCache.delete(s)}async clearNamespaceAsync(e,t){await this.ensureCacheInitialized();let n=[];for(let[s,a]of this.documentCache.entries()){let r=a.metadata.namespace_?.toString()||"";r.includes(e)&&r.includes(t)&&n.push([s,a])}let o=c.join(this.rootPath,e);try{let s=await i.readdir(o);for(let a of s)a.includes(t)&&a.endsWith(".kan.yml")&&await i.unlink(c.join(o,a))}catch{}for(let[s]of n)this.documentCache.delete(s)}async getAllDocumentReferencesAsync(){await this.ensureCacheInitialized();let e=new Set(this.filePathsByIdentifier.values()),t=[];for(let n of e){let o=b(n).toString(),s;for(let[m,l]of this.documentCache.entries())if(this.filePathsByIdentifier.get(m)===n&&l.metadata.namespace_){s=l.metadata.namespace_.toString();break}let a=s??c.relative(this.rootPath,n),r=this.parsingErrors.has(n);t.push({identifier:a,uri:o,hasParseError:r})}return t}async getDocumentContentAsync(e){await this.ensureCacheInitialized();let t=this.filePathsByIdentifier.get(e);if(!t)try{await i.access(e),t=e}catch{let n=c.join(this.rootPath,e);try{await i.access(n),t=n}catch{return null}}try{return await i.readFile(t,"utf8")}catch{return null}}async getDocumentUriAsync(e){await this.ensureCacheInitialized();let t=this.filePathsByIdentifier.get(e);if(!t)try{await i.access(e),t=e}catch{let n=c.join(this.rootPath,e);try{await i.access(n),t=n}catch{return null}}return b(t).toString()}async refreshAsync(){this.documentCache.clear(),this.filePathsByIdentifier.clear(),this.parsingErrors.clear(),this.cacheInitialized=!1,this.cacheInitPromise=null,await this.ensureCacheInitialized()}async ensureCacheInitialized(){if(!this.cacheInitialized){if(this.cacheInitPromise){await this.cacheInitPromise;return}this.cacheInitPromise=this.loadDocuments(),await this.cacheInitPromise,this.cacheInitialized=!0}}async loadDocuments(){try{await i.mkdir(this.rootPath,{recursive:!0})}catch{}let t=(await this.findYamlFiles(this.rootPath,this.recursive)).map(async o=>{try{let s=await i.readFile(o,"utf8"),a=this.parser.parse(s);return{filePath:o,document:a,error:null}}catch(s){return{filePath:o,document:null,error:s instanceof Error?s.message:String(s)}}}),n=await Promise.all(t);for(let{filePath:o,document:s,error:a}of n){let r=c.relative(this.rootPath,o);if(s&&s.metadata.namespace_){let m=s.metadata.namespace_.toString();this.documentCache.set(m,s),this.documentCache.set(o,s),this.documentCache.set(r,s),this.filePathsByIdentifier.set(m,o),this.filePathsByIdentifier.set(o,o),this.filePathsByIdentifier.set(r,o)}else this.filePathsByIdentifier.set(o,o),this.filePathsByIdentifier.set(r,o);a&&this.parsingErrors.set(o,a)}}async findYamlFiles(e,t){let n=[];try{let o=await i.readdir(e,{withFileTypes:!0});for(let s of o){let a=c.join(e,s.name);if(s.isDirectory()&&t){let r=await this.findYamlFiles(a,t);n.push(...r)}else s.isFile()&&s.name.endsWith(".kan.yml")&&n.push(a)}}catch{}return n}};import*as d from"fs";var S=(n=>(n.NotFound="NotFound",n.Workspace="Workspace",n.Cache="Cache",n))(S||{}),k=class{cache;workspace;constructor(e,t,n){let o=n??new f;d.existsSync(e)||d.mkdirSync(e,{recursive:!0}),d.existsSync(t)||d.mkdirSync(t,{recursive:!0}),this.cache=new y(e,!0,o),this.workspace=new y(t,!0,o)}getCache(){return this.cache}getWorkspace(){return this.workspace}async getAllDocumentsAsync(){let e=await this.workspace.getAllDocumentsAsync(),t=await this.cache.getAllDocumentsAsync(),n=new Map;for(let o of t)if(o.metadata.namespace_){let s=o.metadata.namespace_.toString();n.set(s,o)}for(let o of e)if(o.metadata.namespace_){let s=o.metadata.namespace_.toString();n.set(s,o)}return Array.from(n.values())}async getDocumentAsync(e){let t=await this.workspace.getDocumentAsync(e);return t||await this.cache.getDocumentAsync(e)}async getDocumentsByNamespaceAsync(e,t){let n=await this.workspace.getDocumentsByNamespaceAsync(e,t),o=await this.cache.getDocumentsByNamespaceAsync(e,t),s=new Map;for(let a of o)if(a.metadata.namespace_?.version){let r=a.metadata.namespace_.version.toString();s.set(r,a)}for(let a of n)if(a.metadata.namespace_?.version){let r=a.metadata.namespace_.version.toString();s.set(r,a)}return Array.from(s.values())}async getHighestCompatibleVersionAsync(e,t){let n=await this.workspace.getHighestCompatibleVersionAsync(e,t);return n||await this.cache.getHighestCompatibleVersionAsync(e,t)}async saveDocumentAsync(e,t){await this.workspace.saveDocumentAsync(e,t)}async saveToCacheAsync(e,t){await this.cache.saveDocumentAsync(e,t)}async deleteDocumentAsync(e){await this.workspace.deleteDocumentAsync(e)}async clearNamespaceAsync(e,t){await this.workspace.clearNamespaceAsync(e,t)}async getAllDocumentReferencesAsync(){let e=await this.workspace.getAllDocumentReferencesAsync(),t=await this.cache.getAllDocumentReferencesAsync(),n=[];return n.push(...e),n.push(...t),n}async getDocumentContentAsync(e){let t=await this.workspace.getDocumentContentAsync(e);return t||await this.cache.getDocumentContentAsync(e)}async getDocumentUriAsync(e){let t=await this.workspace.getDocumentUriAsync(e);return t||await this.cache.getDocumentUriAsync(e)}async getDocumentLocationAsync(e){return await this.workspace.getDocumentAsync(e)?"Workspace":await this.cache.getDocumentAsync(e)?"Cache":"NotFound"}};import{homedir as _}from"os";import{join as N}from"path";function g(){let u=process.env.KANONAK_PACKAGE_CACHE;return u||N(_(),".kanonak","packages")}var C=class u{static createComposite(e,t,n){let o=e??g(),s=t??".";return new k(o,s,n)}static createFromEnvironment(e){let t=g(),n=process.env.KANONAK_WORKSPACE_PATH??".";return u.createComposite(t,n,e)}};var D=class{repos;constructor(...e){this.repos=e}async getHighestCompatibleVersionAsync(e,t){for(let n of this.repos)try{let o=await n.getHighestCompatibleVersionAsync(e,t);if(o)return o}catch{}return null}async getAllDocumentsAsync(){let e=[],t=new Set;for(let n of this.repos)try{for(let o of await n.getAllDocumentsAsync()){let s=o.metadata?.namespace_,a=s?s.version?`${s.publisher}/${s.package_}@${s.version.major}.${s.version.minor}.${s.version.patch}`:`${s.publisher}/${s.package_}`:void 0;if(a!==void 0){if(t.has(a))continue;t.add(a)}e.push(o)}}catch{}return e}async getDocumentAsync(e){for(let t of this.repos)try{let n=await t.getDocumentAsync(e);if(n)return n}catch{}return null}async getDocumentsByNamespaceAsync(e,t){for(let n of this.repos)try{let o=await n.getDocumentsByNamespaceAsync(e,t);if(o.length>0)return o}catch{}return[]}async saveDocumentAsync(e,t){await this.repos[0].saveDocumentAsync(e,t)}async deleteDocumentAsync(e){await this.repos[0].deleteDocumentAsync(e)}async clearNamespaceAsync(e,t){await this.repos[0].clearNamespaceAsync(e,t)}async getAllDocumentReferencesAsync(){return this.repos[0].getAllDocumentReferencesAsync()}async getDocumentContentAsync(e){for(let t of this.repos)try{let n=await t.getDocumentContentAsync(e);if(n)return n}catch{}return null}async getDocumentUriAsync(e){for(let t of this.repos)try{let n=await t.getDocumentUriAsync(e);if(n)return n}catch{}return null}};import{readFileSync as B,readdirSync as H}from"fs";import{join as x}from"path";var $=new Set(["node_modules",".kanonak",".git","_site","build",".stage"]);function K(u,e=[]){for(let t of H(u,{withFileTypes:!0}))t.isDirectory()?$.has(t.name)||K(x(u,t.name),e):t.name.endsWith(".kan.yml")&&e.push(x(u,t.name));return e}async function j(u,e=new f,t={}){let n=new A(e);for(let m of K(u))try{let l=e.parse(B(m,"utf-8")),h=l.metadata?.namespace_,p=h?.version;h&&p&&await n.saveDocumentAsync(l,`${h.publisher}/${h.package_}@${p.major}.${p.minor}.${p.patch}`)}catch{}let o=new y(g(),!0,e),s=new Map,a=t.httpCache??{getFromCache:(m,l,h)=>s.get(`${m}|${l}|${h}`)??null,onFetch:(m,l,h,p)=>{s.set(`${m}|${l}|${h}`,p)}},r=new v({getFromCache:a.getFromCache,onFetch:a.onFetch});return new D(n,o,r)}export{y as a,S as b,k as c,g as d,C as e,D as f,K as g,j as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as E}from"./chunk-ORFSMEMM.js";import{b as $,c as _,i as M}from"./chunk-64TVBQFR.js";import{a as L,b as N,c as j,d as g,g as S,h as D,i as O,j as P,k as w,l as K}from"./chunk-W6T7MOKY.js";var b=class extends N{name};var R=class extends L{value};var I=class extends S{links=[]};var B=/\[\[([^\[\]\n]+)\]\]/g,z=/\[\[/g,V=/```[\s\S]*?```|`[^`\n]*`/g;function U(c){let e=[];for(let t of c.matchAll(V))e.push([t.index,t.index+t[0].length]);return e}function Q(c){if(!c||!c.includes("[["))return[];let e=U(c),t=o=>e.some(([n,s])=>o>=n&&o<s),r=new Set(T(c).map(o=>o.startOffset)),a=[];for(let o of c.matchAll(z)){let n=o.index;if(t(n)||r.has(n))continue;let s=c.slice(n,n+48).replace(/\s+/g," ").trim();a.push({startOffset:n,snippet:s})}return a}function T(c){if(!c||!c.includes("[["))return[];let e=[];for(let a of c.matchAll(V))e.push([a.index,a.index+a[0].length]);let t=a=>e.some(([o,n])=>a>=o&&a<n),r=[];for(let a of c.matchAll(B)){let o=a.index;if(t(o))continue;let n=a[1],s=n.indexOf("|"),p=(s===-1?n:n.slice(0,s)).trim();if(p.length===0)continue;let m=s===-1?"":n.slice(s+1).trim(),f={reference:p,startOffset:o,endOffset:o+a[0].length};m.length>0&&(f.displayText=m),r.push(f)}return r}var C=class{constructor(e){}async parseKanonaks(e){let t=[],r=await e.getAllDocumentsAsync(),a=new $(e),o=new _(a);for(let i of r){let u=i.metadata.namespace_?.toString()??"";for(let[y,l]of Object.entries(i.body)){let k=new j,d=this.resolveCanonicalEntity(y,i,u);k.namespace=d.namespace,k.name=d.name,k.statement=[];let h=await this.parseStatements(l,i,a,o,e);k.statement.push(...h),t.push(k)}}let n=new Map,s=new Map,p=[];for(let i of t)if(i instanceof j){let u=`${i.namespace}/${i.name}`,y=n.get(u);if(y){let l=s.get(u);for(let k of i.statement){let d=v(k);l.has(d)||(l.add(d),y.statement.push(k))}}else{let l=new Set,k=[];for(let d of i.statement){let h=v(d);l.has(h)||(l.add(h),k.push(d))}i.statement=k,s.set(u,l),n.set(u,i),p.push(i)}}else p.push(i);let m=new Set;for(let i of p)if(i instanceof j){let u=i.namespace||"",y=u.indexOf("/"),l=y>=0?u.slice(0,y):"",k=y>=0?u.slice(y+1):"",d=k.indexOf("@"),h=d>=0?k.slice(0,d):k;m.add(`${l}/${h}/${i.name}`)}let f=i=>m.has(`${i.publisher}/${i.package_}/${i.name}`);for(let i of p)i instanceof j&&this.canonicalizeStatementBuiltins(i.statement,f);return p}canonicalizeStatementBuiltins(e,t){for(let r of e){let a=r.predicate?.subject;if(M(a,t),r instanceof P)r.object instanceof g&&M(r.object.subject,t);else if(r instanceof w)r.object&&this.canonicalizeStatementBuiltins(r.object.statement,t);else if(r instanceof K)for(let o of r.object??[])o instanceof g?M(o.subject,t):o instanceof b&&this.canonicalizeStatementBuiltins(o.statement,t)}}resolveCanonicalEntity(e,t,r){if(!e.includes(".")||!t.metadata?.imports)return{namespace:r,name:e};let a=e.indexOf("."),o=e.substring(0,a),n=e.substring(a+1);for(let[s,p]of Object.entries(t.metadata.imports))for(let m of p)if((m.alias??m.packageName)===o){let i=m.version;return{namespace:`${s}/${m.packageName}@${i.major}.${i.minor}.${i.patch}`,name:n}}return{namespace:r,name:e}}async parseStatements(e,t,r,a,o){let n=[];if(typeof e!="object"||e===null||Array.isArray(e))return n;for(let[s,p]of Object.entries(e))try{let m=await this.getPropertyMetadata(s,t,r,o,a);if(!m)continue;let f=await this.parsePropertyValue(s,p,m,t,r,a);f&&n.push(f)}catch(m){console.error(`Error parsing property ${s}:`,m)}return n}async getPropertyMetadata(e,t,r,a,o){let n=await r.resolveEntityAsync(e,t);if(!n)return;let s=n.entity,p=s.type?.toString()??"",m=p.includes(".")?p.substring(p.lastIndexOf(".")+1):p;if(!new Set(["Property","DatatypeProperty","ObjectProperty","AnnotationProperty"]).has(m))return;let i=o.getPropertyTypeClassification(p),u=s.range?.toString(),y;if(i==="ObjectProperty")y="ObjectProperty";else if(i==="DatatypeProperty")y="DatatypeProperty";else{let d=u&&u.includes(".")?u.substring(u.lastIndexOf(".")+1):u??"";(u?o.isKnownXsdDatatypeName(u):!1)||d==="Literal"?y="DatatypeProperty":y="ObjectProperty"}let l;if(u){let d=t;if(n.isImported&&n.definedInNamespace&&typeof a.getDocumentAsync=="function"){let x=await a.getDocumentAsync(n.definedInNamespace);x&&(d=x)}l=(await r.resolveEntityAsync(u,d))?.uri}return{propertyUri:n.uri.toString(),propertyType:y,range:u,rangeUri:l,isImported:n.isImported,definedInNamespace:n.definedInNamespace}}async parsePropertyValue(e,t,r,a,o,n){let s=r.propertyUri;if(t!=null){if(Array.isArray(t))return this.parseListValue(s,t,r,a,o,n);if(r.propertyType==="DatatypeProperty")return this.parseDatatypeValue(s,t,r,a,o,n);if(r.propertyType==="ObjectProperty")return this.parseObjectValue(s,t,r,a,o,n)}}async parseDatatypeValue(e,t,r,a,o,n){if(t instanceof Date)return S.parse(e,t.toISOString());if(typeof t=="string")return n.isSubstitutableDatatype(r.rangeUri)?await this.parseSubstitutableValue(e,t,a,o):S.parse(e,t);if(typeof t=="number")return D.parse(e,t);if(typeof t=="boolean"){let s=new O;return s.predicate=g.parse(e),s.object=t,s}}async parseSubstitutableValue(e,t,r,a){let o=new I;o.predicate=g.parse(e),o.object=t;for(let n of T(t)){let s=await a.resolveEntityAsync(n.reference,r),p;s&&(p=new g,p.subject=s.uri);let m={reference:n.reference,startOffset:n.startOffset,endOffset:n.endOffset};n.displayText!==void 0&&(m.displayText=n.displayText),p!==void 0&&(m.target=p),o.links.push(m)}return o}async parseObjectValue(e,t,r,a,o,n){if(typeof t=="string"){let s=await this.resolveReference(t,a,o);if(!s)return;let p=new P;return p.predicate=g.parse(e),p.object=s,p}if(typeof t=="object"&&!Array.isArray(t)){let s=new b;if(s.statement=await this.parseStatements(t,a,o,n,{}),s.statement.length>0){let f=new w;return f.predicate=g.parse(e),f.object=s,f}let p=[];for(let[f,i]of Object.entries(t))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let u=new b;u.name=f,u.statement=await this.parseStatements(i,a,o,n,{}),p.push(u)}else if(typeof i=="string"){let u=await this.resolveReference(i,a,o);u&&p.push(u)}if(p.length>0){let f=new K;return f.predicate=g.parse(e),f.object=p,f}let m=new w;return m.predicate=g.parse(e),m.object=s,m}}async parseListValue(e,t,r,a,o,n){let s=[],p=r.propertyType==="DatatypeProperty";for(let f of t){if(p&&(typeof f=="string"||typeof f=="number"||typeof f=="boolean")){let i=new R;i.value=f,s.push(i);continue}if(p&&f instanceof Date){let i=new R;i.value=f.toISOString(),s.push(i);continue}if(typeof f=="string"){let i=await this.resolveReference(f,a,o);i&&s.push(i)}else if(typeof f=="object"&&f!==null&&!Array.isArray(f)){let i=new b;i.statement=await this.parseStatements(f,a,o,n,{}),s.push(i)}}let m=new K;return m.predicate=g.parse(e),m.object=s,m}async resolveReference(e,t,r){let a=await r.resolveEntityAsync(e,t);if(a){let n=new g;return n.subject=a.uri,n}let o=t.metadata?.namespace_;if(o){let{KanonakUri:n}=await import("./KanonakUri-4VJGV3FN.js"),s=o.version??{major:0,minor:0,patch:0,toString:()=>"0.0.0",equals:()=>!1,getHashCode:()=>0,compareTo:()=>0};if(e.includes(".")){let m=e.indexOf("."),f=e.substring(0,m),i=e.substring(m+1);if(t.metadata?.imports){for(let[u,y]of Object.entries(t.metadata.imports))for(let l of y)if((l.alias??l.packageName)===f){let d=new g;return d.subject=new n(u,l.packageName,i,l.version),d}}}let p=new g;return p.subject=new n(o.publisher,o.package_,e,s),p}return null}async saveKanonaks(e,t){let r=new Map;for(let a of e)a instanceof j&&a.namespace&&(r.has(a.namespace)||r.set(a.namespace,[]),r.get(a.namespace).push(a));for(let[a,o]of r){let n=await this.convertKanonaksToDocument(a,o),s=`${a.split("@")[0]}.yml`;await t.saveDocumentAsync(n,s)}}async serializeToYaml(e,t){let r=e.filter(n=>n instanceof j&&n.namespace===t);if(r.length===0)throw new Error(`No kanonaks found with namespace '${t}'`);let a=await this.convertKanonaksToDocument(t,r);return new E().save(a)}async convertKanonaksToDocument(e,t){let a={metadata:{namespace_:e,get allImports(){if(!this.imports)return[];let n=[];for(let s of Object.values(this.imports))n.push(...s);return n}},body:{}},o=new Map;for(let n of t){let s={};for(let p of n.statement){let[m,f]=this.convertStatementToProperty(p);m&&f!==null&&f!==void 0&&(s[m]=f),this.collectImportsFromStatement(p,e,o)}a.body[n.name]=s}return a}convertStatementToProperty(e){if(e instanceof S)return[e.predicate.subject.name,e.object];if(e instanceof D)return[e.predicate.subject.name,e.object];if(e instanceof O)return[e.predicate.subject.name,e.object];if(e instanceof P)return[e.predicate.subject.name,e.object.subject.name];if(e instanceof K){let t=this.convertKanonakListToValue(e.object);return[e.predicate.subject.name,t]}else if(e instanceof w){let t=this.convertEmbeddedKanonakToValue(e.object);return[e.predicate.subject.name,t]}return[null,null]}convertKanonakListToValue(e){let t=[];for(let r of e)r instanceof g?t.push(r.subject.name):r instanceof b&&t.push(this.convertEmbeddedKanonakToValue(r));return t}convertEmbeddedKanonakToValue(e){let t={};for(let r of e.statement){let[a,o]=this.convertStatementToProperty(r);a&&o!==null&&o!==void 0&&(t[a]=o)}return t}collectImportsFromStatement(e,t,r){}};function v(c){let e=c.predicate?.subject;return(e?`${e.publisher}/${e.package_}/${e.name}`:"?")+"="+X(c)}function X(c){return c instanceof I?"m:"+String(c.object):c instanceof S?"s:"+String(c.object):c instanceof D?"n:"+String(c.object):c instanceof O?"b:"+String(c.object):c instanceof P?"r:"+A(c.object):c instanceof w?"e:"+A(c.object):c instanceof K?"l:["+(c.object??[]).map(A).join("|")+"]":"x"}function A(c){if(!c)return"";if(c instanceof g){let e=c.subject;return"R("+(e?`${e.publisher}/${e.package_}/${e.name}`:"")+")"}return c instanceof b?"E("+(c.statement??[]).map(v).join(";")+")":c instanceof R?"L("+String(c.value)+")":"N"}export{b as a,R as b,I as c,Q as d,T as e,C as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="kanonak.org",a="transformations",i=3,e=r=>({publisher:t,package_:a,name:r}),n={Transformation:e("Transformation"),InstanceTransformation:e("InstanceTransformation"),SetTransformation:e("SetTransformation"),inputPattern:e("inputPattern"),rule:e("rule"),artifactName:e("artifactName"),outputs:e("outputs"),formatOverrides:e("formatOverrides"),partitionBy:e("partitionBy"),InputPattern:e("InputPattern"),matchesClass:e("matchesClass"),requires:e("requires"),sortBy:e("sortBy"),SortKey:e("SortKey"),byProperty:e("byProperty"),order:e("order"),SortOrder:e("SortOrder"),ascending:e("ascending"),descending:e("descending"),OutputFormat:e("OutputFormat"),backendUri:e("backendUri"),FormatOverride:e("FormatOverride"),formatTarget:e("formatTarget"),metadataKeys:e("metadataKeys"),metadataRenames:e("metadataRenames"),trailingNewline:e("trailingNewline"),omitWrapper:e("omitWrapper"),RenameEntry:e("RenameEntry"),fromKey:e("fromKey"),toKey:e("toKey"),FMT_MARKDOWN_FRONTMATTER:e("markdown-with-frontmatter"),FMT_PLAIN_MARKDOWN:e("plain-markdown"),FMT_TOML:e("toml"),FMT_JSON:e("json"),FMT_HTML:e("html"),FMT_SVG:e("svg"),Expression:e("Expression"),ListSourcedExpression:e("ListSourcedExpression"),ListAggregate:e("ListAggregate"),IteratingExpression:e("IteratingExpression"),BuildAstNode:e("BuildAstNode"),astClass:e("astClass"),set:e("set"),AstFieldBinding:e("AstFieldBinding"),field:e("field"),bindValue:e("bindValue"),When:e("When"),condition:e("condition"),thenBuild:e("thenBuild"),elseBuild:e("elseBuild"),Concat:e("Concat"),parts:e("parts"),Fallback:e("Fallback"),primary:e("primary"),alternate:e("alternate"),StringLiteral:e("StringLiteral"),stringLiteral:e("stringLiteral"),IntegerLiteral:e("IntegerLiteral"),integerLiteral:e("integerLiteral"),DecimalLiteral:e("DecimalLiteral"),decimalLiteral:e("decimalLiteral"),BooleanLiteral:e("BooleanLiteral"),booleanLiteral:e("booleanLiteral"),VarRef:e("VarRef"),varName:e("varName"),PropertyRead:e("PropertyRead"),readSource:e("readSource"),readProp:e("readProp"),Traverse:e("Traverse"),traverseSource:e("traverseSource"),through:e("through"),step:e("step"),UriName:e("UriName"),uriNameOf:e("uriNameOf"),UriPublisher:e("UriPublisher"),uriPublisherOf:e("uriPublisherOf"),UriPackage:e("UriPackage"),uriPackageOf:e("uriPackageOf"),UriVersion:e("UriVersion"),uriVersionOf:e("uriVersionOf"),SubjectUri:e("SubjectUri"),subjectOf:e("subjectOf"),UriLiteral:e("UriLiteral"),refTo:e("refTo"),DisplayLabel:e("DisplayLabel"),labelTarget:e("labelTarget"),labelSource:e("labelSource"),ResolveRef:e("ResolveRef"),resolveSource:e("resolveSource"),Normalize:e("Normalize"),normSource:e("normSource"),normKind:e("normKind"),NormalizeKind:e("NormalizeKind"),NORM_TRIM_END:e("trim-end"),NORM_TO_UPPER:e("to-upper"),NORM_TO_LOWER:e("to-lower"),NORM_FIRST_CHAR:e("first-char"),UnescapedString:e("UnescapedString"),unescapedSource:e("unescapedSource"),IsSet:e("IsSet"),checkExpr:e("checkExpr"),ExpressionFragment:e("ExpressionFragment"),body:e("body"),CallFragment:e("CallFragment"),fragmentRef:e("fragmentRef"),source:e("source"),Join:e("Join"),separator:e("separator"),Count:e("Count"),Sum:e("Sum"),Min:e("Min"),Max:e("Max"),Average:e("Average"),loopVar:e("loopVar"),ForEach:e("ForEach"),emit:e("emit"),ListMap:e("ListMap"),mapBody:e("mapBody"),Filter:e("Filter"),predicate:e("predicate"),PartitionBy:e("PartitionBy"),partitionKey:e("partitionKey"),DistinctBy:e("DistinctBy"),distinctKey:e("distinctKey"),Partition:e("Partition"),key:e("key"),members:e("members"),AllStatements:e("AllStatements"),statementsOf:e("statementsOf"),StatementPredicate:e("StatementPredicate"),predicateOf:e("predicateOf"),StatementValue:e("StatementValue"),valueOf:e("valueOf"),DateFormat:e("DateFormat"),dateSource:e("dateSource"),dateFormat:e("dateFormat"),BinaryArithmetic:e("BinaryArithmetic"),arithLeft:e("arithLeft"),arithRight:e("arithRight"),Add:e("Add"),Subtract:e("Subtract"),Multiply:e("Multiply"),Divide:e("Divide"),Reverse:e("Reverse"),WindowedMap:e("WindowedMap"),windowSize:e("windowSize"),windowVar:e("windowVar"),windowBody:e("windowBody"),PairwiseMap:e("PairwiseMap"),firstVar:e("firstVar"),secondVar:e("secondVar"),pairBody:e("pairBody"),Scan:e("Scan"),initialState:e("initialState"),stateVar:e("stateVar"),elementVar:e("elementVar"),accumulate:e("accumulate"),ListItemAt:e("ListItemAt"),itemIndex:e("itemIndex"),BinaryComparison:e("BinaryComparison"),compareLeft:e("compareLeft"),compareRight:e("compareRight"),Equals:e("Equals"),GreaterThan:e("GreaterThan"),LessThan:e("LessThan"),GreaterThanOrEqual:e("GreaterThanOrEqual"),LessThanOrEqual:e("LessThanOrEqual"),Not:e("Not"),operand:e("operand"),BooleanLogic:e("BooleanLogic"),operands:e("operands"),And:e("And"),Or:e("Or"),Contains:e("Contains"),haystack:e("haystack"),needle:e("needle"),UnaryNumericOp:e("UnaryNumericOp"),value:e("value"),Abs:e("Abs"),Negate:e("Negate"),KindPredicate:e("KindPredicate"),IsReference:e("IsReference"),IsEmbedded:e("IsEmbedded"),IsList:e("IsList"),kindCheck:e("kindCheck"),IsString:e("IsString"),IsNumber:e("IsNumber"),IsBoolean:e("IsBoolean"),StatementObject:e("StatementObject"),statementSource:e("statementSource"),Let:e("Let"),letName:e("letName"),letValue:e("letValue"),letBody:e("letBody"),GetStatementByName:e("GetStatementByName"),inSubject:e("inSubject"),byName:e("byName"),RenderMarkdown:e("RenderMarkdown"),renderSource:e("renderSource"),renderProp:e("renderProp"),renderFormat:e("renderFormat"),RenderFormat:e("RenderFormat"),RENDER_HTML:e("render-html"),RENDER_MARKDOWN:e("render-markdown")};export{t as a,a as b,i as c,n as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"./chunk-SC5M74NM.js";import{a as d}from"./chunk-ORFSMEMM.js";var k="https://{publisher}/index.txt",x="https://{publisher}/{package}/{version}.kan.yml",v={version:1};function F(a){return{version:1,index:k.replaceAll("{publisher}",a),package:x.replaceAll("{publisher}",a),auth:"none"}}var h=class{cache=new Map;getConfig(n){let e=this.cache.get(n);return e||(e=this.fetchConfig(n),this.cache.set(n,e),e.catch(()=>{this.cache.get(n)===e&&this.cache.delete(n)})),e}async fetchConfig(n){let e=`https://${n}/.well-known/kanonak.json`,r;try{r=await fetch(e)}catch{return v}if(r.status===404)return v;if(!r.ok)throw new Error(`Failed to fetch publisher config: ${e} (${r.status} ${r.statusText})`);let t=await r.json();if(typeof t.version!="number")throw new Error(`Invalid publisher config at ${e}: missing or invalid "version" field`);let s={version:t.version};return typeof t.index=="string"&&(s.index=t.index),typeof t.package=="string"&&(s.package=t.package),(t.auth==="none"||t.auth==="oauth"||t.auth==="bearer")&&(s.auth=t.auth),Array.isArray(t.render)&&t.render.every(i=>typeof i=="string")&&(s.render=t.render),s}resolveIndexUrl(n,e){let r=e.index??k;return y(r,{publisher:n})}resolvePackageUrl(n,e,r,t){let s=t.package??x;return y(s,{publisher:n,package:e,version:r})}};function y(a,n){let e=a;for(let[t,s]of Object.entries(n))e=e.replaceAll(`{${t}}`,s);let r=e.match(/\{[a-z]+\}/);if(r)throw new Error(`Unresolved variable ${r[0]} in URL template: ${a}`);return e}import{VersionOperator as l}from"@kanonak-protocol/types/document/models/enums";var g=class a{indexCache=new Map;configResolver;fetchFn;constructor(n){this.configResolver=n?.configResolver??new h,this.fetchFn=n?.fetchFn}async resolveVersion(n,e){let r=await this.getPackageVersions(n,e.packageName);if(r.length===0)return null;let t=r.filter(s=>this.isVersionCompatible(s,e.version,e.versionOperator));return t.length===0?null:(t.sort((s,i)=>this.compareVersionStrings(i,s)),t[0])}async getHighestVersion(n,e){let r=await this.getPackageVersions(n,e);return r.length===0?null:[...r].sort((s,i)=>this.compareVersionStrings(i,s))[0]}async listLatestPackages(n){let e=await this.getIndex(n),r=[];for(let[t,s]of e){if(s.length===0)continue;let i=[...s].sort((o,c)=>this.compareVersionStrings(c,o));r.push({packageName:t,version:i[0]})}return r.sort((t,s)=>t.packageName.localeCompare(s.packageName)),r}async getPackageUrl(n,e,r){let t=await this.configResolver.getConfig(n);return this.configResolver.resolvePackageUrl(n,e,r,t)}async getPackageVersions(n,e){return(await this.getIndex(n)).get(e)??[]}getIndex(n){let e=this.indexCache.get(n);return e||(e=this.fetchIndex(n),this.indexCache.set(n,e),e.catch(()=>{this.indexCache.get(n)===e&&this.indexCache.delete(n)})),e}async fetchIndex(n){let e=await this.configResolver.getConfig(n),r=this.configResolver.resolveIndexUrl(n,e),t=this.fetchFn?await this.fetchFn(r,n):await fetch(r);if(!t.ok)throw new Error(`Failed to fetch publisher index: ${r} (${t.status} ${t.statusText})`);let s=await t.text();return a.parseIndex(s)}static parseIndex(n){let e=new Map;for(let r of n.split(`
|
|
2
|
+
`)){let t=r.trim();if(!t||t.startsWith("#"))continue;let s=t.indexOf("/");if(s===-1)continue;let i=t.substring(0,s),o=t.substring(s+1);if(!i||!o)continue;let c=e.get(i);c?c.push(o):e.set(i,[o])}return e}isVersionCompatible(n,e,r){let t=a.parseVersion(n);if(!t)return!1;switch(r){case l.Any:return!0;case l.Exact:return t.major===e.major&&t.minor===e.minor&&t.patch===e.patch;case l.Compatible:return t.major===e.major&&t.minor===e.minor&&t.patch>=e.patch;case l.Major:return t.major!==e.major?!1:t.minor>e.minor?!0:t.minor===e.minor?t.patch>=e.patch:!1;default:return!1}}static parseVersion(n){let e=n.split(".");if(e.length<2)return null;let r=parseInt(e[0],10),t=parseInt(e[1],10),s=e.length>=3?parseInt(e[2],10):0;return isNaN(r)||isNaN(t)||isNaN(s)?null:{major:r,minor:t,patch:s}}compareVersionStrings(n,e){let r=a.parseVersion(n),t=a.parseVersion(e);return!r&&!t?0:r?t?r.major!==t.major?r.major-t.major:r.minor!==t.minor?r.minor-t.minor:r.patch-t.patch:1:-1}};var P=class{parser=new d;publisherIndex;documents=new Map;contentCache=new Map;fetchFn;onFetch;getFromCache;constructor(n){this.onFetch=n?.onFetch,this.getFromCache=n?.getFromCache,this.fetchFn=n?.fetchFn,this.publisherIndex=n?.fetchFn?new g({fetchFn:n.fetchFn}):new g}async getHighestCompatibleVersionAsync(n,e){let r=await this.publisherIndex.resolveVersion(n,e);if(!r)return null;let t=`${n}/${e.packageName}@${r}`,s=this.documents.get(t);if(s)return s;if(this.getFromCache){let m=this.getFromCache(n,e.packageName,r);if(m){let p=this.parser.parse(m);return f(p,n,e.packageName,r),this.documents.set(t,p),this.contentCache.set(t,m),p}}let i=await this.publisherIndex.getPackageUrl(n,e.packageName,r),o=this.fetchFn?await this.fetchFn(i,n):await fetch(i);if(!o.ok)throw new Error(`Failed to fetch Kanonak package: ${i} (${o.status} ${o.statusText})`);let c=await o.text(),u=this.parser.parse(c);return f(u,n,e.packageName,r),this.onFetch&&this.onFetch(n,e.packageName,r,c),this.documents.set(t,u),this.contentCache.set(t,c),u}async getAllDocumentsAsync(){return Array.from(this.documents.values())}async getDocumentAsync(n){return this.documents.get(n)??null}async getDocumentsByNamespaceAsync(n,e){return Array.from(this.documents.values()).filter(r=>{let t=r.metadata.namespace_;return t&&t.publisher===n&&t.package_===e})}async saveDocumentAsync(n,e){throw new Error("HttpKanonakDocumentRepository is read-only")}async deleteDocumentAsync(n){throw new Error("HttpKanonakDocumentRepository is read-only")}async clearNamespaceAsync(n,e){throw new Error("HttpKanonakDocumentRepository is read-only")}async getAllDocumentReferencesAsync(){return[]}async getDocumentContentAsync(n){return this.contentCache.get(n)??null}async getDocumentUriAsync(n){let e=n.match(/^(.+?)\/(.+?)@(.+)$/);if(!e)return null;let[,r,t,s]=e;return this.publisherIndex.getPackageUrl(r,t,s)}};export{F as a,h as b,g as c,P as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D}from"./chunk-PODBS4IU.js";import{c as j,d as m,g as R,j as p,k as K,l as k}from"./chunk-W6T7MOKY.js";import{c as b,g as u}from"./chunk-2ACBWC7K.js";function F(a,e,n,t){let i=g(a);if(i.length>0){let s=v(i,e,n);return s?{transformation:s.transformation,source:"instance"}:void 0}let r=new Set,o=O(a);for(;o.length>0;){let s=o.shift(),f=_(s.subject);if(r.has(f))continue;r.add(f);let l=S(t,s.subject);if(l.length===0)continue;let U=l.flatMap(g),h=v(U,e,n);if(h)return{transformation:h.transformation,source:{publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name}};for(let T of l)for(let P of $(T))o.push(P)}let c={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"};if(!r.has(_(c))){let s=S(t,c).flatMap(g),f=v(s,e,n);if(f)return{transformation:f.transformation,source:c}}}function g(a){let e=[];for(let n of a.statement)if(n instanceof k&&d(n,"kanonak.org","derivation","derivations"))for(let t of n.object??[]){if(!(t instanceof D))continue;let i=x(t);i&&e.push(i)}return e}function v(a,e,n){let t=a.filter(o=>E(o.format,e)&&E(o.variant,n));if(t.length<=1)return t[0];let i=t[0].transformation,r=t[0];for(let o of t){let c=o.transformation;if(c.publisher!==i.publisher||c.package_!==i.package_||c.name!==i.name)continue;let s=u(r.transformation.version),f=u(c.version);s&&f&&b(f,s)>0&&(r=o)}return r}function x(a){let e,n,t;for(let i of a.statement)i instanceof p?d(i,"kanonak.org","derivation","format")?e=y(i):d(i,"kanonak.org","derivation","variant")&&(n=y(i)):i instanceof K&&d(i,"kanonak.org","derivation","transformation")&&(t=C(i.object));if(!(!e||!t))return n||(n={publisher:"kanonak.org",package_:"derivation",name:"default"}),{format:e,variant:n,transformation:t}}function C(a){let e,n,t,i;for(let r of a.statement){if(!(r instanceof R))continue;let o=r.predicate?.subject?.name;o==="publisher"?e=r.object:o==="package"?n=r.object:o==="version"?t=r.object:o==="name"&&(i=r.object)}if(!(!e||!n||!t||!i))return{publisher:e,package_:n,version:t,name:i}}function O(a){let e=[];for(let n of a.statement)n instanceof p&&n.predicate?.subject?.name==="type"&&n.object instanceof m&&e.push(n.object);return e}function $(a){let e=[];for(let n of a.statement)if(n instanceof p){if(n.predicate?.subject?.name!=="subClassOf")continue;n.object instanceof m&&e.push(n.object)}else if(n instanceof k){if(n.predicate?.subject?.name!=="subClassOf")continue;for(let t of n.object??[])t instanceof m&&e.push(t)}return e}function S(a,e){let n=[];for(let t of a){if(!(t instanceof j)||t.name!==e.name)continue;(t.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&n.push(t)}return n.sort((t,i)=>{let r=u((t.namespace||"").split("@")[1]??""),o=u((i.namespace||"").split("@")[1]??"");return!r||!o?0:b(o,r)}),n}function d(a,e,n,t){let i=a.predicate?.subject;return i?i.publisher===e&&i.package_===n&&i.name===t:!1}function y(a){let e=a.object.subject;return{publisher:e.publisher,package_:e.package_,name:e.name}}function E(a,e){return a.publisher===e.publisher&&a.package_===e.package_&&a.name===e.name}function _(a){return`${a.publisher}/${a.package_}/${a.name}`}export{F as a};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import{a as ue,c as v}from"./chunk-Q6QTQWR2.js";import{a as le,c as ye}from"./chunk-H2LEQLVD.js";import{a as ae}from"./chunk-ORFSMEMM.js";import{d as de,f as ge,g as he}from"./chunk-N224PFBI.js";import{i as fe,l as J}from"./chunk-Q4DKP5DO.js";import{a as P,b as D,c as me}from"./chunk-64TVBQFR.js";import{c as G,k as ce,l as pe}from"./chunk-W6T7MOKY.js";import{e as V}from"./chunk-2ACBWC7K.js";var A=class{isValid=!1;errors=[];warnings=[];get totalIssues(){return this.errors.length+this.warnings.length}};var R=(r=>(r.Warning="Warning",r.Error="Error",r))(R||{});var g=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var te=class d{resolvedDocuments=[];currentEntityPath;withPath(e){let r=new d;return r.resolvedDocuments=this.resolvedDocuments,r.currentEntityPath=e,r}};var oe=class{constructor(e){this.underlying=e;this.repository=new ne(e)}underlying;repository;kanonaksPromise=null;importClosureCache=new Map;classDeclarationsCache=new Map;propertyNamesCache=new Map;allDocumentsPromise=null;getKanonaks(){return this.kanonaksPromise||(this.kanonaksPromise=new v().parseKanonaks(this.underlying)),this.kanonaksPromise}async getImportClosure(e){let r=this.importClosureCache.get(e);return r||(r=this.computeImportClosure(e),this.importClosureCache.set(e,r),r)}async getClassDeclarations(e){let r=this.classDeclarationsCache.get(e);return r||(r=this.computeClassDeclarations(e),this.classDeclarationsCache.set(e,r),r)}async getPropertyNames(e){let r=this.propertyNamesCache.get(e);return r||(r=this.computePropertyNames(e),this.propertyNamesCache.set(e,r),r)}getAllDocuments(){return this.allDocumentsPromise||(this.allDocumentsPromise=this.underlying.getAllDocumentsAsync()),this.allDocumentsPromise}async computeImportClosure(e){let r=new Set([e]),t=[e],o=await this.buildDocsByIdIndex();for(;t.length>0;){let s=t.shift(),i=o.get(s);if(i?.metadata.imports)for(let[n,l]of Object.entries(i.metadata.imports))for(let a of l){let c=await this.repository.getHighestCompatibleVersionAsync(n,a);if(!c)continue;let p=re(c);!p||r.has(p)||(r.add(p),t.push(p))}}return r}async buildDocsByIdIndex(){let e=await this.getAllDocuments(),r=new Map;for(let t of e){let o=re(t);o&&r.set(o,t)}return r}async computeClassDeclarations(e){let r=await this.findDocById(e),t=new Map;if(!r)return t;for(let[o,s]of Object.entries(r.body)){if(!be(s))continue;let i=s,n=Re(i,"type");if(n==="Class"||n?.endsWith(".Class")){let l=ve(i);t.set(o,l)}}return t}async computePropertyNames(e){let r=await this.findDocById(e),t=new Set;if(!r)return t;for(let[o,s]of Object.entries(r.body)){if(!be(s))continue;let n=Re(s,"type");(n==="ObjectProperty"||n?.endsWith(".ObjectProperty")||n==="DatatypeProperty"||n?.endsWith(".DatatypeProperty")||n==="AnnotationProperty"||n?.endsWith(".AnnotationProperty")||n==="Property"||n?.endsWith(".Property"))&&t.add(o)}return t}async findDocById(e){let r=await this.getAllDocuments();for(let t of r)if(re(t)===e)return t}};function re(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${V(e.version)}`}function be(d){return typeof d=="object"&&d!==null&&!Array.isArray(d)}function Re(d,e){if(e in d)return ke(d[e]);for(let r of Object.keys(d))if(r.endsWith(`.${e}`))return ke(d[r])}function ke(d){return Array.isArray(d)?d.length>0?String(d[0]):void 0:d==null?void 0:String(d)}function ve(d){let e=d.subClassOf;if(e===void 0){for(let r of Object.keys(d))if(r.endsWith(".subClassOf")){e=d[r];break}}return P(e)}var ne=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,r){let t=`${e}/${r}`,o=this.byNamespaceCache.get(t);return o||(o=this.inner.getDocumentsByNamespaceAsync(e,r),this.byNamespaceCache.set(t,o),o)}getHighestCompatibleVersionAsync(e,r){let t=r.version,o=t?`${t.major}.${t.minor}.${t.patch}`:"",s=`${e}/${r.packageName}@${r.versionOperator}:${o}`,i=this.highestVersionCache.get(s);return i||(i=this.inner.getHighestCompatibleVersionAsync(e,r),this.highestVersionCache.set(s,i),i)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};var I=class d{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):/i;ruleName="NamespacePrefix";validate(e){let r=[];for(let[t,o]of Object.entries(e.body))o&&typeof o=="object"&&!Array.isArray(o)&&this.validateEntity(t,o,r);return r}validateEntity(e,r,t){for(let[o,s]of Object.entries(r)){let i=s?.toString()??"";if(i&&d.NAMESPACE_PREFIX_PATTERN.test(i)){let n=this.getSuggestionForPrefixedValue(i),l=e.split(".")[0],a=new g;a.ruleType=this.ruleName,a.severity="Error",a.entityName=l,a.propertyName=e,a.actualValue=o,a.expectedValue=n,a.message=`Invalid namespace prefix '${i}'. Use '${n}' without prefix.`,a.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",t.push(a)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validateEntity(`${e}.${o}`,s,t)}}getSuggestionForPrefixedValue(e){let r=e.toLowerCase();if(r==="rdfs:class"||r==="owl:class")return"Class";if(r==="rdfs:property"||r==="rdf:property")return"DatatypeProperty or ObjectProperty";if(r.startsWith("xsd:"))return e.substring(4);let t=e.indexOf(":");return t>=0?e.substring(t+1):e}};var O=class d{static RESERVED_WORDS=new Set(["kanonak","imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let r=[],t=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[o,s]of Object.entries(e.body)){let i=d.VALID_AUGMENTATION_PATTERN.test(o);if(!i&&!t&&d.RESERVED_WORDS.has(o.toLowerCase())){let n=new g;n.ruleType=this.ruleName,n.severity="Error",n.entityName=o,n.message=`Entity name '${o}' is a reserved word and cannot be used.`,n.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",r.push(n);continue}if(!i&&!d.VALID_NAME_PATTERN.test(o)){let n;/^\d/.test(o)?n="Entity names must start with a letter, not a number.":o.includes(" ")?n="Entity names cannot contain spaces. Use camelCase or underscores instead.":n="Entity names must start with a letter and contain only letters, numbers, and underscores.";let l=new g;l.ruleType=this.ruleName,l.severity="Error",l.entityName=o,l.message=`Invalid entity name '${o}'. ${n}`,l.suggestion=n,r.push(l)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validatePropertyNames(o,s,r)}return r}validatePropertyNames(e,r,t){for(let o of Object.keys(r))if(!d.VALID_PROPERTIES.has(o)&&!d.VALID_PROPERTY_NAME_PATTERN.test(o)){let s=new g;s.ruleType=this.ruleName,s.severity="Warning",s.entityName=e,s.propertyName=o,s.message=`Property name '${o}' in entity '${e}' doesn't follow naming conventions.`,s.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",t.push(s)}}};var w=class d{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let r=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return r;let t=this.isPropertyDefinedAsClass(e);for(let[o,s]of Object.entries(e.body))if(s&&typeof s=="object"&&!Array.isArray(s)){let i=s,n=i.type;if(n){let l=[];if(Array.isArray(n))for(let a of n){let c=a?.toString();c&&c==="Property"&&!t&&l.push(c)}else{let a=n?.toString();a&&a==="Property"&&!t&&l.push(a)}for(let a of l){let c=this.getPropertyValue(i,"range"),p=this.determinePropertyType(c),y=new g;y.ruleType=this.ruleName,y.severity="Error",y.entityName=o,y.propertyName="type",y.actualValue=a,y.expectedValue=p,y.message=`Invalid property type '${a}'. Use '${p}' instead.`,y.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",r.push(y)}}}return r}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":d.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,r){let t=e[r];return t?t.toString():null}isPropertyDefinedAsClass(e){let r=e.body.Property;if(r&&typeof r=="object"&&!Array.isArray(r)){let o=r.type;if(o){let s=o.toString();return s==="Class"||s.endsWith(".Class")}}return!1}};var j=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let r=[];for(let[t,o]of Object.entries(e.body)){if(typeof o!="object"||o===null||Array.isArray(o)||t.includes("."))continue;let s=o,i="type"in s,n=s.type?.toString().trim();if(!i||!n){let l=new g;l.ruleType=this.ruleName,l.severity="Error",l.entityName=t,l.propertyName="type",l.message=`Subject Kanonak '${t}' must have a 'type' property.`,l.suggestion=`Add a type statement like:
|
|
1
|
+
import{d as A}from"./chunk-SHDHMKMJ.js";import{a as ee,c as ke,d as Ve,f as D}from"./chunk-PODBS4IU.js";import{a as he}from"./chunk-ORFSMEMM.js";import{d as ae,f as le,g as Ae}from"./chunk-N224PFBI.js";import{d as ne,h as ve,i as ie,j as se,k as De,l as O}from"./chunk-Q4DKP5DO.js";import{a as V,b as v,c as Pe}from"./chunk-64TVBQFR.js";import{c as I,k as be,l as Re}from"./chunk-W6T7MOKY.js";import{e as P}from"./chunk-2ACBWC7K.js";var w=class{isValid=!1;errors=[];warnings=[];get totalIssues(){return this.errors.length+this.warnings.length}};var R=(r=>(r.Warning="Warning",r.Error="Error",r))(R||{});var g=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let e="";return this.lineNumber!==void 0&&(e+=`Line ${this.lineNumber}: `),this.entityName&&(e+=`[${this.entityName}] `),e+=this.message,e}};var ye=class d{resolvedDocuments=[];currentEntityPath;withPath(e){let r=new d;return r.resolvedDocuments=this.resolvedDocuments,r.currentEntityPath=e,r}};var ue=class{constructor(e){this.underlying=e;this.repository=new fe(e)}underlying;repository;kanonaksPromise=null;importClosureCache=new Map;classDeclarationsCache=new Map;propertyNamesCache=new Map;allDocumentsPromise=null;getKanonaks(){return this.kanonaksPromise||(this.kanonaksPromise=new D().parseKanonaks(this.underlying)),this.kanonaksPromise}async getImportClosure(e){let r=this.importClosureCache.get(e);return r||(r=this.computeImportClosure(e),this.importClosureCache.set(e,r),r)}async getClassDeclarations(e){let r=this.classDeclarationsCache.get(e);return r||(r=this.computeClassDeclarations(e),this.classDeclarationsCache.set(e,r),r)}async getPropertyNames(e){let r=this.propertyNamesCache.get(e);return r||(r=this.computePropertyNames(e),this.propertyNamesCache.set(e,r),r)}getAllDocuments(){return this.allDocumentsPromise||(this.allDocumentsPromise=this.underlying.getAllDocumentsAsync()),this.allDocumentsPromise}async computeImportClosure(e){let r=new Set([e]),t=[e],o=await this.buildDocsByIdIndex();for(;t.length>0;){let s=t.shift(),i=o.get(s);if(i?.metadata.imports)for(let[n,l]of Object.entries(i.metadata.imports))for(let a of l){let c=await this.repository.getHighestCompatibleVersionAsync(n,a);if(!c)continue;let p=me(c);!p||r.has(p)||(r.add(p),t.push(p))}}return r}async buildDocsByIdIndex(){let e=await this.getAllDocuments(),r=new Map;for(let t of e){let o=me(t);o&&r.set(o,t)}return r}async computeClassDeclarations(e){let r=await this.findDocById(e),t=new Map;if(!r)return t;for(let[o,s]of Object.entries(r.body)){if(!Ie(s))continue;let i=s,n=Oe(i,"type");if(n==="Class"||n?.endsWith(".Class")){let l=Se(i);t.set(o,l)}}return t}async computePropertyNames(e){let r=await this.findDocById(e),t=new Set;if(!r)return t;for(let[o,s]of Object.entries(r.body)){if(!Ie(s))continue;let n=Oe(s,"type");(n==="ObjectProperty"||n?.endsWith(".ObjectProperty")||n==="DatatypeProperty"||n?.endsWith(".DatatypeProperty")||n==="AnnotationProperty"||n?.endsWith(".AnnotationProperty")||n==="Property"||n?.endsWith(".Property"))&&t.add(o)}return t}async findDocById(e){let r=await this.getAllDocuments();for(let t of r)if(me(t)===e)return t}};function me(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}function Ie(d){return typeof d=="object"&&d!==null&&!Array.isArray(d)}function Oe(d,e){if(e in d)return we(d[e]);for(let r of Object.keys(d))if(r.endsWith(`.${e}`))return we(d[r])}function we(d){return Array.isArray(d)?d.length>0?String(d[0]):void 0:d==null?void 0:String(d)}function Se(d){let e=d.subClassOf;if(e===void 0){for(let r of Object.keys(d))if(r.endsWith(".subClassOf")){e=d[r];break}}return V(e)}var fe=class{constructor(e){this.inner=e}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,r){let t=`${e}/${r}`,o=this.byNamespaceCache.get(t);return o||(o=this.inner.getDocumentsByNamespaceAsync(e,r),this.byNamespaceCache.set(t,o),o)}getHighestCompatibleVersionAsync(e,r){let t=r.version,o=t?`${t.major}.${t.minor}.${t.patch}`:"",s=`${e}/${r.packageName}@${r.versionOperator}:${o}`,i=this.highestVersionCache.get(s);return i||(i=this.inner.getHighestCompatibleVersionAsync(e,r),this.highestVersionCache.set(s,i),i)}saveDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}deleteDocumentAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}clearNamespaceAsync(){throw new Error("CachingRepository is read-only during a validation pass.")}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};var E=class d{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):/i;ruleName="NamespacePrefix";validate(e){let r=[];for(let[t,o]of Object.entries(e.body))o&&typeof o=="object"&&!Array.isArray(o)&&this.validateEntity(t,o,r);return r}validateEntity(e,r,t){for(let[o,s]of Object.entries(r)){let i=s?.toString()??"";if(i&&d.NAMESPACE_PREFIX_PATTERN.test(i)){let n=this.getSuggestionForPrefixedValue(i),l=e.split(".")[0],a=new g;a.ruleType=this.ruleName,a.severity="Error",a.entityName=l,a.propertyName=e,a.actualValue=o,a.expectedValue=n,a.message=`Invalid namespace prefix '${i}'. Use '${n}' without prefix.`,a.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",t.push(a)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validateEntity(`${e}.${o}`,s,t)}}getSuggestionForPrefixedValue(e){let r=e.toLowerCase();if(r==="rdfs:class"||r==="owl:class")return"Class";if(r==="rdfs:property"||r==="rdf:property")return"DatatypeProperty or ObjectProperty";if(r.startsWith("xsd:"))return e.substring(4);let t=e.indexOf(":");return t>=0?e.substring(t+1):e}};var j=class d{static RESERVED_WORDS=new Set(["kanonak","imports","namespace","type","label","comment","subclassof","domain","range","required","functional"]);static VALID_PROPERTIES=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","required","functional","inverseOf","transitive","symmetric","inverseFunctional"]);static VALID_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_AUGMENTATION_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;static VALID_PROPERTY_NAME_PATTERN=/^[a-zA-Z][a-zA-Z0-9_.]*$/;ruleName="ResourceNaming";validate(e){let r=[],t=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[o,s]of Object.entries(e.body)){let i=d.VALID_AUGMENTATION_PATTERN.test(o);if(!i&&!t&&d.RESERVED_WORDS.has(o.toLowerCase())){let n=new g;n.ruleType=this.ruleName,n.severity="Error",n.entityName=o,n.message=`Entity name '${o}' is a reserved word and cannot be used.`,n.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",r.push(n);continue}if(!i&&!d.VALID_NAME_PATTERN.test(o)){let n;/^\d/.test(o)?n="Entity names must start with a letter, not a number.":o.includes(" ")?n="Entity names cannot contain spaces. Use camelCase or underscores instead.":n="Entity names must start with a letter and contain only letters, numbers, and underscores.";let l=new g;l.ruleType=this.ruleName,l.severity="Error",l.entityName=o,l.message=`Invalid entity name '${o}'. ${n}`,l.suggestion=n,r.push(l)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validatePropertyNames(o,s,r)}return r}validatePropertyNames(e,r,t){for(let o of Object.keys(r))if(!d.VALID_PROPERTIES.has(o)&&!d.VALID_PROPERTY_NAME_PATTERN.test(o)){let s=new g;s.ruleType=this.ruleName,s.severity="Warning",s.entityName=e,s.propertyName=o,s.message=`Property name '${o}' in entity '${e}' doesn't follow naming conventions.`,s.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",t.push(s)}}};var $=class d{static XSD_TYPES=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","datetime","date","time","duration","anyuri","anysimpletype","nonnegativeinteger","positiveinteger","negativeinteger","nonpositiveinteger","unsignedint","unsignedlong","unsignedshort","unsignedbyte","base64binary","hexbinary"]);ruleName="PropertyTypeSpecificity";validate(e){let r=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return r;let t=this.isPropertyDefinedAsClass(e);for(let[o,s]of Object.entries(e.body))if(s&&typeof s=="object"&&!Array.isArray(s)){let i=s,n=i.type;if(n){let l=[];if(Array.isArray(n))for(let a of n){let c=a?.toString();c&&c==="Property"&&!t&&l.push(c)}else{let a=n?.toString();a&&a==="Property"&&!t&&l.push(a)}for(let a of l){let c=this.getPropertyValue(i,"range"),p=this.determinePropertyType(c),y=new g;y.ruleType=this.ruleName,y.severity="Error",y.entityName=o,y.propertyName="type",y.actualValue=a,y.expectedValue=p,y.message=`Invalid property type '${a}'. Use '${p}' instead.`,y.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",r.push(y)}}}return r}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":d.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,r){let t=e[r];return t?t.toString():null}isPropertyDefinedAsClass(e){let r=e.body.Property;if(r&&typeof r=="object"&&!Array.isArray(r)){let o=r.type;if(o){let s=o.toString();return s==="Class"||s.endsWith(".Class")}}return!1}};var S=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let r=[];for(let[t,o]of Object.entries(e.body)){if(typeof o!="object"||o===null||Array.isArray(o)||t.includes("."))continue;let s=o,i="type"in s,n=s.type?.toString().trim();if(!i||!n){let l=new g;l.ruleType=this.ruleName,l.severity="Error",l.entityName=t,l.propertyName="type",l.message=`Subject Kanonak '${t}' must have a 'type' property.`,l.suggestion=`Add a type statement like:
|
|
2
2
|
type: Scene
|
|
3
3
|
|
|
4
|
-
Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,l.expectedValue="A valid class name (Scene, Character, Story, etc.)",r.push(l)}}return r}};var
|
|
4
|
+
Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,l.expectedValue="A valid class name (Scene, Character, Story, etc.)",r.push(l)}}return r}};var C=class{get ruleName(){return"EmbeddedKanonakType"}async validateAsync(e,r){let t=[],o=new v(r),s=await this.buildPropertyRangeMap(e,o);for(let[i,n]of Object.entries(e.body))typeof n=="object"&&n!==null&&!Array.isArray(n)&&await this.checkEmbeddedTypes(i,n,void 0,s,o,e,t,0);return t}pickRange(e,r,t){if(e.length===0)return;if(e.length===1)return e[0].range;let o=r.indexOf(".");if(o>0){let s=r.substring(0,o),i=e.find(n=>n.declaringAlias===s);if(i)return i.range}if(t){let s=this.localName(t),i=e.find(n=>this.localName(n.domain)===s);if(i)return i.range}return e[0].range}async checkEmbeddedTypes(e,r,t,o,s,i,n,l){if(l>0){let c=r.type;if(c!=null){let p=await this.validateEmbeddedType(e,String(c),t,s,i);p&&n.push(p)}}let a=r.type!==void 0&&r.type!==null?String(r.type):void 0;for(let[c,p]of Object.entries(r)){let y=this.localName(c),m=o.get(y),f=(m!==void 0?this.pickRange(m,c,a):void 0)??t;if(typeof p=="object"&&p!==null)if(Array.isArray(p))for(let b=0;b<p.length;b++){let h=p[b];typeof h=="object"&&h!==null&&!Array.isArray(h)&&await this.checkEmbeddedTypes(`${e}.${c}[${b}]`,h,f,o,s,i,n,l+1)}else await this.checkEmbeddedTypes(`${e}.${c}`,p,f,o,s,i,n,l+1)}}async validateEmbeddedType(e,r,t,o,s){if(r.length===0||!t)return null;let i=this.localName(r),n=this.localName(t);if(n==="Resource"||n==="Class")return null;let l=e.split(".")[0];if(i===n){let c=new g;return c.ruleType=this.ruleName,c.severity="Warning",c.entityName=l,c.propertyName=e,c.actualValue=r,c.expectedValue=t,c.message=`Embedded object at '${e}' declares 'type: ${r}', which equals the parent property's range '${t}'. The declaration is redundant \u2014 the type is already inferred from the property's range.`,c.suggestion=`Remove the 'type: ${r}' line, or keep it if explicitness is preferred over concision.`,c}if(await o.isSubclassOfAsync(r,t,s)||(i!==r||n!==t)&&await o.isSubclassOfAsync(i,n,s))return null;let a=new g;return a.ruleType=this.ruleName,a.severity="Error",a.entityName=l,a.propertyName=e,a.actualValue=r,a.expectedValue=t,a.message=`Embedded object at '${e}' has 'type: ${r}', which is not a subclass of the parent property's range '${t}'.`,a.suggestion=`Either remove the 'type: ${r}' line (so the type is inferred from the property's range '${t}'), or add 'subClassOf: ${t}' to the '${r}' class definition so the relationship holds.`,a}localName(e){let r=e.lastIndexOf(".");return r<0||r===e.length-1?e:e.substring(r+1)}async buildPropertyRangeMap(e,r){let t=new Map,o=await r.buildEntityIndexAsync(e),s=new Map;for(let[i,n]of o){let l=n.entity.type;if(l==null)continue;let a=String(l),c=this.localName(a);if(!(c==="Property"||c==="DatatypeProperty"||c==="ObjectProperty"||c==="AnnotationProperty"))continue;let y=n.entity.range;if(y==null)continue;let m=String(y);if(m.length===0)continue;let u=n.entity.domain,f=u!=null?String(u):"",b=n.uri.toString(),h=s.get(b),k=i.includes(".");(!h||k&&!h.entityName.includes("."))&&s.set(b,{entityName:i,domain:f,range:m})}for(let i of s.values()){let n=this.localName(i.entityName),l=i.entityName.indexOf("."),a=l>0?i.entityName.substring(0,l):void 0,c=t.get(n)??[];c.push({domain:i.domain,range:i.range,declaringAlias:a}),t.set(n,c)}return t}};import{VersionOperator as ce}from"@kanonak-protocol/types/document/models/enums";var N=class{ruleName="ImportExistence";async validateAsync(e,r){let t=[];if(!e.metadata?.imports)return t;let o=await r.getAllDocumentsAsync();for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i)if(!await r.getHighestCompatibleVersionAsync(s,n)){let a=await this.determineImportErrorAsync(r,s,n,o),c=new g;c.ruleType=this.ruleName,c.severity="Error",c.message=a.message,c.suggestion=a.suggestion,c.entityName=`Import: ${s}/${n.packageName}`,c.actualValue=n.toString(),c.expectedValue=a.expectedValue,t.push(c)}return t}async determineImportErrorAsync(e,r,t,o){let s=await e.getDocumentsByNamespaceAsync(r,t.packageName);if(s.length===0){let a=o.filter(m=>m.metadata.namespace_?.publisher===r).map(m=>m.metadata.namespace_.package_).filter((m,u,f)=>f.indexOf(m)===u),c=this.findSimilarPackages(t.packageName,a),p=`Import '${r}/${t.package_}' not found - package does not exist`,y=c.length>0?`Did you mean: ${c.slice(0,3).join(", ")}?`:a.length>0?`Available packages in ${r}: ${a.slice(0,5).join(", ")}`:`No packages found for publisher '${r}'. Verify the publisher name is correct.`;return{message:p,suggestion:y,expectedValue:"Existing package"}}let n=s.filter(a=>a.metadata.namespace_?.version).map(a=>a.metadata.namespace_.version.toString()).sort().join(", "),l=this.getAcceptableVersionRange(t);return{message:`Import '${r}/${t.toString()}' version mismatch - no compatible version found`,suggestion:`Available versions: ${n}. Required: ${l}`,expectedValue:l}}getAcceptableVersionRange(e){switch(e.versionOperator){case ce.Exact:return`exactly ${e.version.major}.${e.version.minor}.${e.version.patch}`;case ce.Compatible:return`${e.version.major}.${e.version.minor}.${e.version.patch} to ${e.version.major}.${e.version.minor}.x`;case ce.Major:return e.version.major===0?`0.${e.version.minor}.x`:`${e.version.major}.x.x`;case ce.Any:return`any version >= ${e.version.major}.${e.version.minor}.${e.version.patch}`;default:return e.toString()}}findSimilarPackages(e,r){if(r.length===0)return[];let t=r.filter(i=>i.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(i.toLowerCase()));if(t.length>0)return t.sort((i,n)=>i.length-n.length);let o=r.map(i=>({package:i,distance:this.levenshteinDistance(e.toLowerCase(),i.toLowerCase())})).sort((i,n)=>i.distance-n.distance),s=Math.max(3,Math.floor(e.length*.4));return o.filter(i=>i.distance<=s).map(i=>i.package)}levenshteinDistance(e,r){if(!e||e.length===0)return r?.length??0;if(!r||r.length===0)return e.length;let t=e.length,o=r.length,s=Array(t+1).fill(null).map(()=>Array(o+1).fill(0));for(let i=0;i<=t;i++)s[i][0]=i;for(let i=0;i<=o;i++)s[0][i]=i;for(let i=1;i<=t;i++)for(let n=1;n<=o;n++){let l=e[i-1]===r[n-1]?0:1;s[i][n]=Math.min(Math.min(s[i-1][n]+1,s[i][n-1]+1),s[i-1][n-1]+l)}return s[t][o]}};var K=class{ruleName="UnresolvedReference";async validateAsync(e,r){let t=[],o=new v(r),s=await o.buildEntityIndexAsync(e),i=new Set;for(let[n,l]of s.entries()){let a=l.entity.type;if(a){let c=a.toString();(c==="ObjectProperty"||c.endsWith(".ObjectProperty"))&&i.add(n)}}for(let[n,l]of Object.entries(e.body)){if(!l||typeof l!="object"||Array.isArray(l))continue;let a=l,c=this.getPropertyValue(a,"type");if(!(!c||c==="Class"||c.endsWith("Property")||c==="AnnotationProperty"))for(let[p,y]of Object.entries(a))p==="type"||p==="label"||p==="comment"||!(i.has(p)||Array.from(i).some(u=>u.endsWith(`.${p}`)))||await this.validateReferenceValue(n,p,y,e,o,t)}return t}async validateReferenceValue(e,r,t,o,s,i){if(t!=null){if(typeof t=="string")await s.resolveEntityAsync(t,o)||i.push(this.createUnresolvedReferenceError(e,r,t));else if(Array.isArray(t))for(let n=0;n<t.length;n++){let l=t[n];typeof l=="string"&&(await s.resolveEntityAsync(l,o)||i.push(this.createUnresolvedReferenceError(e,`${r}[${n}]`,l)))}}}createUnresolvedReferenceError(e,r,t){let o=`The entity '${t}' cannot be found in the current document or any imported namespaces.
|
|
5
5
|
|
|
6
6
|
Possible solutions:
|
|
7
7
|
\u2022 Add import if the entity is defined in another namespace:
|
|
8
8
|
kanonak namespace add-import <publisher>/<package>@<version>
|
|
9
9
|
\u2022 Check for typos in the reference name '${t}'
|
|
10
10
|
\u2022 Define '${t}' in the current namespace or an appropriate namespace
|
|
11
|
-
\u2022 Use 'kanonak search type ${t} --include-imports' to locate the entity`,s=new g;return s.ruleType=this.ruleName,s.severity="Error",s.entityName=e,s.propertyName=r,s.actualValue=t,s.message=`Reference to '${t}' could not be resolved`,s.suggestion=o,s.expectedValue="A valid entity reference that exists in the current document or imported namespaces",s}getPropertyValue(e,r){let t=e[r];return t?t.toString():null}};var N=class{ruleName="ClassHierarchyCycle";async validateAsync(e,r){let t=[],o=new Map,s=new Set;await this.buildClassHierarchy(e,r,o,s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type,c=l.subClassOf;if(a?.toString()==="Class"&&c){let p=i,y=this.detectCycle(p,o);if(y){let m=y.join(" \u2192 "),u=new g;u.ruleType=this.ruleName,u.severity="Error",u.message=`Circular class hierarchy detected: ${m}`,u.suggestion="Remove the circular dependency by breaking one of the subClassOf relationships",u.entityName=p,u.propertyName="subClassOf",u.actualValue=m,t.push(u);break}}}return t}async buildClassHierarchy(e,r,t,o){let s=e.metadata?.namespace_?.toString()??"";if(!(s&&o.has(s))){s&&o.add(s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type,c=l.subClassOf;if(a?.toString()==="Class"&&c){let p=P(c);p.length>0&&t.set(i,p)}}if(e.metadata?.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);a&&await this.buildClassHierarchy(a,r,t,o)}}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){if(t.includes(e)){let i=t.indexOf(e),n=t.slice(i);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let s=r.get(e);if(s)for(let i of s){let n=this.detectCycleRecursive(i,r,t,o);if(n)return n}return t.pop(),null}};var C=class{ruleName="PropertyHierarchyCycle";async validateAsync(e,r){let t=[],o=new Map,s=new Set;await this.buildPropertyHierarchy(e,r,o,s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)&&n.subPropertyOf){let c=i,p=this.detectCycle(c,o);if(p){let y=p.join(" \u2192 "),m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular property hierarchy detected: ${y}`,m.suggestion="Remove the circular dependency by breaking one of the subPropertyOf relationships",m.entityName=c,m.propertyName="subPropertyOf",m.actualValue=y,t.push(m);break}}return t}async buildPropertyHierarchy(e,r,t,o){let s=e.metadata?.namespace_?.toString()??"";if(!(s&&o.has(s))){s&&o.add(s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type;if(a){let c=a.toString();if(c==="DatatypeProperty"||c==="ObjectProperty"||c==="AnnotationProperty"){let p=l.subPropertyOf;if(p){let y=P(p);y.length>0&&t.set(i,y)}}}}if(e.metadata?.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);a&&await this.buildPropertyHierarchy(a,r,t,o)}}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){if(t.includes(e)){let i=t.indexOf(e),n=t.slice(i);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let s=r.get(e);if(s)for(let i of s){let n=this.detectCycleRecursive(i,r,t,o);if(n)return n}return t.pop(),null}};var K=class{get ruleName(){return"PropertyRangeRequired"}async validateAsync(e,r){let t=[];for(let[o,s]of Object.entries(e.body)){if(typeof s!="object"||s===null||Array.isArray(s))continue;let i=s,n=i.type?.toString();if(n==="DatatypeProperty"||n==="ObjectProperty"||n?.endsWith(".DatatypeProperty")||n?.endsWith(".ObjectProperty")){let l="range"in i,a=i.range?.toString().trim();if(!l||!a){let c=new g;c.ruleType=this.ruleName,c.severity="Error",c.entityName=o,c.propertyName="range",c.message=`Property '${o}' must have a 'range' defined.`,c.suggestion=n==="DatatypeProperty"?"Add a range like: range: string (or integer, boolean, etc.)":"Add a range like: range: ClassName (the class this property expects)",c.expectedValue=n==="DatatypeProperty"?"A datatype (string, integer, boolean, decimal, etc.)":"A class name (Character, Scene, Story, etc.)",t.push(c)}}}return t}};var T=class{builtInClasses=new Set(["Resource","Class","Datatype","Literal","Thing","Nothing","Property","DatatypeProperty","ObjectProperty","AnnotationProperty","FunctionalProperty","InverseFunctionalProperty","TransitiveProperty","SymmetricProperty"]);get ruleName(){return"SubClassOfReference"}isClassLikeType(e){return e?e==="Class"||e.endsWith(".Class")||e==="Datatype"||e.endsWith(".Datatype"):!1}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();this.isClassLikeType(l)&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=P(i.subClassOf);for(let a=0;a<l.length;a++){let c=l[a];if(this.builtInClasses.has(c)||o.has(c))continue;if(!await this.isClassAvailableInImports(e,r,c)){let y=l.length>1?`[${a}]`:"",m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Class '${c}' referenced in subClassOf${y} is not defined or imported`,m.suggestion=`Define '${c}' as a Class, or import a namespace that contains it`,m.entityName=s,m.propertyName="subClassOf",m.actualValue=c,m.expectedValue="Defined or imported class",t.push(m)}}}return t}async isClassAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(this.isClassLikeType(u))return!0}let y=new Set;if(await this.isClassAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isClassAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isClassLikeType(y))return!0}if(await this.isClassAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var x=class{builtInProperties=new Set(["type","label","comment","domain","range","subPropertyOf","subClassOf","inverseOf","sameAs","seeAlso","isDefinedBy","functional","required"]);get ruleName(){return"SubPropertyOfReference"}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();(l==="DatatypeProperty"||l==="ObjectProperty"||l==="AnnotationProperty")&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=P(i.subPropertyOf);for(let a=0;a<l.length;a++){let c=l[a];if(this.builtInProperties.has(c)||o.has(c))continue;if(!await this.isPropertyAvailableInImports(e,r,c)){let y=l.length>1?`[${a}]`:"",m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Property '${c}' referenced in subPropertyOf${y} is not defined or imported`,m.suggestion=`Define '${c}' as a DatatypeProperty or ObjectProperty, or import a namespace that contains it`,m.entityName=s,m.propertyName="subPropertyOf",m.actualValue=c,m.expectedValue="Defined or imported property",t.push(m)}}}return t}async isPropertyAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(u==="DatatypeProperty"||u==="ObjectProperty"||u==="AnnotationProperty")return!0}let y=new Set;if(await this.isPropertyAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isPropertyAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(y==="DatatypeProperty"||y==="ObjectProperty"||y==="AnnotationProperty")return!0}if(await this.isPropertyAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var M=class{get ruleName(){return"NamespaceImportCycle"}async validateAsync(e,r){let t=[],o=e.metadata.namespace_?.toString();if(!o)return t;let s=new Map,i=new Set;await this.buildImportGraph(e,r,s,i);let n=this.detectCycle(o,s);if(n){let l=n.join(" \u2192 "),a=new g;a.ruleType=this.ruleName,a.severity="Error",a.message=`Circular namespace import detected: ${l}`,a.suggestion="Remove one of the imports to break the circular dependency. Circular dependencies prevent proper package resolution.",a.entityName="imports",a.propertyName="imports",a.actualValue=l,t.push(a)}return t}async buildImportGraph(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(!(!s||o.has(s))&&(o.add(s),e.metadata.imports)){let i=[];for(let[n,l]of Object.entries(e.metadata.imports))for(let a of l){let c=`${n}/${a.packageName}@${a.version}`;i.push(c);let p=await r.getHighestCompatibleVersionAsync(n,a);p&&await this.buildImportGraph(p,r,t,o)}i.length>0&&t.set(s,i)}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){let s=t.indexOf(e);if(s>=0){let n=t.slice(s);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let i=r.get(e);if(i)for(let n of i){let l=this.detectCycleRecursive(n,r,t,o);if(l)return l}return t.pop(),null}};var L=class{metadataKeys=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","inverseOf","transitive","symmetric","functional","inverseFunctional"]);get ruleName(){return"InstancePropertyReference"}async validateAsync(e,r,t){let o=[],s=new Set,i=t?await this.closurePropertyNamesViaCache(e,t):void 0,n=t?await this.aliasClosurePropertyNamesViaCache(e,t):void 0;for(let[l,a]of Object.entries(e.body))if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let p=a.type?.toString();this.isPropertyType(p)&&s.add(l)}for(let[l,a]of Object.entries(e.body))if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let c=a,p=c.type?.toString();if(this.isPropertyType(p)||this.isClassType(p))continue;for(let[y,m]of Object.entries(c)){if(!y||this.metadataKeys.has(y))continue;let u=y,f=null;if(y.includes(".")){let h=y.lastIndexOf(".");f=y.substring(0,h),u=y.substring(h+1)}if(s.has(u))continue;if(!await this.isPropertyAvailable(e,r,u,f,i,n)){let h=new g;h.ruleType=this.ruleName,h.severity="Error",h.message=`Property '${y}' is not defined or imported`,h.suggestion=f?`The property '${u}' is not found in the imported namespace with alias '${f}'.
|
|
11
|
+
\u2022 Use 'kanonak search type ${t} --include-imports' to locate the entity`,s=new g;return s.ruleType=this.ruleName,s.severity="Error",s.entityName=e,s.propertyName=r,s.actualValue=t,s.message=`Reference to '${t}' could not be resolved`,s.suggestion=o,s.expectedValue="A valid entity reference that exists in the current document or imported namespaces",s}getPropertyValue(e,r){let t=e[r];return t?t.toString():null}};var T=class{ruleName="ClassHierarchyCycle";async validateAsync(e,r){let t=[],o=new Map,s=new Set;await this.buildClassHierarchy(e,r,o,s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type,c=l.subClassOf;if(a?.toString()==="Class"&&c){let p=i,y=this.detectCycle(p,o);if(y){let m=y.join(" \u2192 "),u=new g;u.ruleType=this.ruleName,u.severity="Error",u.message=`Circular class hierarchy detected: ${m}`,u.suggestion="Remove the circular dependency by breaking one of the subClassOf relationships",u.entityName=p,u.propertyName="subClassOf",u.actualValue=m,t.push(u);break}}}return t}async buildClassHierarchy(e,r,t,o){let s=e.metadata?.namespace_?.toString()??"";if(!(s&&o.has(s))){s&&o.add(s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type,c=l.subClassOf;if(a?.toString()==="Class"&&c){let p=V(c);p.length>0&&t.set(i,p)}}if(e.metadata?.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);a&&await this.buildClassHierarchy(a,r,t,o)}}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){if(t.includes(e)){let i=t.indexOf(e),n=t.slice(i);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let s=r.get(e);if(s)for(let i of s){let n=this.detectCycleRecursive(i,r,t,o);if(n)return n}return t.pop(),null}};var x=class{ruleName="PropertyHierarchyCycle";async validateAsync(e,r){let t=[],o=new Map,s=new Set;await this.buildPropertyHierarchy(e,r,o,s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)&&n.subPropertyOf){let c=i,p=this.detectCycle(c,o);if(p){let y=p.join(" \u2192 "),m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Circular property hierarchy detected: ${y}`,m.suggestion="Remove the circular dependency by breaking one of the subPropertyOf relationships",m.entityName=c,m.propertyName="subPropertyOf",m.actualValue=y,t.push(m);break}}return t}async buildPropertyHierarchy(e,r,t,o){let s=e.metadata?.namespace_?.toString()??"";if(!(s&&o.has(s))){s&&o.add(s);for(let[i,n]of Object.entries(e.body))if(n&&typeof n=="object"&&!Array.isArray(n)){let l=n,a=l.type;if(a){let c=a.toString();if(c==="DatatypeProperty"||c==="ObjectProperty"||c==="AnnotationProperty"){let p=l.subPropertyOf;if(p){let y=V(p);y.length>0&&t.set(i,y)}}}}if(e.metadata?.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);a&&await this.buildPropertyHierarchy(a,r,t,o)}}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){if(t.includes(e)){let i=t.indexOf(e),n=t.slice(i);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let s=r.get(e);if(s)for(let i of s){let n=this.detectCycleRecursive(i,r,t,o);if(n)return n}return t.pop(),null}};var _=class{get ruleName(){return"PropertyRangeRequired"}async validateAsync(e,r){let t=[];for(let[o,s]of Object.entries(e.body)){if(typeof s!="object"||s===null||Array.isArray(s))continue;let i=s,n=i.type?.toString();if(n==="DatatypeProperty"||n==="ObjectProperty"||n?.endsWith(".DatatypeProperty")||n?.endsWith(".ObjectProperty")){let l="range"in i,a=i.range?.toString().trim();if(!l||!a){let c=new g;c.ruleType=this.ruleName,c.severity="Error",c.entityName=o,c.propertyName="range",c.message=`Property '${o}' must have a 'range' defined.`,c.suggestion=n==="DatatypeProperty"?"Add a range like: range: string (or integer, boolean, etc.)":"Add a range like: range: ClassName (the class this property expects)",c.expectedValue=n==="DatatypeProperty"?"A datatype (string, integer, boolean, decimal, etc.)":"A class name (Character, Scene, Story, etc.)",t.push(c)}}}return t}};var L=class{builtInClasses=new Set(["Resource","Class","Datatype","Literal","Thing","Nothing","Property","DatatypeProperty","ObjectProperty","AnnotationProperty","FunctionalProperty","InverseFunctionalProperty","TransitiveProperty","SymmetricProperty"]);get ruleName(){return"SubClassOfReference"}isClassLikeType(e){return e?e==="Class"||e.endsWith(".Class")||e==="Datatype"||e.endsWith(".Datatype"):!1}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();this.isClassLikeType(l)&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=V(i.subClassOf);for(let a=0;a<l.length;a++){let c=l[a];if(this.builtInClasses.has(c)||o.has(c))continue;if(!await this.isClassAvailableInImports(e,r,c)){let y=l.length>1?`[${a}]`:"",m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Class '${c}' referenced in subClassOf${y} is not defined or imported`,m.suggestion=`Define '${c}' as a Class, or import a namespace that contains it`,m.entityName=s,m.propertyName="subClassOf",m.actualValue=c,m.expectedValue="Defined or imported class",t.push(m)}}}return t}async isClassAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(this.isClassLikeType(u))return!0}let y=new Set;if(await this.isClassAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isClassAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isClassLikeType(y))return!0}if(await this.isClassAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var M=class{builtInProperties=new Set(["type","label","comment","domain","range","subPropertyOf","subClassOf","inverseOf","sameAs","seeAlso","isDefinedBy","functional","required"]);get ruleName(){return"SubPropertyOfReference"}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();(l==="DatatypeProperty"||l==="ObjectProperty"||l==="AnnotationProperty")&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=V(i.subPropertyOf);for(let a=0;a<l.length;a++){let c=l[a];if(this.builtInProperties.has(c)||o.has(c))continue;if(!await this.isPropertyAvailableInImports(e,r,c)){let y=l.length>1?`[${a}]`:"",m=new g;m.ruleType=this.ruleName,m.severity="Error",m.message=`Property '${c}' referenced in subPropertyOf${y} is not defined or imported`,m.suggestion=`Define '${c}' as a DatatypeProperty or ObjectProperty, or import a namespace that contains it`,m.entityName=s,m.propertyName="subPropertyOf",m.actualValue=c,m.expectedValue="Defined or imported property",t.push(m)}}}return t}async isPropertyAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(u==="DatatypeProperty"||u==="ObjectProperty"||u==="AnnotationProperty")return!0}let y=new Set;if(await this.isPropertyAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isPropertyAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(y==="DatatypeProperty"||y==="ObjectProperty"||y==="AnnotationProperty")return!0}if(await this.isPropertyAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var U=class{get ruleName(){return"NamespaceImportCycle"}async validateAsync(e,r){let t=[],o=e.metadata.namespace_?.toString();if(!o)return t;let s=new Map,i=new Set;await this.buildImportGraph(e,r,s,i);let n=this.detectCycle(o,s);if(n){let l=n.join(" \u2192 "),a=new g;a.ruleType=this.ruleName,a.severity="Error",a.message=`Circular namespace import detected: ${l}`,a.suggestion="Remove one of the imports to break the circular dependency. Circular dependencies prevent proper package resolution.",a.entityName="imports",a.propertyName="imports",a.actualValue=l,t.push(a)}return t}async buildImportGraph(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(!(!s||o.has(s))&&(o.add(s),e.metadata.imports)){let i=[];for(let[n,l]of Object.entries(e.metadata.imports))for(let a of l){let c=`${n}/${a.packageName}@${a.version}`;i.push(c);let p=await r.getHighestCompatibleVersionAsync(n,a);p&&await this.buildImportGraph(p,r,t,o)}i.length>0&&t.set(s,i)}}detectCycle(e,r){let t=[],o=new Set;return this.detectCycleRecursive(e,r,t,o)}detectCycleRecursive(e,r,t,o){let s=t.indexOf(e);if(s>=0){let n=t.slice(s);return n.push(e),n}if(o.has(e))return null;t.push(e),o.add(e);let i=r.get(e);if(i)for(let n of i){let l=this.detectCycleRecursive(n,r,t,o);if(l)return l}return t.pop(),null}};var W=class{metadataKeys=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","inverseOf","transitive","symmetric","functional","inverseFunctional"]);get ruleName(){return"InstancePropertyReference"}async validateAsync(e,r,t){let o=[],s=new Set,i=t?await this.closurePropertyNamesViaCache(e,t):void 0,n=t?await this.aliasClosurePropertyNamesViaCache(e,t):void 0;for(let[l,a]of Object.entries(e.body))if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let p=a.type?.toString();this.isPropertyType(p)&&s.add(l)}for(let[l,a]of Object.entries(e.body))if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let c=a,p=c.type?.toString();if(this.isPropertyType(p)||this.isClassType(p))continue;for(let[y,m]of Object.entries(c)){if(!y||this.metadataKeys.has(y))continue;let u=y,f=null;if(y.includes(".")){let h=y.lastIndexOf(".");f=y.substring(0,h),u=y.substring(h+1)}if(s.has(u))continue;if(!await this.isPropertyAvailable(e,r,u,f,i,n)){let h=new g;h.ruleType=this.ruleName,h.severity="Error",h.message=`Property '${y}' is not defined or imported`,h.suggestion=f?`The property '${u}' is not found in the imported namespace with alias '${f}'.
|
|
12
12
|
1. Verify the namespace is imported with the correct alias
|
|
13
13
|
2. Check if the property name is spelled correctly
|
|
14
14
|
3. Ensure the imported namespace version contains this property`:`The property '${y}' is not defined in this namespace or any imported namespace.
|
|
15
15
|
1. Define '${y}' as an ObjectProperty or DatatypeProperty in this namespace, OR
|
|
16
16
|
2. Import the namespace that contains '${y}', OR
|
|
17
|
-
3. Use a qualified reference like 'alias.${y}' if already imported with an alias`,h.entityName=l,h.propertyName=y,h.actualValue=m?.toString(),h.expectedValue="A defined or imported property",o.push(h)}}}return o}isPropertyType(e){return e?e==="ObjectProperty"||e==="DatatypeProperty"||e==="AnnotationProperty"||e==="Property"||e.endsWith(".ObjectProperty")||e.endsWith(".DatatypeProperty")||e.endsWith(".AnnotationProperty")||e.endsWith(".Property"):!1}isClassType(e){return e?e==="Class"||e.endsWith(".Class"):!1}async isPropertyAvailable(e,r,t,o,s,i){if(s!==void 0&&i!==void 0){if(o===null)return s.has(t);let n=i.get(o);return n?n.has(t):!1}return await this.isPropertyAvailableInImports(e,r,t,o)}async closurePropertyNamesViaCache(e,r){let t=new Set,o=
|
|
17
|
+
3. Use a qualified reference like 'alias.${y}' if already imported with an alias`,h.entityName=l,h.propertyName=y,h.actualValue=m?.toString(),h.expectedValue="A defined or imported property",o.push(h)}}}return o}isPropertyType(e){return e?e==="ObjectProperty"||e==="DatatypeProperty"||e==="AnnotationProperty"||e==="Property"||e.endsWith(".ObjectProperty")||e.endsWith(".DatatypeProperty")||e.endsWith(".AnnotationProperty")||e.endsWith(".Property"):!1}isClassType(e){return e?e==="Class"||e.endsWith(".Class"):!1}async isPropertyAvailable(e,r,t,o,s,i){if(s!==void 0&&i!==void 0){if(o===null)return s.has(t);let n=i.get(o);return n?n.has(t):!1}return await this.isPropertyAvailableInImports(e,r,t,o)}async closurePropertyNamesViaCache(e,r){let t=new Set,o=Ee(e);if(!o)return t;let s=await r.getImportClosure(o);for(let i of s)if(i!==o)for(let n of await r.getPropertyNames(i))t.add(n);return t}async aliasClosurePropertyNamesViaCache(e,r){let t=new Map;if(!e.metadata.imports)return t;for(let[o,s]of Object.entries(e.metadata.imports))for(let i of s){if(!i.alias)continue;let n=await r.repository.getHighestCompatibleVersionAsync(o,i);if(!n)continue;let l=Ee(n);if(!l)continue;let a=await r.getImportClosure(l),c=t.get(i.alias)??new Set;for(let p of a)for(let y of await r.getPropertyNames(p))c.add(y);t.set(i.alias,c)}return t}async isPropertyAvailableInImports(e,r,t,o){if(!e.metadata.imports)return!1;for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i){if(o!==null&&n.alias!==o)continue;let l=await r.getHighestCompatibleVersionAsync(s,n);if(l){let a=l.body[t];if(a&&typeof a=="object"&&!Array.isArray(a)){let y=a.type?.toString();if(this.isPropertyType(y))return!0}let c=new Set;if(await this.isPropertyAvailableInImportsRecursive(l,r,t,c))return!0}}return!1}async isPropertyAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isPropertyType(y))return!0}if(await this.isPropertyAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};function Ee(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}var H=class{metadataKeys=new Set(["type","label","comment","subClassOf","subPropertyOf","domain","range","inverseOf","transitive","symmetric","functional","inverseFunctional"]);get ruleName(){return"DefinitionPropertyReference"}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();this.isPropertyType(l)&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let n=i,l=n.type?.toString();if(!this.isPropertyType(l)&&!this.isClassType(l))continue;for(let[a,c]of Object.entries(n)){if(!a||this.metadataKeys.has(a))continue;let p=a,y=null;if(a.includes(".")){let u=a.lastIndexOf(".");y=a.substring(0,u),p=a.substring(u+1)}if(o.has(p))continue;if(!await this.isPropertyAvailableInImports(e,r,p,y)){let u=this.isClassType(l)?"class":"property",f=new g;f.ruleType=this.ruleName,f.severity="Error",f.message=`Property '${a}' used on ${u} '${s}' is not defined or imported`,f.suggestion=y?`The property '${p}' is not found in the imported namespace with alias '${y}'.
|
|
18
18
|
1. Verify the namespace is imported with the correct alias
|
|
19
19
|
2. Check if the property name is spelled correctly
|
|
20
20
|
3. Ensure the imported namespace version contains this property`:`The property '${a}' is not defined in this namespace or any imported namespace.
|
|
21
21
|
1. Define '${a}' as an ObjectProperty or DatatypeProperty in this namespace, OR
|
|
22
22
|
2. Import the namespace that contains '${a}', OR
|
|
23
|
-
3. Use a qualified reference like 'alias.${a}' if already imported with an alias`,f.entityName=s,f.propertyName=a,f.actualValue=c?.toString(),f.expectedValue="A defined or imported property",t.push(f)}}}return t}isPropertyType(e){return e?e==="ObjectProperty"||e==="DatatypeProperty"||e==="AnnotationProperty"||e==="Property"||e.endsWith(".ObjectProperty")||e.endsWith(".DatatypeProperty")||e.endsWith(".AnnotationProperty")||e.endsWith(".Property"):!1}isClassType(e){return e?e==="Class"||e.endsWith(".Class"):!1}async isPropertyAvailableInImports(e,r,t,o){if(!e.metadata.imports)return!1;for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i){if(o!==null&&n.alias!==o)continue;let l=await r.getHighestCompatibleVersionAsync(s,n);if(l){let a=l.body[t];if(a&&typeof a=="object"&&!Array.isArray(a)){let y=a.type?.toString();if(this.isPropertyType(y))return!0}let c=new Set;if(await this.isPropertyAvailableInImportsRecursive(l,r,t,c))return!0}}return!1}async isPropertyAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isPropertyType(y))return!0}if(await this.isPropertyAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var
|
|
23
|
+
3. Use a qualified reference like 'alias.${a}' if already imported with an alias`,f.entityName=s,f.propertyName=a,f.actualValue=c?.toString(),f.expectedValue="A defined or imported property",t.push(f)}}}return t}isPropertyType(e){return e?e==="ObjectProperty"||e==="DatatypeProperty"||e==="AnnotationProperty"||e==="Property"||e.endsWith(".ObjectProperty")||e.endsWith(".DatatypeProperty")||e.endsWith(".AnnotationProperty")||e.endsWith(".Property"):!1}isClassType(e){return e?e==="Class"||e.endsWith(".Class"):!1}async isPropertyAvailableInImports(e,r,t,o){if(!e.metadata.imports)return!1;for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i){if(o!==null&&n.alias!==o)continue;let l=await r.getHighestCompatibleVersionAsync(s,n);if(l){let a=l.body[t];if(a&&typeof a=="object"&&!Array.isArray(a)){let y=a.type?.toString();if(this.isPropertyType(y))return!0}let c=new Set;if(await this.isPropertyAvailableInImportsRecursive(l,r,t,c))return!0}}return!1}async isPropertyAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isPropertyType(y))return!0}if(await this.isPropertyAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}};var F=class{xsdTypes=new Set(["string","integer","boolean","decimal","float","double","date","dateTime","time","duration","anyURI","base64Binary","hexBinary","long","int","short","byte","unsignedLong","unsignedInt","unsignedShort","unsignedByte","positiveInteger","nonPositiveInteger","negativeInteger","nonNegativeInteger","normalizedString","token","language","Name","NCName","ENTITY","ENTITIES","IDREF","IDREFS","NMTOKEN","NMTOKENS"]);get ruleName(){return"XsdImport"}async validateAsync(e,r){let t=[],o=new Set,s=[];for(let[i,n]of Object.entries(e.body))if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let l=n,a=!1,c=l.type;if(Array.isArray(c)){for(let p of c)if(p?.toString()==="DatatypeProperty"){a=!0;break}}else c?.toString()==="DatatypeProperty"&&(a=!0);if(a){s.push(i);let p=this.getPropertyValue(l,"range");p&&this.xsdTypes.has(p)&&o.add(p)}}if(o.size>0&&!await this.checkXsdImportAsync(e.metadata,r)){let n=Array.from(o).sort().join(", "),l=s.sort().join(", "),a=new g;a.ruleType=this.ruleName,a.severity="Error",a.message=`XSD namespace not imported but XSD types are used: ${n}`,a.suggestion=`Add an XSD import to the imports section. The core XSD types package is 'core-xsd' from publisher 'kanonak.org'. Used by properties: ${l}`,a.entityName="imports",t.push(a)}return t}async checkXsdImportAsync(e,r,t=new Set){if(!e?.imports)return!1;let o=e.namespace_?.toString()??"";if(o&&t.has(o))return!1;o&&t.add(o);for(let[,s]of Object.entries(e.imports))for(let i of s)if(i.packageName==="xsd"||i.packageName.toLowerCase().endsWith("-xsd"))return!0;for(let[s,i]of Object.entries(e.imports))for(let n of i){let l=await r.getHighestCompatibleVersionAsync(s,n);if(l?.metadata&&await this.checkXsdImportAsync(l.metadata,r,t))return!0}return!1}getPropertyValue(e,r){return e[r]?.toString()}};var B=class{get ruleName(){return"AmbiguousReference"}async validateAsync(e,r){let t=[],o=await this.buildEntitySourceMapAsync(e,r),s=await this.buildDatatypePropertyNamesAsync(e,r);for(let[i,n]of Object.entries(e.body))typeof n=="object"&&n!==null&&!Array.isArray(n)&&this.validateEntityReferences(i,n,o,s,e,t);return t}async buildEntitySourceMapAsync(e,r){let t=new Map,o=new Set;for(let s of Object.keys(e.body)){let i=e.metadata.namespace_?.toString()??"";t.has(s)||t.set(s,[]),t.get(s).push(`(local:${i})`)}if(e.metadata.imports)for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i){let l=await r.getHighestCompatibleVersionAsync(s,n);l&&await this.collectEntitiesRecursivelyAsync(l,t,o,r)}return t}async collectEntitiesRecursivelyAsync(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(!t.has(s)){t.add(s);for(let i of Object.keys(e.body)){r.has(i)||r.set(i,[]);let n=r.get(i);n.includes(s)||n.push(s)}if(e.metadata.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await o.getHighestCompatibleVersionAsync(i,l);a&&await this.collectEntitiesRecursivelyAsync(a,r,t,o)}}}async buildDatatypePropertyNamesAsync(e,r){let t=new Set,o=new Set;if(await this.collectDatatypePropertiesAsync(e,t,o,r),e.metadata.imports)for(let[s,i]of Object.entries(e.metadata.imports))for(let n of i){let l=await r.getHighestCompatibleVersionAsync(s,n);l&&await this.collectDatatypePropertiesAsync(l,t,o,r)}return t}async collectDatatypePropertiesAsync(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(!t.has(s)){t.add(s);for(let[i,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n))continue;let l=n.type;if(typeof l!="string")continue;(l.includes(".")?l.substring(l.lastIndexOf(".")+1):l)==="DatatypeProperty"&&r.add(i)}if(e.metadata.imports)for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await o.getHighestCompatibleVersionAsync(i,l);a&&await this.collectDatatypePropertiesAsync(a,r,t,o)}}}validateEntityReferences(e,r,t,o,s,i){for(let[n,l]of Object.entries(r)){let a=n;if(a&&!a.includes(".")){let c=t.get(a);if(c&&c.length>1&&!c.some(y=>y.startsWith("(local:"))){let y=c.filter(m=>!m.startsWith("(local:"));y.length>1&&i.push(this.createAmbiguityError(e,a,`Property '${a}'`,y,s,!0,a))}}this.validatePropertyValue(e,a,l,t,o,s,i)}}validatePropertyValue(e,r,t,o,s,i,n){if(t==null)return;let l=r&&r.includes(".")?r.substring(r.lastIndexOf(".")+1):r,a=!!l&&s.has(l);if(typeof t=="string"&&!t.includes(".")&&!a){let c=o.get(t);if(c&&c.length>1&&!c.some(y=>y.startsWith("(local:"))){let y=c.filter(m=>!m.startsWith("(local:"));y.length>1&&n.push(this.createAmbiguityError(e,r,`Reference '${t}'`,y,i,!1,t))}}else if(Array.isArray(t))for(let c=0;c<t.length;c++){let p=`${e}.${r}[${c}]`;this.validatePropertyValue(p,r,t[c],o,s,i,n)}else if(typeof t=="object"&&!Array.isArray(t)){let c=r?`${e}.${r}`:e;this.validateEntityReferences(c,t,o,s,i,n)}}createAmbiguityError(e,r,t,o,s,i,n){let l=[];for(let f of o){let b=this.findAliasForNamespace(s,f);if(b){let h=r?.split(".").pop()??r;l.push(`${b}.${h}`)}}let a=l.length>0?`Use one of: ${l.map(f=>`'${f}'`).join(", ")}`:`Add aliases to imports and use qualified names (e.g., 'alias.${r}')`,c=o.map(f=>` \u2022 ${f}`).join(`
|
|
24
24
|
`),p=e.split(".")[0],y=e.includes(".")?e:r,m=new g;m.ruleType=this.ruleName,m.severity="Error",m.entityName=p,y&&(m.propertyName=y);let u=n??r;return u&&(m.actualValue=u),m.message=`${t} is ambiguous - defined in multiple imported namespaces`,m.suggestion=`${a}
|
|
25
25
|
|
|
26
26
|
Defined in:
|
|
27
|
-
${c}`,m.expectedValue="Unambiguous reference (use namespace alias to disambiguate)",m}findAliasForNamespace(e,r){if(!e.metadata.imports)return null;for(let[t,o]of Object.entries(e.metadata.imports))for(let s of o)if(`${t}/${s.packageName}@${s.version}`===r&&s.alias)return s.alias;return null}};var
|
|
27
|
+
${c}`,m.expectedValue="Unambiguous reference (use namespace alias to disambiguate)",m}findAliasForNamespace(e,r){if(!e.metadata.imports)return null;for(let[t,o]of Object.entries(e.metadata.imports))for(let s of o)if(`${t}/${s.packageName}@${s.version}`===r&&s.alias)return s.alias;return null}};var q=class{builtInClasses=new Set(["Resource","Class","Literal","Thing","Nothing","Property","DatatypeProperty","ObjectProperty","AnnotationProperty"]);primitiveTypes=new Set(["string","integer","int","long","short","byte","decimal","float","double","boolean","bool","dateTime","date","time","duration","anyURI","anySimpleType","nonNegativeInteger","positiveInteger","negativeInteger","nonPositiveInteger","unsignedInt","unsignedLong","unsignedShort","unsignedByte","base64Binary","hexBinary","Literal","Resource"]);get ruleName(){return"PropertyRangeReference"}async validateAsync(e,r){let t=[],o=new Set;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let l=i.type?.toString();this.isValidRangeTargetType(l)&&o.add(s)}for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let n=i,l=n.type?.toString();if(l!=="DatatypeProperty"&&l!=="ObjectProperty"&&!l?.endsWith(".DatatypeProperty")&&!l?.endsWith(".ObjectProperty"))continue;let a=n.range;if(!a)continue;let c=[];if(Array.isArray(a))for(let p of a){let y=p?.toString();y&&c.push(y)}else{let p=a?.toString();p&&c.push(p)}if(c.length===0)continue;for(let p of c){if(this.primitiveTypes.has(p)||this.builtInClasses.has(p)||o.has(p))continue;if(!await this.isTypeAvailableInImports(e,r,p)){let m=l?.includes("ObjectProperty")?"ObjectProperty":"DatatypeProperty",u=new g;u.ruleType=this.ruleName,u.severity="Error",u.message=`Property '${s}' has range '${p}' which is not defined or imported`,u.suggestion=m==="ObjectProperty"?`For ObjectProperty:
|
|
28
28
|
1. Define '${p}' as a Class in this namespace, OR
|
|
29
29
|
2. Import the namespace that contains '${p}', OR
|
|
30
30
|
3. Use a qualified reference like 'alias.${p}' if already imported with an alias`:`For DatatypeProperty:
|
|
31
31
|
1. Use a primitive type (string, integer, boolean, dateTime, etc.), OR
|
|
32
|
-
2. If '${p}' should be a class, change property type to ObjectProperty`,u.entityName=s,u.propertyName="range",u.actualValue=p,u.expectedValue=m==="ObjectProperty"?"A defined or imported class name":"A primitive type or defined class",t.push(u)}}}return t}async isTypeAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(this.isValidRangeTargetType(u))return!0}let y=new Set;if(await this.isTypeAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isTypeAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isValidRangeTargetType(y))return!0}if(await this.isTypeAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}isValidRangeTargetType(e){return e?e==="Class"||e.endsWith(".Class")||e==="Datatype"||e.endsWith(".Datatype"):!1}};var
|
|
32
|
+
2. If '${p}' should be a class, change property type to ObjectProperty`,u.entityName=s,u.propertyName="range",u.actualValue=p,u.expectedValue=m==="ObjectProperty"?"A defined or imported class name":"A primitive type or defined class",t.push(u)}}}return t}async isTypeAvailableInImports(e,r,t){if(!e.metadata.imports)return!1;let o=null,s=t;if(t.includes(".")){let i=t.split(".",2);o=i[0],s=i[1]}for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){if(o!==null&&l.alias!==o)continue;let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=o!==null?s:t,p=a.body[c];if(p&&typeof p=="object"&&!Array.isArray(p)){let u=p.type?.toString();if(this.isValidRangeTargetType(u))return!0}let y=new Set;if(await this.isTypeAvailableInImportsRecursive(a,r,c,y))return!0}}return!1}async isTypeAvailableInImportsRecursive(e,r,t,o){let s=e.metadata.namespace_?.toString()??"";if(s&&o.has(s)||(s&&o.add(s),!e.metadata.imports))return!1;for(let[i,n]of Object.entries(e.metadata.imports))for(let l of n){let a=await r.getHighestCompatibleVersionAsync(i,l);if(a){let c=a.body[t];if(c&&typeof c=="object"&&!Array.isArray(c)){let y=c.type?.toString();if(this.isValidRangeTargetType(y))return!0}if(await this.isTypeAvailableInImportsRecursive(a,r,t,o))return!0}}return!1}isValidRangeTargetType(e){return e?e==="Class"||e.endsWith(".Class")||e==="Datatype"||e.endsWith(".Datatype"):!1}};var X=class{xsdTypes=new Set(["string","integer","boolean","decimal","float","double","date","dateTime","time","duration","anyURI","base64Binary","hexBinary","long","int","short","byte","unsignedLong","unsignedInt","unsignedShort","unsignedByte","positiveInteger","nonPositiveInteger","negativeInteger","nonNegativeInteger","normalizedString","token","language","Name","NCName","ENTITY","ENTITIES","IDREF","IDREFS","NMTOKEN","NMTOKENS"]);get ruleName(){return"ObjectPropertyImport"}async validateAsync(e,r){let t=[],o=new Map,s=new v(r);await s.buildEntityIndexAsync(e);for(let[i,n]of Object.entries(e.body))if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let l=n,a=!1,c=l.type;if(Array.isArray(c)){for(let p of c)if(p?.toString()==="ObjectProperty"){a=!0;break}}else c?.toString()==="ObjectProperty"&&(a=!0);if(a){let p=l.range,y=[];if(Array.isArray(p))for(let m of p){let u=m?.toString();u&&y.push(u)}else{let m=p?.toString();m&&y.push(m)}for(let m of y)this.xsdTypes.has(m)||(o.has(m)||o.set(m,[]),o.get(m).push(i))}}for(let[i,n]of o)if(!await s.resolveEntityAsync(i,e))for(let a of n){let c=new g;c.ruleType=this.ruleName,c.severity="Warning",c.message=`ObjectProperty references class '${i}' which may not be imported`,c.suggestion=`Ensure the namespace containing '${i}' is imported, or define '${i}' in this document`,c.entityName=a,c.propertyName="range",c.actualValue=i,t.push(c)}return t}};var z=class{standardProperties=new Set(["type","label","comment","subClassOf","domain","range","subPropertyOf","inverseOf","sameAs","seeAlso","isDefinedBy"]);get ruleName(){return"ObjectPropertyValue"}async validateAsync(e,r){let t=[],o=new v(r),s=new Pe(o),i=await o.buildEntityIndexAsync(e),n=await this.buildPropertyMetadataAsync(e,r,o,i);for(let[l,a]of Object.entries(e.body))typeof a=="object"&&a!==null&&!Array.isArray(a)&&await this.scanEntityForObjectProperties(a,l,"",n,o,s,e,t);return t}async scanEntityForObjectProperties(e,r,t,o,s,i,n,l){for(let[a,c]of Object.entries(e)){if(this.standardProperties.has(a))continue;let p,y=await s.resolveEntityAsync(a,n);if(y?.uri){let m=`${y.uri.publisher}/${y.uri.package_}/${y.uri.name}`;p=o.get(m)}if(!p){let m=a,u=a.lastIndexOf(".");u>0&&u<a.length-1&&(m=a.substring(u+1)),p=o.get(m)}if(p&&i.isEffectiveObjectProperty(p.propertyType,p.rangeUri)){let u=t?`${t}.${a}`:a;if(typeof c=="string"&&c.trim().length>0){let f=c.trim();if(f.includes(",")){let h=f.split(",").map(k=>k.trim()).filter(k=>k.length>0);l.push({ruleType:this.ruleName,severity:"Error",message:`Property '${a}' has a comma-separated string value, but ObjectProperty expects a list of references`,suggestion:`Use YAML list format:
|
|
33
33
|
${a}:
|
|
34
34
|
- ${h[0]}
|
|
35
35
|
${h.slice(1).map(k=>` - ${k}`).join(`
|
|
36
|
-
`)}`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:`A single reference to ${p.range??"an entity"} OR a YAML list`});continue}let b=await s.resolveEntityAsync(f,n);if(b)p.range&&(await this.validateRangeType(b,p.range,s,n)||l.push({ruleType:this.ruleName,severity:"Warning",message:`Property '${a}' expects a ${p.range}, but '${f}' may not be a ${p.range}`,suggestion:`Ensure '${f}' is defined with appropriate type`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:p.range}));else{let h=p.range??"entity";l.push({ruleType:this.ruleName,severity:"Error",message:`Property '${a}' references '${f}' which is not defined or imported`,suggestion:`Define '${f}' or import a namespace that contains it. Expected range: ${h}`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:"Defined or imported entity"})}}else if(typeof c=="object"&&c!==null&&!Array.isArray(c)){let f=t?`${t}.${a}`:a;await this.scanEntityForObjectProperties(c,r,f,o,s,i,n,l)}else if(Array.isArray(c))for(let f=0;f<c.length;f++){let b=c[f];if(typeof b=="string"&&b.trim().length>0){let h=b.trim(),k=await s.resolveEntityAsync(h,n);if(k){if(p.range&&!await this.validateRangeType(k,p.range,s,n)){let
|
|
36
|
+
`)}`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:`A single reference to ${p.range??"an entity"} OR a YAML list`});continue}let b=await s.resolveEntityAsync(f,n);if(b)p.range&&(await this.validateRangeType(b,p.range,s,n)||l.push({ruleType:this.ruleName,severity:"Warning",message:`Property '${a}' expects a ${p.range}, but '${f}' may not be a ${p.range}`,suggestion:`Ensure '${f}' is defined with appropriate type`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:p.range}));else{let h=p.range??"entity";l.push({ruleType:this.ruleName,severity:"Error",message:`Property '${a}' references '${f}' which is not defined or imported`,suggestion:`Define '${f}' or import a namespace that contains it. Expected range: ${h}`,entityName:r,propertyName:a,propertyPath:u,actualValue:f,expectedValue:"Defined or imported entity"})}}else if(typeof c=="object"&&c!==null&&!Array.isArray(c)){let f=t?`${t}.${a}`:a;await this.scanEntityForObjectProperties(c,r,f,o,s,i,n,l)}else if(Array.isArray(c))for(let f=0;f<c.length;f++){let b=c[f];if(typeof b=="string"&&b.trim().length>0){let h=b.trim(),k=await s.resolveEntityAsync(h,n);if(k){if(p.range&&!await this.validateRangeType(k,p.range,s,n)){let pe=t?`${t}.${a}[${f}]`:`${a}[${f}]`;l.push({ruleType:this.ruleName,severity:"Warning",message:`Property '${a}' expects a ${p.range}, but '${h}' may not be a ${p.range}`,suggestion:`Ensure '${h}' is defined with appropriate type`,entityName:r,propertyName:`${a}[${f}]`,propertyPath:pe,actualValue:h,expectedValue:p.range})}}else{let ge=p.range??"entity",pe=t?`${t}.${a}[${f}]`:`${a}[${f}]`;l.push({ruleType:this.ruleName,severity:"Error",message:`Property '${a}' references '${h}' which is not defined or imported`,suggestion:`Define '${h}' or import a namespace that contains it. Expected range: ${ge}`,entityName:r,propertyName:`${a}[${f}]`,propertyPath:pe,actualValue:h,expectedValue:"Defined or imported entity"})}}else if(typeof b=="object"&&b!==null&&!Array.isArray(b)){let h=t?`${t}.${a}[${f}]`:`${a}[${f}]`;await this.scanEntityForObjectProperties(b,r,h,o,s,i,n,l)}}}if(typeof c=="object"&&c!==null&&!Array.isArray(c)&&!o.has(a)){let m=t?`${t}.${a}`:a;await this.scanEntityForObjectProperties(c,r,m,o,s,i,n,l)}else if(Array.isArray(c))for(let m=0;m<c.length;m++){let u=c[m];if(typeof u=="object"&&u!==null&&!Array.isArray(u)){let f=t?`${t}.${a}[${m}]`:`${a}[${m}]`;await this.scanEntityForObjectProperties(u,r,f,o,s,i,n,l)}}}}async validateRangeType(e,r,t,o){if(!new Set(["Property","DatatypeProperty","ObjectProperty","AnnotationProperty","Class","Resource"]).has(r))return!0;let i=e.entity.type;if(i){let n=[];if(Array.isArray(i))for(let l of i){let a=l?.toString();a&&a.trim().length>0&&n.push(a)}else{let l=i?.toString();l&&l.trim().length>0&&n.push(l)}for(let l of n){let a=l.includes(".")?l.split(".")[1]:l;if(a===r||r==="Property"&&(a==="DatatypeProperty"||a==="ObjectProperty"||a==="AnnotationProperty")||r==="Class"&&a==="Class"||await t.isSubclassOfAsync(l,r,o))return!0}}return!1}async buildPropertyMetadataAsync(e,r,t,o){let s=new Map;for(let[i,n]of o){let l=n.entity.type;if(l){let a=[];if(Array.isArray(l))for(let y of l){let m=y?.toString();m&&m.trim().length>0&&a.push(m)}else{let y=l?.toString();y&&y.trim().length>0&&a.push(y)}let c=!1,p="Property";for(let y of a){let m=y.includes(".")?y.split(".")[1]:y;if(m==="Property"||m==="DatatypeProperty"||m==="ObjectProperty"||m==="AnnotationProperty"){c=!0,p=y;break}}if(c){let y={propertyType:p},m=n.entity.range;if(m){let u=m?.toString();if(u&&u.trim().length>0){y.range=u;let f=await t.resolveEntityAsync(u,e);f&&(y.rangeUri=f.uri)}}if(s.set(i,y),n.uri){let u=`${n.uri.publisher}/${n.uri.package_}/${n.uri.name}`;s.set(u,y)}}}}return s}};var Y=class{standardProperties=new Set(["type","label","comment","subClassOf","domain","range","subPropertyOf","inverseOf","sameAs","seeAlso","isDefinedBy"]);get ruleName(){return"PropertyDomain"}async validateAsync(e,r,t){let o=[],s=new Map;for(let[n,l]of Object.entries(e.body))if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let a=l,c=this.getPropertyValue(a,"type");(c==="DatatypeProperty"||c?.endsWith(".DatatypeProperty")||c==="ObjectProperty"||c?.endsWith(".ObjectProperty")||c==="AnnotationProperty"||c?.endsWith(".AnnotationProperty"))&&s.set(n,a)}let i=t?await this.buildClassHierarchyViaCache(e,t):await this.buildCompleteClassHierarchyAsync(e,r);for(let[n,l]of Object.entries(e.body))if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let a=l,c=this.getPropertyValue(a,"type");if(!c||c==="Class"||c.endsWith(".Class")||c.endsWith("Property")||c==="AnnotationProperty")continue;this.validateEntityProperties(a,n,c,s,i,o)}return o}async buildClassHierarchyViaCache(e,r){let t=new Map,o=Ce(e);if(!o)return t;let s=await r.getImportClosure(o);for(let i of s){let n=await r.getClassDeclarations(i);for(let[l,a]of n)a.length>0&&t.set(l,a)}return t}async buildCompleteClassHierarchyAsync(e,r){let t=new Map,o=new Set,s=async(n,l)=>{if(!o.has(l)){o.add(l);for(let[a,c]of Object.entries(n.body))if(typeof c=="object"&&c!==null&&!Array.isArray(c)){let p=c,y=this.getPropertyValue(p,"type");if(y==="Class"||y?.endsWith(".Class")){let m=p.subClassOf;if(m===void 0){for(let f of Object.keys(p))if(f.endsWith(".subClassOf")){m=p[f];break}}let u=V(m);u.length>0&&t.set(a,u)}}if(n.metadata.imports)for(let[a,c]of Object.entries(n.metadata.imports))for(let p of c)try{let y=await r.getHighestCompatibleVersionAsync(a,p);if(y){let m=`${a}/${p.packageName}@${p.version}`;await s(y,m)}}catch{}}},i=e.metadata.namespace_?.toString()??"unknown";return await s(e,i),t}validateEntityProperties(e,r,t,o,s,i){for(let[n,l]of Object.entries(e)){if(this.standardProperties.has(n))continue;let a=n,c=n.lastIndexOf(".");c>0&&c<n.length-1&&(a=n.substring(c+1));let p=o.get(a);if(!p)continue;let y=this.getPropertyValue(p,"domain");if(y){if(!this.isTypeCompatibleWithDomain(t,y,s)){let m=r.split(".")[0];i.push({ruleType:this.ruleName,severity:"Error",entityName:m,propertyName:r,actualValue:n,message:`Property '${n}' has domain '${y}' but is used on '${t}' at '${r}'`,suggestion:`Either:
|
|
37
37
|
1. Use this property only on '${y}' instances
|
|
38
38
|
2. Change the property domain to include '${t}'
|
|
39
|
-
3. Create a different property for '${t}'`,expectedValue:`Property used on ${y} or its subclasses`})}if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let m=l,u=this.getPropertyValue(m,"type");if(u){let f=`${r}.${n}`;this.validateEntityProperties(m,f,u,o,s,i)}else{let f=this.getPropertyValue(p,"range");if(f){let b=`${r}.${n}`;this.validateEntityProperties(m,b,f,o,s,i)}}}else if(Array.isArray(l))for(let m=0;m<l.length;m++){let u=l[m];if(typeof u=="object"&&u!==null&&!Array.isArray(u)){let f=u,b=this.getPropertyValue(f,"type");if(b){let h=`${r}.${n}[${m}]`;this.validateEntityProperties(f,h,b,o,s,i)}else{let h=this.getPropertyValue(p,"range");if(h){let k=`${r}.${n}[${m}]`;this.validateEntityProperties(f,k,h,o,s,i)}}}}}}}isTypeCompatibleWithDomain(e,r,t){if(e===r)return!0;let o=new Set,s=[e];for(;s.length>0;){let i=s.shift();if(o.has(i))continue;o.add(i);let n=t.get(i);if(n)for(let l of n){if(l===r)return!0;s.push(l)}}return!1}getPropertyValue(e,r){if(r in e){let t=e[r];return this.extractFirstValue(t)}for(let t of Object.keys(e))if(t.endsWith(`.${r}`)){let o=e[t];return this.extractFirstValue(o)}}extractFirstValue(e){if(Array.isArray(e)){let r=[];for(let t of e)r.push(t?.toString()??"");return r.length>0?r[0]:void 0}return e?.toString()}};function
|
|
39
|
+
3. Create a different property for '${t}'`,expectedValue:`Property used on ${y} or its subclasses`})}if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let m=l,u=this.getPropertyValue(m,"type");if(u){let f=`${r}.${n}`;this.validateEntityProperties(m,f,u,o,s,i)}else{let f=this.getPropertyValue(p,"range");if(f){let b=`${r}.${n}`;this.validateEntityProperties(m,b,f,o,s,i)}}}else if(Array.isArray(l))for(let m=0;m<l.length;m++){let u=l[m];if(typeof u=="object"&&u!==null&&!Array.isArray(u)){let f=u,b=this.getPropertyValue(f,"type");if(b){let h=`${r}.${n}[${m}]`;this.validateEntityProperties(f,h,b,o,s,i)}else{let h=this.getPropertyValue(p,"range");if(h){let k=`${r}.${n}[${m}]`;this.validateEntityProperties(f,k,h,o,s,i)}}}}}}}isTypeCompatibleWithDomain(e,r,t){if(e===r)return!0;let o=new Set,s=[e];for(;s.length>0;){let i=s.shift();if(o.has(i))continue;o.add(i);let n=t.get(i);if(n)for(let l of n){if(l===r)return!0;s.push(l)}}return!1}getPropertyValue(e,r){if(r in e){let t=e[r];return this.extractFirstValue(t)}for(let t of Object.keys(e))if(t.endsWith(`.${r}`)){let o=e[t];return this.extractFirstValue(o)}}extractFirstValue(e){if(Array.isArray(e)){let r=[];for(let t of e)r.push(t?.toString()??"");return r.length>0?r[0]:void 0}return e?.toString()}};function Ce(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}var Z=class{get ruleName(){return"PropertyValueType"}async validateAsync(e,r){let t=[],o=new Map;for(let[s,i]of Object.entries(e.body))if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let n=i,l=this.getPropertyValue(n,"type");(l==="DatatypeProperty"||l==="ObjectProperty")&&o.set(s,n)}for(let[s,i]of Object.entries(e.body)){if(typeof i!="object"||i===null||Array.isArray(i))continue;let n=i,l=this.getPropertyValue(n,"type");if(!(!l||l==="Class"||l.endsWith("Property")||l==="AnnotationProperty"))for(let[a,c]of Object.entries(n)){if(a==="type"||a==="label"||a==="comment")continue;let p=a,y=a.lastIndexOf(".");y>0&&y<a.length-1&&(p=a.substring(y+1));let m=o.get(p);if(!m)continue;let u=this.getPropertyValue(m,"type"),f=this.getPropertyValue(m,"range");if(u==="DatatypeProperty"){if(typeof c=="object"&&c!==null&&!Array.isArray(c)||Array.isArray(c))t.push({ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:a,message:`Property '${a}' is a DatatypeProperty with range '${f}' but instance '${s}' has a complex object value`,suggestion:`Either:
|
|
40
40
|
1. Create a class for this data and change '${a}' to an ObjectProperty
|
|
41
41
|
2. Store as a JSON string to keep it as DatatypeProperty
|
|
42
|
-
3. Use separate properties instead of nesting`,expectedValue:`A simple value of type '${f}'`});else if(!this.validateDatatypeValue(f,c)){let b={ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:a,message:`Property '${a}' expects type '${f}' but instance '${s}' has value of type '${this.getValueTypeName(c)}'`,suggestion:`Provide a value of type '${f}'`,toString:()=>""};f&&(b.expectedValue=f),t.push(b)}}else if(u==="ObjectProperty")if(Array.isArray(c))for(let b=0;b<c.length;b++){let h=c[b];typeof h!="string"&&(typeof h!="object"||h===null||Array.isArray(h))&&t.push({ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:`${a}[${b}]`,message:`ObjectProperty '${a}' array item ${b} in instance '${s}' has invalid type '${this.getValueTypeName(h)}'`,suggestion:"Array items must be references (strings) or embedded objects (dictionaries)",expectedValue:"string or object"})}else typeof c!="string"&&(typeof c!="object"||c===null||Array.isArray(c))&&t.push({ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:a,message:`ObjectProperty '${a}' in instance '${s}' has invalid value type '${this.getValueTypeName(c)}'`,suggestion:"Value must be a reference (string), embedded object (dictionary), or array of these",expectedValue:`Reference to ${f} or embedded ${f} object`})}}return t}validateDatatypeValue(e,r){switch(e?.toLowerCase()){case"string":return typeof r=="string";case"integer":case"int":return typeof r=="number"&&Number.isInteger(r);case"decimal":return typeof r=="number";case"boolean":return typeof r=="boolean";case"float":case"double":return typeof r=="number";default:return!0}}getValueTypeName(e){return typeof e=="string"?"string":typeof e=="number"?Number.isInteger(e)?"integer":"decimal":typeof e=="boolean"?"boolean":Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":e===null?"null":e===void 0?"undefined":typeof e}getPropertyValue(e,r){if(r in e){let t=e[r];if(Array.isArray(t)){let o=[];for(let s of t)o.push(s?.toString()??"");return o.length>0?o[0]:void 0}return t?.toString()}}};var
|
|
42
|
+
3. Use separate properties instead of nesting`,expectedValue:`A simple value of type '${f}'`});else if(!this.validateDatatypeValue(f,c)){let b={ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:a,message:`Property '${a}' expects type '${f}' but instance '${s}' has value of type '${this.getValueTypeName(c)}'`,suggestion:`Provide a value of type '${f}'`,toString:()=>""};f&&(b.expectedValue=f),t.push(b)}}else if(u==="ObjectProperty")if(Array.isArray(c))for(let b=0;b<c.length;b++){let h=c[b];typeof h!="string"&&(typeof h!="object"||h===null||Array.isArray(h))&&t.push({ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:`${a}[${b}]`,message:`ObjectProperty '${a}' array item ${b} in instance '${s}' has invalid type '${this.getValueTypeName(h)}'`,suggestion:"Array items must be references (strings) or embedded objects (dictionaries)",expectedValue:"string or object"})}else typeof c!="string"&&(typeof c!="object"||c===null||Array.isArray(c))&&t.push({ruleType:this.ruleName,severity:"Error",entityName:s,propertyName:a,message:`ObjectProperty '${a}' in instance '${s}' has invalid value type '${this.getValueTypeName(c)}'`,suggestion:"Value must be a reference (string), embedded object (dictionary), or array of these",expectedValue:`Reference to ${f} or embedded ${f} object`})}}return t}validateDatatypeValue(e,r){switch(e?.toLowerCase()){case"string":return typeof r=="string";case"integer":case"int":return typeof r=="number"&&Number.isInteger(r);case"decimal":return typeof r=="number";case"boolean":return typeof r=="boolean";case"float":case"double":return typeof r=="number";default:return!0}}getValueTypeName(e){return typeof e=="string"?"string":typeof e=="number"?Number.isInteger(e)?"integer":"decimal":typeof e=="boolean"?"boolean":Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":e===null?"null":e===void 0?"undefined":typeof e}getPropertyValue(e,r){if(r in e){let t=e[r];if(Array.isArray(t)){let o=[];for(let s of t)o.push(s?.toString()??"");return o.length>0?o[0]:void 0}return t?.toString()}}};var G=class{builtInClasses=new Set(["Resource","Class","Literal","Thing","Nothing","Property","DatatypeProperty","ObjectProperty","AnnotationProperty","FunctionalProperty","InverseFunctionalProperty","TransitiveProperty","SymmetricProperty","Package"]);get ruleName(){return"ClassDefinition"}async validateAsync(e,r){let t=[],o=new Map,s=new Set;for(let[n,l]of Object.entries(e.body))if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let c=l.type;if(c)if(Array.isArray(c))for(let p of c){let y=p?.toString();if(y==="Class"||y&&y.endsWith(".Class")){s.add(n);break}}else{let p=c?.toString();(p==="Class"||p&&p.endsWith(".Class"))&&s.add(n)}}for(let[n,l]of Object.entries(e.body))if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let a=l,c=a.type;if(c)if(Array.isArray(c)){let p=!1;for(let y of c){let m=y?.toString();if(m&&this.isDefinitionType(m)){p=!0;break}}if(!p)for(let y of c){let m=y?.toString();m&&m.trim().length>0&&(o.has(m)||o.set(m,[]),o.get(m).push(n))}}else{let p=c?.toString();p&&p.trim().length>0&&(this.isDefinitionType(p)||(o.has(p)||o.set(p,[]),o.get(p).push(n)))}this.checkNestedTypes(a,n,o,n)}let i=new v(r);for(let[n,l]of o){if(this.builtInClasses.has(n)||s.has(n))continue;let a=await i.resolveEntityAsync(n,e);if(!(a&&this.isClassEntity(a.entity))){let p=Array.from(new Set(l)).sort();for(let y of p)t.push({ruleType:this.ruleName,severity:"Error",message:`Class '${n}' is not defined or imported`,suggestion:`Define '${n}' as a Class in this document, or import a namespace that contains it`,entityName:y,propertyName:"type",actualValue:n,expectedValue:"Defined or imported class"})}}return t}checkNestedTypes(e,r,t,o){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=e,i=s.type;if(i){let n=new Set(["Class","DatatypeProperty","ObjectProperty","AnnotationProperty"]);if(Array.isArray(i))for(let l of i){let a=l?.toString();a&&a.trim().length>0&&!n.has(a)&&(t.has(a)||t.set(a,[]),t.get(a).push(o))}else{let l=i?.toString();l&&l.trim().length>0&&!n.has(l)&&(t.has(l)||t.set(l,[]),t.get(l).push(o))}}for(let[n,l]of Object.entries(s))if(n!=="type"){let a=`${o}.${n}`;this.checkNestedTypes(l,r,t,a)}}else if(Array.isArray(e))for(let s=0;s<e.length;s++){let i=`${o}[${s}]`;this.checkNestedTypes(e[s],r,t,i)}}isClassEntity(e){if(!e)return!1;let r=e.type;if(!r)return!1;if(Array.isArray(r))for(let t of r){let o=t?.toString();if(o==="Class"||o&&o.endsWith(".Class"))return!0}else{let t=r?.toString();if(t==="Class"||t&&t.endsWith(".Class"))return!0}return!1}isDefinitionType(e){return!e||e.trim().length===0?!1:new Set(["Class","Property","DatatypeProperty","ObjectProperty","AnnotationProperty"]).has(e)?!0:e.endsWith(".Class")||e.endsWith(".Property")||e.endsWith(".DatatypeProperty")||e.endsWith(".ObjectProperty")||e.endsWith(".AnnotationProperty")}};var J=class{ruleName="MarkdownLink";async validateAsync(e,r,t){let o=[],s;if(t){let i=await t.getKanonaks(),n=Ne(e);s=n?i.filter(l=>l instanceof I&&l.namespace===n):[]}else{let i=new O(e,r);s=await new D().parseKanonaks(i)}for(let i of s)i instanceof I&&this.checkDefined(i,i.name,o);return o}checkDefined(e,r,t){for(let o of e.statement)if(o instanceof ke){let s=o.predicate.subject?.name??"(unknown)";for(let i of o.links)i.target||t.push(this.unresolvedLinkError(r,s,i.reference));for(let i of Ve(o.object))t.push(this.malformedLinkError(r,s,i.snippet))}else if(o instanceof be)this.checkDefined(o.object,r,t);else if(o instanceof Re)for(let s of o.object)s instanceof ee&&this.checkDefined(s,r,t)}unresolvedLinkError(e,r,t){let o=new g;return o.ruleType=this.ruleName,o.severity="Error",o.entityName=e,o.propertyName=r,o.actualValue=t,o.message=`Embedded link [[${t}]] in '${r}' could not be resolved`,o.expectedValue="A reference resolvable through the document's import closure",o.suggestion=`The reference '${t}' inside a markdown value cannot be found in the current document or any imported namespace.
|
|
43
43
|
|
|
44
44
|
Possible solutions:
|
|
45
45
|
\u2022 Import the package that defines '${t}' so the link can resolve
|
|
@@ -51,9 +51,14 @@ long reference across two lines in a block scalar, e.g.:
|
|
|
51
51
|
... read for [[persistent-energy-
|
|
52
52
|
shock]] held ...
|
|
53
53
|
which is parsed as literal text, not a link. Keep each [[reference]] on one
|
|
54
|
-
line (let the line run long), or check for an unterminated [[.`,o}};function
|
|
54
|
+
line (let the line run long), or check for an unterminated [[.`,o}};function Ne(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}var je="kanonak.org",$e="look",Ke={publisher:je,package_:$e,name:"displayLabel"},Te={publisher:je,package_:$e,name:"displaySummary"},Q=class{ruleName="DisplayLensScope";async validateAsync(e,r,t){let o=[],s;t?s=await t.getKanonaks():s=await new D().parseKanonaks(new O(e,r));let i=xe(e);if(!i)return o;for(let n of s)n instanceof I&&n.namespace===i&&(this.checkLens(s,n,Ke,"displayLabel",o),this.checkLens(s,n,Te,"displaySummary",o));return o}checkLens(e,r,t,o,s){let i=ie(r,t);if(!i)return;let n=[],l=ae(r);if(l&&n.push(l),n.push(...Ae(r)),n.length===0)return;n.some(c=>le(e,c,i).ok)||s.push(this.scopeError(r.name,o,i.name))}scopeError(e,r,t){let o=new g;return o.ruleType=this.ruleName,o.severity="Error",o.entityName=e,o.propertyName=r,o.actualValue=t,o.message=`${r} points at '${t}', which is not a property in scope for '${e}'`,o.expectedValue="A property whose domain is this resource's class, an ancestor, or rdfs.Resource",o.suggestion=`'${t}' resolves, but its domain does not cover '${e}', so the lens would silently fall back to the resource's name at render time.
|
|
55
55
|
|
|
56
56
|
Possible solutions:
|
|
57
57
|
\u2022 Point ${r} at a property declared on this class (or an ancestor / rdfs.Resource)
|
|
58
58
|
\u2022 Set the property's domain to this class if it should apply here
|
|
59
|
-
\u2022 Use rdfs.label / rdfs.comment for the universal default`,o}};function
|
|
59
|
+
\u2022 Use rdfs.label / rdfs.comment for the universal default`,o}};function xe(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}var re="kanonak.org",oe="look",_e={publisher:re,package_:oe,name:"semanticSvg"},Le={publisher:re,package_:oe,name:"tierChip"},Me={publisher:re,package_:oe,name:"tierIcon"},Ue={publisher:re,package_:oe,name:"tierCard"},We={publisher:re,package_:oe,name:"tierFull"},He=[Le,Me,Ue,We],te=class{ruleName="LookSemanticSvgPath";async validateAsync(e,r,t){let o=[],s;t?s=await t.getKanonaks():s=await new D().parseKanonaks(new O(e,r));let i=Fe(e);if(!i)return o;for(let n of s)n instanceof I&&n.namespace===i&&this.checkSemanticSvg(s,n,o);return o}checkSemanticSvg(e,r,t){let o=se(r,_e);if(!o)return;let s=ae(r);if(s)for(let i of He){let n=se(o,i);n&&this.walkExpression(e,s,r.name,i.name,n,t)}}walkExpression(e,r,t,o,s,i){if(ne(s,A.PropertyRead)&&this.checkPropertyRead(e,r,t,o,s,i),ne(s,A.Concat)){for(let n of De(s,A.parts))n instanceof ee&&this.walkExpression(e,r,t,o,n,i);return}for(let n of s.statement){let l=n.object;l instanceof ee&&this.walkExpression(e,r,t,o,l,i)}}checkPropertyRead(e,r,t,o,s,i){let n=se(s,A.readSource);if(!n||!ne(n,A.VarRef)||ve(n,A.varName)!=="input")return;let a=ie(s,A.readProp);if(!a||le(e,r,a).ok)return;let p=new g;p.ruleType=this.ruleName,p.severity="Error",p.entityName=t,p.propertyName=`look.semanticSvg.${o}`,p.actualValue=`${a.publisher}/${a.package_}/${a.name}`,p.message=`tx.PropertyRead reads property '${a.name}' off the rendered instance, but its domain is not in scope for '${t}' (the class this SemanticSvg is declared on). The read would silently return undefined at render time.`,p.expectedValue=`A property whose domain is '${t}', an ancestor, or rdfs.Resource`,p.suggestion=`Property '${a.publisher}/${a.package_}/${a.name}' resolves, but its domain does not cover '${t}'.
|
|
60
|
+
|
|
61
|
+
Possible solutions:
|
|
62
|
+
\u2022 Read a property declared on '${t}' (or an ancestor / rdfs.Resource)
|
|
63
|
+
\u2022 If the property should apply to '${t}', adjust its domain
|
|
64
|
+
\u2022 If the value comes from a pre-computed env binding, use tx.VarRef instead of PropertyRead`,i.push(p)}};function Fe(d){let e=d.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${P(e.version)}`}var de=class{parser;documentRules;repositoryRules;includeWarnings=!0;constructor(e){this.parser=e??new he,this.documentRules=[new E,new j,new $,new S],this.repositoryRules=[new C,new N,new K,new T,new x,new _,new L,new M,new U,new W,new H,new F,new B,new q,new X,new z,new Y,new Z,new G,new J,new Q,new te]}async validateAsync(e,r,t){let o=new w;for(let s of this.documentRules)try{let i=s.validate(e);this.addErrorsToResult(o,i)}catch(i){let n=new g;n.ruleType=s.ruleName,n.severity="Error",n.message=`Validation rule '${s.ruleName}' failed: ${i instanceof Error?i.message:String(i)}`,o.errors.push(n)}if(r){let s=[],i=t?.repository??r;for(let n of this.repositoryRules)try{let l=await n.validateAsync(e,i,t);this.addErrorsToResult(o,l)}catch(l){let a=l instanceof Error?l.message:String(l);s.push({ruleName:n.ruleName,cause:a})}if(s.length>0){let n=new Map;for(let{ruleName:l,cause:a}of s){let c=n.get(a);c?c.push(l):n.set(a,[l])}for(let[l,a]of n){let c=new g;c.ruleType=a[0],c.severity="Error",a.length===1?c.message=`Validation rule '${a[0]}' failed: ${l}`:c.message=`${l} (affects ${a.length} rules: ${a.join(", ")})`,o.errors.push(c)}}}return o.isValid=o.errors.length===0,o}async validateYamlAsync(e,r,t){let o=this.parser.parseWithErrors(e);if(!o.isValid){let s=new w;s.isValid=!1;for(let i of o.errors){let n=new g;n.ruleType="ParseError",n.severity="Error",n.lineNumber=i.line,n.column=i.column,n.message=i.message,i.keyName&&(n.entityName=i.keyName),i.errorType==="DuplicateKey"&&(n.suggestion="All property names must be unique across the entire document. Rename one of the duplicate properties to make them unique."),s.errors.push(n)}return s}return await this.validateAsync(o.document,r,t)}addDocumentRule(e){this.documentRules.push(e)}addRepositoryRule(e){this.repositoryRules.push(e)}removeDocumentRule(e){let r=this.documentRules.findIndex(t=>t instanceof e);r>=0&&this.documentRules.splice(r,1)}removeRepositoryRule(e){let r=this.repositoryRules.findIndex(t=>t instanceof e);r>=0&&this.repositoryRules.splice(r,1)}addErrorsToResult(e,r){for(let t of r)t.severity==="Error"?e.errors.push(t):this.includeWarnings&&e.warnings.push(t)}};export{w as a,R as b,g as c,ye as d,ue as e,E as f,j as g,$ as h,S as i,C as j,N as k,K as l,T as m,x as n,_ as o,L as p,M as q,U as r,W as s,H as t,F as u,B as v,q as w,X as x,z as y,Y as z,Z as A,G as B,J as C,Q as D,de as E};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ut,b as pt,c as mt,d as ft,e as yt}from"./chunk-
|
|
1
|
+
import{a as ut,b as pt,c as mt,d as ft,e as yt}from"./chunk-2OXZDBHX.js";import{a as sr,j as cr}from"./chunk-C5NKFT7W.js";import{a as ct,b as lt,c as dt,d as b,e as S,f as i}from"./chunk-7ZCFYITD.js";import{a as ir}from"./chunk-W4LPC6VM.js";import"./chunk-QHABFCRC.js";import{a as Le,b as Fe,c as De,d as Ne,e as Oe,f as Me,g as _e,h as ze}from"./chunk-EOMKFFKU.js";import{b as Ae,c as Ue,d as He}from"./chunk-U75VPNYW.js";import{a as Te}from"./chunk-4NO7MHS7.js";import{a as ht,b as kt,c as bt,d as St}from"./chunk-6T2XFOMU.js";import{a as Ct,b as Kt}from"./chunk-PEUTCG3B.js";import{a as wt}from"./chunk-PEJALHXK.js";import{a as Ve}from"./chunk-SC5M74NM.js";import{A as rr,B as nr,C as or,E as ar,a as It,b as Bt,c as Tt,d as jt,e as Lt,f as Ft,g as Dt,h as Nt,i as Ot,j as At,k as Ut,l as Vt,m as Ht,n as Mt,o as _t,p as zt,q as Gt,r as Wt,s as Jt,t as qt,u as Yt,v as Xt,w as Zt,x as Qt,y as er,z as tr}from"./chunk-XEFBKQY5.js";import"./chunk-SHDHMKMJ.js";import{a as F,b as N,c as Ye,d as ot,e as at,f as it}from"./chunk-PODBS4IU.js";import{a as je}from"./chunk-ORFSMEMM.js";import{a as st,b as Pt,c as Rt,d as xt,e as vt,f as $t,g as Et}from"./chunk-N224PFBI.js";import"./chunk-Q4DKP5DO.js";import{b as Xe,c as Ze,d as Qe,e as et,f as tt,h as rt,j as nt}from"./chunk-64TVBQFR.js";import{a as Ge,b as j,c as L,d as D,e as Je,f as qe,g as O,h as A,i as U,j as V,k as H,l as M}from"./chunk-W6T7MOKY.js";import{a as We}from"./chunk-FUUTGGJS.js";import{a as Pe,b as Re,c as we,d as xe,e as ve,f as $e,g as Ee,h as Ke,i as Ie,j as Be}from"./chunk-2ACBWC7K.js";import{a as gt}from"./chunk-ODIECDN7.js";import{VersionOperator as ko}from"@kanonak-protocol/types/document/models/enums";import{existsSync as vr,readFileSync as $r}from"fs";import{homedir as Er}from"os";import{join as Kr}from"path";import{execFile as lr}from"child_process";import{promisify as dr}from"util";var C=dr(lr),P="kanonak",R="/usr/bin/security",p=class{async get(e){let r=i(e);try{let{stdout:n}=await C(R,["find-generic-password","-s",P,"-a",r,"-w"],{timeout:1e4});try{return JSON.parse(n.trim())}catch{throw new Error(`Stored credential for '${r}' is corrupted (not valid JSON).
|
|
2
2
|
Run 'kanonak logout ${r}' then 'kanonak login ${r}' to fix.`)}}catch(n){if(X(n,44))return null;throw new Error(`macOS Keychain read failed for '${r}': ${w(n)}
|
|
3
3
|
The Keychain may be locked or inaccessible.
|
|
4
4
|
Try unlocking it via Keychain Access.app or running 'security unlock-keychain'.`)}}async store(e,r){let n=i(e),o=JSON.stringify(r);try{await C(R,["add-generic-password","-s",P,"-a",n,"-U","-w",o],{timeout:1e4})}catch(a){throw new Error(`macOS Keychain write failed for '${n}': ${w(a)}
|
|
@@ -135,7 +135,35 @@ export declare class LookRenderer {
|
|
|
135
135
|
* the first letter; tier-card adds the full label; tier-full adds
|
|
136
136
|
* the subtitle plus the canonical URI footer.
|
|
137
137
|
*/
|
|
138
|
-
renderSvg(instance: SubjectKanonak): string
|
|
138
|
+
renderSvg(instance: SubjectKanonak): Promise<string>;
|
|
139
|
+
/**
|
|
140
|
+
* Lazily-constructed `ReferenceResolver` used by `ExpressionEngineV3`
|
|
141
|
+
* for advanced features (Traverse, ResolveRef). For the tier-fragment
|
|
142
|
+
* use case the resolver is rarely invoked — tier expressions are
|
|
143
|
+
* typically a Concat over StringLiteral / VarRef / Normalize /
|
|
144
|
+
* PropertyRead which look at the catalog directly. The empty
|
|
145
|
+
* in-memory repository simply makes the resolver's repo-fallback path
|
|
146
|
+
* a no-op; catalog-local lookups continue to work.
|
|
147
|
+
*/
|
|
148
|
+
private resolverInstance;
|
|
149
|
+
private expressionResolver;
|
|
150
|
+
/**
|
|
151
|
+
* Compile + evaluate a tier's `tx.Expression` against the rendering env
|
|
152
|
+
* and assemble the resulting string. The fragment is typically a
|
|
153
|
+
* `tx.Concat`; we inspect parts individually so we can apply different
|
|
154
|
+
* escape policies per part type:
|
|
155
|
+
*
|
|
156
|
+
* - `tx.StringLiteral` and `tx.UnescapedString` → emit verbatim
|
|
157
|
+
* (author-trusted SVG markup); the latter goes through the
|
|
158
|
+
* `raw-string` marker the engine emits, which we unwrap.
|
|
159
|
+
* - Anything else (PropertyRead, VarRef, Normalize over user data,
|
|
160
|
+
* Concat results …) → HTML/SVG-escape so untrusted values can't
|
|
161
|
+
* break out of the surrounding markup.
|
|
162
|
+
*
|
|
163
|
+
* A non-Concat top-level expression is evaluated whole and formatted
|
|
164
|
+
* with the same per-kind escape policy.
|
|
165
|
+
*/
|
|
166
|
+
private evaluateTier;
|
|
139
167
|
/**
|
|
140
168
|
* Apply {{...}} placeholders to a slot SVG template.
|
|
141
169
|
*
|
package/dist/parsing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f}from"../chunk-
|
|
1
|
+
import{a as c,b as d,c as e,d as f}from"../chunk-6T2XFOMU.js";import{f as b}from"../chunk-PODBS4IU.js";import{a}from"../chunk-ORFSMEMM.js";import"../chunk-64TVBQFR.js";import"../chunk-W6T7MOKY.js";import"../chunk-FUUTGGJS.js";import"../chunk-2ACBWC7K.js";export{d as KanonakDocumentPositions,b as KanonakObjectParser,a as KanonakParser,c as PropertyMetadata,f as findMarkdownLinkAt,e as parseWithPositions};
|