@kanonak-protocol/cli 5.30.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -291,7 +291,7 @@ ${c}
291
291
  `)}renderPropertyTable(e,n,r,a=""){let s=ge(e,et);if(!s)return"<!-- LookRenderer: PropertyTable missing look.source -->";let i=this.gatherValueItems(_e(n,s)).filter(u=>u instanceof K);if(i.length===0)return"";let o=this.readLabelForUri(s)??s.name,l=a?`${a}.${s.name}`:s.name,c=ge(e,FP);return this.renderEmbeddedTable(i,r,o,l,c)}renderEmbeddedTable(e,n,r,a,s){let i=[],o=new Set;for(let g of e)for(let k of g.statement){let y=k.predicate?.subject;if(!y||this.isMetaPredicate(y))continue;let w=`${y.publisher}/${y.package_}/${y.name}`;o.has(w)||(o.add(w),i.push({uri:{publisher:y.publisher,package_:y.package_,name:y.name},label:this.readLabelForUri(y)??y.name}))}if(i.length===0)return"";let l=e.map(g=>de(this.catalog,g).label),c=e.some((g,k)=>l[k]!==""&&l[k]!==g.name),u=!!a,p=(u?'<th class="kan-anchor-col"></th>':"")+(c?"<th></th>":"")+i.map(g=>`<th>${j(g.label)}</th>`).join(""),f=e.map((g,k)=>{let y=u&&g.name?`${a}.${g.name}`:"",w=y?` id="${j(y)}"`:"",$=u?`<td class="kan-anchor-col">${y?this.anchorLink(y):""}</td>`:"",S=c?`<th scope="row">${j(l[k]??"")}</th>`:"",x=i.map(C=>{let A=_e(g,C.uri);return A?`<td>${this.tableCellValue(A,n,s)}</td>`:"<td></td>"}).join("");return`<tr${w}>${$}${S}${x}</tr>`}).join(""),d=u&&a?` id="${j(a)}"`:"",h=u&&a?this.anchorLink(a):"",m=r?`<caption>${j(r)}${h}</caption>`:"";return`<table class="kan-property-table"${d}>${m}<thead><tr>${p}</tr></thead><tbody>${f}</tbody></table>`}tableCellValue(e,n,r){if(r&&we(r,Wg)){if(e instanceof Se)return this.barMarkup(String(e.object));if(e instanceof ae&&Number.isFinite(Number(e.object)))return this.barMarkup(e.object)}if(e instanceof bt)return this.statementToMarkdownHtml(e,n);if(e instanceof ae)return sy(e.object);if(e instanceof Se||e instanceof be)return j(String(e.object));if(e instanceof z&&e.object instanceof P)return this.detailReferenceLink(e.object,n);if(e instanceof ne)return this.renderEmbeddedTable([e.object],n);if(e instanceof H){let a=e.object??[],s=a.filter(i=>i instanceof K);return s.length>0&&s.length===a.length?this.renderEmbeddedTable(s,n):a.map(i=>i instanceof P?this.detailReferenceLink(i,n):i instanceof K?this.renderEmbeddedTable([i],n):j(String(i))).filter(i=>i).join(", ")}return""}statementToMarkdownHtml(e,n){let r=new Map,a;if(e instanceof bt?a=this.resolveMarkdownLinks(e,n,r):e instanceof ae&&(a=e.object),!a)return"";let s=this.codeHighlighter(),i=ys(a,{highlight:(o,l)=>s.highlight(o,l)});for(let[o,l]of r){let c=new RegExp('(<a href="'+ay(o)+'">)([^<]*)(</a>)',"g");i=i.replace(c,`$1<img class="kan-md-chip" src="${j(l)}" alt="" loading="lazy">$2$3`)}return i}renderBadgeRow(e,n,r){let a=ge(e,et);if(!a)return"<!-- LookRenderer: BadgeRow missing look.source -->";let s=this.readPropertyValueReferences(n,a);return s.length===0?"":`<div class="kan-badge-row">${s.map(i=>this.renderBadge(i,et,r)).join("")}</div>`}renderChipRow(e,n,r){let a=mu(e,c1);if(a.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let s=[];for(let i of a){let o=_e(n,i);if(!o)continue;let l=this.readLabelForUri(i)??i.name,c=this.renderStatementInlineValue(o,i,r);c&&s.push(`<span class="kan-chip"><span class="kan-chip-key">${j(l)}</span> <span class="kan-chip-val">${c}</span></span>`)}return s.length===0?"":`<div class="kan-chip-row">${s.join("")}</div>`}async renderReferenceList(e,n,r){let a=mu(e,ey);if(a.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let s=this.readEmbeddedCarrier(e,Hg),i=this.readEmbeddedCarrier(e,MP),o=[];for(let l of a){let c=this.readPropertyValueReferences(n,l);if(c.length===0)continue;let u=this.readLabelForUri(l)??l.name;if(s){let p=[];for(let d of c)p.push(await this.renderDetailRow(d,s,i,r));let f=p.filter(d=>d).join("");f&&o.push(`<dt>${j(u)}</dt><dd><ul class="kan-ref-rows">${f}</ul></dd>`)}else{let p=c.map(f=>this.renderReferenceLink(f,ey,r)).join(", ");o.push(`<dt>${j(u)}</dt><dd>${p}</dd>`)}}return o.length===0?"":`<dl class="kan-reference-list">${o.join("")}</dl>`}async renderDetailRow(e,n,r,a){let s=Le(this.catalog,{publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name,...e.subject.version?{version:e.subject.version}:{}});if(!s)return"";let i=await this.evaluateCarrier(n,s)??de(this.catalog,s).label,o="";if(r){let p=await this.evaluateCarrier(r,s);p&&(o=`<span class="kan-ref-badge">${j(p)}</span>`)}let l=`<span class="kan-ref-text">${j(i)}</span>${o}`;if(!this.isLinkable(Be(s),a))return`<li class="kan-ref-row"><span class="kan-ref-rowlink">${l}</span></li>`;let c=this.hrefForSubject(s,a),u=this.svgUrlForSubject(s,a);return`<li class="kan-ref-row"><a class="kan-ref-rowlink" href="${j(c)}"><img class="kan-ref-icon" src="${j(u)}" alt="" loading="lazy"/>`+l+"</a></li>"}readPropertyValueText(e,n){let r=_e(e,n);if(r){if(r instanceof ae)return r.object;if(r instanceof Se||r instanceof be)return String(r.object);if(r instanceof z){let a=r.object;return this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name}if(r instanceof ne)return this.readEmbeddedText(r.object,0)||void 0;if(r instanceof H)return(r.object??[]).map(a=>a instanceof P?this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name:a instanceof K?this.readEmbeddedText(a,0):String(a)).filter(a=>a).join(", ")}}readEmbeddedText(e,n){if(n>=Qg)return"\u2026";let r=[];for(let a of e.statement){let s=a.predicate?.subject;if(!(s&&we(s,Cn)))if(a instanceof ae)r.push(a.object);else if(a instanceof Se||a instanceof be)r.push(String(a.object));else if(a instanceof z){let i=a.object;r.push(this.readLabelForUri({publisher:i.subject.publisher,package_:i.subject.package_,name:i.subject.name})??i.subject.name)}else a instanceof ne&&r.push(this.readEmbeddedText(a.object,n+1))}return r.filter(a=>a).join(", ")}readPropertyValueReferences(e,n){let r=_e(e,n);if(!r)return[];if(r instanceof z)return[r.object];if(r instanceof H){let a=[];for(let s of r.object??[])s instanceof P&&a.push(s);return a}return[]}gatherValueItems(e){return e?e instanceof H?e.object??[]:e instanceof z?[e.object]:e instanceof ne?[e.object]:e instanceof ae?[e.object]:e instanceof Se||e instanceof be?[e.object]:[]:[]}renderInlineValue(e,n,r,a=0){return e instanceof P?this.renderReferenceLink(e,n,r):e instanceof K?this.renderEmbeddedInline(e,r,a):typeof e=="string"?j(e):typeof e=="number"||typeof e=="boolean"?j(String(e)):""}renderStatementInlineValue(e,n,r,a=0){return e instanceof ae?j(e.object):e instanceof Se||e instanceof be?j(String(e.object)):e instanceof z?this.renderReferenceLink(e.object,n,r):e instanceof ne?this.renderEmbeddedInline(e.object,r,a):e instanceof H?(e.object??[]).map(s=>this.renderInlineValue(s,n,r,a)).filter(s=>s).join(", "):""}renderEmbeddedInline(e,n,r=0){if(r>=Qg)return"\u2026";let a=[];for(let s of e.statement){let i=s.predicate?.subject;if(!i||we(i,Cn))continue;let o=this.readLabelForUri({publisher:i.publisher,package_:i.package_,name:i.name})??i.name,l=this.renderStatementInlineValue(s,i,n,r+1);l&&a.push(`<dt>${j(o)}</dt><dd>${l}</dd>`)}return a.length?`<dl class="kan-embedded">${a.join("")}</dl>`:""}renderReferenceLink(e,n,r){let a=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name;if(!this.isLinkable(e.subject.publisher,r))return`<span class="kan-link-plain">${j(a)}</span>`;let s=this.urlForReference(e,n,r);return`<a class="kan-link" href="${j(s)}">${j(a)}</a>`}isLinkable(e,n){return this.publisherFirst||e===n}renderBadge(e,n,r){let a=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,s=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),i=s?` title="${j(s)}"`:"";if(!this.isLinkable(e.subject.publisher,r))return`<span class="kan-badge"${i}>${j(a)}</span>`;let o=this.urlForReference(e,n,r);return`<a class="kan-badge" href="${j(o)}"${i}>${j(a)}</a>`}urlForReference(e,n,r){let a=n?this.getUrlFormForProperty(n):"=";return this.resourceHref({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},r,a)}getUrlFormForProperty(e){let n=Le(this.catalog,e);if(!n)return"=";let r=Re(n,u1);return r==="*"||r==="^"||r==="~"||r==="="?r:"="}readLabelForUri(e){let n=Le(this.catalog,e);if(n)return de(this.catalog,n).label}readCommentForUri(e){let n=Le(this.catalog,e);if(n)return de(this.catalog,n).summary}};function p1(t){let e=new Map;for(let n of t.statement){if(!(n instanceof ne)||!Bt(n,Qi.publisher,Qi.package_,Qi.name))continue;let r=n.object;for(let a of r.statement){if(!(a instanceof ae))continue;let s=a.predicate?.subject?.name;if(!s)continue;let i=a.object;e.has(s)||e.set(s,i)}}return e}function zi(t){for(let e of t.statement)if(e instanceof ne&&Bt(e,Xi.publisher,Xi.package_,Xi.name))return e.object}function du(t){for(let e of t.statement){if(!(e instanceof H)||!Bt(e,fu.publisher,fu.package_,fu.name))continue;let n=[];for(let r of e.object??[])r instanceof K&&n.push(r);return n}return[]}function sa(t){for(let e of t.statement)if(e instanceof z&&!(!e.predicate?.subject||!we(e.predicate.subject,Cn))&&e.object instanceof P){let n=e.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function ge(t,e){for(let n of t.statement)if(n instanceof z&&Bt(n,e.publisher,e.package_,e.name)&&n.object instanceof P){let r=n.object.subject;return{publisher:r.publisher,package_:r.package_,name:r.name}}}function mu(t,e){for(let n of t.statement){if(!(n instanceof H)||!Bt(n,e.publisher,e.package_,e.name))continue;let r=[];for(let a of n.object??[])a instanceof P&&r.push({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name});return r}return[]}function _e(t,e){for(let n of t.statement)if(Bt(n,e.publisher,e.package_,e.name))return n}function Re(t,e){for(let n of t.statement)if(n instanceof ae&&Bt(n,e.publisher,e.package_,e.name))return n.object}function Gi(t,e){for(let n of t.statement)if(n instanceof ne&&Bt(n,e.publisher,e.package_,e.name))return n.object}function ty(t,e){for(let n of t.statement)if(n instanceof Se&&Bt(n,e.publisher,e.package_,e.name))return n.object}function f1(t,e){for(let n of t.statement)if(n instanceof be&&Bt(n,e.publisher,e.package_,e.name))return n.object===!0;return!1}function d1(t){for(let e of wt(t))if(we(e.subject,uC)||we(e.subject,pC))return!0;return!1}function wt(t){let e=[];for(let n of t.statement)if(n instanceof z){if(!n.predicate?.subject||!we(n.predicate.subject,Cn))continue;n.object instanceof P&&e.push(n.object)}else if(n instanceof H){if(!n.predicate?.subject||!we(n.predicate.subject,Cn))continue;for(let r of n.object??[])r instanceof P&&e.push(r)}return e}function Yi(t){let e=[];for(let n of t.statement)if(n instanceof z){if(!n.predicate?.subject||!we(n.predicate.subject,wu))continue;n.object instanceof P&&e.push(n.object)}else if(n instanceof H){if(!n.predicate?.subject||!we(n.predicate.subject,wu))continue;for(let r of n.object??[])r instanceof P&&e.push(r)}return e}function Le(t,e){let n="version"in e?e.version:void 0;if(n){let r=`${e.publisher}/${e.package_}@${n.major}.${n.minor}.${n.patch}`;for(let a of t)if(a instanceof L&&a.name===e.name&&a.namespace===r)return a}for(let r of t)if(!(!(r instanceof L)||r.name!==e.name)&&(r.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return r}function Bt(t,e,n,r){let a=t.predicate?.subject;return a?a.publisher===e&&a.package_===n&&a.name===r:!1}function we(t,e){return t.publisher===e.publisher&&t.package_===e.package_&&t.name===e.name}function Ne(t){return`${t.publisher}/${t.package_}/${t.name}`}function m1(t){let e=s=>s.replace(/\*\//g,"* /"),n=[];n.push(` * kanonak stylesheet \u2014 ${e(t.resource.namespace)}/${e(t.resource.name)}`),n.push(" *");let r=new Map;for(let s of t.tokens.values()){let i=`${s.sourceNamespace} ${s.sourceName}`,o=r.get(i)??{count:0,level:s.level};o.count+=1,r.set(i,o)}if(r.size===0)n.push(" * :root tokens: NONE resolved");else{n.push(` * :root tokens (${t.tokens.size}):`);for(let[s,{count:i,level:o}]of r)n.push(` * ${i} from ${e(s)} (${o})`)}let a=t.baseStylesheet;if(a.css!==void 0)n.push(` * base CSS: ${e(a.sourceNamespace??"")}/base-stylesheet (${a.css.length} bytes, ${a.scope})`);else{n.push(" *"),n.push(" * !! WARNING: NO BASE STYLESHEET \u2014 this file contains only :root tokens."),n.push(" * !! Pages will appear UNSTYLED.");for(let s of t.warnings)n.push(` * !! ${e(s)}`);n.push(" * !! Full diagnostics: /.well-known/kanonak-render")}if(t.look){let s=t.look.sourceClass;n.push(` * look: ${e(s.publisher)}/${e(s.package_)}/${e(s.name)}`)}return`/*
292
292
  ${n.join(`
293
293
  `)}
294
- */`}function Be(t){let e=t.namespace||"",n=e.indexOf("/");return n>=0?e.substring(0,n):e}function j(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _n(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ny(t,e){return e==null?"":cn(e)?e.value:t==="string-literal"?typeof e=="string"?e:String(e):Array.isArray(e)?e.map(n=>cn(n)?n.value:_n(typeof n=="string"?n:String(n))).join(""):_n(typeof e=="string"?e:String(e))}function fy(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(cn(t))return t.value;if(Array.isArray(t))return t.map(fy).filter(n=>n!=="").join(", ");if(t instanceof P)return t.subject.name;if(t instanceof L||t instanceof K)return t.name??"";let e=t.value;return typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}function hu(t,e){return t.length<=e?t:t.slice(0,e).replace(/\s+\S*$/,"")+"\u2026"}function ry(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ay(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sy(t){let e=Zi(t);return j(e||t)}function Zi(t){let e=/^(\d{4})-(\d{2})-(\d{2})([T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.exec(t.trim());if(!e)return;let n=Date.parse(t);if(!Number.isFinite(n))return;let r=new Date(n),a=`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getUTCMonth()]} ${r.getUTCDate()}, ${r.getUTCFullYear()}`;if(!e[4])return a;let s=r.getUTCHours(),i=(s+11)%12+1,o=s>=12?"PM":"AM";return`${a} \xB7 ${i}:${String(r.getUTCMinutes()).padStart(2,"0")} ${o} UTC`}function Ji(t){if(!t)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:t}function ju(){return new Set(nr.bandDispatchUris().map(t=>`${t.publisher}/${t.package_}/${t.name}`))}Lt();var Pu=class{isValid=!1;errors=[];warnings=[];infos=[];get totalIssues(){return this.errors.length+this.warnings.length+this.infos.length}get allDiagnostics(){return[...this.errors,...this.warnings,...this.infos]}},da=(t=>(t.Info="Info",t.Warning="Warning",t.Error="Error",t))(da||{}),se=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let t="";return this.lineNumber!==void 0&&(t+=`Line ${this.lineNumber}: `),this.entityName&&(t+=`[${this.entityName}] `),t+=this.message,t}};var Eu=class{constructor(t){this.underlying=t,this.repository=new h1(t)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(t=>t.merged)}getAuthoredKanonaks(){return this.parseOnce().then(t=>t.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let t=await this.underlying.getAllDocumentsAsync();await ds(t,this.repository);let e={};return{merged:await new te().parseKanonaks(this.underlying,e),authored:e.authored??[]}})()),this.parsePromise}},h1=class{constructor(t){this.inner=t}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(t){return this.inner.getDocumentAsync(t)}getDocumentsByNamespaceAsync(t,e){let n=`${t}/${e}`,r=this.byNamespaceCache.get(n);return r||(r=this.inner.getDocumentsByNamespaceAsync(t,e),this.byNamespaceCache.set(n,r),r)}getHighestCompatibleVersionAsync(t,e){let n=e.version,r=n?`${n.major}.${n.minor}.${n.patch}`:"",a=`${t}/${e.packageName}@${e.versionOperator}:${r}`,s=this.highestVersionCache.get(a);return s||(s=this.inner.getHighestCompatibleVersionAsync(t,e),this.highestVersionCache.set(a,s),s)}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(t){return this.inner.getDocumentContentAsync(t)}getDocumentUriAsync(t){return this.inner.getDocumentUriAsync(t)}};async function Pt(t,e,n){return n?n.getKanonaks():new te().parseKanonaks(new Ru(t,e))}async function Ut(t,e,n){let r=await Pt(t,e,n),a=Ou(t);return a?r.filter(s=>s instanceof L&&s.namespace===a):[]}async function Nu(t,e,n){let r=Ou(t);if(!r)return[];let a;if(n)a=await n.getAuthoredKanonaks();else{let s={};await new te().parseKanonaks(new Ru(t,e),s),a=s.authored??[]}return a.filter(s=>s instanceof L&&s.sourceDoc===r)}function Ou(t){let e=t.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${le(e.version)}`}var Ru=class{constructor(t,e){this.document=t,this.broader=e}document;broader;async getAllDocumentsAsync(){let t=this.document.metadata.namespace_?.toString(),e=(await this.broader.getAllDocumentsAsync()).filter(n=>n.metadata.namespace_?.toString()!==t);return[this.document,...e]}getDocumentAsync(t){return this.broader.getDocumentAsync(t)}getDocumentsByNamespaceAsync(t,e){return this.broader.getDocumentsByNamespaceAsync(t,e)}getHighestCompatibleVersionAsync(t,e){return this.broader.getHighestCompatibleVersionAsync(t,e)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(t){return this.broader.getDocumentContentAsync(t)}getDocumentUriAsync(t){return this.broader.getDocumentUriAsync(t)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}},Ny=class{constructor(t={}){this.options=t}options;ruleName="LinkTarget";async validateAsync(t,e,n){let r=[],a=new Map;for(let[l,c]of Object.entries(t.metadata?.imports??{}))for(let u of c)Rt(u)&&a.set(`${l}/${u.packageName}`,{publisher:l,import_:u});if(a.size===0)return r;let s=new Map,i=(l,c,u)=>{let p=`${l.publisher}/${l.package_}`;if(!a.has(p))return;let f=s.get(p)??[];f.push({uri:l,where:c,predicate:u}),s.set(p,f)},o=await Ut(t,e,n);Fn(o,({kanonak:l,path:c})=>{for(let u of l.statement){let p=u.predicate?.subject?.name??"(unknown)";if(u instanceof z)i(u.object.subject,c,p);else if(u instanceof H)for(let f of u.object)f instanceof P&&i(f.subject,c,p);else if(u instanceof bt)for(let f of u.links)f.target&&i(f.target.subject,c,p)}});for(let[l,c]of s){let{publisher:u,import_:p}=a.get(l),f=null,d;try{f=await e.getHighestCompatibleVersionAsync(u,p)}catch(h){d=h instanceof Error?h.message:String(h)}if(!f){let h=c[0],m=`${c.length} reference${c.length===1?"":"s"}, first at '${h.where}.${h.predicate}'`;this.options.offline?r.push(this.finding("Warning",h.where,h.predicate,l,`Link target package '${l}' could not be resolved offline (${m}); the link is UNVERIFIED, not known to be broken.`,"Run without --offline to verify the link over HTTP, or add the package to the workspace or cache.")):r.push(this.finding("Error",h.where,h.predicate,l,`Link target package '${l}' could not be resolved${d?` (${d})`:""} \u2014 ${m}.`,"Check the publisher and package name of the link import; a link must dereference even though it is not a dependency. Use --offline to validate without the network (the link is then reported as unverified)."));continue}for(let{uri:h,where:m,predicate:g}of c)Object.prototype.hasOwnProperty.call(f.body,h.name)||r.push(this.finding("Error",m,g,`${l}/${h.name}`,`Link to '${h.name}' in '${g}' at '${m}' does not dereference: package '${l}' (resolved to ${f.metadata.namespace_?.toString()??l}) defines no resource named '${h.name}'.`,`Check for a typo, or a resource renamed or removed in '${l}'; a link addresses a resource by name in its package's current version unless the import is pinned with '='.`))}return r}finding(t,e,n,r,a,s){let i=new se;return i.ruleType=this.ruleName,i.severity=t,i.entityName=e,i.propertyName=n,i.actualValue=r,i.expectedValue="A link that dereferences to a resource its target package defines",i.message=a,i.suggestion=s,i}},Oy=class Ry{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 n=[];for(let[r,a]of Object.entries(e.body))a&&typeof a=="object"&&!Array.isArray(a)&&this.validateEntity(r,a,n);return n}validateEntity(e,n,r){for(let[a,s]of Object.entries(n)){let i=s?.toString()??"";if(i&&Ry.NAMESPACE_PREFIX_PATTERN.test(i)){let o=this.getSuggestionForPrefixedValue(i),l=e.split(".")[0],c=new se;c.ruleType=this.ruleName,c.severity="Error",c.entityName=l,c.propertyName=e,c.actualValue=a,c.expectedValue=o,c.message=`Invalid namespace prefix '${i}'. Use '${o}' without prefix.`,c.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",r.push(c)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validateEntity(`${e}.${a}`,s,r)}}getSuggestionForPrefixedValue(e){let n=e.toLowerCase();if(n==="rdfs:class"||n==="owl:class")return"Class";if(n==="rdfs:property"||n==="rdf:property")return"DatatypeProperty or ObjectProperty";if(n.startsWith("xsd:"))return e.substring(4);let r=e.indexOf(":");return r>=0?e.substring(r+1):e}},Ly=class fa{static RESERVED_WORDS=new Set(["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 n=[],r=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[a,s]of Object.entries(e.body)){let i=fa.VALID_AUGMENTATION_PATTERN.test(a);if(!i&&!r&&fa.RESERVED_WORDS.has(a.toLowerCase())){let o=new se;o.ruleType=this.ruleName,o.severity="Error",o.entityName=a,o.message=`Entity name '${a}' is a reserved word and cannot be used.`,o.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",n.push(o);continue}if(!i&&!fa.VALID_NAME_PATTERN.test(a)){let o;/^\d/.test(a)?o="Entity names must start with a letter, not a number.":a.includes(" ")?o="Entity names cannot contain spaces. Use camelCase or underscores instead.":o="Entity names must start with a letter and contain only letters, numbers, and underscores.";let l=new se;l.ruleType=this.ruleName,l.severity="Error",l.entityName=a,l.message=`Invalid entity name '${a}'. ${o}`,l.suggestion=o,n.push(l)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validatePropertyNames(a,s,n)}return n}validatePropertyNames(e,n,r){for(let a of Object.keys(n))if(!fa.VALID_PROPERTIES.has(a)&&!fa.VALID_PROPERTY_NAME_PATTERN.test(a)){let s=new se;s.ruleType=this.ruleName,s.severity="Warning",s.entityName=e,s.propertyName=a,s.message=`Property name '${a}' in entity '${e}' doesn't follow naming conventions.`,s.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",r.push(s)}}},Ty=class Iy{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 n=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return n;let r=this.isPropertyDefinedAsClass(e);for(let[a,s]of Object.entries(e.body))if(s&&typeof s=="object"&&!Array.isArray(s)){let i=s,o=i.type;if(o){let l=[];if(Array.isArray(o))for(let c of o){let u=c?.toString();u&&u==="Property"&&!r&&l.push(u)}else{let c=o?.toString();c&&c==="Property"&&!r&&l.push(c)}for(let c of l){let u=this.getPropertyValue(i,"range"),p=this.determinePropertyType(u),f=new se;f.ruleType=this.ruleName,f.severity="Error",f.entityName=a,f.propertyName="type",f.actualValue=c,f.expectedValue=p,f.message=`Invalid property type '${c}'. Use '${p}' instead.`,f.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",n.push(f)}}}return n}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":Iy.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,n){let r=e[n];return r?r.toString():null}isPropertyDefinedAsClass(e){let n=e.body.Property;if(n&&typeof n=="object"&&!Array.isArray(n)){let r=n.type;if(r){let a=r.toString();return a==="Class"||a.endsWith(".Class")}}return!1}},Dy=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(t){let e=[];for(let[n,r]of Object.entries(t.body)){if(typeof r!="object"||r===null||Array.isArray(r)||n.includes("."))continue;let a=r,s="type"in a,i=a.type?.toString().trim();if(!s||!i){let o=new se;o.ruleType=this.ruleName,o.severity="Error",o.entityName=n,o.propertyName="type",o.message=`Subject Kanonak '${n}' must have a 'type' property.`,o.suggestion=`Add a type statement like:
294
+ */`}function Be(t){let e=t.namespace||"",n=e.indexOf("/");return n>=0?e.substring(0,n):e}function j(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _n(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ny(t,e){return e==null?"":cn(e)?e.value:t==="string-literal"?typeof e=="string"?e:String(e):Array.isArray(e)?e.map(n=>cn(n)?n.value:_n(typeof n=="string"?n:String(n))).join(""):_n(typeof e=="string"?e:String(e))}function fy(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(cn(t))return t.value;if(Array.isArray(t))return t.map(fy).filter(n=>n!=="").join(", ");if(t instanceof P)return t.subject.name;if(t instanceof L||t instanceof K)return t.name??"";let e=t.value;return typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}function hu(t,e){return t.length<=e?t:t.slice(0,e).replace(/\s+\S*$/,"")+"\u2026"}function ry(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ay(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sy(t){let e=Zi(t);return j(e||t)}function Zi(t){let e=/^(\d{4})-(\d{2})-(\d{2})([T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.exec(t.trim());if(!e)return;let n=Date.parse(t);if(!Number.isFinite(n))return;let r=new Date(n),a=`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getUTCMonth()]} ${r.getUTCDate()}, ${r.getUTCFullYear()}`;if(!e[4])return a;let s=r.getUTCHours(),i=(s+11)%12+1,o=s>=12?"PM":"AM";return`${a} \xB7 ${i}:${String(r.getUTCMinutes()).padStart(2,"0")} ${o} UTC`}function Ji(t){if(!t)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:t}function ju(){return new Set(nr.bandDispatchUris().map(t=>`${t.publisher}/${t.package_}/${t.name}`))}Lt();var Pu=class{isValid=!1;errors=[];warnings=[];infos=[];get totalIssues(){return this.errors.length+this.warnings.length+this.infos.length}get allDiagnostics(){return[...this.errors,...this.warnings,...this.infos]}},da=(t=>(t.Info="Info",t.Warning="Warning",t.Error="Error",t))(da||{}),se=class{ruleType="";severity="Error";lineNumber;column;entityName;propertyName;propertyPath;message="";suggestion;actualValue;expectedValue;toString(){let t="";return this.lineNumber!==void 0&&(t+=`Line ${this.lineNumber}: `),this.entityName&&(t+=`[${this.entityName}] `),t+=this.message,t}};var Eu=class{constructor(t){this.underlying=t,this.repository=new h1(t)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(t=>t.merged)}getAuthoredKanonaks(){return this.parseOnce().then(t=>t.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let t=await this.underlying.getAllDocumentsAsync();await ds(t,this.repository);let e={};return{merged:await new te().parseKanonaks(this.underlying,e),authored:e.authored??[]}})()),this.parsePromise}},h1=class{constructor(t){this.inner=t}inner;highestVersionCache=new Map;byNamespaceCache=new Map;getAllDocumentsAsync(){return this.inner.getAllDocumentsAsync()}getDocumentAsync(t){return this.inner.getDocumentAsync(t)}getDocumentsByNamespaceAsync(t,e){let n=`${t}/${e}`,r=this.byNamespaceCache.get(n);return r||(r=this.inner.getDocumentsByNamespaceAsync(t,e),this.byNamespaceCache.set(n,r),r)}getHighestCompatibleVersionAsync(t,e){let n=e.version,r=n?`${n.major}.${n.minor}.${n.patch}`:"",a=`${t}/${e.packageName}@${e.versionOperator}:${r}`,s=this.highestVersionCache.get(a);return s||(s=this.inner.getHighestCompatibleVersionAsync(t,e),this.highestVersionCache.set(a,s),s)}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(t){return this.inner.getDocumentContentAsync(t)}getDocumentUriAsync(t){return this.inner.getDocumentUriAsync(t)}};async function Pt(t,e,n){return n?n.getKanonaks():new te().parseKanonaks(new Ru(t,e))}async function Ut(t,e,n){let r=await Pt(t,e,n),a=Ou(t);return a?r.filter(s=>s instanceof L&&s.namespace===a):[]}async function Nu(t,e,n){let r=Ou(t);if(!r)return[];let a;if(n)a=await n.getAuthoredKanonaks();else{let s={};await new te().parseKanonaks(new Ru(t,e),s),a=s.authored??[]}return a.filter(s=>s instanceof L&&s.sourceDoc===r)}function Ou(t){let e=t.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${le(e.version)}`}var Ru=class{constructor(t,e){this.document=t,this.broader=e}document;broader;async getAllDocumentsAsync(){let t=this.document.metadata.namespace_?.toString(),e=(await this.broader.getAllDocumentsAsync()).filter(n=>n.metadata.namespace_?.toString()!==t);return[this.document,...e]}getDocumentAsync(t){return this.broader.getDocumentAsync(t)}getDocumentsByNamespaceAsync(t,e){return this.broader.getDocumentsByNamespaceAsync(t,e)}getHighestCompatibleVersionAsync(t,e){return this.broader.getHighestCompatibleVersionAsync(t,e)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(t){return this.broader.getDocumentContentAsync(t)}getDocumentUriAsync(t){return this.broader.getDocumentUriAsync(t)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}},Ny=class{constructor(t={}){this.options=t}options;ruleName="LinkTarget";async validateAsync(t,e,n){let r=[],a=new Map;for(let[l,c]of Object.entries(t.metadata?.imports??{}))for(let u of c)Rt(u)&&a.set(`${l}/${u.packageName}`,{publisher:l,import_:u});if(a.size===0)return r;let s=new Map,i=(l,c,u)=>{let p=`${l.publisher}/${l.package_}`;if(!a.has(p))return;let f=s.get(p)??[];f.push({uri:l,where:c,predicate:u}),s.set(p,f)},o=await Ut(t,e,n);Fn(o,({kanonak:l,path:c})=>{for(let u of l.statement){let p=u.predicate?.subject?.name??"(unknown)";if(u instanceof z)i(u.object.subject,c,p);else if(u instanceof H)for(let f of u.object)f instanceof P&&i(f.subject,c,p);else if(u instanceof bt)for(let f of u.links)f.target&&i(f.target.subject,c,p)}});for(let[l,c]of s){let{publisher:u,import_:p}=a.get(l),f=null,d;try{f=await e.getHighestCompatibleVersionAsync(u,p)}catch(h){d=h instanceof Error?h.message:String(h)}if(!f){let h=c[0],m=`${c.length} reference${c.length===1?"":"s"}, first at '${h.where}.${h.predicate}'`;this.options.offline?r.push(this.finding("Warning",h.where,h.predicate,l,`Link target package '${l}' could not be resolved offline (${m}); the link is UNVERIFIED, not known to be broken.`,"Run without --offline to verify the link over HTTP, or add the package to the workspace or cache.")):r.push(this.finding("Error",h.where,h.predicate,l,`Link target package '${l}' could not be resolved${d?` (${d})`:""} \u2014 ${m}.`,"Check the publisher and package name of the link import; a link must dereference even though it is not a dependency. Use --offline to validate without the network (the link is then reported as unverified)."));continue}for(let{uri:h,where:m,predicate:g}of c)Object.prototype.hasOwnProperty.call(f.body,h.name)||r.push(this.finding("Error",m,g,`${l}/${h.name}`,`Link to '${h.name}' in '${g}' at '${m}' does not dereference: package '${l}' (resolved to ${f.metadata.namespace_?.toString()??l}) defines no resource named '${h.name}'.`,`Check for a typo, or a resource renamed or removed in '${l}'; a link addresses a resource by name in its package's current version unless the import is pinned with '='.`))}return r}finding(t,e,n,r,a,s){let i=new se;return i.ruleType=this.ruleName,i.severity=t,i.entityName=e,i.propertyName=n,i.actualValue=r,i.expectedValue="A link that dereferences to a resource its target package defines",i.message=a,i.suggestion=s,i}},Oy=class Ry{static NAMESPACE_PREFIX_PATTERN=/^(rdfs|xsd|owl|rdf|dc|foaf|skos|dct|dcterms|geo|time|prov|schema|og|dbo):[A-Za-z_][A-Za-z0-9_.-]*$/i;ruleName="NamespacePrefix";validate(e){let n=[];for(let[r,a]of Object.entries(e.body))a&&typeof a=="object"&&!Array.isArray(a)&&this.validateEntity(r,a,n);return n}validateEntity(e,n,r){for(let[a,s]of Object.entries(n)){let i=s?.toString()??"";if(i&&Ry.NAMESPACE_PREFIX_PATTERN.test(i)){let o=this.getSuggestionForPrefixedValue(i),l=e.split(".")[0],c=new se;c.ruleType=this.ruleName,c.severity="Error",c.entityName=l,c.propertyName=e,c.actualValue=a,c.expectedValue=o,c.message=`Invalid namespace prefix '${i}'. Use '${o}' without prefix.`,c.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",r.push(c)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validateEntity(`${e}.${a}`,s,r)}}getSuggestionForPrefixedValue(e){let n=e.toLowerCase();if(n==="rdfs:class"||n==="owl:class")return"Class";if(n==="rdfs:property"||n==="rdf:property")return"DatatypeProperty or ObjectProperty";if(n.startsWith("xsd:"))return e.substring(4);let r=e.indexOf(":");return r>=0?e.substring(r+1):e}},Ly=class fa{static RESERVED_WORDS=new Set(["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 n=[],r=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[a,s]of Object.entries(e.body)){let i=fa.VALID_AUGMENTATION_PATTERN.test(a);if(!i&&!r&&fa.RESERVED_WORDS.has(a.toLowerCase())){let o=new se;o.ruleType=this.ruleName,o.severity="Error",o.entityName=a,o.message=`Entity name '${a}' is a reserved word and cannot be used.`,o.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",n.push(o);continue}if(!i&&!fa.VALID_NAME_PATTERN.test(a)){let o;/^\d/.test(a)?o="Entity names must start with a letter, not a number.":a.includes(" ")?o="Entity names cannot contain spaces. Use camelCase or underscores instead.":o="Entity names must start with a letter and contain only letters, numbers, and underscores.";let l=new se;l.ruleType=this.ruleName,l.severity="Error",l.entityName=a,l.message=`Invalid entity name '${a}'. ${o}`,l.suggestion=o,n.push(l)}s&&typeof s=="object"&&!Array.isArray(s)&&this.validatePropertyNames(a,s,n)}return n}validatePropertyNames(e,n,r){for(let a of Object.keys(n))if(!fa.VALID_PROPERTIES.has(a)&&!fa.VALID_PROPERTY_NAME_PATTERN.test(a)){let s=new se;s.ruleType=this.ruleName,s.severity="Warning",s.entityName=e,s.propertyName=a,s.message=`Property name '${a}' in entity '${e}' doesn't follow naming conventions.`,s.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",r.push(s)}}},Ty=class Iy{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 n=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return n;let r=this.isPropertyDefinedAsClass(e);for(let[a,s]of Object.entries(e.body))if(s&&typeof s=="object"&&!Array.isArray(s)){let i=s,o=i.type;if(o){let l=[];if(Array.isArray(o))for(let c of o){let u=c?.toString();u&&u==="Property"&&!r&&l.push(u)}else{let c=o?.toString();c&&c==="Property"&&!r&&l.push(c)}for(let c of l){let u=this.getPropertyValue(i,"range"),p=this.determinePropertyType(u),f=new se;f.ruleType=this.ruleName,f.severity="Error",f.entityName=a,f.propertyName="type",f.actualValue=c,f.expectedValue=p,f.message=`Invalid property type '${c}'. Use '${p}' instead.`,f.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",n.push(f)}}}return n}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":Iy.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,n){let r=e[n];return r?r.toString():null}isPropertyDefinedAsClass(e){let n=e.body.Property;if(n&&typeof n=="object"&&!Array.isArray(n)){let r=n.type;if(r){let a=r.toString();return a==="Class"||a.endsWith(".Class")}}return!1}},Dy=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(t){let e=[];for(let[n,r]of Object.entries(t.body)){if(typeof r!="object"||r===null||Array.isArray(r)||n.includes("."))continue;let a=r,s="type"in a,i=a.type?.toString().trim();if(!s||!i){let o=new se;o.ruleType=this.ruleName,o.severity="Error",o.entityName=n,o.propertyName="type",o.message=`Subject Kanonak '${n}' must have a 'type' property.`,o.suggestion=`Add a type statement like:
295
295
  type: Scene
296
296
 
297
297
  Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,o.expectedValue="A valid class name (Scene, Character, Story, etc.)",e.push(o)}}return e}},g1=new Set(["EphemeralPackage"]),My=class{get ruleName(){return"PackageHeader"}validate(t){let e=t.metadata;if(!e.type_)return[];let n=[],r=this.packageKey(t,e.type_);return e.namespace_?(!g1.has(e.type_)&&!e.namespace_.version&&n.push(this.error(r,"version",`Package resource '${r}' requires a 'version' property \u2014 packages are addressed by name@version.`,`Add a version, e.g.:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanonak-protocol/cli",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "Command-line tool for the Kanonak Protocol — validate, resolve, preview, and publish semantic ontology packages.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,8 +35,8 @@
35
35
  "semantic-web"
36
36
  ],
37
37
  "dependencies": {
38
- "@kanonak-protocol/sdk": "^5.30.0",
39
- "@kanonak-protocol/types": "^5.30.0",
38
+ "@kanonak-protocol/sdk": "^5.31.0",
39
+ "@kanonak-protocol/types": "^5.31.0",
40
40
  "commander": "^13.0.0",
41
41
  "js-yaml": "^4.1.1"
42
42
  },