@kanonak-protocol/sdk 5.17.0 → 5.18.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.d.ts +2 -0
- package/dist/browser.js +1 -1
- package/dist/{chunk-Q6XQ5IXW.js → chunk-3O7CRE6J.js} +1 -1
- package/dist/chunk-M443OYKT.js +1 -0
- package/dist/{chunk-4PY3JJH3.js → chunk-P36E2UV6.js} +13 -13
- package/dist/{chunk-QLVKAGUU.js → chunk-UNSWF3UN.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/search/index.js +1 -1
- package/dist/server/closure.d.ts +35 -4
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +10 -10
- package/dist/server/renderStack.d.ts +2 -1
- package/dist/transformations/index.js +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-ITKOKDBG.js +0 -1
package/dist/browser.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export { normalizeHost } from './auth/hosts.js';
|
|
|
35
35
|
export { OAuthDiscovery, createCredentialedFetch, parseAuthChallenge, TokenCredentialProvider, } from './auth/index.js';
|
|
36
36
|
export type { AuthenticatedFetchFn, CredentialProvider, RequestCredential, AuthChallenge, ResolveOptions, } from './auth/index.js';
|
|
37
37
|
export { kanonakFetch, setKanonakUserAgent, getKanonakUserAgent, KANONAK_USER_AGENT, } from './http/kanonakFetch.js';
|
|
38
|
+
export { parseLockFile, serializeLockFile, computeIntegrityAsync, INTEGRITY_PREFIX, } from './lock/LockFile.js';
|
|
39
|
+
export type { LockFile, LockEntry } from './lock/LockFile.js';
|
|
38
40
|
export type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
39
41
|
export type { IKanonakParser } from '@kanonak-protocol/types/document/parsing';
|
|
40
42
|
export type { KanonakDocument, KanonakMetadata, Namespace, Import, Version, DocumentReference, ParseResult, ParseError } from '@kanonak-protocol/types/document/models/types';
|
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as B,b as _,c as q,d as Ie,f as Ke,g as Se,h as be,i as je,j as De,k as Ve,l as ve,m as Ee}from"./chunk-UNSWF3UN.js";import{a as Oe}from"./chunk-LYSCTQC2.js";import"./chunk-QHABFCRC.js";import{a as c,b as m,c as u,e as d,h as y,i as R,j as f,k,l as x,m as P,n as g}from"./chunk-W35FCNM7.js";import{a as p}from"./chunk-4NO7MHS7.js";import{a as w,b as z,c as W}from"./chunk-5NH5XDGO.js";import{a as X,b as Y}from"./chunk-PEUTCG3B.js";import"./chunk-PEJALHXK.js";import"./chunk-SC5M74NM.js";import{A as ge,B as Ce,K as he,a as J,b as Q,c as Z,d as $,f as ee,g as oe,h as te,i as re,k as ne,l as ae,m as ie,n as se,o as pe,p as le,q as ce,r as me,s as ue,t as de,u as ye,v as Re,w as fe,x as ke,y as xe,z as Pe}from"./chunk-3O7CRE6J.js";import"./chunk-M443OYKT.js";import{a as K,c as A,i as U,j as G,m as H}from"./chunk-V6KIDED2.js";import{a as l}from"./chunk-NJ3AZYQD.js";import{a as F,b as L,o as M}from"./chunk-SVUMCLK5.js";import{a as C,b as h,c as I,d as b,e as j,f as O,g as D,h as V,i as v,j as E,k as N,l as T}from"./chunk-YW6P24RF.js";import{a as S}from"./chunk-FUUTGGJS.js";import{c as e,d as o,e as t,f as r,g as n,h as a,i,j as s}from"./chunk-2ACBWC7K.js";export{ye as AmbiguousReferenceRule,v as BooleanStatement,ve as CANONICAL_FORM_VERSION,U as Carrier,ge as ClassDefinitionRule,se as ClassHierarchyCycleRule,h as DefinedKanonak,_ as EdgeType,K as EmbeddedKanonak,ne as EmbeddedKanonakTypeRule,N as EmbeddedStatement,q as GraphBuilder,g as HttpKanonakDocumentRepository,R as INTEGRITY_PREFIX,ae as ImportExistenceRule,p as InMemoryKanonakDocumentRepository,c as KANONAK_USER_AGENT,C as Kanonak,z as KanonakDocumentPositions,H as KanonakObjectParser,he as KanonakObjectValidator,l as KanonakParser,S as KanonakUri,X as KanonakUriBuilder,T as ListStatement,Ce as MarkdownLinkRule,A as MarkdownStatement,ue as NamespaceImportCycleRule,ee as NamespacePrefixRule,B as NodeType,V as NumberStatement,Ke as OAuthDiscovery,fe as ObjectPropertyValueValidationRule,Z as OntologyValidationError,J as OntologyValidationResult,ke as PropertyDomainRule,pe as PropertyHierarchyCycleRule,xe as PropertyKindRangeConsistencyRule,w as PropertyMetadata,Re as PropertyRangeReferenceRule,le as PropertyRangeRequiredRule,te as PropertyTypeSpecificityRule,y as PublisherConfigResolver,P as PublisherIndex,b as ReferenceKanonak,E as ReferenceStatement,Pe as ReservedNameShadowRule,oe as ResourceNamingRule,F as ResourceResolver,M as ResourceTypeClassifier,O as ScalarStatement,j as Statement,D as StringStatement,ce as SubClassOfReferenceRule,me as SubPropertyOfReferenceRule,I as SubjectKanonak,re as SubjectKanonakTypeRequiredRule,je as TokenCredentialProvider,L as TypeResolver,de as UnresolvedPredicateRule,ie as UnresolvedReferenceRule,$ as ValidationContext,Q as ValidationSeverity,Ee as buildOntologyModel,De as canonicalForm,Ve as canonicalHash,G as carrierOf,e as compareVersions,x as computeIntegrityAsync,be as createCredentialedFetch,r as createVersion,Oe as findDerivation,Y as findInstancesByType,t as formatVersion,u as getKanonakUserAgent,a as isCompatibleVersion,i as isMajorCompatible,d as kanonakFetch,Ie as normalizeHost,Se as parseAuthChallenge,f as parseLockFile,n as parseVersionString,W as parseWithPositions,s as pickHighestDocument,k as serializeLockFile,m as setKanonakUserAgent,o as versionsEqual};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as lt}from"./chunk-
|
|
1
|
+
import{a as lt}from"./chunk-M443OYKT.js";import{a as I,b as Fe,c as at,d as G,h as M,k as pt,m as S}from"./chunk-V6KIDED2.js";import{a as nt}from"./chunk-NJ3AZYQD.js";import{j as We,k as it,o as v,p as w,q as z,r as H,s as W,v as st,w as L,x as ct}from"./chunk-SVUMCLK5.js";import{c as f,d as D,j as He,k as Q,l as Y,m as R,n as X,p as P,r as k,t as ee,u as x,v as F,w as y,x as $,y as b,z as q}from"./chunk-YW6P24RF.js";import{a as rt}from"./chunk-FUUTGGJS.js";import{e as U}from"./chunk-2ACBWC7K.js";var te=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]}};var g=(o=>(o.Info="Info",o.Warning="Warning",o.Error="Error",o))(g||{});var u=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 Xe=class c{resolvedDocuments=[];currentEntityPath;withPath(e){let t=new c;return t.resolvedDocuments=this.resolvedDocuments,t.currentEntityPath=e,t}};var oe=class{constructor(e){this.underlying=e;this.repository=new Ze(e)}underlying;repository;parsePromise=null;getKanonaks(){return this.parseOnce().then(e=>e.merged)}getAuthoredKanonaks(){return this.parseOnce().then(e=>e.authored)}parseOnce(){return this.parsePromise||(this.parsePromise=(async()=>{let e=await this.underlying.getAllDocumentsAsync();await lt(e,this.repository);let t={};return{merged:await new S().parseKanonaks(this.underlying,t),authored:t.authored??[]}})()),this.parsePromise}},Ze=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,t){let o=`${e}/${t}`,n=this.byNamespaceCache.get(o);return n||(n=this.inner.getDocumentsByNamespaceAsync(e,t),this.byNamespaceCache.set(o,n),n)}getHighestCompatibleVersionAsync(e,t){let o=t.version,n=o?`${o.major}.${o.minor}.${o.patch}`:"",r=`${e}/${t.packageName}@${t.versionOperator}:${n}`,a=this.highestVersionCache.get(r);return a||(a=this.inner.getHighestCompatibleVersionAsync(e,t),this.highestVersionCache.set(r,a),a)}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)}};async function E(c,e,t){return t?t.getKanonaks():new S().parseKanonaks(new ne(c,e))}async function C(c,e,t){let o=await E(c,e,t),n=Ge(c);return n?o.filter(r=>r instanceof f&&r.namespace===n):[]}async function re(c,e,t){let o=Ge(c);if(!o)return[];let n;if(t)n=await t.getAuthoredKanonaks();else{let r={};await new S().parseKanonaks(new ne(c,e),r),n=r.authored??[]}return n.filter(r=>r instanceof f&&r.sourceDoc===o)}function Ge(c){let e=c.metadata.namespace_;if(!(!e||!e.version))return`${e.publisher}/${e.package_}@${U(e.version)}`}var ne=class{constructor(e,t){this.document=e;this.broader=t}document;broader;async getAllDocumentsAsync(){let e=this.document.metadata.namespace_?.toString(),t=(await this.broader.getAllDocumentsAsync()).filter(o=>o.metadata.namespace_?.toString()!==e);return[this.document,...t]}getDocumentAsync(e){return this.broader.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,t){return this.broader.getDocumentsByNamespaceAsync(e,t)}getHighestCompatibleVersionAsync(e,t){return this.broader.getHighestCompatibleVersionAsync(e,t)}getAllDocumentReferencesAsync(){return this.broader.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.broader.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.broader.getDocumentUriAsync(e)}saveDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}deleteDocumentAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}clearNamespaceAsync(){throw new Error("DocumentWithRepositoryCatalog is read-only")}};var ae=class c{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 t=[];for(let[o,n]of Object.entries(e.body))n&&typeof n=="object"&&!Array.isArray(n)&&this.validateEntity(o,n,t);return t}validateEntity(e,t,o){for(let[n,r]of Object.entries(t)){let a=r?.toString()??"";if(a&&c.NAMESPACE_PREFIX_PATTERN.test(a)){let i=this.getSuggestionForPrefixedValue(a),s=e.split(".")[0],p=new u;p.ruleType=this.ruleName,p.severity="Error",p.entityName=s,p.propertyName=e,p.actualValue=n,p.expectedValue=i,p.message=`Invalid namespace prefix '${a}'. Use '${i}' without prefix.`,p.suggestion="Kanonak YAML uses simple type names. Namespace resolution is handled through imports.",o.push(p)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validateEntity(`${e}.${n}`,r,o)}}getSuggestionForPrefixedValue(e){let t=e.toLowerCase();if(t==="rdfs:class"||t==="owl:class")return"Class";if(t==="rdfs:property"||t==="rdf:property")return"DatatypeProperty or ObjectProperty";if(t.startsWith("xsd:"))return e.substring(4);let o=e.indexOf(":");return o>=0?e.substring(o+1):e}};var ie=class c{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 t=[],o=e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-");for(let[n,r]of Object.entries(e.body)){let a=c.VALID_AUGMENTATION_PATTERN.test(n);if(!a&&!o&&c.RESERVED_WORDS.has(n.toLowerCase())){let i=new u;i.ruleType=this.ruleName,i.severity="Error",i.entityName=n,i.message=`Entity name '${n}' is a reserved word and cannot be used.`,i.suggestion="Choose a different name that doesn't conflict with Kanonak reserved words.",t.push(i);continue}if(!a&&!c.VALID_NAME_PATTERN.test(n)){let i;/^\d/.test(n)?i="Entity names must start with a letter, not a number.":n.includes(" ")?i="Entity names cannot contain spaces. Use camelCase or underscores instead.":i="Entity names must start with a letter and contain only letters, numbers, and underscores.";let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=n,s.message=`Invalid entity name '${n}'. ${i}`,s.suggestion=i,t.push(s)}r&&typeof r=="object"&&!Array.isArray(r)&&this.validatePropertyNames(n,r,t)}return t}validatePropertyNames(e,t,o){for(let n of Object.keys(t))if(!c.VALID_PROPERTIES.has(n)&&!c.VALID_PROPERTY_NAME_PATTERN.test(n)){let r=new u;r.ruleType=this.ruleName,r.severity="Warning",r.entityName=e,r.propertyName=n,r.message=`Property name '${n}' in entity '${e}' doesn't follow naming conventions.`,r.suggestion="Property names should start with a letter and contain only letters, numbers, and underscores.",o.push(r)}}};var se=class c{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 t=[];if(e.metadata?.namespace_?.publisher==="kanonak.org"&&e.metadata?.namespace_?.package_?.startsWith("core-"))return t;let o=this.isPropertyDefinedAsClass(e);for(let[n,r]of Object.entries(e.body))if(r&&typeof r=="object"&&!Array.isArray(r)){let a=r,i=a.type;if(i){let s=[];if(Array.isArray(i))for(let p of i){let l=p?.toString();l&&l==="Property"&&!o&&s.push(l)}else{let p=i?.toString();p&&p==="Property"&&!o&&s.push(p)}for(let p of s){let l=this.getPropertyValue(a,"range"),m=this.determinePropertyType(l),d=new u;d.ruleType=this.ruleName,d.severity="Error",d.entityName=n,d.propertyName="type",d.actualValue=p,d.expectedValue=m,d.message=`Invalid property type '${p}'. Use '${m}' instead.`,d.suggestion="Properties should specify their type: DatatypeProperty for data values, ObjectProperty for relationships.",t.push(d)}}}return t}determinePropertyType(e){return!e||e.trim().length===0?"DatatypeProperty or ObjectProperty":c.XSD_TYPES.has(e.toLowerCase())?"DatatypeProperty":/^[A-Z]/.test(e)?"ObjectProperty":"DatatypeProperty or ObjectProperty"}getPropertyValue(e,t){let o=e[t];return o?o.toString():null}isPropertyDefinedAsClass(e){let t=e.body.Property;if(t&&typeof t=="object"&&!Array.isArray(t)){let n=t.type;if(n){let r=n.toString();return r==="Class"||r.endsWith(".Class")}}return!1}};var ce=class{get ruleName(){return"SubjectKanonakTypeRequired"}validate(e){let t=[];for(let[o,n]of Object.entries(e.body)){if(typeof n!="object"||n===null||Array.isArray(n)||o.includes("."))continue;let r=n,a="type"in r,i=r.type?.toString().trim();if(!a||!i){let s=new u;s.ruleType=this.ruleName,s.severity="Error",s.entityName=o,s.propertyName="type",s.message=`Subject Kanonak '${o}' must have a 'type' property.`,s.suggestion=`Add a type statement like:
|
|
2
2
|
type: Scene
|
|
3
3
|
|
|
4
4
|
Only embedded objects can infer type from their parent property's range. Subject Kanonaks (top-level entities) must explicitly declare their type.`,s.expectedValue="A valid class name (Scene, Character, Story, etc.)",t.push(s)}}return t}};var $t=new Set(["EphemeralPackage"]),pe=class{get ruleName(){return"PackageHeader"}validate(e){let t=e.metadata;if(!t.type_)return[];let o=[],n=this.packageKey(e,t.type_);return t.namespace_?(!$t.has(t.type_)&&!t.namespace_.version&&o.push(this.error(n,"version",`Package resource '${n}' requires a 'version' property \u2014 packages are addressed by name@version.`,`Add a version, e.g.:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as y,e as m}from"./chunk-2ACBWC7K.js";function f(t){let e=t.metadata?.namespace_;return e?`${e.publisher}/${e.package_}`:void 0}function k(t){let e=t.metadata?.namespace_;if(e)return e.version?`${e.publisher}/${e.package_}@${m(e.version)}`:`${e.publisher}/${e.package_}`}async function A(t,e,n={}){let o=new Set,u=new Set,i=[...t];for(;i.length>0;){let a=i.shift(),l=f(a),r=k(a);if(!l||!r||u.has(r))continue;u.add(r),o.add(l);let p=a.metadata?.imports;if(p)for(let[g,h]of Object.entries(p))for(let s of h){let c=null,d="no-compatible-version";try{c=await e.getHighestCompatibleVersionAsync(g,s)}catch{d="resolution-error"}c?i.push(c):n.onUnresolvedEdge?.({fromNamespace:r,publisher:g,packageName:s.packageName,constraint:`${y(s.versionOperator)}${m(s.version)}`,reason:d})}}return o}var D=class{constructor(e,n){this.inner=e;this.scope=n}inner;scope;async getAllDocumentsAsync(){return(await this.inner.getAllDocumentsAsync()).filter(n=>{let o=f(n);return o!==void 0&&this.scope.has(o)})}getDocumentAsync(e){return this.inner.getDocumentAsync(e)}getDocumentsByNamespaceAsync(e,n){return this.inner.getDocumentsByNamespaceAsync(e,n)}getHighestCompatibleVersionAsync(e,n){return this.inner.getHighestCompatibleVersionAsync(e,n)}saveDocumentAsync(e,n){return this.inner.saveDocumentAsync(e,n)}deleteDocumentAsync(e){return this.inner.deleteDocumentAsync(e)}clearNamespaceAsync(e,n){return this.inner.clearNamespaceAsync(e,n)}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(e){return this.inner.getDocumentContentAsync(e)}getDocumentUriAsync(e){return this.inner.getDocumentUriAsync(e)}};export{A as a,D as b};
|