@shaclmate/compiler 4.0.2 → 4.0.3
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/ShapesGraphToAstTransformer.d.ts +4 -1
- package/dist/ShapesGraphToAstTransformer.js +5 -1
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +3 -2
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +66 -3
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +3 -4
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +1 -1
- package/dist/ast/AbstractObjectCompoundType.d.ts +1 -1
- package/dist/ast/AbstractObjectCompoundType.js +1 -1
- package/dist/ast/ObjectType.d.ts +4 -1
- package/dist/generators/ts/AbstractDeclaredType.d.ts +1 -1
- package/dist/generators/ts/ListType.d.ts +1 -1
- package/dist/generators/ts/ObjectType.d.ts +2 -1
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +1 -1
- package/dist/input/NodeShape.d.ts +4 -2
- package/dist/input/NodeShape.js +5 -6
- package/dist/input/Ontology.d.ts +3 -2
- package/dist/input/Ontology.js +5 -6
- package/dist/input/PropertyShape.d.ts +1 -1
- package/package.json +3 -3
- package/dist/enums/index.d.ts +0 -5
- package/dist/enums/index.js +0 -5
- package/dist/input/tsFeatures.d.ts +0 -11
- package/dist/input/tsFeatures.js +0 -67
|
@@ -5,6 +5,7 @@ import { Either } from "purify-ts";
|
|
|
5
5
|
import { CurieFactory } from "./_ShapesGraphToAstTransformer/CurieFactory.js";
|
|
6
6
|
import * as _ShapesGraphToAstTransformer from "./_ShapesGraphToAstTransformer/index.js";
|
|
7
7
|
import type * as ast from "./ast/index.js";
|
|
8
|
+
import type { TsFeature } from "./enums/TsFeature.js";
|
|
8
9
|
import type * as input from "./input/index.js";
|
|
9
10
|
export declare class ShapesGraphToAstTransformer {
|
|
10
11
|
protected readonly curieFactory: CurieFactory;
|
|
@@ -14,9 +15,11 @@ export declare class ShapesGraphToAstTransformer {
|
|
|
14
15
|
protected transformNodeShapeToAstType: typeof _ShapesGraphToAstTransformer.transformNodeShapeToAstType;
|
|
15
16
|
protected transformPropertyShapeToAstObjectTypeProperty: typeof _ShapesGraphToAstTransformer.transformPropertyShapeToAstObjectTypeProperty;
|
|
16
17
|
protected transformShapeToAstType: typeof _ShapesGraphToAstTransformer.transformShapeToAstType;
|
|
17
|
-
|
|
18
|
+
protected tsFeaturesDefault: ReadonlySet<TsFeature>;
|
|
19
|
+
constructor({ iriPrefixMap, shapesGraph, tsFeaturesDefault, }: {
|
|
18
20
|
iriPrefixMap: PrefixMap;
|
|
19
21
|
shapesGraph: input.ShapesGraph;
|
|
22
|
+
tsFeaturesDefault?: ReadonlySet<TsFeature>;
|
|
20
23
|
});
|
|
21
24
|
transform(): Either<Error, ast.Ast>;
|
|
22
25
|
}
|
|
@@ -12,9 +12,13 @@ export class ShapesGraphToAstTransformer {
|
|
|
12
12
|
transformNodeShapeToAstType = _ShapesGraphToAstTransformer.transformNodeShapeToAstType;
|
|
13
13
|
transformPropertyShapeToAstObjectTypeProperty = _ShapesGraphToAstTransformer.transformPropertyShapeToAstObjectTypeProperty;
|
|
14
14
|
transformShapeToAstType = _ShapesGraphToAstTransformer.transformShapeToAstType;
|
|
15
|
-
|
|
15
|
+
tsFeaturesDefault;
|
|
16
|
+
constructor({ iriPrefixMap, shapesGraph, tsFeaturesDefault, }) {
|
|
16
17
|
this.curieFactory = new CurieFactory({ prefixMap: iriPrefixMap });
|
|
17
18
|
this.shapesGraph = shapesGraph;
|
|
19
|
+
this.tsFeaturesDefault =
|
|
20
|
+
tsFeaturesDefault ??
|
|
21
|
+
new Set(["create", "equals", "hash", "json", "rdf"]);
|
|
18
22
|
}
|
|
19
23
|
transform() {
|
|
20
24
|
const nodeShapeAstObjectIntersectionTypes = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Either
|
|
1
|
+
import { Either } from "purify-ts";
|
|
2
2
|
import type { TsFeature } from "../enums/TsFeature.js";
|
|
3
3
|
import type * as input from "../input/index.js";
|
|
4
|
-
|
|
4
|
+
import type { ShapesGraphToAstTransformer } from "../ShapesGraphToAstTransformer.js";
|
|
5
|
+
export declare function nodeShapeTsFeatures(this: ShapesGraphToAstTransformer, nodeShape: input.NodeShape): Either<Error, ReadonlySet<TsFeature>>;
|
|
5
6
|
//# sourceMappingURL=nodeShapeTsFeatures.d.ts.map
|
|
@@ -1,8 +1,71 @@
|
|
|
1
1
|
import { Either } from "purify-ts";
|
|
2
|
+
const tsFeaturesAll = [
|
|
3
|
+
"create",
|
|
4
|
+
"equals",
|
|
5
|
+
"graphql",
|
|
6
|
+
"hash",
|
|
7
|
+
"json",
|
|
8
|
+
"rdf",
|
|
9
|
+
"sparql",
|
|
10
|
+
];
|
|
2
11
|
export function nodeShapeTsFeatures(nodeShape) {
|
|
3
|
-
|
|
4
|
-
|
|
12
|
+
const tsFeaturesDefault = this.tsFeaturesDefault;
|
|
13
|
+
function iriToTsFeatures(iri) {
|
|
14
|
+
switch (iri.value) {
|
|
15
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
16
|
+
return tsFeaturesAll;
|
|
17
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
|
|
18
|
+
return ["create"];
|
|
19
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
|
|
20
|
+
return [...tsFeaturesDefault];
|
|
21
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
|
|
22
|
+
return ["equals"];
|
|
23
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
|
|
24
|
+
return ["graphql"];
|
|
25
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
|
|
26
|
+
return ["json"];
|
|
27
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
|
|
28
|
+
return ["rdf"];
|
|
29
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
|
|
30
|
+
return ["hash"];
|
|
31
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
|
|
32
|
+
return [];
|
|
33
|
+
case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
|
|
34
|
+
return ["sparql"];
|
|
35
|
+
}
|
|
5
36
|
}
|
|
6
|
-
return nodeShape.isDefinedBy.
|
|
37
|
+
return nodeShape.isDefinedBy.chain((ontologyMaybe) => {
|
|
38
|
+
let tsFeatureExcludes = nodeShape.tsFeatureExcludes.flatMap(iriToTsFeatures);
|
|
39
|
+
let tsFeatureIncludes = nodeShape.tsFeatureIncludes.flatMap(iriToTsFeatures);
|
|
40
|
+
if (tsFeatureExcludes.length === 0 && tsFeatureIncludes.length === 0) {
|
|
41
|
+
ontologyMaybe.ifJust((ontology) => {
|
|
42
|
+
tsFeatureExcludes = ontology.tsFeatureExcludes.flatMap(iriToTsFeatures);
|
|
43
|
+
tsFeatureIncludes = ontology.tsFeatureIncludes.flatMap(iriToTsFeatures);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const tsFeatures = new Set();
|
|
47
|
+
if (tsFeatureIncludes.length > 0) {
|
|
48
|
+
for (const tsFeatureInclude of tsFeatureIncludes) {
|
|
49
|
+
tsFeatures.add(tsFeatureInclude);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
for (const tsFeature of this.tsFeaturesDefault) {
|
|
54
|
+
tsFeatures.add(tsFeature);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const tsFeatureExclude of tsFeatureExcludes) {
|
|
58
|
+
tsFeatures.delete(tsFeatureExclude);
|
|
59
|
+
}
|
|
60
|
+
if (tsFeatures.size === 0) {
|
|
61
|
+
for (const tsFeature of tsFeaturesDefault) {
|
|
62
|
+
tsFeatures.add(tsFeature);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (tsFeatures.has("graphql")) {
|
|
66
|
+
tsFeatures.add("rdf");
|
|
67
|
+
}
|
|
68
|
+
return Either.of(tsFeatures);
|
|
69
|
+
});
|
|
7
70
|
}
|
|
8
71
|
//# sourceMappingURL=nodeShapeTsFeatures.js.map
|
|
@@ -4,7 +4,6 @@ import { Either, Left, Maybe } from "purify-ts";
|
|
|
4
4
|
import { invariant } from "ts-invariant";
|
|
5
5
|
import * as ast from "../ast/index.js";
|
|
6
6
|
import { Eithers } from "../Eithers.js";
|
|
7
|
-
import { tsFeaturesDefault } from "../input/tsFeatures.js";
|
|
8
7
|
import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
|
|
9
8
|
import { nodeShapeTsFeatures } from "./nodeShapeTsFeatures.js";
|
|
10
9
|
import { shapeNodeKinds } from "./shapeNodeKinds.js";
|
|
@@ -157,7 +156,7 @@ function transformNodeShapeToAstListType(nodeShape) {
|
|
|
157
156
|
});
|
|
158
157
|
}
|
|
159
158
|
export function transformNodeShapeToAstObjectCompoundType({ export_, nodeShape, }) {
|
|
160
|
-
return Eithers.chain3(nodeShape.constraints.and, nodeShapeTsFeatures(nodeShape), nodeShape.constraints.xone).chain(([andShapes, tsFeatures, xoneShapes]) => {
|
|
159
|
+
return Eithers.chain3(nodeShape.constraints.and, nodeShapeTsFeatures.bind(this)(nodeShape), nodeShape.constraints.xone).chain(([andShapes, tsFeatures, xoneShapes]) => {
|
|
161
160
|
let compoundTypeShapes;
|
|
162
161
|
let compoundTypeKind;
|
|
163
162
|
if (andShapes.length > 0) {
|
|
@@ -210,7 +209,7 @@ export function transformNodeShapeToAstType(nodeShape) {
|
|
|
210
209
|
if (nodeShape.isList) {
|
|
211
210
|
return transformNodeShapeToAstListType.bind(this)(nodeShape);
|
|
212
211
|
}
|
|
213
|
-
return Eithers.chain11(nodeShape.ancestorNodeShapes, nodeShape.childNodeShapes, nodeShape.descendantNodeShapes, nodeShape.parentNodeShapes, nodeShape.constraints.and, nodeShapeIdentifierMintingStrategy(nodeShape), shapeNodeKinds(nodeShape, { defaultNodeShapeNodeKinds }), nodeShape.constraints.properties, nodeShapeTsFeatures(nodeShape), nodeShape.tsObjectDeclarationType.isJust()
|
|
212
|
+
return Eithers.chain11(nodeShape.ancestorNodeShapes, nodeShape.childNodeShapes, nodeShape.descendantNodeShapes, nodeShape.parentNodeShapes, nodeShape.constraints.and, nodeShapeIdentifierMintingStrategy(nodeShape), shapeNodeKinds(nodeShape, { defaultNodeShapeNodeKinds }), nodeShape.constraints.properties, nodeShapeTsFeatures.bind(this)(nodeShape), nodeShape.tsObjectDeclarationType.isJust()
|
|
214
213
|
? Either.of(nodeShape.tsObjectDeclarationType)
|
|
215
214
|
: nodeShape.isDefinedBy.map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType)), nodeShape.constraints.xone).chain(([ancestorNodeShapes, childNodeShapes, descendantNodeShapes, parentNodeShapes, andShapes, identifierMintingStrategy, nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType, xoneShapes,]) => {
|
|
216
215
|
const abstract = nodeShape.abstract.orDefault(false);
|
|
@@ -293,7 +292,7 @@ export function transformNodeShapeToAstType(nodeShape) {
|
|
|
293
292
|
shapeIdentifier: this.shapeIdentifier(nodeShape),
|
|
294
293
|
synthetic: false,
|
|
295
294
|
toRdfTypes,
|
|
296
|
-
tsFeatures
|
|
295
|
+
tsFeatures,
|
|
297
296
|
tsImports: nodeShape.tsImports,
|
|
298
297
|
tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
|
|
299
298
|
});
|
|
@@ -104,7 +104,7 @@ export function transformShapeToAstCompoundType(shape, shapeStack) {
|
|
|
104
104
|
export_: true,
|
|
105
105
|
name: shape.shaclmateName,
|
|
106
106
|
shapeIdentifier: this.shapeIdentifier(shape),
|
|
107
|
-
tsFeatures:
|
|
107
|
+
tsFeatures: this.tsFeaturesDefault,
|
|
108
108
|
});
|
|
109
109
|
for (const memberType of memberTypes) {
|
|
110
110
|
const addMemberTypeResult = compoundType.addMemberType(memberType);
|
|
@@ -33,7 +33,7 @@ export declare abstract class AbstractObjectCompoundType<ObjectCompoundTypeT ext
|
|
|
33
33
|
export_: boolean;
|
|
34
34
|
name: Maybe<string>;
|
|
35
35
|
shapeIdentifier: BlankNode | NamedNode;
|
|
36
|
-
tsFeatures:
|
|
36
|
+
tsFeatures: ReadonlySet<TsFeature>;
|
|
37
37
|
} & ConstructorParameters<typeof AbstractCompoundType<ObjectCompoundTypeT | ObjectType>>[0]);
|
|
38
38
|
equals(other: AbstractObjectCompoundType<ObjectCompoundTypeT>): boolean;
|
|
39
39
|
get identifierType(): BlankNodeType | IdentifierType | IriType;
|
package/dist/ast/ObjectType.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import type { Maybe } from "purify-ts";
|
|
3
3
|
import { PropertyPath } from "rdfjs-resource";
|
|
4
|
-
import type { IdentifierMintingStrategy
|
|
4
|
+
import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
5
|
+
import type { PropertyVisibility } from "../enums/PropertyVisibility.js";
|
|
6
|
+
import type { TsFeature } from "../enums/TsFeature.js";
|
|
7
|
+
import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
5
8
|
import { AbstractType } from "./AbstractType.js";
|
|
6
9
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
7
10
|
import type { Curie } from "./Curie.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TsFeature } from "../../enums/
|
|
1
|
+
import type { TsFeature } from "../../enums/TsFeature.js";
|
|
2
2
|
import { AbstractType } from "./AbstractType.js";
|
|
3
3
|
import type { Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare abstract class AbstractDeclaredType extends AbstractType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import type { Maybe } from "purify-ts";
|
|
3
|
-
import type { IdentifierMintingStrategy } from "../../enums/
|
|
3
|
+
import type { IdentifierMintingStrategy } from "../../enums/IdentifierMintingStrategy.js";
|
|
4
4
|
import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
5
5
|
import type { BigDecimalType } from "./BigDecimalType.js";
|
|
6
6
|
import type { BigIntType } from "./BigIntType.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { Maybe, NonEmptyList } from "purify-ts";
|
|
3
|
-
import type { IdentifierMintingStrategy
|
|
3
|
+
import type { IdentifierMintingStrategy } from "../../enums/IdentifierMintingStrategy.js";
|
|
4
|
+
import type { TsObjectDeclarationType } from "../../enums/TsObjectDeclarationType.js";
|
|
4
5
|
import { IdentifierPrefixProperty as _IdentifierPrefixProperty } from "./_ObjectType/IdentifierPrefixProperty.js";
|
|
5
6
|
import { IdentifierProperty as _IdentifierProperty } from "./_ObjectType/IdentifierProperty.js";
|
|
6
7
|
import type { Property as _Property } from "./_ObjectType/Property.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Maybe } from "purify-ts";
|
|
2
|
-
import type { PropertyVisibility } from "../../../enums/
|
|
2
|
+
import type { PropertyVisibility } from "../../../enums/PropertyVisibility.js";
|
|
3
3
|
import type { ObjectType } from "../ObjectType.js";
|
|
4
4
|
import type { Type } from "../Type.js";
|
|
5
5
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { IdentifierMintingStrategy } from "../../../enums/
|
|
2
|
+
import type { IdentifierMintingStrategy } from "../../../enums/IdentifierMintingStrategy.js";
|
|
3
3
|
import type { BlankNodeType } from "../BlankNodeType.js";
|
|
4
4
|
import type { IdentifierType } from "../IdentifierType.js";
|
|
5
5
|
import type { IriType } from "../IriType.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { NodeShape as ShaclCoreNodeShape } from "@shaclmate/shacl-ast";
|
|
3
3
|
import { Either, type Maybe } from "purify-ts";
|
|
4
|
-
import type { IdentifierMintingStrategy
|
|
4
|
+
import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
5
|
+
import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
5
6
|
import type * as generated from "./generated.js";
|
|
6
7
|
import type { Ontology, PropertyGroup, PropertyShape, ShapesGraph } from "./index.js";
|
|
7
8
|
import type { Shape } from "./Shape.js";
|
|
@@ -41,7 +42,8 @@ export declare class NodeShape extends ShaclCoreNodeShape<any, Ontology, Propert
|
|
|
41
42
|
get rdfType(): Maybe<NamedNode>;
|
|
42
43
|
get shaclmateName(): Maybe<string>;
|
|
43
44
|
get toRdfTypes(): readonly NamedNode[];
|
|
44
|
-
get
|
|
45
|
+
get tsFeatureExcludes(): readonly NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">[];
|
|
46
|
+
get tsFeatureIncludes(): readonly NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">[];
|
|
45
47
|
get tsImports(): readonly string[];
|
|
46
48
|
get tsObjectDeclarationType(): Maybe<TsObjectDeclarationType>;
|
|
47
49
|
}
|
package/dist/input/NodeShape.js
CHANGED
|
@@ -9,7 +9,6 @@ import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
|
9
9
|
import { Either, List } from "purify-ts";
|
|
10
10
|
import { invariant } from "ts-invariant";
|
|
11
11
|
import { Memoize } from "typescript-memoize";
|
|
12
|
-
import { tsFeatures } from "./tsFeatures.js";
|
|
13
12
|
export class NodeShape extends ShaclCoreNodeShape {
|
|
14
13
|
ancestorClassIris;
|
|
15
14
|
childClassIris;
|
|
@@ -103,8 +102,11 @@ export class NodeShape extends ShaclCoreNodeShape {
|
|
|
103
102
|
get toRdfTypes() {
|
|
104
103
|
return this.generatedShaclmateNodeShape.toRdfTypes;
|
|
105
104
|
}
|
|
106
|
-
get
|
|
107
|
-
return
|
|
105
|
+
get tsFeatureExcludes() {
|
|
106
|
+
return this.generatedShaclmateNodeShape.tsFeatureExcludes;
|
|
107
|
+
}
|
|
108
|
+
get tsFeatureIncludes() {
|
|
109
|
+
return this.generatedShaclmateNodeShape.tsFeatureIncludes;
|
|
108
110
|
}
|
|
109
111
|
get tsImports() {
|
|
110
112
|
return this.generatedShaclmateNodeShape.tsImports;
|
|
@@ -149,9 +151,6 @@ __decorate([
|
|
|
149
151
|
__decorate([
|
|
150
152
|
Memoize()
|
|
151
153
|
], NodeShape.prototype, "rdfType", null);
|
|
152
|
-
__decorate([
|
|
153
|
-
Memoize()
|
|
154
|
-
], NodeShape.prototype, "tsFeatures", null);
|
|
155
154
|
__decorate([
|
|
156
155
|
Memoize()
|
|
157
156
|
], NodeShape.prototype, "tsObjectDeclarationType", null);
|
package/dist/input/Ontology.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Ontology as OwlOntology } from "@shaclmate/shacl-ast";
|
|
2
2
|
import type { Maybe } from "purify-ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
|
|
4
4
|
import type * as generated from "./generated.js";
|
|
5
5
|
export declare class Ontology extends OwlOntology {
|
|
6
6
|
private readonly generatedShaclmateOntology;
|
|
7
7
|
constructor(generatedShaclmateOntology: generated.ShaclmateOntology);
|
|
8
|
-
get
|
|
8
|
+
get tsFeatureExcludes(): readonly import("@rdfjs/types").NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">[];
|
|
9
|
+
get tsFeatureIncludes(): readonly import("@rdfjs/types").NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">[];
|
|
9
10
|
get tsImports(): readonly string[];
|
|
10
11
|
get tsObjectDeclarationType(): Maybe<TsObjectDeclarationType>;
|
|
11
12
|
}
|
package/dist/input/Ontology.js
CHANGED
|
@@ -6,15 +6,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Ontology as OwlOntology } from "@shaclmate/shacl-ast";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
|
-
import { tsFeatures } from "./tsFeatures.js";
|
|
10
9
|
export class Ontology extends OwlOntology {
|
|
11
10
|
generatedShaclmateOntology;
|
|
12
11
|
constructor(generatedShaclmateOntology) {
|
|
13
12
|
super(generatedShaclmateOntology);
|
|
14
13
|
this.generatedShaclmateOntology = generatedShaclmateOntology;
|
|
15
14
|
}
|
|
16
|
-
get
|
|
17
|
-
return
|
|
15
|
+
get tsFeatureExcludes() {
|
|
16
|
+
return this.generatedShaclmateOntology.tsFeatureExcludes;
|
|
17
|
+
}
|
|
18
|
+
get tsFeatureIncludes() {
|
|
19
|
+
return this.generatedShaclmateOntology.tsFeatureIncludes;
|
|
18
20
|
}
|
|
19
21
|
get tsImports() {
|
|
20
22
|
return this.generatedShaclmateOntology.tsImports;
|
|
@@ -32,9 +34,6 @@ export class Ontology extends OwlOntology {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
__decorate([
|
|
36
|
-
Memoize()
|
|
37
|
-
], Ontology.prototype, "tsFeatures", null);
|
|
38
37
|
__decorate([
|
|
39
38
|
Memoize()
|
|
40
39
|
], Ontology.prototype, "tsObjectDeclarationType", null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropertyShape as ShaclCorePropertyShape } from "@shaclmate/shacl-ast";
|
|
2
2
|
import { Either, Maybe } from "purify-ts";
|
|
3
|
-
import type { PropertyVisibility } from "../enums/
|
|
3
|
+
import type { PropertyVisibility } from "../enums/PropertyVisibility.js";
|
|
4
4
|
import type * as generated from "./generated.js";
|
|
5
5
|
import type { NodeShape, Ontology, PropertyGroup, ShapesGraph } from "./index.js";
|
|
6
6
|
import type { Shape } from "./Shape.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "4.0.
|
|
3
|
+
"@shaclmate/shacl-ast": "4.0.3",
|
|
4
4
|
"@rdfjs/data-model": "~2.1.1",
|
|
5
5
|
"@rdfjs/dataset": "~2.0.2",
|
|
6
6
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"license": "Apache-2.0",
|
|
64
64
|
"main": "./dist/index.js",
|
|
65
65
|
"name": "@shaclmate/compiler",
|
|
66
|
-
"packageManager": "npm@
|
|
66
|
+
"packageManager": "npm@11.11.0",
|
|
67
67
|
"repository": {
|
|
68
68
|
"type": "git",
|
|
69
69
|
"url": "git+https://github.com/minorg/shaclmate.git"
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
},
|
|
80
80
|
"type": "module",
|
|
81
81
|
"types": "./dist/index.d.ts",
|
|
82
|
-
"version": "4.0.
|
|
82
|
+
"version": "4.0.3"
|
|
83
83
|
}
|
package/dist/enums/index.d.ts
DELETED
package/dist/enums/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type * as rdfjs from "@rdfjs/types";
|
|
2
|
-
import { Maybe } from "purify-ts";
|
|
3
|
-
import type { TsFeature } from "../enums/index.js";
|
|
4
|
-
type TsFeatureIri = rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#_TsFeatures_All" | "http://purl.org/shaclmate/ontology#_TsFeature_Create" | "http://purl.org/shaclmate/ontology#_TsFeatures_Default" | "http://purl.org/shaclmate/ontology#_TsFeature_Equals" | "http://purl.org/shaclmate/ontology#_TsFeature_Graphql" | "http://purl.org/shaclmate/ontology#_TsFeature_Json" | "http://purl.org/shaclmate/ontology#_TsFeature_Hash" | "http://purl.org/shaclmate/ontology#_TsFeatures_None" | "http://purl.org/shaclmate/ontology#_TsFeature_Rdf" | "http://purl.org/shaclmate/ontology#_TsFeature_Sparql">;
|
|
5
|
-
export declare function tsFeatures(generated: {
|
|
6
|
-
readonly tsFeatureExcludes: readonly TsFeatureIri[];
|
|
7
|
-
readonly tsFeatureIncludes: readonly TsFeatureIri[];
|
|
8
|
-
}): Maybe<ReadonlySet<TsFeature>>;
|
|
9
|
-
export declare const tsFeaturesDefault: readonly TsFeature[];
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=tsFeatures.d.ts.map
|
package/dist/input/tsFeatures.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
function iriToTsFeatures(iri) {
|
|
3
|
-
switch (iri.value) {
|
|
4
|
-
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
5
|
-
return tsFeaturesAll;
|
|
6
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
|
|
7
|
-
return ["create"];
|
|
8
|
-
case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
|
|
9
|
-
return tsFeaturesDefault;
|
|
10
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
|
|
11
|
-
return ["equals"];
|
|
12
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Graphql":
|
|
13
|
-
return ["graphql"];
|
|
14
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Json":
|
|
15
|
-
return ["json"];
|
|
16
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
|
|
17
|
-
return ["rdf"];
|
|
18
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
|
|
19
|
-
return ["hash"];
|
|
20
|
-
case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
|
|
21
|
-
return [];
|
|
22
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
|
|
23
|
-
return ["sparql"];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function tsFeatures(generated) {
|
|
27
|
-
const tsFeatureIncludes = generated.tsFeatureIncludes.flatMap(iriToTsFeatures);
|
|
28
|
-
const tsFeatureExcludes = generated.tsFeatureExcludes.flatMap(iriToTsFeatures);
|
|
29
|
-
if (tsFeatureExcludes.length === 0 && tsFeatureIncludes.length === 0) {
|
|
30
|
-
return Maybe.empty();
|
|
31
|
-
}
|
|
32
|
-
const tsFeatures = new Set();
|
|
33
|
-
if (tsFeatureIncludes.length > 0) {
|
|
34
|
-
for (const tsFeatureInclude of tsFeatureIncludes) {
|
|
35
|
-
tsFeatures.add(tsFeatureInclude);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
for (const tsFeature of tsFeaturesDefault) {
|
|
40
|
-
tsFeatures.add(tsFeature);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
for (const tsFeatureExclude of tsFeatureExcludes) {
|
|
44
|
-
tsFeatures.delete(tsFeatureExclude);
|
|
45
|
-
}
|
|
46
|
-
if (tsFeatures.has("graphql")) {
|
|
47
|
-
tsFeatures.add("rdf");
|
|
48
|
-
}
|
|
49
|
-
return Maybe.of(tsFeatures);
|
|
50
|
-
}
|
|
51
|
-
const tsFeaturesAll = [
|
|
52
|
-
"create",
|
|
53
|
-
"equals",
|
|
54
|
-
"graphql",
|
|
55
|
-
"hash",
|
|
56
|
-
"json",
|
|
57
|
-
"rdf",
|
|
58
|
-
"sparql",
|
|
59
|
-
];
|
|
60
|
-
export const tsFeaturesDefault = [
|
|
61
|
-
"create",
|
|
62
|
-
"equals",
|
|
63
|
-
"hash",
|
|
64
|
-
"json",
|
|
65
|
-
"rdf",
|
|
66
|
-
];
|
|
67
|
-
//# sourceMappingURL=tsFeatures.js.map
|