@shaclmate/compiler 4.0.41 → 4.0.43
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 +11 -43
- 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 +9 -4
- 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 +511 -386
- package/dist/input/generated.js +1780 -2293
- 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,21 +10,22 @@ import { Memoize } from "typescript-memoize";
|
|
|
10
10
|
import { AbstractType } from "./AbstractType.js";
|
|
11
11
|
import { arrayEquals } from "./equals.js";
|
|
12
12
|
import { Type } from "./Type.js";
|
|
13
|
-
export class
|
|
13
|
+
export class StructType extends AbstractType {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Fields of this StructType.
|
|
16
16
|
*
|
|
17
17
|
* Mutable to support cycle-handling logic in the compiler.
|
|
18
18
|
*/
|
|
19
|
-
#
|
|
19
|
+
#fields = [];
|
|
20
|
+
fieldNames = new Set();
|
|
20
21
|
/**
|
|
21
|
-
* If true, the code for this
|
|
22
|
+
* If true, the code for this StructType is defined externally and should not be generated.
|
|
22
23
|
*
|
|
23
24
|
* Defaults to false.
|
|
24
25
|
*/
|
|
25
26
|
extern;
|
|
26
27
|
/**
|
|
27
|
-
* The expected rdf:type of instances of this
|
|
28
|
+
* The expected rdf:type of instances of this StructType.
|
|
28
29
|
*
|
|
29
30
|
* This is usually the identifier of an sh:NodeShape that is also an rdfs:Class (i.e., a node shape with implicit
|
|
30
31
|
* class targets).
|
|
@@ -37,7 +38,7 @@ export class ObjectType extends AbstractType {
|
|
|
37
38
|
/**
|
|
38
39
|
* Type discriminant.
|
|
39
40
|
*/
|
|
40
|
-
kind = "
|
|
41
|
+
kind = "Struct";
|
|
41
42
|
nodeKinds = nodeKinds;
|
|
42
43
|
/**
|
|
43
44
|
* Was this type synthesized or did it come from SHACL?
|
|
@@ -53,7 +54,7 @@ export class ObjectType extends AbstractType {
|
|
|
53
54
|
/**
|
|
54
55
|
* TypeScript imports to add to generated code.
|
|
55
56
|
*
|
|
56
|
-
* This is often used in conjunction with extern=true to import the extern'd
|
|
57
|
+
* This is often used in conjunction with extern=true to import the extern'd StructType code in order for generated
|
|
57
58
|
* code to reference it.
|
|
58
59
|
*
|
|
59
60
|
* import { MyType } from "./MyType.js"
|
|
@@ -68,24 +69,26 @@ export class ObjectType extends AbstractType {
|
|
|
68
69
|
this.toRdfTypes = toRdfTypes;
|
|
69
70
|
this.tsImports = tsImports;
|
|
70
71
|
}
|
|
71
|
-
get
|
|
72
|
-
return this.#
|
|
72
|
+
get fields() {
|
|
73
|
+
return this.#fields;
|
|
73
74
|
}
|
|
74
75
|
get recursive() {
|
|
75
|
-
return this.
|
|
76
|
+
return this.fields.some((field) => field.recursive);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
invariant(
|
|
78
|
+
addFields(...fields) {
|
|
79
|
+
for (const field of fields) {
|
|
80
|
+
invariant(Object.is(field.structType, this), "field has unexpected .structType");
|
|
81
|
+
invariant(!this.fieldNames.has(field.name), `${field.structType.shapeIdentifier}: duplicate field name: ${field.name}`);
|
|
82
|
+
this.#fields.push(field);
|
|
83
|
+
this.fieldNames.add(field.name);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
equals(other) {
|
|
84
87
|
// Don't recurse
|
|
85
88
|
return this.shapeIdentifier.equals(other.shapeIdentifier);
|
|
86
89
|
}
|
|
87
|
-
|
|
88
|
-
this.#
|
|
90
|
+
sortFields() {
|
|
91
|
+
this.#fields.sort((left, right) => {
|
|
89
92
|
if (left.order < right.order) {
|
|
90
93
|
return -1;
|
|
91
94
|
}
|
|
@@ -106,8 +109,8 @@ export class ObjectType extends AbstractType {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
109
|
-
(function (
|
|
110
|
-
class
|
|
112
|
+
(function (StructType) {
|
|
113
|
+
class Field {
|
|
111
114
|
/**
|
|
112
115
|
* Documentation comment from rdfs:comment.
|
|
113
116
|
*/
|
|
@@ -117,7 +120,7 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
117
120
|
*/
|
|
118
121
|
description;
|
|
119
122
|
/**
|
|
120
|
-
* Should the
|
|
123
|
+
* Should the field and its value be displayed in a toString()-type representation?
|
|
121
124
|
*/
|
|
122
125
|
display;
|
|
123
126
|
/**
|
|
@@ -125,42 +128,42 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
125
128
|
*/
|
|
126
129
|
label;
|
|
127
130
|
/**
|
|
128
|
-
* The
|
|
131
|
+
* The field should be mutable in generated code i.e., it should be re-assignable. The field value may or may
|
|
129
132
|
* not be mutable.
|
|
130
133
|
*/
|
|
131
134
|
mutable;
|
|
132
135
|
/**
|
|
133
|
-
* Name of this
|
|
136
|
+
* Name of this field, derived from sh:name or shaclmate:name.
|
|
134
137
|
*/
|
|
135
138
|
name;
|
|
136
139
|
/**
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
|
-
objectType;
|
|
140
|
-
/**
|
|
141
|
-
* Relative order of this property, derived from sh:order.
|
|
140
|
+
* Relative order of this field, derived from sh:order.
|
|
142
141
|
*/
|
|
143
142
|
order;
|
|
144
143
|
/**
|
|
145
|
-
* SHACL property path (https://www.w3.org/TR/shacl/#
|
|
144
|
+
* SHACL property path (https://www.w3.org/TR/shacl/#field-paths)
|
|
146
145
|
*/
|
|
147
146
|
path;
|
|
148
147
|
/**
|
|
149
|
-
* Identifier of the
|
|
148
|
+
* Identifier of the field shape.
|
|
150
149
|
*/
|
|
151
150
|
shapeIdentifier;
|
|
152
151
|
/**
|
|
153
|
-
*
|
|
152
|
+
* StructType this field belongs to.
|
|
153
|
+
*/
|
|
154
|
+
structType;
|
|
155
|
+
/**
|
|
156
|
+
* Type of this field.
|
|
154
157
|
*/
|
|
155
158
|
type;
|
|
156
|
-
constructor({ comment, description, display, label, mutable, name,
|
|
159
|
+
constructor({ comment, description, display, label, mutable, name, order, path, shapeIdentifier, structType, type, }) {
|
|
157
160
|
this.comment = comment;
|
|
158
161
|
this.description = description;
|
|
159
162
|
this.display = display;
|
|
160
163
|
this.label = label;
|
|
161
164
|
this.mutable = mutable;
|
|
162
165
|
this.name = name;
|
|
163
|
-
this.
|
|
166
|
+
this.structType = structType;
|
|
164
167
|
this.order = order;
|
|
165
168
|
this.path = path;
|
|
166
169
|
this.shapeIdentifier = shapeIdentifier;
|
|
@@ -170,35 +173,35 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
170
173
|
return this.shapeIdentifier.equals(other.shapeIdentifier);
|
|
171
174
|
}
|
|
172
175
|
/**
|
|
173
|
-
* Does the
|
|
176
|
+
* Does the field directly or indirectly reference the StructType itself?
|
|
174
177
|
*/
|
|
175
178
|
get recursive() {
|
|
176
179
|
const DEBUG = false;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
180
|
+
const rootField = this;
|
|
181
|
+
const rootStructType = this.structType;
|
|
179
182
|
function helper(stack) {
|
|
180
183
|
const currentStackFrame = stack.at(-1);
|
|
181
|
-
const {
|
|
184
|
+
const { field, fieldType, structType } = currentStackFrame;
|
|
182
185
|
if (DEBUG) {
|
|
183
186
|
process.stderr.write(`${[
|
|
184
187
|
stack.length.toString(),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
? `[${propertyType.map(Type.toString).join(", ")}]`
|
|
188
|
+
rootField,
|
|
189
|
+
rootStructType,
|
|
190
|
+
field,
|
|
191
|
+
fieldType
|
|
192
|
+
? `[${fieldType.map(Type.toString).join(", ")}]`
|
|
191
193
|
: "undefined",
|
|
194
|
+
structType,
|
|
192
195
|
].join(",")}\n`);
|
|
193
196
|
}
|
|
194
197
|
for (const lowerStackFrame of stack.slice(0, -1)) {
|
|
195
|
-
if (!Type.equals(currentStackFrame.
|
|
198
|
+
if (!Type.equals(currentStackFrame.structType, lowerStackFrame.structType)) {
|
|
196
199
|
continue;
|
|
197
200
|
}
|
|
198
|
-
if (!currentStackFrame.
|
|
201
|
+
if (!currentStackFrame.field.equals(lowerStackFrame.field)) {
|
|
199
202
|
continue;
|
|
200
203
|
}
|
|
201
|
-
if (!arrayEquals(Type.equals)(currentStackFrame.
|
|
204
|
+
if (!arrayEquals(Type.equals)(currentStackFrame.fieldType ?? [], lowerStackFrame.fieldType ?? [])) {
|
|
202
205
|
continue;
|
|
203
206
|
}
|
|
204
207
|
// We've seen this combination before and don't want to recurse further, to avoid infinite recursion
|
|
@@ -207,49 +210,49 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
207
210
|
}
|
|
208
211
|
return true;
|
|
209
212
|
}
|
|
210
|
-
if (!
|
|
213
|
+
if (!fieldType) {
|
|
211
214
|
return helper(stack.concat({
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
field,
|
|
216
|
+
fieldType: [field.type],
|
|
217
|
+
structType,
|
|
215
218
|
}));
|
|
216
219
|
}
|
|
217
|
-
invariant(
|
|
218
|
-
const
|
|
219
|
-
switch (
|
|
220
|
+
invariant(fieldType.length > 0);
|
|
221
|
+
const currentFieldType = fieldType.at(-1);
|
|
222
|
+
switch (currentFieldType.kind) {
|
|
220
223
|
case "BlankNode":
|
|
221
224
|
case "Identifier":
|
|
222
225
|
case "Iri":
|
|
223
226
|
case "Literal":
|
|
224
227
|
case "Term":
|
|
225
228
|
return false;
|
|
226
|
-
case "
|
|
227
|
-
case "
|
|
228
|
-
case "
|
|
229
|
+
case "LazyOption":
|
|
230
|
+
case "LazySet":
|
|
231
|
+
case "Lazy": {
|
|
229
232
|
if (helper(stack.concat({
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
+
field,
|
|
234
|
+
fieldType: fieldType.concat(currentFieldType.partialType),
|
|
235
|
+
structType,
|
|
233
236
|
}))) {
|
|
234
237
|
return true;
|
|
235
238
|
}
|
|
236
239
|
if (helper(stack.concat({
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
field,
|
|
241
|
+
fieldType: fieldType.concat(currentFieldType.resolveType),
|
|
242
|
+
structType,
|
|
240
243
|
}))) {
|
|
241
244
|
return true;
|
|
242
245
|
}
|
|
243
246
|
return false;
|
|
244
247
|
}
|
|
245
|
-
case "
|
|
248
|
+
case "Struct": {
|
|
246
249
|
if (DEBUG) {
|
|
247
|
-
process.stderr.write(`recurse into ${
|
|
250
|
+
process.stderr.write(`recurse into ${currentFieldType}`);
|
|
248
251
|
}
|
|
249
|
-
for (const
|
|
252
|
+
for (const field of currentFieldType.fields) {
|
|
250
253
|
if (helper(stack.concat({
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
structType: currentFieldType,
|
|
255
|
+
field,
|
|
253
256
|
}))) {
|
|
254
257
|
return true;
|
|
255
258
|
}
|
|
@@ -259,13 +262,13 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
259
262
|
case "Intersection":
|
|
260
263
|
case "Union": {
|
|
261
264
|
if (DEBUG) {
|
|
262
|
-
process.stderr.write(`recurse into ${
|
|
265
|
+
process.stderr.write(`recurse into ${currentFieldType}`);
|
|
263
266
|
}
|
|
264
|
-
for (const member of
|
|
267
|
+
for (const member of currentFieldType.members) {
|
|
265
268
|
if (helper(stack.concat({
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
field,
|
|
270
|
+
fieldType: fieldType.concat(member.type),
|
|
271
|
+
structType,
|
|
269
272
|
}))) {
|
|
270
273
|
return true;
|
|
271
274
|
}
|
|
@@ -277,13 +280,13 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
277
280
|
case "Option":
|
|
278
281
|
case "Set":
|
|
279
282
|
return helper(stack.concat({
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
field,
|
|
284
|
+
fieldType: fieldType.concat(currentFieldType.itemType),
|
|
285
|
+
structType,
|
|
283
286
|
}));
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
|
-
return helper([{
|
|
289
|
+
return helper([{ structType: rootStructType, field: rootField }]);
|
|
287
290
|
}
|
|
288
291
|
toJSON() {
|
|
289
292
|
return {
|
|
@@ -305,7 +308,7 @@ const nodeKinds = new Set(["BlankNode", "IRI"]);
|
|
|
305
308
|
}
|
|
306
309
|
__decorate([
|
|
307
310
|
Memoize()
|
|
308
|
-
],
|
|
309
|
-
|
|
310
|
-
})(
|
|
311
|
-
//# sourceMappingURL=
|
|
311
|
+
], Field.prototype, "recursive", null);
|
|
312
|
+
StructType.Field = Field;
|
|
313
|
+
})(StructType || (StructType = {}));
|
|
314
|
+
//# sourceMappingURL=StructType.js.map
|
package/dist/ast/Type.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ import type { DefaultValueType } from "./DefaultValueType.js";
|
|
|
3
3
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
4
4
|
import type { IntersectionType } from "./IntersectionType.js";
|
|
5
5
|
import type { IriType } from "./IriType.js";
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
6
|
+
import type { LazyOptionType } from "./LazyOptionType.js";
|
|
7
|
+
import type { LazySetType } from "./LazySetType.js";
|
|
8
|
+
import type { LazyType } from "./LazyType.js";
|
|
9
9
|
import type { ListType } from "./ListType.js";
|
|
10
10
|
import type { LiteralType } from "./LiteralType.js";
|
|
11
|
-
import type { ObjectType } from "./ObjectType.js";
|
|
12
11
|
import type { OptionType } from "./OptionType.js";
|
|
13
12
|
import type { SetType } from "./SetType.js";
|
|
13
|
+
import type { StructType } from "./StructType.js";
|
|
14
14
|
import type { TermType } from "./TermType.js";
|
|
15
15
|
import type { UnionType } from "./UnionType.js";
|
|
16
|
-
export type Type = BlankNodeType | DefaultValueType | IdentifierType | IntersectionType | IriType |
|
|
16
|
+
export type Type = BlankNodeType | DefaultValueType | IdentifierType | IntersectionType | IriType | LazyOptionType | LazySetType | LazyType | ListType | LiteralType | StructType | OptionType | SetType | TermType | UnionType;
|
|
17
17
|
export declare namespace Type {
|
|
18
18
|
function equals(left: Type, right: Type): boolean;
|
|
19
19
|
}
|
package/dist/ast/Type.js
CHANGED
|
@@ -17,15 +17,15 @@ export var Type;
|
|
|
17
17
|
return left.equals(right);
|
|
18
18
|
case "Literal":
|
|
19
19
|
return left.equals(right);
|
|
20
|
-
case "
|
|
20
|
+
case "LazyOption":
|
|
21
21
|
return left.equals(right);
|
|
22
|
-
case "
|
|
22
|
+
case "LazySet":
|
|
23
23
|
return left.equals(right);
|
|
24
|
-
case "
|
|
24
|
+
case "Lazy":
|
|
25
25
|
return left.equals(right);
|
|
26
26
|
case "List":
|
|
27
27
|
return left.equals(right);
|
|
28
|
-
case "
|
|
28
|
+
case "Struct":
|
|
29
29
|
return left.equals(right);
|
|
30
30
|
case "Option":
|
|
31
31
|
return left.equals(right);
|
package/dist/ast/UnionType.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Maybe } from "purify-ts";
|
|
2
2
|
import { AbstractCompoundType } from "./AbstractCompoundType.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { StructUnionType } from "./StructUnionType.js";
|
|
4
4
|
/**
|
|
5
5
|
* A disjunction/union of types, corresponding to an sh:xone.
|
|
6
6
|
*/
|
|
7
7
|
export declare class UnionType<MemberTypeT extends UnionType.MemberType = UnionType.MemberType> extends AbstractCompoundType<UnionType.Member<MemberTypeT>, MemberTypeT> {
|
|
8
8
|
readonly kind = "Union";
|
|
9
|
-
|
|
9
|
+
isStructUnionType(): this is StructUnionType;
|
|
10
10
|
toJSON(): {
|
|
11
11
|
members: {
|
|
12
12
|
discriminantValue: string | number | undefined;
|
package/dist/ast/UnionType.js
CHANGED
|
@@ -4,10 +4,10 @@ import { AbstractCompoundType } from "./AbstractCompoundType.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export class UnionType extends AbstractCompoundType {
|
|
6
6
|
kind = "Union";
|
|
7
|
-
|
|
7
|
+
isStructUnionType() {
|
|
8
8
|
return (this.members.length > 0 &&
|
|
9
|
-
this.members.every((member) => member.type.kind === "
|
|
10
|
-
(member.type.kind === "Union" && member.type.
|
|
9
|
+
this.members.every((member) => member.type.kind === "Struct" ||
|
|
10
|
+
(member.type.kind === "Union" && member.type.isStructUnionType())));
|
|
11
11
|
}
|
|
12
12
|
toJSON() {
|
|
13
13
|
return {
|
package/dist/ast/index.d.ts
CHANGED
|
@@ -4,17 +4,17 @@ export * from "./DefaultValueType.js";
|
|
|
4
4
|
export * from "./IdentifierType.js";
|
|
5
5
|
export * from "./IntersectionType.js";
|
|
6
6
|
export * from "./IriType.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./LazyOptionType.js";
|
|
8
|
+
export * from "./LazySetType.js";
|
|
9
|
+
export * from "./LazyType.js";
|
|
10
10
|
export * from "./ListType.js";
|
|
11
11
|
export * from "./LiteralType.js";
|
|
12
|
-
export * from "./ObjectCompoundType.js";
|
|
13
|
-
export * from "./ObjectIntersectionType.js";
|
|
14
|
-
export * from "./ObjectType.js";
|
|
15
|
-
export * from "./ObjectUnionType.js";
|
|
16
12
|
export * from "./OptionType.js";
|
|
17
13
|
export * from "./SetType.js";
|
|
14
|
+
export * from "./StructCompoundType.js";
|
|
15
|
+
export * from "./StructIntersectionType.js";
|
|
16
|
+
export * from "./StructType.js";
|
|
17
|
+
export * from "./StructUnionType.js";
|
|
18
18
|
export * from "./TermType.js";
|
|
19
19
|
export * from "./Type.js";
|
|
20
20
|
export * from "./UnionType.js";
|
package/dist/ast/index.js
CHANGED
|
@@ -4,17 +4,17 @@ export * from "./DefaultValueType.js";
|
|
|
4
4
|
export * from "./IdentifierType.js";
|
|
5
5
|
export * from "./IntersectionType.js";
|
|
6
6
|
export * from "./IriType.js";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
7
|
+
export * from "./LazyOptionType.js";
|
|
8
|
+
export * from "./LazySetType.js";
|
|
9
|
+
export * from "./LazyType.js";
|
|
10
10
|
export * from "./ListType.js";
|
|
11
11
|
export * from "./LiteralType.js";
|
|
12
|
-
export * from "./ObjectCompoundType.js";
|
|
13
|
-
export * from "./ObjectIntersectionType.js";
|
|
14
|
-
export * from "./ObjectType.js";
|
|
15
|
-
export * from "./ObjectUnionType.js";
|
|
16
12
|
export * from "./OptionType.js";
|
|
17
13
|
export * from "./SetType.js";
|
|
14
|
+
export * from "./StructCompoundType.js";
|
|
15
|
+
export * from "./StructIntersectionType.js";
|
|
16
|
+
export * from "./StructType.js";
|
|
17
|
+
export * from "./StructUnionType.js";
|
|
18
18
|
export * from "./TermType.js";
|
|
19
19
|
export * from "./Type.js";
|
|
20
20
|
export * from "./UnionType.js";
|
|
@@ -3,9 +3,9 @@ export class AstJsonGenerator {
|
|
|
3
3
|
return JSON.stringify({
|
|
4
4
|
namedTypes: ast.namedTypes.map((namedType) => ({
|
|
5
5
|
...namedType.toJSON(),
|
|
6
|
-
...(namedType.kind === "
|
|
6
|
+
...(namedType.kind === "Struct"
|
|
7
7
|
? {
|
|
8
|
-
properties: namedType.
|
|
8
|
+
properties: namedType.fields.map((property) => property.toJSON()),
|
|
9
9
|
}
|
|
10
10
|
: {}),
|
|
11
11
|
})),
|
|
@@ -3,13 +3,13 @@ export function transformAstToLabeledPropertyGraph(ast) {
|
|
|
3
3
|
const nodes = [];
|
|
4
4
|
const relationships = [];
|
|
5
5
|
for (const namedType of ast.namedTypes) {
|
|
6
|
-
if (namedType.kind === "
|
|
7
|
-
const
|
|
6
|
+
if (namedType.kind === "Struct") {
|
|
7
|
+
const namedStructType = namedType;
|
|
8
8
|
const id = typeId(namedType);
|
|
9
9
|
const properties = {
|
|
10
10
|
name: { type: "string", value: typeName(namedType) },
|
|
11
11
|
};
|
|
12
|
-
for (const namedObjectTypeProperty of
|
|
12
|
+
for (const namedObjectTypeProperty of namedStructType.fields) {
|
|
13
13
|
let itemType;
|
|
14
14
|
switch (namedObjectTypeProperty.type.kind) {
|
|
15
15
|
case "DefaultValue":
|
|
@@ -18,11 +18,11 @@ export function transformAstToLabeledPropertyGraph(ast) {
|
|
|
18
18
|
case "Set":
|
|
19
19
|
itemType = namedObjectTypeProperty.type.itemType;
|
|
20
20
|
break;
|
|
21
|
-
case "
|
|
21
|
+
case "Lazy":
|
|
22
22
|
itemType = namedObjectTypeProperty.type.resolveType;
|
|
23
23
|
break;
|
|
24
|
-
case "
|
|
25
|
-
case "
|
|
24
|
+
case "LazyOption":
|
|
25
|
+
case "LazySet":
|
|
26
26
|
itemType = namedObjectTypeProperty.type.resolveType.itemType;
|
|
27
27
|
break;
|
|
28
28
|
default:
|
|
@@ -31,7 +31,7 @@ export function transformAstToLabeledPropertyGraph(ast) {
|
|
|
31
31
|
}
|
|
32
32
|
switch (itemType.kind) {
|
|
33
33
|
case "Intersection":
|
|
34
|
-
case "
|
|
34
|
+
case "Struct":
|
|
35
35
|
case "Union":
|
|
36
36
|
if (itemType.name.isJust()) {
|
|
37
37
|
relationships.push({
|
|
@@ -52,7 +52,7 @@ export function transformAstToLabeledPropertyGraph(ast) {
|
|
|
52
52
|
}
|
|
53
53
|
nodes.push({
|
|
54
54
|
id,
|
|
55
|
-
label: typeName(
|
|
55
|
+
label: typeName(namedStructType),
|
|
56
56
|
properties: properties,
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -35,7 +35,7 @@ export declare abstract class AbstractContainerType<ItemTypeT extends AbstractCo
|
|
|
35
35
|
itemType: ItemTypeT;
|
|
36
36
|
} & ConstructorParameters<typeof AbstractType>[0]);
|
|
37
37
|
get recursive(): boolean;
|
|
38
|
-
get
|
|
38
|
+
get referencesNamedType(): boolean;
|
|
39
39
|
protected get itemConversionFunctionDefault(): AbstractType.ConversionFunction;
|
|
40
40
|
protected get itemValidationFunctionDefault(): Code;
|
|
41
41
|
protected get schemaInitializers(): readonly Code[];
|
|
@@ -26,8 +26,8 @@ export class AbstractContainerType extends AbstractType {
|
|
|
26
26
|
get recursive() {
|
|
27
27
|
return this.itemType.recursive;
|
|
28
28
|
}
|
|
29
|
-
get
|
|
30
|
-
return this.itemType.
|
|
29
|
+
get referencesNamedType() {
|
|
30
|
+
return this.name.isJust() || this.itemType.referencesNamedType;
|
|
31
31
|
}
|
|
32
32
|
get itemConversionFunctionDefault() {
|
|
33
33
|
return {
|
|
@@ -45,7 +45,7 @@ export class AbstractContainerType extends AbstractType {
|
|
|
45
45
|
}
|
|
46
46
|
get schemaInitializers() {
|
|
47
47
|
const initializers = super.schemaInitializers.concat();
|
|
48
|
-
if (this.recursive || this.
|
|
48
|
+
if (this.recursive || this.referencesNamedType) {
|
|
49
49
|
initializers.push(code `get itemType() { return ${this.itemType.schema}; }`);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -83,9 +83,9 @@ __decorate([
|
|
|
83
83
|
case "Union":
|
|
84
84
|
return true;
|
|
85
85
|
case "DefaultValue":
|
|
86
|
-
case "
|
|
87
|
-
case "
|
|
88
|
-
case "
|
|
86
|
+
case "LazyOption":
|
|
87
|
+
case "LazySet":
|
|
88
|
+
case "Lazy":
|
|
89
89
|
case "Option":
|
|
90
90
|
case "Set":
|
|
91
91
|
return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
2
2
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
3
3
|
export declare abstract class AbstractDateType extends AbstractPrimitiveType<Date> {
|
|
4
|
+
protected readonly inlineExpression: Code;
|
|
4
5
|
readonly equalsFunction: Code;
|
|
5
|
-
readonly expression: Code;
|
|
6
6
|
readonly filterFunction: Code;
|
|
7
7
|
readonly filterType: Code;
|
|
8
8
|
readonly jsTypes: readonly [{
|
|
@@ -16,12 +16,6 @@ export declare abstract class AbstractDateType extends AbstractPrimitiveType<Dat
|
|
|
16
16
|
fromJsonExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromJsonExpression"]>[0]): Code;
|
|
17
17
|
jsonType(): AbstractPrimitiveType.JsonType;
|
|
18
18
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
19
|
-
protected abstract fromRdfResourceValueExpression(variables: {
|
|
20
|
-
variables: {
|
|
21
|
-
value: Code;
|
|
22
|
-
};
|
|
23
|
-
}): Code;
|
|
24
|
-
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<Date>["fromRdfResourceValuesExpressionChain"]>;
|
|
25
19
|
}
|
|
26
20
|
export declare namespace AbstractDateType {
|
|
27
21
|
type ConversionFunction = AbstractPrimitiveType.ConversionFunction;
|
|
@@ -8,8 +8,8 @@ import { Memoize } from "typescript-memoize";
|
|
|
8
8
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
9
9
|
import { code } from "./ts-poet-wrapper.js";
|
|
10
10
|
export class AbstractDateType extends AbstractPrimitiveType {
|
|
11
|
+
inlineExpression = code `Date`;
|
|
11
12
|
equalsFunction = code `${this.reusables.snippets.dateEquals}`;
|
|
12
|
-
expression = code `Date`;
|
|
13
13
|
filterFunction = code `${this.reusables.snippets.filterDate}`;
|
|
14
14
|
filterType = code `${this.reusables.snippets.DateFilter}`;
|
|
15
15
|
jsTypes = [
|
|
@@ -30,16 +30,6 @@ export class AbstractDateType extends AbstractPrimitiveType {
|
|
|
30
30
|
toRdfResourceValuesExpression({ variables, }) {
|
|
31
31
|
return code `[${this.reusables.snippets.literalFactory}.date(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
|
|
32
32
|
}
|
|
33
|
-
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
34
|
-
return {
|
|
35
|
-
...super.fromRdfResourceValuesExpressionChain({ variables }),
|
|
36
|
-
languageIn: undefined,
|
|
37
|
-
preferredLanguages: undefined,
|
|
38
|
-
valueTo: code `chain(values => values.chainMap(value => ${this.fromRdfResourceValueExpression({
|
|
39
|
-
variables: { value: code `value` },
|
|
40
|
-
})}))`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
33
|
}
|
|
44
34
|
__decorate([
|
|
45
35
|
Memoize()
|