@kanonak-protocol/sdk 5.17.1 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/{chunk-QLVKAGUU.js → chunk-5TI4E6M7.js} +2 -2
- package/dist/chunk-M443OYKT.js +1 -0
- package/dist/{chunk-4PY3JJH3.js → chunk-P36E2UV6.js} +13 -13
- package/dist/{chunk-Q6XQ5IXW.js → chunk-UYSEO3OT.js} +6 -6
- package/dist/index.d.ts +3 -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/shacl/ConformanceEvaluator.d.ts +53 -0
- package/dist/shacl/ConformanceScope.d.ts +72 -0
- package/dist/shacl/ReportBuilder.d.ts +28 -0
- package/dist/shacl/ShapesModel.d.ts +59 -0
- package/dist/shacl/index.d.ts +9 -0
- package/dist/shacl/lowering.d.ts +26 -0
- package/dist/shacl/uris.d.ts +64 -0
- package/dist/transformations/index.js +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-ITKOKDBG.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PublisherConfig } from '../repositories/index.js';
|
|
2
|
+
import type { UnresolvedImportEdge } from './closure.js';
|
|
2
3
|
/** A render-stack package by canonical (publisher, package). */
|
|
3
4
|
export interface RenderPackageRef {
|
|
4
5
|
readonly publisher: string;
|
|
@@ -74,4 +75,4 @@ export interface RenderStackReport {
|
|
|
74
75
|
* package COSTS the page is part of the message — that's the insight a person
|
|
75
76
|
* debugging "my site has no styles" needs, and it differs per package.
|
|
76
77
|
*/
|
|
77
|
-
export declare function buildRenderStackWarnings(packages: readonly RenderPackageStatus[]): string[];
|
|
78
|
+
export declare function buildRenderStackWarnings(packages: readonly RenderPackageStatus[], unresolvedEdges?: readonly UnresolvedImportEdge[]): string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
|
+
import { type EntityUri } from '../uri-helpers/index.js';
|
|
4
|
+
import type { ConformanceScope } from './ConformanceScope.js';
|
|
5
|
+
import { type ShaclNodeShapeModel, type ShaclSeverity } from './ShapesModel.js';
|
|
6
|
+
/**
|
|
7
|
+
* SHACL conformance over an explicit {@link ConformanceScope} — the evaluator
|
|
8
|
+
* half of the settled division:
|
|
9
|
+
*
|
|
10
|
+
* - TARGETING is a host-side graph query (this module, over the scope
|
|
11
|
+
* catalog + optional reasoning);
|
|
12
|
+
* - kernel-expressible constraints evaluate through the PUBLISHED expression
|
|
13
|
+
* runtime via the lowering (`Count`/`Contains`/`Matches`/ordering
|
|
14
|
+
* comparisons) — this module never re-implements an operator;
|
|
15
|
+
* - constraints whose evidence exists only in the host object model are
|
|
16
|
+
* HOST PROJECTIONS: `sh:datatype` (the typed statement + the canonical
|
|
17
|
+
* layer's carrier routing), `sh:class` (resolution + type closure),
|
|
18
|
+
* `sh:nodeKind` (statement kind), `sh:closed` (the focus node's predicate
|
|
19
|
+
* set vs. the shape's declared paths, over the scope).
|
|
20
|
+
*
|
|
21
|
+
* Every finding names its focus node, path, offending value, and constraint
|
|
22
|
+
* component — the material a ValidationReport is assembled from.
|
|
23
|
+
*/
|
|
24
|
+
export interface ShaclFinding {
|
|
25
|
+
/** Canonical URI key of the focus node (`publisher/package/name`). */
|
|
26
|
+
focusNode: string;
|
|
27
|
+
/** The focus node's full URI when it carries a resolvable version. */
|
|
28
|
+
focusUri?: KanonakUri | undefined;
|
|
29
|
+
/** The constrained property, for property-level findings. */
|
|
30
|
+
resultPath?: KanonakUri | undefined;
|
|
31
|
+
/** The offending literal value, when one exists. */
|
|
32
|
+
value?: string | number | boolean | undefined;
|
|
33
|
+
/** The offending reference value, when the value is a reference. */
|
|
34
|
+
valueRef?: KanonakUri | undefined;
|
|
35
|
+
/** WHICH constraint failed — a core-shacl ConstraintComponent member. */
|
|
36
|
+
constraintComponent: EntityUri;
|
|
37
|
+
severity: ShaclSeverity;
|
|
38
|
+
message: string;
|
|
39
|
+
/** The NodeShape that produced this finding. */
|
|
40
|
+
sourceShape: string;
|
|
41
|
+
sourceShapeUri?: KanonakUri | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface ShaclConformanceResult {
|
|
44
|
+
/** True when no finding carries Violation severity. */
|
|
45
|
+
conforms: boolean;
|
|
46
|
+
results: ShaclFinding[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Evaluate every NodeShape in `shapes` against the scope. `shapes` may be a
|
|
50
|
+
* pre-built model or a catalog to read shapes from (commonly the scope's own
|
|
51
|
+
* catalog: shapes travel as packages like everything else).
|
|
52
|
+
*/
|
|
53
|
+
export declare function evaluateConformance(scope: ConformanceScope, shapes: ShaclNodeShapeModel[] | Kanonak[]): ShaclConformanceResult;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
2
|
+
import type { KanonakDocument } from '@kanonak-protocol/types/document/models/types';
|
|
3
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
4
|
+
import type { ReasoningResult } from '../reasoning/ReasoningResult.js';
|
|
5
|
+
/**
|
|
6
|
+
* The EXPLICIT data scope a conformance evaluation runs over — the answer to
|
|
7
|
+
* "which statements count as the statements about this node." Conformance —
|
|
8
|
+
* and `sh:closed` in particular — is never evaluated against the ambient open
|
|
9
|
+
* world: closed means closed over THIS scope, an authorized graph handle the
|
|
10
|
+
* caller constructs deliberately.
|
|
11
|
+
*
|
|
12
|
+
* Two modes:
|
|
13
|
+
*
|
|
14
|
+
* - `merged` — the open-world merge over a pinned load-set (a repository
|
|
15
|
+
* the caller controls: a workspace, a locked closure, a governance
|
|
16
|
+
* load-set). Augmentations WITHIN the load-set are honored — that is what
|
|
17
|
+
* the merge is for — and the reasoner's saturation is available so
|
|
18
|
+
* `targetClass` sees subclass/equivalentClass closure.
|
|
19
|
+
*
|
|
20
|
+
* - `standalone` — one document judged ON ITS OWN STATEMENTS, its imports
|
|
21
|
+
* deliberately NOT resolved into data: the ingress case, where the
|
|
22
|
+
* document is an untrusted payload and nothing it declares may pull more
|
|
23
|
+
* graph into scope. References to entities outside the document stay
|
|
24
|
+
* unresolved, which is exactly what a closed-world boundary check wants
|
|
25
|
+
* (unknown = reject, fail closed).
|
|
26
|
+
*/
|
|
27
|
+
export interface ConformanceScope {
|
|
28
|
+
kind: 'merged' | 'standalone';
|
|
29
|
+
/** The statements in scope, as the parsed object model. */
|
|
30
|
+
catalog: Kanonak[];
|
|
31
|
+
/**
|
|
32
|
+
* The reasoned view of the scope, when the mode reasons (merged). Used for
|
|
33
|
+
* closure-aware `targetClass` and `sh:class` checks; absent in standalone
|
|
34
|
+
* mode, where checks fall back to the direct statements — an untrusted
|
|
35
|
+
* payload gets no inference.
|
|
36
|
+
*/
|
|
37
|
+
reasoning?: ReasoningResult | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build a merged scope from a repository — the pinned load-set. One parse
|
|
41
|
+
* (the same open-world merge every SDK consumer sees) + one reasoning pass
|
|
42
|
+
* over the same repository, so targeting and class checks are
|
|
43
|
+
* closure-aware. The caller owns WHAT is in the repository; that is the
|
|
44
|
+
* authorization boundary.
|
|
45
|
+
*/
|
|
46
|
+
export declare function scopeFromRepositoryAsync(repository: IKanonakDocumentRepository): Promise<ConformanceScope>;
|
|
47
|
+
/**
|
|
48
|
+
* Build a merged scope from an already-parsed catalog (e.g. a validation
|
|
49
|
+
* pass's single-parse `ValidationCache.getKanonaks()`), optionally with an
|
|
50
|
+
* existing reasoning result — so a batch caller adds conformance without a
|
|
51
|
+
* second parse or reason.
|
|
52
|
+
*/
|
|
53
|
+
export declare function scopeFromCatalog(catalog: Kanonak[], reasoning?: ReasoningResult): ConformanceScope;
|
|
54
|
+
/**
|
|
55
|
+
* Build a standalone scope from a single document — the ingress case. The
|
|
56
|
+
* split is DATA vs IDENTITY:
|
|
57
|
+
*
|
|
58
|
+
* - DATA: only the payload's own subjects enter the scope
|
|
59
|
+
* (`SingleDocumentRepository` exposes exactly this document), so the
|
|
60
|
+
* payload cannot pull additional statements into what is judged — its
|
|
61
|
+
* imports are not honored as data, and no reasoning runs (an untrusted
|
|
62
|
+
* payload gets no inference).
|
|
63
|
+
* - IDENTITY: the payload's predicates and type references resolve through
|
|
64
|
+
* `identityRepository` — the TRUSTED closure the caller authorizes
|
|
65
|
+
* (typically the same pinned load-set the shapes come from). Without
|
|
66
|
+
* this, an adversarial payload's statements would fail to resolve and
|
|
67
|
+
* silently vanish from the judged data — a fail-OPEN closed-shape check.
|
|
68
|
+
* An import naming a package outside the trusted repository stays
|
|
69
|
+
* unresolved, and its unresolvable statements are exactly what a closed
|
|
70
|
+
* shape rejects.
|
|
71
|
+
*/
|
|
72
|
+
export declare function scopeFromDocumentAsync(document: KanonakDocument, identityRepository?: IKanonakDocumentRepository): Promise<ConformanceScope>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IKanonakDocumentRepository } from '@kanonak-protocol/types/document/models';
|
|
2
|
+
import { type BuiltPackage } from '../producer/PackageBuilder.js';
|
|
3
|
+
import type { ShaclConformanceResult } from './ConformanceEvaluator.js';
|
|
4
|
+
/**
|
|
5
|
+
* Assemble a {@link ShaclConformanceResult} into an AUTHORED
|
|
6
|
+
* `sh:ValidationReport` package — graph data, not tool prose — via the
|
|
7
|
+
* EphemeralPackage pattern: versionless, content-addressed (`q-<hex16>`),
|
|
8
|
+
* produced per invocation, and therefore hashable and signable into a
|
|
9
|
+
* provenance chain. This is the report half of the settled division:
|
|
10
|
+
* `explain()` is the evaluation MECHANISM; the report is authored vocabulary
|
|
11
|
+
* (`core-shacl@1.1.0`) any SHACL-aware tool can round-trip.
|
|
12
|
+
*
|
|
13
|
+
* Reference serialization is honest about what can be imported: a focus node
|
|
14
|
+
* (or path/shape/value) whose package carries a resolvable version is
|
|
15
|
+
* serialized as a true reference through the ImportBook; an entity from a
|
|
16
|
+
* versionless, content-addressed scope (an ingress EphemeralPackage) cannot
|
|
17
|
+
* be imported by version, so it is recorded as its canonical URI string —
|
|
18
|
+
* stated in the property's value rather than silently dropped.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildReportPackageAsync(args: {
|
|
21
|
+
result: ShaclConformanceResult;
|
|
22
|
+
/** The publisher the report package is authored under (the evaluator's operator). */
|
|
23
|
+
publisher: string;
|
|
24
|
+
/** Resolution context for content-hashing the report body. */
|
|
25
|
+
repository: IKanonakDocumentRepository;
|
|
26
|
+
/** Out-of-body provenance (e.g. `resolvedAt`, `id`) — never hashed. */
|
|
27
|
+
header?: Record<string, unknown> | undefined;
|
|
28
|
+
}): Promise<BuiltPackage>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Kanonak } from '../kanonaks/Kanonak.js';
|
|
2
|
+
import type { KanonakUri } from '../resolution/KanonakUri.js';
|
|
3
|
+
/**
|
|
4
|
+
* The parsed, resolved model of the core-shacl shapes a catalog declares —
|
|
5
|
+
* the CONFORMANCE side's view (the introspection side keeps its own
|
|
6
|
+
* codegen-shaped `PropertyConstraints`; both read the same vocabulary through
|
|
7
|
+
* the shared `shacl/uris` identities). Everything resolves through the object
|
|
8
|
+
* model: shapes are recognized by durable core-shacl URI identity, references
|
|
9
|
+
* arrive as `KanonakUri`, and nothing matches on alias or local-name shape.
|
|
10
|
+
*/
|
|
11
|
+
/** The three node kinds, mapped from the sh:NodeKind members. */
|
|
12
|
+
export type ShaclNodeKind = 'IRI' | 'BlankNode' | 'Literal';
|
|
13
|
+
/** Result severity, mapped from the sh:Severity members. */
|
|
14
|
+
export type ShaclSeverity = 'Violation' | 'Warning' | 'Info';
|
|
15
|
+
export interface ShaclPropertyConstraint {
|
|
16
|
+
/** The constrained property's canonical URI (`sh:path`). */
|
|
17
|
+
path: KanonakUri;
|
|
18
|
+
minCount?: number | undefined;
|
|
19
|
+
maxCount?: number | undefined;
|
|
20
|
+
minLength?: number | undefined;
|
|
21
|
+
maxLength?: number | undefined;
|
|
22
|
+
minInclusive?: number | undefined;
|
|
23
|
+
maxInclusive?: number | undefined;
|
|
24
|
+
pattern?: {
|
|
25
|
+
regex: string;
|
|
26
|
+
flags?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
/** `sh:in` literal members. */
|
|
29
|
+
inValues?: (string | number | boolean)[] | undefined;
|
|
30
|
+
/** `sh:in` reference members (named individuals). */
|
|
31
|
+
inRefs?: KanonakUri[] | undefined;
|
|
32
|
+
datatype?: KanonakUri | undefined;
|
|
33
|
+
classRef?: KanonakUri | undefined;
|
|
34
|
+
nodeKind?: ShaclNodeKind | undefined;
|
|
35
|
+
message?: string | undefined;
|
|
36
|
+
severity?: ShaclSeverity | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface ShaclNodeShapeModel {
|
|
39
|
+
/** The shape's local name (diagnostics + `sh:sourceShape`). */
|
|
40
|
+
name: string;
|
|
41
|
+
/** The shape's canonical URI, when it is a named subject. */
|
|
42
|
+
uri?: KanonakUri | undefined;
|
|
43
|
+
targetClass?: KanonakUri | undefined;
|
|
44
|
+
targetNodes: KanonakUri[];
|
|
45
|
+
targetSubjectsOf: KanonakUri[];
|
|
46
|
+
targetObjectsOf: KanonakUri[];
|
|
47
|
+
closed: boolean;
|
|
48
|
+
ignoredProperties: KanonakUri[];
|
|
49
|
+
severity?: ShaclSeverity | undefined;
|
|
50
|
+
properties: ShaclPropertyConstraint[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse every `sh:NodeShape` in the shapes catalog into its resolved model.
|
|
54
|
+
* PropertyShapes are collected inline-embedded or by reference (resolved in
|
|
55
|
+
* the same catalog). A shape with no target of any kind constrains nothing
|
|
56
|
+
* and is still returned — the evaluator simply finds an empty focus set (the
|
|
57
|
+
* definition validator warns about it separately).
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildShapesModel(shapesCatalog: Kanonak[]): ShaclNodeShapeModel[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { scopeFromRepositoryAsync, scopeFromCatalog, scopeFromDocumentAsync, } from './ConformanceScope.js';
|
|
2
|
+
export type { ConformanceScope } from './ConformanceScope.js';
|
|
3
|
+
export { buildShapesModel } from './ShapesModel.js';
|
|
4
|
+
export type { ShaclNodeShapeModel, ShaclPropertyConstraint, ShaclNodeKind, ShaclSeverity, } from './ShapesModel.js';
|
|
5
|
+
export { lowerConstraint, foldFlagsIntoPattern } from './lowering.js';
|
|
6
|
+
export type { LoweredCheck, LoweredExprNode } from './lowering.js';
|
|
7
|
+
export { evaluateConformance } from './ConformanceEvaluator.js';
|
|
8
|
+
export type { ShaclConformanceResult, ShaclFinding } from './ConformanceEvaluator.js';
|
|
9
|
+
export { buildReportPackageAsync } from './ReportBuilder.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ShaclPropertyConstraint } from './ShapesModel.js';
|
|
2
|
+
/** A node in the expression runtime's tree format (its `ExprNode`). */
|
|
3
|
+
export interface LoweredExprNode {
|
|
4
|
+
type: string;
|
|
5
|
+
[operandOrValue: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
/** The variable names the evaluator binds when running lowered checks. */
|
|
8
|
+
export declare const LOWERED_VALUES_VAR = "values";
|
|
9
|
+
export declare const LOWERED_VALUE_VAR = "v";
|
|
10
|
+
export declare const LOWERED_ALLOWED_VAR = "allowed";
|
|
11
|
+
export interface LoweredCheck {
|
|
12
|
+
/** Which constraint this check enforces (the report's discriminant). */
|
|
13
|
+
component: 'minCount' | 'maxCount' | 'in' | 'pattern' | 'minLength' | 'maxLength' | 'minInclusive' | 'maxInclusive';
|
|
14
|
+
/** `node` = once per focus node (binds `values`); `value` = once per value (binds `v`, and `allowed` for `in`). */
|
|
15
|
+
per: 'node' | 'value';
|
|
16
|
+
expr: LoweredExprNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `sh:flags` folds into the runtime's whole-pattern flag prefix — the only
|
|
20
|
+
* flag mechanism in the pinned subset. Only `i`, `m`, `s` exist there; any
|
|
21
|
+
* other flag is outside the subset and must fail loudly rather than be
|
|
22
|
+
* silently dropped.
|
|
23
|
+
*/
|
|
24
|
+
export declare function foldFlagsIntoPattern(regex: string, flags: string | undefined): string;
|
|
25
|
+
/** Lower one PropertyShape's kernel-expressible constraints. */
|
|
26
|
+
export declare function lowerConstraint(c: ShaclPropertyConstraint): LoweredCheck[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { EntityUri } from '../uri-helpers/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* THE canonical URI constants for the `kanonak.org/core-shacl` vocabulary —
|
|
4
|
+
* shared by the conformance layer, the constraint-enrichment index
|
|
5
|
+
* (`introspection/ShaclConstraints`), and the definition-validation rule
|
|
6
|
+
* (`ShaclShapeRule`), so the vocabulary's identity lives in exactly one
|
|
7
|
+
* module. Hardcoded URIs are the canonical-ontology contract (never
|
|
8
|
+
* alias/local-name heuristics).
|
|
9
|
+
*/
|
|
10
|
+
export declare const SHACL_PUBLISHER = "kanonak.org";
|
|
11
|
+
export declare const SHACL_PACKAGE = "core-shacl";
|
|
12
|
+
export declare const SH_NODE_SHAPE: EntityUri;
|
|
13
|
+
export declare const SH_PROPERTY_SHAPE: EntityUri;
|
|
14
|
+
export declare const SH_TARGET_CLASS: EntityUri;
|
|
15
|
+
export declare const SH_PROPERTY: EntityUri;
|
|
16
|
+
export declare const SH_PATH: EntityUri;
|
|
17
|
+
export declare const SH_MIN_COUNT: EntityUri;
|
|
18
|
+
export declare const SH_MAX_COUNT: EntityUri;
|
|
19
|
+
export declare const SH_DATATYPE: EntityUri;
|
|
20
|
+
export declare const SH_CLASS: EntityUri;
|
|
21
|
+
export declare const SH_IN: EntityUri;
|
|
22
|
+
export declare const SH_PATTERN: EntityUri;
|
|
23
|
+
export declare const SH_FLAGS: EntityUri;
|
|
24
|
+
export declare const SH_MIN_LENGTH: EntityUri;
|
|
25
|
+
export declare const SH_MAX_LENGTH: EntityUri;
|
|
26
|
+
export declare const SH_MIN_INCLUSIVE: EntityUri;
|
|
27
|
+
export declare const SH_MAX_INCLUSIVE: EntityUri;
|
|
28
|
+
export declare const SH_MESSAGE: EntityUri;
|
|
29
|
+
export declare const SH_TARGET_NODE: EntityUri;
|
|
30
|
+
export declare const SH_TARGET_SUBJECTS_OF: EntityUri;
|
|
31
|
+
export declare const SH_TARGET_OBJECTS_OF: EntityUri;
|
|
32
|
+
export declare const SH_CLOSED: EntityUri;
|
|
33
|
+
export declare const SH_IGNORED_PROPERTIES: EntityUri;
|
|
34
|
+
export declare const SH_NODE_KIND: EntityUri;
|
|
35
|
+
export declare const SH_NODEKIND_IRI: EntityUri;
|
|
36
|
+
export declare const SH_NODEKIND_BLANK_NODE: EntityUri;
|
|
37
|
+
export declare const SH_NODEKIND_LITERAL: EntityUri;
|
|
38
|
+
export declare const SH_SEVERITY: EntityUri;
|
|
39
|
+
export declare const SH_VIOLATION: EntityUri;
|
|
40
|
+
export declare const SH_WARNING: EntityUri;
|
|
41
|
+
export declare const SH_INFO: EntityUri;
|
|
42
|
+
export declare const SH_VALIDATION_REPORT: EntityUri;
|
|
43
|
+
export declare const SH_CONFORMS: EntityUri;
|
|
44
|
+
export declare const SH_RESULT: EntityUri;
|
|
45
|
+
export declare const SH_VALIDATION_RESULT: EntityUri;
|
|
46
|
+
export declare const SH_FOCUS_NODE: EntityUri;
|
|
47
|
+
export declare const SH_RESULT_PATH: EntityUri;
|
|
48
|
+
export declare const SH_RESULT_MESSAGE: EntityUri;
|
|
49
|
+
export declare const SH_RESULT_SEVERITY: EntityUri;
|
|
50
|
+
export declare const SH_SOURCE_SHAPE: EntityUri;
|
|
51
|
+
export declare const SH_VALUE: EntityUri;
|
|
52
|
+
export declare const SH_SOURCE_CONSTRAINT_COMPONENT: EntityUri;
|
|
53
|
+
export declare const SH_COMP_MIN_COUNT: EntityUri;
|
|
54
|
+
export declare const SH_COMP_MAX_COUNT: EntityUri;
|
|
55
|
+
export declare const SH_COMP_DATATYPE: EntityUri;
|
|
56
|
+
export declare const SH_COMP_CLASS: EntityUri;
|
|
57
|
+
export declare const SH_COMP_IN: EntityUri;
|
|
58
|
+
export declare const SH_COMP_PATTERN: EntityUri;
|
|
59
|
+
export declare const SH_COMP_MIN_LENGTH: EntityUri;
|
|
60
|
+
export declare const SH_COMP_MAX_LENGTH: EntityUri;
|
|
61
|
+
export declare const SH_COMP_MIN_INCLUSIVE: EntityUri;
|
|
62
|
+
export declare const SH_COMP_MAX_INCLUSIVE: EntityUri;
|
|
63
|
+
export declare const SH_COMP_NODE_KIND: EntityUri;
|
|
64
|
+
export declare const SH_COMP_CLOSED: EntityUri;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as X,c as Un,d as Vn,e as pe,f as ve,g as M,h as Rn,i as q,j as G}from"../chunk-
|
|
1
|
+
import{b as X,c as Un,d as Vn,e as pe,f as ve,g as M,h as Rn,i as q,j as G}from"../chunk-P36E2UV6.js";import{a as le}from"../chunk-LYSCTQC2.js";import"../chunk-QHABFCRC.js";import"../chunk-4NO7MHS7.js";import"../chunk-5NH5XDGO.js";import"../chunk-PEJALHXK.js";import{a as ce,b as ue,c as de,e as $n,f as Tn,g as Bn,h as xn,m as fe}from"../chunk-V6KIDED2.js";import{a as se}from"../chunk-NJ3AZYQD.js";import{e as U}from"../chunk-SVUMCLK5.js";import{b as Y,c as D,d as E,g as $,h as T,i as B,j as w,k as me,l as x,n as N,o as S,r as A}from"../chunk-YW6P24RF.js";import"../chunk-FUUTGGJS.js";import{g as ie}from"../chunk-2ACBWC7K.js";var Le="kanonak.org",Oe="document-ast",i=e=>({publisher:Le,package_:Oe,name:e}),m={Document:i("Document"),Block:i("Block"),Inline:i("Inline"),StructuredValue:i("StructuredValue"),Heading:i("Heading"),Paragraph:i("Paragraph"),RawBlock:i("RawBlock"),Text:i("Text"),StructuredMap:i("StructuredMap"),StructuredEntry:i("StructuredEntry"),StructuredList:i("StructuredList"),StringScalar:i("StringScalar"),IntegerScalar:i("IntegerScalar"),EscapeHint:i("EscapeHint"),MediaType:i("MediaType"),metadata:i("metadata"),children:i("children"),level:i("level"),inlines:i("inlines"),text:i("text"),entries:i("entries"),key:i("key"),value:i("value"),escapeHint:i("escapeHint"),items:i("items"),stringValue:i("stringValue"),integerValue:i("integerValue"),rawContent:i("rawContent"),mediaType:i("mediaType"),mimeType:i("mimeType"),ESC_RAW:i("esc-raw"),ESC_YAML_SAFE:i("esc-yaml-safe"),ESC_TOML_STRING:i("esc-toml-string"),ESC_TOML_MULTILINE:i("esc-toml-multiline"),ESC_JSON:i("esc-json"),ESC_DYNAMODB_BOOL:i("esc-dynamodb-bool"),ESC_DYNAMODB_NUMBER:i("esc-dynamodb-number"),ESC_DYNAMODB_NULL:i("esc-dynamodb-null"),TEXT_PLAIN:i("text-plain"),TEXT_MARKDOWN:i("text-markdown"),TEXT_HTML:i("text-html"),TEXT_CSS:i("text-css"),APPLICATION_JSON:i("application-json"),TEXT_YAML:i("text-yaml"),IMAGE_SVG_XML:i("image-svg-xml"),ResourceLink:i("ResourceLink"),target:i("target"),linkLabel:i("linkLabel"),PropertyList:i("PropertyList"),propertyEntries:i("propertyEntries"),PropertyEntry:i("PropertyEntry"),propertyKey:i("propertyKey"),propertyValue:i("propertyValue"),Table:i("Table"),tableColumnLabels:i("tableColumnLabels"),tableRows:i("tableRows"),TableRow:i("TableRow"),tableCells:i("tableCells")};function ge(e,n){return e.publisher===n.publisher&&e.package_===n.package_&&e.name===n.name}var V=class{backendUri="kanonak.org/transformations/markdown-with-frontmatter";render(n,t){let r=Ie(n.metadata,t),o=Ke(n.children),s=["---",...r,"---","",o].join(`
|
|
2
2
|
`);return t?.trailingNewline&&(s.endsWith(`
|
|
3
3
|
`)||(s+=`
|
|
4
4
|
`)),s}};function Ie(e,n){if(!e)return[];let t=new Map;for(let c of e.entries)t.set(P(c.key),c);let r=new Map;if(n?.metadataRenames)for(let[c,u]of n.metadataRenames)r.set(P(c),u);let a=(n?.metadataKeys??e.entries.map(c=>c.key)).map(P),s=[];for(let c of a){let u=t.get(c);if(!u)continue;let f=r.get(c),l=P(f??c),d=ye(u.value,u.escapeHint);d!==void 0&&s.push(`${l}: ${d}`)}return s}function P(e){let n=e.lastIndexOf(".");return n===-1?e:e.substring(n+1)||e}function ye(e,n){switch(e.kind){case"StringScalar":return _e(e.stringValue,n);case"IntegerScalar":return String(e.integerValue);case"StructuredList":{let t=[];for(let r of e.items){let o=ye(r,n);o!==void 0&&t.push(o)}return t.join(", ")}case"StructuredMap":return;default:return}}function _e(e,n){return!n||ge(n,m.ESC_RAW)?e:ge(n,m.ESC_YAML_SAFE)?Ce(e):e}function Ce(e){return e.includes(`
|
|
@@ -8,4 +8,4 @@ export { KanonakObjectValidator } from './KanonakObjectValidator.js';
|
|
|
8
8
|
export type { IDocumentValidationRule } from './rules/document/IDocumentValidationRule.js';
|
|
9
9
|
export type { IRepositoryValidationRule } from './rules/repository/IRepositoryValidationRule.js';
|
|
10
10
|
export { NamespacePrefixRule, ResourceNamingRule, PropertyTypeSpecificityRule, SubjectKanonakTypeRequiredRule, PackageHeaderRule } from './rules/document/index.js';
|
|
11
|
-
export { ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, EmbeddedKanonakTypeRule, MarkdownLinkRule, DisplayLensScopeRule, LookSemanticSvgPathRule, TxExpressionPathRule, ShaclShapeRule, OwlOneOfRule, DiamondNameClashRule } from './rules/repository/index.js';
|
|
11
|
+
export { ImportExistenceRule, UnresolvedReferenceRule, ClassHierarchyCycleRule, PropertyHierarchyCycleRule, PropertyRangeRequiredRule, SubClassOfReferenceRule, SubPropertyOfReferenceRule, NamespaceImportCycleRule, UnresolvedPredicateRule, AmbiguousReferenceRule, PropertyRangeReferenceRule, ObjectPropertyValueValidationRule, PropertyDomainRule, PropertyKindRangeConsistencyRule, ReservedNameShadowRule, ClassDefinitionRule, EmbeddedKanonakTypeRule, MarkdownLinkRule, DisplayLensScopeRule, LookSemanticSvgPathRule, LookBandPathRule, TxExpressionPathRule, ShaclShapeRule, OwlOneOfRule, DiamondNameClashRule } from './rules/repository/index.js';
|
package/dist/validation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,
|
|
1
|
+
import{A,B,C,D,E,F,G,H,K as I,L as J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-UYSEO3OT.js";import"../chunk-M443OYKT.js";import"../chunk-V6KIDED2.js";import"../chunk-NJ3AZYQD.js";import"../chunk-SVUMCLK5.js";import"../chunk-YW6P24RF.js";import"../chunk-FUUTGGJS.js";import"../chunk-2ACBWC7K.js";export{u as AmbiguousReferenceRule,A as ClassDefinitionRule,n as ClassHierarchyCycleRule,I as DiamondNameClashRule,C as DisplayLensScopeRule,k as EmbeddedKanonakTypeRule,l as ImportExistenceRule,J as KanonakObjectValidator,E as LookBandPathRule,D as LookSemanticSvgPathRule,B as MarkdownLinkRule,s as NamespaceImportCycleRule,f as NamespacePrefixRule,w as ObjectPropertyValueValidationRule,c as OntologyValidationError,a as OntologyValidationResult,H as OwlOneOfRule,j as PackageHeaderRule,x as PropertyDomainRule,o as PropertyHierarchyCycleRule,y as PropertyKindRangeConsistencyRule,v as PropertyRangeReferenceRule,p as PropertyRangeRequiredRule,h as PropertyTypeSpecificityRule,z as ReservedNameShadowRule,g as ResourceNamingRule,G as ShaclShapeRule,q as SubClassOfReferenceRule,r as SubPropertyOfReferenceRule,i as SubjectKanonakTypeRequiredRule,F as TxExpressionPathRule,t as UnresolvedPredicateRule,m as UnresolvedReferenceRule,e as ValidationCache,d as ValidationContext,b as ValidationSeverity};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.0",
|
|
4
4
|
"description": "TypeScript SDK for the Kanonak Protocol — parse, resolve, validate, reason over, and render .kan.yml packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -126,10 +126,11 @@
|
|
|
126
126
|
],
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@kanonak-protocol/canonical": "^0.1.3",
|
|
129
|
-
"@kanonak-protocol/types": "^5.
|
|
129
|
+
"@kanonak-protocol/types": "^5.19.0",
|
|
130
130
|
"ignore": "^7.0.5",
|
|
131
131
|
"js-yaml": "^4.1.0",
|
|
132
|
-
"yaml": "^2.7.0"
|
|
132
|
+
"yaml": "^2.7.0",
|
|
133
|
+
"@kanonak-protocol/expression": "^0.3.0"
|
|
133
134
|
},
|
|
134
135
|
"optionalDependencies": {
|
|
135
136
|
"@huggingface/transformers": "^3.8.1"
|
package/dist/chunk-ITKOKDBG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as u}from"./chunk-2ACBWC7K.js";function g(t){let n=t.metadata?.namespace_;return n?`${n.publisher}/${n.package_}`:void 0}function d(t){let n=t.metadata?.namespace_;if(n)return n.version?`${n.publisher}/${n.package_}@${u(n.version)}`:`${n.publisher}/${n.package_}`}async function h(t,n){let e=new Set,s=new Set,o=[...t];for(;o.length>0;){let r=o.shift(),c=g(r),i=d(r);if(!c||!i||s.has(i))continue;s.add(i),e.add(c);let a=r.metadata?.imports;if(a)for(let[p,y]of Object.entries(a))for(let D of y)try{let m=await n.getHighestCompatibleVersionAsync(p,D);m&&o.push(m)}catch{}}return e}var l=class{constructor(n,e){this.inner=n;this.scope=e}inner;scope;async getAllDocumentsAsync(){return(await this.inner.getAllDocumentsAsync()).filter(e=>{let s=g(e);return s!==void 0&&this.scope.has(s)})}getDocumentAsync(n){return this.inner.getDocumentAsync(n)}getDocumentsByNamespaceAsync(n,e){return this.inner.getDocumentsByNamespaceAsync(n,e)}getHighestCompatibleVersionAsync(n,e){return this.inner.getHighestCompatibleVersionAsync(n,e)}saveDocumentAsync(n,e){return this.inner.saveDocumentAsync(n,e)}deleteDocumentAsync(n){return this.inner.deleteDocumentAsync(n)}clearNamespaceAsync(n,e){return this.inner.clearNamespaceAsync(n,e)}getAllDocumentReferencesAsync(){return this.inner.getAllDocumentReferencesAsync()}getDocumentContentAsync(n){return this.inner.getDocumentContentAsync(n)}getDocumentUriAsync(n){return this.inner.getDocumentUriAsync(n)}};export{h as a,l as b};
|