@shaclmate/compiler 2.0.22 → 2.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.d.ts +6 -5
- package/dist/ShapesGraphToAstTransformer.js +61 -17
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.d.ts +2 -0
- package/dist/_ShapesGraphToAstTransformer/InheritableShapeConstraints.js +2 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +15 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +5 -5
- package/dist/_ShapesGraphToAstTransformer/index.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/shapeAstName.js +53 -12
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +5 -0
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +130 -54
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +175 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompositeType.js +185 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstIdentifierType.js +32 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstLiteralType.js +46 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +12 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +24 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +14 -0
- package/dist/ast/Ast.d.ts +0 -1
- package/dist/ast/Curie.d.ts +14 -0
- package/dist/ast/Curie.js +21 -0
- package/dist/ast/IdentifierType.d.ts +3 -2
- package/dist/ast/ListType.d.ts +2 -1
- package/dist/ast/LiteralType.d.ts +1 -1
- package/dist/ast/Name.d.ts +40 -5
- package/dist/ast/ObjectCompositeType.d.ts +11 -0
- package/dist/ast/ObjectType.d.ts +18 -13
- package/dist/ast/ObjectUnionType.d.ts +0 -11
- package/dist/ast/OptionType.d.ts +2 -4
- package/dist/ast/SetType.d.ts +2 -7
- package/dist/ast/TermType.d.ts +12 -4
- package/dist/ast/Type.d.ts +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/enums/TsFeature.d.ts +1 -4
- package/dist/enums/TsFeature.js +1 -15
- package/dist/generators/json/AstJsonGenerator.js +26 -4
- package/dist/generators/ts/BooleanType.d.ts +4 -2
- package/dist/generators/ts/BooleanType.js +12 -3
- package/dist/generators/ts/DateTimeType.d.ts +9 -8
- package/dist/generators/ts/DateTimeType.js +32 -8
- package/dist/generators/ts/DateType.d.ts +5 -2
- package/dist/generators/ts/DateType.js +15 -1
- package/dist/generators/ts/DeclaredType.d.ts +2 -2
- package/dist/generators/ts/DeclaredType.js +2 -2
- package/dist/generators/ts/FloatType.d.ts +6 -0
- package/dist/generators/ts/FloatType.js +18 -0
- package/dist/generators/ts/IdentifierType.d.ts +17 -7
- package/dist/generators/ts/IdentifierType.js +112 -18
- package/dist/generators/ts/Import.d.ts +2 -0
- package/dist/generators/ts/Import.js +10 -0
- package/dist/generators/ts/IntType.d.ts +6 -0
- package/dist/generators/ts/IntType.js +18 -0
- package/dist/generators/ts/ListType.d.ts +15 -12
- package/dist/generators/ts/ListType.js +113 -61
- package/dist/generators/ts/LiteralType.d.ts +17 -9
- package/dist/generators/ts/LiteralType.js +92 -17
- package/dist/generators/ts/NumberType.d.ts +3 -2
- package/dist/generators/ts/NumberType.js +8 -3
- package/dist/generators/ts/ObjectType.d.ts +65 -43
- package/dist/generators/ts/ObjectType.js +143 -123
- package/dist/generators/ts/ObjectUnionType.d.ts +50 -8
- package/dist/generators/ts/ObjectUnionType.js +303 -101
- package/dist/generators/ts/OptionType.d.ts +14 -10
- package/dist/generators/ts/OptionType.js +62 -34
- package/dist/generators/ts/PrimitiveType.d.ts +23 -5
- package/dist/generators/ts/PrimitiveType.js +34 -6
- package/dist/generators/ts/SetType.d.ts +17 -13
- package/dist/generators/ts/SetType.js +76 -44
- package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
- package/dist/generators/ts/SnippetDeclarations.js +226 -101
- package/dist/generators/ts/StringType.d.ts +4 -2
- package/dist/generators/ts/StringType.js +20 -8
- package/dist/generators/ts/TermType.d.ts +29 -33
- package/dist/generators/ts/TermType.js +89 -68
- package/dist/generators/ts/TsGenerator.d.ts +2 -1
- package/dist/generators/ts/TsGenerator.js +26 -12
- package/dist/generators/ts/Type.d.ts +100 -32
- package/dist/generators/ts/Type.js +58 -54
- package/dist/generators/ts/TypeFactory.d.ts +12 -5
- package/dist/generators/ts/TypeFactory.js +380 -226
- package/dist/generators/ts/UnionType.d.ts +14 -10
- package/dist/generators/ts/UnionType.js +319 -142
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.d.ts +12 -0
- package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +31 -0
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +59 -46
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +198 -140
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +100 -0
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +315 -0
- package/dist/generators/ts/_ObjectType/Property.d.ts +47 -46
- package/dist/generators/ts/_ObjectType/Property.js +1 -10
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +25 -30
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +120 -85
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +21 -17
- package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +61 -53
- package/dist/generators/ts/_ObjectType/classDeclaration.js +22 -17
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +26 -13
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +8 -5
- package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +8 -5
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +49 -0
- package/dist/generators/ts/_ObjectType/hashFunctionOrMethodDeclarations.js +7 -8
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +7 -0
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +54 -0
- package/dist/generators/ts/_ObjectType/index.d.ts +9 -7
- package/dist/generators/ts/_ObjectType/index.js +9 -7
- package/dist/generators/ts/_ObjectType/interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.js +189 -0
- package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.js +28 -0
- package/dist/generators/ts/_ObjectType/objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/_ObjectType/objectSetMethodNames.js +18 -0
- package/dist/generators/ts/_ObjectType/propertiesVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/propertiesVariableStatement.js +37 -0
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +144 -0
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +6 -5
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +4 -3
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +109 -37
- package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +33 -24
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +9 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +86 -0
- package/dist/generators/ts/objectSetDeclarations.d.ts +8 -0
- package/dist/generators/ts/objectSetDeclarations.js +59 -0
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +8 -0
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +46 -0
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +11 -0
- package/dist/generators/ts/objectSetMethodSignatures.js +52 -0
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +8 -0
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +393 -0
- package/dist/generators/ts/rdfjsTermExpression.d.ts +3 -0
- package/dist/generators/ts/rdfjsTermExpression.js +57 -0
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +8 -0
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +415 -0
- package/dist/generators/ts/syntheticNamePrefix.d.ts +2 -0
- package/dist/generators/ts/syntheticNamePrefix.js +2 -0
- package/dist/generators/ts/tsName.js +27 -13
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +10 -0
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +19 -0
- package/dist/input/NodeShape.d.ts +6 -8
- package/dist/input/NodeShape.js +20 -44
- package/dist/input/Ontology.d.ts +0 -3
- package/dist/input/Ontology.js +0 -9
- package/dist/input/PropertyPath.d.ts +5 -5
- package/dist/input/PropertyPath.js +14 -24
- package/dist/input/PropertyShape.d.ts +3 -1
- package/dist/input/PropertyShape.js +8 -2
- package/dist/input/ShapesGraph.js +4 -8
- package/dist/input/generated.d.ts +967 -107
- package/dist/input/generated.js +2548 -1046
- package/dist/input/tsFeatures.d.ts +3 -2
- package/dist/input/tsFeatures.js +44 -27
- package/package.json +18 -16
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +0 -13
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +0 -200
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.js +0 -29
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.js +0 -43
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +0 -14
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.js +0 -21
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +0 -16
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.js +0 -60
- package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +0 -78
- package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +0 -91
- package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +0 -31
- package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +0 -37
- package/dist/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +0 -6
- package/dist/generators/ts/_ObjectType/rdfjsTermExpression.js +0 -17
- package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectType/toJsonReturnType.d.ts +0 -3
- package/dist/generators/ts/_ObjectType/toJsonReturnType.js +0 -17
- package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +0 -19
|
@@ -0,0 +1,31 @@
|
|
|
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 { Memoize } from "typescript-memoize";
|
|
9
|
+
import { ShaclProperty } from "./ShaclProperty.js";
|
|
10
|
+
export class EagerShaclProperty extends ShaclProperty {
|
|
11
|
+
mutable;
|
|
12
|
+
recursive;
|
|
13
|
+
constructor({ mutable, recursive, ...superParameters }) {
|
|
14
|
+
super(superParameters);
|
|
15
|
+
this.mutable = mutable;
|
|
16
|
+
this.recursive = recursive;
|
|
17
|
+
}
|
|
18
|
+
get graphqlField() {
|
|
19
|
+
return Maybe.of({
|
|
20
|
+
args: Maybe.empty(),
|
|
21
|
+
description: this.comment.map(JSON.stringify),
|
|
22
|
+
name: this.name,
|
|
23
|
+
resolve: `(source, _args) => ${this.type.graphqlResolveExpression({ variables: { args: "_args", value: `source.${this.name}` } })}`,
|
|
24
|
+
type: this.type.graphqlName.toString(),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
__decorate([
|
|
29
|
+
Memoize()
|
|
30
|
+
], EagerShaclProperty.prototype, "graphqlField", null);
|
|
31
|
+
//# sourceMappingURL=EagerShaclProperty.js.map
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import type { IdentifierType } from "generators/ts/IdentifierType.js";
|
|
2
|
-
import type { Import } from "generators/ts/Import.js";
|
|
3
1
|
import { Maybe } from "purify-ts";
|
|
4
2
|
import { type GetAccessorDeclarationStructure, type OptionalKind, type PropertyDeclarationStructure, type PropertySignatureStructure } from "ts-morph";
|
|
3
|
+
import type { IdentifierType } from "../IdentifierType.js";
|
|
4
|
+
import type { Import } from "../Import.js";
|
|
5
5
|
import type { StringType } from "../StringType.js";
|
|
6
6
|
import { Property } from "./Property.js";
|
|
7
7
|
export declare class IdentifierPrefixProperty extends Property<StringType> {
|
|
8
|
-
readonly equalsFunction = "strictEquals";
|
|
9
|
-
readonly mutable = false;
|
|
10
8
|
private readonly own;
|
|
9
|
+
readonly declarationImports: readonly Import[];
|
|
10
|
+
readonly graphqlField: Property<StringType>["graphqlField"];
|
|
11
|
+
readonly propertySignature: Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
12
|
+
readonly jsonPropertySignature: Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
13
|
+
readonly mutable = false;
|
|
14
|
+
readonly recursive = false;
|
|
11
15
|
constructor({ own, ...superParameters }: {
|
|
12
16
|
own: boolean;
|
|
13
17
|
type: StringType;
|
|
14
18
|
} & ConstructorParameters<typeof Property>[0]);
|
|
15
|
-
get classGetAccessorDeclaration(): Maybe<OptionalKind<GetAccessorDeclarationStructure>>;
|
|
16
|
-
get classPropertyDeclaration(): Maybe<OptionalKind<PropertyDeclarationStructure>>;
|
|
17
19
|
get constructorParametersPropertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
18
|
-
get
|
|
19
|
-
|
|
20
|
-
get jsonPropertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
21
|
-
get snippetDeclarations(): readonly string[];
|
|
22
|
-
classConstructorStatements({ variables, }: Parameters<Property<IdentifierType>["classConstructorStatements"]>[0]): readonly string[];
|
|
20
|
+
get equalsFunction(): Maybe<string>;
|
|
21
|
+
constructorStatements({ variables, }: Parameters<Property<IdentifierType>["constructorStatements"]>[0]): readonly string[];
|
|
23
22
|
fromJsonStatements(): readonly string[];
|
|
24
23
|
fromRdfStatements(): readonly string[];
|
|
24
|
+
get getAccessorDeclaration(): Maybe<OptionalKind<GetAccessorDeclarationStructure>>;
|
|
25
25
|
hashStatements(): readonly string[];
|
|
26
|
-
interfaceConstructorStatements(): readonly string[];
|
|
27
26
|
jsonUiSchemaElement(): Maybe<string>;
|
|
28
27
|
jsonZodSchema(): ReturnType<Property<IdentifierType>["jsonZodSchema"]>;
|
|
28
|
+
get propertyDeclaration(): Maybe<OptionalKind<PropertyDeclarationStructure>>;
|
|
29
|
+
snippetDeclarations(): readonly string[];
|
|
29
30
|
sparqlConstructTemplateTriples(): readonly string[];
|
|
30
31
|
sparqlWherePatterns(): readonly string[];
|
|
31
32
|
toJsonObjectMember(): Maybe<string>;
|
|
@@ -1,38 +1,29 @@
|
|
|
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
|
+
};
|
|
1
7
|
import { Maybe } from "purify-ts";
|
|
2
8
|
import { invariant } from "ts-invariant";
|
|
3
9
|
import { Scope, } from "ts-morph";
|
|
10
|
+
import { Memoize } from "typescript-memoize";
|
|
4
11
|
import { SnippetDeclarations } from "../SnippetDeclarations.js";
|
|
12
|
+
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
5
13
|
import { Property } from "./Property.js";
|
|
6
14
|
export class IdentifierPrefixProperty extends Property {
|
|
7
|
-
equalsFunction = "strictEquals";
|
|
8
|
-
mutable = false;
|
|
9
15
|
own;
|
|
16
|
+
declarationImports = [];
|
|
17
|
+
graphqlField = Maybe.empty();
|
|
18
|
+
propertySignature = Maybe.empty();
|
|
19
|
+
jsonPropertySignature = Maybe.empty();
|
|
20
|
+
mutable = false;
|
|
21
|
+
recursive = false;
|
|
10
22
|
constructor({ own, ...superParameters }) {
|
|
11
23
|
super(superParameters);
|
|
12
24
|
invariant(this.visibility === "protected");
|
|
13
25
|
this.own = own;
|
|
14
26
|
}
|
|
15
|
-
get classGetAccessorDeclaration() {
|
|
16
|
-
return Maybe.of({
|
|
17
|
-
leadingTrivia: `protected ${!this.own ? "override " : ""}`,
|
|
18
|
-
name: this.name,
|
|
19
|
-
returnType: this.type.name,
|
|
20
|
-
statements: [
|
|
21
|
-
`return (typeof this._${this.name} !== "undefined") ? this._${this.name} : \`urn:shaclmate:\${this.type}:\``,
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
get classPropertyDeclaration() {
|
|
26
|
-
return this.own
|
|
27
|
-
? Maybe.of({
|
|
28
|
-
hasQuestionToken: true,
|
|
29
|
-
isReadonly: true,
|
|
30
|
-
name: `_${this.name}`,
|
|
31
|
-
scope: Scope.Protected,
|
|
32
|
-
type: this.type.name,
|
|
33
|
-
})
|
|
34
|
-
: Maybe.empty();
|
|
35
|
-
}
|
|
36
27
|
get constructorParametersPropertySignature() {
|
|
37
28
|
return Maybe.of({
|
|
38
29
|
hasQuestionToken: true,
|
|
@@ -41,28 +32,22 @@ export class IdentifierPrefixProperty extends Property {
|
|
|
41
32
|
type: this.type.name,
|
|
42
33
|
});
|
|
43
34
|
}
|
|
44
|
-
get
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return Maybe.empty();
|
|
49
|
-
}
|
|
50
|
-
get jsonPropertySignature() {
|
|
51
|
-
return Maybe.empty();
|
|
35
|
+
get equalsFunction() {
|
|
36
|
+
return this.objectType.declarationType === "class"
|
|
37
|
+
? Maybe.of(`${syntheticNamePrefix}strictEquals`)
|
|
38
|
+
: Maybe.empty();
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
constructorStatements({ variables, }) {
|
|
41
|
+
switch (this.objectType.declarationType) {
|
|
42
|
+
case "class":
|
|
43
|
+
return this.propertyDeclaration
|
|
44
|
+
.map((propertyDeclaration) => [
|
|
45
|
+
`this.${propertyDeclaration.name} = ${variables.parameter};`,
|
|
46
|
+
])
|
|
47
|
+
.orDefault([]);
|
|
48
|
+
case "interface":
|
|
49
|
+
return [];
|
|
57
50
|
}
|
|
58
|
-
return snippetDeclarations;
|
|
59
|
-
}
|
|
60
|
-
classConstructorStatements({ variables, }) {
|
|
61
|
-
return this.classPropertyDeclaration
|
|
62
|
-
.map((classPropertyDeclaration) => [
|
|
63
|
-
`this.${classPropertyDeclaration.name} = ${variables.parameter};`,
|
|
64
|
-
])
|
|
65
|
-
.orDefault([]);
|
|
66
51
|
}
|
|
67
52
|
fromJsonStatements() {
|
|
68
53
|
return [];
|
|
@@ -70,10 +55,17 @@ export class IdentifierPrefixProperty extends Property {
|
|
|
70
55
|
fromRdfStatements() {
|
|
71
56
|
return [];
|
|
72
57
|
}
|
|
73
|
-
|
|
74
|
-
return
|
|
58
|
+
get getAccessorDeclaration() {
|
|
59
|
+
return Maybe.of({
|
|
60
|
+
leadingTrivia: `protected ${!this.own ? "override " : ""}`,
|
|
61
|
+
name: this.name,
|
|
62
|
+
returnType: this.type.name,
|
|
63
|
+
statements: [
|
|
64
|
+
`return (typeof this._${this.name} !== "undefined") ? this._${this.name} : \`urn:shaclmate:\${this.${syntheticNamePrefix}type}:\``,
|
|
65
|
+
],
|
|
66
|
+
});
|
|
75
67
|
}
|
|
76
|
-
|
|
68
|
+
hashStatements() {
|
|
77
69
|
return [];
|
|
78
70
|
}
|
|
79
71
|
jsonUiSchemaElement() {
|
|
@@ -82,6 +74,24 @@ export class IdentifierPrefixProperty extends Property {
|
|
|
82
74
|
jsonZodSchema() {
|
|
83
75
|
return Maybe.empty();
|
|
84
76
|
}
|
|
77
|
+
get propertyDeclaration() {
|
|
78
|
+
return this.own
|
|
79
|
+
? Maybe.of({
|
|
80
|
+
hasQuestionToken: true,
|
|
81
|
+
isReadonly: true,
|
|
82
|
+
name: `_${this.name}`,
|
|
83
|
+
scope: Scope.Protected,
|
|
84
|
+
type: this.type.name,
|
|
85
|
+
})
|
|
86
|
+
: Maybe.empty();
|
|
87
|
+
}
|
|
88
|
+
snippetDeclarations() {
|
|
89
|
+
const snippetDeclarations = [];
|
|
90
|
+
if (this.objectType.features.has("equals")) {
|
|
91
|
+
snippetDeclarations.push(SnippetDeclarations.strictEquals);
|
|
92
|
+
}
|
|
93
|
+
return snippetDeclarations;
|
|
94
|
+
}
|
|
85
95
|
sparqlConstructTemplateTriples() {
|
|
86
96
|
return [];
|
|
87
97
|
}
|
|
@@ -95,4 +105,7 @@ export class IdentifierPrefixProperty extends Property {
|
|
|
95
105
|
return [];
|
|
96
106
|
}
|
|
97
107
|
}
|
|
108
|
+
__decorate([
|
|
109
|
+
Memoize()
|
|
110
|
+
], IdentifierPrefixProperty.prototype, "equalsFunction", null);
|
|
98
111
|
//# sourceMappingURL=IdentifierPrefixProperty.js.map
|
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { GetAccessorDeclarationStructure, OptionalKind, PropertyDeclarationStructure, PropertySignatureStructure } from "ts-morph";
|
|
2
|
+
import type { GetAccessorDeclarationStructure, OptionalKind, PropertyDeclarationStructure, PropertySignatureStructure, Scope } from "ts-morph";
|
|
3
3
|
import type { IdentifierMintingStrategy, PropertyVisibility } from "../../../enums/index.js";
|
|
4
4
|
import type { IdentifierType } from "../IdentifierType.js";
|
|
5
5
|
import { Import } from "../Import.js";
|
|
6
6
|
import { Property } from "./Property.js";
|
|
7
7
|
export declare class IdentifierProperty extends Property<IdentifierType> {
|
|
8
|
-
readonly
|
|
9
|
-
readonly equalsFunction = "booleanEquals";
|
|
10
|
-
readonly mutable = false;
|
|
11
|
-
private readonly classDeclarationVisibility;
|
|
8
|
+
private readonly getAccessorScope;
|
|
12
9
|
private readonly identifierMintingStrategy;
|
|
10
|
+
private readonly identifierPrefixPropertyName;
|
|
13
11
|
private readonly override;
|
|
14
|
-
|
|
12
|
+
private readonly propertyDeclarationVisibility;
|
|
13
|
+
private readonly typeAlias;
|
|
14
|
+
readonly abstract: boolean;
|
|
15
|
+
readonly equalsFunction: Maybe<string>;
|
|
16
|
+
readonly mutable = false;
|
|
17
|
+
readonly recursive = false;
|
|
18
|
+
constructor({ abstract, getAccessorScope, identifierMintingStrategy, identifierPrefixPropertyName, override, propertyDeclarationVisibility, typeAlias, ...superParameters }: {
|
|
15
19
|
abstract: boolean;
|
|
16
|
-
|
|
20
|
+
getAccessorScope: Maybe<Scope>;
|
|
21
|
+
propertyDeclarationVisibility: Maybe<PropertyVisibility>;
|
|
17
22
|
identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
23
|
+
identifierPrefixPropertyName: string;
|
|
18
24
|
override: boolean;
|
|
19
25
|
type: IdentifierType;
|
|
26
|
+
typeAlias: string;
|
|
20
27
|
} & ConstructorParameters<typeof Property>[0]);
|
|
21
|
-
get classGetAccessorDeclaration(): Maybe<OptionalKind<GetAccessorDeclarationStructure>>;
|
|
22
|
-
get classPropertyDeclaration(): Maybe<OptionalKind<PropertyDeclarationStructure>>;
|
|
23
28
|
get constructorParametersPropertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
24
29
|
get declarationImports(): readonly Import[];
|
|
25
|
-
get
|
|
30
|
+
get getAccessorDeclaration(): Maybe<OptionalKind<GetAccessorDeclarationStructure>>;
|
|
31
|
+
get graphqlField(): Property<IdentifierType>["graphqlField"];
|
|
26
32
|
get jsonPropertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
27
|
-
|
|
28
|
-
classConstructorStatements({ variables, }: Parameters<Property<IdentifierType>["classConstructorStatements"]>[0]): readonly string[];
|
|
33
|
+
constructorStatements({ variables, }: Parameters<Property<IdentifierType>["constructorStatements"]>[0]): readonly string[];
|
|
29
34
|
fromJsonStatements({ variables, }: Parameters<Property<IdentifierType>["fromJsonStatements"]>[0]): readonly string[];
|
|
30
35
|
fromRdfStatements({ variables, }: Parameters<Property<IdentifierType>["fromRdfStatements"]>[0]): readonly string[];
|
|
31
36
|
hashStatements({ variables, }: Parameters<Property<IdentifierType>["hashStatements"]>[0]): readonly string[];
|
|
32
|
-
interfaceConstructorStatements({ variables, }: Parameters<Property<IdentifierType>["interfaceConstructorStatements"]>[0]): readonly string[];
|
|
33
37
|
jsonUiSchemaElement({ variables, }: Parameters<Property<IdentifierType>["jsonUiSchemaElement"]>[0]): Maybe<string>;
|
|
34
38
|
jsonZodSchema({ variables, }: Parameters<Property<IdentifierType>["jsonZodSchema"]>[0]): ReturnType<Property<IdentifierType>["jsonZodSchema"]>;
|
|
39
|
+
get propertyDeclaration(): Maybe<OptionalKind<PropertyDeclarationStructure>>;
|
|
40
|
+
get propertySignature(): Maybe<OptionalKind<PropertySignatureStructure>>;
|
|
41
|
+
snippetDeclarations(): readonly string[];
|
|
35
42
|
sparqlConstructTemplateTriples(): readonly string[];
|
|
36
43
|
sparqlWherePatterns(): readonly string[];
|
|
37
44
|
toJsonObjectMember({ variables, }: Parameters<Property<IdentifierType>["toJsonObjectMember"]>[0]): Maybe<string>;
|