@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
|
|
2
|
+
import type { AbstractType } from "./AbstractType.js";
|
|
3
|
+
import type { Type } from "./Type.js";
|
|
4
|
+
import type { Code } from "./ts-poet-wrapper.js";
|
|
5
|
+
export declare class NamedUnionType extends AbstractNamedUnionType<Type> {
|
|
6
|
+
readonly graphqlArgs: AbstractType["graphqlArgs"];
|
|
7
|
+
readonly kind = "NamedUnionType";
|
|
8
|
+
graphqlResolveExpression(): Code;
|
|
9
|
+
get graphqlType(): AbstractType.GraphqlType;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=NamedUnionType.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
|
|
3
|
+
export class NamedUnionType extends AbstractNamedUnionType {
|
|
4
|
+
graphqlArgs = Maybe.empty();
|
|
5
|
+
kind = "NamedUnionType";
|
|
6
|
+
graphqlResolveExpression() {
|
|
7
|
+
throw new Error("GraphQL doesn't support scalar unions");
|
|
8
|
+
}
|
|
9
|
+
get graphqlType() {
|
|
10
|
+
throw new Error("GraphQL doesn't support scalar unions");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=NamedUnionType.js.map
|
|
@@ -14,21 +14,21 @@ export declare class OptionType<ItemTypeT extends OptionType.ItemType> extends A
|
|
|
14
14
|
get mutable(): boolean;
|
|
15
15
|
get name(): Code;
|
|
16
16
|
get schemaType(): Code;
|
|
17
|
-
get
|
|
18
|
-
get
|
|
17
|
+
get valueSparqlConstructTriplesFunction(): Code;
|
|
18
|
+
get valueSparqlWherePatternsFunction(): Code;
|
|
19
19
|
protected get schemaObject(): {
|
|
20
20
|
kind: Code;
|
|
21
21
|
item: Code;
|
|
22
22
|
};
|
|
23
23
|
fromJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromJsonExpression"]>[0]): Code;
|
|
24
|
-
|
|
24
|
+
fromRdfResourceValuesExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
25
25
|
graphqlResolveExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["graphqlResolveExpression"]>[0]): Code;
|
|
26
26
|
hashStatements({ depth, variables, }: Parameters<AbstractContainerType<ItemTypeT>["hashStatements"]>[0]): readonly Code[];
|
|
27
27
|
jsonType(parameters?: Parameters<AbstractContainerType<ItemTypeT>["jsonType"]>[0]): AbstractContainerType.JsonType;
|
|
28
28
|
jsonUiSchemaElement(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
29
|
-
|
|
29
|
+
jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
|
|
30
30
|
toJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toJsonExpression"]>[0]): Code;
|
|
31
|
-
|
|
31
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
32
32
|
}
|
|
33
33
|
export declare namespace OptionType {
|
|
34
34
|
type ItemType = AbstractContainerType.ItemType;
|
|
@@ -70,11 +70,11 @@ export class OptionType extends AbstractContainerType {
|
|
|
70
70
|
get schemaType() {
|
|
71
71
|
return code `${snippets.MaybeSchema}<${this.itemType.schemaType}>`;
|
|
72
72
|
}
|
|
73
|
-
get
|
|
74
|
-
return code `${snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.
|
|
73
|
+
get valueSparqlConstructTriplesFunction() {
|
|
74
|
+
return code `${snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
|
|
75
75
|
}
|
|
76
|
-
get
|
|
77
|
-
return code `${snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.
|
|
76
|
+
get valueSparqlWherePatternsFunction() {
|
|
77
|
+
return code `${snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
|
|
78
78
|
}
|
|
79
79
|
get schemaObject() {
|
|
80
80
|
return {
|
|
@@ -92,9 +92,9 @@ export class OptionType extends AbstractContainerType {
|
|
|
92
92
|
? expression
|
|
93
93
|
: code `${expression}.map(item => (${itemFromJsonExpression}))`;
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
fromRdfResourceValuesExpression(parameters) {
|
|
96
96
|
const { variables } = parameters;
|
|
97
|
-
return code `${this.itemType.
|
|
97
|
+
return code `${this.itemType.fromRdfResourceValuesExpression(parameters)}.map(values => values.length > 0 ? values.map(value => ${imports.Maybe}.of(value)) : ${imports.Resource}.Values.fromValue<${imports.Maybe}<${this.itemType.name}>>({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: ${imports.Maybe}.empty() }))`;
|
|
98
98
|
}
|
|
99
99
|
graphqlResolveExpression(parameters) {
|
|
100
100
|
return code `${this.itemType.graphqlResolveExpression(parameters)}.extractNullable()`;
|
|
@@ -122,14 +122,14 @@ export class OptionType extends AbstractContainerType {
|
|
|
122
122
|
jsonUiSchemaElement(parameters) {
|
|
123
123
|
return this.itemType.jsonUiSchemaElement(parameters);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
return code `${this.itemType.
|
|
125
|
+
jsonSchema(parameters) {
|
|
126
|
+
return code `${this.itemType.jsonSchema(parameters)}.optional()`;
|
|
127
127
|
}
|
|
128
128
|
toJsonExpression({ variables, }) {
|
|
129
129
|
return code `${variables.value}.map(item => (${this.itemType.toJsonExpression({ variables: { value: code `item` } })})).extract()`;
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
const itemTypeToRdfExpression = this.itemType.
|
|
131
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
132
|
+
const itemTypeToRdfExpression = this.itemType.toRdfResourceValuesExpression({
|
|
133
133
|
variables: { ...variables, value: code `value` },
|
|
134
134
|
});
|
|
135
135
|
let toRdfExpression = code `${variables.value}.toList()`;
|
|
@@ -162,10 +162,10 @@ __decorate([
|
|
|
162
162
|
], OptionType.prototype, "schemaType", null);
|
|
163
163
|
__decorate([
|
|
164
164
|
Memoize()
|
|
165
|
-
], OptionType.prototype, "
|
|
165
|
+
], OptionType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
166
166
|
__decorate([
|
|
167
167
|
Memoize()
|
|
168
|
-
], OptionType.prototype, "
|
|
168
|
+
], OptionType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
169
169
|
__decorate([
|
|
170
170
|
Memoize()
|
|
171
171
|
], OptionType.prototype, "jsonType", null);
|
|
@@ -3,11 +3,11 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
3
3
|
export declare class SetType<ItemTypeT extends SetType.ItemType> extends AbstractCollectionType<ItemTypeT> {
|
|
4
4
|
readonly graphqlArgs: AbstractCollectionType<ItemTypeT>["graphqlArgs"];
|
|
5
5
|
readonly kind = "SetType";
|
|
6
|
-
get
|
|
7
|
-
get
|
|
8
|
-
|
|
6
|
+
get valueSparqlConstructTriplesFunction(): Code;
|
|
7
|
+
get valueSparqlWherePatternsFunction(): Code;
|
|
8
|
+
fromRdfResourceValuesExpression(parameters: Parameters<AbstractCollectionType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
9
9
|
jsonType(): AbstractCollectionType.JsonType;
|
|
10
|
-
|
|
10
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractCollectionType<ItemTypeT>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
11
11
|
}
|
|
12
12
|
export declare namespace SetType {
|
|
13
13
|
type ItemType = AbstractCollectionType.ItemType;
|
|
@@ -13,15 +13,17 @@ import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
|
13
13
|
export class SetType extends AbstractCollectionType {
|
|
14
14
|
graphqlArgs = Maybe.empty();
|
|
15
15
|
kind = "SetType";
|
|
16
|
-
get
|
|
17
|
-
return code `${snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.
|
|
16
|
+
get valueSparqlConstructTriplesFunction() {
|
|
17
|
+
return code `${snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
|
|
18
18
|
}
|
|
19
|
-
get
|
|
20
|
-
return code `${snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.
|
|
19
|
+
get valueSparqlWherePatternsFunction() {
|
|
20
|
+
return code `${snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
fromRdfResourceValuesExpression(parameters) {
|
|
23
23
|
const { variables } = parameters;
|
|
24
|
-
const chain = [
|
|
24
|
+
const chain = [
|
|
25
|
+
this.itemType.fromRdfResourceValuesExpression(parameters),
|
|
26
|
+
];
|
|
25
27
|
if (this.minCount === 0 || this._mutable) {
|
|
26
28
|
chain.push(code `map(values => values.toArray()${this._mutable ? ".concat()" : ""})`);
|
|
27
29
|
}
|
|
@@ -32,24 +34,24 @@ export class SetType extends AbstractCollectionType {
|
|
|
32
34
|
return joinCode(chain, { on: "." });
|
|
33
35
|
}
|
|
34
36
|
jsonType() {
|
|
35
|
-
const name = code
|
|
37
|
+
const name = code `${!this.mutable ? "readonly " : ""}(${this.itemType.jsonType().name})[]`;
|
|
36
38
|
if (this.minCount === 0) {
|
|
37
39
|
return new AbstractCollectionType.JsonType(name, { optional: true });
|
|
38
40
|
}
|
|
39
41
|
return new AbstractCollectionType.JsonType(name);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
return code `${variables.value}.flatMap((item) => ${this.itemType.
|
|
43
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
44
|
+
return code `${variables.value}.flatMap((item) => ${this.itemType.toRdfResourceValuesExpression({
|
|
43
45
|
variables: { ...variables, value: code `item` },
|
|
44
46
|
})})`;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
__decorate([
|
|
48
50
|
Memoize()
|
|
49
|
-
], SetType.prototype, "
|
|
51
|
+
], SetType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
50
52
|
__decorate([
|
|
51
53
|
Memoize()
|
|
52
|
-
], SetType.prototype, "
|
|
54
|
+
], SetType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
53
55
|
__decorate([
|
|
54
56
|
Memoize()
|
|
55
57
|
], SetType.prototype, "jsonType", null);
|
|
@@ -7,7 +7,7 @@ export declare class StringType extends AbstractPrimitiveType<string> {
|
|
|
7
7
|
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
8
|
readonly kind = "StringType";
|
|
9
9
|
readonly schemaType: Code;
|
|
10
|
-
readonly
|
|
10
|
+
readonly valueSparqlWherePatternsFunction: Code;
|
|
11
11
|
readonly typeofs: NonEmptyList<"string">;
|
|
12
12
|
get name(): string;
|
|
13
13
|
protected get schemaObject(): {
|
|
@@ -16,8 +16,8 @@ export declare class StringType extends AbstractPrimitiveType<string> {
|
|
|
16
16
|
kind: Code;
|
|
17
17
|
};
|
|
18
18
|
hashStatements({ variables, }: Parameters<AbstractPrimitiveType<string>["hashStatements"]>[0]): readonly Code[];
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<string>["jsonSchema"]>[0]): Code;
|
|
20
|
+
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
21
21
|
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<string>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<string>["fromRdfExpressionChain"]>;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=StringType.d.ts.map
|
|
@@ -18,7 +18,7 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
18
18
|
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${imports.GraphQLString}`);
|
|
19
19
|
kind = "StringType";
|
|
20
20
|
schemaType = code `${snippets.StringSchema}`;
|
|
21
|
-
|
|
21
|
+
valueSparqlWherePatternsFunction = code `${snippets.stringSparqlWherePatterns}`;
|
|
22
22
|
typeofs = NonEmptyList(["string"]);
|
|
23
23
|
get name() {
|
|
24
24
|
if (this.primitiveIn.length > 0) {
|
|
@@ -37,7 +37,7 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
37
37
|
hashStatements({ variables, }) {
|
|
38
38
|
return [code `${variables.hasher}.update(${variables.value});`];
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
jsonSchema(_parameters) {
|
|
41
41
|
switch (this.primitiveIn.length) {
|
|
42
42
|
case 0:
|
|
43
43
|
return code `${imports.z}.string()`;
|
|
@@ -47,7 +47,7 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
47
47
|
return code `${imports.z}.enum(${arrayOf(...this.primitiveIn)})`;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
51
51
|
return code `[${snippets.literalFactory}.string(${variables.value}${!this.datatype.equals(xsd.string) ? `, ${rdfjsTermExpression(this.datatype)}` : ""})]`;
|
|
52
52
|
}
|
|
53
53
|
fromRdfExpressionChain({ variables, }) {
|
|
@@ -8,7 +8,7 @@ export declare class TermType<ConstantTermT extends Literal | NamedNode = Litera
|
|
|
8
8
|
readonly kind = "TermType";
|
|
9
9
|
readonly nodeKinds: ReadonlySet<NodeKind>;
|
|
10
10
|
readonly schemaType: Code;
|
|
11
|
-
readonly
|
|
11
|
+
readonly valueSparqlWherePatternsFunction: Code;
|
|
12
12
|
constructor({ nodeKinds, ...superParameters }: ConstructorParameters<typeof AbstractTermType<ConstantTermT, RuntimeTermT>>[0] & {
|
|
13
13
|
nodeKinds: ReadonlySet<NodeKind>;
|
|
14
14
|
});
|
|
@@ -21,7 +21,7 @@ export declare class TermType<ConstantTermT extends Literal | NamedNode = Litera
|
|
|
21
21
|
fromJsonExpression({ variables, }: Parameters<AbstractTermType["fromJsonExpression"]>[0]): Code;
|
|
22
22
|
graphqlResolveExpression(_parameters: Parameters<AbstractTermType["graphqlResolveExpression"]>[0]): Code;
|
|
23
23
|
jsonType(): AbstractTermType.JsonType;
|
|
24
|
-
|
|
24
|
+
jsonSchema(_parameters: Parameters<AbstractTermType["jsonSchema"]>[0]): Code;
|
|
25
25
|
toJsonExpression({ variables, }: Parameters<AbstractTermType["toJsonExpression"]>[0]): Code;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=TermType.d.ts.map
|
|
@@ -19,7 +19,7 @@ export class TermType extends AbstractTermType {
|
|
|
19
19
|
kind = "TermType";
|
|
20
20
|
nodeKinds;
|
|
21
21
|
schemaType = code `${snippets.TermSchema}`;
|
|
22
|
-
|
|
22
|
+
valueSparqlWherePatternsFunction = code `${snippets.termSparqlWherePatterns}`;
|
|
23
23
|
constructor({ nodeKinds, ...superParameters }) {
|
|
24
24
|
super(superParameters);
|
|
25
25
|
this.nodeKinds = nodeKinds;
|
|
@@ -63,7 +63,7 @@ export class TermType extends AbstractTermType {
|
|
|
63
63
|
valueToNodeKind = code `${imports.dataFactory}.namedNode(${variables.value}["@id"])`;
|
|
64
64
|
break;
|
|
65
65
|
case "Literal":
|
|
66
|
-
valueToNodeKind = code `${imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${imports.dataFactory}.namedNode(${variables.value}["@type"]) : undefined))`;
|
|
66
|
+
valueToNodeKind = code `${imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined))`;
|
|
67
67
|
break;
|
|
68
68
|
default:
|
|
69
69
|
throw new RangeError(nodeKind);
|
|
@@ -82,7 +82,7 @@ export class TermType extends AbstractTermType {
|
|
|
82
82
|
.map((nodeKind) => `"${NodeKind.toTermType(nodeKind)}"`)
|
|
83
83
|
.join(" | ")} } | { readonly "@language"?: string, readonly "@type"?: string, readonly "@value": string, readonly termType: "Literal" }`);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
jsonSchema(_parameters) {
|
|
86
86
|
return code `${imports.z}.discriminatedUnion("termType", [${joinCode([...this.nodeKinds].map((nodeKind) => {
|
|
87
87
|
switch (nodeKind) {
|
|
88
88
|
case "BlankNode":
|
|
@@ -1,38 +1,46 @@
|
|
|
1
1
|
import * as ast from "../../ast/index.js";
|
|
2
2
|
import { graphqlSchemaVariableStatement } from "./graphqlSchemaVariableStatement.js";
|
|
3
3
|
import { objectSetDeclarations } from "./objectSetDeclarations.js";
|
|
4
|
-
// import { graphqlSchemaVariableStatement } from "./graphqlSchemaVariableStatement.js";
|
|
5
|
-
// import { objectSetDeclarations } from "./objectSetDeclarations.js";
|
|
6
4
|
import { snippets } from "./snippets.js";
|
|
7
5
|
import { synthesizeUberObjectUnionType } from "./synthesizeUberObjectUnionType.js";
|
|
8
|
-
// import { synthesizeUberObjectUnionType } from "./synthesizeUberObjectUnionType.js";
|
|
9
6
|
import { TypeFactory } from "./TypeFactory.js";
|
|
10
7
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
11
8
|
export class TsGenerator {
|
|
12
9
|
typeFactory = new TypeFactory();
|
|
13
10
|
generate(ast_) {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
let declarations = [];
|
|
12
|
+
for (const astNamedUnionType of ast_.namedUnionTypes) {
|
|
13
|
+
if (astNamedUnionType.isObjectUnionType()) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
declarations = declarations.concat(this.typeFactory.createType(astNamedUnionType).declaration.toList());
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const namedObjectTypesToposorted = ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => this.typeFactory.createNamedObjectType(astObjectType));
|
|
19
|
+
const namedObjectUnionTypesToposorted = ast_.namedUnionTypes
|
|
20
|
+
.filter((_) => _.isObjectUnionType())
|
|
21
|
+
.map((astObjectUnionType) => this.typeFactory.createNamedObjectUnionType(astObjectUnionType));
|
|
22
|
+
for (const namedObjectType of namedObjectTypesToposorted) {
|
|
23
|
+
declarations = declarations.concat(namedObjectType.declaration.toList());
|
|
24
|
+
}
|
|
25
|
+
for (const namedObjectUnionType of namedObjectUnionTypesToposorted) {
|
|
26
|
+
declarations = declarations.concat(namedObjectUnionType.declaration.toList());
|
|
27
|
+
}
|
|
28
|
+
const namedObjectTypesNameSorted = namedObjectTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
29
|
+
const namedObjectUnionTypesNameSorted = namedObjectUnionTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
30
|
+
if (namedObjectTypesToposorted.length > 0) {
|
|
31
|
+
const uberObjectUnionType = synthesizeUberObjectUnionType({
|
|
32
|
+
namedObjectTypes: namedObjectTypesToposorted.toReversed(), // Reverse topological order so children ane before parents
|
|
33
|
+
});
|
|
34
|
+
declarations = declarations.concat(uberObjectUnionType.declaration.toList());
|
|
35
|
+
namedObjectUnionTypesNameSorted.push(uberObjectUnionType);
|
|
22
36
|
}
|
|
23
|
-
const objectTypesNameSorted = objectTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
24
|
-
const objectUnionTypesNameSorted = objectUnionTypesToposorted.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
25
|
-
const uberObjectUnionType = synthesizeUberObjectUnionType({
|
|
26
|
-
objectTypes: objectTypesToposorted.toReversed(), // Reverse topological order so children ane before parents
|
|
27
|
-
});
|
|
28
|
-
declarations.push(uberObjectUnionType.declaration);
|
|
29
37
|
declarations.push(...objectSetDeclarations({
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
namedObjectTypes: namedObjectTypesNameSorted,
|
|
39
|
+
namedObjectUnionTypes: namedObjectUnionTypesNameSorted,
|
|
32
40
|
}));
|
|
33
41
|
declarations.push(...graphqlSchemaVariableStatement({
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
namedObjectTypes: namedObjectTypesNameSorted,
|
|
43
|
+
namedObjectUnionTypes: namedObjectUnionTypesNameSorted,
|
|
36
44
|
}).toList());
|
|
37
45
|
declarations.splice(0, 0, joinCode(Object.values(snippets)
|
|
38
46
|
.sort((left, right) => left.usageSiteName.localeCompare(right.usageSiteName))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AnonymousUnionType } from "./AnonymousUnionType.js";
|
|
1
2
|
import type { BigDecimalType } from "./BigDecimalType.js";
|
|
2
3
|
import type { BigIntType } from "./BigIntType.js";
|
|
3
4
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
@@ -14,12 +15,12 @@ import type { LazyObjectSetType } from "./LazyObjectSetType.js";
|
|
|
14
15
|
import type { LazyObjectType } from "./LazyObjectType.js";
|
|
15
16
|
import type { ListType } from "./ListType.js";
|
|
16
17
|
import type { LiteralType } from "./LiteralType.js";
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
18
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
19
|
+
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
20
|
+
import type { NamedUnionType } from "./NamedUnionType.js";
|
|
19
21
|
import type { OptionType } from "./OptionType.js";
|
|
20
22
|
import type { SetType } from "./SetType.js";
|
|
21
23
|
import type { StringType } from "./StringType.js";
|
|
22
24
|
import type { TermType } from "./TermType.js";
|
|
23
|
-
|
|
24
|
-
export type Type = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | DefaultValueType<DefaultValueType.ItemType> | FloatType | IdentifierType | IntType | IriType | LazyObjectOptionType | LazyObjectSetType | LazyObjectType | ListType<ListType.ItemType> | LiteralType | ObjectType | ObjectUnionType | OptionType<OptionType.ItemType> | SetType<SetType.ItemType> | StringType | TermType | UnionType;
|
|
25
|
+
export type Type = AnonymousUnionType | BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | DefaultValueType<DefaultValueType.ItemType> | FloatType | IdentifierType | IntType | IriType | LazyObjectOptionType | LazyObjectSetType | LazyObjectType | ListType<ListType.ItemType> | LiteralType | NamedObjectUnionType | NamedUnionType | NamedObjectType | OptionType<OptionType.ItemType> | SetType<SetType.ItemType> | StringType | TermType;
|
|
25
26
|
//# sourceMappingURL=Type.d.ts.map
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { Literal, NamedNode } from "@rdfjs/types";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import * as ast from "../../ast/index.js";
|
|
3
|
+
import { AnonymousUnionType } from "./AnonymousUnionType.js";
|
|
4
|
+
import { NamedObjectType } from "./NamedObjectType.js";
|
|
5
|
+
import { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
6
|
+
import { NamedUnionType } from "./NamedUnionType.js";
|
|
5
7
|
import type { Type } from "./Type.js";
|
|
6
8
|
export declare class TypeFactory {
|
|
9
|
+
private cachedNamedObjectUnionTypesByShapeIdentifier;
|
|
7
10
|
private cachedObjectTypePropertiesByShapeIdentifier;
|
|
8
11
|
private cachedObjectTypesByShapeIdentifier;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
createObjectUnionType(astType: ast.ObjectUnionType): ObjectUnionType;
|
|
12
|
+
createNamedObjectUnionType(astType: ast.ObjectUnionType): NamedObjectUnionType;
|
|
13
|
+
createNamedObjectType(astType: ast.ObjectType): NamedObjectType;
|
|
12
14
|
createType(astType: ast.Type, parameters?: {
|
|
13
15
|
defaultValue?: Literal | NamedNode;
|
|
14
16
|
}): Type;
|
|
17
|
+
createUnionType(astType: ast.UnionType): AnonymousUnionType | NamedUnionType | NamedObjectUnionType;
|
|
15
18
|
private createBlankNodeType;
|
|
16
19
|
private createDefaultValueType;
|
|
17
20
|
private createIdentifierType;
|
|
@@ -25,6 +28,5 @@ export declare class TypeFactory {
|
|
|
25
28
|
private createOptionType;
|
|
26
29
|
private createSetType;
|
|
27
30
|
private createTermType;
|
|
28
|
-
private createUnionType;
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=TypeFactory.d.ts.map
|