@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
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { camelCase } from "change-case";
|
|
8
|
-
import { Maybe, NonEmptyList } from "purify-ts";
|
|
9
|
-
import { invariant } from "ts-invariant";
|
|
10
|
-
import { Memoize } from "typescript-memoize";
|
|
11
|
-
import { IdentifierPrefixProperty as _IdentifierPrefixProperty } from "./_ObjectType/IdentifierPrefixProperty.js";
|
|
12
|
-
import { IdentifierProperty as _IdentifierProperty } from "./_ObjectType/IdentifierProperty.js";
|
|
13
|
-
import { identifierTypeDeclarations } from "./_ObjectType/identifierTypeDeclarations.js";
|
|
14
|
-
import { ObjectType_classDeclaration } from "./_ObjectType/ObjectType_classDeclaration.js";
|
|
15
|
-
import { ObjectType_createFunctionDeclaration } from "./_ObjectType/ObjectType_createFunctionDeclaration.js";
|
|
16
|
-
import { ObjectType_equalsFunctionOrMethodDeclaration } from "./_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js";
|
|
17
|
-
import { ObjectType_filterFunctionDeclaration } from "./_ObjectType/ObjectType_filterFunctionDeclaration.js";
|
|
18
|
-
import { ObjectType_filterTypeDeclaration } from "./_ObjectType/ObjectType_filterTypeDeclaration.js";
|
|
19
|
-
import { ObjectType_fromJsonFunctionDeclarations } from "./_ObjectType/ObjectType_fromJsonFunctionDeclarations.js";
|
|
20
|
-
import { ObjectType_fromRdfFunctionDeclaration } from "./_ObjectType/ObjectType_fromRdfFunctionDeclaration.js";
|
|
21
|
-
import { ObjectType_fromRdfTypeVariableStatement } from "./_ObjectType/ObjectType_fromRdfTypeVariableStatement.js";
|
|
22
|
-
import { ObjectType_graphqlTypeVariableStatement } from "./_ObjectType/ObjectType_graphqlTypeVariableStatement.js";
|
|
23
|
-
import { ObjectType_hashFunctionOrMethodDeclarations } from "./_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js";
|
|
24
|
-
import { ObjectType_interfaceDeclaration } from "./_ObjectType/ObjectType_interfaceDeclaration.js";
|
|
25
|
-
import { ObjectType_isTypeFunctionDeclaration } from "./_ObjectType/ObjectType_isTypeFunctionDeclaration.js";
|
|
26
|
-
import { ObjectType_jsonSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js";
|
|
27
|
-
import { ObjectType_jsonTypeAliasDeclaration } from "./_ObjectType/ObjectType_jsonTypeAliasDeclaration.js";
|
|
28
|
-
import { ObjectType_jsonUiSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js";
|
|
29
|
-
import { ObjectType_jsonZodSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js";
|
|
30
|
-
import { ObjectType_objectSetMethodNames } from "./_ObjectType/ObjectType_objectSetMethodNames.js";
|
|
31
|
-
import { ObjectType_propertiesFromRdfFunctionDeclaration } from "./_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.js";
|
|
32
|
-
import { ObjectType_schemaVariableStatement } from "./_ObjectType/ObjectType_schemaVariableStatement.js";
|
|
33
|
-
import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js";
|
|
34
|
-
import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
|
|
35
|
-
import { ObjectType_sparqlConstructTriplesFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.js";
|
|
36
|
-
import { ObjectType_sparqlWherePatternsFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.js";
|
|
37
|
-
import { ObjectType_toJsonFunctionOrMethodDeclaration } from "./_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js";
|
|
38
|
-
import { ObjectType_toRdfFunctionOrMethodDeclaration } from "./_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.js";
|
|
39
|
-
import { ShaclProperty as _ShaclProperty } from "./_ObjectType/ShaclProperty.js";
|
|
40
|
-
import { TypeDiscriminantProperty as _TypeDiscriminantProperty } from "./_ObjectType/TypeDiscriminantProperty.js";
|
|
41
|
-
import { AbstractDeclaredType } from "./AbstractDeclaredType.js";
|
|
42
|
-
import { imports } from "./imports.js";
|
|
43
|
-
import { snippets } from "./snippets.js";
|
|
44
|
-
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
45
|
-
import { code, def, joinCode } from "./ts-poet-wrapper.js";
|
|
46
|
-
export class ObjectType extends AbstractDeclaredType {
|
|
47
|
-
imports;
|
|
48
|
-
toRdfTypes;
|
|
49
|
-
abstract;
|
|
50
|
-
declarationType;
|
|
51
|
-
extern;
|
|
52
|
-
fromRdfType;
|
|
53
|
-
graphqlArgs = Maybe.empty();
|
|
54
|
-
identifierType;
|
|
55
|
-
kind = "ObjectType";
|
|
56
|
-
staticModuleName;
|
|
57
|
-
synthetic;
|
|
58
|
-
typeofs = NonEmptyList(["object"]);
|
|
59
|
-
constructor({ abstract, declarationType, extern, fromRdfType, identifierType, imports, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyParentObjectTypes, lazyProperties, staticModuleName, synthetic, toRdfTypes, ...superParameters }) {
|
|
60
|
-
super(superParameters);
|
|
61
|
-
this.abstract = abstract;
|
|
62
|
-
this.declarationType = declarationType;
|
|
63
|
-
this.extern = extern;
|
|
64
|
-
this.fromRdfType = fromRdfType;
|
|
65
|
-
this.identifierType = identifierType;
|
|
66
|
-
this.imports = imports;
|
|
67
|
-
// Lazily initialize some members in getters to avoid recursive construction
|
|
68
|
-
this.lazyAncestorObjectTypes = lazyAncestorObjectTypes;
|
|
69
|
-
this.lazyChildObjectTypes = lazyChildObjectTypes;
|
|
70
|
-
this.lazyDescendantObjectTypes = lazyDescendantObjectTypes;
|
|
71
|
-
this.lazyParentObjectTypes = lazyParentObjectTypes;
|
|
72
|
-
this.lazyProperties = lazyProperties;
|
|
73
|
-
this.staticModuleName = staticModuleName;
|
|
74
|
-
this.synthetic = synthetic;
|
|
75
|
-
this.toRdfTypes = toRdfTypes;
|
|
76
|
-
}
|
|
77
|
-
get _discriminantProperty() {
|
|
78
|
-
const discriminantProperty = this.properties.find((property) => property instanceof ObjectType.TypeDiscriminantProperty);
|
|
79
|
-
invariant(discriminantProperty);
|
|
80
|
-
return {
|
|
81
|
-
name: discriminantProperty.name,
|
|
82
|
-
ownValues: discriminantProperty.type.ownValues,
|
|
83
|
-
descendantValues: discriminantProperty.type.descendantValues,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
get ancestorObjectTypes() {
|
|
87
|
-
return this.lazyAncestorObjectTypes();
|
|
88
|
-
}
|
|
89
|
-
get childObjectTypes() {
|
|
90
|
-
return this.lazyChildObjectTypes();
|
|
91
|
-
}
|
|
92
|
-
get conversions() {
|
|
93
|
-
return [
|
|
94
|
-
{
|
|
95
|
-
conversionExpression: (value) => value,
|
|
96
|
-
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object" && ${value} instanceof ${this.name}`,
|
|
97
|
-
sourceTypeName: this.name,
|
|
98
|
-
sourceTypeof: "object",
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
get declaration() {
|
|
103
|
-
const declarations = [];
|
|
104
|
-
for (const import_ of this.imports) {
|
|
105
|
-
declarations.push(code `${import_}`);
|
|
106
|
-
}
|
|
107
|
-
if (!this.extern) {
|
|
108
|
-
const staticModuleDeclarations = [];
|
|
109
|
-
switch (this.declarationType) {
|
|
110
|
-
case "class": {
|
|
111
|
-
declarations.push(ObjectType_classDeclaration.bind(this)());
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case "interface": {
|
|
115
|
-
declarations.push(ObjectType_interfaceDeclaration.bind(this)());
|
|
116
|
-
staticModuleDeclarations.push(...ObjectType_createFunctionDeclaration.bind(this)().toList(), ...ObjectType_equalsFunctionOrMethodDeclaration.bind(this)().toList(), ...ObjectType_hashFunctionOrMethodDeclarations.bind(this)());
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
staticModuleDeclarations.push(...ObjectType_graphqlTypeVariableStatement.bind(this)().toList(), ...identifierTypeDeclarations.bind(this)(), ...ObjectType_jsonTypeAliasDeclaration.bind(this)().toList(), ObjectType_filterFunctionDeclaration.bind(this)(), ObjectType_filterTypeDeclaration.bind(this)(), ...ObjectType_fromJsonFunctionDeclarations.bind(this)(), ...ObjectType_fromRdfFunctionDeclaration.bind(this)().toList(), ...ObjectType_fromRdfTypeVariableStatement.bind(this)().toList(), ObjectType_isTypeFunctionDeclaration.bind(this)(), ...ObjectType_jsonSchemaFunctionDeclaration.bind(this)().toList(), ...ObjectType_jsonUiSchemaFunctionDeclaration.bind(this)().toList(), ...ObjectType_jsonZodSchemaFunctionDeclaration.bind(this)().toList(), ...ObjectType_propertiesFromRdfFunctionDeclaration.bind(this)().toList(), ObjectType_schemaVariableStatement.bind(this)(), ...ObjectType_sparqlConstructQueryFunctionDeclaration.bind(this)().toList(), ...ObjectType_sparqlConstructQueryStringFunctionDeclaration.bind(this)().toList(), ...ObjectType_sparqlConstructTriplesFunctionDeclaration.bind(this)().toList(), ...ObjectType_sparqlWherePatternsFunctionDeclaration.bind(this)().toList(), ...(this.declarationType === "interface"
|
|
121
|
-
? ObjectType_toJsonFunctionOrMethodDeclaration.bind(this)().toList()
|
|
122
|
-
: []), ...(this.declarationType === "interface"
|
|
123
|
-
? ObjectType_toRdfFunctionOrMethodDeclaration.bind(this)().toList()
|
|
124
|
-
: []));
|
|
125
|
-
if (staticModuleDeclarations.length > 0) {
|
|
126
|
-
declarations.push(code `\
|
|
127
|
-
export namespace ${def(this.staticModuleName)} {
|
|
128
|
-
${joinCode(staticModuleDeclarations, { on: "\n\n" })}
|
|
129
|
-
}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return joinCode(declarations, { on: "\n\n" });
|
|
133
|
-
}
|
|
134
|
-
get descendantFromRdfTypeVariables() {
|
|
135
|
-
return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfTypeVariable.toList());
|
|
136
|
-
}
|
|
137
|
-
get descendantFromRdfTypes() {
|
|
138
|
-
return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfType.toList());
|
|
139
|
-
}
|
|
140
|
-
get descendantObjectTypes() {
|
|
141
|
-
return this.lazyDescendantObjectTypes();
|
|
142
|
-
}
|
|
143
|
-
get discriminantProperty() {
|
|
144
|
-
return Maybe.of(this._discriminantProperty);
|
|
145
|
-
}
|
|
146
|
-
get discriminantValue() {
|
|
147
|
-
return this.name;
|
|
148
|
-
}
|
|
149
|
-
get equalsFunction() {
|
|
150
|
-
switch (this.declarationType) {
|
|
151
|
-
case "class":
|
|
152
|
-
return code `((left, right) => left.${syntheticNamePrefix}equals(right))`;
|
|
153
|
-
case "interface":
|
|
154
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}equals`;
|
|
155
|
-
default:
|
|
156
|
-
throw new RangeError(this.declarationType);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
get filterFunction() {
|
|
160
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}filter`;
|
|
161
|
-
}
|
|
162
|
-
get filterType() {
|
|
163
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}Filter`;
|
|
164
|
-
}
|
|
165
|
-
get fromRdfTypeVariable() {
|
|
166
|
-
return this.fromRdfType.map(() => code `${this.staticModuleName}.${syntheticNamePrefix}fromRdfType`);
|
|
167
|
-
}
|
|
168
|
-
get graphqlType() {
|
|
169
|
-
return new AbstractDeclaredType.GraphqlType(code `${this.staticModuleName}.${syntheticNamePrefix}GraphQL`);
|
|
170
|
-
}
|
|
171
|
-
get identifierProperty() {
|
|
172
|
-
const identifierProperty = this.properties.find((property) => property.kind === "IdentifierProperty");
|
|
173
|
-
invariant(identifierProperty);
|
|
174
|
-
return identifierProperty;
|
|
175
|
-
}
|
|
176
|
-
get identifierTypeAlias() {
|
|
177
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}Identifier`;
|
|
178
|
-
}
|
|
179
|
-
get mutable() {
|
|
180
|
-
return this.properties.some((property) => property.mutable);
|
|
181
|
-
}
|
|
182
|
-
get objectSetMethodNames() {
|
|
183
|
-
return ObjectType_objectSetMethodNames.bind(this)();
|
|
184
|
-
}
|
|
185
|
-
get ownProperties() {
|
|
186
|
-
if (this.parentObjectTypes.length === 0) {
|
|
187
|
-
// Consider that a root of the object type hierarchy "owns" the identifier and type discriminant properties
|
|
188
|
-
// for all of its subtypes in the hierarchy.
|
|
189
|
-
// invariant(this.properties.length >= 2, this.name);
|
|
190
|
-
return this.properties;
|
|
191
|
-
}
|
|
192
|
-
return this.ownShaclProperties;
|
|
193
|
-
}
|
|
194
|
-
get ownShaclProperties() {
|
|
195
|
-
return this.properties.filter((property) => property.kind === "ShaclProperty");
|
|
196
|
-
}
|
|
197
|
-
get parentObjectTypes() {
|
|
198
|
-
return this.lazyParentObjectTypes();
|
|
199
|
-
}
|
|
200
|
-
get properties() {
|
|
201
|
-
const properties = this.lazyProperties(this);
|
|
202
|
-
const propertyNames = new Set();
|
|
203
|
-
for (const property of properties) {
|
|
204
|
-
if (propertyNames.has(property.name)) {
|
|
205
|
-
throw new Error(`duplicate property '${property.name}'`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return properties;
|
|
209
|
-
}
|
|
210
|
-
get schema() {
|
|
211
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}schema`;
|
|
212
|
-
}
|
|
213
|
-
get schemaType() {
|
|
214
|
-
return code `typeof ${this.schema}`;
|
|
215
|
-
}
|
|
216
|
-
get sparqlConstructTriplesFunction() {
|
|
217
|
-
return code `(({ filter, ignoreRdfType, valueVariable, variablePrefix }: ${snippets.SparqlConstructTriplesFunctionParameters}<${this.filterType}, ${this.schemaType}>) => ${this.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples({ filter, focusIdentifier: valueVariable, ignoreRdfType, variablePrefix }))`;
|
|
218
|
-
}
|
|
219
|
-
get sparqlWherePatternsFunction() {
|
|
220
|
-
return code `(({ filter, ignoreRdfType, preferredLanguages, propertyPatterns, valueVariable, variablePrefix }: ${snippets.SparqlWherePatternsFunctionParameters}<${this.filterType}, ${this.schemaType}>) => (propertyPatterns as readonly ${snippets.SparqlPattern}[]).concat(${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns({ filter, focusIdentifier: valueVariable, ignoreRdfType, preferredLanguages, variablePrefix })))`;
|
|
221
|
-
}
|
|
222
|
-
get toRdfjsResourceType() {
|
|
223
|
-
if (this.parentObjectTypes.length > 0) {
|
|
224
|
-
return this.parentObjectTypes[0].toRdfjsResourceType;
|
|
225
|
-
}
|
|
226
|
-
return code `${imports.Resource}${this.identifierType.kind === "IriType" ? code `<${imports.NamedNode}>` : ""}`;
|
|
227
|
-
}
|
|
228
|
-
get thisVariable() {
|
|
229
|
-
switch (this.declarationType) {
|
|
230
|
-
case "class":
|
|
231
|
-
return code `this`;
|
|
232
|
-
case "interface":
|
|
233
|
-
return code `_${camelCase(this.name)}`;
|
|
234
|
-
default:
|
|
235
|
-
throw new RangeError(this.declarationType);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
fromJsonExpression({ variables, }) {
|
|
239
|
-
// Assumes the JSON object has been recursively validated already.
|
|
240
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}fromJson(${variables.value}).unsafeCoerce()`;
|
|
241
|
-
}
|
|
242
|
-
fromRdfExpression({ variables, }) {
|
|
243
|
-
return code `${variables.resourceValues}.chain(values => values.chainMap(value => value.toResource().chain(resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdf(resource, { context: ${variables.context}, ${variables.ignoreRdfType ? "ignoreRdfType: true, " : ""}objectSet: ${variables.objectSet}, preferredLanguages: ${variables.preferredLanguages} }))))`;
|
|
244
|
-
}
|
|
245
|
-
graphqlResolveExpression({ variables, }) {
|
|
246
|
-
return variables.value;
|
|
247
|
-
}
|
|
248
|
-
hashStatements({ variables, }) {
|
|
249
|
-
switch (this.declarationType) {
|
|
250
|
-
case "class":
|
|
251
|
-
return [
|
|
252
|
-
code `${variables.value}.${syntheticNamePrefix}hash(${variables.hasher});`,
|
|
253
|
-
];
|
|
254
|
-
case "interface":
|
|
255
|
-
return [
|
|
256
|
-
code `${this.staticModuleName}.${syntheticNamePrefix}hash(${variables.value}, ${variables.hasher});`,
|
|
257
|
-
];
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
jsonType() {
|
|
261
|
-
return new AbstractDeclaredType.JsonType(code `${this.staticModuleName}.${syntheticNamePrefix}Json`);
|
|
262
|
-
}
|
|
263
|
-
jsonUiSchemaElement({ variables, }) {
|
|
264
|
-
return Maybe.of(code `${this.staticModuleName}.${syntheticNamePrefix}jsonUiSchema({ scopePrefix: ${variables.scopePrefix} })`);
|
|
265
|
-
}
|
|
266
|
-
jsonZodSchema({ context, }) {
|
|
267
|
-
let expression = code `${this.staticModuleName}.${syntheticNamePrefix}jsonZodSchema()`;
|
|
268
|
-
if (context === "property" &&
|
|
269
|
-
this.properties.some((property) => property.recursive)) {
|
|
270
|
-
expression = code `${imports.z}.lazy((): ${imports.z}.ZodType<${this.staticModuleName}.${syntheticNamePrefix}Json> => ${expression})`;
|
|
271
|
-
}
|
|
272
|
-
return expression;
|
|
273
|
-
}
|
|
274
|
-
newExpression({ parameters }) {
|
|
275
|
-
switch (this.declarationType) {
|
|
276
|
-
case "class":
|
|
277
|
-
return code `new ${this.name}(${parameters})`;
|
|
278
|
-
case "interface":
|
|
279
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}create(${parameters})`;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
toJsonExpression({ variables, }) {
|
|
283
|
-
switch (this.declarationType) {
|
|
284
|
-
case "class":
|
|
285
|
-
return code `${variables.value}.${syntheticNamePrefix}toJson()`;
|
|
286
|
-
case "interface":
|
|
287
|
-
return code `${this.staticModuleName}.${syntheticNamePrefix}toJson(${variables.value})`;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
toRdfExpression({ variables, }) {
|
|
291
|
-
switch (this.declarationType) {
|
|
292
|
-
case "class":
|
|
293
|
-
return code `[${variables.value}.${syntheticNamePrefix}toRdf({ graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
|
|
294
|
-
case "interface":
|
|
295
|
-
return code `[${this.staticModuleName}.${syntheticNamePrefix}toRdf(${variables.value}, { graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
ensureAtMostOneSuperObjectType() {
|
|
299
|
-
if (this.parentObjectTypes.length > 1) {
|
|
300
|
-
throw new RangeError(`object type '${this.name}' has multiple super object types`);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
lazyAncestorObjectTypes;
|
|
304
|
-
lazyChildObjectTypes;
|
|
305
|
-
lazyDescendantObjectTypes;
|
|
306
|
-
lazyParentObjectTypes;
|
|
307
|
-
lazyProperties;
|
|
308
|
-
}
|
|
309
|
-
__decorate([
|
|
310
|
-
Memoize()
|
|
311
|
-
], ObjectType.prototype, "_discriminantProperty", null);
|
|
312
|
-
__decorate([
|
|
313
|
-
Memoize()
|
|
314
|
-
], ObjectType.prototype, "ancestorObjectTypes", null);
|
|
315
|
-
__decorate([
|
|
316
|
-
Memoize()
|
|
317
|
-
], ObjectType.prototype, "childObjectTypes", null);
|
|
318
|
-
__decorate([
|
|
319
|
-
Memoize()
|
|
320
|
-
], ObjectType.prototype, "conversions", null);
|
|
321
|
-
__decorate([
|
|
322
|
-
Memoize()
|
|
323
|
-
], ObjectType.prototype, "descendantFromRdfTypeVariables", null);
|
|
324
|
-
__decorate([
|
|
325
|
-
Memoize()
|
|
326
|
-
], ObjectType.prototype, "descendantFromRdfTypes", null);
|
|
327
|
-
__decorate([
|
|
328
|
-
Memoize()
|
|
329
|
-
], ObjectType.prototype, "descendantObjectTypes", null);
|
|
330
|
-
__decorate([
|
|
331
|
-
Memoize()
|
|
332
|
-
], ObjectType.prototype, "discriminantProperty", null);
|
|
333
|
-
__decorate([
|
|
334
|
-
Memoize()
|
|
335
|
-
], ObjectType.prototype, "discriminantValue", null);
|
|
336
|
-
__decorate([
|
|
337
|
-
Memoize()
|
|
338
|
-
], ObjectType.prototype, "equalsFunction", null);
|
|
339
|
-
__decorate([
|
|
340
|
-
Memoize()
|
|
341
|
-
], ObjectType.prototype, "filterFunction", null);
|
|
342
|
-
__decorate([
|
|
343
|
-
Memoize()
|
|
344
|
-
], ObjectType.prototype, "filterType", null);
|
|
345
|
-
__decorate([
|
|
346
|
-
Memoize()
|
|
347
|
-
], ObjectType.prototype, "fromRdfTypeVariable", null);
|
|
348
|
-
__decorate([
|
|
349
|
-
Memoize()
|
|
350
|
-
], ObjectType.prototype, "graphqlType", null);
|
|
351
|
-
__decorate([
|
|
352
|
-
Memoize()
|
|
353
|
-
], ObjectType.prototype, "identifierProperty", null);
|
|
354
|
-
__decorate([
|
|
355
|
-
Memoize()
|
|
356
|
-
], ObjectType.prototype, "identifierTypeAlias", null);
|
|
357
|
-
__decorate([
|
|
358
|
-
Memoize()
|
|
359
|
-
], ObjectType.prototype, "mutable", null);
|
|
360
|
-
__decorate([
|
|
361
|
-
Memoize()
|
|
362
|
-
], ObjectType.prototype, "objectSetMethodNames", null);
|
|
363
|
-
__decorate([
|
|
364
|
-
Memoize()
|
|
365
|
-
], ObjectType.prototype, "ownProperties", null);
|
|
366
|
-
__decorate([
|
|
367
|
-
Memoize()
|
|
368
|
-
], ObjectType.prototype, "ownShaclProperties", null);
|
|
369
|
-
__decorate([
|
|
370
|
-
Memoize()
|
|
371
|
-
], ObjectType.prototype, "parentObjectTypes", null);
|
|
372
|
-
__decorate([
|
|
373
|
-
Memoize()
|
|
374
|
-
], ObjectType.prototype, "properties", null);
|
|
375
|
-
__decorate([
|
|
376
|
-
Memoize()
|
|
377
|
-
], ObjectType.prototype, "schema", null);
|
|
378
|
-
__decorate([
|
|
379
|
-
Memoize()
|
|
380
|
-
], ObjectType.prototype, "schemaType", null);
|
|
381
|
-
__decorate([
|
|
382
|
-
Memoize()
|
|
383
|
-
], ObjectType.prototype, "sparqlConstructTriplesFunction", null);
|
|
384
|
-
__decorate([
|
|
385
|
-
Memoize()
|
|
386
|
-
], ObjectType.prototype, "sparqlWherePatternsFunction", null);
|
|
387
|
-
__decorate([
|
|
388
|
-
Memoize()
|
|
389
|
-
], ObjectType.prototype, "toRdfjsResourceType", null);
|
|
390
|
-
__decorate([
|
|
391
|
-
Memoize()
|
|
392
|
-
], ObjectType.prototype, "thisVariable", null);
|
|
393
|
-
__decorate([
|
|
394
|
-
Memoize()
|
|
395
|
-
], ObjectType.prototype, "jsonType", null);
|
|
396
|
-
(function (ObjectType) {
|
|
397
|
-
ObjectType.IdentifierPrefixProperty = _IdentifierPrefixProperty;
|
|
398
|
-
ObjectType.IdentifierProperty = _IdentifierProperty;
|
|
399
|
-
ObjectType.ShaclProperty = _ShaclProperty;
|
|
400
|
-
ObjectType.TypeDiscriminantProperty = _TypeDiscriminantProperty;
|
|
401
|
-
})(ObjectType || (ObjectType = {}));
|
|
402
|
-
//# sourceMappingURL=ObjectType.js.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Maybe, NonEmptyList } from "purify-ts";
|
|
2
|
-
import { MemberType } from "./_ObjectUnionType/MemberType.js";
|
|
3
|
-
import { AbstractDeclaredType } from "./AbstractDeclaredType.js";
|
|
4
|
-
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
5
|
-
import type { IdentifierType } from "./IdentifierType.js";
|
|
6
|
-
import type { IriType } from "./IriType.js";
|
|
7
|
-
import type { ObjectType } from "./ObjectType.js";
|
|
8
|
-
import { type Code } from "./ts-poet-wrapper.js";
|
|
9
|
-
/**
|
|
10
|
-
* A union of object types, generated as a type alias
|
|
11
|
-
*
|
|
12
|
-
* type SomeUnion = Member1 | Member2 | ...
|
|
13
|
-
*
|
|
14
|
-
* with associated functions that switch on the type discriminant property and delegate to the appropriate
|
|
15
|
-
* member type code.
|
|
16
|
-
*
|
|
17
|
-
* It also generates SPARQL graph patterns that UNION the member object types.
|
|
18
|
-
*/
|
|
19
|
-
export declare class ObjectUnionType extends AbstractDeclaredType {
|
|
20
|
-
readonly graphqlArgs: AbstractDeclaredType["graphqlArgs"];
|
|
21
|
-
readonly identifierType: BlankNodeType | IdentifierType | IriType;
|
|
22
|
-
readonly kind = "ObjectUnionType";
|
|
23
|
-
readonly memberTypes: readonly MemberType[];
|
|
24
|
-
readonly typeofs: NonEmptyList<"object">;
|
|
25
|
-
constructor({ identifierType, memberTypes, ...superParameters }: ConstructorParameters<typeof AbstractDeclaredType>[0] & {
|
|
26
|
-
comment: Maybe<string>;
|
|
27
|
-
export_: boolean;
|
|
28
|
-
identifierType: BlankNodeType | IdentifierType | IriType;
|
|
29
|
-
label: Maybe<string>;
|
|
30
|
-
memberTypes: readonly ObjectType[];
|
|
31
|
-
name: string;
|
|
32
|
-
});
|
|
33
|
-
get conversions(): readonly AbstractDeclaredType.Conversion[];
|
|
34
|
-
get declaration(): Code;
|
|
35
|
-
get discriminantProperty(): Maybe<AbstractDeclaredType.DiscriminantProperty>;
|
|
36
|
-
get equalsFunction(): Code;
|
|
37
|
-
get filterFunction(): Code;
|
|
38
|
-
get filterType(): Code;
|
|
39
|
-
get graphqlType(): AbstractDeclaredType.GraphqlType;
|
|
40
|
-
get identifierTypeAlias(): Code;
|
|
41
|
-
get mutable(): boolean;
|
|
42
|
-
get objectSetMethodNames(): ObjectType.ObjectSetMethodNames;
|
|
43
|
-
get schema(): Code;
|
|
44
|
-
get schemaType(): Code;
|
|
45
|
-
get sparqlConstructTriplesFunction(): Code;
|
|
46
|
-
get sparqlWherePatternsFunction(): Code;
|
|
47
|
-
get staticModuleName(): string;
|
|
48
|
-
protected get _discriminantProperty(): AbstractDeclaredType.DiscriminantProperty;
|
|
49
|
-
protected get concreteMemberTypes(): readonly MemberType[];
|
|
50
|
-
protected get thisVariable(): Code;
|
|
51
|
-
fromJsonExpression({ variables, }: Parameters<AbstractDeclaredType["fromJsonExpression"]>[0]): Code;
|
|
52
|
-
fromRdfExpression({ variables, }: Parameters<AbstractDeclaredType["fromRdfExpression"]>[0]): Code;
|
|
53
|
-
graphqlResolveExpression({ variables, }: {
|
|
54
|
-
variables: {
|
|
55
|
-
value: Code;
|
|
56
|
-
};
|
|
57
|
-
}): Code;
|
|
58
|
-
hashStatements({ variables, }: Parameters<AbstractDeclaredType["hashStatements"]>[0]): readonly Code[];
|
|
59
|
-
jsonType(): AbstractDeclaredType.JsonType;
|
|
60
|
-
jsonUiSchemaElement(): Maybe<Code>;
|
|
61
|
-
jsonZodSchema({ context, }: Parameters<AbstractDeclaredType["jsonZodSchema"]>[0]): Code;
|
|
62
|
-
toJsonExpression({ variables, }: Parameters<AbstractDeclaredType["toJsonExpression"]>[0]): Code;
|
|
63
|
-
toRdfExpression({ variables, }: Parameters<AbstractDeclaredType["toRdfExpression"]>[0]): Code;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=ObjectUnionType.d.ts.map
|