@shaclmate/compiler 4.0.41 → 4.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -0
- package/dist/ShapesGraphToAstTransformer.js +10 -45
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.d.ts +17 -0
- package/dist/_ShapesGraphToAstTransformer/{transformPropertyShapeToAstObjectTypeProperty.js → transformPropertyShapeToAstStructTypeField.js} +71 -48
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +29 -20
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.d.ts → transformShapeToAstStructType.d.ts} +2 -2
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.js → transformShapeToAstStructType.js} +35 -29
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +2 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractCompoundType.d.ts +2 -2
- package/dist/ast/AbstractCompoundType.js +4 -4
- package/dist/ast/AbstractContainerType.d.ts +2 -2
- package/dist/ast/AbstractContainerType.js +4 -4
- package/dist/ast/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +10 -10
- package/dist/ast/{AbstractLazyObjectType.js → AbstractLazyType.js} +3 -3
- package/dist/ast/AbstractType.d.ts +1 -1
- package/dist/ast/AbstractType.js +3 -0
- package/dist/ast/Ast.d.ts +2 -4
- package/dist/ast/DefaultValueType.js +2 -1
- package/dist/ast/IntersectionType.d.ts +2 -2
- package/dist/ast/IntersectionType.js +3 -3
- package/dist/ast/LazyOptionType.d.ts +6 -0
- package/dist/ast/LazyOptionType.js +5 -0
- package/dist/ast/LazySetType.d.ts +6 -0
- package/dist/ast/LazySetType.js +5 -0
- package/dist/ast/LazyType.d.ts +5 -0
- package/dist/ast/LazyType.js +5 -0
- package/dist/ast/ListType.d.ts +2 -2
- package/dist/ast/ListType.js +4 -4
- package/dist/ast/OptionType.js +2 -1
- package/dist/ast/SetType.js +2 -1
- package/dist/ast/StructCompoundType.d.ts +12 -0
- package/dist/ast/{ObjectCompoundType.js → StructCompoundType.js} +18 -18
- package/dist/ast/StructIntersectionType.d.ts +4 -0
- package/dist/ast/StructIntersectionType.js +2 -0
- package/dist/ast/{ObjectType.d.ts → StructType.d.ts} +28 -27
- package/dist/ast/{ObjectType.js → StructType.js} +81 -78
- package/dist/ast/StructUnionType.d.ts +4 -0
- package/dist/ast/StructUnionType.js +2 -0
- package/dist/ast/Type.d.ts +5 -5
- package/dist/ast/Type.js +4 -4
- package/dist/ast/UnionType.d.ts +2 -2
- package/dist/ast/UnionType.js +3 -3
- package/dist/ast/index.d.ts +7 -7
- package/dist/ast/index.js +7 -7
- package/dist/generators/AstJsonGenerator.js +2 -2
- package/dist/generators/transformAstToLabeledPropertyGraph.js +8 -8
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
- package/dist/generators/ts/AbstractContainerType.js +6 -6
- package/dist/generators/ts/AbstractDateType.d.ts +1 -7
- package/dist/generators/ts/AbstractDateType.js +1 -11
- package/dist/generators/ts/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +7 -7
- package/dist/generators/ts/{AbstractLazyObjectType.js → AbstractLazyType.js} +19 -17
- package/dist/generators/ts/AbstractLiteralType.d.ts +2 -5
- package/dist/generators/ts/AbstractLiteralType.js +0 -21
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -7
- package/dist/generators/ts/AbstractNumericType.js +15 -25
- package/dist/generators/ts/AbstractObjectSetType.d.ts +1 -1
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -1
- package/dist/generators/ts/AbstractPrimitiveType.js +1 -1
- package/dist/generators/ts/AbstractTermType.d.ts +6 -21
- package/dist/generators/ts/AbstractTermType.js +26 -55
- package/dist/generators/ts/AbstractType.d.ts +40 -47
- package/dist/generators/ts/AbstractType.js +17 -6
- package/dist/generators/ts/BigDecimalType.d.ts +3 -3
- package/dist/generators/ts/BigDecimalType.js +3 -8
- package/dist/generators/ts/BigIntType.d.ts +2 -2
- package/dist/generators/ts/BigIntType.js +7 -4
- package/dist/generators/ts/BlankNodeType.d.ts +2 -7
- package/dist/generators/ts/BlankNodeType.js +2 -7
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +12 -14
- package/dist/generators/ts/DateTimeType.d.ts +2 -2
- package/dist/generators/ts/DateTimeType.js +14 -4
- package/dist/generators/ts/DateType.d.ts +2 -2
- package/dist/generators/ts/DateType.js +14 -4
- package/dist/generators/ts/DefaultValueType.d.ts +8 -8
- package/dist/generators/ts/DefaultValueType.js +10 -12
- package/dist/generators/ts/FloatType.d.ts +2 -2
- package/dist/generators/ts/FloatType.js +7 -4
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +2 -7
- package/dist/generators/ts/IntType.d.ts +2 -2
- package/dist/generators/ts/IntType.js +7 -4
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +12 -14
- package/dist/generators/ts/{LazyObjectOptionType.d.ts → LazyOptionType.d.ts} +12 -11
- package/dist/generators/ts/{LazyObjectOptionType.js → LazyOptionType.js} +23 -14
- package/dist/generators/ts/LazySetType.d.ts +20 -0
- package/dist/generators/ts/{LazyObjectSetType.js → LazySetType.js} +22 -13
- package/dist/generators/ts/LazyType.d.ts +19 -0
- package/dist/generators/ts/{LazyObjectType.js → LazyType.js} +22 -13
- package/dist/generators/ts/ListType.d.ts +1 -1
- package/dist/generators/ts/ListType.js +9 -19
- package/dist/generators/ts/LiteralType.d.ts +3 -2
- package/dist/generators/ts/LiteralType.js +6 -2
- package/dist/generators/ts/ObjectType.d.ts +16 -3
- package/dist/generators/ts/ObjectType.js +301 -91
- package/dist/generators/ts/ObjectUnionType.js +40 -40
- package/dist/generators/ts/OptionType.d.ts +2 -2
- package/dist/generators/ts/OptionType.js +7 -5
- package/dist/generators/ts/SetType.d.ts +3 -3
- package/dist/generators/ts/SetType.js +8 -10
- package/dist/generators/ts/Snippets.d.ts +26 -8
- package/dist/generators/ts/Snippets.js +161 -35
- package/dist/generators/ts/StringType.d.ts +4 -3
- package/dist/generators/ts/StringType.js +18 -11
- package/dist/generators/ts/TermType.d.ts +7 -5
- package/dist/generators/ts/TermType.js +28 -9
- package/dist/generators/ts/TsGenerator.js +11 -6
- package/dist/generators/ts/Type.d.ts +4 -4
- package/dist/generators/ts/TypeFactory.d.ts +5 -5
- package/dist/generators/ts/TypeFactory.js +79 -58
- package/dist/generators/ts/UnionType.d.ts +23 -18
- package/dist/generators/ts/UnionType.js +227 -221
- package/dist/generators/ts/ZodGenerator.js +15 -7
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +24 -15
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +1 -24
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +8 -6
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +11 -24
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +8 -2
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +44 -16
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.js +28 -0
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_equalsFunctionDeclaration.js → ObjectType_equalsFunctionExpression.js} +6 -10
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_filterTypeDeclaration.js → ObjectType_filterTypeExpression.js} +6 -8
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → ObjectType_focusSparqlConstructTriplesFunctionExpression.js} +5 -9
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.js → ObjectType_focusSparqlWherePatternsFunctionExpression.js} +5 -9
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_fromRdfResourceFunctionDeclaration.js → ObjectType_fromRdfResourceFunctionExpression.js} +8 -16
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_graphqlTypeVariableStatement.js → ObjectType_graphqlTypeExpression.js} +6 -13
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.js +30 -0
- package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{identifierTypeDeclarations.js → ObjectType_identifierTypeDeclarations.js} +2 -5
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +1 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js +2 -6
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_jsonSchemaFunctionDeclaration.js → ObjectType_jsonSchemaExpression.js} +3 -10
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.js +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.js +17 -0
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.js +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +5 -9
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +4 -8
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.js +14 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_toRdfResourceFunctionDeclaration.js → ObjectType_toRdfResourceFunctionExpression.js} +6 -12
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.js +7 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.js +5 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_valueSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js +8 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js +10 -0
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +9 -2
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +65 -33
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +4 -3
- package/dist/generators/ts/_snippets/snippets_DateSchema.js +4 -3
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +6 -5
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +2 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +1 -0
- package/dist/generators/ts/_snippets/snippets_Lazy.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_Lazy.js +22 -0
- package/dist/generators/ts/_snippets/snippets_LazyOption.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LazyOption.js +25 -0
- package/dist/generators/ts/_snippets/snippets_LazySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LazySet.js +40 -0
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +1 -0
- package/dist/generators/ts/_snippets/snippets_NumericSchema.js +2 -1
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +6 -8
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +32 -32
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +5 -3
- package/dist/generators/ts/_snippets/snippets_TermFilter.js +3 -3
- package/dist/generators/ts/_snippets/snippets_TermSchema.js +4 -2
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazy.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazy.js +15 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.js +33 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.js +27 -0
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.js +10 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_filterNumeric.js +1 -1
- package/dist/generators/ts/_snippets/snippets_filterTerm.js +1 -2
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.js +15 -0
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.js +11 -0
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.js +8 -0
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.js +8 -0
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.js +9 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +13 -7
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.js +17 -0
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.js +60 -0
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
- package/dist/input/generated.d.ts +464 -389
- package/dist/input/generated.js +1748 -2294
- package/package.json +2 -2
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.d.ts +0 -9
- package/dist/ast/LazyObjectOptionType.d.ts +0 -6
- package/dist/ast/LazyObjectOptionType.js +0 -5
- package/dist/ast/LazyObjectSetType.d.ts +0 -6
- package/dist/ast/LazyObjectSetType.js +0 -5
- package/dist/ast/LazyObjectType.d.ts +0 -5
- package/dist/ast/LazyObjectType.js +0 -5
- package/dist/ast/ObjectCompoundType.d.ts +0 -12
- package/dist/ast/ObjectIntersectionType.d.ts +0 -4
- package/dist/ast/ObjectIntersectionType.js +0 -2
- package/dist/ast/ObjectUnionType.d.ts +0 -4
- package/dist/ast/ObjectUnionType.js +0 -2
- package/dist/generators/ts/LazyObjectSetType.d.ts +0 -20
- package/dist/generators/ts/LazyObjectType.d.ts +0 -19
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +0 -44
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -21
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +0 -18
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.js +0 -10
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +0 -41
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +0 -20
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.js +0 -29
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +0 -11
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js +0 -13
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_snippets/snippets_LazyObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +0 -22
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +0 -25
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +0 -40
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +0 -15
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +0 -31
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +0 -25
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +0 -15
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.js +0 -23
|
@@ -10,17 +10,15 @@ import { Maybe } from "purify-ts";
|
|
|
10
10
|
import { invariant } from "ts-invariant";
|
|
11
11
|
import { Memoize } from "typescript-memoize";
|
|
12
12
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
13
|
-
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
13
|
+
import { arrayOf, code, joinCode } from "./ts-poet-wrapper.js";
|
|
14
14
|
export class TermType extends AbstractTermType {
|
|
15
15
|
conversionFunction = Maybe.empty();
|
|
16
16
|
filterFunction = code `${this.reusables.snippets.filterTerm}`;
|
|
17
|
-
filterType = code `${this.reusables.snippets.TermFilter}`;
|
|
18
|
-
kind = "Term";
|
|
19
|
-
nodeKinds;
|
|
20
|
-
schemaType = code `${this.reusables.snippets.TermSchema}`;
|
|
21
17
|
jsTypes = [
|
|
22
18
|
{ instanceof: "Object", typeof: "object" },
|
|
23
19
|
];
|
|
20
|
+
kind = "Term";
|
|
21
|
+
nodeKinds;
|
|
24
22
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.termSparqlWherePatterns}`;
|
|
25
23
|
constructor({ nodeKinds, ...superParameters }) {
|
|
26
24
|
super(superParameters);
|
|
@@ -28,7 +26,19 @@ export class TermType extends AbstractTermType {
|
|
|
28
26
|
invariant(this.nodeKinds.has("Literal") &&
|
|
29
27
|
(this.nodeKinds.has("BlankNode") || this.nodeKinds.has("IRI")), "should be IdentifierType or LiteralType");
|
|
30
28
|
}
|
|
31
|
-
get
|
|
29
|
+
get fromRdfResourceValuesFunction() {
|
|
30
|
+
return code `${this.reusables.snippets.termFromRdfResourceValues}<${this.expression}>`;
|
|
31
|
+
}
|
|
32
|
+
get filterType() {
|
|
33
|
+
return code `${this.reusables.snippets.TermFilter}<${this.expression}>`;
|
|
34
|
+
}
|
|
35
|
+
get graphqlType() {
|
|
36
|
+
throw new Error("not implemented");
|
|
37
|
+
}
|
|
38
|
+
get schemaType() {
|
|
39
|
+
return code `${this.reusables.snippets.TermSchema}<${this.expression}>`;
|
|
40
|
+
}
|
|
41
|
+
get inlineExpression() {
|
|
32
42
|
return code `(${joinCode([...this.nodeKinds]
|
|
33
43
|
.map((nodeKind) => {
|
|
34
44
|
switch (nodeKind) {
|
|
@@ -45,8 +55,8 @@ export class TermType extends AbstractTermType {
|
|
|
45
55
|
})
|
|
46
56
|
.map((import_) => code `${import_}`), { on: " | " })})`;
|
|
47
57
|
}
|
|
48
|
-
get
|
|
49
|
-
|
|
58
|
+
get schemaInitializers() {
|
|
59
|
+
return super.schemaInitializers.concat(code `types: ${arrayOf(...[...this.nodeKinds].map(NodeKind.toTermType))}`);
|
|
50
60
|
}
|
|
51
61
|
fromJsonExpression({ variables, }) {
|
|
52
62
|
return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${[
|
|
@@ -117,7 +127,16 @@ export class TermType extends AbstractTermType {
|
|
|
117
127
|
}
|
|
118
128
|
__decorate([
|
|
119
129
|
Memoize()
|
|
120
|
-
], TermType.prototype, "
|
|
130
|
+
], TermType.prototype, "fromRdfResourceValuesFunction", null);
|
|
131
|
+
__decorate([
|
|
132
|
+
Memoize()
|
|
133
|
+
], TermType.prototype, "filterType", null);
|
|
134
|
+
__decorate([
|
|
135
|
+
Memoize()
|
|
136
|
+
], TermType.prototype, "schemaType", null);
|
|
137
|
+
__decorate([
|
|
138
|
+
Memoize()
|
|
139
|
+
], TermType.prototype, "inlineExpression", null);
|
|
121
140
|
__decorate([
|
|
122
141
|
Memoize()
|
|
123
142
|
], TermType.prototype, "jsonType", null);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dataFactory from "@rdfx/data-factory";
|
|
1
2
|
import { Maybe } from "purify-ts";
|
|
2
3
|
import { invariant } from "ts-invariant";
|
|
3
4
|
import { BlankNodeType } from "./BlankNodeType.js";
|
|
@@ -12,7 +13,7 @@ import { SparqlObjectSetType } from "./SparqlObjectSetType.js";
|
|
|
12
13
|
import { TypeFactory } from "./TypeFactory.js";
|
|
13
14
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
14
15
|
function compareTsNamedType(left, right) {
|
|
15
|
-
return left.
|
|
16
|
+
return left.name.unsafeCoerce().localeCompare(right.name.unsafeCoerce());
|
|
16
17
|
}
|
|
17
18
|
export class TsGenerator {
|
|
18
19
|
configuration;
|
|
@@ -39,7 +40,7 @@ export class TsGenerator {
|
|
|
39
40
|
for (const astNamedType of ast_.namedTypes) {
|
|
40
41
|
const tsNamedType = typeFactory.createType(astNamedType);
|
|
41
42
|
tsNamedTypes.push(tsNamedType);
|
|
42
|
-
if (astNamedType.kind === "
|
|
43
|
+
if (astNamedType.kind === "Struct") {
|
|
43
44
|
for (const tsImport of astNamedType.tsImports) {
|
|
44
45
|
declarations.push(code `${tsImport}`);
|
|
45
46
|
}
|
|
@@ -152,29 +153,31 @@ export class TsGenerator {
|
|
|
152
153
|
let identifierType;
|
|
153
154
|
if (nodeKinds.size === 2) {
|
|
154
155
|
identifierType = new IdentifierType({
|
|
155
|
-
|
|
156
|
+
name: Maybe.empty(),
|
|
156
157
|
comment: Maybe.empty(),
|
|
157
158
|
configuration,
|
|
158
159
|
label: Maybe.empty(),
|
|
159
160
|
logger: this.logger,
|
|
160
161
|
reusables,
|
|
162
|
+
shapeIdentifier: dataFactory.blankNode(),
|
|
161
163
|
});
|
|
162
164
|
}
|
|
163
165
|
else {
|
|
164
166
|
switch ([...nodeKinds][0]) {
|
|
165
167
|
case "BlankNode":
|
|
166
168
|
identifierType = new BlankNodeType({
|
|
167
|
-
|
|
169
|
+
name: Maybe.empty(),
|
|
168
170
|
comment: Maybe.empty(),
|
|
169
171
|
configuration,
|
|
170
172
|
label: Maybe.empty(),
|
|
171
173
|
logger: this.logger,
|
|
172
174
|
reusables,
|
|
175
|
+
shapeIdentifier: dataFactory.blankNode(),
|
|
173
176
|
});
|
|
174
177
|
break;
|
|
175
178
|
case "IRI":
|
|
176
179
|
identifierType = new IriType({
|
|
177
|
-
|
|
180
|
+
name: Maybe.empty(),
|
|
178
181
|
comment: Maybe.empty(),
|
|
179
182
|
configuration,
|
|
180
183
|
hasValues: [],
|
|
@@ -182,12 +185,13 @@ export class TsGenerator {
|
|
|
182
185
|
label: Maybe.empty(),
|
|
183
186
|
logger: this.logger,
|
|
184
187
|
reusables,
|
|
188
|
+
shapeIdentifier: dataFactory.blankNode(),
|
|
185
189
|
});
|
|
186
190
|
break;
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
return new ObjectUnionType({
|
|
190
|
-
|
|
194
|
+
name: Maybe.of(`${configuration.syntheticNamePrefix}Object`),
|
|
191
195
|
comment: Maybe.empty(),
|
|
192
196
|
configuration,
|
|
193
197
|
identifierType: Maybe.of(identifierType),
|
|
@@ -199,6 +203,7 @@ export class TsGenerator {
|
|
|
199
203
|
})),
|
|
200
204
|
recursive: false,
|
|
201
205
|
reusables,
|
|
206
|
+
shapeIdentifier: dataFactory.blankNode(),
|
|
202
207
|
synthetic: true,
|
|
203
208
|
});
|
|
204
209
|
}
|
|
@@ -9,9 +9,9 @@ import type { FloatType } from "./FloatType.js";
|
|
|
9
9
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
10
10
|
import type { IntType } from "./IntType.js";
|
|
11
11
|
import type { IriType } from "./IriType.js";
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
12
|
+
import type { LazyOptionType } from "./LazyOptionType.js";
|
|
13
|
+
import type { LazySetType } from "./LazySetType.js";
|
|
14
|
+
import type { LazyType } from "./LazyType.js";
|
|
15
15
|
import type { ListType } from "./ListType.js";
|
|
16
16
|
import type { LiteralType } from "./LiteralType.js";
|
|
17
17
|
import type { ObjectType } from "./ObjectType.js";
|
|
@@ -21,5 +21,5 @@ import type { SetType } from "./SetType.js";
|
|
|
21
21
|
import type { StringType } from "./StringType.js";
|
|
22
22
|
import type { TermType } from "./TermType.js";
|
|
23
23
|
import type { UnionType } from "./UnionType.js";
|
|
24
|
-
export type Type = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | DefaultValueType<DefaultValueType.ItemType> | FloatType | IdentifierType | IntType | IriType |
|
|
24
|
+
export type Type = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | DefaultValueType<DefaultValueType.ItemType> | FloatType | IdentifierType | IntType | IriType | LazyOptionType | LazySetType | LazyType | ListType<ListType.ItemType> | LiteralType | ObjectUnionType | ObjectType | OptionType<OptionType.ItemType> | SetType<SetType.ItemType> | StringType | TermType | UnionType<Type>;
|
|
25
25
|
//# sourceMappingURL=Type.d.ts.map
|
|
@@ -19,8 +19,8 @@ export declare class TypeFactory {
|
|
|
19
19
|
logger: Logger;
|
|
20
20
|
reusables: Reusables;
|
|
21
21
|
});
|
|
22
|
-
createObjectType(astType: ast.
|
|
23
|
-
createObjectUnionType(astType: ast.
|
|
22
|
+
createObjectType(astType: ast.StructType): ObjectType;
|
|
23
|
+
createObjectUnionType(astType: ast.StructUnionType): ObjectUnionType;
|
|
24
24
|
createType(astType: ast.Type, parameters?: {
|
|
25
25
|
defaultValue?: Literal | NamedNode;
|
|
26
26
|
}): Type;
|
|
@@ -29,9 +29,9 @@ export declare class TypeFactory {
|
|
|
29
29
|
private createDefaultValueType;
|
|
30
30
|
private createIdentifierType;
|
|
31
31
|
private createIriType;
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
private
|
|
32
|
+
private createLazyOptionType;
|
|
33
|
+
private createLazySetType;
|
|
34
|
+
private createLazyType;
|
|
35
35
|
private createListType;
|
|
36
36
|
private createLiteralType;
|
|
37
37
|
private createObjectTypeProperty;
|
|
@@ -18,9 +18,9 @@ import { FloatType } from "./FloatType.js";
|
|
|
18
18
|
import { IdentifierType } from "./IdentifierType.js";
|
|
19
19
|
import { IntType } from "./IntType.js";
|
|
20
20
|
import { IriType } from "./IriType.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
21
|
+
import { LazyOptionType } from "./LazyOptionType.js";
|
|
22
|
+
import { LazySetType } from "./LazySetType.js";
|
|
23
|
+
import { LazyType } from "./LazyType.js";
|
|
24
24
|
import { ListType } from "./ListType.js";
|
|
25
25
|
import { LiteralType } from "./LiteralType.js";
|
|
26
26
|
import { ObjectType } from "./ObjectType.js";
|
|
@@ -53,13 +53,12 @@ export class TypeFactory {
|
|
|
53
53
|
configuration: this.configuration,
|
|
54
54
|
logger: this.logger,
|
|
55
55
|
name: `${this.configuration.syntheticNamePrefix}type`,
|
|
56
|
-
objectType: {
|
|
56
|
+
objectType: { name: astType.name },
|
|
57
57
|
reusables: this.reusables,
|
|
58
58
|
value: name,
|
|
59
59
|
}));
|
|
60
60
|
const identifierType = this.createIdentifierType(astType.identifierType);
|
|
61
61
|
const objectType = new ObjectType({
|
|
62
|
-
alias: astType.name.map((name) => this.tsName(name, { synthetic: astType.synthetic })),
|
|
63
62
|
discriminantProperty,
|
|
64
63
|
comment: astType.comment,
|
|
65
64
|
configuration: this.configuration,
|
|
@@ -68,7 +67,7 @@ export class TypeFactory {
|
|
|
68
67
|
identifierType,
|
|
69
68
|
label: astType.label,
|
|
70
69
|
lazyProperties: (objectType) => {
|
|
71
|
-
const properties = astType.
|
|
70
|
+
const properties = astType.fields
|
|
72
71
|
.toSorted((left, right) => {
|
|
73
72
|
if (left.order < right.order) {
|
|
74
73
|
return -1;
|
|
@@ -78,8 +77,8 @@ export class TypeFactory {
|
|
|
78
77
|
}
|
|
79
78
|
return this.tsName(left.name).localeCompare(this.tsName(right.name));
|
|
80
79
|
})
|
|
81
|
-
.map((
|
|
82
|
-
|
|
80
|
+
.map((astField) => this.createObjectTypeProperty({
|
|
81
|
+
astStructField: astField,
|
|
83
82
|
objectType,
|
|
84
83
|
}));
|
|
85
84
|
discriminantProperty.ifJust((discriminantProperty) => {
|
|
@@ -96,8 +95,10 @@ export class TypeFactory {
|
|
|
96
95
|
return properties;
|
|
97
96
|
},
|
|
98
97
|
logger: this.logger,
|
|
98
|
+
name: astType.name.map((name) => this.tsName(name, { synthetic: astType.synthetic })),
|
|
99
99
|
recursive: astType.recursive,
|
|
100
100
|
reusables: this.reusables,
|
|
101
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
101
102
|
synthetic: astType.synthetic,
|
|
102
103
|
toRdfTypes: astType.toRdfTypes,
|
|
103
104
|
});
|
|
@@ -112,18 +113,19 @@ export class TypeFactory {
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
const objectUnionType = new ObjectUnionType({
|
|
115
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
116
116
|
comment: astType.comment,
|
|
117
117
|
configuration: this.configuration,
|
|
118
|
-
identifierType: Maybe.of(this.createIdentifierType(ast.
|
|
118
|
+
identifierType: Maybe.of(this.createIdentifierType(ast.StructCompoundType.identifierType(astType))),
|
|
119
119
|
label: astType.label,
|
|
120
120
|
logger: this.logger,
|
|
121
|
-
members: ast.
|
|
121
|
+
members: ast.StructCompoundType.memberStructTypes(astType).map((astStructType) => ({
|
|
122
122
|
discriminantValue: Maybe.empty(),
|
|
123
|
-
type: this.createObjectType(
|
|
123
|
+
type: this.createObjectType(astStructType),
|
|
124
124
|
})),
|
|
125
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
125
126
|
recursive: astType.recursive,
|
|
126
127
|
reusables: this.reusables,
|
|
128
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
127
129
|
synthetic: astType.synthetic,
|
|
128
130
|
});
|
|
129
131
|
this.cachedObjectUnionTypesByShapeIdentifier.set(astType.shapeIdentifier, objectUnionType);
|
|
@@ -141,22 +143,22 @@ export class TypeFactory {
|
|
|
141
143
|
throw new Error("not implemented");
|
|
142
144
|
case "Iri":
|
|
143
145
|
return this.createIriType(astType);
|
|
144
|
-
case "
|
|
145
|
-
return this.
|
|
146
|
-
case "
|
|
147
|
-
return this.
|
|
148
|
-
case "
|
|
149
|
-
return this.
|
|
146
|
+
case "Lazy":
|
|
147
|
+
return this.createLazyType(astType);
|
|
148
|
+
case "LazyOption":
|
|
149
|
+
return this.createLazyOptionType(astType);
|
|
150
|
+
case "LazySet":
|
|
151
|
+
return this.createLazySetType(astType);
|
|
150
152
|
case "List":
|
|
151
153
|
return this.createListType(astType);
|
|
152
154
|
case "Literal":
|
|
153
155
|
return this.createLiteralType(astType, parameters);
|
|
154
|
-
case "Object":
|
|
155
|
-
return this.createObjectType(astType);
|
|
156
156
|
case "Option":
|
|
157
157
|
return this.createOptionType(astType);
|
|
158
158
|
case "Set":
|
|
159
159
|
return this.createSetType(astType);
|
|
160
|
+
case "Struct":
|
|
161
|
+
return this.createObjectType(astType);
|
|
160
162
|
case "Term":
|
|
161
163
|
return this.createTermType(astType);
|
|
162
164
|
case "Union":
|
|
@@ -164,11 +166,10 @@ export class TypeFactory {
|
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
createUnionType(astType) {
|
|
167
|
-
if (astType.
|
|
169
|
+
if (astType.isStructUnionType()) {
|
|
168
170
|
return this.createObjectUnionType(astType);
|
|
169
171
|
}
|
|
170
172
|
return new UnionType({
|
|
171
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
172
173
|
comment: astType.comment,
|
|
173
174
|
configuration: this.configuration,
|
|
174
175
|
identifierType: Maybe.empty(),
|
|
@@ -178,19 +179,22 @@ export class TypeFactory {
|
|
|
178
179
|
discriminantValue: member.discriminantValue,
|
|
179
180
|
type: this.createType(member.type),
|
|
180
181
|
})),
|
|
182
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
181
183
|
recursive: astType.recursive,
|
|
182
184
|
reusables: this.reusables,
|
|
185
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
183
186
|
synthetic: astType.synthetic,
|
|
184
187
|
});
|
|
185
188
|
}
|
|
186
189
|
createBlankNodeType(astType) {
|
|
187
190
|
return new BlankNodeType({
|
|
188
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
189
191
|
comment: astType.comment,
|
|
190
192
|
configuration: this.configuration,
|
|
191
193
|
label: astType.label,
|
|
192
194
|
logger: this.logger,
|
|
195
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
193
196
|
reusables: this.reusables,
|
|
197
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
194
198
|
});
|
|
195
199
|
}
|
|
196
200
|
createDefaultValueType(astType) {
|
|
@@ -199,14 +203,15 @@ export class TypeFactory {
|
|
|
199
203
|
});
|
|
200
204
|
invariant(DefaultValueType.isItemType(itemType));
|
|
201
205
|
return new DefaultValueType({
|
|
202
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
203
206
|
comment: astType.comment,
|
|
204
207
|
configuration: this.configuration,
|
|
205
208
|
defaultValue: astType.defaultValue,
|
|
206
209
|
itemType,
|
|
207
210
|
label: astType.label,
|
|
208
211
|
logger: this.logger,
|
|
212
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
209
213
|
reusables: this.reusables,
|
|
214
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
210
215
|
});
|
|
211
216
|
}
|
|
212
217
|
createIdentifierType(astType) {
|
|
@@ -215,12 +220,13 @@ export class TypeFactory {
|
|
|
215
220
|
return this.createBlankNodeType(astType);
|
|
216
221
|
case "Identifier":
|
|
217
222
|
return new IdentifierType({
|
|
218
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
219
223
|
comment: astType.comment,
|
|
220
224
|
configuration: this.configuration,
|
|
221
225
|
label: astType.label,
|
|
222
226
|
logger: this.logger,
|
|
227
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
223
228
|
reusables: this.reusables,
|
|
229
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
224
230
|
});
|
|
225
231
|
case "Iri":
|
|
226
232
|
return this.createIriType(astType);
|
|
@@ -228,57 +234,60 @@ export class TypeFactory {
|
|
|
228
234
|
}
|
|
229
235
|
createIriType(astType) {
|
|
230
236
|
return new IriType({
|
|
231
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
232
237
|
comment: astType.comment,
|
|
233
238
|
configuration: this.configuration,
|
|
234
239
|
hasValues: astType.hasValues,
|
|
235
240
|
in_: astType.in_,
|
|
236
241
|
label: astType.label,
|
|
237
242
|
logger: this.logger,
|
|
243
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
238
244
|
reusables: this.reusables,
|
|
245
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
239
246
|
});
|
|
240
247
|
}
|
|
241
|
-
|
|
242
|
-
return new
|
|
243
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
248
|
+
createLazyOptionType(astType) {
|
|
249
|
+
return new LazyOptionType({
|
|
244
250
|
comment: astType.comment,
|
|
245
251
|
configuration: this.configuration,
|
|
246
252
|
label: astType.label,
|
|
247
253
|
logger: this.logger,
|
|
254
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
248
255
|
partialType: this.createOptionType(astType.partialType),
|
|
249
256
|
resolveType: this.createOptionType(astType.resolveType),
|
|
250
257
|
reusables: this.reusables,
|
|
258
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
251
259
|
});
|
|
252
260
|
}
|
|
253
|
-
|
|
254
|
-
return new
|
|
255
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
261
|
+
createLazySetType(astType) {
|
|
262
|
+
return new LazySetType({
|
|
256
263
|
comment: astType.comment,
|
|
257
264
|
configuration: this.configuration,
|
|
258
265
|
label: astType.label,
|
|
259
266
|
logger: this.logger,
|
|
267
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
260
268
|
partialType: this.createSetType(astType.partialType),
|
|
261
269
|
resolveType: this.createSetType(astType.resolveType),
|
|
262
270
|
reusables: this.reusables,
|
|
271
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
263
272
|
});
|
|
264
273
|
}
|
|
265
|
-
|
|
266
|
-
return new
|
|
267
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
274
|
+
createLazyType(astType) {
|
|
275
|
+
return new LazyType({
|
|
268
276
|
comment: astType.comment,
|
|
269
277
|
configuration: this.configuration,
|
|
270
278
|
label: astType.label,
|
|
271
279
|
logger: this.logger,
|
|
280
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
272
281
|
partialType: this.createType(astType.partialType),
|
|
273
282
|
resolveType: this.createType(astType.resolveType),
|
|
274
283
|
reusables: this.reusables,
|
|
284
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
275
285
|
});
|
|
276
286
|
}
|
|
277
287
|
createListType(astType) {
|
|
278
288
|
const itemType = this.createType(astType.itemType);
|
|
279
289
|
invariant(ListType.isItemType(itemType));
|
|
280
290
|
return new ListType({
|
|
281
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
282
291
|
comment: astType.comment,
|
|
283
292
|
configuration: this.configuration,
|
|
284
293
|
identifierNodeKind: astType.identifierNodeKind,
|
|
@@ -286,7 +295,9 @@ export class TypeFactory {
|
|
|
286
295
|
label: astType.label,
|
|
287
296
|
logger: this.logger,
|
|
288
297
|
mutable: astType.mutable,
|
|
298
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
289
299
|
reusables: this.reusables,
|
|
300
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
290
301
|
toRdfTypes: astType.toRdfTypes,
|
|
291
302
|
});
|
|
292
303
|
}
|
|
@@ -315,7 +326,6 @@ export class TypeFactory {
|
|
|
315
326
|
switch (datatypeDefinition.kind) {
|
|
316
327
|
case "bigdecimal":
|
|
317
328
|
return new BigDecimalType({
|
|
318
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
319
329
|
comment: astType.comment,
|
|
320
330
|
configuration: this.configuration,
|
|
321
331
|
hasValues: astType.hasValues,
|
|
@@ -323,11 +333,12 @@ export class TypeFactory {
|
|
|
323
333
|
label: astType.label,
|
|
324
334
|
languageIn: [],
|
|
325
335
|
logger: this.logger,
|
|
336
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
326
337
|
reusables: this.reusables,
|
|
338
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
327
339
|
});
|
|
328
340
|
case "bigint":
|
|
329
341
|
return new BigIntType({
|
|
330
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
331
342
|
comment: astType.comment,
|
|
332
343
|
configuration: this.configuration,
|
|
333
344
|
datatype,
|
|
@@ -336,12 +347,13 @@ export class TypeFactory {
|
|
|
336
347
|
label: astType.label,
|
|
337
348
|
languageIn: [],
|
|
338
349
|
logger: this.logger,
|
|
350
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
339
351
|
primitiveIn: astType.in_.map((value) => LiteralDecoder.decodeBigIntLiteral(value).unsafeCoerce()),
|
|
340
352
|
reusables: this.reusables,
|
|
353
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
341
354
|
});
|
|
342
355
|
case "boolean":
|
|
343
356
|
return new BooleanType({
|
|
344
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
345
357
|
comment: astType.comment,
|
|
346
358
|
configuration: this.configuration,
|
|
347
359
|
datatype,
|
|
@@ -350,13 +362,14 @@ export class TypeFactory {
|
|
|
350
362
|
languageIn: [],
|
|
351
363
|
in_: astType.in_,
|
|
352
364
|
logger: this.logger,
|
|
365
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
353
366
|
primitiveIn: astType.in_.map((value) => LiteralDecoder.decodeBooleanLiteral(value).unsafeCoerce()),
|
|
354
367
|
reusables: this.reusables,
|
|
368
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
355
369
|
});
|
|
356
370
|
case "date":
|
|
357
371
|
case "datetime":
|
|
358
372
|
return new (datatypeDefinition.kind === "date" ? DateType : DateTimeType)({
|
|
359
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
360
373
|
comment: astType.comment,
|
|
361
374
|
configuration: this.configuration,
|
|
362
375
|
datatype,
|
|
@@ -365,15 +378,16 @@ export class TypeFactory {
|
|
|
365
378
|
label: astType.label,
|
|
366
379
|
languageIn: [],
|
|
367
380
|
logger: this.logger,
|
|
381
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
368
382
|
primitiveIn: astType.in_.map((value) => (datatypeDefinition.kind === "date"
|
|
369
383
|
? LiteralDecoder.decodeDateLiteral
|
|
370
384
|
: LiteralDecoder.decodeDateTimeLiteral)(value).unsafeCoerce()),
|
|
371
385
|
reusables: this.reusables,
|
|
386
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
372
387
|
});
|
|
373
388
|
case "float":
|
|
374
389
|
case "int":
|
|
375
390
|
return new (datatypeDefinition.kind === "float" ? FloatType : IntType)({
|
|
376
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
377
391
|
comment: astType.comment,
|
|
378
392
|
configuration: this.configuration,
|
|
379
393
|
datatype,
|
|
@@ -382,15 +396,16 @@ export class TypeFactory {
|
|
|
382
396
|
label: astType.label,
|
|
383
397
|
languageIn: [],
|
|
384
398
|
logger: this.logger,
|
|
399
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
385
400
|
primitiveIn: astType.in_.map((value) => (datatypeDefinition.kind === "float"
|
|
386
401
|
? LiteralDecoder.decodeFloatLiteral
|
|
387
402
|
: LiteralDecoder.decodeIntLiteral)(value).unsafeCoerce()),
|
|
388
403
|
reusables: this.reusables,
|
|
404
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
389
405
|
});
|
|
390
406
|
case "string":
|
|
391
407
|
if (!datatype.equals(rdf.langString)) {
|
|
392
408
|
return new StringType({
|
|
393
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
394
409
|
comment: astType.comment,
|
|
395
410
|
configuration: this.configuration,
|
|
396
411
|
datatype,
|
|
@@ -399,8 +414,10 @@ export class TypeFactory {
|
|
|
399
414
|
label: astType.label,
|
|
400
415
|
languageIn: astType.languageIn,
|
|
401
416
|
logger: this.logger,
|
|
417
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
402
418
|
primitiveIn: astType.in_.map((value) => value.value),
|
|
403
419
|
reusables: this.reusables,
|
|
420
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
404
421
|
});
|
|
405
422
|
}
|
|
406
423
|
break;
|
|
@@ -420,7 +437,6 @@ export class TypeFactory {
|
|
|
420
437
|
// // this.logger.debug("literal type has no datatypes");
|
|
421
438
|
// }
|
|
422
439
|
return new LiteralType({
|
|
423
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
424
440
|
comment: astType.comment,
|
|
425
441
|
configuration: this.configuration,
|
|
426
442
|
hasValues: astType.hasValues,
|
|
@@ -428,52 +444,54 @@ export class TypeFactory {
|
|
|
428
444
|
label: astType.label,
|
|
429
445
|
languageIn: astType.languageIn,
|
|
430
446
|
logger: this.logger,
|
|
447
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
431
448
|
reusables: this.reusables,
|
|
449
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
432
450
|
});
|
|
433
451
|
}
|
|
434
|
-
createObjectTypeProperty({
|
|
452
|
+
createObjectTypeProperty({ astStructField, objectType, }) {
|
|
435
453
|
{
|
|
436
|
-
const cachedProperty = this.cachedObjectTypePropertiesByShapeIdentifier.get(
|
|
454
|
+
const cachedProperty = this.cachedObjectTypePropertiesByShapeIdentifier.get(astStructField.shapeIdentifier);
|
|
437
455
|
if (cachedProperty) {
|
|
438
456
|
return cachedProperty;
|
|
439
457
|
}
|
|
440
458
|
}
|
|
441
459
|
const property = new ObjectType.ShaclProperty({
|
|
442
|
-
comment:
|
|
460
|
+
comment: astStructField.comment,
|
|
443
461
|
configuration: this.configuration,
|
|
444
|
-
description:
|
|
445
|
-
display:
|
|
446
|
-
label:
|
|
462
|
+
description: astStructField.description,
|
|
463
|
+
display: astStructField.display,
|
|
464
|
+
label: astStructField.label,
|
|
447
465
|
logger: this.logger,
|
|
448
|
-
mutable:
|
|
466
|
+
mutable: astStructField.mutable,
|
|
467
|
+
name: this.tsName(astStructField.name),
|
|
449
468
|
objectType,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
recursive: !!astObjectTypeProperty.recursive,
|
|
469
|
+
path: astStructField.path,
|
|
470
|
+
recursive: !!astStructField.recursive,
|
|
453
471
|
reusables: this.reusables,
|
|
454
|
-
type: this.createType(
|
|
472
|
+
type: this.createType(astStructField.type),
|
|
455
473
|
});
|
|
456
|
-
this.cachedObjectTypePropertiesByShapeIdentifier.set(
|
|
474
|
+
this.cachedObjectTypePropertiesByShapeIdentifier.set(astStructField.shapeIdentifier, property);
|
|
457
475
|
return property;
|
|
458
476
|
}
|
|
459
477
|
createOptionType(astType) {
|
|
460
478
|
const itemType = this.createType(astType.itemType);
|
|
461
479
|
invariant(OptionType.isItemType(itemType));
|
|
462
480
|
return new OptionType({
|
|
463
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
464
481
|
comment: astType.comment,
|
|
465
482
|
configuration: this.configuration,
|
|
466
483
|
itemType,
|
|
467
484
|
label: astType.label,
|
|
468
485
|
logger: this.logger,
|
|
486
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
469
487
|
reusables: this.reusables,
|
|
488
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
470
489
|
});
|
|
471
490
|
}
|
|
472
491
|
createSetType(astType) {
|
|
473
492
|
const itemType = this.createType(astType.itemType);
|
|
474
493
|
invariant(SetType.isItemType(itemType));
|
|
475
494
|
return new SetType({
|
|
476
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
477
495
|
comment: astType.comment,
|
|
478
496
|
configuration: this.configuration,
|
|
479
497
|
itemType,
|
|
@@ -481,20 +499,23 @@ export class TypeFactory {
|
|
|
481
499
|
logger: this.logger,
|
|
482
500
|
mutable: astType.mutable,
|
|
483
501
|
minCount: astType.minCount,
|
|
502
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
484
503
|
reusables: this.reusables,
|
|
504
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
485
505
|
});
|
|
486
506
|
}
|
|
487
507
|
createTermType(astType) {
|
|
488
508
|
return new TermType({
|
|
489
|
-
alias: astType.name.map((name) => this.tsName(name)),
|
|
490
509
|
comment: astType.comment,
|
|
491
510
|
configuration: this.configuration,
|
|
492
511
|
hasValues: astType.hasValues,
|
|
493
512
|
in_: astType.in_,
|
|
494
513
|
label: astType.label,
|
|
495
514
|
logger: this.logger,
|
|
515
|
+
name: astType.name.map((name) => this.tsName(name)),
|
|
496
516
|
nodeKinds: astType.nodeKinds,
|
|
497
517
|
reusables: this.reusables,
|
|
518
|
+
shapeIdentifier: astType.shapeIdentifier,
|
|
498
519
|
});
|
|
499
520
|
}
|
|
500
521
|
tsName(name, options) {
|