@shaclmate/compiler 4.0.23 → 4.0.24
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.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -5
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +4 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +11 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +6 -9
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +11 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
- package/dist/ast/ListType.d.ts +1 -8
- package/dist/ast/ListType.js +1 -6
- package/dist/ast/ObjectType.d.ts +1 -8
- package/dist/ast/ObjectType.js +1 -7
- package/dist/generators/ts/AbstractUnionType.js +1 -1
- package/dist/generators/ts/ListType.d.ts +1 -5
- package/dist/generators/ts/ListType.js +8 -27
- package/dist/generators/ts/NamedObjectType.d.ts +1 -9
- package/dist/generators/ts/NamedObjectType.js +1 -29
- package/dist/generators/ts/NamedObjectUnionType.js +1 -1
- package/dist/generators/ts/TypeFactory.js +8 -46
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +10 -10
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +6 -0
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +1 -3
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +17 -5
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +5 -15
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +32 -202
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +10 -9
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -10
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +13 -9
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js +8 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +4 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +9 -5
- package/dist/generators/ts/_NamedObjectType/Property.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -3
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +3 -12
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +2 -2
- package/dist/generators/ts/imports.d.ts +0 -2
- package/dist/generators/ts/imports.js +0 -2
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +1 -1
- package/dist/input/generated.d.ts +10 -47
- package/dist/input/generated.js +105 -154
- package/package.json +2 -2
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +0 -32
- package/dist/enums/IdentifierMintingStrategy.d.ts +0 -9
- package/dist/enums/IdentifierMintingStrategy.js +0 -18
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +0 -33
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +0 -92
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.24",
|
|
4
4
|
"@rdfjs/dataset": "~2.0.2",
|
|
5
5
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
6
6
|
"@rdfjs/term-map": "~2.0.2",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
},
|
|
71
71
|
"type": "module",
|
|
72
72
|
"types": "./dist/index.d.ts",
|
|
73
|
-
"version": "4.0.
|
|
73
|
+
"version": "4.0.24"
|
|
74
74
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Either, Maybe } from "purify-ts";
|
|
2
|
-
import { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
3
|
-
import type * as input from "../input/index.js";
|
|
4
|
-
import type { ShapesGraphToAstTransformer } from "../ShapesGraphToAstTransformer.js";
|
|
5
|
-
export declare function nodeShapeIdentifierMintingStrategy(this: ShapesGraphToAstTransformer, nodeShape: input.NodeShape): Either<Error, Maybe<IdentifierMintingStrategy>>;
|
|
6
|
-
//# sourceMappingURL=nodeShapeIdentifierMintingStrategy.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Either, Left, Maybe } from "purify-ts";
|
|
2
|
-
import { IdentifierMintingStrategy } from "../enums/IdentifierMintingStrategy.js";
|
|
3
|
-
import { shapeNodeKinds } from "./shapeNodeKinds.js";
|
|
4
|
-
const defaultNodeShapeNodeKinds = new Set([
|
|
5
|
-
"BlankNode",
|
|
6
|
-
"IRI",
|
|
7
|
-
]);
|
|
8
|
-
export function nodeShapeIdentifierMintingStrategy(nodeShape) {
|
|
9
|
-
if (nodeShape.identifierMintingStrategy.isJust()) {
|
|
10
|
-
if (nodeShape.in_.filter((_) => _.length > 0).isJust()) {
|
|
11
|
-
return Left(new Error(`${nodeShape} cannot have an identifier minting strategy and sh:in`));
|
|
12
|
-
}
|
|
13
|
-
return Either.of(nodeShape.identifierMintingStrategy.map(IdentifierMintingStrategy.fromIri));
|
|
14
|
-
}
|
|
15
|
-
// Recurse into parents
|
|
16
|
-
for (const parentNodeShape of this.relatedNodeShapesByIdentifier.get(nodeShape.$identifier).parents) {
|
|
17
|
-
const parentNodeShapeIdentifierMintingStrategy = nodeShapeIdentifierMintingStrategy.call(this, parentNodeShape);
|
|
18
|
-
if (parentNodeShapeIdentifierMintingStrategy.isRight() &&
|
|
19
|
-
parentNodeShapeIdentifierMintingStrategy.extract().isJust()) {
|
|
20
|
-
return parentNodeShapeIdentifierMintingStrategy;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return shapeNodeKinds
|
|
24
|
-
.call(this, nodeShape, { defaultNodeShapeNodeKinds })
|
|
25
|
-
.map((nodeKinds) => {
|
|
26
|
-
if (nodeKinds.has("BlankNode")) {
|
|
27
|
-
return Maybe.of("blankNode");
|
|
28
|
-
}
|
|
29
|
-
return Maybe.empty();
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=nodeShapeIdentifierMintingStrategy.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NamedNode } from "@rdfjs/types";
|
|
2
|
-
/**
|
|
3
|
-
* TypeScript enum corresponding to shaclmate:identifierMintingStrategy, for simpler manipulation.
|
|
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
|
-
}
|
|
9
|
-
//# sourceMappingURL=IdentifierMintingStrategy.d.ts.map
|
|
@@ -1,18 +0,0 @@
|
|
|
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 = {}));
|
|
18
|
-
//# sourceMappingURL=IdentifierMintingStrategy.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { StringType } from "../StringType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
import { AbstractProperty } from "./AbstractProperty.js";
|
|
5
|
-
export declare class IdentifierPrefixProperty extends AbstractProperty<StringType> {
|
|
6
|
-
private readonly own;
|
|
7
|
-
readonly filterProperty: AbstractProperty<StringType>["filterProperty"];
|
|
8
|
-
readonly graphqlField: AbstractProperty<StringType>["graphqlField"];
|
|
9
|
-
readonly jsonSchema: AbstractProperty<StringType>["jsonSchema"];
|
|
10
|
-
readonly jsonSignature: Maybe<Code>;
|
|
11
|
-
readonly kind = "IdentifierPrefixProperty";
|
|
12
|
-
readonly mutable = false;
|
|
13
|
-
readonly recursive = false;
|
|
14
|
-
constructor({ own, ...superParameters }: {
|
|
15
|
-
own: boolean;
|
|
16
|
-
type: StringType;
|
|
17
|
-
} & ConstructorParameters<typeof AbstractProperty>[0]);
|
|
18
|
-
get constructorParametersSignature(): Maybe<Code>;
|
|
19
|
-
get declaration(): Maybe<Code>;
|
|
20
|
-
get equalsFunction(): Maybe<Code>;
|
|
21
|
-
get getAccessorDeclaration(): Maybe<Code>;
|
|
22
|
-
constructorStatements({ variables, }: Parameters<AbstractProperty<StringType>["constructorStatements"]>[0]): readonly Code[];
|
|
23
|
-
fromJsonStatements(): readonly Code[];
|
|
24
|
-
fromRdfResourceValuesExpression(): Maybe<Code>;
|
|
25
|
-
hashStatements(): readonly Code[];
|
|
26
|
-
jsonUiSchemaElement(): Maybe<Code>;
|
|
27
|
-
sparqlConstructTriplesExpression(): Maybe<Code>;
|
|
28
|
-
sparqlWherePatternsExpression(): ReturnType<AbstractProperty<StringType>["sparqlWherePatternsExpression"]>;
|
|
29
|
-
toJsonObjectMemberExpression(): Maybe<Code>;
|
|
30
|
-
toRdfRdfResourceValuesStatements(): readonly Code[];
|
|
31
|
-
toStringExpression(): Maybe<Code>;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=IdentifierPrefixProperty.d.ts.map
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Maybe } from "purify-ts";
|
|
8
|
-
import { invariant } from "ts-invariant";
|
|
9
|
-
import { Memoize } from "typescript-memoize";
|
|
10
|
-
import { snippets } from "../snippets.js";
|
|
11
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
12
|
-
import { code } from "../ts-poet-wrapper.js";
|
|
13
|
-
import { AbstractProperty } from "./AbstractProperty.js";
|
|
14
|
-
export class IdentifierPrefixProperty extends AbstractProperty {
|
|
15
|
-
own;
|
|
16
|
-
filterProperty = Maybe.empty();
|
|
17
|
-
graphqlField = Maybe.empty();
|
|
18
|
-
jsonSchema = Maybe.empty();
|
|
19
|
-
jsonSignature = Maybe.empty();
|
|
20
|
-
kind = "IdentifierPrefixProperty";
|
|
21
|
-
mutable = false;
|
|
22
|
-
recursive = false;
|
|
23
|
-
constructor({ own, ...superParameters }) {
|
|
24
|
-
super(superParameters);
|
|
25
|
-
invariant(this.visibility === "protected");
|
|
26
|
-
this.own = own;
|
|
27
|
-
}
|
|
28
|
-
get constructorParametersSignature() {
|
|
29
|
-
return Maybe.of(code `readonly ${this.name}?: ${this.type.name};`);
|
|
30
|
-
}
|
|
31
|
-
get declaration() {
|
|
32
|
-
if (this.namedObjectType.declarationType === "interface") {
|
|
33
|
-
return Maybe.empty();
|
|
34
|
-
}
|
|
35
|
-
if (!this.own) {
|
|
36
|
-
return Maybe.empty();
|
|
37
|
-
}
|
|
38
|
-
return Maybe.of(code `protected readonly _${this.name}?: ${this.type.name};`);
|
|
39
|
-
}
|
|
40
|
-
get equalsFunction() {
|
|
41
|
-
return this.namedObjectType.declarationType === "class"
|
|
42
|
-
? Maybe.of(code `${snippets.strictEquals}`)
|
|
43
|
-
: Maybe.empty();
|
|
44
|
-
}
|
|
45
|
-
get getAccessorDeclaration() {
|
|
46
|
-
return Maybe.of(code `\
|
|
47
|
-
protected ${!this.own ? "override " : ""} get ${this.name}(): ${this.type.name} {
|
|
48
|
-
return (this._${this.name} !== undefined) ? this._${this.name} : \`urn:shaclmate:\${this.${syntheticNamePrefix}type}:\`;
|
|
49
|
-
}`);
|
|
50
|
-
}
|
|
51
|
-
constructorStatements({ variables, }) {
|
|
52
|
-
switch (this.namedObjectType.declarationType) {
|
|
53
|
-
case "class":
|
|
54
|
-
return this.declaration
|
|
55
|
-
.map(() => [code `this._${this.name} = ${variables.parameter};`])
|
|
56
|
-
.orDefault([]);
|
|
57
|
-
case "interface":
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
fromJsonStatements() {
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
fromRdfResourceValuesExpression() {
|
|
65
|
-
return Maybe.empty();
|
|
66
|
-
}
|
|
67
|
-
hashStatements() {
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
jsonUiSchemaElement() {
|
|
71
|
-
return Maybe.empty();
|
|
72
|
-
}
|
|
73
|
-
sparqlConstructTriplesExpression() {
|
|
74
|
-
return Maybe.empty();
|
|
75
|
-
}
|
|
76
|
-
sparqlWherePatternsExpression() {
|
|
77
|
-
return Maybe.empty();
|
|
78
|
-
}
|
|
79
|
-
toJsonObjectMemberExpression() {
|
|
80
|
-
return Maybe.empty();
|
|
81
|
-
}
|
|
82
|
-
toRdfRdfResourceValuesStatements() {
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
toStringExpression() {
|
|
86
|
-
return Maybe.empty();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
__decorate([
|
|
90
|
-
Memoize()
|
|
91
|
-
], IdentifierPrefixProperty.prototype, "equalsFunction", null);
|
|
92
|
-
//# sourceMappingURL=IdentifierPrefixProperty.js.map
|