@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
|
@@ -12,13 +12,13 @@ import { removeUndefined } from "../removeUndefined.js";
|
|
|
12
12
|
import { snippets } from "../snippets.js";
|
|
13
13
|
import { arrayOf, code, literalOf } from "../ts-poet-wrapper.js";
|
|
14
14
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
15
|
-
export class
|
|
15
|
+
export class DiscriminantProperty extends AbstractProperty {
|
|
16
16
|
constructorParametersSignature = Maybe.empty();
|
|
17
17
|
equalsFunction = Maybe.of(code `${snippets.strictEquals}`);
|
|
18
18
|
filterProperty = Maybe.empty();
|
|
19
19
|
getAccessorDeclaration = Maybe.empty();
|
|
20
20
|
graphqlField = Maybe.empty();
|
|
21
|
-
kind = "
|
|
21
|
+
kind = "DiscriminantProperty";
|
|
22
22
|
mutable = false;
|
|
23
23
|
recursive = false;
|
|
24
24
|
constructor({ type, ...superParameters }) {
|
|
@@ -26,20 +26,20 @@ export class TypeDiscriminantProperty extends AbstractProperty {
|
|
|
26
26
|
invariant(this.visibility === "public");
|
|
27
27
|
}
|
|
28
28
|
get declaration() {
|
|
29
|
-
switch (this.
|
|
29
|
+
switch (this.namedObjectType.declarationType) {
|
|
30
30
|
case "class":
|
|
31
31
|
return Maybe.of(code `${this.abstract ? "abstract " : ""}${this.override ? "override " : ""}readonly ${this.name}: ${this.type.name}${!this.abstract ? code ` = ${this.initializer};` : ";"}`);
|
|
32
32
|
case "interface":
|
|
33
33
|
return Maybe.of(code `readonly ${this.name}: ${this.type.name};`);
|
|
34
34
|
default:
|
|
35
|
-
this.
|
|
35
|
+
this.namedObjectType.declarationType;
|
|
36
36
|
throw new Error("should never reach this point");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
get jsonSignature() {
|
|
40
40
|
return Maybe.of(code `readonly ${this.name}: ${this.type.name}`);
|
|
41
41
|
}
|
|
42
|
-
get
|
|
42
|
+
get jsonZchema() {
|
|
43
43
|
return Maybe.of({
|
|
44
44
|
key: this.name,
|
|
45
45
|
schema: this.type.values.length > 1
|
|
@@ -48,16 +48,16 @@ export class TypeDiscriminantProperty extends AbstractProperty {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
get abstract() {
|
|
51
|
-
return this.
|
|
51
|
+
return this.namedObjectType.abstract;
|
|
52
52
|
}
|
|
53
53
|
get initializer() {
|
|
54
|
-
return code `${literalOf(this.
|
|
54
|
+
return code `${literalOf(this.namedObjectType.discriminantValue)} as const`;
|
|
55
55
|
}
|
|
56
56
|
get override() {
|
|
57
|
-
return this.
|
|
57
|
+
return this.namedObjectType.parentObjectTypes.length > 0;
|
|
58
58
|
}
|
|
59
59
|
constructorStatements() {
|
|
60
|
-
switch (this.
|
|
60
|
+
switch (this.namedObjectType.declarationType) {
|
|
61
61
|
case "class":
|
|
62
62
|
return [];
|
|
63
63
|
case "interface":
|
|
@@ -68,13 +68,15 @@ export class TypeDiscriminantProperty extends AbstractProperty {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
fromJsonStatements() {
|
|
71
|
-
return !this.abstract &&
|
|
71
|
+
return !this.abstract &&
|
|
72
|
+
this.namedObjectType.declarationType === "interface"
|
|
72
73
|
? [code `const ${this.name} = ${this.initializer};`]
|
|
73
74
|
: [];
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
return !this.abstract &&
|
|
77
|
-
|
|
76
|
+
fromRdfResourceValuesExpression() {
|
|
77
|
+
return !this.abstract &&
|
|
78
|
+
this.namedObjectType.declarationType === "interface"
|
|
79
|
+
? Maybe.of(code `${imports.Right}<${literalOf(this.namedObjectType.discriminantValue)}>(${this.initializer})`)
|
|
78
80
|
: Maybe.empty();
|
|
79
81
|
}
|
|
80
82
|
hashStatements({ variables, }) {
|
|
@@ -93,17 +95,17 @@ export class TypeDiscriminantProperty extends AbstractProperty {
|
|
|
93
95
|
toJsonObjectMemberExpression({ variables, }) {
|
|
94
96
|
return Maybe.of(code `${this.name}: ${variables.value}`);
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
toRdfRdfResourceValuesStatements() {
|
|
97
99
|
return [];
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
__decorate([
|
|
101
103
|
Memoize()
|
|
102
|
-
],
|
|
104
|
+
], DiscriminantProperty.prototype, "jsonSignature", null);
|
|
103
105
|
__decorate([
|
|
104
106
|
Memoize()
|
|
105
|
-
],
|
|
106
|
-
(function (
|
|
107
|
+
], DiscriminantProperty.prototype, "jsonZchema", null);
|
|
108
|
+
(function (DiscriminantProperty) {
|
|
107
109
|
class Type {
|
|
108
110
|
filterFunction = code `nonextant`;
|
|
109
111
|
mutable;
|
|
@@ -137,6 +139,6 @@ __decorate([
|
|
|
137
139
|
__decorate([
|
|
138
140
|
Memoize()
|
|
139
141
|
], Type.prototype, "values", null);
|
|
140
|
-
|
|
141
|
-
})(
|
|
142
|
-
//# sourceMappingURL=
|
|
142
|
+
DiscriminantProperty.Type = Type;
|
|
143
|
+
})(DiscriminantProperty || (DiscriminantProperty = {}));
|
|
144
|
+
//# sourceMappingURL=DiscriminantProperty.js.map
|
|
@@ -7,7 +7,7 @@ export declare class IdentifierPrefixProperty extends AbstractProperty<StringTyp
|
|
|
7
7
|
readonly filterProperty: AbstractProperty<StringType>["filterProperty"];
|
|
8
8
|
readonly graphqlField: AbstractProperty<StringType>["graphqlField"];
|
|
9
9
|
readonly jsonSignature: Maybe<Code>;
|
|
10
|
-
readonly
|
|
10
|
+
readonly jsonZchema: AbstractProperty<StringType>["jsonZchema"];
|
|
11
11
|
readonly kind = "IdentifierPrefixProperty";
|
|
12
12
|
readonly mutable = false;
|
|
13
13
|
readonly recursive = false;
|
|
@@ -21,12 +21,12 @@ export declare class IdentifierPrefixProperty extends AbstractProperty<StringTyp
|
|
|
21
21
|
get getAccessorDeclaration(): Maybe<Code>;
|
|
22
22
|
constructorStatements({ variables, }: Parameters<AbstractProperty<StringType>["constructorStatements"]>[0]): readonly Code[];
|
|
23
23
|
fromJsonStatements(): readonly Code[];
|
|
24
|
-
|
|
24
|
+
fromRdfResourceValuesExpression(): Maybe<Code>;
|
|
25
25
|
hashStatements(): readonly Code[];
|
|
26
26
|
jsonUiSchemaElement(): Maybe<Code>;
|
|
27
27
|
sparqlConstructTriplesExpression(): Maybe<Code>;
|
|
28
28
|
sparqlWherePatternsExpression(): ReturnType<AbstractProperty<StringType>["sparqlWherePatternsExpression"]>;
|
|
29
29
|
toJsonObjectMemberExpression(): Maybe<Code>;
|
|
30
|
-
|
|
30
|
+
toRdfRdfResourceValuesStatements(): readonly Code[];
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=IdentifierPrefixProperty.d.ts.map
|
|
@@ -16,7 +16,7 @@ export class IdentifierPrefixProperty extends AbstractProperty {
|
|
|
16
16
|
filterProperty = Maybe.empty();
|
|
17
17
|
graphqlField = Maybe.empty();
|
|
18
18
|
jsonSignature = Maybe.empty();
|
|
19
|
-
|
|
19
|
+
jsonZchema = Maybe.empty();
|
|
20
20
|
kind = "IdentifierPrefixProperty";
|
|
21
21
|
mutable = false;
|
|
22
22
|
recursive = false;
|
|
@@ -29,7 +29,7 @@ export class IdentifierPrefixProperty extends AbstractProperty {
|
|
|
29
29
|
return Maybe.of(code `readonly ${this.name}?: ${this.type.name};`);
|
|
30
30
|
}
|
|
31
31
|
get declaration() {
|
|
32
|
-
if (this.
|
|
32
|
+
if (this.namedObjectType.declarationType === "interface") {
|
|
33
33
|
return Maybe.empty();
|
|
34
34
|
}
|
|
35
35
|
if (!this.own) {
|
|
@@ -38,7 +38,7 @@ export class IdentifierPrefixProperty extends AbstractProperty {
|
|
|
38
38
|
return Maybe.of(code `protected readonly _${this.name}?: ${this.type.name};`);
|
|
39
39
|
}
|
|
40
40
|
get equalsFunction() {
|
|
41
|
-
return this.
|
|
41
|
+
return this.namedObjectType.declarationType === "class"
|
|
42
42
|
? Maybe.of(code `${snippets.strictEquals}`)
|
|
43
43
|
: Maybe.empty();
|
|
44
44
|
}
|
|
@@ -49,7 +49,7 @@ protected ${!this.own ? "override " : ""} get ${this.name}(): ${this.type.name}
|
|
|
49
49
|
}`);
|
|
50
50
|
}
|
|
51
51
|
constructorStatements({ variables, }) {
|
|
52
|
-
switch (this.
|
|
52
|
+
switch (this.namedObjectType.declarationType) {
|
|
53
53
|
case "class":
|
|
54
54
|
return this.declaration
|
|
55
55
|
.map(() => [code `this._${this.name} = ${variables.parameter};`])
|
|
@@ -61,7 +61,7 @@ protected ${!this.own ? "override " : ""} get ${this.name}(): ${this.type.name}
|
|
|
61
61
|
fromJsonStatements() {
|
|
62
62
|
return [];
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
fromRdfResourceValuesExpression() {
|
|
65
65
|
return Maybe.empty();
|
|
66
66
|
}
|
|
67
67
|
hashStatements() {
|
|
@@ -79,7 +79,7 @@ protected ${!this.own ? "override " : ""} get ${this.name}(): ${this.type.name}
|
|
|
79
79
|
toJsonObjectMemberExpression() {
|
|
80
80
|
return Maybe.empty();
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
toRdfRdfResourceValuesStatements() {
|
|
83
83
|
return [];
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -28,14 +28,14 @@ export declare class IdentifierProperty extends AbstractProperty<BlankNodeType |
|
|
|
28
28
|
get getAccessorDeclaration(): Maybe<Code>;
|
|
29
29
|
get graphqlField(): AbstractProperty<IdentifierType>["graphqlField"];
|
|
30
30
|
get jsonSignature(): Maybe<Code>;
|
|
31
|
-
get
|
|
31
|
+
get jsonZchema(): AbstractProperty<IdentifierType>["jsonZchema"];
|
|
32
32
|
private get abstract();
|
|
33
33
|
private get declarationModifiers();
|
|
34
34
|
private get declarationName();
|
|
35
35
|
private get override();
|
|
36
36
|
constructorStatements({ variables, }: Parameters<AbstractProperty<IdentifierType>["constructorStatements"]>[0]): readonly Code[];
|
|
37
37
|
fromJsonStatements({ variables, }: Parameters<AbstractProperty<IdentifierType>["fromJsonStatements"]>[0]): readonly Code[];
|
|
38
|
-
|
|
38
|
+
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractProperty<IdentifierType>["fromRdfResourceValuesExpression"]>[0]): Maybe<Code>;
|
|
39
39
|
hashStatements({ variables, }: Parameters<AbstractProperty<IdentifierType>["hashStatements"]>[0]): readonly Code[];
|
|
40
40
|
jsonUiSchemaElement({ variables, }: Parameters<AbstractProperty<IdentifierType>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
41
41
|
sparqlConstructTriplesExpression(): Maybe<Code>;
|
|
@@ -44,6 +44,6 @@ export declare class IdentifierProperty extends AbstractProperty<BlankNodeType |
|
|
|
44
44
|
patterns: Code;
|
|
45
45
|
}>;
|
|
46
46
|
toJsonObjectMemberExpression({ variables, }: Parameters<AbstractProperty<IdentifierType>["toJsonObjectMemberExpression"]>[0]): Maybe<Code>;
|
|
47
|
-
|
|
47
|
+
toRdfRdfResourceValuesStatements(): readonly Code[];
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=IdentifierProperty.d.ts.map
|
|
@@ -39,8 +39,8 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const hasQuestionToken = this.identifierMintingStrategy.isJust() ||
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
42
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
43
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust());
|
|
44
44
|
const typeNames = [];
|
|
45
45
|
for (const conversion of this.type.conversions) {
|
|
46
46
|
if (conversion.sourceTypeof !== "undefined" &&
|
|
@@ -91,7 +91,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
91
91
|
break;
|
|
92
92
|
case "sha256":
|
|
93
93
|
// If the object is mutable don't memoize the minted identifier, since the hash will change if the object mutates.
|
|
94
|
-
memoizeMintedIdentifier = !this.
|
|
94
|
+
memoizeMintedIdentifier = !this.namedObjectType.mutable;
|
|
95
95
|
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${this.${this.identifierPrefixPropertyName}}\${this.${syntheticNamePrefix}hashShaclProperties(${imports.sha256}.create())}\`)`;
|
|
96
96
|
break;
|
|
97
97
|
case "uuidv4":
|
|
@@ -107,11 +107,11 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
107
107
|
])} }`);
|
|
108
108
|
}
|
|
109
109
|
// If this object type has an ancestor or a descendant with an identifier minting strategy, declare a get accessor.
|
|
110
|
-
if (this.
|
|
111
|
-
this.
|
|
112
|
-
if (this.
|
|
110
|
+
if (this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
111
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())) {
|
|
112
|
+
if (this.namedObjectType.parentObjectTypes.length > 0) {
|
|
113
113
|
// If this object type isn't the root, delegate up.
|
|
114
|
-
const checkSuperIdentifierTermTypeStatements = checkIdentifierTermTypeStatements("identifier", this.
|
|
114
|
+
const checkSuperIdentifierTermTypeStatements = checkIdentifierTermTypeStatements("identifier", this.namedObjectType.parentObjectTypes[0].identifierType.nodeKinds);
|
|
115
115
|
if (checkSuperIdentifierTermTypeStatements.length === 0) {
|
|
116
116
|
return Maybe.empty(); // Don't need a get accessor just to return super.identifier.
|
|
117
117
|
}
|
|
@@ -143,9 +143,12 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
get jsonSignature() {
|
|
146
|
+
if (this.type.in_.length > 0) {
|
|
147
|
+
return Maybe.of(code `readonly "@id": ${this.type.in_.map((iri) => `"${iri.value}"`).join(" | ")}`);
|
|
148
|
+
}
|
|
146
149
|
return Maybe.of(code `readonly "@id": string`);
|
|
147
150
|
}
|
|
148
|
-
get
|
|
151
|
+
get jsonZchema() {
|
|
149
152
|
let schema;
|
|
150
153
|
if (this.type.in_.length > 0 && this.type.kind === "IriType") {
|
|
151
154
|
// Treat sh:in as a union of the IRIs
|
|
@@ -169,22 +172,22 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
169
172
|
// };
|
|
170
173
|
// }
|
|
171
174
|
get abstract() {
|
|
172
|
-
return this.
|
|
175
|
+
return this.namedObjectType.abstract;
|
|
173
176
|
}
|
|
174
177
|
get declarationModifiers() {
|
|
175
|
-
if (this.
|
|
178
|
+
if (this.namedObjectType.declarationType === "interface") {
|
|
176
179
|
return Maybe.of({ readonly: true });
|
|
177
180
|
}
|
|
178
|
-
if (this.
|
|
181
|
+
if (this.namedObjectType.parentObjectTypes.length > 0) {
|
|
179
182
|
// An ancestor will declare the identifier property.
|
|
180
183
|
return Maybe.empty();
|
|
181
184
|
}
|
|
182
185
|
if (this.identifierMintingStrategy.isJust() ||
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
186
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
187
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())) {
|
|
185
188
|
return Maybe.of({
|
|
186
189
|
hasQuestionToken: true,
|
|
187
|
-
visibility: this.
|
|
190
|
+
visibility: this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())
|
|
188
191
|
? "protected"
|
|
189
192
|
: "private",
|
|
190
193
|
});
|
|
@@ -204,10 +207,10 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
204
207
|
});
|
|
205
208
|
}
|
|
206
209
|
get declarationName() {
|
|
207
|
-
if (this.
|
|
210
|
+
if (this.namedObjectType.declarationType === "class" &&
|
|
208
211
|
(this.identifierMintingStrategy.isJust() ||
|
|
209
|
-
this.
|
|
210
|
-
this.
|
|
212
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
213
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust()))) {
|
|
211
214
|
// If this, an ancestor, or a descendant has an identifier minting strategy, declare the identifier property
|
|
212
215
|
// private or protected and prefix its name with _ in order to avoid a conflict with the get accessor name.
|
|
213
216
|
return `_${this.name}`;
|
|
@@ -215,7 +218,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
215
218
|
return this.name;
|
|
216
219
|
}
|
|
217
220
|
get override() {
|
|
218
|
-
return this.
|
|
221
|
+
return this.namedObjectType.parentObjectTypes.length > 0;
|
|
219
222
|
}
|
|
220
223
|
constructorStatements({ variables, }) {
|
|
221
224
|
const constructorParametersSignature = this.constructorParametersSignature.extractNullable();
|
|
@@ -225,7 +228,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
225
228
|
let lhs;
|
|
226
229
|
const statements = [];
|
|
227
230
|
const typeConversions = this.type.conversions;
|
|
228
|
-
switch (this.
|
|
231
|
+
switch (this.namedObjectType.declarationType) {
|
|
229
232
|
case "class": {
|
|
230
233
|
if (this.declaration.isNothing()) {
|
|
231
234
|
return [];
|
|
@@ -244,7 +247,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
244
247
|
conversionBranches.push(code `if (${conversion.sourceTypeCheckExpression(variables.parameter)}) { ${lhs} = ${conversion.conversionExpression(variables.parameter)}; }`);
|
|
245
248
|
}
|
|
246
249
|
this.identifierMintingStrategy.ifJust((identifierMintingStrategy) => {
|
|
247
|
-
switch (this.
|
|
250
|
+
switch (this.namedObjectType.declarationType) {
|
|
248
251
|
case "class":
|
|
249
252
|
// The identifier will be minted lazily in the get accessor
|
|
250
253
|
invariant(this.getAccessorDeclaration.isJust());
|
|
@@ -257,10 +260,10 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
257
260
|
mintIdentifier = code `${imports.dataFactory}.blankNode()`;
|
|
258
261
|
break;
|
|
259
262
|
case "sha256":
|
|
260
|
-
logger.warn("minting %s identifiers with %s is unsupported", this.
|
|
263
|
+
logger.warn("minting %s identifiers with %s is unsupported", this.namedObjectType.declarationType, identifierMintingStrategy);
|
|
261
264
|
return;
|
|
262
265
|
case "uuidv4":
|
|
263
|
-
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${${variables.parameters}.${this.identifierPrefixPropertyName} ?? "urn:shaclmate:${this.
|
|
266
|
+
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${${variables.parameters}.${this.identifierPrefixPropertyName} ?? "urn:shaclmate:${this.namedObjectType.discriminantValue}:"}\${${imports.uuid}.v4()}\`)`;
|
|
264
267
|
break;
|
|
265
268
|
}
|
|
266
269
|
conversionBranches.push(code `if (${variables.parameter} === undefined) { ${lhs} = ${mintIdentifier}; }`);
|
|
@@ -277,8 +280,8 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
277
280
|
code `const ${this.name} = ${this.type.fromJsonExpression({ variables: { value: variables.jsonObject } })};`,
|
|
278
281
|
];
|
|
279
282
|
}
|
|
280
|
-
|
|
281
|
-
return Maybe.of(code `${this.type.
|
|
283
|
+
fromRdfResourceValuesExpression({ variables, }) {
|
|
284
|
+
return Maybe.of(code `${this.type.fromRdfResourceValuesExpression({
|
|
282
285
|
variables: {
|
|
283
286
|
...variables,
|
|
284
287
|
propertyPath: rdfjsTermExpression(rdf.subject),
|
|
@@ -298,12 +301,12 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
298
301
|
sparqlWherePatternsExpression({ variables, }) {
|
|
299
302
|
return Maybe.of({
|
|
300
303
|
condition: code `${variables.focusIdentifier}.termType === "Variable"`,
|
|
301
|
-
patterns: code `${this.type.
|
|
304
|
+
patterns: code `${this.type.valueSparqlWherePatternsFunction}(${{
|
|
302
305
|
filter: code `${variables.filter}?.${this.name}`,
|
|
303
306
|
ignoreRdfType: true, // Unused
|
|
304
307
|
preferredLanguages: variables.preferredLanguages,
|
|
305
308
|
propertyPatterns: code `[]`,
|
|
306
|
-
schema: code `${this.
|
|
309
|
+
schema: code `${this.namedObjectType.staticModuleName}.${syntheticNamePrefix}schema.properties.${this.namedObjectType.identifierProperty.name}.type()`,
|
|
307
310
|
valueVariable: variables.focusIdentifier,
|
|
308
311
|
variablePrefix: variables.variablePrefix, // Unused
|
|
309
312
|
}})`,
|
|
@@ -327,7 +330,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
327
330
|
invariant(valueToNodeKinds.length === 2);
|
|
328
331
|
return Maybe.of(code `"@id": ${variables.value}.termType === "${NodeKind.toTermType(nodeKinds[0])}" ? ${valueToNodeKinds[0]} : ${valueToNodeKinds[1]}`);
|
|
329
332
|
}
|
|
330
|
-
|
|
333
|
+
toRdfRdfResourceValuesStatements() {
|
|
331
334
|
return [];
|
|
332
335
|
}
|
|
333
336
|
}
|
|
@@ -354,7 +357,7 @@ __decorate([
|
|
|
354
357
|
], IdentifierProperty.prototype, "jsonSignature", null);
|
|
355
358
|
__decorate([
|
|
356
359
|
Memoize()
|
|
357
|
-
], IdentifierProperty.prototype, "
|
|
360
|
+
], IdentifierProperty.prototype, "jsonZchema", null);
|
|
358
361
|
__decorate([
|
|
359
362
|
Memoize()
|
|
360
363
|
], IdentifierProperty.prototype, "declarationModifiers", null);
|
|
@@ -2,11 +2,11 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
3
|
import { code, def, joinCode } from "../ts-poet-wrapper.js";
|
|
4
4
|
import { tsComment } from "../tsComment.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
function
|
|
5
|
+
import { NamedObjectType_equalsFunctionOrMethodDeclaration } from "./NamedObjectType_equalsFunctionOrMethodDeclaration.js";
|
|
6
|
+
import { NamedObjectType_hashFunctionOrMethodDeclarations } from "./NamedObjectType_hashFunctionOrMethodDeclarations.js";
|
|
7
|
+
import { NamedObjectType_toJsonFunctionOrMethodDeclaration } from "./NamedObjectType_toJsonFunctionOrMethodDeclaration.js";
|
|
8
|
+
import { NamedObjectType_toRdfResourceFunctionOrMethodDeclaration } from "./NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js";
|
|
9
|
+
function NamedObjectType_constructorDeclaration() {
|
|
10
10
|
const parametersPropertySignatures = this.properties.flatMap((property) => property.constructorParametersSignature.toList());
|
|
11
11
|
const parametersType = [];
|
|
12
12
|
if (parametersPropertySignatures.length > 0) {
|
|
@@ -41,29 +41,29 @@ constructor(${statements.length > 0 ? "parameters" : "_parameters"}${parametersH
|
|
|
41
41
|
${joinCode(statements)}
|
|
42
42
|
}`;
|
|
43
43
|
}
|
|
44
|
-
export function
|
|
44
|
+
export function NamedObjectType_classDeclaration() {
|
|
45
45
|
this.ensureAtMostOneSuperObjectType();
|
|
46
46
|
return code `\
|
|
47
47
|
${this.comment
|
|
48
48
|
.alt(this.label)
|
|
49
49
|
.map(tsComment)
|
|
50
|
-
.orDefault("")}
|
|
50
|
+
.orDefault("")}export ${this.abstract ? "abstract " : ""}class ${def(this.name)}${this.parentObjectTypes.length > 0 ? ` extends ${this.parentObjectTypes[0].name}` : ""} {
|
|
51
51
|
${joinCode([
|
|
52
52
|
...this.properties.flatMap((property) => property.declaration.toList()),
|
|
53
|
-
|
|
53
|
+
NamedObjectType_constructorDeclaration.call(this),
|
|
54
54
|
...this.properties.flatMap((property) => property.getAccessorDeclaration.toList()),
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
-
...
|
|
55
|
+
...NamedObjectType_equalsFunctionOrMethodDeclaration.call(this).toList(),
|
|
56
|
+
...NamedObjectType_hashFunctionOrMethodDeclarations.call(this),
|
|
57
|
+
...NamedObjectType_toJsonFunctionOrMethodDeclaration.call(this).toList(),
|
|
58
|
+
...NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.call(this).toList(),
|
|
59
|
+
...NamedObjectType_toStringMethodDeclaration.call(this).toList(),
|
|
60
60
|
], { on: "\n\n" })}
|
|
61
61
|
}`;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function NamedObjectType_toStringMethodDeclaration() {
|
|
64
64
|
if (!this.features.has("json")) {
|
|
65
65
|
return Maybe.empty();
|
|
66
66
|
}
|
|
67
67
|
return Maybe.of(code `${this.parentObjectTypes.length > 0 ? "override " : ""}toString(): string { return JSON.stringify(this.${syntheticNamePrefix}toJson()); }`);
|
|
68
68
|
}
|
|
69
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=NamedObjectType_classDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_createFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_createFunctionDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_createFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("create")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -49,4 +49,4 @@ export function ${syntheticNamePrefix}create(parameters${parametersHasQuestionTo
|
|
|
49
49
|
return { ${propertyInitializers.join(", ")} };
|
|
50
50
|
}`);
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=NamedObjectType_createFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_equalsFunctionOrMethodDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { snippets } from "../snippets.js";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_equalsFunctionOrMethodDeclaration() {
|
|
6
6
|
if (!this.features.has("equals")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -48,4 +48,4 @@ ${preamble}${syntheticNamePrefix}equals(${parameters}): ${snippets.EqualsResult}
|
|
|
48
48
|
return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
|
|
49
49
|
}`);
|
|
50
50
|
}
|
|
51
|
-
//# sourceMappingURL=
|
|
51
|
+
//# sourceMappingURL=NamedObjectType_equalsFunctionOrMethodDeclaration.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function NamedObjectType_filterFunctionDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_filterFunctionDeclaration() {
|
|
4
4
|
const statements = [];
|
|
5
5
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
6
6
|
statements.push(code `if (!${parentObjectType.filterFunction}(filter, value)) { return false; }`);
|
|
@@ -18,4 +18,4 @@ export function ${syntheticNamePrefix}filter(filter: ${this.filterType}, value:
|
|
|
18
18
|
${joinCode(statements)}
|
|
19
19
|
}`;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function NamedObjectType_filterTypeDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_filterTypeDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_filterTypeDeclaration() {
|
|
4
4
|
const members = [];
|
|
5
5
|
if (this.properties.length > 0) {
|
|
6
6
|
const filterProperties = {};
|
|
@@ -19,4 +19,4 @@ export function ObjectType_filterTypeDeclaration() {
|
|
|
19
19
|
return code `\
|
|
20
20
|
export type ${syntheticNamePrefix}Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`;
|
|
21
21
|
}
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=NamedObjectType_filterTypeDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
|
|
@@ -2,6 +2,7 @@ import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { imports } from "../imports.js";
|
|
4
4
|
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
5
|
+
import { snippets } from "../snippets.js";
|
|
5
6
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
6
7
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
7
8
|
const variables = {
|
|
@@ -9,7 +10,7 @@ const variables = {
|
|
|
9
10
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
10
11
|
variablePrefix: code `parameters.variablePrefix`,
|
|
11
12
|
};
|
|
12
|
-
export function
|
|
13
|
+
export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
|
|
13
14
|
if (!this.features.has("sparql")) {
|
|
14
15
|
return Maybe.empty();
|
|
15
16
|
}
|
|
@@ -18,7 +19,7 @@ export function ObjectType_sparqlConstructTriplesFunctionDeclaration() {
|
|
|
18
19
|
let triplesVariableDeclarationKeyword = "const";
|
|
19
20
|
const statements = [];
|
|
20
21
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
21
|
-
statements.push(code `triples = triples.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}
|
|
22
|
+
statements.push(code `triples = triples.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
|
|
22
23
|
triplesVariableDeclarationKeyword = "let";
|
|
23
24
|
}
|
|
24
25
|
if (this.fromRdfType.isJust()) {
|
|
@@ -44,7 +45,7 @@ if (!parameters?.ignoreRdfType) {
|
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
return Maybe.of(code `\
|
|
47
|
-
export
|
|
48
|
+
export const ${syntheticNamePrefix}focusSparqlConstructTriples: ${snippets.FocusSparqlConstructTriplesFunction}<${this.filterType}> = (${statements.length === 0 ? "_" : ""}parameters) => {
|
|
48
49
|
${statements.length > 0
|
|
49
50
|
? joinCode([
|
|
50
51
|
code `${triplesVariableDeclarationKeyword} triples: ${imports.sparqljs}.Triple[] = [];`,
|
|
@@ -52,6 +53,6 @@ ${statements.length > 0
|
|
|
52
53
|
code `return triples;`,
|
|
53
54
|
])
|
|
54
55
|
: "return [];"}
|
|
55
|
-
}
|
|
56
|
+
};`);
|
|
56
57
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
|