@shaclmate/compiler 4.0.40 → 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 -8
- package/dist/ShapesGraphToAstTransformer.js +11 -126
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
- 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} +3 -3
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.js → transformShapeToAstStructType.js} +35 -45
- 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 +3 -2
- package/dist/ast/AbstractCompoundType.js +5 -5
- 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 -12
- 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 -6
- 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 +5 -5
- 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 -39
- package/dist/ast/{ObjectType.js → StructType.js} +81 -156
- 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 +7 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
- package/dist/generators/ts/AbstractCollectionType.d.ts +4 -11
- package/dist/generators/ts/AbstractCollectionType.js +3 -62
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -2
- package/dist/generators/ts/AbstractContainerType.js +7 -10
- package/dist/generators/ts/AbstractDateType.d.ts +5 -8
- package/dist/generators/ts/AbstractDateType.js +7 -12
- package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
- package/dist/generators/ts/AbstractIdentifierType.js +3 -0
- package/dist/generators/ts/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +8 -8
- package/dist/generators/ts/{AbstractLazyObjectType.js → AbstractLazyType.js} +30 -17
- package/dist/generators/ts/AbstractLiteralType.d.ts +3 -5
- package/dist/generators/ts/AbstractLiteralType.js +0 -21
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -7
- package/dist/generators/ts/AbstractNumericType.js +17 -27
- package/dist/generators/ts/AbstractObjectSetType.d.ts +1 -1
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -1
- package/dist/generators/ts/AbstractPrimitiveType.js +1 -1
- package/dist/generators/ts/AbstractTermType.d.ts +7 -23
- package/dist/generators/ts/AbstractTermType.js +27 -58
- package/dist/generators/ts/AbstractType.d.ts +86 -63
- package/dist/generators/ts/AbstractType.js +48 -22
- package/dist/generators/ts/BigDecimalType.d.ts +7 -3
- package/dist/generators/ts/BigDecimalType.js +7 -9
- package/dist/generators/ts/BigIntType.d.ts +5 -3
- package/dist/generators/ts/BigIntType.js +8 -5
- package/dist/generators/ts/BlankNodeType.d.ts +2 -7
- package/dist/generators/ts/BlankNodeType.js +4 -9
- package/dist/generators/ts/BooleanType.d.ts +6 -4
- package/dist/generators/ts/BooleanType.js +13 -15
- 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 +40 -2
- package/dist/generators/ts/DefaultValueType.js +15 -14
- package/dist/generators/ts/FloatType.d.ts +5 -3
- package/dist/generators/ts/FloatType.js +8 -5
- package/dist/generators/ts/GraphqlSchema.js +2 -2
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +8 -11
- package/dist/generators/ts/IntType.d.ts +5 -3
- package/dist/generators/ts/IntType.js +8 -5
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +16 -16
- package/dist/generators/ts/{LazyObjectOptionType.d.ts → LazyOptionType.d.ts} +13 -11
- package/dist/generators/ts/LazyOptionType.js +75 -0
- package/dist/generators/ts/LazySetType.d.ts +20 -0
- package/dist/generators/ts/LazySetType.js +76 -0
- package/dist/generators/ts/LazyType.d.ts +19 -0
- package/dist/generators/ts/LazyType.js +65 -0
- package/dist/generators/ts/ListType.d.ts +11 -2
- package/dist/generators/ts/ListType.js +53 -26
- package/dist/generators/ts/LiteralType.d.ts +7 -2
- package/dist/generators/ts/LiteralType.js +12 -5
- package/dist/generators/ts/ObjectType.d.ts +24 -25
- package/dist/generators/ts/ObjectType.js +303 -161
- package/dist/generators/ts/ObjectUnionType.js +42 -42
- package/dist/generators/ts/OptionType.d.ts +6 -2
- package/dist/generators/ts/OptionType.js +16 -9
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +1 -4
- package/dist/generators/ts/SetType.d.ts +17 -2
- package/dist/generators/ts/SetType.js +85 -9
- package/dist/generators/ts/Snippets.d.ts +29 -9
- package/dist/generators/ts/Snippets.js +179 -39
- package/dist/generators/ts/StringType.d.ts +7 -4
- package/dist/generators/ts/StringType.js +23 -12
- package/dist/generators/ts/TermType.d.ts +9 -3
- package/dist/generators/ts/TermType.js +29 -7
- package/dist/generators/ts/TsGenerator.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.js +62 -32
- package/dist/generators/ts/Type.d.ts +4 -4
- package/dist/generators/ts/TypeFactory.d.ts +5 -5
- package/dist/generators/ts/TypeFactory.js +90 -82
- package/dist/generators/ts/UnionType.d.ts +25 -23
- package/dist/generators/ts/UnionType.js +254 -261
- package/dist/generators/ts/ZodGenerator.d.ts +1 -1
- package/dist/generators/ts/ZodGenerator.js +29 -14
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +28 -16
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +1 -24
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +15 -17
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +24 -54
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +8 -2
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +48 -20
- 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_equalsFunctionExpression.js +15 -0
- 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} +5 -10
- 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 -13
- 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} +8 -31
- 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_fromRdfResourceFunctionExpression.js +43 -0
- 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/ObjectType_identifierTypeDeclarations.js +13 -0
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +11 -8
- 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_jsonSchemaExpression.js +18 -0
- 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} +7 -13
- 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 +70 -38
- 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_convertToArraySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -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_convertToList.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -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 +1116 -400
- package/dist/input/generated.js +1879 -1917
- package/package.json +2 -4
- 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/LazyObjectOptionType.js +0 -62
- package/dist/generators/ts/LazyObjectSetType.d.ts +0 -20
- package/dist/generators/ts/LazyObjectSetType.js +0 -61
- package/dist/generators/ts/LazyObjectType.d.ts +0 -19
- package/dist/generators/ts/LazyObjectType.js +0 -53
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +0 -65
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.js +0 -23
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -24
- 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 -43
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +0 -80
- 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 -45
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +0 -16
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -31
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +0 -16
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +0 -17
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +0 -41
- 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 -36
- 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/_ObjectType/identifierTypeDeclarations.js +0 -27
- 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_convertToArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
- 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
|
@@ -2,64 +2,67 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
export function transformAstToLabeledPropertyGraph(ast) {
|
|
3
3
|
const nodes = [];
|
|
4
4
|
const relationships = [];
|
|
5
|
-
for (const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
5
|
+
for (const namedType of ast.namedTypes) {
|
|
6
|
+
if (namedType.kind === "Struct") {
|
|
7
|
+
const namedStructType = namedType;
|
|
8
|
+
const id = typeId(namedType);
|
|
9
|
+
const properties = {
|
|
10
|
+
name: { type: "string", value: typeName(namedType) },
|
|
11
|
+
};
|
|
12
|
+
for (const namedObjectTypeProperty of namedStructType.fields) {
|
|
13
|
+
let itemType;
|
|
14
|
+
switch (namedObjectTypeProperty.type.kind) {
|
|
15
|
+
case "DefaultValue":
|
|
16
|
+
case "List":
|
|
17
|
+
case "Option":
|
|
18
|
+
case "Set":
|
|
19
|
+
itemType = namedObjectTypeProperty.type.itemType;
|
|
20
|
+
break;
|
|
21
|
+
case "Lazy":
|
|
22
|
+
itemType = namedObjectTypeProperty.type.resolveType;
|
|
23
|
+
break;
|
|
24
|
+
case "LazyOption":
|
|
25
|
+
case "LazySet":
|
|
26
|
+
itemType = namedObjectTypeProperty.type.resolveType.itemType;
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
itemType = namedObjectTypeProperty.type;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
switch (itemType.kind) {
|
|
33
|
+
case "Intersection":
|
|
34
|
+
case "Struct":
|
|
35
|
+
case "Union":
|
|
36
|
+
if (itemType.name.isJust()) {
|
|
37
|
+
relationships.push({
|
|
38
|
+
id: namedObjectTypeProperty.shapeIdentifier.toString(),
|
|
39
|
+
label: Maybe.of(namedObjectTypeProperty.name),
|
|
40
|
+
properties: {},
|
|
41
|
+
sourceNodeId: id,
|
|
42
|
+
targetNodeId: typeId(itemType),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
properties[namedObjectTypeProperty.name] = {
|
|
48
|
+
type: "string",
|
|
49
|
+
value: namedObjectTypeProperty.toString(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
49
52
|
}
|
|
53
|
+
nodes.push({
|
|
54
|
+
id,
|
|
55
|
+
label: typeName(namedStructType),
|
|
56
|
+
properties: properties,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (namedType.kind === "Union") {
|
|
60
|
+
nodes.push({
|
|
61
|
+
id: typeId(namedType),
|
|
62
|
+
label: typeName(namedType),
|
|
63
|
+
properties: {},
|
|
64
|
+
});
|
|
50
65
|
}
|
|
51
|
-
nodes.push({
|
|
52
|
-
id,
|
|
53
|
-
label: typeName(namedObjectType),
|
|
54
|
-
properties: properties,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
for (const namedUnionType of ast.namedUnionTypes) {
|
|
58
|
-
nodes.push({
|
|
59
|
-
id: typeId(namedUnionType),
|
|
60
|
-
label: typeName(namedUnionType),
|
|
61
|
-
properties: {},
|
|
62
|
-
});
|
|
63
66
|
}
|
|
64
67
|
return {
|
|
65
68
|
nodes,
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
3
|
-
import type { AbstractType } from "./AbstractType.js";
|
|
4
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
4
|
/**
|
|
6
5
|
* Abstract base class for ListType and SetType.
|
|
7
6
|
*/
|
|
8
7
|
export declare abstract class AbstractCollectionType<ItemTypeT extends AbstractCollectionType.ItemType> extends AbstractContainerType<ItemTypeT> {
|
|
9
8
|
protected readonly _mutable: boolean;
|
|
10
|
-
protected readonly minCount: bigint;
|
|
11
9
|
readonly discriminantProperty: Maybe<AbstractContainerType.DiscriminantProperty>;
|
|
12
10
|
readonly graphqlArgs: AbstractContainerType<ItemTypeT>["graphqlArgs"];
|
|
13
|
-
|
|
14
|
-
constructor({ minCount, mutable, ...superParameters }: {
|
|
15
|
-
minCount: bigint;
|
|
11
|
+
constructor({ mutable, ...superParameters }: {
|
|
16
12
|
mutable: boolean;
|
|
17
13
|
} & ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0]);
|
|
18
|
-
get conversionFunction(): Maybe<AbstractType.ConversionFunction>;
|
|
19
14
|
get equalsFunction(): Code;
|
|
20
15
|
get expression(): Code;
|
|
21
16
|
get filterFunction(): Code;
|
|
@@ -25,20 +20,18 @@ export declare abstract class AbstractCollectionType<ItemTypeT extends AbstractC
|
|
|
25
20
|
get mutable(): boolean;
|
|
26
21
|
get schemaType(): Code;
|
|
27
22
|
get validationFunction(): Maybe<Code>;
|
|
28
|
-
protected get schemaInitializers(): readonly Code[];
|
|
29
|
-
fromJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromJsonExpression"]>[0]): Code;
|
|
30
23
|
graphqlResolveExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["graphqlResolveExpression"]>[0]): Code;
|
|
31
|
-
jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
|
|
32
24
|
jsonUiSchemaElement(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
33
25
|
toJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toJsonExpression"]>[0]): Code;
|
|
34
26
|
}
|
|
35
27
|
export declare namespace AbstractCollectionType {
|
|
28
|
+
type ConversionFunction = AbstractContainerType.ConversionFunction;
|
|
36
29
|
type DiscriminantProperty = AbstractContainerType.DiscriminantProperty;
|
|
37
|
-
const GraphqlType: typeof AbstractType.GraphqlType;
|
|
30
|
+
const GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
|
|
38
31
|
type GraphqlType = AbstractContainerType.GraphqlType;
|
|
39
32
|
const isItemType: typeof AbstractContainerType.isItemType;
|
|
40
33
|
type ItemType = AbstractContainerType.ItemType;
|
|
41
|
-
const JsonType: typeof AbstractType.JsonType;
|
|
34
|
+
const JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
|
|
42
35
|
type JsonType = AbstractContainerType.JsonType;
|
|
43
36
|
}
|
|
44
37
|
//# sourceMappingURL=AbstractCollectionType.d.ts.map
|
|
@@ -5,46 +5,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
|
-
import { invariant } from "ts-invariant";
|
|
9
8
|
import { Memoize } from "typescript-memoize";
|
|
10
9
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
11
|
-
import { code,
|
|
10
|
+
import { code, literalOf } from "./ts-poet-wrapper.js";
|
|
12
11
|
/**
|
|
13
12
|
* Abstract base class for ListType and SetType.
|
|
14
13
|
*/
|
|
15
14
|
export class AbstractCollectionType extends AbstractContainerType {
|
|
16
15
|
_mutable;
|
|
17
|
-
minCount;
|
|
18
16
|
discriminantProperty = Maybe.empty();
|
|
19
17
|
graphqlArgs = Maybe.empty();
|
|
20
|
-
|
|
21
|
-
constructor({ minCount, mutable, ...superParameters }) {
|
|
18
|
+
constructor({ mutable, ...superParameters }) {
|
|
22
19
|
super(superParameters);
|
|
23
|
-
this.minCount = minCount;
|
|
24
|
-
invariant(this.minCount >= 0n);
|
|
25
20
|
this._mutable = mutable;
|
|
26
|
-
if (mutable) {
|
|
27
|
-
invariant(this.minCount === 0n);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get conversionFunction() {
|
|
31
|
-
const itemConversionFunction = this.itemType.conversionFunction.orDefault(this.itemConversionFunctionDefault);
|
|
32
|
-
const sourceTypes = [
|
|
33
|
-
{
|
|
34
|
-
expression: code `readonly (${joinCode(itemConversionFunction.sourceTypes.map((itemSourceType) => code `${itemSourceType.expression}`), { on: " | " })})[]`,
|
|
35
|
-
typeof: "object",
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
if (this.minCount === 0n) {
|
|
39
|
-
sourceTypes.push({
|
|
40
|
-
expression: code `undefined`,
|
|
41
|
-
typeof: "undefined",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return Maybe.of({
|
|
45
|
-
code: code `${this.reusables.snippets.convertToArray}(${itemConversionFunction.code}, ${literalOf(!this._mutable)})`,
|
|
46
|
-
sourceTypes,
|
|
47
|
-
});
|
|
48
21
|
}
|
|
49
22
|
get equalsFunction() {
|
|
50
23
|
return code `((left, right) => ${this.reusables.snippets.arrayEquals}(left, right, ${this.itemType.equalsFunction}))`;
|
|
@@ -59,7 +32,7 @@ export class AbstractCollectionType extends AbstractContainerType {
|
|
|
59
32
|
return code `${this.reusables.snippets.CollectionFilter}<${this.itemType.filterType}>`;
|
|
60
33
|
}
|
|
61
34
|
get graphqlType() {
|
|
62
|
-
return new AbstractContainerType.GraphqlType(code `new ${this.reusables.imports.GraphQLList}(${this.itemType.graphqlType.
|
|
35
|
+
return new AbstractContainerType.GraphqlType(code `new ${this.reusables.imports.GraphQLList}(${this.itemType.graphqlType.expression})`, this.reusables);
|
|
63
36
|
}
|
|
64
37
|
get hashFunction() {
|
|
65
38
|
return code `${this.reusables.snippets.hashArray}(${this.itemType.hashFunction})`;
|
|
@@ -73,38 +46,9 @@ export class AbstractCollectionType extends AbstractContainerType {
|
|
|
73
46
|
get validationFunction() {
|
|
74
47
|
return Maybe.of(code `${this.reusables.snippets.validateArray}(${this.itemType.validationFunction.orDefault(this.itemValidationFunctionDefault)}, ${literalOf(!this._mutable)})`);
|
|
75
48
|
}
|
|
76
|
-
get schemaInitializers() {
|
|
77
|
-
let schemaInitializers = super.schemaInitializers;
|
|
78
|
-
if (this.minCount > 0n) {
|
|
79
|
-
schemaInitializers = schemaInitializers.concat(code `minCount: ${Number(this.minCount)}`);
|
|
80
|
-
}
|
|
81
|
-
return schemaInitializers;
|
|
82
|
-
}
|
|
83
|
-
fromJsonExpression({ variables, }) {
|
|
84
|
-
let expression = variables.value;
|
|
85
|
-
if (this.minCount === 0n) {
|
|
86
|
-
expression = code `(${expression} ?? [])`;
|
|
87
|
-
}
|
|
88
|
-
return code `${this.reusables.imports.Either}.sequence<Error, ${this.itemType.expression}>(${expression}.map(item => (${this.itemType.fromJsonExpression({
|
|
89
|
-
variables: { value: code `item` },
|
|
90
|
-
})})))`;
|
|
91
|
-
}
|
|
92
49
|
graphqlResolveExpression({ variables, }) {
|
|
93
50
|
return variables.value;
|
|
94
51
|
}
|
|
95
|
-
jsonSchema(parameters) {
|
|
96
|
-
let schema = code `${this.itemType.jsonSchema(parameters)}.array()`;
|
|
97
|
-
if (this.minCount > 0n) {
|
|
98
|
-
schema = code `${schema}.nonempty().min(${this.minCount})`;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
schema = code `${schema}.optional()`;
|
|
102
|
-
}
|
|
103
|
-
if (!this._mutable) {
|
|
104
|
-
schema = code `${schema}.readonly()`;
|
|
105
|
-
}
|
|
106
|
-
return schema;
|
|
107
|
-
}
|
|
108
52
|
jsonUiSchemaElement(parameters) {
|
|
109
53
|
return this.itemType.jsonUiSchemaElement(parameters);
|
|
110
54
|
}
|
|
@@ -112,9 +56,6 @@ export class AbstractCollectionType extends AbstractContainerType {
|
|
|
112
56
|
return code `${variables.value}.map(item => (${this.itemType.toJsonExpression({ variables: { value: code `item` } })}))`;
|
|
113
57
|
}
|
|
114
58
|
}
|
|
115
|
-
__decorate([
|
|
116
|
-
Memoize()
|
|
117
|
-
], AbstractCollectionType.prototype, "conversionFunction", null);
|
|
118
59
|
__decorate([
|
|
119
60
|
Memoize()
|
|
120
61
|
], AbstractCollectionType.prototype, "equalsFunction", null);
|
|
@@ -35,8 +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
|
|
39
|
-
get toRdfResourceValueTypes(): AbstractType["toRdfResourceValueTypes"];
|
|
38
|
+
get referencesNamedType(): boolean;
|
|
40
39
|
protected get itemConversionFunctionDefault(): AbstractType.ConversionFunction;
|
|
41
40
|
protected get itemValidationFunctionDefault(): Code;
|
|
42
41
|
protected get schemaInitializers(): readonly Code[];
|
|
@@ -26,11 +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.
|
|
31
|
-
}
|
|
32
|
-
get toRdfResourceValueTypes() {
|
|
33
|
-
return this.itemType.toRdfResourceValueTypes;
|
|
29
|
+
get referencesNamedType() {
|
|
30
|
+
return this.name.isJust() || this.itemType.referencesNamedType;
|
|
34
31
|
}
|
|
35
32
|
get itemConversionFunctionDefault() {
|
|
36
33
|
return {
|
|
@@ -38,7 +35,7 @@ export class AbstractContainerType extends AbstractType {
|
|
|
38
35
|
sourceTypes: [
|
|
39
36
|
{
|
|
40
37
|
expression: this.itemType.expression,
|
|
41
|
-
|
|
38
|
+
jsType: this.itemType.jsTypes[0],
|
|
42
39
|
},
|
|
43
40
|
],
|
|
44
41
|
};
|
|
@@ -48,7 +45,7 @@ export class AbstractContainerType extends AbstractType {
|
|
|
48
45
|
}
|
|
49
46
|
get schemaInitializers() {
|
|
50
47
|
const initializers = super.schemaInitializers.concat();
|
|
51
|
-
if (this.recursive || this.
|
|
48
|
+
if (this.recursive || this.referencesNamedType) {
|
|
52
49
|
initializers.push(code `get itemType() { return ${this.itemType.schema}; }`);
|
|
53
50
|
}
|
|
54
51
|
else {
|
|
@@ -86,9 +83,9 @@ __decorate([
|
|
|
86
83
|
case "Union":
|
|
87
84
|
return true;
|
|
88
85
|
case "DefaultValue":
|
|
89
|
-
case "
|
|
90
|
-
case "
|
|
91
|
-
case "
|
|
86
|
+
case "LazyOption":
|
|
87
|
+
case "LazySet":
|
|
88
|
+
case "Lazy":
|
|
92
89
|
case "Option":
|
|
93
90
|
case "Set":
|
|
94
91
|
return false;
|
|
@@ -1,24 +1,21 @@
|
|
|
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
|
+
readonly jsTypes: readonly [{
|
|
9
|
+
readonly instanceof: "Date";
|
|
10
|
+
readonly typeof: "object";
|
|
11
|
+
}];
|
|
8
12
|
abstract readonly kind: "DateTime" | "Date";
|
|
9
13
|
readonly mutable = false;
|
|
10
14
|
readonly schemaType: Code;
|
|
11
|
-
readonly typeofs: "object"[];
|
|
12
15
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
13
16
|
fromJsonExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromJsonExpression"]>[0]): Code;
|
|
14
17
|
jsonType(): AbstractPrimitiveType.JsonType;
|
|
15
18
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
16
|
-
protected abstract fromRdfResourceValueExpression(variables: {
|
|
17
|
-
variables: {
|
|
18
|
-
value: Code;
|
|
19
|
-
};
|
|
20
|
-
}): Code;
|
|
21
|
-
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<Date>["fromRdfResourceValuesExpressionChain"]>;
|
|
22
19
|
}
|
|
23
20
|
export declare namespace AbstractDateType {
|
|
24
21
|
type ConversionFunction = AbstractPrimitiveType.ConversionFunction;
|
|
@@ -8,13 +8,18 @@ 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
|
+
jsTypes = [
|
|
16
|
+
{
|
|
17
|
+
instanceof: "Date",
|
|
18
|
+
typeof: "object",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
15
21
|
mutable = false;
|
|
16
22
|
schemaType = code `${this.reusables.snippets.DateSchema}`;
|
|
17
|
-
typeofs = ["object"];
|
|
18
23
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.dateSparqlWherePatterns}`;
|
|
19
24
|
fromJsonExpression({ variables, }) {
|
|
20
25
|
return code `${this.reusables.imports.Either}.of<Error, Date>(new Date(${variables.value}))`;
|
|
@@ -25,16 +30,6 @@ export class AbstractDateType extends AbstractPrimitiveType {
|
|
|
25
30
|
toRdfResourceValuesExpression({ variables, }) {
|
|
26
31
|
return code `[${this.reusables.snippets.literalFactory}.date(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
|
|
27
32
|
}
|
|
28
|
-
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
29
|
-
return {
|
|
30
|
-
...super.fromRdfResourceValuesExpressionChain({ variables }),
|
|
31
|
-
languageIn: undefined,
|
|
32
|
-
preferredLanguages: undefined,
|
|
33
|
-
valueTo: code `chain(values => values.chainMap(value => ${this.fromRdfResourceValueExpression({
|
|
34
|
-
variables: { value: code `value` },
|
|
35
|
-
})}))`,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
33
|
}
|
|
39
34
|
__decorate([
|
|
40
35
|
Memoize()
|
|
@@ -3,6 +3,10 @@ import type { IdentifierNodeKind } from "@shaclmate/shacl-ast";
|
|
|
3
3
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
4
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
5
|
export declare abstract class AbstractIdentifierType<IdentifierT extends BlankNode | NamedNode> extends AbstractTermType<NamedNode, IdentifierT> {
|
|
6
|
+
readonly jsTypes: readonly [{
|
|
7
|
+
readonly instanceof: "Object";
|
|
8
|
+
readonly typeof: "object";
|
|
9
|
+
}];
|
|
6
10
|
abstract readonly kind: "BlankNode" | "Identifier" | "Iri";
|
|
7
11
|
abstract readonly nodeKinds: ReadonlySet<IdentifierNodeKind>;
|
|
8
12
|
abstract readonly parseFunction: Code;
|
|
@@ -8,6 +8,9 @@ import { Memoize } from "typescript-memoize";
|
|
|
8
8
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
9
9
|
import { code } from "./ts-poet-wrapper.js";
|
|
10
10
|
export class AbstractIdentifierType extends AbstractTermType {
|
|
11
|
+
jsTypes = [
|
|
12
|
+
{ instanceof: "Object", typeof: "object" },
|
|
13
|
+
];
|
|
11
14
|
stringifyFunction = code `${this.reusables.imports.NTriplesTerm}.stringify`;
|
|
12
15
|
get graphqlType() {
|
|
13
16
|
return new AbstractTermType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
|
|
@@ -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,8 +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
|
-
readonly typeofs: "object"[];
|
|
21
19
|
readonly validationFunction: Maybe<Code>;
|
|
22
20
|
constructor({ partialType, resolveType, ...superParameters }: {
|
|
23
21
|
partialType: PartialTypeT;
|
|
@@ -29,7 +27,9 @@ export declare abstract class AbstractLazyObjectType<PartialTypeT extends Abstra
|
|
|
29
27
|
get filterType(): Code;
|
|
30
28
|
get graphqlType(): AbstractType.GraphqlType;
|
|
31
29
|
get hashFunction(): Code;
|
|
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,14 +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
|
-
typeofs = ["object"];
|
|
20
18
|
validationFunction = Maybe.empty();
|
|
21
19
|
constructor({ partialType, resolveType, ...superParameters }) {
|
|
22
20
|
super(superParameters);
|
|
@@ -41,9 +39,21 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
41
39
|
get hashFunction() {
|
|
42
40
|
return code `((hasher, value) => ${this.partialType.hashFunction}(hasher, value.${this.runtimeClass.partialPropertyName}))`;
|
|
43
41
|
}
|
|
42
|
+
get jsTypes() {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
className: this.runtimeClass.rawName,
|
|
46
|
+
instanceof: "class",
|
|
47
|
+
typeof: "object",
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
44
51
|
get recursive() {
|
|
45
52
|
return this.partialType.recursive;
|
|
46
53
|
}
|
|
54
|
+
get referencesNamedType() {
|
|
55
|
+
return this.partialType.referencesNamedType;
|
|
56
|
+
}
|
|
47
57
|
get schemaType() {
|
|
48
58
|
return code `${{
|
|
49
59
|
kind: this.kind,
|
|
@@ -95,13 +105,13 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
95
105
|
}
|
|
96
106
|
resolveToPartialFunction({ partialType, resolveType, }) {
|
|
97
107
|
if (partialType.kind === "Object") {
|
|
98
|
-
return code `${partialType.
|
|
108
|
+
return code `${partialType.name.unsafeCoerce()}.createUnsafe`;
|
|
99
109
|
}
|
|
100
110
|
invariant(partialType.kind === "ObjectUnion");
|
|
101
111
|
invariant(resolveType.kind === "ObjectUnion");
|
|
102
112
|
invariant(partialType.members.length === resolveType.members.length);
|
|
103
113
|
const caseBlocks = resolveType.members.map(({ discriminantValues }, memberI) => {
|
|
104
|
-
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);`;
|
|
105
115
|
});
|
|
106
116
|
caseBlocks.push(code `default: resolved satisfies never; throw new Error("unrecognized type");`);
|
|
107
117
|
return code `((resolved: ${resolveType.expression}) => { switch (resolved.${resolveType.discriminantProperty.unsafeCoerce().name}) { ${joinCode(caseBlocks)} } })`;
|
|
@@ -110,7 +120,7 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
110
120
|
invariant(resolvedObjectUnionType.members.length ===
|
|
111
121
|
partialObjectUnionType.members.length);
|
|
112
122
|
const caseBlocks = resolvedObjectUnionType.members.map(({ discriminantValues }, memberI) => {
|
|
113
|
-
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});`;
|
|
114
124
|
});
|
|
115
125
|
caseBlocks.push(code `default: ${variables.resolvedObjectUnion} satisfies never; throw new Error("unrecognized type");`);
|
|
116
126
|
return code `switch (${variables.resolvedObjectUnion}.${resolvedObjectUnionType.discriminantProperty.unsafeCoerce().name}) { ${joinCode(caseBlocks)} }`;
|
|
@@ -118,24 +128,27 @@ export class AbstractLazyObjectType extends AbstractType {
|
|
|
118
128
|
}
|
|
119
129
|
__decorate([
|
|
120
130
|
Memoize()
|
|
121
|
-
],
|
|
131
|
+
], AbstractLazyType.prototype, "equalsFunction", null);
|
|
132
|
+
__decorate([
|
|
133
|
+
Memoize()
|
|
134
|
+
], AbstractLazyType.prototype, "filterFunction", null);
|
|
122
135
|
__decorate([
|
|
123
136
|
Memoize()
|
|
124
|
-
],
|
|
137
|
+
], AbstractLazyType.prototype, "hashFunction", null);
|
|
125
138
|
__decorate([
|
|
126
139
|
Memoize()
|
|
127
|
-
],
|
|
140
|
+
], AbstractLazyType.prototype, "jsTypes", null);
|
|
128
141
|
__decorate([
|
|
129
142
|
Memoize()
|
|
130
|
-
],
|
|
143
|
+
], AbstractLazyType.prototype, "schemaType", null);
|
|
131
144
|
__decorate([
|
|
132
145
|
Memoize()
|
|
133
|
-
],
|
|
146
|
+
], AbstractLazyType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
134
147
|
__decorate([
|
|
135
148
|
Memoize()
|
|
136
|
-
],
|
|
137
|
-
(function (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
})(
|
|
141
|
-
//# 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,27 +1,25 @@
|
|
|
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;
|
|
22
19
|
type DiscriminantProperty = AbstractTermType.DiscriminantProperty;
|
|
23
20
|
const GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
|
|
24
21
|
type GraphqlType = AbstractTermType.GraphqlType;
|
|
22
|
+
type JsType = AbstractTermType.JsType;
|
|
25
23
|
const JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
|
|
26
24
|
type JsonType = AbstractTermType.JsonType;
|
|
27
25
|
}
|
|
@@ -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;
|