@shaclmate/compiler 4.0.13 → 4.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/ShapesGraphToAstTransformer.js +2 -2
  2. package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +6 -5
  3. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +3 -2
  4. package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +8 -5
  5. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +2 -1
  6. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -6
  7. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.d.ts +2 -1
  8. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +23 -17
  9. package/dist/_ShapesGraphToAstTransformer/shapeOntology.d.ts +5 -0
  10. package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +25 -0
  11. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +23 -16
  12. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +6 -6
  13. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +15 -15
  14. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +122 -118
  15. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +10 -8
  16. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
  17. package/dist/ast/ObjectType.d.ts +3 -3
  18. package/dist/enums/IdentifierMintingStrategy.d.ts +4 -0
  19. package/dist/enums/IdentifierMintingStrategy.js +17 -1
  20. package/dist/enums/TsObjectDeclarationType.d.ts +4 -0
  21. package/dist/enums/TsObjectDeclarationType.js +15 -1
  22. package/dist/enums/Visibility.d.ts +6 -0
  23. package/dist/enums/Visibility.js +18 -0
  24. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +3 -3
  25. package/dist/input/NodeShape.d.ts +8 -46
  26. package/dist/input/NodeShape.js +1 -153
  27. package/dist/input/Shape.d.ts +2 -2
  28. package/dist/input/ShapesGraph.d.ts +10 -10
  29. package/dist/input/ShapesGraph.js +11 -13
  30. package/dist/input/generated.d.ts +185 -152
  31. package/dist/input/generated.js +316 -249
  32. package/dist/input/index.d.ts +1 -3
  33. package/dist/input/index.js +1 -3
  34. package/package.json +2 -2
  35. package/dist/enums/PropertyVisibility.d.ts +0 -2
  36. package/dist/enums/PropertyVisibility.js +0 -2
  37. package/dist/input/Ontology.d.ts +0 -13
  38. package/dist/input/Ontology.js +0 -40
  39. package/dist/input/PropertyShape.d.ts +0 -20
  40. package/dist/input/PropertyShape.js +0 -78
@@ -2,12 +2,14 @@ import { Either, Left, Maybe } from "purify-ts";
2
2
  import { invariant } from "ts-invariant";
3
3
  import * as ast from "../ast/index.js";
4
4
  import { Eithers } from "../Eithers.js";
5
+ import { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
5
6
  import { defaultNodeShapeNodeKinds } from "./defaultNodeShapeNodeKinds.js";
6
7
  import { nodeShapeIdentifierMintingStrategy } from "./nodeShapeIdentifierMintingStrategy.js";
7
8
  import { nodeShapeTsFeatures } from "./nodeShapeTsFeatures.js";
8
9
  import { ShapeStack } from "./ShapeStack.js";
9
10
  import { shapeAstTypeName } from "./shapeAstTypeName.js";
10
11
  import { shapeNodeKinds } from "./shapeNodeKinds.js";
12
+ import { shapeOntology } from "./shapeOntology.js";
11
13
  import { transformPropertyShapeToAstObjectTypeProperty } from "./transformPropertyShapeToAstObjectTypeProperty.js";
12
14
  import { transformShapeToAstType } from "./transformShapeToAstType.js";
13
15
  function isObjectTypePropertyRequired(property) {
@@ -43,135 +45,137 @@ function isObjectTypePropertyRequired(property) {
43
45
  export function transformShapeToAstObjectType(shape, shapeStack) {
44
46
  shapeStack.push(shape);
45
47
  try {
46
- if (shape.kind !== "NodeShape") {
48
+ if (shape.$type !== "NodeShape") {
47
49
  return Either.of(Maybe.empty());
48
50
  }
49
51
  const nodeShape = shape;
50
- if (nodeShape.identifier.termType !== "NamedNode") {
52
+ if (nodeShape.and.length > 0 || nodeShape.xone.length > 0) {
51
53
  return Either.of(Maybe.empty());
52
54
  }
53
- return Eithers.chain2(nodeShape.constraints.and, nodeShape.constraints.xone).chain(([andShapes, xoneShapes]) => {
54
- if (andShapes.length > 0 || xoneShapes.length > 0) {
55
- return Either.of(Maybe.empty());
56
- }
57
- return Eithers.chain9(nodeShape.ancestorNodeShapes, nodeShape.childNodeShapes, nodeShape.descendantNodeShapes, nodeShape.parentNodeShapes, nodeShapeIdentifierMintingStrategy(nodeShape), shapeNodeKinds(nodeShape, { defaultNodeShapeNodeKinds }), nodeShape.constraints.properties, nodeShapeTsFeatures.call(this, nodeShape), nodeShape.tsObjectDeclarationType.isJust()
58
- ? Either.of(nodeShape.tsObjectDeclarationType)
59
- : nodeShape.isDefinedBy.map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType))).chain(([ancestorNodeShapes, childNodeShapes, descendantNodeShapes, parentNodeShapes, identifierMintingStrategy, nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType,]) => {
60
- const abstract = nodeShape.abstract.orDefault(false);
61
- let fromRdfType;
62
- let toRdfTypes;
63
- if (!abstract) {
64
- fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
65
- if (nodeShape.isClass &&
66
- nodeShape.identifier.termType === "NamedNode") {
67
- fromRdfType = fromRdfType.alt(Maybe.of(nodeShape.identifier));
68
- }
69
- toRdfTypes = nodeShape.toRdfTypes.concat();
70
- if (toRdfTypes.length === 0) {
71
- toRdfTypes.push(...nodeShape.rdfType.toList());
72
- }
73
- // Ensure toRdfTypes has fromRdfType
74
- fromRdfType.ifJust((fromRdfType) => {
75
- if (!toRdfTypes.some((toRdfType) => toRdfType.equals(fromRdfType))) {
76
- toRdfTypes.push(fromRdfType);
77
- }
78
- });
79
- }
80
- else {
81
- fromRdfType = Maybe.empty();
82
- toRdfTypes = [];
83
- }
84
- if (nodeKinds.has("Literal")) {
85
- return Left(new Error(`${nodeShape} should not have a nodeKind "Literal"`));
55
+ if (nodeShape.$identifier.termType !== "NamedNode") {
56
+ return Either.of(Maybe.empty());
57
+ }
58
+ return Eithers.chain9(Either.sequence(nodeShape.ancestorClassIris.map((nodeShapeIdentifier) => this.shapesGraph.nodeShape(nodeShapeIdentifier))), Either.sequence(nodeShape.childClassIris.map((nodeShapeIdentifier) => this.shapesGraph.nodeShape(nodeShapeIdentifier))), Either.sequence(nodeShape.descendantClassIris.map((nodeShapeIdentifier) => this.shapesGraph.nodeShape(nodeShapeIdentifier))), Either.sequence(nodeShape.parentClassIris.map((nodeShapeIdentifier) => this.shapesGraph.nodeShape(nodeShapeIdentifier))), nodeShapeIdentifierMintingStrategy.call(this, nodeShape), shapeNodeKinds.call(this, nodeShape, { defaultNodeShapeNodeKinds }), Either.sequence(nodeShape.properties.map((propertyShapeIdentifier) => this.shapesGraph.propertyShape(propertyShapeIdentifier))), nodeShapeTsFeatures.call(this, nodeShape), nodeShape.tsObjectDeclarationType.isJust()
59
+ ? Either.of(nodeShape.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri))
60
+ : shapeOntology
61
+ .call(this, nodeShape)
62
+ .map((ontology) => ontology.chain((ontology) => ontology.tsObjectDeclarationType.map(TsObjectDeclarationType.fromIri)))).chain(([ancestorNodeShapes, childNodeShapes, descendantNodeShapes, parentNodeShapes, identifierMintingStrategy, nodeKinds, propertyShapes, tsFeatures, tsObjectDeclarationType,]) => {
63
+ const abstract = nodeShape.abstract.orDefault(false);
64
+ let fromRdfType;
65
+ let toRdfTypes;
66
+ if (!abstract) {
67
+ fromRdfType = nodeShape.fromRdfType.alt(nodeShape.rdfType);
68
+ if (nodeShape.isClass &&
69
+ nodeShape.$identifier.termType === "NamedNode") {
70
+ fromRdfType = fromRdfType.alt(Maybe.of(nodeShape.$identifier));
86
71
  }
87
- let identifierType;
88
- const identifierTypeProperties = {
89
- comment: Maybe.empty(),
90
- label: Maybe.empty(),
91
- name: Maybe.empty(),
92
- shapeIdentifier: nodeShape.identifier,
93
- };
94
- if (nodeKinds.size === 2) {
95
- invariant(nodeShape.identifierIn.length === 0);
96
- identifierType = new ast.IdentifierType(identifierTypeProperties);
72
+ toRdfTypes = nodeShape.toRdfTypes.concat();
73
+ if (toRdfTypes.length === 0) {
74
+ toRdfTypes.push(...nodeShape.rdfType.toList());
97
75
  }
98
- else {
99
- switch ([...nodeKinds][0]) {
100
- case "BlankNode":
101
- invariant(nodeShape.identifierIn.length === 0);
102
- identifierType = new ast.BlankNodeType(identifierTypeProperties);
103
- break;
104
- case "IRI":
105
- identifierType = new ast.IriType({
106
- ...identifierTypeProperties,
107
- hasValues: [],
108
- in_: nodeShape.identifierIn,
109
- });
110
- break;
111
- case "Literal":
112
- throw new Error("should never happen");
76
+ // Ensure toRdfTypes has fromRdfType
77
+ fromRdfType.ifJust((fromRdfType) => {
78
+ if (!toRdfTypes.some((toRdfType) => toRdfType.equals(fromRdfType))) {
79
+ toRdfTypes.push(fromRdfType);
113
80
  }
114
- }
115
- invariant(identifierType);
116
- // Put a placeholder in the cache to deal with cyclic references
117
- // Remove the placeholder if the transformation fails.
118
- // If this node shape's properties (directly or indirectly) refer to the node shape itself,
119
- // we'll return this placeholder.
120
- const objectType = new ast.ObjectType({
121
- abstract,
122
- comment: nodeShape.comment,
123
- extern: nodeShape.extern.orDefault(false),
124
- fromRdfType,
125
- label: nodeShape.label,
126
- identifierType,
127
- identifierMintingStrategy,
128
- name: shapeAstTypeName(nodeShape),
129
- shapeIdentifier: nodeShape.identifier,
130
- synthetic: false,
131
- toRdfTypes,
132
- tsFeatures,
133
- tsImports: nodeShape.tsImports,
134
- tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
135
81
  });
136
- this.cachedAstTypesByShapeIdentifier.set(nodeShape.identifier, objectType);
137
- return (() => {
138
- // Populate ancestor and descendant object types
139
- const relatedObjectTypes = (relatedNodeShapes) => {
140
- return relatedNodeShapes
141
- .flatMap((relatedNodeShape) => transformShapeToAstType
142
- .call(this, relatedNodeShape, new ShapeStack())
143
- .toMaybe()
144
- .toList())
145
- .filter((astType) => astType.kind === "ObjectType");
146
- };
147
- objectType.addAncestorObjectTypes(...relatedObjectTypes(ancestorNodeShapes));
148
- objectType.addChildObjectTypes(...relatedObjectTypes(childNodeShapes));
149
- objectType.addDescendantObjectTypes(...relatedObjectTypes(descendantNodeShapes));
150
- objectType.addParentObjectTypes(...relatedObjectTypes(parentNodeShapes));
151
- // Populate properties
152
- for (const propertyShape of propertyShapes) {
153
- const propertyEither = transformPropertyShapeToAstObjectTypeProperty.call(this, {
154
- objectType,
155
- propertyShape,
156
- });
157
- if (propertyEither.isLeft()) {
158
- return propertyEither;
159
- }
160
- propertyEither.ifRight((property) => {
161
- objectType.addProperties(property);
82
+ }
83
+ else {
84
+ fromRdfType = Maybe.empty();
85
+ toRdfTypes = [];
86
+ }
87
+ if (nodeKinds.has("Literal")) {
88
+ return Left(new Error(`${nodeShape} should not have a nodeKind "Literal"`));
89
+ }
90
+ let identifierType;
91
+ const identifierTypeProperties = {
92
+ comment: Maybe.empty(),
93
+ label: Maybe.empty(),
94
+ name: Maybe.empty(),
95
+ shapeIdentifier: nodeShape.$identifier,
96
+ };
97
+ if (nodeKinds.size === 2) {
98
+ invariant(nodeShape.in_.isNothing());
99
+ identifierType = new ast.IdentifierType(identifierTypeProperties);
100
+ }
101
+ else {
102
+ switch ([...nodeKinds][0]) {
103
+ case "BlankNode":
104
+ invariant(nodeShape.in_.isNothing());
105
+ identifierType = new ast.BlankNodeType(identifierTypeProperties);
106
+ break;
107
+ case "IRI":
108
+ identifierType = new ast.IriType({
109
+ ...identifierTypeProperties,
110
+ hasValues: [],
111
+ in_: nodeShape.in_
112
+ .orDefault([])
113
+ .filter((_) => _.termType === "NamedNode"),
162
114
  });
115
+ break;
116
+ default:
117
+ throw new Error("should never happen");
118
+ }
119
+ }
120
+ invariant(identifierType);
121
+ // Put a placeholder in the cache to deal with cyclic references
122
+ // Remove the placeholder if the transformation fails.
123
+ // If this node shape's properties (directly or indirectly) refer to the node shape itself,
124
+ // we'll return this placeholder.
125
+ const objectType = new ast.ObjectType({
126
+ abstract,
127
+ comment: nodeShape.comment,
128
+ extern: nodeShape.extern.orDefault(false),
129
+ fromRdfType,
130
+ label: nodeShape.label,
131
+ identifierType,
132
+ identifierMintingStrategy,
133
+ name: shapeAstTypeName(nodeShape),
134
+ shapeIdentifier: nodeShape.$identifier,
135
+ synthetic: false,
136
+ toRdfTypes,
137
+ tsFeatures,
138
+ tsImports: nodeShape.tsImports,
139
+ tsObjectDeclarationType: tsObjectDeclarationType.orDefault("class"),
140
+ });
141
+ this.cachedAstTypesByShapeIdentifier.set(nodeShape.$identifier, objectType);
142
+ return (() => {
143
+ // Populate ancestor and descendant object types
144
+ const relatedObjectTypes = (relatedNodeShapes) => {
145
+ return relatedNodeShapes
146
+ .flatMap((relatedNodeShape) => transformShapeToAstType
147
+ .call(this, relatedNodeShape, new ShapeStack())
148
+ .toMaybe()
149
+ .toList())
150
+ .filter((astType) => astType.kind === "ObjectType");
151
+ };
152
+ objectType.addAncestorObjectTypes(...relatedObjectTypes(ancestorNodeShapes));
153
+ objectType.addChildObjectTypes(...relatedObjectTypes(childNodeShapes));
154
+ objectType.addDescendantObjectTypes(...relatedObjectTypes(descendantNodeShapes));
155
+ objectType.addParentObjectTypes(...relatedObjectTypes(parentNodeShapes));
156
+ // Populate properties
157
+ for (const propertyShape of propertyShapes) {
158
+ const propertyEither = transformPropertyShapeToAstObjectTypeProperty.call(this, {
159
+ objectType,
160
+ propertyShape,
161
+ });
162
+ if (propertyEither.isLeft()) {
163
+ return propertyEither;
163
164
  }
164
- if (!objectType.abstract &&
165
- !objectType.extern &&
166
- objectType.fromRdfType.isNothing() &&
167
- !objectType.properties.some(isObjectTypePropertyRequired)) {
168
- return Left(new Error(`${nodeShape} has no required properties and no implicitly required rdf:type`));
169
- }
170
- objectType.sortProperties();
171
- return Either.of(Maybe.of(objectType));
172
- })().ifLeft(() => {
173
- this.cachedAstTypesByShapeIdentifier.delete(nodeShape.identifier);
174
- });
165
+ propertyEither.ifRight((property) => {
166
+ objectType.addProperties(property);
167
+ });
168
+ }
169
+ if (!objectType.abstract &&
170
+ !objectType.extern &&
171
+ objectType.fromRdfType.isNothing() &&
172
+ !objectType.properties.some(isObjectTypePropertyRequired)) {
173
+ return Left(new Error(`${nodeShape} has no required properties and no implicitly required rdf:type`));
174
+ }
175
+ objectType.sortProperties();
176
+ return Either.of(Maybe.of(objectType));
177
+ })().ifLeft(() => {
178
+ this.cachedAstTypesByShapeIdentifier.delete(nodeShape.$identifier);
175
179
  });
176
180
  });
177
181
  }
@@ -8,14 +8,14 @@ import { shapeNodeKinds } from "./shapeNodeKinds.js";
8
8
  export function transformShapeToAstTermType(shape, shapeStack) {
9
9
  shapeStack.push(shape);
10
10
  try {
11
- return shapeNodeKinds(shape).chain((nodeKinds) => {
11
+ return shapeNodeKinds.call(this, shape).chain((nodeKinds) => {
12
12
  const hasValues = shapeStack.constraints.hasValues;
13
13
  const in_ = shapeStack.constraints.in_;
14
14
  const astAbstractTypeProperties = {
15
15
  comment: Maybe.empty(),
16
16
  name: Maybe.empty(),
17
17
  label: Maybe.empty(),
18
- shapeIdentifier: shape.identifier,
18
+ shapeIdentifier: shape.$identifier,
19
19
  };
20
20
  let termType;
21
21
  if (nodeKinds.size === 1) {
@@ -35,14 +35,16 @@ export function transformShapeToAstTermType(shape, shapeStack) {
35
35
  case "Literal":
36
36
  termType = new ast.LiteralType({
37
37
  ...astAbstractTypeProperties,
38
- datatype: shape.constraints.datatype,
38
+ datatype: shape.datatype,
39
39
  hasValues: hasValues.filter((_) => _.termType === "Literal"),
40
40
  in_: in_.filter((_) => _.termType === "Literal"),
41
- languageIn: [...new Set(shape.constraints.languageIn)],
42
- maxExclusive: shape.constraints.maxExclusive,
43
- maxInclusive: shape.constraints.maxInclusive,
44
- minExclusive: shape.constraints.minExclusive,
45
- minInclusive: shape.constraints.minInclusive,
41
+ languageIn: shape.languageIn
42
+ .map((languageIn) => [...new Set(languageIn)])
43
+ .orDefault([]),
44
+ maxExclusive: shape.maxExclusive,
45
+ maxInclusive: shape.maxInclusive,
46
+ minExclusive: shape.minExclusive,
47
+ minInclusive: shape.minInclusive,
46
48
  });
47
49
  break;
48
50
  }
@@ -13,7 +13,7 @@ const tryTransformShapeToAstTypeMethods = [
13
13
  * not the other transformShapeToAst*Type functions directly.
14
14
  */
15
15
  export function transformShapeToAstType(shape, shapeStack) {
16
- const astType = this.cachedAstTypesByShapeIdentifier.get(shape.identifier);
16
+ const astType = this.cachedAstTypesByShapeIdentifier.get(shape.$identifier);
17
17
  if (astType) {
18
18
  return Either.of(astType);
19
19
  }
@@ -28,14 +28,14 @@ export function transformShapeToAstType(shape, shapeStack) {
28
28
  }
29
29
  const astType = either.unsafeCoerce().extract();
30
30
  if (astType) {
31
- this.cachedAstTypesByShapeIdentifier.set(shape.identifier, astType);
31
+ this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
32
32
  return Either.of(astType);
33
33
  }
34
34
  }
35
35
  return transformShapeToAstTermType
36
36
  .call(this, shape, shapeStack)
37
37
  .ifRight((astType) => {
38
- this.cachedAstTypesByShapeIdentifier.set(shape.identifier, astType);
38
+ this.cachedAstTypesByShapeIdentifier.set(shape.$identifier, astType);
39
39
  });
40
40
  }
41
41
  //# sourceMappingURL=transformShapeToAstType.js.map
@@ -3,9 +3,9 @@ import type { NodeKind } from "@shaclmate/shacl-ast";
3
3
  import type { Maybe } from "purify-ts";
4
4
  import { PropertyPath } from "rdfjs-resource";
5
5
  import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
6
- import type { PropertyVisibility } from "../enums/PropertyVisibility.js";
7
6
  import type { TsFeature } from "../enums/TsFeature.js";
8
7
  import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
8
+ import type { Visibility } from "../enums/Visibility.js";
9
9
  import { AbstractType } from "./AbstractType.js";
10
10
  import type { BlankNodeType } from "./BlankNodeType.js";
11
11
  import type { IdentifierType } from "./IdentifierType.js";
@@ -146,7 +146,7 @@ export declare namespace ObjectType {
146
146
  /**
147
147
  * Visibility: private, protected, public.
148
148
  */
149
- readonly visibility: PropertyVisibility;
149
+ readonly visibility: Visibility;
150
150
  constructor({ comment, description, label, mutable, name, objectType, order, path, shapeIdentifier, type, visibility, }: {
151
151
  comment: Maybe<string>;
152
152
  description: Maybe<string>;
@@ -158,7 +158,7 @@ export declare namespace ObjectType {
158
158
  path: PropertyPath;
159
159
  shapeIdentifier: BlankNode | NamedNode;
160
160
  type: Type;
161
- visibility: PropertyVisibility;
161
+ visibility: Visibility;
162
162
  });
163
163
  equals(other: Property): boolean;
164
164
  /**
@@ -1,5 +1,9 @@
1
+ import type { NamedNode } from "@rdfjs/types";
1
2
  /**
2
3
  * TypeScript enum corresponding to shaclmate:identifierMintingStrategy, for simpler manipulation.
3
4
  */
4
5
  export type IdentifierMintingStrategy = "blankNode" | "sha256" | "uuidv4";
6
+ export declare namespace IdentifierMintingStrategy {
7
+ function fromIri(iri: NamedNode<"http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_BlankNode" | "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_SHA256" | "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_UUIDv4">): IdentifierMintingStrategy;
8
+ }
5
9
  //# sourceMappingURL=IdentifierMintingStrategy.d.ts.map
@@ -1,2 +1,18 @@
1
- export {};
1
+ export var IdentifierMintingStrategy;
2
+ (function (IdentifierMintingStrategy) {
3
+ function fromIri(iri) {
4
+ switch (iri.value) {
5
+ case "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_BlankNode":
6
+ return "blankNode";
7
+ case "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_SHA256":
8
+ return "sha256";
9
+ case "http://purl.org/shaclmate/ontology#_IdentifierMintingStrategy_UUIDv4":
10
+ return "uuidv4";
11
+ default:
12
+ iri.value;
13
+ throw new RangeError(iri.value);
14
+ }
15
+ }
16
+ IdentifierMintingStrategy.fromIri = fromIri;
17
+ })(IdentifierMintingStrategy || (IdentifierMintingStrategy = {}));
2
18
  //# sourceMappingURL=IdentifierMintingStrategy.js.map
@@ -1,5 +1,9 @@
1
+ import type { NamedNode } from "@rdfjs/types";
1
2
  /**
2
3
  * TypeScript enum corresponding to shaclmate:tsObjectDeclarationType, for simpler manipulation.
3
4
  */
4
5
  export type TsObjectDeclarationType = "class" | "interface";
6
+ export declare namespace TsObjectDeclarationType {
7
+ function fromIri(iri: NamedNode<"http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class" | "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface">): TsObjectDeclarationType;
8
+ }
5
9
  //# sourceMappingURL=TsObjectDeclarationType.d.ts.map
@@ -1,2 +1,16 @@
1
- export {};
1
+ export var TsObjectDeclarationType;
2
+ (function (TsObjectDeclarationType) {
3
+ function fromIri(iri) {
4
+ switch (iri.value) {
5
+ case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
6
+ return "class";
7
+ case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface":
8
+ return "interface";
9
+ default:
10
+ iri.value;
11
+ throw new RangeError(iri.value);
12
+ }
13
+ }
14
+ TsObjectDeclarationType.fromIri = fromIri;
15
+ })(TsObjectDeclarationType || (TsObjectDeclarationType = {}));
2
16
  //# sourceMappingURL=TsObjectDeclarationType.js.map
@@ -0,0 +1,6 @@
1
+ import type { NamedNode } from "@rdfjs/types";
2
+ export type Visibility = "private" | "protected" | "public";
3
+ export declare namespace Visibility {
4
+ function fromIri(iri: NamedNode<"http://purl.org/shaclmate/ontology#_Visibility_Private" | "http://purl.org/shaclmate/ontology#_Visibility_Protected" | "http://purl.org/shaclmate/ontology#_Visibility_Public">): Visibility;
5
+ }
6
+ //# sourceMappingURL=Visibility.d.ts.map
@@ -0,0 +1,18 @@
1
+ export var Visibility;
2
+ (function (Visibility) {
3
+ function fromIri(iri) {
4
+ switch (iri.value) {
5
+ case "http://purl.org/shaclmate/ontology#_Visibility_Private":
6
+ return "private";
7
+ case "http://purl.org/shaclmate/ontology#_Visibility_Protected":
8
+ return "protected";
9
+ case "http://purl.org/shaclmate/ontology#_Visibility_Public":
10
+ return "public";
11
+ default:
12
+ iri.value;
13
+ throw new RangeError(iri.value);
14
+ }
15
+ }
16
+ Visibility.fromIri = fromIri;
17
+ })(Visibility || (Visibility = {}));
18
+ //# sourceMappingURL=Visibility.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Maybe } from "purify-ts";
2
- import type { PropertyVisibility } from "../../../enums/PropertyVisibility.js";
2
+ import type { Visibility } from "../../../enums/Visibility.js";
3
3
  import type { NamedObjectType } from "../NamedObjectType.js";
4
4
  import type { Type } from "../Type.js";
5
5
  import { type Code } from "../ts-poet-wrapper.js";
@@ -74,12 +74,12 @@ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterF
74
74
  /**
75
75
  * Property visibility: private, protected, public.
76
76
  */
77
- readonly visibility: PropertyVisibility;
77
+ readonly visibility: Visibility;
78
78
  constructor({ name, namedObjectType, type, visibility, }: {
79
79
  name: string;
80
80
  namedObjectType: NamedObjectType;
81
81
  type: TypeT;
82
- visibility: PropertyVisibility;
82
+ visibility: Visibility;
83
83
  });
84
84
  /**
85
85
  * TypeScript object describing this type, for runtime use.
@@ -1,49 +1,11 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
- import { NodeShape as ShaclAstNodeShape } from "@shaclmate/shacl-ast";
3
- import { Either, type Maybe } from "purify-ts";
4
- import type { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
5
- import type { TsObjectDeclarationType } from "../enums/TsObjectDeclarationType.js";
6
2
  import type * as generated from "./generated.js";
7
- import type { Ontology, PropertyGroup, PropertyShape, ShapesGraph } from "./index.js";
8
- import type { Shape } from "./Shape.js";
9
- export declare class NodeShape extends ShaclAstNodeShape<any, Ontology, PropertyGroup, PropertyShape, Shape> {
10
- private readonly ancestorClassIris;
11
- private readonly childClassIris;
12
- private readonly descendantClassIris;
13
- private readonly generatedNodeShape;
14
- private readonly parentClassIris;
15
- readonly isClass: boolean;
16
- readonly isList: boolean;
17
- readonly kind = "NodeShape";
18
- constructor({ ancestorClassIris, childClassIris, descendantClassIris, generatedNodeShape, isClass, isList, parentClassIris, shapesGraph, }: {
19
- ancestorClassIris: readonly NamedNode[];
20
- generatedNodeShape: generated.NodeShape;
21
- childClassIris: readonly NamedNode[];
22
- descendantClassIris: readonly NamedNode[];
23
- isClass: boolean;
24
- isList: boolean;
25
- parentClassIris: readonly NamedNode[];
26
- shapesGraph: ShapesGraph;
27
- });
28
- get abstract(): Maybe<boolean>;
29
- get ancestorNodeShapes(): Either<Error, readonly NodeShape[]>;
30
- get childNodeShapes(): Either<Error, readonly NodeShape[]>;
31
- get comment(): Maybe<string>;
32
- get descendantNodeShapes(): Either<Error, readonly NodeShape[]>;
33
- get discriminantValue(): Maybe<string>;
34
- get extern(): Maybe<boolean>;
35
- get fromRdfType(): Maybe<NamedNode>;
36
- get identifierIn(): readonly NamedNode[];
37
- get identifierMintingStrategy(): Maybe<IdentifierMintingStrategy>;
38
- get label(): Maybe<string>;
39
- get mutable(): Maybe<boolean>;
40
- get parentNodeShapes(): Either<Error, readonly NodeShape[]>;
41
- get rdfType(): Maybe<NamedNode>;
42
- get shaclmateName(): Maybe<string>;
43
- get toRdfTypes(): readonly NamedNode[];
44
- 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">[];
45
- 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">[];
46
- get tsImports(): readonly string[];
47
- get tsObjectDeclarationType(): Maybe<TsObjectDeclarationType>;
48
- }
3
+ export type NodeShape = generated.NodeShape & Readonly<{
4
+ ancestorClassIris: readonly NamedNode[];
5
+ childClassIris: readonly NamedNode[];
6
+ descendantClassIris: readonly NamedNode[];
7
+ isClass: boolean;
8
+ isList: boolean;
9
+ parentClassIris: readonly NamedNode[];
10
+ }>;
49
11
  //# sourceMappingURL=NodeShape.d.ts.map