@shaclmate/compiler 4.0.38 → 4.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.js +12 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +24 -24
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -4
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/ast/AbstractCollectionType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.js +15 -15
- package/dist/ast/AbstractContainerType.d.ts +1 -1
- package/dist/ast/AbstractContainerType.js +15 -15
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -1
- package/dist/ast/AbstractTermType.d.ts +1 -1
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/BlankNodeType.js +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -1
- package/dist/ast/DefaultValueType.js +2 -2
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IdentifierType.js +1 -1
- package/dist/ast/IntersectionType.d.ts +1 -1
- package/dist/ast/IntersectionType.js +3 -3
- package/dist/ast/IriType.d.ts +1 -1
- package/dist/ast/IriType.js +1 -1
- package/dist/ast/LazyObjectOptionType.d.ts +1 -1
- package/dist/ast/LazyObjectOptionType.js +1 -1
- package/dist/ast/LazyObjectSetType.d.ts +1 -1
- package/dist/ast/LazyObjectSetType.js +1 -1
- package/dist/ast/LazyObjectType.d.ts +1 -1
- package/dist/ast/LazyObjectType.js +1 -1
- package/dist/ast/ListType.d.ts +1 -1
- package/dist/ast/ListType.js +16 -16
- package/dist/ast/LiteralType.d.ts +1 -1
- package/dist/ast/LiteralType.js +1 -1
- package/dist/ast/ObjectCompoundType.js +3 -3
- package/dist/ast/ObjectType.d.ts +1 -1
- package/dist/ast/ObjectType.js +16 -16
- package/dist/ast/OptionType.d.ts +1 -1
- package/dist/ast/OptionType.js +1 -1
- package/dist/ast/SetType.d.ts +1 -1
- package/dist/ast/SetType.js +1 -1
- package/dist/ast/TermType.d.ts +1 -1
- package/dist/ast/TermType.js +1 -1
- package/dist/ast/Type.js +15 -15
- package/dist/ast/UnionType.d.ts +1 -1
- package/dist/ast/UnionType.js +3 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +10 -10
- package/dist/generators/ts/AbstractCollectionType.d.ts +2 -6
- package/dist/generators/ts/AbstractCollectionType.js +16 -15
- package/dist/generators/ts/AbstractContainerType.d.ts +7 -11
- package/dist/generators/ts/AbstractContainerType.js +35 -36
- package/dist/generators/ts/AbstractDateType.d.ts +4 -4
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +14 -17
- package/dist/generators/ts/AbstractLazyObjectType.js +26 -38
- package/dist/generators/ts/AbstractLiteralType.d.ts +1 -5
- package/dist/generators/ts/AbstractLiteralType.js +7 -6
- package/dist/generators/ts/AbstractNumericType.d.ts +2 -2
- package/dist/generators/ts/AbstractNumericType.js +3 -3
- package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -6
- package/dist/generators/ts/AbstractPrimitiveType.js +9 -10
- package/dist/generators/ts/AbstractTermType.d.ts +1 -5
- package/dist/generators/ts/AbstractTermType.js +3 -17
- package/dist/generators/ts/AbstractType.d.ts +22 -15
- package/dist/generators/ts/AbstractType.js +18 -8
- package/dist/generators/ts/BigDecimalType.d.ts +2 -2
- package/dist/generators/ts/BigDecimalType.js +3 -3
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +3 -3
- package/dist/generators/ts/BlankNodeType.d.ts +4 -4
- package/dist/generators/ts/BlankNodeType.js +12 -12
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +11 -6
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +3 -7
- package/dist/generators/ts/DefaultValueType.js +17 -21
- package/dist/generators/ts/FloatType.d.ts +1 -1
- package/dist/generators/ts/FloatType.js +1 -1
- package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
- package/dist/generators/ts/GraphqlSchema.js +4 -4
- package/dist/generators/ts/IdentifierType.d.ts +4 -4
- package/dist/generators/ts/IdentifierType.js +14 -14
- package/dist/generators/ts/IntType.d.ts +1 -1
- package/dist/generators/ts/IntType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +4 -2
- package/dist/generators/ts/IriType.js +27 -22
- package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
- package/dist/generators/ts/LazyObjectOptionType.js +7 -7
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +6 -6
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +5 -5
- package/dist/generators/ts/ListType.d.ts +5 -6
- package/dist/generators/ts/ListType.js +24 -25
- package/dist/generators/ts/LiteralType.d.ts +3 -2
- package/dist/generators/ts/LiteralType.js +14 -7
- package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +24 -24
- package/dist/generators/ts/ObjectType.js +350 -0
- package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
- package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +54 -64
- package/dist/generators/ts/OptionType.d.ts +2 -6
- package/dist/generators/ts/OptionType.js +12 -18
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
- package/dist/generators/ts/SetType.d.ts +1 -1
- package/dist/generators/ts/SetType.js +1 -1
- package/dist/generators/ts/Snippets.d.ts +1 -0
- package/dist/generators/ts/Snippets.js +7 -0
- package/dist/generators/ts/SparqlObjectSetType.js +2 -2
- package/dist/generators/ts/StringType.d.ts +3 -3
- package/dist/generators/ts/StringType.js +11 -6
- package/dist/generators/ts/TermType.d.ts +3 -3
- package/dist/generators/ts/TermType.js +13 -13
- package/dist/generators/ts/TsGenerator.js +12 -9
- package/dist/generators/ts/Type.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.d.ts +7 -8
- package/dist/generators/ts/TypeFactory.js +79 -80
- package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +40 -15
- package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +328 -135
- package/dist/generators/ts/ZodGenerator.js +7 -9
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +13 -13
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +11 -14
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +3 -2
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +24 -15
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +3 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +20 -12
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +7 -31
- 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/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +8 -8
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +5 -5
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
- 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} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- 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 +14 -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/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
- 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} +6 -6
- 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.d.ts +2 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +24 -28
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +16 -0
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +3 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateArray.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +1 -1
- package/dist/generators/ts/tsComment.js +1 -1
- package/dist/input/generated.d.ts +1399 -1468
- package/dist/input/generated.js +518 -655
- package/package.json +4 -4
- 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 -341
- 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_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_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- 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_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
- 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_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_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/removeUndefined.d.ts +0 -2
- package/dist/generators/ts/removeUndefined.js +0 -17
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
|
@@ -9,21 +9,21 @@ import { invariant } from "ts-invariant";
|
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
11
11
|
import { codeEquals } from "./codeEquals.js";
|
|
12
|
-
import { code
|
|
12
|
+
import { code } from "./ts-poet-wrapper.js";
|
|
13
13
|
export class OptionType extends AbstractContainerType {
|
|
14
14
|
discriminantProperty = Maybe.empty();
|
|
15
15
|
graphqlArgs = Maybe.empty();
|
|
16
|
-
kind = "
|
|
16
|
+
kind = "Option";
|
|
17
17
|
typeofs = ["object"];
|
|
18
18
|
get conversionFunction() {
|
|
19
19
|
const itemConversionFunction = this.itemType.conversionFunction.orDefault(this.itemConversionFunctionDefault);
|
|
20
20
|
return Maybe.of({
|
|
21
21
|
code: code `${this.reusables.snippets.convertToMaybe}(${itemConversionFunction.code})`,
|
|
22
22
|
sourceTypes: itemConversionFunction.sourceTypes.concat({
|
|
23
|
-
|
|
23
|
+
expression: this.expression,
|
|
24
24
|
typeof: "object",
|
|
25
25
|
}, {
|
|
26
|
-
|
|
26
|
+
expression: code `undefined`,
|
|
27
27
|
typeof: "undefined",
|
|
28
28
|
}),
|
|
29
29
|
});
|
|
@@ -31,8 +31,11 @@ export class OptionType extends AbstractContainerType {
|
|
|
31
31
|
get equalsFunction() {
|
|
32
32
|
return code `((left, right) => ${this.reusables.snippets.maybeEquals}(left, right, ${this.itemType.equalsFunction}))`;
|
|
33
33
|
}
|
|
34
|
+
get expression() {
|
|
35
|
+
return code `${this.reusables.imports.Maybe}<${this.itemType.expression}>`;
|
|
36
|
+
}
|
|
34
37
|
get filterFunction() {
|
|
35
|
-
return code `${this.reusables.snippets.filterMaybe}<${this.itemType.
|
|
38
|
+
return code `${this.reusables.snippets.filterMaybe}<${this.itemType.expression}, ${this.itemType.filterType}>(${this.itemType.filterFunction})`;
|
|
36
39
|
}
|
|
37
40
|
get filterType() {
|
|
38
41
|
return code `${this.reusables.snippets.MaybeFilter}<${this.itemType.filterType}>`;
|
|
@@ -49,9 +52,6 @@ export class OptionType extends AbstractContainerType {
|
|
|
49
52
|
get mutable() {
|
|
50
53
|
return this.itemType.mutable;
|
|
51
54
|
}
|
|
52
|
-
get name() {
|
|
53
|
-
return code `${this.reusables.imports.Maybe}<${this.itemType.name}>`;
|
|
54
|
-
}
|
|
55
55
|
get schemaType() {
|
|
56
56
|
return code `${this.reusables.snippets.MaybeSchema}<${this.itemType.schemaType}>`;
|
|
57
57
|
}
|
|
@@ -64,12 +64,6 @@ export class OptionType extends AbstractContainerType {
|
|
|
64
64
|
get valueSparqlWherePatternsFunction() {
|
|
65
65
|
return code `${this.reusables.snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
|
|
66
66
|
}
|
|
67
|
-
get schemaObject() {
|
|
68
|
-
return {
|
|
69
|
-
...super.schemaObject,
|
|
70
|
-
kind: code `${literalOf("Maybe")} as const`,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
67
|
fromJsonExpression({ variables, }) {
|
|
74
68
|
const expression = code `${this.reusables.imports.Maybe}.fromNullable(${variables.value})`;
|
|
75
69
|
const itemFromJsonExpression = this.itemType.fromJsonExpression({
|
|
@@ -79,7 +73,7 @@ export class OptionType extends AbstractContainerType {
|
|
|
79
73
|
}
|
|
80
74
|
fromRdfResourceValuesExpression(parameters) {
|
|
81
75
|
const { variables } = parameters;
|
|
82
|
-
return code `${this.itemType.fromRdfResourceValuesExpression(parameters)}.map(values => values.length > 0 ? values.map(value => ${this.reusables.imports.Maybe}.of(value)) : ${this.reusables.imports.Resource}.Values.fromValue<${this.reusables.imports.Maybe}<${this.itemType.
|
|
76
|
+
return code `${this.itemType.fromRdfResourceValuesExpression(parameters)}.map(values => values.length > 0 ? values.map(value => ${this.reusables.imports.Maybe}.of(value)) : ${this.reusables.imports.Resource}.Values.fromValue<${this.reusables.imports.Maybe}<${this.itemType.expression}>>({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: ${this.reusables.imports.Maybe}.empty() }))`;
|
|
83
77
|
}
|
|
84
78
|
graphqlResolveExpression(parameters) {
|
|
85
79
|
return code `${this.itemType.graphqlResolveExpression(parameters)}.extractNullable()`;
|
|
@@ -120,6 +114,9 @@ __decorate([
|
|
|
120
114
|
__decorate([
|
|
121
115
|
Memoize()
|
|
122
116
|
], OptionType.prototype, "equalsFunction", null);
|
|
117
|
+
__decorate([
|
|
118
|
+
Memoize()
|
|
119
|
+
], OptionType.prototype, "expression", null);
|
|
123
120
|
__decorate([
|
|
124
121
|
Memoize()
|
|
125
122
|
], OptionType.prototype, "filterFunction", null);
|
|
@@ -132,9 +129,6 @@ __decorate([
|
|
|
132
129
|
__decorate([
|
|
133
130
|
Memoize()
|
|
134
131
|
], OptionType.prototype, "hashFunction", null);
|
|
135
|
-
__decorate([
|
|
136
|
-
Memoize()
|
|
137
|
-
], OptionType.prototype, "name", null);
|
|
138
132
|
__decorate([
|
|
139
133
|
Memoize()
|
|
140
134
|
], OptionType.prototype, "schemaType", null);
|
|
@@ -56,7 +56,7 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
|
|
|
56
56
|
}`,
|
|
57
57
|
// objectSync
|
|
58
58
|
code `\
|
|
59
|
-
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${this.reusables.imports.Either}<Error, ${namedObjectType.
|
|
59
|
+
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${this.reusables.imports.Either}<Error, ${namedObjectType.expression}> {
|
|
60
60
|
return this.${methodSignatures.objects.name}Sync({ identifiers: [identifier], preferredLanguages: options?.preferredLanguages }).map(objects => objects[0]);
|
|
61
61
|
}`,
|
|
62
62
|
// objectCount
|
|
@@ -90,19 +90,19 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
90
90
|
const fromRdfTypes = namedObjectType.fromRdfTypeVariable
|
|
91
91
|
.toList()
|
|
92
92
|
.concat(namedObjectType.descendantFromRdfTypeVariables);
|
|
93
|
-
return code `{ filter: ${filterFunction}, fromRdfResource: ${namedObjectType.
|
|
93
|
+
return code `{ filter: ${filterFunction}, fromRdfResource: ${namedObjectType.expression}.fromRdfResource, fromRdfTypes: ${fromRdfTypes.length > 0 ? code `[${joinCode(fromRdfTypes, { on: ", " })}]` : "[]"} }`;
|
|
94
94
|
};
|
|
95
95
|
switch (namedObjectType.kind) {
|
|
96
|
-
case "
|
|
96
|
+
case "Object": {
|
|
97
97
|
return delegatingMethods.concat(code `\
|
|
98
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.
|
|
99
|
-
return this.#objectsSync<${namedObjectType.
|
|
98
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.expression}[]> {
|
|
99
|
+
return this.#objectsSync<${namedObjectType.expression}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
|
|
100
100
|
}`);
|
|
101
101
|
}
|
|
102
|
-
case "
|
|
102
|
+
case "ObjectUnion":
|
|
103
103
|
return delegatingMethods.concat(code `\
|
|
104
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.
|
|
105
|
-
return this.#objectUnionsSync<${namedObjectType.
|
|
104
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.expression}[]> {
|
|
105
|
+
return this.#objectUnionsSync<${namedObjectType.expression}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
|
|
106
106
|
${joinCode(namedObjectType.members.map((member) => runtimeObjectType(namedObjectType.filterFunction, member.type)), { on: ", " })}
|
|
107
107
|
], query);
|
|
108
108
|
}`);
|
|
@@ -2,7 +2,7 @@ import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
|
2
2
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
3
3
|
export declare class SetType<ItemTypeT extends SetType.ItemType> extends AbstractCollectionType<ItemTypeT> {
|
|
4
4
|
readonly graphqlArgs: AbstractCollectionType<ItemTypeT>["graphqlArgs"];
|
|
5
|
-
readonly kind = "
|
|
5
|
+
readonly kind = "Set";
|
|
6
6
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
7
7
|
get valueSparqlWherePatternsFunction(): Code;
|
|
8
8
|
fromRdfResourceValuesExpression(parameters: Parameters<AbstractCollectionType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
@@ -10,7 +10,7 @@ import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
|
10
10
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
11
11
|
export class SetType extends AbstractCollectionType {
|
|
12
12
|
graphqlArgs = Maybe.empty();
|
|
13
|
-
kind = "
|
|
13
|
+
kind = "Set";
|
|
14
14
|
get valueSparqlConstructTriplesFunction() {
|
|
15
15
|
return code `${this.reusables.snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
|
|
16
16
|
}
|
|
@@ -87,6 +87,7 @@ export declare class Snippets {
|
|
|
87
87
|
get decodeBigDecimalLiteral(): Snippet;
|
|
88
88
|
get deduplicateSparqlPatterns(): Snippet;
|
|
89
89
|
get defaultValueSparqlWherePatterns(): Snippet;
|
|
90
|
+
get ensureRdfResourceType(): Snippet;
|
|
90
91
|
get filterArray(): Snippet;
|
|
91
92
|
get filterBigDecimal(): Snippet;
|
|
92
93
|
get filterBlankNode(): Snippet;
|
|
@@ -45,6 +45,7 @@ import { snippets_decodeBigDecimalLiteral } from "./_snippets/snippets_decodeBig
|
|
|
45
45
|
import { snippets_deduplicateSparqlPatterns } from "./_snippets/snippets_deduplicateSparqlPatterns.js";
|
|
46
46
|
import { snippets_defaultValueSparqlWherePatterns } from "./_snippets/snippets_defaultValueSparqlWherePatterns.js";
|
|
47
47
|
import { snippets_EqualsResult } from "./_snippets/snippets_EqualsResult.js";
|
|
48
|
+
import { snippets_ensureRdfResourceType } from "./_snippets/snippets_ensureRdfResourceType.js";
|
|
48
49
|
import { snippets_FocusSparqlConstructTriplesFunction } from "./_snippets/snippets_FocusSparqlConstructTriplesFunction.js";
|
|
49
50
|
import { snippets_FocusSparqlWherePatternsFunction } from "./_snippets/snippets_FocusSparqlWherePatternsFunction.js";
|
|
50
51
|
import { snippets_FromRdfResourceFunction } from "./_snippets/snippets_FromRdfResourceFunction.js";
|
|
@@ -379,6 +380,9 @@ export class Snippets {
|
|
|
379
380
|
get defaultValueSparqlWherePatterns() {
|
|
380
381
|
return this.snippet(snippets_defaultValueSparqlWherePatterns);
|
|
381
382
|
}
|
|
383
|
+
get ensureRdfResourceType() {
|
|
384
|
+
return this.snippet(snippets_ensureRdfResourceType);
|
|
385
|
+
}
|
|
382
386
|
get filterArray() {
|
|
383
387
|
return this.snippet(snippets_filterArray);
|
|
384
388
|
}
|
|
@@ -827,6 +831,9 @@ __decorate([
|
|
|
827
831
|
__decorate([
|
|
828
832
|
Memoize()
|
|
829
833
|
], Snippets.prototype, "defaultValueSparqlWherePatterns", null);
|
|
834
|
+
__decorate([
|
|
835
|
+
Memoize()
|
|
836
|
+
], Snippets.prototype, "ensureRdfResourceType", null);
|
|
830
837
|
__decorate([
|
|
831
838
|
Memoize()
|
|
832
839
|
], Snippets.prototype, "filterArray", null);
|
|
@@ -42,7 +42,7 @@ ${joinCode([...this.namedObjectTypes, ...this.namedObjectUnionTypes].flatMap((na
|
|
|
42
42
|
const methodSignatures = this.methodSignatures(namedObjectType, {
|
|
43
43
|
queryT: `${syntheticNamePrefix}SparqlObjectSet.Query`,
|
|
44
44
|
});
|
|
45
|
-
const runtimeObjectType = namedObjectType.
|
|
45
|
+
const runtimeObjectType = namedObjectType.expression;
|
|
46
46
|
return [
|
|
47
47
|
code `\
|
|
48
48
|
async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${methodSignatures.object.returnType} {
|
|
@@ -58,7 +58,7 @@ async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdenti
|
|
|
58
58
|
}`,
|
|
59
59
|
code `\
|
|
60
60
|
async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}): ${methodSignatures.objects.returnType} {
|
|
61
|
-
return this.#objects<${namedObjectType.
|
|
61
|
+
return this.#objects<${namedObjectType.expression}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
|
|
62
62
|
}`,
|
|
63
63
|
];
|
|
64
64
|
}), { on: "\n\n" })}
|
|
@@ -6,11 +6,11 @@ export declare class StringType extends AbstractPrimitiveType<string> {
|
|
|
6
6
|
readonly filterType: Code;
|
|
7
7
|
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
8
|
readonly hashFunction: Code;
|
|
9
|
-
readonly kind = "
|
|
10
|
-
readonly schemaType: Code;
|
|
9
|
+
readonly kind = "String";
|
|
11
10
|
readonly typeofs: "string"[];
|
|
12
11
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
13
|
-
get
|
|
12
|
+
get expression(): Code;
|
|
13
|
+
get schemaType(): Code;
|
|
14
14
|
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<string>["jsonSchema"]>[0]): Code;
|
|
15
15
|
literalExpression(literal: Literal | string): Code;
|
|
16
16
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
@@ -13,15 +13,17 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
13
13
|
filterType = code `${this.reusables.snippets.StringFilter}`;
|
|
14
14
|
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
|
|
15
15
|
hashFunction = code `${this.reusables.snippets.hashString}`;
|
|
16
|
-
kind = "
|
|
17
|
-
schemaType = code `${this.reusables.snippets.StringSchema}`;
|
|
16
|
+
kind = "String";
|
|
18
17
|
typeofs = ["string"];
|
|
19
18
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.stringSparqlWherePatterns}`;
|
|
20
|
-
get
|
|
19
|
+
get expression() {
|
|
21
20
|
if (this.primitiveIn.length > 0) {
|
|
22
|
-
return `${this.primitiveIn.map((value) => `"${value}"`).join(" | ")}`;
|
|
21
|
+
return code `${this.primitiveIn.map((value) => `"${value}"`).join(" | ")}`;
|
|
23
22
|
}
|
|
24
|
-
return `string`;
|
|
23
|
+
return code `string`;
|
|
24
|
+
}
|
|
25
|
+
get schemaType() {
|
|
26
|
+
return code `${this.reusables.snippets.StringSchema}<${this.expression}>`;
|
|
25
27
|
}
|
|
26
28
|
jsonSchema(_parameters) {
|
|
27
29
|
switch (this.primitiveIn.length) {
|
|
@@ -48,5 +50,8 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
48
50
|
}
|
|
49
51
|
__decorate([
|
|
50
52
|
Memoize()
|
|
51
|
-
], StringType.prototype, "
|
|
53
|
+
], StringType.prototype, "expression", null);
|
|
54
|
+
__decorate([
|
|
55
|
+
Memoize()
|
|
56
|
+
], StringType.prototype, "schemaType", null);
|
|
52
57
|
//# sourceMappingURL=StringType.js.map
|
|
@@ -7,19 +7,19 @@ export declare class TermType<ConstantTermT extends Literal | NamedNode = Litera
|
|
|
7
7
|
readonly conversionFunction: Maybe<AbstractTermType.ConversionFunction>;
|
|
8
8
|
readonly filterFunction: Code;
|
|
9
9
|
readonly filterType: Code;
|
|
10
|
-
readonly kind = "
|
|
10
|
+
readonly kind = "Term";
|
|
11
11
|
readonly nodeKinds: ReadonlySet<NodeKind>;
|
|
12
12
|
readonly schemaType: Code;
|
|
13
13
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
14
14
|
constructor({ nodeKinds, ...superParameters }: ConstructorParameters<typeof AbstractTermType<ConstantTermT, RuntimeTermT>>[0] & {
|
|
15
15
|
nodeKinds: ReadonlySet<NodeKind>;
|
|
16
16
|
});
|
|
17
|
+
get expression(): Code;
|
|
17
18
|
get graphqlType(): AbstractTermType.GraphqlType;
|
|
18
|
-
get name(): Code;
|
|
19
19
|
fromJsonExpression({ variables, }: Parameters<AbstractTermType["fromJsonExpression"]>[0]): Code;
|
|
20
20
|
graphqlResolveExpression(_parameters: Parameters<AbstractTermType["graphqlResolveExpression"]>[0]): Code;
|
|
21
|
-
jsonType(): AbstractTermType.JsonType;
|
|
22
21
|
jsonSchema(_parameters: Parameters<AbstractTermType["jsonSchema"]>[0]): Code;
|
|
22
|
+
jsonType(): AbstractTermType.JsonType;
|
|
23
23
|
toJsonExpression({ variables, }: Parameters<AbstractTermType["toJsonExpression"]>[0]): Code;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=TermType.d.ts.map
|
|
@@ -15,7 +15,7 @@ export class TermType extends AbstractTermType {
|
|
|
15
15
|
conversionFunction = Maybe.empty();
|
|
16
16
|
filterFunction = code `${this.reusables.snippets.filterTerm}`;
|
|
17
17
|
filterType = code `${this.reusables.snippets.TermFilter}`;
|
|
18
|
-
kind = "
|
|
18
|
+
kind = "Term";
|
|
19
19
|
nodeKinds;
|
|
20
20
|
schemaType = code `${this.reusables.snippets.TermSchema}`;
|
|
21
21
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.termSparqlWherePatterns}`;
|
|
@@ -25,10 +25,7 @@ export class TermType extends AbstractTermType {
|
|
|
25
25
|
invariant(this.nodeKinds.has("Literal") &&
|
|
26
26
|
(this.nodeKinds.has("BlankNode") || this.nodeKinds.has("IRI")), "should be IdentifierType or LiteralType");
|
|
27
27
|
}
|
|
28
|
-
get
|
|
29
|
-
throw new Error("not implemented");
|
|
30
|
-
}
|
|
31
|
-
get name() {
|
|
28
|
+
get expression() {
|
|
32
29
|
return code `(${joinCode([...this.nodeKinds]
|
|
33
30
|
.map((nodeKind) => {
|
|
34
31
|
switch (nodeKind) {
|
|
@@ -45,8 +42,11 @@ export class TermType extends AbstractTermType {
|
|
|
45
42
|
})
|
|
46
43
|
.map((import_) => code `${import_}`), { on: " | " })})`;
|
|
47
44
|
}
|
|
45
|
+
get graphqlType() {
|
|
46
|
+
throw new Error("not implemented");
|
|
47
|
+
}
|
|
48
48
|
fromJsonExpression({ variables, }) {
|
|
49
|
-
return code `${this.reusables.imports.Either}.of<Error, ${this.
|
|
49
|
+
return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${[
|
|
50
50
|
...this.nodeKinds,
|
|
51
51
|
].reduce((expression, nodeKind) => {
|
|
52
52
|
let valueToNodeKind;
|
|
@@ -71,12 +71,6 @@ export class TermType extends AbstractTermType {
|
|
|
71
71
|
graphqlResolveExpression(_parameters) {
|
|
72
72
|
throw new Error("not implemented");
|
|
73
73
|
}
|
|
74
|
-
jsonType() {
|
|
75
|
-
return new AbstractTermType.JsonType(code `{ readonly "@id": string, readonly termType: ${[...this.nodeKinds]
|
|
76
|
-
.filter((nodeKind) => nodeKind !== "Literal")
|
|
77
|
-
.map((nodeKind) => `"${NodeKind.toTermType(nodeKind)}"`)
|
|
78
|
-
.join(" | ")} } | { readonly "@language"?: string, readonly "@type"?: string, readonly "@value": string, readonly termType: "Literal" }`);
|
|
79
|
-
}
|
|
80
74
|
jsonSchema(_parameters) {
|
|
81
75
|
return code `${this.reusables.imports.z}.discriminatedUnion("termType", [${joinCode([...this.nodeKinds].map((nodeKind) => {
|
|
82
76
|
switch (nodeKind) {
|
|
@@ -90,6 +84,12 @@ export class TermType extends AbstractTermType {
|
|
|
90
84
|
}
|
|
91
85
|
}), { on: "," })}])`;
|
|
92
86
|
}
|
|
87
|
+
jsonType() {
|
|
88
|
+
return new AbstractTermType.JsonType(code `{ readonly "@id": string, readonly termType: ${[...this.nodeKinds]
|
|
89
|
+
.filter((nodeKind) => nodeKind !== "Literal")
|
|
90
|
+
.map((nodeKind) => `"${NodeKind.toTermType(nodeKind)}"`)
|
|
91
|
+
.join(" | ")} } | { readonly "@language"?: string, readonly "@type"?: string, readonly "@value": string, readonly termType: "Literal" }`);
|
|
92
|
+
}
|
|
93
93
|
toJsonExpression({ variables, }) {
|
|
94
94
|
return [...this.nodeKinds].reduce((expression, nodeKind) => {
|
|
95
95
|
let valueToNodeKind;
|
|
@@ -114,7 +114,7 @@ export class TermType extends AbstractTermType {
|
|
|
114
114
|
}
|
|
115
115
|
__decorate([
|
|
116
116
|
Memoize()
|
|
117
|
-
], TermType.prototype, "
|
|
117
|
+
], TermType.prototype, "expression", null);
|
|
118
118
|
__decorate([
|
|
119
119
|
Memoize()
|
|
120
120
|
], TermType.prototype, "jsonType", null);
|
|
@@ -5,8 +5,8 @@ import { BlankNodeType } from "./BlankNodeType.js";
|
|
|
5
5
|
import { GraphqlSchema } from "./GraphqlSchema.js";
|
|
6
6
|
import { IdentifierType } from "./IdentifierType.js";
|
|
7
7
|
import { IriType } from "./IriType.js";
|
|
8
|
-
import { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
9
8
|
import { ObjectSetType } from "./ObjectSetType.js";
|
|
9
|
+
import { ObjectUnionType } from "./ObjectUnionType.js";
|
|
10
10
|
import { RdfjsDatasetObjectSetType } from "./RdfjsDatasetObjectSetType.js";
|
|
11
11
|
import { Reusables } from "./Reusables.js";
|
|
12
12
|
import { SparqlObjectSetType } from "./SparqlObjectSetType.js";
|
|
@@ -42,23 +42,23 @@ export class TsGenerator {
|
|
|
42
42
|
}
|
|
43
43
|
declarations = declarations.concat(typeFactory.createType(astNamedUnionType).declaration.toList());
|
|
44
44
|
}
|
|
45
|
-
const namedObjectTypesToposorted = ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.
|
|
45
|
+
const namedObjectTypesToposorted = ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.createObjectType(astObjectType));
|
|
46
46
|
const namedObjectUnionTypesToposorted = ast_.namedUnionTypes
|
|
47
47
|
.filter((_) => _.isObjectUnionType())
|
|
48
|
-
.map((astObjectUnionType) => typeFactory.
|
|
48
|
+
.map((astObjectUnionType) => typeFactory.createObjectUnionType(astObjectUnionType));
|
|
49
49
|
for (const namedObjectType of namedObjectTypesToposorted) {
|
|
50
50
|
declarations = declarations.concat(namedObjectType.declaration.toList());
|
|
51
51
|
}
|
|
52
52
|
for (const namedObjectUnionType of namedObjectUnionTypesToposorted) {
|
|
53
53
|
declarations = declarations.concat(namedObjectUnionType.declaration.toList());
|
|
54
54
|
}
|
|
55
|
-
const namedObjectTypesNameSorted = namedObjectTypesToposorted.toSorted((left, right) => left.
|
|
56
|
-
const namedObjectUnionTypesNameSorted = namedObjectUnionTypesToposorted.toSorted((left, right) => left.
|
|
55
|
+
const namedObjectTypesNameSorted = namedObjectTypesToposorted.toSorted((left, right) => left.alias.unsafeCoerce().localeCompare(right.alias.unsafeCoerce()));
|
|
56
|
+
const namedObjectUnionTypesNameSorted = namedObjectUnionTypesToposorted.toSorted((left, right) => left.alias.unsafeCoerce().localeCompare(right.alias.unsafeCoerce()));
|
|
57
57
|
switch (namedObjectTypesNameSorted.length) {
|
|
58
58
|
case 0:
|
|
59
59
|
break;
|
|
60
60
|
case 1:
|
|
61
|
-
declarations.push(code `type ${configuration.syntheticNamePrefix}Object = ${namedObjectTypesNameSorted[0].
|
|
61
|
+
declarations.push(code `type ${configuration.syntheticNamePrefix}Object = ${namedObjectTypesNameSorted[0].expression};`);
|
|
62
62
|
break;
|
|
63
63
|
default: {
|
|
64
64
|
const uberObjectUnionType = this.synthesizeUberObjectUnionType({
|
|
@@ -127,6 +127,7 @@ export class TsGenerator {
|
|
|
127
127
|
let identifierType;
|
|
128
128
|
if (nodeKinds.size === 2) {
|
|
129
129
|
identifierType = new IdentifierType({
|
|
130
|
+
alias: Maybe.empty(),
|
|
130
131
|
comment: Maybe.empty(),
|
|
131
132
|
configuration,
|
|
132
133
|
label: Maybe.empty(),
|
|
@@ -138,6 +139,7 @@ export class TsGenerator {
|
|
|
138
139
|
switch ([...nodeKinds][0]) {
|
|
139
140
|
case "BlankNode":
|
|
140
141
|
identifierType = new BlankNodeType({
|
|
142
|
+
alias: Maybe.empty(),
|
|
141
143
|
comment: Maybe.empty(),
|
|
142
144
|
configuration,
|
|
143
145
|
label: Maybe.empty(),
|
|
@@ -147,6 +149,7 @@ export class TsGenerator {
|
|
|
147
149
|
break;
|
|
148
150
|
case "IRI":
|
|
149
151
|
identifierType = new IriType({
|
|
152
|
+
alias: Maybe.empty(),
|
|
150
153
|
comment: Maybe.empty(),
|
|
151
154
|
configuration,
|
|
152
155
|
hasValues: [],
|
|
@@ -158,17 +161,17 @@ export class TsGenerator {
|
|
|
158
161
|
break;
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
|
-
return new
|
|
164
|
+
return new ObjectUnionType({
|
|
165
|
+
alias: Maybe.of(`${configuration.syntheticNamePrefix}Object`),
|
|
162
166
|
comment: Maybe.empty(),
|
|
163
167
|
configuration,
|
|
164
|
-
identifierType,
|
|
168
|
+
identifierType: Maybe.of(identifierType),
|
|
165
169
|
label: Maybe.empty(),
|
|
166
170
|
logger: this.logger,
|
|
167
171
|
members: filteredNamedObjectTypes.map((namedObjectType) => ({
|
|
168
172
|
discriminantValue: Maybe.empty(),
|
|
169
173
|
type: namedObjectType,
|
|
170
174
|
})),
|
|
171
|
-
name: `${configuration.syntheticNamePrefix}Object`,
|
|
172
175
|
recursive: false,
|
|
173
176
|
reusables,
|
|
174
177
|
synthetic: true,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AnonymousUnionType } from "./AnonymousUnionType.js";
|
|
2
1
|
import type { BigDecimalType } from "./BigDecimalType.js";
|
|
3
2
|
import type { BigIntType } from "./BigIntType.js";
|
|
4
3
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
@@ -15,12 +14,12 @@ import type { LazyObjectSetType } from "./LazyObjectSetType.js";
|
|
|
15
14
|
import type { LazyObjectType } from "./LazyObjectType.js";
|
|
16
15
|
import type { ListType } from "./ListType.js";
|
|
17
16
|
import type { LiteralType } from "./LiteralType.js";
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type { NamedUnionType } from "./NamedUnionType.js";
|
|
17
|
+
import type { ObjectType } from "./ObjectType.js";
|
|
18
|
+
import type { ObjectUnionType } from "./ObjectUnionType.js";
|
|
21
19
|
import type { OptionType } from "./OptionType.js";
|
|
22
20
|
import type { SetType } from "./SetType.js";
|
|
23
21
|
import type { StringType } from "./StringType.js";
|
|
24
22
|
import type { TermType } from "./TermType.js";
|
|
25
|
-
|
|
23
|
+
import type { UnionType } from "./UnionType.js";
|
|
24
|
+
export type Type = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | DefaultValueType<DefaultValueType.ItemType> | FloatType | IdentifierType | IntType | IriType | LazyObjectOptionType | LazyObjectSetType | LazyObjectType | ListType<ListType.ItemType> | LiteralType | ObjectUnionType | ObjectType | OptionType<OptionType.ItemType> | SetType<SetType.ItemType> | StringType | TermType | UnionType<Type>;
|
|
26
25
|
//# sourceMappingURL=Type.d.ts.map
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import type { Literal, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import type { Logger } from "ts-log";
|
|
3
3
|
import * as ast from "../../ast/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
7
|
-
import { NamedUnionType } from "./NamedUnionType.js";
|
|
4
|
+
import { ObjectType } from "./ObjectType.js";
|
|
5
|
+
import { ObjectUnionType } from "./ObjectUnionType.js";
|
|
8
6
|
import type { Reusables } from "./Reusables.js";
|
|
9
7
|
import type { TsGenerator } from "./TsGenerator.js";
|
|
10
8
|
import type { Type } from "./Type.js";
|
|
9
|
+
import { UnionType } from "./UnionType.js";
|
|
11
10
|
export declare class TypeFactory {
|
|
12
11
|
private readonly configuration;
|
|
13
12
|
private readonly logger;
|
|
14
13
|
private readonly reusables;
|
|
15
|
-
private
|
|
14
|
+
private cachedObjectUnionTypesByShapeIdentifier;
|
|
16
15
|
private cachedObjectTypePropertiesByShapeIdentifier;
|
|
17
16
|
private cachedObjectTypesByShapeIdentifier;
|
|
18
17
|
constructor({ configuration, logger, reusables, }: {
|
|
@@ -20,12 +19,12 @@ export declare class TypeFactory {
|
|
|
20
19
|
logger: Logger;
|
|
21
20
|
reusables: Reusables;
|
|
22
21
|
});
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
createObjectType(astType: ast.ObjectType): ObjectType;
|
|
23
|
+
createObjectUnionType(astType: ast.ObjectUnionType): ObjectUnionType;
|
|
25
24
|
createType(astType: ast.Type, parameters?: {
|
|
26
25
|
defaultValue?: Literal | NamedNode;
|
|
27
26
|
}): Type;
|
|
28
|
-
createUnionType(astType: ast.UnionType):
|
|
27
|
+
createUnionType(astType: ast.UnionType): ObjectUnionType | UnionType<Type>;
|
|
29
28
|
private createBlankNodeType;
|
|
30
29
|
private createDefaultValueType;
|
|
31
30
|
private createIdentifierType;
|