@shaclmate/compiler 2.0.22 → 2.0.23
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 +1 -0
- package/dist/ShapesGraphToAstTransformer.js +56 -12
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
- package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
- 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/transformPropertyShapeToAstCompositeType.d.ts +2 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +122 -129
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +2 -2
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +2 -2
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +127 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +2 -3
- 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 -2
- package/dist/ast/SetType.d.ts +2 -2
- package/dist/ast/TermType.d.ts +12 -4
- package/dist/ast/Type.d.ts +1 -1
- package/dist/enums/TsFeature.d.ts +1 -4
- package/dist/enums/TsFeature.js +1 -15
- package/dist/generators/json/AstJsonGenerator.js +19 -3
- package/dist/generators/ts/BooleanType.d.ts +3 -1
- package/dist/generators/ts/BooleanType.js +11 -2
- package/dist/generators/ts/DateTimeType.d.ts +8 -7
- package/dist/generators/ts/DateTimeType.js +31 -7
- 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 +12 -7
- package/dist/generators/ts/IdentifierType.js +94 -6
- 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 +98 -57
- package/dist/generators/ts/LiteralType.d.ts +10 -9
- package/dist/generators/ts/LiteralType.js +13 -2
- package/dist/generators/ts/NumberType.d.ts +2 -1
- package/dist/generators/ts/NumberType.js +7 -2
- package/dist/generators/ts/ObjectType.d.ts +66 -43
- package/dist/generators/ts/ObjectType.js +144 -123
- package/dist/generators/ts/ObjectUnionType.d.ts +49 -8
- package/dist/generators/ts/ObjectUnionType.js +290 -97
- package/dist/generators/ts/OptionType.d.ts +14 -10
- package/dist/generators/ts/OptionType.js +60 -34
- package/dist/generators/ts/PrimitiveType.d.ts +4 -4
- package/dist/generators/ts/PrimitiveType.js +18 -3
- package/dist/generators/ts/SetType.d.ts +16 -12
- package/dist/generators/ts/SetType.js +69 -40
- package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
- package/dist/generators/ts/SnippetDeclarations.js +215 -101
- package/dist/generators/ts/StringType.d.ts +3 -1
- package/dist/generators/ts/StringType.js +14 -2
- package/dist/generators/ts/TermType.d.ts +22 -14
- package/dist/generators/ts/TermType.js +53 -25
- package/dist/generators/ts/TsGenerator.d.ts +2 -1
- package/dist/generators/ts/TsGenerator.js +23 -12
- package/dist/generators/ts/Type.d.ts +89 -31
- package/dist/generators/ts/Type.js +57 -54
- package/dist/generators/ts/TypeFactory.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.js +290 -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 +30 -0
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
- package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +46 -47
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +152 -124
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +87 -0
- package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +237 -0
- package/dist/generators/ts/_ObjectType/Property.d.ts +39 -44
- 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 +108 -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 +6 -5
- package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +5 -4
- package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +5 -4
- 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 +37 -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 +152 -0
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +4 -3
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +3 -2
- package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +103 -35
- package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
- package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +15 -13
- 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 +6 -5
- package/dist/input/PropertyPath.js +14 -22
- package/dist/input/PropertyShape.d.ts +3 -1
- package/dist/input/PropertyShape.js +8 -2
- package/dist/input/ShapesGraph.js +4 -4
- package/dist/input/generated.d.ts +923 -105
- package/dist/input/generated.js +1865 -969
- package/dist/input/tsFeatures.d.ts +3 -2
- package/dist/input/tsFeatures.js +44 -27
- package/package.json +18 -16
- 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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type * as rdfjs from "@rdfjs/types";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { TsFeature } from "../enums/index.js";
|
|
4
|
-
type TsFeatureIri = rdfjs.NamedNode<"http://purl.org/shaclmate/ontology#
|
|
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
5
|
export declare function tsFeatures(generated: {
|
|
6
6
|
readonly tsFeatureExcludes: readonly TsFeatureIri[];
|
|
7
7
|
readonly tsFeatureIncludes: readonly TsFeatureIri[];
|
|
8
8
|
}): Maybe<Set<TsFeature>>;
|
|
9
|
+
export declare const tsFeaturesDefault: readonly TsFeature[];
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=tsFeatures.d.ts.map
|
package/dist/input/tsFeatures.js
CHANGED
|
@@ -1,50 +1,67 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { TsFeature } from "../enums/index.js";
|
|
3
2
|
function iriToTsFeatures(iri) {
|
|
4
3
|
switch (iri.value) {
|
|
5
|
-
case "http://purl.org/shaclmate/ontology#
|
|
6
|
-
return
|
|
4
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_All":
|
|
5
|
+
return tsFeaturesAll;
|
|
7
6
|
case "http://purl.org/shaclmate/ontology#_TsFeature_Create":
|
|
8
7
|
return ["create"];
|
|
8
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_Default":
|
|
9
|
+
return tsFeaturesDefault;
|
|
9
10
|
case "http://purl.org/shaclmate/ontology#_TsFeature_Equals":
|
|
10
11
|
return ["equals"];
|
|
11
|
-
case "http://purl.org/shaclmate/ontology#
|
|
12
|
-
return ["
|
|
13
|
-
case "http://purl.org/shaclmate/ontology#
|
|
14
|
-
return ["
|
|
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"];
|
|
15
18
|
case "http://purl.org/shaclmate/ontology#_TsFeature_Hash":
|
|
16
19
|
return ["hash"];
|
|
17
|
-
case "http://purl.org/shaclmate/ontology#
|
|
18
|
-
return ["fromJson", "jsonSchema", "jsonUiSchema", "toJson"];
|
|
19
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_JsonSchema":
|
|
20
|
-
return ["jsonSchema"];
|
|
21
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_JsonUiSchema":
|
|
22
|
-
return ["jsonUiSchema"];
|
|
23
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_None":
|
|
20
|
+
case "http://purl.org/shaclmate/ontology#_TsFeatures_None":
|
|
24
21
|
return [];
|
|
25
22
|
case "http://purl.org/shaclmate/ontology#_TsFeature_Sparql":
|
|
26
23
|
return ["sparql"];
|
|
27
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_Rdf":
|
|
28
|
-
return ["fromRdf", "toRdf"];
|
|
29
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_ToJson":
|
|
30
|
-
return ["toJson"];
|
|
31
|
-
case "http://purl.org/shaclmate/ontology#_TsFeature_ToRdf":
|
|
32
|
-
return ["toRdf"];
|
|
33
24
|
}
|
|
34
25
|
}
|
|
35
26
|
export function tsFeatures(generated) {
|
|
36
27
|
const tsFeatureIncludes = generated.tsFeatureIncludes.flatMap(iriToTsFeatures);
|
|
37
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();
|
|
38
33
|
if (tsFeatureIncludes.length > 0) {
|
|
39
|
-
|
|
34
|
+
for (const tsFeatureInclude of tsFeatureIncludes) {
|
|
35
|
+
tsFeatures.add(tsFeatureInclude);
|
|
36
|
+
}
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
tsFeatures.delete(tsFeatureExclude);
|
|
38
|
+
else {
|
|
39
|
+
for (const tsFeature of tsFeaturesDefault) {
|
|
40
|
+
tsFeatures.add(tsFeature);
|
|
45
41
|
}
|
|
46
|
-
return Maybe.of(tsFeatures);
|
|
47
42
|
}
|
|
48
|
-
|
|
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);
|
|
49
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
|
+
];
|
|
50
67
|
//# sourceMappingURL=tsFeatures.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "2.0.
|
|
3
|
+
"@shaclmate/shacl-ast": "2.0.23",
|
|
4
4
|
"@rdfjs/prefix-map": "^0.1.2",
|
|
5
5
|
"@rdfjs/term-map": "^2.0.2",
|
|
6
6
|
"@rdfjs/term-set": "^2.0.3",
|
|
@@ -13,15 +13,22 @@
|
|
|
13
13
|
"@types/toposort": "2.0.7",
|
|
14
14
|
"change-case": "^5.4.4",
|
|
15
15
|
"pino": "^9.1.0",
|
|
16
|
+
"plur": "^5.1.0",
|
|
17
|
+
"purify-ts": "^2.1.0",
|
|
16
18
|
"reserved-identifiers": "^1.0.0",
|
|
17
19
|
"toposort": "2.0.2",
|
|
18
20
|
"ts-invariant": "^0.10.3",
|
|
19
|
-
"ts-morph": "^
|
|
21
|
+
"ts-morph": "^26.0.0",
|
|
20
22
|
"typescript-memoize": "^1.1.1"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
23
|
-
"@shaclmate/
|
|
24
|
-
"
|
|
25
|
+
"@shaclmate/kitchen-sink-example": "2.0.23",
|
|
26
|
+
"@shaclmate/runtime": "2.0.23",
|
|
27
|
+
"@kos-kit/sparql-client": "2.0.115",
|
|
28
|
+
"@types/n3": "^1.21.1",
|
|
29
|
+
"oxigraph": "0.4.11",
|
|
30
|
+
"n3": "^1.21.3",
|
|
31
|
+
"rdfjs-resource": "1.0.20"
|
|
25
32
|
},
|
|
26
33
|
"exports": {
|
|
27
34
|
".": {
|
|
@@ -51,31 +58,26 @@
|
|
|
51
58
|
],
|
|
52
59
|
"license": "Apache-2.0",
|
|
53
60
|
"name": "@shaclmate/compiler",
|
|
61
|
+
"packageManager": "npm@10.9.0",
|
|
54
62
|
"repository": {
|
|
55
63
|
"type": "git",
|
|
56
64
|
"url": "git+https://github.com/minorg/shaclmate"
|
|
57
65
|
},
|
|
58
66
|
"scripts": {
|
|
59
67
|
"build": "tsc -b",
|
|
68
|
+
"build:noEmit": "tsc --noEmit",
|
|
60
69
|
"check": "biome check",
|
|
61
70
|
"check:write": "biome check --write",
|
|
62
71
|
"check:write:unsafe": "biome check --write --unsafe",
|
|
63
72
|
"clean": "rimraf dist",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"format:write:unsafe": "biome format --write --unsafe",
|
|
67
|
-
"rebuild": "run-s clean build",
|
|
73
|
+
"dev": "tsc -w --preserveWatchOutput",
|
|
74
|
+
"dev:noEmit": "tsc --noEmit -w --preserveWatchOutput",
|
|
68
75
|
"link-dependencies": "npm link rdfjs-resource",
|
|
69
|
-
"lint": "biome lint",
|
|
70
|
-
"lint:write": "biome lint --write",
|
|
71
|
-
"lint:write:unsafe": "biome lint --write --unsafe",
|
|
72
76
|
"test": "biome check && vitest run",
|
|
73
77
|
"test:coverage": "biome check && vitest run --coverage",
|
|
74
|
-
"test:watch": "vitest watch",
|
|
75
|
-
"unlink": "npm unlink -g @shaclmate/compiler"
|
|
76
|
-
"watch": "tsc -w --preserveWatchOutput",
|
|
77
|
-
"watch:noEmit": "tsc --noEmit -w --preserveWatchOutput"
|
|
78
|
+
"test:watch": "biome check && vitest watch",
|
|
79
|
+
"unlink": "npm unlink -g @shaclmate/compiler"
|
|
78
80
|
},
|
|
79
81
|
"type": "module",
|
|
80
|
-
"version": "2.0.
|
|
82
|
+
"version": "2.0.23"
|
|
81
83
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
export declare function fromJsonFunctionDeclarations(this: ObjectType): readonly FunctionDeclarationStructure[];
|
|
4
|
-
//# sourceMappingURL=fromJsonFunctionDeclarations.d.ts.map
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { StructureKind } from "ts-morph";
|
|
2
|
-
const variables = {
|
|
3
|
-
jsonObject: "_jsonObject",
|
|
4
|
-
};
|
|
5
|
-
export function fromJsonFunctionDeclarations() {
|
|
6
|
-
if (!this.features.has("fromJson")) {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
if (this.extern) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const initializers = [];
|
|
13
|
-
const propertyReturnTypeSignatures = [];
|
|
14
|
-
const propertiesFromJsonFunctionReturnType = [];
|
|
15
|
-
const propertiesFromJsonFunctionStatements = [];
|
|
16
|
-
propertiesFromJsonFunctionStatements.push(`const _jsonSafeParseResult = ${this.jsonZodSchemaFunctionName}().safeParse(_json);`, "if (!_jsonSafeParseResult.success) { return purify.Left(_jsonSafeParseResult.error); }", `const ${variables.jsonObject} = _jsonSafeParseResult.data;`);
|
|
17
|
-
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
18
|
-
propertiesFromJsonFunctionStatements.push(`const _super${parentObjectTypeI}Either = ${parentObjectType.name}._propertiesFromJson(${variables.jsonObject});`, `if (_super${parentObjectTypeI}Either.isLeft()) { return _super${parentObjectTypeI}Either; }`, `const _super${parentObjectTypeI} = _super${parentObjectTypeI}Either.unsafeCoerce()`);
|
|
19
|
-
initializers.push(`..._super${parentObjectTypeI}`);
|
|
20
|
-
propertiesFromJsonFunctionReturnType.push(`UnwrapR<ReturnType<typeof ${parentObjectType.name}._propertiesFromJson>>`);
|
|
21
|
-
});
|
|
22
|
-
for (const property of this.properties) {
|
|
23
|
-
const propertyFromJsonStatements = property.fromJsonStatements({
|
|
24
|
-
variables,
|
|
25
|
-
});
|
|
26
|
-
if (propertyFromJsonStatements.length > 0) {
|
|
27
|
-
propertiesFromJsonFunctionStatements.push(...propertyFromJsonStatements);
|
|
28
|
-
initializers.push(property.name);
|
|
29
|
-
propertyReturnTypeSignatures.push(`${property.name}: ${property.type.name};`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
propertiesFromJsonFunctionStatements.push(`return purify.Either.of({ ${initializers.join(", ")} })`);
|
|
33
|
-
if (propertyReturnTypeSignatures.length > 0) {
|
|
34
|
-
propertiesFromJsonFunctionReturnType.splice(0, 0, `{ ${propertyReturnTypeSignatures.join(" ")} }`);
|
|
35
|
-
}
|
|
36
|
-
const fromJsonFunctionDeclarations = [];
|
|
37
|
-
fromJsonFunctionDeclarations.push({
|
|
38
|
-
isExported: true,
|
|
39
|
-
kind: StructureKind.Function,
|
|
40
|
-
name: "_propertiesFromJson",
|
|
41
|
-
parameters: [
|
|
42
|
-
{
|
|
43
|
-
name: "_json",
|
|
44
|
-
type: "unknown",
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
returnType: `purify.Either<zod.ZodError, ${propertiesFromJsonFunctionReturnType.join(" & ")}>`,
|
|
48
|
-
statements: propertiesFromJsonFunctionStatements,
|
|
49
|
-
});
|
|
50
|
-
if (!this.abstract) {
|
|
51
|
-
let fromJsonStatements;
|
|
52
|
-
switch (this.declarationType) {
|
|
53
|
-
case "class":
|
|
54
|
-
fromJsonStatements = [
|
|
55
|
-
`return ${this.name}._propertiesFromJson(json).map(properties => new ${this.name}(properties));`,
|
|
56
|
-
];
|
|
57
|
-
break;
|
|
58
|
-
case "interface":
|
|
59
|
-
fromJsonStatements = [`return ${this.name}._propertiesFromJson(json);`];
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
fromJsonFunctionDeclarations.push({
|
|
63
|
-
isExported: true,
|
|
64
|
-
kind: StructureKind.Function,
|
|
65
|
-
name: "fromJson",
|
|
66
|
-
parameters: [
|
|
67
|
-
{
|
|
68
|
-
name: "json",
|
|
69
|
-
type: "unknown",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
returnType: `purify.Either<zod.ZodError, ${this.name}>`,
|
|
73
|
-
statements: fromJsonStatements,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return fromJsonFunctionDeclarations;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=fromJsonFunctionDeclarations.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
export declare function fromRdfFunctionDeclarations(this: ObjectType): readonly FunctionDeclarationStructure[];
|
|
4
|
-
//# sourceMappingURL=fromRdfFunctionDeclarations.d.ts.map
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { StructureKind } from "ts-morph";
|
|
2
|
-
import { objectInitializer } from "../objectInitializer.js";
|
|
3
|
-
const variables = {
|
|
4
|
-
context: "_context",
|
|
5
|
-
ignoreRdfType: "_ignoreRdfType",
|
|
6
|
-
languageIn: "_languageIn",
|
|
7
|
-
resource: "_resource",
|
|
8
|
-
};
|
|
9
|
-
export function fromRdfFunctionDeclarations() {
|
|
10
|
-
if (!this.features.has("fromRdf")) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
if (this.extern) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const initializers = [];
|
|
17
|
-
const propertySignatures = [];
|
|
18
|
-
const propertiesFromRdfFunctionReturnType = [];
|
|
19
|
-
const propertiesFromRdfFunctionStatements = [];
|
|
20
|
-
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
21
|
-
propertiesFromRdfFunctionStatements.push(`const _super${parentObjectTypeI}Either = ${parentObjectType.name}._propertiesFromRdf({ ...${variables.context}, ignoreRdfType: true, languageIn: ${variables.languageIn}, resource: ${variables.resource} });`, `if (_super${parentObjectTypeI}Either.isLeft()) { return _super${parentObjectTypeI}Either; }`, `const _super${parentObjectTypeI} = _super${parentObjectTypeI}Either.unsafeCoerce()`);
|
|
22
|
-
initializers.push(`..._super${parentObjectTypeI}`);
|
|
23
|
-
propertiesFromRdfFunctionReturnType.push(`UnwrapR<ReturnType<typeof ${parentObjectType.name}._propertiesFromRdf>>`);
|
|
24
|
-
});
|
|
25
|
-
this.fromRdfType.ifJust((rdfType) => {
|
|
26
|
-
propertiesFromRdfFunctionStatements.push(`if (!${variables.ignoreRdfType} && !${variables.resource}.isInstanceOf(${this.rdfjsTermExpression(rdfType)})) { return purify.Left(new rdfjsResource.Resource.ValueError(${objectInitializer({ focusResource: variables.resource, message: `\`\${rdfjsResource.Resource.Identifier.toString(${variables.resource}.identifier)} has unexpected RDF type\``, predicate: this.rdfjsTermExpression(rdfType) })})); }`);
|
|
27
|
-
});
|
|
28
|
-
const propertyFromRdfVariables = {
|
|
29
|
-
context: variables.context,
|
|
30
|
-
languageIn: variables.languageIn,
|
|
31
|
-
resource: variables.resource,
|
|
32
|
-
};
|
|
33
|
-
for (const property of this.properties) {
|
|
34
|
-
const propertyFromRdfStatements = property.fromRdfStatements({
|
|
35
|
-
variables: propertyFromRdfVariables,
|
|
36
|
-
});
|
|
37
|
-
if (propertyFromRdfStatements.length > 0) {
|
|
38
|
-
propertiesFromRdfFunctionStatements.push(...propertyFromRdfStatements);
|
|
39
|
-
initializers.push(property.name);
|
|
40
|
-
propertySignatures.push(`${property.name}: ${property.type.name};`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
propertiesFromRdfFunctionStatements.push(`return purify.Either.of({ ${initializers.join(", ")} })`);
|
|
44
|
-
if (propertySignatures.length > 0) {
|
|
45
|
-
propertiesFromRdfFunctionReturnType.splice(0, 0, `{ ${propertySignatures.join(" ")} }`);
|
|
46
|
-
}
|
|
47
|
-
const fromRdfFunctionDeclarations = [];
|
|
48
|
-
fromRdfFunctionDeclarations.push({
|
|
49
|
-
isExported: true,
|
|
50
|
-
kind: StructureKind.Function,
|
|
51
|
-
name: "_propertiesFromRdf",
|
|
52
|
-
parameters: [
|
|
53
|
-
{
|
|
54
|
-
name: `{ ignoreRdfType: ${variables.ignoreRdfType}, languageIn: ${variables.languageIn}, resource: ${variables.resource},\n// @ts-ignore\n...${variables.context} }`,
|
|
55
|
-
type: `{ [_index: string]: any; ignoreRdfType?: boolean; languageIn?: readonly string[]; resource: ${this.rdfjsResourceType().name}; }`,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
returnType: `purify.Either<rdfjsResource.Resource.ValueError, ${propertiesFromRdfFunctionReturnType.join(" & ")}>`,
|
|
59
|
-
statements: propertiesFromRdfFunctionStatements,
|
|
60
|
-
});
|
|
61
|
-
if (!this.abstract) {
|
|
62
|
-
let fromRdfStatements;
|
|
63
|
-
switch (this.declarationType) {
|
|
64
|
-
case "class":
|
|
65
|
-
fromRdfStatements = [
|
|
66
|
-
`return ${this.name}._propertiesFromRdf(parameters).map(properties => new ${this.name}(properties));`,
|
|
67
|
-
];
|
|
68
|
-
break;
|
|
69
|
-
case "interface":
|
|
70
|
-
fromRdfStatements = [
|
|
71
|
-
`return ${this.name}._propertiesFromRdf(parameters);`,
|
|
72
|
-
];
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
fromRdfFunctionDeclarations.push({
|
|
76
|
-
isExported: true,
|
|
77
|
-
kind: StructureKind.Function,
|
|
78
|
-
name: "fromRdf",
|
|
79
|
-
parameters: [
|
|
80
|
-
{
|
|
81
|
-
name: "parameters",
|
|
82
|
-
type: `Parameters<typeof ${this.name}._propertiesFromRdf>[0]`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
returnType: `purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>`,
|
|
86
|
-
statements: fromRdfStatements,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return fromRdfFunctionDeclarations;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=fromRdfFunctionDeclarations.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
3
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
-
export declare function jsonSchemaFunctionDeclaration(this: ObjectType): Maybe<FunctionDeclarationStructure>;
|
|
5
|
-
//# sourceMappingURL=jsonSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { StructureKind } from "ts-morph";
|
|
3
|
-
export function jsonSchemaFunctionDeclaration() {
|
|
4
|
-
if (!this.features.has("jsonSchema")) {
|
|
5
|
-
return Maybe.empty();
|
|
6
|
-
}
|
|
7
|
-
if (this.extern) {
|
|
8
|
-
return Maybe.empty();
|
|
9
|
-
}
|
|
10
|
-
return Maybe.of({
|
|
11
|
-
isExported: true,
|
|
12
|
-
kind: StructureKind.Function,
|
|
13
|
-
name: "jsonSchema",
|
|
14
|
-
statements: [
|
|
15
|
-
`return zodToJsonSchema(${this.jsonZodSchemaFunctionName}());`,
|
|
16
|
-
],
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=jsonSchemaFunctionDeclaration.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
3
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
-
export declare function jsonUiSchemaFunctionDeclaration(this: ObjectType): Maybe<FunctionDeclarationStructure>;
|
|
5
|
-
//# sourceMappingURL=jsonUiSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { StructureKind } from "ts-morph";
|
|
3
|
-
export function jsonUiSchemaFunctionDeclaration() {
|
|
4
|
-
if (!this.features.has("jsonUiSchema")) {
|
|
5
|
-
return Maybe.empty();
|
|
6
|
-
}
|
|
7
|
-
if (this.extern) {
|
|
8
|
-
return Maybe.empty();
|
|
9
|
-
}
|
|
10
|
-
const variables = { scopePrefix: "scopePrefix" };
|
|
11
|
-
const elements = this.parentObjectTypes
|
|
12
|
-
.map((parentObjectType) => `${parentObjectType.name}.${parentObjectType.jsonUiSchemaFunctionName}({ scopePrefix })`)
|
|
13
|
-
.concat(this.ownProperties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
14
|
-
return Maybe.of({
|
|
15
|
-
isExported: true,
|
|
16
|
-
kind: StructureKind.Function,
|
|
17
|
-
name: this.jsonUiSchemaFunctionName,
|
|
18
|
-
parameters: [
|
|
19
|
-
{
|
|
20
|
-
hasQuestionToken: true,
|
|
21
|
-
name: "parameters",
|
|
22
|
-
type: "{ scopePrefix?: string }",
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
statements: [
|
|
26
|
-
'const scopePrefix = parameters?.scopePrefix ?? "#";',
|
|
27
|
-
`return { "elements": [ ${elements.join(", ")} ], label: "${this.label.orDefault(this.name)}", type: "Group" }`,
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=jsonUiSchemaFunctionDeclaration.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
3
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
-
export declare function jsonZodSchemaFunctionDeclaration(this: ObjectType): Maybe<FunctionDeclarationStructure>;
|
|
5
|
-
//# sourceMappingURL=jsonZodSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { StructureKind } from "ts-morph";
|
|
3
|
-
export function jsonZodSchemaFunctionDeclaration() {
|
|
4
|
-
if (!this.features.has("fromJson") && !this.features.has("jsonSchema")) {
|
|
5
|
-
return Maybe.empty();
|
|
6
|
-
}
|
|
7
|
-
if (this.extern) {
|
|
8
|
-
return Maybe.empty();
|
|
9
|
-
}
|
|
10
|
-
const variables = { zod: "zod" };
|
|
11
|
-
const mergeZodObjectSchemas = [];
|
|
12
|
-
for (const parentObjectType of this.parentObjectTypes) {
|
|
13
|
-
mergeZodObjectSchemas.push(`${parentObjectType.jsonZodSchema({ variables })}`);
|
|
14
|
-
}
|
|
15
|
-
if (this.properties.length > 0) {
|
|
16
|
-
mergeZodObjectSchemas.push(`${variables.zod}.object({ ${this.properties
|
|
17
|
-
.flatMap((property) => property.jsonZodSchema({ variables }).toList())
|
|
18
|
-
.map(({ key, schema }) => `"${key}": ${schema}`)
|
|
19
|
-
.join(",")} })`);
|
|
20
|
-
}
|
|
21
|
-
return Maybe.of({
|
|
22
|
-
isExported: true,
|
|
23
|
-
kind: StructureKind.Function,
|
|
24
|
-
name: this.jsonZodSchemaFunctionName,
|
|
25
|
-
statements: [
|
|
26
|
-
`return ${mergeZodObjectSchemas.length > 0
|
|
27
|
-
? mergeZodObjectSchemas.reduce((merged, zodObjectSchema) => {
|
|
28
|
-
if (merged.length === 0) {
|
|
29
|
-
return zodObjectSchema;
|
|
30
|
-
}
|
|
31
|
-
return `${merged}.merge(${zodObjectSchema})`;
|
|
32
|
-
}, "")
|
|
33
|
-
: `${variables.zod}.object()`};`,
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=jsonZodSchemaFunctionDeclaration.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BlankNode, Literal, NamedNode, Variable } from "@rdfjs/types";
|
|
2
|
-
export declare function rdfjsTermExpression({ dataFactoryVariable, rdfjsTerm, }: {
|
|
3
|
-
dataFactoryVariable: string;
|
|
4
|
-
rdfjsTerm: Omit<BlankNode, "equals"> | Omit<Literal, "equals"> | Omit<NamedNode, "equals"> | Omit<Variable, "equals">;
|
|
5
|
-
}): string;
|
|
6
|
-
//# sourceMappingURL=rdfjsTermExpression.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { xsd } from "@tpluscode/rdf-ns-builders";
|
|
2
|
-
export function rdfjsTermExpression({ dataFactoryVariable, rdfjsTerm, }) {
|
|
3
|
-
switch (rdfjsTerm.termType) {
|
|
4
|
-
case "BlankNode":
|
|
5
|
-
return `${dataFactoryVariable}.blankNode("${rdfjsTerm.value}")`;
|
|
6
|
-
case "Literal":
|
|
7
|
-
if (rdfjsTerm.datatype.equals(xsd.string)) {
|
|
8
|
-
return `${dataFactoryVariable}.literal("${rdfjsTerm.value}", "${rdfjsTerm.language}")`;
|
|
9
|
-
}
|
|
10
|
-
return `${dataFactoryVariable}.literal("${rdfjsTerm.value}", ${dataFactoryVariable}.namedNode("${rdfjsTerm.datatype.value}"))`;
|
|
11
|
-
case "NamedNode":
|
|
12
|
-
return `${dataFactoryVariable}.namedNode("${rdfjsTerm.value}")`;
|
|
13
|
-
case "Variable":
|
|
14
|
-
return `${dataFactoryVariable}.variable!("${rdfjsTerm.value}")`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=rdfjsTermExpression.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
3
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
-
export declare function toJsonFunctionDeclaration(this: ObjectType): Maybe<FunctionDeclarationStructure>;
|
|
5
|
-
//# sourceMappingURL=toJsonFunctionDeclaration.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { StructureKind } from "ts-morph";
|
|
3
|
-
import { toJsonFunctionOrMethodDeclaration } from "./toJsonFunctionOrMethodDeclaration.js";
|
|
4
|
-
export function toJsonFunctionDeclaration() {
|
|
5
|
-
if (this.declarationType !== "interface") {
|
|
6
|
-
return Maybe.empty();
|
|
7
|
-
}
|
|
8
|
-
if (this.extern) {
|
|
9
|
-
return Maybe.empty();
|
|
10
|
-
}
|
|
11
|
-
return toJsonFunctionOrMethodDeclaration
|
|
12
|
-
.bind(this)()
|
|
13
|
-
.map((toJsonFunctionOrMethodDeclaration) => ({
|
|
14
|
-
...toJsonFunctionOrMethodDeclaration,
|
|
15
|
-
isExported: true,
|
|
16
|
-
kind: StructureKind.Function,
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=toJsonFunctionDeclaration.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function toJsonReturnType() {
|
|
2
|
-
const typeMembers = [];
|
|
3
|
-
if (this.ownProperties.length > 0) {
|
|
4
|
-
typeMembers.push(`{ ${this.ownProperties
|
|
5
|
-
.flatMap((property) => property.jsonPropertySignature.toList())
|
|
6
|
-
.map((propertySignature) => `readonly "${propertySignature.name}": ${propertySignature.type}`)
|
|
7
|
-
.join("; ")} }`);
|
|
8
|
-
}
|
|
9
|
-
for (const parentObjectType of this.parentObjectTypes) {
|
|
10
|
-
typeMembers.push(parentObjectType.jsonName);
|
|
11
|
-
}
|
|
12
|
-
if (typeMembers.length === 0) {
|
|
13
|
-
return "object";
|
|
14
|
-
}
|
|
15
|
-
return typeMembers.join(" & ");
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=toJsonReturnType.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { type FunctionDeclarationStructure } from "ts-morph";
|
|
3
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
4
|
-
export declare function toRdfFunctionDeclaration(this: ObjectType): Maybe<FunctionDeclarationStructure>;
|
|
5
|
-
//# sourceMappingURL=toRdfFunctionDeclaration.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { StructureKind } from "ts-morph";
|
|
3
|
-
import { toRdfFunctionOrMethodDeclaration } from "./toRdfFunctionOrMethodDeclaration.js";
|
|
4
|
-
export function toRdfFunctionDeclaration() {
|
|
5
|
-
if (this.declarationType !== "interface") {
|
|
6
|
-
return Maybe.empty();
|
|
7
|
-
}
|
|
8
|
-
if (this.extern) {
|
|
9
|
-
return Maybe.empty();
|
|
10
|
-
}
|
|
11
|
-
return toRdfFunctionOrMethodDeclaration
|
|
12
|
-
.bind(this)()
|
|
13
|
-
.map((toRdfFunctionOrMethodDeclaration) => ({
|
|
14
|
-
...toRdfFunctionOrMethodDeclaration,
|
|
15
|
-
isExported: true,
|
|
16
|
-
kind: StructureKind.Function,
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=toRdfFunctionDeclaration.js.map
|