@shaclmate/compiler 4.0.8 → 4.0.10
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/Compiler.d.ts +1 -4
- package/dist/Compiler.js +1 -5
- package/dist/ShapesGraphToAstTransformer.d.ts +2 -11
- package/dist/ShapesGraphToAstTransformer.js +25 -27
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +3 -0
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +5 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +4 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +27 -0
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +74 -19
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +45 -91
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +146 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +7 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +182 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +9 -7
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +3 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +33 -10
- package/dist/ast/AbstractCompoundType.d.ts +26 -8
- package/dist/ast/AbstractCompoundType.js +84 -16
- package/dist/ast/AbstractContainerType.d.ts +2 -4
- package/dist/ast/AbstractContainerType.js +3 -4
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -0
- package/dist/ast/AbstractLazyObjectType.js +3 -0
- package/dist/ast/AbstractTermType.d.ts +1 -0
- package/dist/ast/AbstractTermType.js +1 -0
- package/dist/ast/AbstractType.d.ts +16 -1
- package/dist/ast/AbstractType.js +11 -1
- package/dist/ast/Ast.d.ts +5 -5
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -2
- package/dist/ast/DefaultValueType.js +2 -0
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IntersectionType.d.ts +7 -2
- package/dist/ast/IntersectionType.js +8 -0
- package/dist/ast/ListType.d.ts +2 -9
- package/dist/ast/ListType.js +1 -9
- package/dist/ast/LiteralType.d.ts +1 -0
- package/dist/ast/LiteralType.js +26 -0
- package/dist/ast/ObjectCompoundType.d.ts +12 -0
- package/dist/ast/ObjectCompoundType.js +88 -0
- package/dist/ast/ObjectIntersectionType.d.ts +3 -7
- package/dist/ast/ObjectIntersectionType.js +1 -7
- package/dist/ast/ObjectType.d.ts +14 -31
- package/dist/ast/ObjectType.js +41 -73
- package/dist/ast/ObjectUnionType.d.ts +3 -7
- package/dist/ast/ObjectUnionType.js +1 -7
- package/dist/ast/OptionType.d.ts +1 -2
- package/dist/ast/OptionType.js +2 -0
- package/dist/ast/SetType.d.ts +1 -2
- package/dist/ast/SetType.js +2 -0
- package/dist/ast/Type.d.ts +1 -4
- package/dist/ast/Type.js +0 -6
- package/dist/ast/UnionType.d.ts +11 -6
- package/dist/ast/UnionType.js +6 -4
- package/dist/ast/index.d.ts +1 -2
- package/dist/ast/index.js +1 -2
- package/dist/generators/json/AstJsonGenerator.js +17 -15
- package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
- package/dist/generators/ts/AbstractCollectionType.js +10 -12
- package/dist/generators/ts/AbstractContainerType.d.ts +9 -4
- package/dist/generators/ts/AbstractContainerType.js +10 -3
- package/dist/generators/ts/AbstractDateType.d.ts +2 -2
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractIdentifierType.js +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +13 -10
- package/dist/generators/ts/AbstractLazyObjectType.js +21 -16
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +33 -0
- package/dist/generators/ts/AbstractNamedUnionType.js +195 -0
- package/dist/generators/ts/AbstractNumericType.d.ts +3 -3
- package/dist/generators/ts/AbstractNumericType.js +4 -4
- package/dist/generators/ts/AbstractTermType.d.ts +7 -4
- package/dist/generators/ts/AbstractTermType.js +7 -4
- package/dist/generators/ts/AbstractType.d.ts +34 -19
- package/dist/generators/ts/AbstractUnionType.d.ts +80 -0
- package/dist/generators/ts/AbstractUnionType.js +514 -0
- package/dist/generators/ts/AnonymousUnionType.d.ts +26 -0
- package/dist/generators/ts/AnonymousUnionType.js +56 -0
- package/dist/generators/ts/BigDecimalType.d.ts +4 -4
- package/dist/generators/ts/BigDecimalType.js +5 -5
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +2 -2
- package/dist/generators/ts/BlankNodeType.js +2 -2
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +3 -3
- 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 +5 -5
- package/dist/generators/ts/DefaultValueType.js +17 -16
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +2 -2
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +2 -2
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +10 -10
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +8 -8
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +9 -10
- package/dist/generators/ts/ListType.d.ts +9 -8
- package/dist/generators/ts/ListType.js +15 -14
- package/dist/generators/ts/LiteralType.d.ts +2 -2
- package/dist/generators/ts/LiteralType.js +3 -3
- package/dist/generators/ts/NamedObjectType.d.ts +126 -0
- package/dist/generators/ts/NamedObjectType.js +420 -0
- package/dist/generators/ts/NamedObjectUnionType.d.ts +35 -0
- package/dist/generators/ts/NamedObjectUnionType.js +217 -0
- package/dist/generators/ts/NamedUnionType.d.ts +11 -0
- package/dist/generators/ts/NamedUnionType.js +13 -0
- package/dist/generators/ts/OptionType.d.ts +5 -5
- package/dist/generators/ts/OptionType.js +12 -12
- package/dist/generators/ts/SetType.d.ts +4 -4
- package/dist/generators/ts/SetType.js +13 -11
- package/dist/generators/ts/StringType.d.ts +3 -3
- package/dist/generators/ts/StringType.js +3 -3
- package/dist/generators/ts/TermType.d.ts +2 -2
- package/dist/generators/ts/TermType.js +3 -3
- package/dist/generators/ts/TsGenerator.js +28 -20
- package/dist/generators/ts/Type.d.ts +5 -4
- package/dist/generators/ts/TypeFactory.d.ts +9 -7
- package/dist/generators/ts/TypeFactory.js +139 -112
- package/dist/generators/ts/ZodGenerator.js +18 -16
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.d.ts +9 -9
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.d.ts → _NamedObjectType/DiscriminantProperty.d.ts} +14 -14
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.js → _NamedObjectType/DiscriminantProperty.js} +22 -20
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.js +6 -6
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.js +31 -28
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_classDeclaration.js → _NamedObjectType/NamedObjectType_classDeclaration.js} +15 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_createFunctionDeclaration.js → _NamedObjectType/NamedObjectType_createFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterFunctionDeclaration.js → _NamedObjectType/NamedObjectType_filterFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterTypeDeclaration.js → _NamedObjectType/NamedObjectType_filterTypeDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +6 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.js → _NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js} +6 -7
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfTypeVariableStatement.js → _NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_graphqlTypeVariableStatement.js → _NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js → _NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_interfaceDeclaration.js → _NamedObjectType/NamedObjectType_interfaceDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_isTypeFunctionDeclaration.js → _NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +19 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonTypeAliasDeclaration.js → _NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_objectSetMethodNames.js → _NamedObjectType/NamedObjectType_objectSetMethodNames.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +38 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +16 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_schemaVariableStatement.js → _NamedObjectType/NamedObjectType_schemaVariableStatement.js} +3 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +10 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +13 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +15 -0
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.d.ts +2 -2
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.js +14 -14
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +12 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +14 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +17 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +5 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +35 -0
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +7 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +1 -1
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +2 -2
- 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_literalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +2 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +4 -3
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -2
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +4 -4
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +25 -25
- package/dist/generators/ts/imports.d.ts +1 -1
- package/dist/generators/ts/imports.js +1 -1
- package/dist/generators/ts/objectSetDeclarations.d.ts +5 -5
- package/dist/generators/ts/objectSetDeclarations.js +34 -31
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +5 -5
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +6 -4
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +4 -4
- package/dist/generators/ts/objectSetMethodSignatures.js +9 -9
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +54 -53
- package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
- package/dist/generators/ts/singleEntryRecord.js +6 -0
- package/dist/generators/ts/snippets.d.ts +10 -6
- package/dist/generators/ts/snippets.js +20 -12
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +19 -20
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +4 -4
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +14 -9
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +5 -5
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +2 -2
- package/dist/input/NodeShape.d.ts +0 -1
- package/dist/input/NodeShape.js +0 -3
- package/dist/input/ShapesGraph.d.ts +3 -2
- package/dist/input/ShapesGraph.js +12 -7
- package/dist/input/generated.d.ts +1899 -88
- package/dist/input/generated.js +676 -564
- package/package.json +5 -7
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
- package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
- package/dist/ast/AbstractObjectCompoundType.js +0 -180
- package/dist/ast/Curie.d.ts +0 -21
- package/dist/ast/Curie.js +0 -29
- package/dist/ast/PlaceholderType.d.ts +0 -15
- package/dist/ast/PlaceholderType.js +0 -19
- package/dist/generators/codeName.d.ts +0 -6
- package/dist/generators/codeName.js +0 -66
- package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
- package/dist/generators/ts/AbstractDeclaredType.js +0 -17
- package/dist/generators/ts/ObjectType.d.ts +0 -117
- package/dist/generators/ts/ObjectType.js +0 -402
- package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
- package/dist/generators/ts/ObjectUnionType.js +0 -257
- package/dist/generators/ts/UnionType.d.ts +0 -40
- package/dist/generators/ts/UnionType.js +0 -527
- package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
- package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/identifierTypeDeclarations.js +0 -0
|
@@ -17,7 +17,7 @@ export class AbstractDateType extends AbstractPrimitiveType {
|
|
|
17
17
|
mutable = false;
|
|
18
18
|
name = "Date";
|
|
19
19
|
schemaType = code `${snippets.DateSchema}`;
|
|
20
|
-
|
|
20
|
+
valueSparqlWherePatternsFunction = code `${snippets.dateSparqlWherePatterns}`;
|
|
21
21
|
typeofs = NonEmptyList(["object"]);
|
|
22
22
|
get conversions() {
|
|
23
23
|
return [
|
|
@@ -48,7 +48,7 @@ export class AbstractDateType extends AbstractPrimitiveType {
|
|
|
48
48
|
jsonType() {
|
|
49
49
|
return new AbstractPrimitiveType.JsonType(code `string`);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
52
52
|
return code `[${snippets.literalFactory}.date(${variables.value}, ${rdfjsTermExpression(this.datatype)})]`;
|
|
53
53
|
}
|
|
54
54
|
fromRdfExpressionChain({ variables, }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import type { IdentifierNodeKind } from "@shaclmate/shacl-ast";
|
|
3
|
-
import { type Code } from "ts-poet";
|
|
4
3
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
4
|
+
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
5
|
export declare abstract class AbstractIdentifierType<IdentifierT extends BlankNode | NamedNode> extends AbstractTermType<NamedNode, IdentifierT> {
|
|
6
6
|
abstract readonly fromStringFunction: Code;
|
|
7
7
|
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
@@ -4,10 +4,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { code } from "ts-poet";
|
|
8
7
|
import { Memoize } from "typescript-memoize";
|
|
9
8
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
10
9
|
import { imports } from "./imports.js";
|
|
10
|
+
import { code } from "./ts-poet-wrapper.js";
|
|
11
11
|
export class AbstractIdentifierType extends AbstractTermType {
|
|
12
12
|
graphqlType = new AbstractTermType.GraphqlType(code `${imports.GraphQLString}`);
|
|
13
13
|
toStringFunction = // Re-export rdfjsResource.Resource.Identifier.toString
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Maybe, NonEmptyList } from "purify-ts";
|
|
2
2
|
import { AbstractType } from "./AbstractType.js";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
4
|
+
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
5
5
|
import type { OptionType } from "./OptionType.js";
|
|
6
6
|
import type { SetType } from "./SetType.js";
|
|
7
7
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
@@ -13,6 +13,8 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
13
13
|
readonly partialPropertyName: string;
|
|
14
14
|
readonly rawName: Code;
|
|
15
15
|
};
|
|
16
|
+
readonly abstract = false;
|
|
17
|
+
readonly declaration: Maybe<Code>;
|
|
16
18
|
readonly discriminantProperty: AbstractType["discriminantProperty"];
|
|
17
19
|
readonly mutable = false;
|
|
18
20
|
readonly typeofs: NonEmptyList<"object">;
|
|
@@ -27,10 +29,11 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
27
29
|
get filterType(): Code;
|
|
28
30
|
get graphqlType(): AbstractType.GraphqlType;
|
|
29
31
|
get name(): Code;
|
|
32
|
+
get recursive(): boolean;
|
|
30
33
|
get schema(): Code;
|
|
31
34
|
get schemaType(): Code;
|
|
32
|
-
get
|
|
33
|
-
get
|
|
35
|
+
get valueSparqlConstructTriplesFunction(): Code;
|
|
36
|
+
get valueSparqlWherePatternsFunction(): Code;
|
|
34
37
|
protected get schemaObject(): {
|
|
35
38
|
partial: Code;
|
|
36
39
|
kind: Code;
|
|
@@ -38,19 +41,19 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
38
41
|
hashStatements({ depth, variables, }: Parameters<AbstractType["hashStatements"]>[0]): readonly Code[];
|
|
39
42
|
jsonType(parameters?: Parameters<AbstractType["jsonType"]>[0]): AbstractType.JsonType;
|
|
40
43
|
jsonUiSchemaElement(parameters: Parameters<AbstractType["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
41
|
-
|
|
44
|
+
jsonSchema(parameters: Parameters<AbstractType["jsonSchema"]>[0]): Code;
|
|
42
45
|
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
43
|
-
|
|
44
|
-
protected
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
47
|
+
protected resolvedNamedObjectUnionTypeToPartialNamedObjectUnionTypeConversion({ resolvedNamedObjectUnionType, partialNamedObjectUnionType, variables, }: {
|
|
48
|
+
resolvedNamedObjectUnionType: NamedObjectUnionType;
|
|
49
|
+
partialNamedObjectUnionType: NamedObjectUnionType;
|
|
47
50
|
variables: {
|
|
48
51
|
resolvedObjectUnion: Code;
|
|
49
52
|
};
|
|
50
53
|
}): Code;
|
|
51
54
|
}
|
|
52
55
|
export declare namespace AbstractLazyObjectType {
|
|
53
|
-
type ObjectTypeConstraint =
|
|
56
|
+
type ObjectTypeConstraint = NamedObjectType | NamedObjectUnionType;
|
|
54
57
|
type PartialTypeConstraint = ObjectTypeConstraint | OptionType<ObjectTypeConstraint> | SetType<ObjectTypeConstraint>;
|
|
55
58
|
type ResolveTypeConstraint = PartialTypeConstraint;
|
|
56
59
|
type Conversion = AbstractType.Conversion;
|
|
@@ -14,6 +14,8 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
14
14
|
partialType;
|
|
15
15
|
resolveType;
|
|
16
16
|
runtimeClass;
|
|
17
|
+
abstract = false;
|
|
18
|
+
declaration = Maybe.empty();
|
|
17
19
|
discriminantProperty = Maybe.empty();
|
|
18
20
|
mutable = false;
|
|
19
21
|
typeofs = NonEmptyList(["object"]);
|
|
@@ -48,6 +50,9 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
48
50
|
get name() {
|
|
49
51
|
return this.runtimeClass.name;
|
|
50
52
|
}
|
|
53
|
+
get recursive() {
|
|
54
|
+
return this.partialType.recursive;
|
|
55
|
+
}
|
|
51
56
|
get schema() {
|
|
52
57
|
return code `${removeUndefined(this.schemaObject)}`;
|
|
53
58
|
}
|
|
@@ -58,11 +63,11 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
58
63
|
resolveType: this.resolveType.schemaType,
|
|
59
64
|
}}`;
|
|
60
65
|
}
|
|
61
|
-
get
|
|
62
|
-
return code `(({ schema, ...otherParameters }) => ${this.partialType.
|
|
66
|
+
get valueSparqlConstructTriplesFunction() {
|
|
67
|
+
return code `(({ schema, ...otherParameters }) => ${this.partialType.valueSparqlConstructTriplesFunction}({ ...otherParameters, schema: schema.partial() }))`;
|
|
63
68
|
}
|
|
64
|
-
get
|
|
65
|
-
return code `(({ schema, ...otherParameters }) => ${this.partialType.
|
|
69
|
+
get valueSparqlWherePatternsFunction() {
|
|
70
|
+
return code `(({ schema, ...otherParameters }) => ${this.partialType.valueSparqlWherePatternsFunction}({ ...otherParameters, schema: schema.partial() }))`;
|
|
66
71
|
}
|
|
67
72
|
get schemaObject() {
|
|
68
73
|
return {
|
|
@@ -87,8 +92,8 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
87
92
|
jsonUiSchemaElement(parameters) {
|
|
88
93
|
return this.partialType.jsonUiSchemaElement(parameters);
|
|
89
94
|
}
|
|
90
|
-
|
|
91
|
-
return this.partialType.
|
|
95
|
+
jsonSchema(parameters) {
|
|
96
|
+
return this.partialType.jsonSchema(parameters);
|
|
92
97
|
}
|
|
93
98
|
toJsonExpression({ variables, }) {
|
|
94
99
|
return this.partialType.toJsonExpression({
|
|
@@ -97,22 +102,22 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
97
102
|
},
|
|
98
103
|
});
|
|
99
104
|
}
|
|
100
|
-
|
|
101
|
-
return this.partialType.
|
|
105
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
106
|
+
return this.partialType.toRdfResourceValuesExpression({
|
|
102
107
|
variables: {
|
|
103
108
|
...variables,
|
|
104
109
|
value: code `${variables.value}.${this.runtimeClass.partialPropertyName}`,
|
|
105
110
|
},
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
|
-
|
|
109
|
-
invariant(
|
|
110
|
-
|
|
111
|
-
const caseBlocks =
|
|
112
|
-
return code `${
|
|
113
|
+
resolvedNamedObjectUnionTypeToPartialNamedObjectUnionTypeConversion({ resolvedNamedObjectUnionType, partialNamedObjectUnionType, variables, }) {
|
|
114
|
+
invariant(resolvedNamedObjectUnionType.members.length ===
|
|
115
|
+
partialNamedObjectUnionType.members.length);
|
|
116
|
+
const caseBlocks = resolvedNamedObjectUnionType.members.map(({ discriminantValues }, memberI) => {
|
|
117
|
+
return code `${discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join("\n")} return ${partialNamedObjectUnionType.members[memberI].type.newExpression({ parameters: variables.resolvedObjectUnion })};`;
|
|
113
118
|
});
|
|
114
119
|
caseBlocks.push(code `default: ${variables.resolvedObjectUnion} satisfies never; throw new Error("unrecognized type");`);
|
|
115
|
-
return code `switch (${variables.resolvedObjectUnion}.${
|
|
120
|
+
return code `switch (${variables.resolvedObjectUnion}.${resolvedNamedObjectUnionType.discriminantProperty.unsafeCoerce().name}) { ${joinCode(caseBlocks)} }`;
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
__decorate([
|
|
@@ -129,10 +134,10 @@ __decorate([
|
|
|
129
134
|
], AbstractLazyObjectType.prototype, "schemaType", null);
|
|
130
135
|
__decorate([
|
|
131
136
|
Memoize()
|
|
132
|
-
], AbstractLazyObjectType.prototype, "
|
|
137
|
+
], AbstractLazyObjectType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
133
138
|
__decorate([
|
|
134
139
|
Memoize()
|
|
135
|
-
], AbstractLazyObjectType.prototype, "
|
|
140
|
+
], AbstractLazyObjectType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
136
141
|
(function (AbstractLazyObjectType) {
|
|
137
142
|
AbstractLazyObjectType.GraphqlType = AbstractType.GraphqlType;
|
|
138
143
|
AbstractLazyObjectType.JsonType = AbstractType.JsonType;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { TsFeature } from "../../enums/TsFeature.js";
|
|
3
|
+
import { AbstractType } from "./AbstractType.js";
|
|
4
|
+
import { AbstractUnionType } from "./AbstractUnionType.js";
|
|
5
|
+
import type { Type } from "./Type.js";
|
|
6
|
+
import { type Code } from "./ts-poet-wrapper.js";
|
|
7
|
+
export declare abstract class AbstractNamedUnionType<MemberTypeT extends Type> extends AbstractUnionType<MemberTypeT> {
|
|
8
|
+
protected readonly _name: string;
|
|
9
|
+
readonly features: ReadonlySet<TsFeature>;
|
|
10
|
+
constructor({ features, name, ...superParameters }: {
|
|
11
|
+
features: ReadonlySet<TsFeature>;
|
|
12
|
+
name: string;
|
|
13
|
+
} & ConstructorParameters<typeof AbstractUnionType<MemberTypeT>>[0]);
|
|
14
|
+
get declaration(): Maybe<Code>;
|
|
15
|
+
get equalsFunction(): Code;
|
|
16
|
+
get filterFunction(): Code;
|
|
17
|
+
get filterType(): Code;
|
|
18
|
+
get jsonTypeAliasDeclaration(): Code;
|
|
19
|
+
get jsonSchemaFunctionDeclaration(): Code;
|
|
20
|
+
get name(): string;
|
|
21
|
+
get staticModuleName(): string;
|
|
22
|
+
get valueSparqlConstructTriplesFunction(): Code;
|
|
23
|
+
get valueSparqlWherePatternsFunction(): Code;
|
|
24
|
+
protected get staticModuleDeclarations(): Record<string, Code>;
|
|
25
|
+
fromJsonExpression({ variables, }: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
|
|
26
|
+
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
27
|
+
hashStatements({ depth, variables, }: Parameters<AbstractType["hashStatements"]>[0]): readonly Code[];
|
|
28
|
+
jsonType(): AbstractType.JsonType;
|
|
29
|
+
jsonSchema({ context, }: Parameters<AbstractType["jsonSchema"]>[0]): Code;
|
|
30
|
+
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
31
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=AbstractNamedUnionType.d.ts.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Maybe } from "purify-ts";
|
|
8
|
+
import { Memoize } from "typescript-memoize";
|
|
9
|
+
import { AbstractType } from "./AbstractType.js";
|
|
10
|
+
import { AbstractUnionType } from "./AbstractUnionType.js";
|
|
11
|
+
import { imports } from "./imports.js";
|
|
12
|
+
import { snippets } from "./snippets.js";
|
|
13
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
14
|
+
import { code, def, joinCode } from "./ts-poet-wrapper.js";
|
|
15
|
+
export class AbstractNamedUnionType extends AbstractUnionType {
|
|
16
|
+
_name;
|
|
17
|
+
features;
|
|
18
|
+
constructor({ features, name, ...superParameters }) {
|
|
19
|
+
super(superParameters);
|
|
20
|
+
this.features = features;
|
|
21
|
+
this._name = name;
|
|
22
|
+
}
|
|
23
|
+
get declaration() {
|
|
24
|
+
const declarations = [
|
|
25
|
+
code `export type ${def(this._name)} = ${this.inlineName};`,
|
|
26
|
+
];
|
|
27
|
+
const staticModuleDeclarations = Object.entries(this.staticModuleDeclarations);
|
|
28
|
+
if (staticModuleDeclarations.length > 0) {
|
|
29
|
+
declarations.push(code `\
|
|
30
|
+
export namespace ${def(this.staticModuleName)} {
|
|
31
|
+
${joinCode(staticModuleDeclarations
|
|
32
|
+
.sort((left, right) => left[0].localeCompare(right[0]))
|
|
33
|
+
.map((_) => _[1]), { on: "\n\n" })}
|
|
34
|
+
}`);
|
|
35
|
+
}
|
|
36
|
+
return Maybe.of(joinCode(declarations, { on: "\n\n" }));
|
|
37
|
+
}
|
|
38
|
+
get equalsFunction() {
|
|
39
|
+
if (this.features.has("equals")) {
|
|
40
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}equals`;
|
|
41
|
+
}
|
|
42
|
+
return this.inlineEqualsFunction;
|
|
43
|
+
}
|
|
44
|
+
get filterFunction() {
|
|
45
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}filter`;
|
|
46
|
+
}
|
|
47
|
+
get filterType() {
|
|
48
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}Filter`;
|
|
49
|
+
}
|
|
50
|
+
get jsonTypeAliasDeclaration() {
|
|
51
|
+
return code `export type ${syntheticNamePrefix}Json = ${this.inlineJsonType.name}`;
|
|
52
|
+
}
|
|
53
|
+
get jsonSchemaFunctionDeclaration() {
|
|
54
|
+
return code `export const schema = () => ${this.inlineJsonSchema};`;
|
|
55
|
+
}
|
|
56
|
+
get name() {
|
|
57
|
+
return this._name;
|
|
58
|
+
}
|
|
59
|
+
get staticModuleName() {
|
|
60
|
+
return this._name;
|
|
61
|
+
}
|
|
62
|
+
get valueSparqlConstructTriplesFunction() {
|
|
63
|
+
if (this.features.has("sparql")) {
|
|
64
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}valueSparqlConstructTriples`;
|
|
65
|
+
}
|
|
66
|
+
return this.inlineValueSparqlConstructTriplesFunction;
|
|
67
|
+
}
|
|
68
|
+
get valueSparqlWherePatternsFunction() {
|
|
69
|
+
if (this.features.has("sparql")) {
|
|
70
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}valueSparqlWherePatterns`;
|
|
71
|
+
}
|
|
72
|
+
return this.inlineValueSparqlWherePatternsFunction;
|
|
73
|
+
}
|
|
74
|
+
get staticModuleDeclarations() {
|
|
75
|
+
const staticModuleDeclarations = {};
|
|
76
|
+
if (this.features.has("equals")) {
|
|
77
|
+
staticModuleDeclarations[`${syntheticNamePrefix}equals`] =
|
|
78
|
+
code `export const ${syntheticNamePrefix}equals = ${this.inlineEqualsFunction};`;
|
|
79
|
+
}
|
|
80
|
+
staticModuleDeclarations[`${syntheticNamePrefix}Filter`] =
|
|
81
|
+
code `export type ${syntheticNamePrefix}Filter = ${this.inlineFilterType};`;
|
|
82
|
+
staticModuleDeclarations[`${syntheticNamePrefix}filter`] =
|
|
83
|
+
code `export const ${syntheticNamePrefix}filter = ${this.inlineFilterFunction};`;
|
|
84
|
+
if (this.features.has("hash")) {
|
|
85
|
+
staticModuleDeclarations[`${syntheticNamePrefix}hash`] =
|
|
86
|
+
code `export function ${syntheticNamePrefix}hash<HasherT extends ${snippets.Hasher}>(value: ${this._name}, hasher: HasherT): HasherT { ${this.inlineHashStatements({ depth: 0, variables: { hasher: code `hasher`, value: code `value` } })} return hasher; }`;
|
|
87
|
+
}
|
|
88
|
+
if (this.features.has("json")) {
|
|
89
|
+
staticModuleDeclarations[`${syntheticNamePrefix}Json`] = code `\
|
|
90
|
+
${this.jsonTypeAliasDeclaration}
|
|
91
|
+
|
|
92
|
+
export namespace ${syntheticNamePrefix}Json {
|
|
93
|
+
${this.jsonSchemaFunctionDeclaration}
|
|
94
|
+
|
|
95
|
+
export function ${syntheticNamePrefix}parse(json: unknown): ${imports.Either}<Error, ${syntheticNamePrefix}Json> {
|
|
96
|
+
const jsonSafeParseResult = schema().safeParse(json);
|
|
97
|
+
if (!jsonSafeParseResult.success) { return ${imports.Left}(jsonSafeParseResult.error); }
|
|
98
|
+
return ${imports.Right}(jsonSafeParseResult.data);
|
|
99
|
+
}
|
|
100
|
+
}`;
|
|
101
|
+
staticModuleDeclarations[`${syntheticNamePrefix}fromJson`] =
|
|
102
|
+
code `export const ${syntheticNamePrefix}fromJson = ${this.inlineFromJsonFunction};`;
|
|
103
|
+
staticModuleDeclarations[`${syntheticNamePrefix}toJson`] =
|
|
104
|
+
code `export const ${syntheticNamePrefix}toJson = ${this.inlineToJsonFunction};`;
|
|
105
|
+
}
|
|
106
|
+
if (this.features.has("rdf")) {
|
|
107
|
+
staticModuleDeclarations[`${syntheticNamePrefix}fromRdfResourceValues`] =
|
|
108
|
+
code `export const ${syntheticNamePrefix}fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${this.name}> = ${this.inlineFromRdfResourceValuesFunction};`;
|
|
109
|
+
staticModuleDeclarations[`${syntheticNamePrefix}toRdfResourceValues`] =
|
|
110
|
+
code `export const ${syntheticNamePrefix}toRdfResourceValues: ${snippets.ToRdfResourceValuesFunction}<${this.name}> = ${this.inlineToRdfResourceValuesFunction};`;
|
|
111
|
+
}
|
|
112
|
+
if (this.features.has("sparql")) {
|
|
113
|
+
staticModuleDeclarations[`${syntheticNamePrefix}valueSparqlConstructTriples`] =
|
|
114
|
+
code `export const ${syntheticNamePrefix}valueSparqlConstructTriples: ${snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ${this.inlineValueSparqlConstructTriplesFunction};`;
|
|
115
|
+
staticModuleDeclarations[`${syntheticNamePrefix}valueSparqlWherePatterns`] =
|
|
116
|
+
code `export const ${syntheticNamePrefix}valueSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ${this.inlineValueSparqlWherePatternsFunction};`;
|
|
117
|
+
}
|
|
118
|
+
return staticModuleDeclarations;
|
|
119
|
+
}
|
|
120
|
+
fromJsonExpression({ variables, }) {
|
|
121
|
+
if (this.features.has("json")) {
|
|
122
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}fromJson(${variables.value})`;
|
|
123
|
+
}
|
|
124
|
+
return code `${this.inlineFromJsonFunction}(${variables.value})`;
|
|
125
|
+
}
|
|
126
|
+
fromRdfResourceValuesExpression({ variables, }) {
|
|
127
|
+
const { resourceValues: resourceValuesVariable, ...otherVariables } = variables;
|
|
128
|
+
if (this.features.has("rdf")) {
|
|
129
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}fromRdfResourceValues(${resourceValuesVariable}, ${otherVariables})`;
|
|
130
|
+
}
|
|
131
|
+
return code `${this.inlineFromRdfResourceValuesFunction}(${resourceValuesVariable}, ${otherVariables})`;
|
|
132
|
+
}
|
|
133
|
+
hashStatements({ depth, variables, }) {
|
|
134
|
+
if (this.features.has("hash")) {
|
|
135
|
+
return [
|
|
136
|
+
code `${this.staticModuleName}.${syntheticNamePrefix}hash(${variables.value}, ${variables.hasher});`,
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
return this.inlineHashStatements({ depth, variables });
|
|
140
|
+
}
|
|
141
|
+
jsonType() {
|
|
142
|
+
if (this.features.has("json")) {
|
|
143
|
+
return new AbstractType.JsonType(`${this.staticModuleName}.${syntheticNamePrefix}Json`);
|
|
144
|
+
}
|
|
145
|
+
return this.inlineJsonType;
|
|
146
|
+
}
|
|
147
|
+
jsonSchema({ context, }) {
|
|
148
|
+
if (this.features.has("json")) {
|
|
149
|
+
const expression = code `${this.staticModuleName}.${syntheticNamePrefix}Json.schema()`;
|
|
150
|
+
if (context === "property" && this.recursive) {
|
|
151
|
+
return code `${imports.z}.lazy((): ${imports.z}.ZodType<${this.staticModuleName}.${syntheticNamePrefix}Json> => ${expression})`;
|
|
152
|
+
}
|
|
153
|
+
return expression;
|
|
154
|
+
}
|
|
155
|
+
return this.inlineJsonSchema;
|
|
156
|
+
}
|
|
157
|
+
toJsonExpression({ variables, }) {
|
|
158
|
+
if (this.features.has("json")) {
|
|
159
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}toJson(${variables.value})`;
|
|
160
|
+
}
|
|
161
|
+
return code `${this.inlineToJsonFunction}(${variables.value})`;
|
|
162
|
+
}
|
|
163
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
164
|
+
const { value: valueVariable, ...otherVariables } = variables;
|
|
165
|
+
if (this.features.has("rdf")) {
|
|
166
|
+
return code `${this.staticModuleName}.${syntheticNamePrefix}toRdfResourceValues(${valueVariable}, ${otherVariables})`;
|
|
167
|
+
}
|
|
168
|
+
return code `${this.inlineToRdfResourceValuesFunction}(${valueVariable}, ${otherVariables})`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
__decorate([
|
|
172
|
+
Memoize()
|
|
173
|
+
], AbstractNamedUnionType.prototype, "declaration", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
Memoize()
|
|
176
|
+
], AbstractNamedUnionType.prototype, "equalsFunction", null);
|
|
177
|
+
__decorate([
|
|
178
|
+
Memoize()
|
|
179
|
+
], AbstractNamedUnionType.prototype, "filterFunction", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
Memoize()
|
|
182
|
+
], AbstractNamedUnionType.prototype, "filterType", null);
|
|
183
|
+
__decorate([
|
|
184
|
+
Memoize()
|
|
185
|
+
], AbstractNamedUnionType.prototype, "name", null);
|
|
186
|
+
__decorate([
|
|
187
|
+
Memoize()
|
|
188
|
+
], AbstractNamedUnionType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
189
|
+
__decorate([
|
|
190
|
+
Memoize()
|
|
191
|
+
], AbstractNamedUnionType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
192
|
+
__decorate([
|
|
193
|
+
Memoize()
|
|
194
|
+
], AbstractNamedUnionType.prototype, "jsonType", null);
|
|
195
|
+
//# sourceMappingURL=AbstractNamedUnionType.js.map
|
|
@@ -9,14 +9,14 @@ export declare abstract class AbstractNumericType<ValueT extends bigint | number
|
|
|
9
9
|
get filterType(): Code;
|
|
10
10
|
get name(): string;
|
|
11
11
|
get schemaType(): Code;
|
|
12
|
-
get
|
|
12
|
+
get valueSparqlWherePatternsFunction(): Code;
|
|
13
13
|
protected get schemaObject(): {
|
|
14
14
|
in: Code[] | undefined;
|
|
15
15
|
languageIn: import("ts-poet/build/Node.js").Node[] | undefined;
|
|
16
16
|
kind: Code;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<ValueT>["jsonSchema"]>[0]): Code;
|
|
19
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
20
20
|
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<ValueT>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<ValueT>["fromRdfExpressionChain"]>;
|
|
21
21
|
protected abstract fromRdfResourceValueExpression(variables: {
|
|
22
22
|
variables: {
|
|
@@ -29,7 +29,7 @@ export class AbstractNumericType extends AbstractPrimitiveType {
|
|
|
29
29
|
get schemaType() {
|
|
30
30
|
return code `${snippets.NumericSchema}<${this.typeofs[0]}>`;
|
|
31
31
|
}
|
|
32
|
-
get
|
|
32
|
+
get valueSparqlWherePatternsFunction() {
|
|
33
33
|
return code `${snippets.numericSparqlWherePatterns}<${this.typeofs[0]}>`;
|
|
34
34
|
}
|
|
35
35
|
get schemaObject() {
|
|
@@ -40,7 +40,7 @@ export class AbstractNumericType extends AbstractPrimitiveType {
|
|
|
40
40
|
: undefined,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
jsonSchema(_parameters) {
|
|
44
44
|
switch (this.primitiveIn.length) {
|
|
45
45
|
case 0:
|
|
46
46
|
return code `${imports.z}.${this.typeofs[0]}()`;
|
|
@@ -50,7 +50,7 @@ export class AbstractNumericType extends AbstractPrimitiveType {
|
|
|
50
50
|
return code `${imports.z}.union([${joinCode(this.primitiveIn.map((value) => code `${imports.z}.literal(${this.literalOf(value)})`), { on: "," })}])`;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
54
54
|
return code `[${snippets.literalFactory}.${this.typeofs[0]}(${variables.value}, ${rdfjsTermExpression(this.datatype)})]`;
|
|
55
55
|
}
|
|
56
56
|
fromRdfExpressionChain({ variables, }) {
|
|
@@ -78,7 +78,7 @@ __decorate([
|
|
|
78
78
|
], AbstractNumericType.prototype, "schemaType", null);
|
|
79
79
|
__decorate([
|
|
80
80
|
Memoize()
|
|
81
|
-
], AbstractNumericType.prototype, "
|
|
81
|
+
], AbstractNumericType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
82
82
|
(function (AbstractNumericType) {
|
|
83
83
|
AbstractNumericType.JsonType = AbstractPrimitiveType.JsonType;
|
|
84
84
|
})(AbstractNumericType || (AbstractNumericType = {}));
|
|
@@ -13,12 +13,15 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
13
13
|
* The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
|
|
14
14
|
*/
|
|
15
15
|
export declare abstract class AbstractTermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, _RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractType {
|
|
16
|
+
readonly abstract = false;
|
|
17
|
+
readonly declaration: Maybe<Code>;
|
|
16
18
|
readonly equalsFunction: Code;
|
|
17
19
|
readonly graphqlArgs: AbstractType["graphqlArgs"];
|
|
18
20
|
readonly hasValues: readonly ConstantTermT[];
|
|
19
21
|
readonly in_: readonly ConstantTermT[];
|
|
20
22
|
readonly mutable: boolean;
|
|
21
23
|
abstract readonly nodeKinds: ReadonlySet<NodeKind>;
|
|
24
|
+
readonly recursive = false;
|
|
22
25
|
readonly typeofs: AbstractType["typeofs"];
|
|
23
26
|
constructor({ hasValues, in_, ...superParameters }: {
|
|
24
27
|
hasValues: readonly ConstantTermT[];
|
|
@@ -28,11 +31,11 @@ export declare abstract class AbstractTermType<ConstantTermT extends Literal | N
|
|
|
28
31
|
get conversions(): readonly AbstractType.Conversion[];
|
|
29
32
|
get discriminantProperty(): Maybe<AbstractType.DiscriminantProperty>;
|
|
30
33
|
get schema(): Code;
|
|
31
|
-
get
|
|
32
|
-
|
|
34
|
+
get valueSparqlConstructTriplesFunction(): Code;
|
|
35
|
+
fromRdfResourceValuesExpression(parameters: Parameters<AbstractType["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
33
36
|
hashStatements({ variables, }: Parameters<AbstractType["hashStatements"]>[0]): readonly Code[];
|
|
34
37
|
jsonUiSchemaElement(): Maybe<Code>;
|
|
35
|
-
|
|
38
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
36
39
|
/**
|
|
37
40
|
* The fromRdfExpression for a term type can be decomposed into multiple sub-expressions with different purposes:
|
|
38
41
|
*
|
|
@@ -42,7 +45,7 @@ export declare abstract class AbstractTermType<ConstantTermT extends Literal | N
|
|
|
42
45
|
*
|
|
43
46
|
* Considering the sub-expressions as a record instead of an array allows them to be selectively overridden by subclasses.
|
|
44
47
|
*/
|
|
45
|
-
protected fromRdfExpressionChain({ variables, }: Parameters<Type["
|
|
48
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<Type["fromRdfResourceValuesExpression"]>[0]): {
|
|
46
49
|
hasValues?: Code;
|
|
47
50
|
languageIn?: Code;
|
|
48
51
|
preferredLanguages?: Code;
|
|
@@ -22,11 +22,14 @@ import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
|
22
22
|
* The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
|
|
23
23
|
*/
|
|
24
24
|
export class AbstractTermType extends AbstractType {
|
|
25
|
+
abstract = false;
|
|
26
|
+
declaration = Maybe.empty();
|
|
25
27
|
equalsFunction = code `${snippets.booleanEquals}`;
|
|
26
28
|
graphqlArgs = Maybe.empty();
|
|
27
29
|
hasValues;
|
|
28
30
|
in_;
|
|
29
31
|
mutable = false;
|
|
32
|
+
recursive = false;
|
|
30
33
|
typeofs = NonEmptyList([
|
|
31
34
|
"object",
|
|
32
35
|
]);
|
|
@@ -87,10 +90,10 @@ export class AbstractTermType extends AbstractType {
|
|
|
87
90
|
get schema() {
|
|
88
91
|
return code `${removeUndefined(this.schemaObject)}`;
|
|
89
92
|
}
|
|
90
|
-
get
|
|
93
|
+
get valueSparqlConstructTriplesFunction() {
|
|
91
94
|
return code `((_: object) => [])`;
|
|
92
95
|
}
|
|
93
|
-
|
|
96
|
+
fromRdfResourceValuesExpression(parameters) {
|
|
94
97
|
// invariant(
|
|
95
98
|
// this.nodeKinds.has("Literal") &&
|
|
96
99
|
// (this.nodeKinds.has("BlankNode") || this.nodeKinds.has("NamedNode")),
|
|
@@ -115,7 +118,7 @@ export class AbstractTermType extends AbstractType {
|
|
|
115
118
|
jsonUiSchemaElement() {
|
|
116
119
|
return Maybe.empty();
|
|
117
120
|
}
|
|
118
|
-
|
|
121
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
119
122
|
return code `[${variables.value}]`;
|
|
120
123
|
}
|
|
121
124
|
/**
|
|
@@ -163,7 +166,7 @@ __decorate([
|
|
|
163
166
|
], AbstractTermType.prototype, "schema", null);
|
|
164
167
|
__decorate([
|
|
165
168
|
Memoize()
|
|
166
|
-
], AbstractTermType.prototype, "
|
|
169
|
+
], AbstractTermType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
167
170
|
(function (AbstractTermType) {
|
|
168
171
|
AbstractTermType.GraphqlType = AbstractType.GraphqlType;
|
|
169
172
|
AbstractTermType.JsonType = AbstractType.JsonType;
|