@kanonak-protocol/sdk 3.14.0 → 3.17.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 +4 -5
- package/dist/browser.js +2 -2
- package/dist/chunk-2JQMUZWN.js +1 -0
- package/dist/{chunk-YENGFI2R.js → chunk-2SSUPRX3.js} +1 -1
- package/dist/chunk-BQIWYLBU.js +2 -0
- package/dist/chunk-C2WWLKWE.js +1 -0
- package/dist/chunk-CQLO62JP.js +1 -0
- package/dist/chunk-FJ35VIV6.js +1 -0
- package/dist/chunk-IXE5THUW.js +1 -0
- package/dist/chunk-L4HXBHJ4.js +47 -0
- package/dist/chunk-VRZUCZEF.js +1 -0
- package/dist/chunk-Z72IKY6C.js +1 -0
- package/dist/graph/GraphBuilder.d.ts +3 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +15 -15
- package/dist/parsing/KanonakObjectParser.d.ts +11 -0
- package/dist/parsing/PropertyMetadata.d.ts +9 -0
- package/dist/parsing/extractMarkdownLinks.d.ts +31 -0
- package/dist/parsing/index.js +1 -1
- package/dist/reasoning/index.js +1 -1
- package/dist/resolution/TypeResolver.d.ts +12 -0
- package/dist/resolution/index.d.ts +1 -0
- package/dist/resolution/index.js +1 -1
- package/dist/statements/MarkdownStatement.d.ts +38 -0
- package/dist/statements/index.d.ts +2 -0
- package/dist/transformations/index.js +29 -29
- package/dist/transformations/v3/CompiledTransformationV3.d.ts +15 -1
- package/dist/transformations/v3/ExpressionEngineV3.d.ts +10 -0
- package/dist/transformations/v3/TransformationUriConstantsV3.d.ts +7 -0
- package/dist/uri-helpers/UriHelpers.d.ts +24 -0
- package/dist/uri-helpers/index.d.ts +2 -2
- package/dist/uri-helpers/index.js +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/rules/repository/MarkdownLinkRule.d.ts +28 -0
- package/dist/validation/rules/repository/SubClassOfReferenceRule.d.ts +8 -0
- package/dist/validation/rules/repository/index.d.ts +1 -0
- package/package.json +2 -10
- package/dist/chunk-7M7XXZOV.js +0 -1
- package/dist/chunk-AFF2TQ7Y.js +0 -2
- package/dist/chunk-C54LRL2A.js +0 -42
- package/dist/chunk-CRR4BQKR.js +0 -1
- package/dist/chunk-GKQVJITL.js +0 -1
- package/dist/chunk-NPWF35XZ.js +0 -1
- package/dist/chunk-QJ66UBDY.js +0 -1
- package/dist/chunk-RGMZAKJV.js +0 -1
- package/dist/chunk-USLG7UIM.js +0 -4
- package/dist/ctl/CtlGraphResolver.d.ts +0 -14
- package/dist/ctl/CtlKanonakUri.d.ts +0 -28
- package/dist/ctl/CtlMarkdownRenderer.d.ts +0 -17
- package/dist/ctl/CtlParser.d.ts +0 -10
- package/dist/ctl/CtlValidator.d.ts +0 -12
- package/dist/ctl/index.d.ts +0 -12
- package/dist/ctl/index.js +0 -1
- /package/dist/{ctl → resolution}/ResourceTypeClassifier.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as Ge,b as ze,c as We,d as Je,e as qe,f as Ye,g as Xe,h as Ze,i as Qe,j as et}from"./chunk-2SSUPRX3.js";import{a as Me,b as Ue,c as Ve,d as S,e as C,f as a}from"./chunk-BQIWYLBU.js";import{a as At}from"./chunk-C2WWLKWE.js";import{a as fe,b as ye,c as ge,d as he,e as ke}from"./chunk-3JRHG2JH.js";import{a as ue,b as Se,c as Ce,d as Pe}from"./chunk-CNM3SY5S.js";import{a as rt,b as nt,c as ot}from"./chunk-CQLO62JP.js";import{a as _e,b as it,c as at,d as st,e as ct}from"./chunk-VRZUCZEF.js";import{a as oe,b as ie,c as ae,d as se,e as ce,f as le,g as de,h as pe}from"./chunk-FQHALFRR.js";import{A as Ft,B as Ot,C as Nt,D as jt,a as lt,b as dt,c as pt,d as ut,e as mt,f as ft,g as yt,h as gt,i as ht,j as kt,k as St,l as Ct,m as Pt,n as bt,o as Rt,p as wt,q as xt,r as $t,s as vt,t as Et,u as Tt,v as It,w as Kt,x as Bt,y as Dt,z as Lt}from"./chunk-L4HXBHJ4.js";import"./chunk-FJ35VIV6.js";import{a as xe,b as Ee,c as Ne,d as He}from"./chunk-Z72IKY6C.js";import{a as be,b as Re,c as we,d as ve,e as Te,f as Ie,g as Ke,h as Be,i as De,j as Le,k as Fe,l as Oe}from"./chunk-W6T7MOKY.js";import{a as me}from"./chunk-MYITGTGJ.js";import{b as je,c as Ae}from"./chunk-IXE5THUW.js";import{a as $e}from"./chunk-FUUTGGJS.js";import{a as tt}from"./chunk-ODIECDN7.js";import{VersionOperator as Dn}from"@kanonak-protocol/types/document/models/enums";import{existsSync as nr,readFileSync as or}from"fs";import{homedir as ir}from"os";import{join as ar}from"path";import{execFile as Ht}from"child_process";import{promisify as _t}from"util";var P=_t(Ht),b="kanonak",R="/usr/bin/security",u=class{async get(e){let t=a(e);try{let{stdout:r}=await P(R,["find-generic-password","-s",b,"-a",t,"-w"],{timeout:1e4});try{return JSON.parse(r.trim())}catch{throw new Error(`Stored credential for '${t}' is corrupted (not valid JSON).
|
|
2
2
|
Run 'kanonak logout ${t}' then 'kanonak login ${t}' to fix.`)}}catch(r){if(j(r,44))return null;throw new Error(`macOS Keychain read failed for '${t}': ${w(r)}
|
|
3
3
|
The Keychain may be locked or inaccessible.
|
|
4
|
-
Try unlocking it via Keychain Access.app or running 'security unlock-keychain'.`)}}async store(e,t){let r=a(e),o=JSON.stringify(t);try{await P(
|
|
4
|
+
Try unlocking it via Keychain Access.app or running 'security unlock-keychain'.`)}}async store(e,t){let r=a(e),o=JSON.stringify(t);try{await P(R,["add-generic-password","-s",b,"-a",r,"-U","-w",o],{timeout:1e4})}catch(i){throw new Error(`macOS Keychain write failed for '${r}': ${w(i)}
|
|
5
5
|
Ensure the Keychain is unlocked and the CLI has write permission.
|
|
6
|
-
On managed devices, your IT policy may block credential storage.`)}}async remove(e){let t=a(e);try{await P(
|
|
7
|
-
The credential may not have been fully removed.`)}}async list(){try{let{stdout:e}=await P(
|
|
8
|
-
`))if(o.includes(`"svce"<blob>="${
|
|
6
|
+
On managed devices, your IT policy may block credential storage.`)}}async remove(e){let t=a(e);try{await P(R,["delete-generic-password","-s",b,"-a",t],{timeout:1e4})}catch(r){if(j(r,44))return;console.warn(` Warning: macOS Keychain delete failed for '${t}': ${w(r)}
|
|
7
|
+
The credential may not have been fully removed.`)}}async list(){try{let{stdout:e}=await P(R,["dump-keychain"],{timeout:1e4}),t=[],r=!1;for(let o of e.split(`
|
|
8
|
+
`))if(o.includes(`"svce"<blob>="${b}"`)&&(r=!0),r&&o.includes('"acct"<blob>=')){let i=o.match(/"acct"<blob>="([^"]+)"/);i&&t.push(i[1]),r=!1}return t}catch(e){return console.warn(` Warning: Could not enumerate Keychain entries: ${w(e)}`),[]}}};function j(n,e){return typeof n=="object"&&n!==null&&"code"in n&&n.code===e}function w(n){return n instanceof Error?n.message:String(n)}import{execFile as Mt}from"child_process";import{promisify as Ut}from"util";var Vt=Ut(Mt),x="kanonak:",m=class{async get(e){let t=x+a(e),r=`
|
|
9
9
|
${v}
|
|
10
10
|
$target = [Console]::In.ReadLine()
|
|
11
11
|
$ptr = [IntPtr]::Zero
|
|
@@ -41,7 +41,7 @@ ${v}
|
|
|
41
41
|
$target = [Console]::In.ReadLine()
|
|
42
42
|
[CredMan]::CredDelete($target, 1, 0) | Out-Null`;try{await $(r,t)}catch{}}async list(){let e=`
|
|
43
43
|
${v}
|
|
44
|
-
${
|
|
44
|
+
${Gt}
|
|
45
45
|
$prefix = [Console]::In.ReadLine()
|
|
46
46
|
$count = 0
|
|
47
47
|
$pCreds = [IntPtr]::Zero
|
|
@@ -56,7 +56,7 @@ if ([CredMan]::CredEnumerate($null, 0, [ref]$count, [ref]$pCreds)) {
|
|
|
56
56
|
}
|
|
57
57
|
[CredMan]::CredFree($pCreds)
|
|
58
58
|
}`;try{let{stdout:t}=await $(e,x);return t.trim().split(`
|
|
59
|
-
`).map(r=>r.trim()).filter(Boolean)}catch{return[]}}};async function $(n,e){for(let t of["pwsh","powershell"])try{return await
|
|
59
|
+
`).map(r=>r.trim()).filter(Boolean)}catch{return[]}}};async function $(n,e){for(let t of["pwsh","powershell"])try{return await Vt(t,["-NoProfile","-NonInteractive","-Command",n],{timeout:15e3,...e!==void 0&&{input:e}})}catch(r){if(t==="powershell")throw r}throw new Error("Neither pwsh nor powershell found")}var v=`
|
|
60
60
|
Add-Type -TypeDefinition @"
|
|
61
61
|
using System;
|
|
62
62
|
using System.Runtime.InteropServices;
|
|
@@ -87,13 +87,13 @@ public class CredMan {
|
|
|
87
87
|
[DllImport("Advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
88
88
|
public static extern bool CredEnumerate(string filter, int flags, out int count, out IntPtr credentials);
|
|
89
89
|
}
|
|
90
|
-
"@`,
|
|
91
|
-
`)){let o=r.match(/attribute\.publisher\s*=\s*(.+)/);o&&t.push(o[1].trim())}return t}catch{return[]}}};async function D(){try{return await T("sh",["-c","command -v secret-tool"],{timeout:5e3}),!0}catch{return!1}}import{existsSync as A,mkdirSync as H,readFileSync as _,writeFileSync as
|
|
90
|
+
"@`,Gt="";import{execFile as zt,spawn as Wt}from"child_process";import{promisify as Jt}from"util";var T=Jt(zt),E="kanonak",f=class{async get(e){let t=a(e);try{let{stdout:r}=await T("secret-tool",["lookup","service",E,"publisher",t],{timeout:1e4}),o=r.trim();return o?JSON.parse(o):null}catch{return null}}async store(e,t){let r=a(e),o=JSON.stringify(t);await new Promise((i,s)=>{let c=Wt("secret-tool",["store","--label",`Kanonak: ${r}`,"service",E,"publisher",r],{stdio:["pipe","ignore","ignore"],timeout:1e4});c.stdin.write(o),c.stdin.end(),c.on("close",l=>{l===0?i():s(new Error(`secret-tool store exited with code ${l}`))}),c.on("error",s)})}async remove(e){let t=a(e);try{await T("secret-tool",["clear","service",E,"publisher",t],{timeout:1e4})}catch{}}async list(){try{let{stdout:e}=await T("secret-tool",["search","service",E],{timeout:1e4}),t=[];for(let r of e.split(`
|
|
91
|
+
`)){let o=r.match(/attribute\.publisher\s*=\s*(.+)/);o&&t.push(o[1].trim())}return t}catch{return[]}}};async function D(){try{return await T("sh",["-c","command -v secret-tool"],{timeout:5e3}),!0}catch{return!1}}import{existsSync as A,mkdirSync as H,readFileSync as _,writeFileSync as M}from"fs";import{createCipheriv as qt,createDecipheriv as Yt,randomBytes as U}from"crypto";import{homedir as Xt}from"os";import{join as O,dirname as V}from"path";var z=O(Xt(),".config","kanonak"),y=O(z,"keyring.key"),I=O(z,"credentials.enc"),G="aes-256-gcm",L=32,p=12,F=16,g=class{async get(e){let t=this.loadStore(),r=a(e);return t[r]??null}async store(e,t){let r=this.loadStore(),o=a(e);r[o]=t,this.saveStore(r)}async remove(e){let t=this.loadStore(),r=a(e);delete t[r],this.saveStore(t)}async list(){let e=this.loadStore();return Object.keys(e)}loadStore(){if(!A(I))return{};try{let e=this.getOrCreateKey(),t=_(I);if(t.length<p+F)return{};let r=t.subarray(0,p),o=t.subarray(p,p+F),i=t.subarray(p+F),s=Yt(G,e,r);s.setAuthTag(o);let c=Buffer.concat([s.update(i),s.final()]);return JSON.parse(c.toString("utf-8"))}catch{return{}}}saveStore(e){let t=this.getOrCreateKey(),r=U(p),o=qt(G,t,r),i=Buffer.from(JSON.stringify(e),"utf-8"),s=Buffer.concat([o.update(i),o.final()]),c=o.getAuthTag(),l=Buffer.concat([r,c,s]);H(V(I),{recursive:!0}),M(I,l,{mode:384})}getOrCreateKey(){if(A(y)){let t=_(y);if(t.length!==L)throw new Error(`Credential keyring key is corrupted (expected ${L} bytes, got ${t.length}). Delete ${y} and re-authenticate.`);return t}let e=U(L);return H(V(y),{recursive:!0}),M(y,e,{mode:384}),e}};import{execFile as Zt}from"child_process";import{promisify as Qt}from"util";var er=Qt(Zt),W=3e4,h=class{constructor(e){this.helperPath=e}helperPath;async get(e){let t=a(e);try{let o=(await this.runHelper("get",{publisher:t})).trim();return o?JSON.parse(o):null}catch(r){throw new Error(`Credential helper '${this.helperPath}' failed to read credential for '${t}': ${K(r)}
|
|
92
92
|
Verify the helper binary exists, is executable, and implements the Kanonak credential helper protocol.
|
|
93
93
|
Check the 'credentialHelper' path in ~/.kanonak/config.json.`)}}async store(e,t){let r=a(e);try{await this.runHelper("store",{publisher:r,credential:t})}catch(o){throw new Error(`Credential helper '${this.helperPath}' failed to store credential for '${r}': ${K(o)}
|
|
94
|
-
Verify the helper binary supports the 'store' action.`)}}async remove(e){let t=a(e);try{await this.runHelper("erase",{publisher:t})}catch(r){console.warn(` Warning: Credential helper '${this.helperPath}' failed to erase credential for '${t}': ${K(r)}`)}}async list(){try{let e=await this.runHelper("list",void 0);return JSON.parse(e.trim())}catch(e){return console.warn(` Warning: Credential helper '${this.helperPath}' failed to list credentials: ${K(e)}`),[]}}async runHelper(e,t){try{let{stdout:r}=await
|
|
95
|
-
Check the 'credentialHelper' path in ~/.kanonak/config.json.`):
|
|
96
|
-
The helper may be waiting for authentication to an external vault.`):r}}};function K(n){return n instanceof Error?n.message:String(n)}function
|
|
97
|
-
Using default credential backend. Fix the JSON syntax or delete the file.`),{}}}import{createHash as
|
|
98
|
-
The stored key pair may be corrupted. Run 'kanonak login ${r}' to re-authenticate.`),s.Authorization=`Bearer ${i.accessToken}`}}else s.Authorization=`Bearer ${i.accessToken}`;let c=await fetch(t,{method:o,headers:s});if(c.status===401&&i.dpopKeyPair){let l=c.headers.get("DPoP-Nonce");if(l){e.set(r,l);try{let d=k(i.dpopKeyPair.privateKey,i.dpopKeyPair.publicKey,o,t,i.accessToken,l);s.DPoP=d,c=await fetch(t,{method:o,headers:s})}catch{}}}return c}}import{readFileSync as
|
|
99
|
-
`;function ee(n=Q){if(!
|
|
94
|
+
Verify the helper binary supports the 'store' action.`)}}async remove(e){let t=a(e);try{await this.runHelper("erase",{publisher:t})}catch(r){console.warn(` Warning: Credential helper '${this.helperPath}' failed to erase credential for '${t}': ${K(r)}`)}}async list(){try{let e=await this.runHelper("list",void 0);return JSON.parse(e.trim())}catch(e){return console.warn(` Warning: Credential helper '${this.helperPath}' failed to list credentials: ${K(e)}`),[]}}async runHelper(e,t){try{let{stdout:r}=await er(this.helperPath,[e],{...t&&{input:JSON.stringify(t)},timeout:W});return r}catch(r){throw tr(r)?new Error(`Credential helper not found at '${this.helperPath}'.
|
|
95
|
+
Check the 'credentialHelper' path in ~/.kanonak/config.json.`):rr(r)?new Error(`Credential helper '${this.helperPath}' timed out after ${W/1e3}s on '${e}'.
|
|
96
|
+
The helper may be waiting for authentication to an external vault.`):r}}};function K(n){return n instanceof Error?n.message:String(n)}function tr(n){return n instanceof Error&&"code"in n&&n.code==="ENOENT"}function rr(n){return n instanceof Error&&"killed"in n&&n.killed}var N=ar(ir(),".kanonak","config.json"),B=class{backend=null;backendReady=null;async getBackend(){if(this.backend)return this.backend;if(this.backendReady)return this.backendReady;this.backendReady=this.resolveBackend();try{return this.backend=await this.backendReady,this.backend}catch(e){throw this.backendReady=null,e}}async getToken(e){let t=sr(e);if(t)return t;let o=await(await this.getBackend()).get(e);return!o||!C(o)?null:o.accessToken??null}async getCredential(e){return(await this.getBackend()).get(e)}async store(e,t){return(await this.getBackend()).store(e,t)}async remove(e){return(await this.getBackend()).remove(e)}async list(){return(await this.getBackend()).list()}async resolveBackend(){let e=cr();return e.credentialHelper?new h(e.credentialHelper):process.platform==="darwin"?new u:process.platform==="win32"?new m:await D()?new f:new g}};function sr(n){let t="KANONAK_TOKEN_"+a(n).replace(/[.\-]/g,"_").toUpperCase();return process.env[t]??null}function cr(){if(!nr(N))return{};try{return JSON.parse(or(N,"utf-8"))}catch(n){let e=n instanceof Error?n.message:String(n);return console.warn(` Warning: Failed to parse ${N}: ${e}
|
|
97
|
+
Using default credential backend. Fix the JSON syntax or delete the file.`),{}}}import{createHash as lr,createPrivateKey as dr,generateKeyPairSync as pr,randomUUID as ur,sign as mr}from"crypto";function q(){let{publicKey:n,privateKey:e}=pr("ec",{namedCurve:"P-256"});return{publicKey:n.export({format:"jwk"}),privateKey:e.export({format:"jwk"})}}function k(n,e,t,r,o,i){let s={alg:"ES256",typ:"dpop+jwt",jwk:{kty:e.kty,crv:e.crv,x:e.x,y:e.y}},c={jti:ur(),htm:t.toUpperCase(),htu:r,iat:Math.floor(Date.now()/1e3)};return o&&(c.ath=lr("sha256").update(o).digest("base64url")),i&&(c.nonce=i),fr(s,c,n)}function Y(n){return!n||n.length===0?!1:n.some(e=>e.toUpperCase()==="ES256")}function fr(n,e,t){let r=J(JSON.stringify(n)),o=J(JSON.stringify(e)),i=`${r}.${o}`,s=dr({key:t,format:"jwk"}),l=mr("SHA256",Buffer.from(i),{key:s,dsaEncoding:"ieee-p1363"}).toString("base64url");return`${i}.${l}`}function J(n){return Buffer.from(n,"utf-8").toString("base64url")}function X(n){let e=new Map;return async(t,r,o="GET")=>{if(!n)return fetch(t,{method:o});let i=await n.getCredential(r);if(!i?.accessToken)return fetch(t,{method:o});S(i)&&console.warn(` Warning: Access token for '${r}' is expired. Run 'kanonak login ${r}' to re-authenticate.`);let s={};if(i.dpopKeyPair){let l=e.get(r);try{let d=k(i.dpopKeyPair.privateKey,i.dpopKeyPair.publicKey,o,t,i.accessToken,l);s.Authorization=`DPoP ${i.accessToken}`,s.DPoP=d}catch(d){let ne=d instanceof Error?d.message:String(d);console.error(` Error: Failed to create DPoP proof for '${r}': ${ne}
|
|
98
|
+
The stored key pair may be corrupted. Run 'kanonak login ${r}' to re-authenticate.`),s.Authorization=`Bearer ${i.accessToken}`}}else s.Authorization=`Bearer ${i.accessToken}`;let c=await fetch(t,{method:o,headers:s});if(c.status===401&&i.dpopKeyPair){let l=c.headers.get("DPoP-Nonce");if(l){e.set(r,l);try{let d=k(i.dpopKeyPair.privateKey,i.dpopKeyPair.publicKey,o,t,i.accessToken,l);s.DPoP=d,c=await fetch(t,{method:o,headers:s})}catch{}}}return c}}import{readFileSync as yr,writeFileSync as gr,existsSync as hr}from"fs";import{createHash as kr}from"crypto";import Z from"js-yaml";var Q="kanonak.lock",Sr=`# This file is generated by Kanonak CLI. Do not edit manually.
|
|
99
|
+
`;function ee(n=Q){if(!hr(n))return null;let e=yr(n,"utf-8"),t=Z.load(e);return!t||typeof t!="object"||t.version!=="1"?null:{version:"1",lastUpdated:t.lastUpdated??new Date().toISOString(),packages:t.packages??{}}}function te(n,e=Q){n.lastUpdated=new Date().toISOString();let t={};for(let o of Object.keys(n.packages).sort())t[o]=n.packages[o];n.packages=t;let r=Z.dump(n,{lineWidth:-1,sortKeys:!1,quotingType:'"'});gr(e,Sr+r,"utf-8")}function re(n){return`sha256:${kr("sha256").update(n).digest("hex")}`}export{It as AmbiguousReferenceRule,De as BooleanStatement,Ot as ClassDefinitionRule,Pt as ClassHierarchyCycleRule,ge as CompositeKanonakDocumentRepository,B as CredentialStore,Re as DefinedKanonak,Et as DefinitionPropertyReferenceRule,ye as DocumentLocation,Ue as EdgeType,xe as EmbeddedKanonak,ht as EmbeddedKanonakTypeRule,Fe as EmbeddedStatement,fe as FileSystemKanonakDocumentRepository,tt as GitIgnoreFilter,Ve as GraphBuilder,Pe as HttpKanonakDocumentRepository,kt as ImportExistenceRule,ue as InMemoryKanonakDocumentRepository,vt as InstancePropertyReferenceRule,be as Kanonak,nt as KanonakDocumentPositions,He as KanonakObjectParser,jt as KanonakObjectValidator,me as KanonakParser,$e as KanonakUri,it as KanonakUriBuilder,Ye as KanonakVocabulary,Oe as ListStatement,Ee as LiteralKanonak,Nt as MarkdownLinkRule,Ne as MarkdownStatement,$t as NamespaceImportCycleRule,mt as NamespacePrefixRule,Me as NodeType,Be as NumberStatement,Ze as OWL_RL_CLASSIFICATION_RULES,Bt as ObjectPropertyImportRule,Dt as ObjectPropertyValueValidationRule,pt as OntologyValidationError,lt as OntologyValidationResult,Lt as PropertyDomainRule,bt as PropertyHierarchyCycleRule,rt as PropertyMetadata,Kt as PropertyRangeReferenceRule,Rt as PropertyRangeRequiredRule,yt as PropertyTypeSpecificityRule,Ft as PropertyValueTypeRule,Se as PublisherConfigResolver,Ce as PublisherIndex,Xe as RDFS_RULES,et as Reasoner,Qe as ReasoningResult,ve as ReferenceKanonak,Le as ReferenceStatement,ke as RepositoryFactory,ft as ResourceNamingRule,je as ResourceResolver,_e as ResourceTypeClassifier,Ie as ScalarStatement,Te as Statement,Ke as StringStatement,wt as SubClassOfReferenceRule,xt as SubPropertyOfReferenceRule,we as SubjectKanonak,gt as SubjectKanonakTypeRequiredRule,qe as TripleStore,Ct as TypeAmbiguityRule,Ae as TypeResolver,St as UnresolvedReferenceRule,ut as ValidationContext,dt as ValidationSeverity,Dn as VersionOperator,Tt as XsdImportRule,oe as compareVersions,re as computeIntegrity,X as createAuthenticatedFetch,k as createDPoPProof,se as createVersion,At as findDerivation,ct as findInstancesByType,st as formatKanonakAddress,ae as formatVersion,q as generateDPoPKeyPair,he as getGlobalCachePath,C as hasValidToken,le as isCompatibleVersion,S as isExpired,de as isMajorCompatible,ee as loadLockFile,ze as makeUriKey,a as normalizeHost,at as parseKanonakAddress,ce as parseVersionString,ot as parseWithPositions,pe as pickHighestDocument,te as saveLockFile,Y as serverSupportsDPoP,We as tripleKey,Ge as uriKey,Je as uriTriple,ie as versionsEqual};
|
|
@@ -31,6 +31,17 @@ export declare class KanonakObjectParser implements IKanonakObjectParser {
|
|
|
31
31
|
private getPropertyMetadata;
|
|
32
32
|
private parsePropertyValue;
|
|
33
33
|
private parseDatatypeValue;
|
|
34
|
+
/**
|
|
35
|
+
* Build a MarkdownStatement for a core-prose datatype value: the raw
|
|
36
|
+
* string becomes the statement `object`, and every `[[reference]]`
|
|
37
|
+
* placeholder is resolved through the document's import closure into
|
|
38
|
+
* a `MarkdownLink`. The captured reference string is handed verbatim
|
|
39
|
+
* to the resolver — bare, alias-qualified, and local references all
|
|
40
|
+
* resolve through the same path, with no `.`-splitting here. A
|
|
41
|
+
* placeholder that does not resolve is still recorded, with `target`
|
|
42
|
+
* left undefined, so MarkdownLinkRule can report it.
|
|
43
|
+
*/
|
|
44
|
+
private parseSubstitutableValue;
|
|
34
45
|
private parseObjectValue;
|
|
35
46
|
private parseListValue;
|
|
36
47
|
/**
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
1
2
|
export declare class PropertyMetadata {
|
|
2
3
|
propertyUri: string;
|
|
3
4
|
propertyType: 'DatatypeProperty' | 'ObjectProperty';
|
|
4
5
|
range?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The property's `range` resolved to a canonical URI through the
|
|
8
|
+
* defining document's import closure. Undefined when the property
|
|
9
|
+
* declares no range, or the range fails to resolve. Lets consumers
|
|
10
|
+
* detect special datatypes (e.g. core-prose Markdown) by URI identity
|
|
11
|
+
* rather than by the author's alias spelling.
|
|
12
|
+
*/
|
|
13
|
+
rangeUri?: KanonakUri;
|
|
5
14
|
isImported: boolean;
|
|
6
15
|
definedInNamespace: string;
|
|
7
16
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts `[[reference]]` placeholders from a core-prose datatype
|
|
3
|
+
* value (`Markdown` / `SubstitutableString`).
|
|
4
|
+
*
|
|
5
|
+
* This module does ONE thing: locate the placeholder spans. It does
|
|
6
|
+
* no alias interpretation and no resolution — the captured `reference`
|
|
7
|
+
* string is handed verbatim to the ResourceResolver, which resolves
|
|
8
|
+
* bare, alias-qualified, and local references uniformly. Splitting the
|
|
9
|
+
* reference on `.` here would be the exact anti-pattern CLAUDE.md
|
|
10
|
+
* forbids.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* A `[[reference]]` placeholder found in a value, before resolution.
|
|
14
|
+
* `reference` and `displayText` are raw author text.
|
|
15
|
+
*/
|
|
16
|
+
export interface RawMarkdownLink {
|
|
17
|
+
/** Text inside the brackets before the optional `|` — e.g. `city.seattle`. */
|
|
18
|
+
reference: string;
|
|
19
|
+
/** Text after the `|` in `[[ref|display]]`, if present. */
|
|
20
|
+
displayText?: string;
|
|
21
|
+
/** Character offset of `[[` within the value string. */
|
|
22
|
+
startOffset: number;
|
|
23
|
+
/** Character offset just past `]]` within the value string. */
|
|
24
|
+
endOffset: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Scan `value` for `[[reference]]` / `[[reference|display]]`
|
|
28
|
+
* placeholders, skipping any that fall inside fenced or inline code.
|
|
29
|
+
* Offsets are relative to the start of `value`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractMarkdownLinks(value: string): RawMarkdownLink[];
|
package/dist/parsing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e}from"../chunk-
|
|
1
|
+
import{a as c,b as d,c as e}from"../chunk-CQLO62JP.js";import{d as b}from"../chunk-Z72IKY6C.js";import"../chunk-W6T7MOKY.js";import{a}from"../chunk-MYITGTGJ.js";import"../chunk-IXE5THUW.js";import"../chunk-FUUTGGJS.js";export{d as KanonakDocumentPositions,b as KanonakObjectParser,a as KanonakParser,c as PropertyMetadata,e as parseWithPositions};
|
package/dist/reasoning/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"../chunk-2SSUPRX3.js";import"../chunk-Z72IKY6C.js";import"../chunk-W6T7MOKY.js";import"../chunk-MYITGTGJ.js";import"../chunk-IXE5THUW.js";import"../chunk-FUUTGGJS.js";export{f as KanonakVocabulary,h as OWL_RL_CLASSIFICATION_RULES,g as RDFS_RULES,j as Reasoner,i as ReasoningResult,e as TripleStore,b as makeUriKey,c as tripleKey,a as uriKey,d as uriTriple};
|
|
@@ -7,6 +7,18 @@ export declare class TypeResolver {
|
|
|
7
7
|
constructor(resourceResolver: ResourceResolver);
|
|
8
8
|
isXsdDatatype(uri: KanonakUri | null | undefined): boolean;
|
|
9
9
|
isLiteralType(uri: KanonakUri | null | undefined): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* True when `uri` is `kanonak.org/core-prose/Markdown` — the datatype
|
|
12
|
+
* for CommonMark text that may embed `[[reference]]` placeholders.
|
|
13
|
+
*/
|
|
14
|
+
isMarkdownDatatype(uri: KanonakUri | null | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True when `uri` is any core-prose substitutable-string datatype —
|
|
17
|
+
* `SubstitutableString` or its `Markdown` subtype. Both carry
|
|
18
|
+
* `[[reference]]` placeholders the SDK extracts and resolves; they
|
|
19
|
+
* differ only in how derivations render the surrounding text.
|
|
20
|
+
*/
|
|
21
|
+
isSubstitutableDatatype(uri: KanonakUri | null | undefined): boolean;
|
|
10
22
|
isKnownXsdDatatypeName(typeName: string): boolean;
|
|
11
23
|
isClassTypeAsync(typeName: string, currentDocument: KanonakDocument): Promise<boolean>;
|
|
12
24
|
getPropertyTypeClassification(propertyType: string | null | undefined): string;
|
|
@@ -6,6 +6,7 @@ export { parseKanonakAddress, formatKanonakAddress, } from './KanonakAddress.js'
|
|
|
6
6
|
export type { KanonakAddress } from './KanonakAddress.js';
|
|
7
7
|
export type { ResourceResolutionResult } from './ResourceResolutionResult.js';
|
|
8
8
|
export { TypeResolver } from './TypeResolver.js';
|
|
9
|
+
export { ResourceTypeClassifier } from './ResourceTypeClassifier.js';
|
|
9
10
|
export { findInstancesByType } from './InstanceSearch.js';
|
|
10
11
|
export type { InstanceSearchResult } from './InstanceSearch.js';
|
|
11
12
|
export { compareVersions, versionsEqual, formatVersion, parseVersionString, createVersion, isCompatibleVersion, isMajorCompatible, pickHighestDocument, } from './VersionUtils.js';
|
package/dist/resolution/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,b as m,c as n,d as o}from"../chunk-
|
|
1
|
+
import{a as l,b as m,c as n,d as o,e as p}from"../chunk-VRZUCZEF.js";import{a,b,c,d,e,f,g,h}from"../chunk-FQHALFRR.js";import{b as j,c as k}from"../chunk-IXE5THUW.js";import{a as i}from"../chunk-FUUTGGJS.js";export{i as KanonakUri,m as KanonakUriBuilder,j as ResourceResolver,l as ResourceTypeClassifier,k as TypeResolver,a as compareVersions,d as createVersion,p as findInstancesByType,o as formatKanonakAddress,c as formatVersion,f as isCompatibleVersion,g as isMajorCompatible,n as parseKanonakAddress,e as parseVersionString,h as pickHighestDocument,b as versionsEqual};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StringStatement } from './StringStatement.js';
|
|
2
|
+
import type { ReferenceKanonak } from '../kanonaks/ReferenceKanonak.js';
|
|
3
|
+
/**
|
|
4
|
+
* A single `[[reference]]` placeholder discovered in a core-prose
|
|
5
|
+
* datatype value, with its raw spelling, optional display label,
|
|
6
|
+
* resolved target, and character span within the value string.
|
|
7
|
+
*/
|
|
8
|
+
export interface MarkdownLink {
|
|
9
|
+
/** Raw reference text inside the brackets, before any `|` — e.g. `city.seattle`. */
|
|
10
|
+
reference: string;
|
|
11
|
+
/** Display label — the text after `|` in `[[ref|label]]`, if the author gave one. */
|
|
12
|
+
displayText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The resolved target. Undefined when `reference` does not resolve
|
|
15
|
+
* through the document's import closure; `MarkdownLinkRule` reports
|
|
16
|
+
* those as validation errors.
|
|
17
|
+
*/
|
|
18
|
+
target?: ReferenceKanonak;
|
|
19
|
+
/** Character offset of `[[` within the value string. */
|
|
20
|
+
startOffset: number;
|
|
21
|
+
/** Character offset just past `]]` within the value string. */
|
|
22
|
+
endOffset: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The statement produced for a property whose range is a core-prose
|
|
26
|
+
* datatype — `kanonak.org/core-prose/Markdown` or its
|
|
27
|
+
* `SubstitutableString` supertype.
|
|
28
|
+
*
|
|
29
|
+
* The literal value is carried as the ordinary `StringStatement`
|
|
30
|
+
* `object`, so consumers that only want the text treat it like any
|
|
31
|
+
* other string statement. `links` additionally exposes every
|
|
32
|
+
* `[[reference]]` placeholder found in the value, each resolved to a
|
|
33
|
+
* `ReferenceKanonak` through the document's import closure.
|
|
34
|
+
* Placeholders inside fenced or inline code are not included.
|
|
35
|
+
*/
|
|
36
|
+
export declare class MarkdownStatement extends StringStatement {
|
|
37
|
+
links: MarkdownLink[];
|
|
38
|
+
}
|
|
@@ -7,3 +7,5 @@ export { BooleanStatement } from './BooleanStatement.js';
|
|
|
7
7
|
export { ReferenceStatement } from './ReferenceStatement.js';
|
|
8
8
|
export { EmbeddedStatement } from './EmbeddedStatement.js';
|
|
9
9
|
export { ListStatement } from './ListStatement.js';
|
|
10
|
+
export { MarkdownStatement } from './MarkdownStatement.js';
|
|
11
|
+
export type { MarkdownLink } from './MarkdownStatement.js';
|