@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
|
@@ -5,7 +5,7 @@ import type { ObjectUnionType } from "./ObjectUnionType.js";
|
|
|
5
5
|
import type { OptionType } from "./OptionType.js";
|
|
6
6
|
import type { SetType } from "./SetType.js";
|
|
7
7
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
8
|
-
export declare abstract class
|
|
8
|
+
export declare abstract class AbstractLazyType<PartialTypeT extends AbstractLazyType.PartialTypeConstraint, ResolveTypeT extends AbstractLazyType.ResolveTypeConstraint> extends AbstractType {
|
|
9
9
|
protected readonly partialType: PartialTypeT;
|
|
10
10
|
protected readonly resolveType: ResolveTypeT;
|
|
11
11
|
protected abstract readonly runtimeClass: {
|
|
@@ -16,7 +16,6 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
16
16
|
readonly declaration: Maybe<Code>;
|
|
17
17
|
readonly discriminantProperty: AbstractType["discriminantProperty"];
|
|
18
18
|
readonly mutable = false;
|
|
19
|
-
readonly referencesObjectType = true;
|
|
20
19
|
readonly validationFunction: Maybe<Code>;
|
|
21
20
|
constructor({ partialType, resolveType, ...superParameters }: {
|
|
22
21
|
partialType: PartialTypeT;
|
|
@@ -30,6 +29,7 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
30
29
|
get hashFunction(): Code;
|
|
31
30
|
get jsTypes(): readonly AbstractType.JsType[];
|
|
32
31
|
get recursive(): boolean;
|
|
32
|
+
get referencesNamedType(): boolean;
|
|
33
33
|
get schemaType(): Code;
|
|
34
34
|
get toRdfResourceValueTypes(): AbstractType["toRdfResourceValueTypes"];
|
|
35
35
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
@@ -41,7 +41,7 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
41
41
|
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
42
42
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
43
43
|
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
44
|
-
protected resolveToPartialFunction<ObjectTypeT extends
|
|
44
|
+
protected resolveToPartialFunction<ObjectTypeT extends AbstractLazyType.ItemTypeConstraint>({ partialType, resolveType, }: {
|
|
45
45
|
partialType: ObjectTypeT;
|
|
46
46
|
resolveType: ObjectTypeT;
|
|
47
47
|
}): Code;
|
|
@@ -53,9 +53,9 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
53
53
|
};
|
|
54
54
|
}): Code;
|
|
55
55
|
}
|
|
56
|
-
export declare namespace
|
|
57
|
-
type
|
|
58
|
-
type PartialTypeConstraint =
|
|
56
|
+
export declare namespace AbstractLazyType {
|
|
57
|
+
type ItemTypeConstraint = ObjectType | ObjectUnionType;
|
|
58
|
+
type PartialTypeConstraint = ItemTypeConstraint | OptionType<ItemTypeConstraint> | SetType<ItemTypeConstraint>;
|
|
59
59
|
type ResolveTypeConstraint = PartialTypeConstraint;
|
|
60
60
|
type ConversionFunction = AbstractType.ConversionFunction;
|
|
61
61
|
type DiscriminantProperty = AbstractType.DiscriminantProperty;
|
|
@@ -64,4 +64,4 @@ export declare namespace AbstractLazyObjectType {
|
|
|
64
64
|
const JsonType: typeof AbstractType.JsonType;
|
|
65
65
|
type JsonType = AbstractType.JsonType;
|
|
66
66
|
}
|
|
67
|
-
//# sourceMappingURL=
|
|
67
|
+
//# sourceMappingURL=AbstractLazyType.d.ts.map
|
|
@@ -9,13 +9,12 @@ import { invariant } from "ts-invariant";
|
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractType } from "./AbstractType.js";
|
|
11
11
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
12
|
-
export class
|
|
12
|
+
export class AbstractLazyType extends AbstractType {
|
|
13
13
|
partialType;
|
|
14
14
|
resolveType;
|
|
15
15
|
declaration = Maybe.empty();
|
|
16
16
|
discriminantProperty = Maybe.empty();
|
|
17
17
|
mutable = false;
|
|
18
|
-
referencesObjectType = true;
|
|
19
18
|
validationFunction = Maybe.empty();
|
|
20
19
|
constructor({ partialType, resolveType, ...superParameters }) {
|
|
21
20
|
super(superParameters);
|
|
@@ -52,6 +51,9 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
52
51
|
get recursive() {
|
|
53
52
|
return this.partialType.recursive;
|
|
54
53
|
}
|
|
54
|
+
get referencesNamedType() {
|
|
55
|
+
return this.partialType.referencesNamedType;
|
|
56
|
+
}
|
|
55
57
|
get schemaType() {
|
|
56
58
|
return code `${{
|
|
57
59
|
kind: this.kind,
|
|
@@ -103,13 +105,13 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
103
105
|
}
|
|
104
106
|
resolveToPartialFunction({ partialType, resolveType, }) {
|
|
105
107
|
if (partialType.kind === "Object") {
|
|
106
|
-
return code `${partialType.
|
|
108
|
+
return code `${partialType.name.unsafeCoerce()}.createUnsafe`;
|
|
107
109
|
}
|
|
108
110
|
invariant(partialType.kind === "ObjectUnion");
|
|
109
111
|
invariant(resolveType.kind === "ObjectUnion");
|
|
110
112
|
invariant(partialType.members.length === resolveType.members.length);
|
|
111
113
|
const caseBlocks = resolveType.members.map(({ discriminantValues }, memberI) => {
|
|
112
|
-
return code `${discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join("\n")} return ${partialType.members[memberI].type.
|
|
114
|
+
return code `${discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join("\n")} return ${partialType.members[memberI].type.name.unsafeCoerce()}.createUnsafe(resolved);`;
|
|
113
115
|
});
|
|
114
116
|
caseBlocks.push(code `default: resolved satisfies never; throw new Error("unrecognized type");`);
|
|
115
117
|
return code `((resolved: ${resolveType.expression}) => { switch (resolved.${resolveType.discriminantProperty.unsafeCoerce().name}) { ${joinCode(caseBlocks)} } })`;
|
|
@@ -118,7 +120,7 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
118
120
|
invariant(resolvedObjectUnionType.members.length ===
|
|
119
121
|
partialObjectUnionType.members.length);
|
|
120
122
|
const caseBlocks = resolvedObjectUnionType.members.map(({ discriminantValues }, memberI) => {
|
|
121
|
-
return code `${discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join("\n")} return ${partialObjectUnionType.members[memberI].type.
|
|
123
|
+
return code `${discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join("\n")} return ${partialObjectUnionType.members[memberI].type.name.unsafeCoerce()}.create(${variables.resolvedObjectUnion});`;
|
|
122
124
|
});
|
|
123
125
|
caseBlocks.push(code `default: ${variables.resolvedObjectUnion} satisfies never; throw new Error("unrecognized type");`);
|
|
124
126
|
return code `switch (${variables.resolvedObjectUnion}.${resolvedObjectUnionType.discriminantProperty.unsafeCoerce().name}) { ${joinCode(caseBlocks)} }`;
|
|
@@ -126,27 +128,27 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
126
128
|
}
|
|
127
129
|
__decorate([
|
|
128
130
|
Memoize()
|
|
129
|
-
],
|
|
131
|
+
], AbstractLazyType.prototype, "equalsFunction", null);
|
|
130
132
|
__decorate([
|
|
131
133
|
Memoize()
|
|
132
|
-
],
|
|
134
|
+
], AbstractLazyType.prototype, "filterFunction", null);
|
|
133
135
|
__decorate([
|
|
134
136
|
Memoize()
|
|
135
|
-
],
|
|
137
|
+
], AbstractLazyType.prototype, "hashFunction", null);
|
|
136
138
|
__decorate([
|
|
137
139
|
Memoize()
|
|
138
|
-
],
|
|
140
|
+
], AbstractLazyType.prototype, "jsTypes", null);
|
|
139
141
|
__decorate([
|
|
140
142
|
Memoize()
|
|
141
|
-
],
|
|
143
|
+
], AbstractLazyType.prototype, "schemaType", null);
|
|
142
144
|
__decorate([
|
|
143
145
|
Memoize()
|
|
144
|
-
],
|
|
146
|
+
], AbstractLazyType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
145
147
|
__decorate([
|
|
146
148
|
Memoize()
|
|
147
|
-
],
|
|
148
|
-
(function (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
})(
|
|
152
|
-
//# sourceMappingURL=
|
|
149
|
+
], AbstractLazyType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
150
|
+
(function (AbstractLazyType) {
|
|
151
|
+
AbstractLazyType.GraphqlType = AbstractType.GraphqlType;
|
|
152
|
+
AbstractLazyType.JsonType = AbstractType.JsonType;
|
|
153
|
+
})(AbstractLazyType || (AbstractLazyType = {}));
|
|
154
|
+
//# sourceMappingURL=AbstractLazyType.js.map
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
2
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare abstract class AbstractLiteralType extends AbstractTermType<Literal, Literal> {
|
|
5
5
|
protected readonly languageIn: readonly string[];
|
|
6
6
|
readonly nodeKinds: ReadonlySet<"Literal">;
|
|
7
7
|
constructor({ languageIn, ...superParameters }: {
|
|
8
8
|
languageIn: readonly string[];
|
|
9
9
|
} & ConstructorParameters<typeof AbstractTermType<Literal, Literal>>[0]);
|
|
10
|
-
get constrained(): boolean;
|
|
11
|
-
protected get schemaInitializers(): readonly Code[];
|
|
12
10
|
/**
|
|
13
11
|
* An expression that converts a compile-time RDF/JS Literal into a runtime TypeScript literal.
|
|
14
12
|
*
|
|
15
13
|
* For example, a string would be converted to "thestring".
|
|
16
14
|
*/
|
|
17
|
-
abstract
|
|
18
|
-
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractTermType<Literal, Literal>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractTermType<Literal, Literal>["fromRdfResourceValuesExpressionChain"]>;
|
|
15
|
+
abstract literalValueExpression(literal: Literal): Code;
|
|
19
16
|
}
|
|
20
17
|
export declare namespace AbstractLiteralType {
|
|
21
18
|
type ConversionFunction = AbstractTermType.ConversionFunction;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
2
|
-
import { arrayOf, code } from "./ts-poet-wrapper.js";
|
|
3
2
|
export class AbstractLiteralType extends AbstractTermType {
|
|
4
3
|
languageIn;
|
|
5
4
|
nodeKinds = nodeKinds;
|
|
@@ -7,26 +6,6 @@ export class AbstractLiteralType extends AbstractTermType {
|
|
|
7
6
|
super(superParameters);
|
|
8
7
|
this.languageIn = languageIn;
|
|
9
8
|
}
|
|
10
|
-
get constrained() {
|
|
11
|
-
return super.constrained || this.languageIn.length > 0;
|
|
12
|
-
}
|
|
13
|
-
get schemaInitializers() {
|
|
14
|
-
let initializers = super.schemaInitializers;
|
|
15
|
-
if (this.languageIn.length > 0) {
|
|
16
|
-
initializers = initializers.concat(code `languageIn: ${arrayOf(...this.languageIn)}`);
|
|
17
|
-
}
|
|
18
|
-
return initializers;
|
|
19
|
-
}
|
|
20
|
-
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
21
|
-
return {
|
|
22
|
-
...super.fromRdfResourceValuesExpressionChain({ variables }),
|
|
23
|
-
languageIn: this.languageIn.length > 0
|
|
24
|
-
? code `chain(values => ${this.reusables.snippets.fromRdfLanguageIn}(values, ${JSON.stringify(this.languageIn)}))`
|
|
25
|
-
: undefined,
|
|
26
|
-
preferredLanguages: code `chain(values => ${this.reusables.snippets.fromRdfPreferredLanguages}(values, ${variables.preferredLanguages}))`,
|
|
27
|
-
valueTo: code `chain(values => values.chainMap(value => value.toLiteral()))`,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
9
|
}
|
|
31
10
|
(function (AbstractLiteralType) {
|
|
32
11
|
AbstractLiteralType.GraphqlType = AbstractTermType.GraphqlType;
|
|
@@ -8,17 +8,11 @@ export declare abstract class AbstractNumericType<ValueT extends bigint | number
|
|
|
8
8
|
abstract readonly kind: "BigInt" | "Float" | "Int";
|
|
9
9
|
get filterFunction(): Code;
|
|
10
10
|
get filterType(): Code;
|
|
11
|
-
get expression(): Code;
|
|
12
11
|
get schemaType(): Code;
|
|
13
12
|
get valueSparqlWherePatternsFunction(): Code;
|
|
13
|
+
protected get inlineExpression(): Code;
|
|
14
14
|
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<ValueT>["jsonSchema"]>[0]): Code;
|
|
15
15
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
16
|
-
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<ValueT>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<ValueT>["fromRdfResourceValuesExpressionChain"]>;
|
|
17
|
-
protected abstract fromRdfResourceValueExpression(variables: {
|
|
18
|
-
variables: {
|
|
19
|
-
value: Code;
|
|
20
|
-
};
|
|
21
|
-
}): Code;
|
|
22
16
|
}
|
|
23
17
|
export declare namespace AbstractNumericType {
|
|
24
18
|
const JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
|
|
@@ -13,46 +13,36 @@ import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
|
13
13
|
export class AbstractNumericType extends AbstractPrimitiveType {
|
|
14
14
|
hashFunction = code `${this.reusables.snippets.hashNumeric}`;
|
|
15
15
|
get filterFunction() {
|
|
16
|
-
return code `${this.reusables.snippets.filterNumeric}<${this.
|
|
16
|
+
return code `${this.reusables.snippets.filterNumeric}<${this.expression}>`;
|
|
17
17
|
}
|
|
18
18
|
get filterType() {
|
|
19
|
-
return code `${this.reusables.snippets.NumericFilter}<${this.
|
|
20
|
-
}
|
|
21
|
-
get expression() {
|
|
22
|
-
if (this.primitiveIn.length > 0) {
|
|
23
|
-
return code `${joinCode(this.primitiveIn.map((value) => this.literalExpression(value)), { on: " | " })}`;
|
|
24
|
-
}
|
|
25
|
-
return code `${this.jsTypes[0].typeof}`;
|
|
19
|
+
return code `${this.reusables.snippets.NumericFilter}<${this.expression}>`;
|
|
26
20
|
}
|
|
27
21
|
get schemaType() {
|
|
28
|
-
return code `${this.reusables.snippets.NumericSchema}<${this.
|
|
22
|
+
return code `${this.reusables.snippets.NumericSchema}<${this.expression}>`;
|
|
29
23
|
}
|
|
30
24
|
get valueSparqlWherePatternsFunction() {
|
|
31
|
-
return code `${this.reusables.snippets.numericSparqlWherePatterns}<${this.
|
|
25
|
+
return code `${this.reusables.snippets.numericSparqlWherePatterns}<${this.expression}>`;
|
|
26
|
+
}
|
|
27
|
+
get inlineExpression() {
|
|
28
|
+
if (this.primitiveIn.length > 0) {
|
|
29
|
+
return code `${joinCode(this.primitiveIn.map((value) => this.literalValueExpression(value)), { on: " | " })}`;
|
|
30
|
+
}
|
|
31
|
+
return code `${this.jsTypes[0].typeof}`;
|
|
32
32
|
}
|
|
33
33
|
jsonSchema(_parameters) {
|
|
34
34
|
switch (this.primitiveIn.length) {
|
|
35
35
|
case 0:
|
|
36
36
|
return code `${this.reusables.imports.z}.${this.jsTypes[0].typeof}()`;
|
|
37
37
|
case 1:
|
|
38
|
-
return code `${this.reusables.imports.z}.literal(${this.
|
|
38
|
+
return code `${this.reusables.imports.z}.literal(${this.literalValueExpression(this.primitiveIn[0])})`;
|
|
39
39
|
default:
|
|
40
|
-
return code `${this.reusables.imports.z}.union([${joinCode(this.primitiveIn.map((value) => code `${this.reusables.imports.z}.literal(${this.
|
|
40
|
+
return code `${this.reusables.imports.z}.union([${joinCode(this.primitiveIn.map((value) => code `${this.reusables.imports.z}.literal(${this.literalValueExpression(value)})`), { on: "," })}])`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
toRdfResourceValuesExpression({ variables, }) {
|
|
44
44
|
return code `[${this.reusables.snippets.literalFactory}.${this.jsTypes[0].typeof}(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
|
|
45
45
|
}
|
|
46
|
-
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
47
|
-
return {
|
|
48
|
-
...super.fromRdfResourceValuesExpressionChain({ variables }),
|
|
49
|
-
languageIn: undefined,
|
|
50
|
-
preferredLanguages: undefined,
|
|
51
|
-
valueTo: code `chain(values => values.chainMap(value => ${this.fromRdfResourceValueExpression({
|
|
52
|
-
variables: { value: code `value` },
|
|
53
|
-
})}))`,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
46
|
}
|
|
57
47
|
__decorate([
|
|
58
48
|
Memoize()
|
|
@@ -60,15 +50,15 @@ __decorate([
|
|
|
60
50
|
__decorate([
|
|
61
51
|
Memoize()
|
|
62
52
|
], AbstractNumericType.prototype, "filterType", null);
|
|
63
|
-
__decorate([
|
|
64
|
-
Memoize()
|
|
65
|
-
], AbstractNumericType.prototype, "expression", null);
|
|
66
53
|
__decorate([
|
|
67
54
|
Memoize()
|
|
68
55
|
], AbstractNumericType.prototype, "schemaType", null);
|
|
69
56
|
__decorate([
|
|
70
57
|
Memoize()
|
|
71
58
|
], AbstractNumericType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
Memoize()
|
|
61
|
+
], AbstractNumericType.prototype, "inlineExpression", null);
|
|
72
62
|
(function (AbstractNumericType) {
|
|
73
63
|
AbstractNumericType.JsonType = AbstractPrimitiveType.JsonType;
|
|
74
64
|
})(AbstractNumericType || (AbstractNumericType = {}));
|
|
@@ -20,9 +20,9 @@ export declare abstract class AbstractObjectSetType {
|
|
|
20
20
|
});
|
|
21
21
|
abstract readonly declaration: Code;
|
|
22
22
|
protected methodSignatures(namedObjectType: {
|
|
23
|
-
readonly alias: Maybe<string>;
|
|
24
23
|
readonly filterType: Code;
|
|
25
24
|
readonly identifierTypeAlias: Code;
|
|
25
|
+
readonly name: Maybe<string>;
|
|
26
26
|
readonly objectSetMethodNames: ObjectType.ObjectSetMethodNames;
|
|
27
27
|
}, options?: {
|
|
28
28
|
parameterNamePrefix?: string;
|
|
@@ -21,7 +21,7 @@ export class AbstractObjectSetType {
|
|
|
21
21
|
object: {
|
|
22
22
|
name: methodNames.object,
|
|
23
23
|
parameters: code `${parameterNamePrefix}identifier: ${namedObjectType.identifierTypeAlias}, options?: { preferredLanguages?: readonly string[]; }`,
|
|
24
|
-
returnType: code `Promise<${this.reusables.imports.Either}<Error, ${namedObjectType.
|
|
24
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, ${namedObjectType.name.unsafeCoerce()}>>`,
|
|
25
25
|
},
|
|
26
26
|
objectCount: {
|
|
27
27
|
name: methodNames.objectCount,
|
|
@@ -36,7 +36,7 @@ export class AbstractObjectSetType {
|
|
|
36
36
|
objects: {
|
|
37
37
|
name: methodNames.objects,
|
|
38
38
|
parameters: code `${parameterNamePrefix}query?: ${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>`,
|
|
39
|
-
returnType: code `Promise<${this.reusables.imports.Either}<Error, readonly ${namedObjectType.
|
|
39
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, readonly ${namedObjectType.name.unsafeCoerce()}[]>>`,
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -17,7 +17,7 @@ export declare abstract class AbstractPrimitiveType<ValueT extends bigint | bool
|
|
|
17
17
|
fromJsonExpression({ variables, }: Parameters<AbstractLiteralType["fromJsonExpression"]>[0]): Code;
|
|
18
18
|
graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
|
|
19
19
|
jsonType(): AbstractLiteralType.JsonType;
|
|
20
|
-
abstract
|
|
20
|
+
abstract literalValueExpression(literal: Literal | ValueT): Code;
|
|
21
21
|
toJsonExpression({ variables, }: Parameters<AbstractLiteralType["toJsonExpression"]>[0]): Code;
|
|
22
22
|
}
|
|
23
23
|
export declare namespace AbstractPrimitiveType {
|
|
@@ -24,7 +24,7 @@ export class AbstractPrimitiveType extends AbstractLiteralType {
|
|
|
24
24
|
get schemaInitializers() {
|
|
25
25
|
let initializers = super.schemaInitializers;
|
|
26
26
|
if (this.primitiveIn.length > 0) {
|
|
27
|
-
initializers = initializers.concat(code `in: ${arrayOf(...this.primitiveIn.map((in_) => this.
|
|
27
|
+
initializers = initializers.concat(code `in: ${arrayOf(...this.primitiveIn.map((in_) => this.literalValueExpression(in_)))} as const`);
|
|
28
28
|
}
|
|
29
29
|
return initializers;
|
|
30
30
|
}
|
|
@@ -2,10 +2,9 @@ import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
|
|
|
2
2
|
import { NodeKind } from "@shaclmate/shacl-ast";
|
|
3
3
|
import { Maybe } from "purify-ts";
|
|
4
4
|
import { AbstractType } from "./AbstractType.js";
|
|
5
|
-
import type { Type } from "./Type.js";
|
|
6
5
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
7
6
|
/**
|
|
8
|
-
* Abstract base class for
|
|
7
|
+
* Abstract base class for all types that are terms in RDF (i.e., identifiers, literals).
|
|
9
8
|
*
|
|
10
9
|
* ConstantTermT is the type of sh:hasValue and sh:in.
|
|
11
10
|
* RuntimeTermT is the type of values at runtime.
|
|
@@ -13,7 +12,7 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
13
12
|
* The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
|
|
14
13
|
*/
|
|
15
14
|
export declare abstract class AbstractTermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, _RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractType {
|
|
16
|
-
readonly
|
|
15
|
+
protected abstract readonly inlineExpression: Code;
|
|
17
16
|
readonly equalsFunction: Code;
|
|
18
17
|
readonly graphqlArgs: AbstractType["graphqlArgs"];
|
|
19
18
|
readonly hasValues: readonly ConstantTermT[];
|
|
@@ -22,36 +21,22 @@ export declare abstract class AbstractTermType<ConstantTermT extends Literal | N
|
|
|
22
21
|
readonly mutable: boolean;
|
|
23
22
|
abstract readonly nodeKinds: ReadonlySet<NodeKind>;
|
|
24
23
|
readonly recursive = false;
|
|
25
|
-
readonly referencesObjectType = false;
|
|
26
24
|
readonly validationFunction: Maybe<Code>;
|
|
27
25
|
constructor({ hasValues, in_, ...superParameters }: {
|
|
28
26
|
hasValues: readonly ConstantTermT[];
|
|
29
27
|
in_: readonly ConstantTermT[];
|
|
30
28
|
} & ConstructorParameters<typeof AbstractType>[0]);
|
|
31
|
-
get
|
|
29
|
+
get declaration(): Maybe<Code>;
|
|
32
30
|
get discriminantProperty(): Maybe<AbstractType.DiscriminantProperty>;
|
|
31
|
+
get expression(): Code;
|
|
32
|
+
get referencesNamedType(): boolean;
|
|
33
33
|
get termTypes(): ReadonlySet<"BlankNode" | "Literal" | "NamedNode">;
|
|
34
34
|
get toRdfResourceValueTypes(): Set<"BlankNode" | "Literal" | "NamedNode">;
|
|
35
35
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
36
|
-
|
|
36
|
+
protected get schemaInitializers(): readonly Code[];
|
|
37
37
|
jsonUiSchemaElement(): Maybe<Code>;
|
|
38
38
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
39
39
|
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
40
|
-
/**
|
|
41
|
-
* The fromRdfExpression for a term type can be decomposed into multiple sub-expressions with different purposes:
|
|
42
|
-
*
|
|
43
|
-
* hasValues: test whether the values sequence has sh:hasValue values
|
|
44
|
-
* languageIn: filter the values sequence to literals with the right sh:languageIn (or runtime languageIn)
|
|
45
|
-
* valueTo: convert values in the values sequence to the appropriate term type/sub-type (literal, string, etc.)
|
|
46
|
-
*
|
|
47
|
-
* Considering the sub-expressions as a record instead of an array allows them to be selectively overridden by subclasses.
|
|
48
|
-
*/
|
|
49
|
-
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<Type["fromRdfResourceValuesExpression"]>[0]): {
|
|
50
|
-
hasValues?: Code;
|
|
51
|
-
languageIn?: Code;
|
|
52
|
-
preferredLanguages?: Code;
|
|
53
|
-
valueTo: Code;
|
|
54
|
-
};
|
|
55
40
|
}
|
|
56
41
|
export declare namespace AbstractTermType {
|
|
57
42
|
type ConversionFunction = AbstractType.ConversionFunction;
|
|
@@ -8,9 +8,9 @@ import { NodeKind } from "@shaclmate/shacl-ast";
|
|
|
8
8
|
import { Maybe } from "purify-ts";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractType } from "./AbstractType.js";
|
|
11
|
-
import {
|
|
11
|
+
import { arrayOf, code } from "./ts-poet-wrapper.js";
|
|
12
12
|
/**
|
|
13
|
-
* Abstract base class for
|
|
13
|
+
* Abstract base class for all types that are terms in RDF (i.e., identifiers, literals).
|
|
14
14
|
*
|
|
15
15
|
* ConstantTermT is the type of sh:hasValue and sh:in.
|
|
16
16
|
* RuntimeTermT is the type of values at runtime.
|
|
@@ -18,7 +18,6 @@ import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
|
18
18
|
* The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
|
|
19
19
|
*/
|
|
20
20
|
export class AbstractTermType extends AbstractType {
|
|
21
|
-
declaration = Maybe.empty();
|
|
22
21
|
equalsFunction = code `${this.reusables.snippets.booleanEquals}`;
|
|
23
22
|
graphqlArgs = Maybe.empty();
|
|
24
23
|
hasValues;
|
|
@@ -26,24 +25,32 @@ export class AbstractTermType extends AbstractType {
|
|
|
26
25
|
in_;
|
|
27
26
|
mutable = false;
|
|
28
27
|
recursive = false;
|
|
29
|
-
referencesObjectType = false;
|
|
30
28
|
validationFunction = Maybe.empty();
|
|
31
29
|
constructor({ hasValues, in_, ...superParameters }) {
|
|
32
30
|
super(superParameters);
|
|
33
31
|
this.hasValues = hasValues;
|
|
34
32
|
this.in_ = in_;
|
|
35
33
|
}
|
|
36
|
-
get
|
|
37
|
-
return this.
|
|
34
|
+
get declaration() {
|
|
35
|
+
return this.name.map((name) => code `export type ${name} = ${this.inlineExpression};`);
|
|
38
36
|
}
|
|
39
37
|
get discriminantProperty() {
|
|
40
38
|
return Maybe.of({
|
|
41
39
|
jsonName: "termType",
|
|
42
40
|
name: "termType",
|
|
43
41
|
values: [...this.nodeKinds].map(NodeKind.toTermType),
|
|
44
|
-
type: "string",
|
|
45
42
|
});
|
|
46
43
|
}
|
|
44
|
+
get expression() {
|
|
45
|
+
const name = this.name.extract();
|
|
46
|
+
if (name) {
|
|
47
|
+
return code `${name}`;
|
|
48
|
+
}
|
|
49
|
+
return this.inlineExpression;
|
|
50
|
+
}
|
|
51
|
+
get referencesNamedType() {
|
|
52
|
+
return this.name.isJust();
|
|
53
|
+
}
|
|
47
54
|
get termTypes() {
|
|
48
55
|
return new Set([...this.nodeKinds].map(NodeKind.toTermType));
|
|
49
56
|
}
|
|
@@ -53,21 +60,12 @@ export class AbstractTermType extends AbstractType {
|
|
|
53
60
|
get valueSparqlConstructTriplesFunction() {
|
|
54
61
|
return code `((_: object) => [])`;
|
|
55
62
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const chain = this.fromRdfResourceValuesExpressionChain(parameters);
|
|
63
|
-
const { variables } = parameters;
|
|
64
|
-
return joinCode([
|
|
65
|
-
variables.resourceValues,
|
|
66
|
-
chain.hasValues,
|
|
67
|
-
chain.languageIn,
|
|
68
|
-
chain.preferredLanguages,
|
|
69
|
-
chain.valueTo,
|
|
70
|
-
].filter((_) => _ !== undefined), { on: "." });
|
|
63
|
+
get schemaInitializers() {
|
|
64
|
+
let initializers = super.schemaInitializers;
|
|
65
|
+
if (this.hasValues.length > 0) {
|
|
66
|
+
initializers = initializers.concat(code `hasValues: ${arrayOf(...this.hasValues.map((hasValue) => this.rdfjsTermExpression(hasValue)))}`);
|
|
67
|
+
}
|
|
68
|
+
return initializers;
|
|
71
69
|
}
|
|
72
70
|
jsonUiSchemaElement() {
|
|
73
71
|
return Maybe.empty();
|
|
@@ -78,43 +76,16 @@ export class AbstractTermType extends AbstractType {
|
|
|
78
76
|
toStringExpression({ variables, }) {
|
|
79
77
|
return code `${variables.value}.toString()`;
|
|
80
78
|
}
|
|
81
|
-
/**
|
|
82
|
-
* The fromRdfExpression for a term type can be decomposed into multiple sub-expressions with different purposes:
|
|
83
|
-
*
|
|
84
|
-
* hasValues: test whether the values sequence has sh:hasValue values
|
|
85
|
-
* languageIn: filter the values sequence to literals with the right sh:languageIn (or runtime languageIn)
|
|
86
|
-
* valueTo: convert values in the values sequence to the appropriate term type/sub-type (literal, string, etc.)
|
|
87
|
-
*
|
|
88
|
-
* Considering the sub-expressions as a record instead of an array allows them to be selectively overridden by subclasses.
|
|
89
|
-
*/
|
|
90
|
-
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
91
|
-
let valueToExpression;
|
|
92
|
-
if (this.in_.length > 0) {
|
|
93
|
-
valueToExpression = code `value.toTerm([${joinCode(this.in_.map((in_) => this.rdfjsTermExpression(in_)), { on: ", " })}])`;
|
|
94
|
-
}
|
|
95
|
-
else if (this.nodeKinds.size < 3) {
|
|
96
|
-
const eitherTypeParameters = code `<Error, ${this.expression}>`;
|
|
97
|
-
valueToExpression = code `value.toTerm().chain(term => {
|
|
98
|
-
switch (term.termType) {
|
|
99
|
-
${[...this.nodeKinds].map((nodeKind) => `case "${NodeKind.toTermType(nodeKind)}":`).join("\n")} return ${this.reusables.imports.Either}.of${eitherTypeParameters}(term);
|
|
100
|
-
default: return ${this.reusables.imports.Left}${eitherTypeParameters}(new ${this.reusables.imports.Resource}.MistypedTermValueError(${{ actualValue: code `term`, expectedValueType: code `${this.expression}`.toCodeString([]), focusResource: variables.resource, propertyPath: variables.propertyPath }}));
|
|
101
|
-
}})`;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
valueToExpression = code `value.toTerm()`;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
hasValues: this.hasValues.length > 0
|
|
108
|
-
? code `\
|
|
109
|
-
chain(values => ${this.reusables.imports.Either}.sequence([${joinCode(this.hasValues.map((hasValue) => this.rdfjsTermExpression(hasValue)), { on: ", " })}].map(hasValue => values.find(value => value.term.equals(hasValue)))).map(() => values))`
|
|
110
|
-
: undefined,
|
|
111
|
-
valueTo: code `chain(values => values.chainMap(value => ${valueToExpression}))`,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
79
|
}
|
|
80
|
+
__decorate([
|
|
81
|
+
Memoize()
|
|
82
|
+
], AbstractTermType.prototype, "declaration", null);
|
|
115
83
|
__decorate([
|
|
116
84
|
Memoize()
|
|
117
85
|
], AbstractTermType.prototype, "discriminantProperty", null);
|
|
86
|
+
__decorate([
|
|
87
|
+
Memoize()
|
|
88
|
+
], AbstractTermType.prototype, "expression", null);
|
|
118
89
|
__decorate([
|
|
119
90
|
Memoize()
|
|
120
91
|
], AbstractTermType.prototype, "termTypes", null);
|