@shaclmate/compiler 4.0.39 → 4.0.41
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 +0 -8
- package/dist/ShapesGraphToAstTransformer.js +5 -85
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +0 -16
- package/dist/ast/AbstractCompoundType.d.ts +2 -1
- package/dist/ast/AbstractCompoundType.js +1 -1
- package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
- package/dist/ast/Ast.d.ts +1 -3
- package/dist/ast/ListType.d.ts +1 -1
- package/dist/ast/ListType.js +1 -1
- package/dist/ast/ObjectType.d.ts +0 -12
- package/dist/ast/ObjectType.js +0 -78
- package/dist/generators/AstJsonGenerator.js +7 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
- package/dist/generators/ts/AbstractCollectionType.d.ts +5 -12
- package/dist/generators/ts/AbstractCollectionType.js +9 -68
- package/dist/generators/ts/AbstractContainerType.d.ts +4 -6
- package/dist/generators/ts/AbstractContainerType.js +5 -9
- package/dist/generators/ts/AbstractDateType.d.ts +6 -3
- package/dist/generators/ts/AbstractDateType.js +7 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
- package/dist/generators/ts/AbstractIdentifierType.js +3 -0
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +9 -9
- package/dist/generators/ts/AbstractLazyObjectType.js +30 -19
- package/dist/generators/ts/AbstractLiteralType.d.ts +1 -0
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
- package/dist/generators/ts/AbstractNumericType.js +9 -9
- package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
- package/dist/generators/ts/AbstractPrimitiveType.js +2 -2
- package/dist/generators/ts/AbstractTermType.d.ts +1 -2
- package/dist/generators/ts/AbstractTermType.js +3 -5
- package/dist/generators/ts/AbstractType.d.ts +61 -26
- package/dist/generators/ts/AbstractType.js +37 -17
- package/dist/generators/ts/BigDecimalType.d.ts +5 -1
- package/dist/generators/ts/BigDecimalType.js +6 -3
- package/dist/generators/ts/BigIntType.d.ts +3 -1
- package/dist/generators/ts/BigIntType.js +3 -3
- package/dist/generators/ts/BlankNodeType.d.ts +3 -3
- package/dist/generators/ts/BlankNodeType.js +13 -13
- package/dist/generators/ts/BooleanType.d.ts +5 -3
- package/dist/generators/ts/BooleanType.js +11 -6
- package/dist/generators/ts/DefaultValueType.d.ts +40 -2
- package/dist/generators/ts/DefaultValueType.js +14 -12
- package/dist/generators/ts/FloatType.d.ts +3 -1
- package/dist/generators/ts/FloatType.js +1 -1
- package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
- package/dist/generators/ts/GraphqlSchema.js +6 -6
- package/dist/generators/ts/IdentifierType.d.ts +3 -3
- package/dist/generators/ts/IdentifierType.js +19 -17
- package/dist/generators/ts/IntType.d.ts +3 -1
- package/dist/generators/ts/IntType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +21 -19
- package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -0
- package/dist/generators/ts/LazyObjectOptionType.js +14 -10
- package/dist/generators/ts/LazyObjectSetType.js +14 -8
- package/dist/generators/ts/LazyObjectType.js +9 -6
- package/dist/generators/ts/ListType.d.ts +13 -5
- package/dist/generators/ts/ListType.js +48 -12
- package/dist/generators/ts/LiteralType.d.ts +5 -1
- package/dist/generators/ts/LiteralType.js +11 -8
- package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +19 -34
- package/dist/generators/ts/ObjectType.js +282 -0
- package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
- package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +52 -60
- package/dist/generators/ts/OptionType.d.ts +6 -2
- package/dist/generators/ts/OptionType.js +20 -15
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -11
- package/dist/generators/ts/SetType.d.ts +16 -1
- package/dist/generators/ts/SetType.js +80 -2
- package/dist/generators/ts/Snippets.d.ts +3 -1
- package/dist/generators/ts/Snippets.js +18 -4
- package/dist/generators/ts/SparqlObjectSetType.js +2 -2
- package/dist/generators/ts/StringType.d.ts +5 -3
- package/dist/generators/ts/StringType.js +15 -6
- package/dist/generators/ts/TermType.d.ts +6 -2
- package/dist/generators/ts/TermType.js +15 -12
- package/dist/generators/ts/TsGenerator.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.js +60 -32
- package/dist/generators/ts/Type.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.d.ts +7 -8
- package/dist/generators/ts/TypeFactory.js +62 -76
- package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +36 -11
- package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +296 -105
- package/dist/generators/ts/ZodGenerator.d.ts +1 -1
- package/dist/generators/ts/ZodGenerator.js +21 -16
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +9 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +9 -13
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +22 -39
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +1 -5
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +18 -13
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +44 -0
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +3 -7
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -6
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +2 -5
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +2 -6
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -24
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +51 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +41 -0
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +5 -11
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +9 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -6
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +12 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +7 -14
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +12 -12
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +16 -0
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -0
- package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -0
- package/dist/input/generated.d.ts +758 -117
- package/dist/input/generated.js +636 -128
- package/package.json +4 -6
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
- package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
- package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
- package/dist/generators/ts/AnonymousUnionType.js +0 -59
- package/dist/generators/ts/NamedObjectType.js +0 -342
- package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
- package/dist/generators/ts/NamedUnionType.d.ts +0 -11
- package/dist/generators/ts/NamedUnionType.js +0 -13
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +0 -65
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +0 -43
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +0 -80
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +0 -45
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +0 -16
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +0 -17
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +0 -16
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +0 -41
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +0 -25
- package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +0 -0
|
@@ -7,7 +7,7 @@ const variables = {
|
|
|
7
7
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
8
8
|
variablePrefix: code `parameters.variablePrefix`,
|
|
9
9
|
};
|
|
10
|
-
export function
|
|
10
|
+
export function ObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
11
11
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
12
12
|
return Maybe.empty();
|
|
13
13
|
}
|
|
@@ -15,30 +15,11 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
|
15
15
|
const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
16
16
|
let patternsVariableDeclarationKeyword = "const";
|
|
17
17
|
const statements = [];
|
|
18
|
-
|
|
19
|
-
statements.push(code `\
|
|
20
|
-
patterns = patterns.concat(${parentObjectType.name}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
|
|
21
|
-
patternsVariableDeclarationKeyword = "let";
|
|
22
|
-
}
|
|
23
|
-
if (this.fromRdfType.isJust()) {
|
|
24
|
-
const fromRdfTypeVariables = this.fromRdfTypeVariable
|
|
25
|
-
.toList()
|
|
26
|
-
.concat(this.descendantFromRdfTypeVariables);
|
|
18
|
+
this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
|
|
27
19
|
statements.push(code `const rdfTypeVariable = ${rdfTypeVariable};`, code `\
|
|
28
20
|
if (!parameters?.ignoreRdfType) {
|
|
29
21
|
patterns.push(
|
|
30
|
-
${
|
|
31
|
-
? code `\
|
|
32
|
-
{
|
|
33
|
-
type: "values" as const,
|
|
34
|
-
values: [${joinCode(fromRdfTypeVariables, { on: "," })}].map((identifier) => {
|
|
35
|
-
const valuePatternRow: ${this.reusables.imports.sparqljs}.ValuePatternRow = {};
|
|
36
|
-
valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${this.reusables.imports.NamedNode};
|
|
37
|
-
return valuePatternRow;
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
|
|
41
|
-
: code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
|
|
22
|
+
${code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariable}, subject: ${variables.focusIdentifier} }),`}
|
|
42
23
|
{
|
|
43
24
|
triples: [
|
|
44
25
|
{
|
|
@@ -70,7 +51,7 @@ if (!parameters?.ignoreRdfType) {
|
|
|
70
51
|
}
|
|
71
52
|
);
|
|
72
53
|
}`);
|
|
73
|
-
}
|
|
54
|
+
});
|
|
74
55
|
for (const property of this.properties) {
|
|
75
56
|
if (property.recursive) {
|
|
76
57
|
continue;
|
|
@@ -99,4 +80,4 @@ ${statements.length > 0
|
|
|
99
80
|
: "return [];"}
|
|
100
81
|
};`);
|
|
101
82
|
}
|
|
102
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { invariant } from "ts-invariant";
|
|
3
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
+
export function ObjectType_fromJsonFunctionDeclaration() {
|
|
5
|
+
if (!this.configuration.features.has("Object.fromJson")) {
|
|
6
|
+
return Maybe.empty();
|
|
7
|
+
}
|
|
8
|
+
const variables = {
|
|
9
|
+
jsonObject: code `${this.configuration.syntheticNamePrefix}json`,
|
|
10
|
+
};
|
|
11
|
+
const propertyInitializers = this.properties.flatMap((property) => property.fromJsonInitializer({ variables }).toList());
|
|
12
|
+
invariant(propertyInitializers.length > 0);
|
|
13
|
+
return Maybe.of(code `\
|
|
14
|
+
export function fromJson(${variables.jsonObject}: ${this.jsonType().expression}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
|
|
15
|
+
return ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(create);
|
|
16
|
+
}`);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { invariant } from "ts-invariant";
|
|
3
|
+
import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
+
export function ObjectType_fromRdfResourceFunctionDeclaration() {
|
|
5
|
+
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
6
|
+
return Maybe.empty();
|
|
7
|
+
}
|
|
8
|
+
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
9
|
+
const optionsVariable = `_${syntheticNamePrefix}options`;
|
|
10
|
+
const variables = {
|
|
11
|
+
context: code `${optionsVariable}.context`,
|
|
12
|
+
graph: code `${optionsVariable}.graph`,
|
|
13
|
+
ignoreRdfType: code `${optionsVariable}.ignoreRdfType`,
|
|
14
|
+
objectSet: code `${optionsVariable}.objectSet`,
|
|
15
|
+
preferredLanguages: code `${optionsVariable}.preferredLanguages`,
|
|
16
|
+
resource: code `${syntheticNamePrefix}resource`,
|
|
17
|
+
};
|
|
18
|
+
const propertyFromRdfResourceValuesExpressionVariable = {
|
|
19
|
+
context: variables.context,
|
|
20
|
+
graph: variables.graph,
|
|
21
|
+
objectSet: variables.objectSet,
|
|
22
|
+
preferredLanguages: variables.preferredLanguages,
|
|
23
|
+
resource: variables.resource,
|
|
24
|
+
};
|
|
25
|
+
const chains = [];
|
|
26
|
+
this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
|
|
27
|
+
chains.push({
|
|
28
|
+
expression: code `!${variables.ignoreRdfType} ? ${this.reusables.snippets.ensureRdfResourceType}(${variables.resource}, ${arrayOf(fromRdfTypeVariable)}, ${{ graph: variables.graph }}) : ${this.reusables.imports.Right}(true as const)`,
|
|
29
|
+
variable: `_rdfTypeCheck`,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
const propertyFromRdfResourceValuesInitializers = this.properties.flatMap((property) => property
|
|
33
|
+
.fromRdfResourceValuesInitializer({
|
|
34
|
+
variables: propertyFromRdfResourceValuesExpressionVariable,
|
|
35
|
+
})
|
|
36
|
+
.toList());
|
|
37
|
+
invariant(Object.keys(propertyFromRdfResourceValuesInitializers).length > 0);
|
|
38
|
+
chains.push({
|
|
39
|
+
expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyFromRdfResourceValuesInitializers, { on: ", " })} })`,
|
|
40
|
+
variable: "properties",
|
|
41
|
+
});
|
|
42
|
+
return Maybe.of(code `\
|
|
43
|
+
export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.expression}> = (${variables.resource}, ${optionsVariable}) => {
|
|
44
|
+
return ${chains
|
|
45
|
+
.reverse()
|
|
46
|
+
.reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(create(properties))`)};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const fromRdfResource = ${this.reusables.snippets.wrap_FromRdfResourceFunction}(_fromRdfResource);`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_fromRdfResourceValuesFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.alias.unsafeCoerce()}> = (values, options) =>
|
|
9
|
+
values.chain(
|
|
10
|
+
values => values.chainMap(
|
|
11
|
+
value => value.toResource().chain(resource => ${this.alias.unsafeCoerce()}.fromRdfResource(resource, options))
|
|
12
|
+
)
|
|
13
|
+
);`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_fromRdfTypeVariableStatement() {
|
|
4
4
|
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return this.fromRdfType.map((fromRdfType) => code `\
|
|
8
8
|
export const fromRdfType: ${this.reusables.imports.NamedNode}<string> = ${this.rdfjsTermExpression(fromRdfType)};`);
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_graphqlTypeVariableStatement() {
|
|
4
4
|
if (!this.configuration.features.has("GraphQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ export function NamedObjectType_graphqlTypeVariableStatement() {
|
|
|
8
8
|
return Maybe.empty();
|
|
9
9
|
}
|
|
10
10
|
return Maybe.of(code `\
|
|
11
|
-
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.
|
|
11
|
+
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
|
|
12
12
|
description: this.comment.extract(),
|
|
13
13
|
fields: code `() => (${this.properties.reduce((fields, property) => {
|
|
14
14
|
property.graphqlField.ifJust((field) => {
|
|
@@ -27,7 +27,7 @@ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.na
|
|
|
27
27
|
});
|
|
28
28
|
return fields;
|
|
29
29
|
}, {})})`,
|
|
30
|
-
name: this.
|
|
30
|
+
name: this.alias.unsafeCoerce(),
|
|
31
31
|
}});`);
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
+
const hasherVariable = code `hasher`;
|
|
3
|
+
export function ObjectType_hashFunctionDeclarations() {
|
|
4
|
+
if (!this.configuration.features.has("Object.hash")) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
return [
|
|
8
|
+
code `\
|
|
9
|
+
export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
|
|
10
|
+
${joinCode([
|
|
11
|
+
code `${this.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`,
|
|
12
|
+
...this.properties
|
|
13
|
+
.filter((property) => property.kind !== "Shacl")
|
|
14
|
+
.flatMap((property) => property.hashStatements({
|
|
15
|
+
variables: {
|
|
16
|
+
hasher: hasherVariable,
|
|
17
|
+
value: code `${property.accessExpression({ variables: { object: this.thisVariable } })}`,
|
|
18
|
+
},
|
|
19
|
+
})),
|
|
20
|
+
code `return ${hasherVariable};`,
|
|
21
|
+
])}
|
|
22
|
+
}`,
|
|
23
|
+
code `\
|
|
24
|
+
export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
|
|
25
|
+
${joinCode([
|
|
26
|
+
...this.properties.flatMap((property) => property.kind === "Shacl"
|
|
27
|
+
? property.hashStatements({
|
|
28
|
+
variables: {
|
|
29
|
+
hasher: hasherVariable,
|
|
30
|
+
value: property.accessExpression({
|
|
31
|
+
variables: { object: this.thisVariable },
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
: []),
|
|
36
|
+
code `return ${hasherVariable};`,
|
|
37
|
+
])}
|
|
38
|
+
}`,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ObjectType_hashFunctionDeclarations.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
+
import { tsComment } from "../tsComment.js";
|
|
3
|
+
export function ObjectType_interfaceDeclaration() {
|
|
4
|
+
return code `\
|
|
5
|
+
${this.comment
|
|
6
|
+
.alt(this.label)
|
|
7
|
+
.map(tsComment)
|
|
8
|
+
.orDefault("")}export interface ${this.alias.unsafeCoerce()} {
|
|
9
|
+
${joinCode(this.properties.map((property) => property.declaration), { on: "\n\n" })}
|
|
10
|
+
}`;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_interfaceDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_isTypeFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, literalOf } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_isTypeFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.type")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
if (this.synthetic) {
|
|
8
|
+
return Maybe.empty();
|
|
9
|
+
}
|
|
10
|
+
const alias = this.alias.extract();
|
|
11
|
+
const discriminantProperty = this.discriminantProperty.extract();
|
|
12
|
+
if (!alias || !discriminantProperty) {
|
|
13
|
+
return Maybe.empty();
|
|
14
|
+
}
|
|
15
|
+
return Maybe.of(code `\
|
|
16
|
+
export function is${alias}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${alias} {
|
|
17
|
+
return object.${discriminantProperty.name} === ${literalOf(discriminantProperty.value)};
|
|
18
|
+
}`);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonParseFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonParseFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.parse")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -11,4 +11,4 @@ export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Js
|
|
|
11
11
|
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
12
12
|
}`);
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.schema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
if (this.properties.length > 0) {
|
|
12
|
-
properties = properties.concat(this.properties
|
|
13
|
-
.flatMap((property) => property.jsonSchema.toList())
|
|
14
|
-
.map(({ key, schema }) => code `"${key}": ${schema}`));
|
|
15
|
-
}
|
|
7
|
+
const properties = this.properties
|
|
8
|
+
.flatMap((property) => property.jsonSchema.toList())
|
|
9
|
+
.map(({ key, schema }) => code `"${key}": ${schema}`);
|
|
16
10
|
const meta = {
|
|
17
11
|
// id: this.name,
|
|
18
12
|
};
|
|
@@ -28,4 +22,4 @@ export function schema() {
|
|
|
28
22
|
return ${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${this.reusables.imports.z}.ZodType<Json>;
|
|
29
23
|
}`);
|
|
30
24
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonTypeAliasDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_jsonTypeAliasDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.JSON.type")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `export type Json = { ${joinCode(this.properties.flatMap((property) => property.jsonSignature.toList()), { on: ";" })} }`);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonUiSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.uiSchema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const variables = { scopePrefix: code `scopePrefix` };
|
|
8
|
-
const elements = this.
|
|
9
|
-
.map((parentObjectType) => code `${parentObjectType.name}.Json.uiSchema({ scopePrefix })`)
|
|
10
|
-
.concat(this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
8
|
+
const elements = this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList());
|
|
11
9
|
return Maybe.of(code `\
|
|
12
10
|
export function uiSchema(parameters?: { scopePrefix?: string }): any {
|
|
13
11
|
const scopePrefix = parameters?.scopePrefix ?? "#";
|
|
14
|
-
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.
|
|
12
|
+
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.alias.unsafeCoerce())}", type: "Group" };
|
|
15
13
|
}`);
|
|
16
14
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function ObjectType_objectSetMethodNames(this: {
|
|
3
|
+
readonly alias: string;
|
|
3
4
|
readonly configuration: TsGenerator.Configuration;
|
|
4
|
-
readonly name: string;
|
|
5
5
|
}): {
|
|
6
6
|
object: string;
|
|
7
7
|
objectCount: string;
|
|
8
8
|
objectIdentifiers: string;
|
|
9
9
|
objects: string;
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { camelCase, trainCase } from "change-case";
|
|
2
2
|
import plur from "plur";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_objectSetMethodNames() {
|
|
4
4
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
5
|
-
const prefixSingular = camelCase(this.
|
|
5
|
+
const prefixSingular = camelCase(this.alias, {
|
|
6
6
|
prefixCharacters: syntheticNamePrefix,
|
|
7
7
|
});
|
|
8
|
-
const thisNameParts = trainCase(this.
|
|
8
|
+
const thisNameParts = trainCase(this.alias, {
|
|
9
9
|
prefixCharacters: syntheticNamePrefix,
|
|
10
10
|
}).split("-");
|
|
11
11
|
let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
|
|
@@ -20,4 +20,4 @@ export function NamedObjectType_objectSetMethodNames() {
|
|
|
20
20
|
objects: prefixPlural,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_schemaVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_schemaVariableStatement() {
|
|
4
|
+
if (!this.configuration.features.has("Object.schema")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export const schema = { properties: { ${joinCode(this.properties.flatMap((property) => property.schema
|
|
9
|
+
.toList()
|
|
10
|
+
.map((propertySchema) => code `${property.name}: ${propertySchema}`)), { on: ", " })} } } as const;`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { camelCase } from "change-case";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_sparqlConstructQueryFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
8
|
return Maybe.of(code `\
|
|
9
9
|
export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages, prefixes, subject, ...queryParameters }: { filter?: ${this.filterType}; ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; preferredLanguages?: readonly string[]; subject: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable} } & Omit<${this.reusables.imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type">): ${this.reusables.imports.sparqljs}.ConstructQuery {
|
|
10
|
-
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.
|
|
10
|
+
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.alias)}";
|
|
11
11
|
|
|
12
12
|
return {
|
|
13
13
|
...queryParameters,
|
|
14
14
|
prefixes: prefixes ?? {},
|
|
15
15
|
queryType: "CONSTRUCT",
|
|
16
16
|
template: (queryParameters.template ?? []).concat(
|
|
17
|
-
${this.
|
|
17
|
+
${this.alias}.focusSparqlConstructTriples({
|
|
18
18
|
filter,
|
|
19
19
|
focusIdentifier: subject,
|
|
20
20
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -24,7 +24,7 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
24
24
|
type: "query",
|
|
25
25
|
where: (queryParameters.where ?? []).concat(
|
|
26
26
|
${this.reusables.snippets.normalizeSparqlWherePatterns}(
|
|
27
|
-
${this.
|
|
27
|
+
${this.alias}.focusSparqlWherePatterns({
|
|
28
28
|
filter,
|
|
29
29
|
focusIdentifier: subject,
|
|
30
30
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -36,4 +36,4 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
36
36
|
};
|
|
37
37
|
}`);
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_sparqlConstructQueryStringFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.alias}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
|
|
9
|
+
return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.alias}.sparqlConstructQuery(parameters));
|
|
10
|
+
}`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_toJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_toJsonFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.toJson")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export function toJson(${this.thisVariable}: ${this.expression}): ${this.jsonType().expression} {
|
|
9
|
+
return JSON.parse(JSON.stringify({ ${joinCode(this.properties.flatMap((property) => property
|
|
10
|
+
.toJsonInitializer({
|
|
11
|
+
variables: {
|
|
12
|
+
value: property.accessExpression({
|
|
13
|
+
variables: { object: this.thisVariable },
|
|
14
|
+
}),
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
.toList()), { on: "," })} } satisfies ${this.jsonType().expression}));
|
|
18
|
+
}`);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_toRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.d.ts.map
|