@shaclmate/compiler 4.0.49 → 4.0.50
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/input/input.shaclmate.ttl +85 -0
- package/package.json +602 -19
- package/dist/Compiler.d.ts +0 -14
- package/dist/Compiler.js +0 -18
- package/dist/Eithers.d.ts +0 -14
- package/dist/Eithers.js +0 -67
- package/dist/ShapesGraphToAstTransformer.d.ts +0 -18
- package/dist/ShapesGraphToAstTransformer.js +0 -50
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +0 -15
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +0 -51
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +0 -3
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +0 -5
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +0 -4
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +0 -24
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.d.ts +0 -9
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +0 -150
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.d.ts +0 -5
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +0 -26
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.d.ts +0 -17
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.js +0 -285
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +0 -10
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +0 -92
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +0 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +0 -149
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.d.ts +0 -7
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.js +0 -166
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +0 -110
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +0 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +0 -46
- package/dist/ast/AbstractCollectionType.d.ts +0 -30
- package/dist/ast/AbstractCollectionType.js +0 -33
- package/dist/ast/AbstractCompoundType.d.ts +0 -45
- package/dist/ast/AbstractCompoundType.js +0 -81
- package/dist/ast/AbstractContainerType.d.ts +0 -44
- package/dist/ast/AbstractContainerType.js +0 -63
- package/dist/ast/AbstractLazyType.d.ts +0 -117
- package/dist/ast/AbstractLazyType.js +0 -40
- package/dist/ast/AbstractTermType.d.ts +0 -33
- package/dist/ast/AbstractTermType.js +0 -47
- package/dist/ast/AbstractType.d.ts +0 -55
- package/dist/ast/AbstractType.js +0 -55
- package/dist/ast/Ast.d.ts +0 -6
- package/dist/ast/Ast.js +0 -2
- package/dist/ast/BlankNodeType.d.ts +0 -11
- package/dist/ast/BlankNodeType.js +0 -17
- package/dist/ast/DefaultValueType.d.ts +0 -35
- package/dist/ast/DefaultValueType.js +0 -50
- package/dist/ast/IdentifierType.d.ts +0 -12
- package/dist/ast/IdentifierType.js +0 -20
- package/dist/ast/IntersectionType.d.ts +0 -14
- package/dist/ast/IntersectionType.js +0 -17
- package/dist/ast/IriType.d.ts +0 -10
- package/dist/ast/IriType.js +0 -10
- package/dist/ast/LazyOptionType.d.ts +0 -6
- package/dist/ast/LazyOptionType.js +0 -5
- package/dist/ast/LazySetType.d.ts +0 -6
- package/dist/ast/LazySetType.js +0 -5
- package/dist/ast/LazyType.d.ts +0 -5
- package/dist/ast/LazyType.js +0 -5
- package/dist/ast/ListType.d.ts +0 -44
- package/dist/ast/ListType.js +0 -56
- package/dist/ast/LiteralType.d.ts +0 -40
- package/dist/ast/LiteralType.js +0 -59
- package/dist/ast/OptionType.d.ts +0 -13
- package/dist/ast/OptionType.js +0 -21
- package/dist/ast/SetType.d.ts +0 -31
- package/dist/ast/SetType.js +0 -42
- package/dist/ast/StructCompoundType.d.ts +0 -12
- package/dist/ast/StructCompoundType.js +0 -87
- package/dist/ast/StructIntersectionType.d.ts +0 -4
- package/dist/ast/StructIntersectionType.js +0 -2
- package/dist/ast/StructType.d.ts +0 -178
- package/dist/ast/StructType.js +0 -314
- package/dist/ast/StructUnionType.d.ts +0 -4
- package/dist/ast/StructUnionType.js +0 -2
- package/dist/ast/TermType.d.ts +0 -14
- package/dist/ast/TermType.js +0 -16
- package/dist/ast/Type.d.ts +0 -20
- package/dist/ast/Type.js +0 -42
- package/dist/ast/UnionType.d.ts +0 -30
- package/dist/ast/UnionType.js +0 -27
- package/dist/ast/equals.d.ts +0 -12
- package/dist/ast/equals.js +0 -65
- package/dist/ast/index.d.ts +0 -21
- package/dist/ast/index.js +0 -21
- package/dist/generators/AstJsonGenerator.d.ts +0 -6
- package/dist/generators/AstJsonGenerator.js +0 -15
- package/dist/generators/Cx2Generator.d.ts +0 -10
- package/dist/generators/Cx2Generator.js +0 -140
- package/dist/generators/Generator.d.ts +0 -5
- package/dist/generators/Generator.js +0 -2
- package/dist/generators/LabeledPropertyGraph.d.ts +0 -42
- package/dist/generators/LabeledPropertyGraph.js +0 -2
- package/dist/generators/index.d.ts +0 -6
- package/dist/generators/index.js +0 -6
- package/dist/generators/transformAstToLabeledPropertyGraph.d.ts +0 -4
- package/dist/generators/transformAstToLabeledPropertyGraph.js +0 -78
- package/dist/generators/ts/AbstractCollectionType.d.ts +0 -37
- package/dist/generators/ts/AbstractCollectionType.js +0 -88
- package/dist/generators/ts/AbstractContainerType.d.ts +0 -53
- package/dist/generators/ts/AbstractContainerType.js +0 -97
- package/dist/generators/ts/AbstractDateType.d.ts +0 -23
- package/dist/generators/ts/AbstractDateType.js +0 -37
- package/dist/generators/ts/AbstractIdentifierType.d.ts +0 -21
- package/dist/generators/ts/AbstractIdentifierType.js +0 -25
- package/dist/generators/ts/AbstractLazyType.d.ts +0 -67
- package/dist/generators/ts/AbstractLazyType.js +0 -154
- package/dist/generators/ts/AbstractLiteralType.d.ts +0 -26
- package/dist/generators/ts/AbstractLiteralType.js +0 -15
- package/dist/generators/ts/AbstractNumericType.d.ts +0 -21
- package/dist/generators/ts/AbstractNumericType.js +0 -65
- package/dist/generators/ts/AbstractObjectSetType.d.ts +0 -36
- package/dist/generators/ts/AbstractObjectSetType.js +0 -44
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +0 -32
- package/dist/generators/ts/AbstractPrimitiveType.js +0 -51
- package/dist/generators/ts/AbstractTermType.d.ts +0 -50
- package/dist/generators/ts/AbstractTermType.js +0 -102
- package/dist/generators/ts/AbstractType.d.ts +0 -345
- package/dist/generators/ts/AbstractType.js +0 -135
- package/dist/generators/ts/BigDecimalType.d.ts +0 -28
- package/dist/generators/ts/BigDecimalType.js +0 -58
- package/dist/generators/ts/BigIntType.d.ts +0 -17
- package/dist/generators/ts/BigIntType.js +0 -56
- package/dist/generators/ts/BlankNodeType.d.ts +0 -22
- package/dist/generators/ts/BlankNodeType.js +0 -67
- package/dist/generators/ts/BooleanType.d.ts +0 -21
- package/dist/generators/ts/BooleanType.js +0 -53
- package/dist/generators/ts/DateTimeType.d.ts +0 -13
- package/dist/generators/ts/DateTimeType.js +0 -31
- package/dist/generators/ts/DateType.d.ts +0 -14
- package/dist/generators/ts/DateType.js +0 -32
- package/dist/generators/ts/DefaultValueType.d.ts +0 -83
- package/dist/generators/ts/DefaultValueType.js +0 -143
- package/dist/generators/ts/FloatType.d.ts +0 -13
- package/dist/generators/ts/FloatType.js +0 -30
- package/dist/generators/ts/GraphqlSchema.d.ts +0 -22
- package/dist/generators/ts/GraphqlSchema.js +0 -87
- package/dist/generators/ts/IdentifierType.d.ts +0 -23
- package/dist/generators/ts/IdentifierType.js +0 -83
- package/dist/generators/ts/Imports.d.ts +0 -40
- package/dist/generators/ts/Imports.js +0 -41
- package/dist/generators/ts/IntType.d.ts +0 -13
- package/dist/generators/ts/IntType.js +0 -30
- package/dist/generators/ts/IriType.d.ts +0 -23
- package/dist/generators/ts/IriType.js +0 -112
- package/dist/generators/ts/LazyOptionType.d.ts +0 -36
- package/dist/generators/ts/LazyOptionType.js +0 -75
- package/dist/generators/ts/LazySetType.d.ts +0 -20
- package/dist/generators/ts/LazySetType.js +0 -76
- package/dist/generators/ts/LazyType.d.ts +0 -19
- package/dist/generators/ts/LazyType.js +0 -65
- package/dist/generators/ts/ListType.d.ts +0 -49
- package/dist/generators/ts/ListType.js +0 -161
- package/dist/generators/ts/LiteralType.d.ts +0 -27
- package/dist/generators/ts/LiteralType.js +0 -71
- package/dist/generators/ts/ObjectSetType.d.ts +0 -6
- package/dist/generators/ts/ObjectSetType.js +0 -36
- package/dist/generators/ts/ObjectType.d.ts +0 -104
- package/dist/generators/ts/ObjectType.js +0 -492
- package/dist/generators/ts/ObjectUnionType.d.ts +0 -20
- package/dist/generators/ts/ObjectUnionType.js +0 -223
- package/dist/generators/ts/OptionType.d.ts +0 -39
- package/dist/generators/ts/OptionType.js +0 -157
- package/dist/generators/ts/RdfjsDatasetObjectSetType.d.ts +0 -6
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +0 -323
- package/dist/generators/ts/Reusables.d.ts +0 -13
- package/dist/generators/ts/Reusables.js +0 -15
- package/dist/generators/ts/SetType.d.ts +0 -32
- package/dist/generators/ts/SetType.js +0 -132
- package/dist/generators/ts/Snippet.d.ts +0 -3
- package/dist/generators/ts/Snippet.js +0 -2
- package/dist/generators/ts/SnippetFactory.d.ts +0 -16
- package/dist/generators/ts/SnippetFactory.js +0 -2
- package/dist/generators/ts/Snippets.d.ts +0 -177
- package/dist/generators/ts/Snippets.js +0 -1163
- package/dist/generators/ts/SparqlObjectSetType.d.ts +0 -6
- package/dist/generators/ts/SparqlObjectSetType.js +0 -241
- package/dist/generators/ts/StringType.d.ts +0 -22
- package/dist/generators/ts/StringType.js +0 -68
- package/dist/generators/ts/TermType.d.ts +0 -31
- package/dist/generators/ts/TermType.js +0 -143
- package/dist/generators/ts/TsFeature.d.ts +0 -3
- package/dist/generators/ts/TsFeature.js +0 -28
- package/dist/generators/ts/TsGenerator.d.ts +0 -30
- package/dist/generators/ts/TsGenerator.js +0 -292
- package/dist/generators/ts/Type.d.ts +0 -25
- package/dist/generators/ts/Type.js +0 -2
- package/dist/generators/ts/TypeFactory.d.ts +0 -43
- package/dist/generators/ts/TypeFactory.js +0 -540
- package/dist/generators/ts/Typeof.d.ts +0 -2
- package/dist/generators/ts/Typeof.js +0 -2
- package/dist/generators/ts/UnionType.d.ts +0 -126
- package/dist/generators/ts/UnionType.js +0 -850
- package/dist/generators/ts/ZodGenerator.d.ts +0 -11
- package/dist/generators/ts/ZodGenerator.js +0 -60
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +0 -220
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +0 -37
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +0 -45
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +0 -104
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +0 -43
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +0 -216
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.js +0 -28
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeExpression.js +0 -20
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionExpression.js +0 -46
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionExpression.js +0 -79
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.js +0 -43
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.js +0 -26
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.js +0 -30
- package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.js +0 -13
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +0 -20
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.js +0 -22
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.js +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.js +0 -17
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -11
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.js +0 -23
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +0 -18
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +0 -18
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +0 -10
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +0 -35
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +0 -10
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -8
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionExpression.js +0 -33
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.js +0 -7
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.js +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js +0 -8
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js +0 -10
- package/dist/generators/ts/_ObjectType/Property.d.ts +0 -6
- package/dist/generators/ts/_ObjectType/Property.js +0 -2
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +0 -53
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +0 -292
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.js +0 -5
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.js +0 -6
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.js +0 -6
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.js +0 -7
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.js +0 -4
- package/dist/generators/ts/_snippets/snippets_DateFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_DateFilter.js +0 -10
- package/dist/generators/ts/_snippets/snippets_DateSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_DateSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_EqualsResult.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_EqualsResult.js +0 -63
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +0 -10
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +0 -11
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +0 -13
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +0 -16
- package/dist/generators/ts/_snippets/snippets_HashFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_HashFunction.js +0 -4
- package/dist/generators/ts/_snippets/snippets_Hasher.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_Hasher.js +0 -3
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.js +0 -7
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +0 -7
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.js +0 -27
- package/dist/generators/ts/_snippets/snippets_IriFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_IriFilter.js +0 -6
- package/dist/generators/ts/_snippets/snippets_IriSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_Lazy.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_Lazy.js +0 -22
- package/dist/generators/ts/_snippets/snippets_LazyOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyOption.js +0 -25
- package/dist/generators/ts/_snippets/snippets_LazySet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazySet.js +0 -40
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +0 -4
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +0 -9
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.js +0 -4
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +0 -7
- package/dist/generators/ts/_snippets/snippets_NumericFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_NumericFilter.js +0 -10
- package/dist/generators/ts/_snippets/snippets_NumericSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_NumericSchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +0 -6
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +0 -46
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +0 -40
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +0 -8
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.js +0 -3
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.js +0 -3
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.js +0 -30
- package/dist/generators/ts/_snippets/snippets_StringFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_StringFilter.js +0 -8
- package/dist/generators/ts/_snippets/snippets_StringSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +0 -9
- package/dist/generators/ts/_snippets/snippets_TermFilter.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_TermFilter.js +0 -9
- package/dist/generators/ts/_snippets/snippets_TermSchema.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_TermSchema.js +0 -9
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +0 -11
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +0 -16
- package/dist/generators/ts/_snippets/snippets_UnwrapR.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_UnwrapR.js +0 -4
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.js +0 -4
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +0 -11
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +0 -13
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +0 -13
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.js +0 -12
- package/dist/generators/ts/_snippets/snippets_arrayEquals.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_arrayEquals.js +0 -68
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.js +0 -29
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.js +0 -9
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +0 -83
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +0 -5
- package/dist/generators/ts/_snippets/snippets_booleanEquals.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +0 -16
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +0 -15
- package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_compactRecord.js +0 -15
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +0 -8
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +0 -11
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.js +0 -17
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +0 -13
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +0 -21
- package/dist/generators/ts/_snippets/snippets_convertToIri.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +0 -11
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +0 -17
- package/dist/generators/ts/_snippets/snippets_convertToLazy.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazy.js +0 -15
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.js +0 -33
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.js +0 -27
- package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToList.js +0 -7
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +0 -13
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +0 -19
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +0 -15
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +0 -11
- package/dist/generators/ts/_snippets/snippets_dateEquals.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_dateEquals.js +0 -13
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +0 -71
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.js +0 -9
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.js +0 -19
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.js +0 -10
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +0 -9
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +0 -16
- package/dist/generators/ts/_snippets/snippets_filterArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterArray.js +0 -22
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.js +0 -26
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.js +0 -6
- package/dist/generators/ts/_snippets/snippets_filterBoolean.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterBoolean.js +0 -10
- package/dist/generators/ts/_snippets/snippets_filterDate.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterDate.js +0 -26
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.js +0 -14
- package/dist/generators/ts/_snippets/snippets_filterIri.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterIri.js +0 -10
- package/dist/generators/ts/_snippets/snippets_filterLiteral.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterLiteral.js +0 -6
- package/dist/generators/ts/_snippets/snippets_filterMaybe.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterMaybe.js +0 -22
- package/dist/generators/ts/_snippets/snippets_filterNumeric.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterNumeric.js +0 -26
- package/dist/generators/ts/_snippets/snippets_filterString.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterString.js +0 -18
- package/dist/generators/ts/_snippets/snippets_filterTerm.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_filterTerm.js +0 -22
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_hashArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashArray.js +0 -11
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashBoolean.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashBoolean.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashDate.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashDate.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashDateTime.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashDateTime.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashMaybe.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashMaybe.js +0 -11
- package/dist/generators/ts/_snippets/snippets_hashNumeric.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashNumeric.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashString.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashString.js +0 -7
- package/dist/generators/ts/_snippets/snippets_hashTerm.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_hashTerm.js +0 -12
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +0 -30
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +0 -13
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.js +0 -15
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.js +0 -15
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +0 -37
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +0 -116
- package/dist/generators/ts/_snippets/snippets_literalFactory.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_literalFactory.js +0 -3
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.js +0 -39
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +0 -5
- package/dist/generators/ts/_snippets/snippets_maybeEquals.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_maybeEquals.js +0 -31
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.js +0 -11
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +0 -6
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +0 -21
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.js +0 -16
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.js +0 -8
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.js +0 -8
- package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.js +0 -92
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +0 -62
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +0 -9
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +0 -4
- package/dist/generators/ts/_snippets/snippets_parseIri.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_parseIri.js +0 -9
- package/dist/generators/ts/_snippets/snippets_sequenceRecord.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_sequenceRecord.js +0 -18
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.js +0 -9
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +0 -6
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +0 -17
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +0 -17
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +0 -90
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +0 -86
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.js +0 -24
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.js +0 -29
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +0 -59
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.js +0 -23
- package/dist/generators/ts/_snippets/snippets_strictEquals.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_strictEquals.js +0 -12
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.js +0 -6
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +0 -39
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +0 -93
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.js +0 -17
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.js +0 -60
- package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.js +0 -24
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +0 -5
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.js +0 -6
- package/dist/generators/ts/_snippets/snippets_validateArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_validateArray.js +0 -13
- package/dist/generators/ts/_snippets/snippets_validateMaybe.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +0 -7
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +0 -9
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.js +0 -14
- package/dist/generators/ts/codeEquals.d.ts +0 -3
- package/dist/generators/ts/codeEquals.js +0 -7
- package/dist/generators/ts/rdfjsTermExpression.d.ts +0 -11
- package/dist/generators/ts/rdfjsTermExpression.js +0 -72
- package/dist/generators/ts/singleEntryRecord.d.ts +0 -2
- package/dist/generators/ts/singleEntryRecord.js +0 -6
- package/dist/generators/ts/ts-poet-wrapper.d.ts +0 -5
- package/dist/generators/ts/ts-poet-wrapper.js +0 -13
- package/dist/generators/ts/tsComment.d.ts +0 -5
- package/dist/generators/ts/tsComment.js +0 -11
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/input/ShapesGraph.d.ts +0 -44
- package/dist/input/ShapesGraph.js +0 -66
- package/dist/input/generated.d.ts +0 -4074
- package/dist/input/generated.js +0 -3417
- package/dist/input/index.d.ts +0 -3
- package/dist/input/index.js +0 -3
|
@@ -1,850 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Maybe } from "purify-ts";
|
|
8
|
-
import { invariant } from "ts-invariant";
|
|
9
|
-
import { Memoize } from "typescript-memoize";
|
|
10
|
-
import { AbstractType } from "./AbstractType.js";
|
|
11
|
-
import { code, def, joinCode, literalOf, } from "./ts-poet-wrapper.js";
|
|
12
|
-
export class UnionType extends AbstractType {
|
|
13
|
-
discriminant;
|
|
14
|
-
graphqlArgs = Maybe.empty();
|
|
15
|
-
identifierType;
|
|
16
|
-
kind = "Union";
|
|
17
|
-
recursive;
|
|
18
|
-
synthetic;
|
|
19
|
-
validationFunction = Maybe.empty();
|
|
20
|
-
constructor({ identifierType, members, recursive, synthetic, ...superParameters }) {
|
|
21
|
-
super(superParameters);
|
|
22
|
-
this.identifierType = identifierType;
|
|
23
|
-
invariant(members.length >= 2);
|
|
24
|
-
this.recursive = recursive;
|
|
25
|
-
this.discriminant = Discriminant.infer(members);
|
|
26
|
-
this.synthetic = synthetic;
|
|
27
|
-
this.lazyMembers = () => members.map((member, memberI) => {
|
|
28
|
-
let discriminantValues;
|
|
29
|
-
invariant(this.discriminant.memberValues.length === members.length);
|
|
30
|
-
switch (this.discriminant.kind) {
|
|
31
|
-
case "Extrinsic":
|
|
32
|
-
discriminantValues = [this.discriminant.memberValues[memberI]];
|
|
33
|
-
break;
|
|
34
|
-
case "Hybrid":
|
|
35
|
-
discriminantValues = this.discriminant.memberValues[memberI].values;
|
|
36
|
-
break;
|
|
37
|
-
case "Intrinsic": {
|
|
38
|
-
discriminantValues =
|
|
39
|
-
member.type.discriminantProperty.unsafeCoerce().values;
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case "Typeof":
|
|
43
|
-
discriminantValues = [this.discriminant.memberValues[memberI]];
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
throw this.discriminant;
|
|
47
|
-
}
|
|
48
|
-
invariant(discriminantValues.length > 0);
|
|
49
|
-
const typeCheck = (json) => (instance) => {
|
|
50
|
-
const discriminant = this.discriminant; // To get type narrowing to work
|
|
51
|
-
if (discriminant.kind === "Typeof") {
|
|
52
|
-
return code `(${joinCode(discriminantValues.map((discriminantValue) => code `typeof ${instance} === ${literalOf(discriminantValue)}`), { on: " || " })})`;
|
|
53
|
-
}
|
|
54
|
-
if (discriminant.kind === "Intrinsic" && !json) {
|
|
55
|
-
switch (member.type.kind) {
|
|
56
|
-
case "Object":
|
|
57
|
-
case "ObjectUnion":
|
|
58
|
-
return code `${member.type.name.unsafeCoerce()}.is${member.type.name.unsafeCoerce()}(${instance})`;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const discriminantName = json
|
|
62
|
-
? discriminant.jsonName
|
|
63
|
-
: discriminant.name;
|
|
64
|
-
return code `(${joinCode(discriminantValues.map((discriminantValue) => code `${instance}["${discriminantName}"] === ${literalOf(discriminantValue)}`), { on: " || " })})`;
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
discriminantValues,
|
|
68
|
-
jsonType: member.type.jsonType({
|
|
69
|
-
includeDiscriminantProperty: this.discriminant.kind === "Intrinsic" ||
|
|
70
|
-
(this.discriminant.kind === "Hybrid" &&
|
|
71
|
-
this.discriminant.memberValues[memberI].kind === "Intrinsic"),
|
|
72
|
-
}).expression,
|
|
73
|
-
jsonTypeCheck: typeCheck(true),
|
|
74
|
-
primaryDiscriminantValue: discriminantValues[0],
|
|
75
|
-
type: member.type,
|
|
76
|
-
typeCheck: typeCheck(false),
|
|
77
|
-
typeToJsonExpression: (valueVariable) => member.type.toJsonExpression({
|
|
78
|
-
includeDiscriminantProperty: this.discriminant.kind === "Intrinsic" ||
|
|
79
|
-
(this.discriminant.kind === "Hybrid" &&
|
|
80
|
-
this.discriminant.memberValues[memberI].kind === "Intrinsic"),
|
|
81
|
-
variables: { value: valueVariable },
|
|
82
|
-
}),
|
|
83
|
-
unwrap: (instance) => {
|
|
84
|
-
switch (this.discriminant.kind) {
|
|
85
|
-
case "Extrinsic":
|
|
86
|
-
return code `${instance}.value`;
|
|
87
|
-
case "Hybrid":
|
|
88
|
-
return this.discriminant.memberValues[memberI].kind ===
|
|
89
|
-
"Intrinsic"
|
|
90
|
-
? instance
|
|
91
|
-
: code `${instance}.value`;
|
|
92
|
-
case "Intrinsic":
|
|
93
|
-
case "Typeof":
|
|
94
|
-
return instance;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
wrap: (instance) => {
|
|
98
|
-
switch (this.discriminant.kind) {
|
|
99
|
-
case "Extrinsic":
|
|
100
|
-
return code `{ ${this.discriminant.name}: ${literalOf(discriminantValues[0])} as const, value: ${instance} }`;
|
|
101
|
-
case "Hybrid":
|
|
102
|
-
return this.discriminant.memberValues[memberI].kind ===
|
|
103
|
-
"Intrinsic"
|
|
104
|
-
? instance
|
|
105
|
-
: code `{ ${this.discriminant.name}: ${literalOf(discriminantValues[0])} as const, value: ${instance} }`;
|
|
106
|
-
case "Intrinsic":
|
|
107
|
-
case "Typeof":
|
|
108
|
-
return instance;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
get conversionFunction() {
|
|
115
|
-
return Maybe.of({
|
|
116
|
-
code: code `${this.reusables.snippets.identityConversionFunction}`,
|
|
117
|
-
sourceTypes: this.discriminant.kind === "Typeof"
|
|
118
|
-
? this.members.flatMap(({ type }) => type.jsTypes.map((jsType) => ({
|
|
119
|
-
expression: type.expression,
|
|
120
|
-
jsType,
|
|
121
|
-
})))
|
|
122
|
-
: [
|
|
123
|
-
{
|
|
124
|
-
expression: this.expression,
|
|
125
|
-
jsType: {
|
|
126
|
-
instanceof: "Object",
|
|
127
|
-
typeof: "object",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
get declaration() {
|
|
134
|
-
const name = this.name.extract();
|
|
135
|
-
if (!name) {
|
|
136
|
-
return Maybe.empty();
|
|
137
|
-
}
|
|
138
|
-
const declarations = [];
|
|
139
|
-
if (this.configuration.features.has("Object.type")) {
|
|
140
|
-
declarations.push(code `export type ${def(name)} = ${this.inlineExpression};`);
|
|
141
|
-
}
|
|
142
|
-
const staticModuleDeclarations = Object.entries(this.staticModuleDeclarations);
|
|
143
|
-
if (staticModuleDeclarations.length > 0) {
|
|
144
|
-
declarations.push(code `\
|
|
145
|
-
export namespace ${def(name)} {
|
|
146
|
-
${joinCode(staticModuleDeclarations
|
|
147
|
-
.sort((left, right) => left[0].localeCompare(right[0]))
|
|
148
|
-
.map((_) => _[1]), { on: "\n\n" })}
|
|
149
|
-
}`);
|
|
150
|
-
}
|
|
151
|
-
return Maybe.of(joinCode(declarations, { on: "\n\n" }));
|
|
152
|
-
}
|
|
153
|
-
get discriminantProperty() {
|
|
154
|
-
switch (this.discriminant.kind) {
|
|
155
|
-
case "Extrinsic":
|
|
156
|
-
return Maybe.of({
|
|
157
|
-
jsonName: this.discriminant.jsonName,
|
|
158
|
-
name: this.discriminant.name,
|
|
159
|
-
values: this.discriminant.memberValues,
|
|
160
|
-
});
|
|
161
|
-
case "Hybrid":
|
|
162
|
-
return Maybe.of({
|
|
163
|
-
jsonName: this.discriminant.jsonName,
|
|
164
|
-
name: "termType",
|
|
165
|
-
values: this.discriminant.memberValues.flatMap((_) => _.values),
|
|
166
|
-
});
|
|
167
|
-
case "Intrinsic":
|
|
168
|
-
return Maybe.of({
|
|
169
|
-
jsonName: this.discriminant.jsonName,
|
|
170
|
-
name: this.discriminant.name,
|
|
171
|
-
values: this.discriminant.memberValues,
|
|
172
|
-
});
|
|
173
|
-
case "Typeof":
|
|
174
|
-
return Maybe.empty();
|
|
175
|
-
default:
|
|
176
|
-
throw this.discriminant;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
get equalsFunction() {
|
|
180
|
-
return this.name
|
|
181
|
-
.map((name) => code `${name}.equals`)
|
|
182
|
-
.orDefault(this.equalsFunctionExpression);
|
|
183
|
-
}
|
|
184
|
-
get expression() {
|
|
185
|
-
return this.name
|
|
186
|
-
.map((name) => code `${name}`)
|
|
187
|
-
.orDefault(this.inlineExpression);
|
|
188
|
-
}
|
|
189
|
-
get filterFunction() {
|
|
190
|
-
return this.name
|
|
191
|
-
.map((name) => code `${name}.filter`)
|
|
192
|
-
.orDefault(this.filterFunctionExpression);
|
|
193
|
-
}
|
|
194
|
-
get filterType() {
|
|
195
|
-
return this.name
|
|
196
|
-
.map((name) => code `${name}.Filter`)
|
|
197
|
-
.orDefault(this.filterTypeLiteral);
|
|
198
|
-
}
|
|
199
|
-
get fromRdfResourceValuesFunction() {
|
|
200
|
-
return this.name
|
|
201
|
-
.map((name) => code `${name}.fromRdfResourceValues`)
|
|
202
|
-
.orDefault(this.fromRdfResourceValuesFunctionExpression);
|
|
203
|
-
}
|
|
204
|
-
get graphqlType() {
|
|
205
|
-
const name = this.name.extract();
|
|
206
|
-
if (!name ||
|
|
207
|
-
!this.members.every((member) => member.type.kind === "Object")) {
|
|
208
|
-
throw new Error("not implemented");
|
|
209
|
-
}
|
|
210
|
-
return new AbstractType.GraphqlType(code `${name}.GraphQL`, this.reusables);
|
|
211
|
-
}
|
|
212
|
-
get hashFunction() {
|
|
213
|
-
return this.name
|
|
214
|
-
.map((name) => code `${name}.hash`)
|
|
215
|
-
.orDefault(this.hashFunctionExpression);
|
|
216
|
-
}
|
|
217
|
-
get jsTypes() {
|
|
218
|
-
const jsTypes = [];
|
|
219
|
-
for (const member of this.members) {
|
|
220
|
-
for (const memberJsType of member.type.jsTypes) {
|
|
221
|
-
if (!jsTypes.some((jsType) => AbstractType.JsType.equals(jsType, memberJsType))) {
|
|
222
|
-
jsTypes.push(memberJsType);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return jsTypes;
|
|
227
|
-
}
|
|
228
|
-
get jsonSchemaFunctionDeclaration() {
|
|
229
|
-
let expression = this.jsonSchemaExpression;
|
|
230
|
-
const meta = {
|
|
231
|
-
// id: this.name,
|
|
232
|
-
};
|
|
233
|
-
this.comment.ifJust((description) => {
|
|
234
|
-
meta["description"] = description;
|
|
235
|
-
});
|
|
236
|
-
this.label.ifJust((label) => {
|
|
237
|
-
meta["title"] = label;
|
|
238
|
-
});
|
|
239
|
-
if (Object.keys(meta).length > 0) {
|
|
240
|
-
expression = code `${expression}.meta(${meta})`;
|
|
241
|
-
}
|
|
242
|
-
return code `export const schema = () => ${expression};`;
|
|
243
|
-
}
|
|
244
|
-
get jsonTypeAliasDeclaration() {
|
|
245
|
-
return code `export type Json = ${this.jsonTypeLiteral.expression}`;
|
|
246
|
-
}
|
|
247
|
-
get members() {
|
|
248
|
-
return this.lazyMembers();
|
|
249
|
-
}
|
|
250
|
-
get mutable() {
|
|
251
|
-
return this.members.some((member) => member.type.mutable);
|
|
252
|
-
}
|
|
253
|
-
get referencesNamedType() {
|
|
254
|
-
return (this.name.isJust() ||
|
|
255
|
-
this.members.some((member) => member.type.referencesNamedType));
|
|
256
|
-
}
|
|
257
|
-
get schema() {
|
|
258
|
-
return this.name
|
|
259
|
-
.map((name) => code `${name}.schema`)
|
|
260
|
-
.orDefault(this.schemaExpression);
|
|
261
|
-
}
|
|
262
|
-
get schemaType() {
|
|
263
|
-
return this.name
|
|
264
|
-
.map(() => code `typeof ${this.schema}`)
|
|
265
|
-
.orDefault(this.schemaTypeExpression);
|
|
266
|
-
}
|
|
267
|
-
get toRdfResourceValueTypes() {
|
|
268
|
-
const set = new Set();
|
|
269
|
-
for (const member of this.members) {
|
|
270
|
-
for (const value of member.type.toRdfResourceValueTypes) {
|
|
271
|
-
set.add(value);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return set;
|
|
275
|
-
}
|
|
276
|
-
get valueSparqlConstructTriplesFunction() {
|
|
277
|
-
return this.name
|
|
278
|
-
.map((name) => code `${name}.valueSparqlConstructTriples`)
|
|
279
|
-
.orDefault(this.valueSparqlConstructTriplesFunctionExpression);
|
|
280
|
-
}
|
|
281
|
-
get valueSparqlWherePatternsFunction() {
|
|
282
|
-
return this.name
|
|
283
|
-
.map((name) => code `${name}.valueSparqlWherePatterns`)
|
|
284
|
-
.orDefault(this.valueSparqlWherePatternsFunctionExpression);
|
|
285
|
-
}
|
|
286
|
-
get schemaInitializers() {
|
|
287
|
-
return super.schemaInitializers.concat(code `members: { ${joinCode(this.members.map(({ discriminantValues, type, primaryDiscriminantValue }) => code `${literalOf(primaryDiscriminantValue)}: ${{
|
|
288
|
-
discriminantValues: discriminantValues,
|
|
289
|
-
type: type.schema,
|
|
290
|
-
}}`), { on: "," })} }`);
|
|
291
|
-
}
|
|
292
|
-
get schemaTypeExpression() {
|
|
293
|
-
return code `${{
|
|
294
|
-
kind: this.kind,
|
|
295
|
-
members: code `{ ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}: ${{
|
|
296
|
-
discriminantValues: code `readonly (number | string)[]`,
|
|
297
|
-
type: type.schemaType,
|
|
298
|
-
}}`), { on: ";" })} }`,
|
|
299
|
-
}}`;
|
|
300
|
-
}
|
|
301
|
-
get staticModuleDeclarations() {
|
|
302
|
-
const name = this.name.unsafeCoerce();
|
|
303
|
-
const staticModuleDeclarations = {};
|
|
304
|
-
if (this.configuration.features.has("Object.equals")) {
|
|
305
|
-
staticModuleDeclarations[`equals`] =
|
|
306
|
-
code `export const equals = ${this.equalsFunctionExpression};`;
|
|
307
|
-
}
|
|
308
|
-
if (this.configuration.features.has("Object.filter")) {
|
|
309
|
-
staticModuleDeclarations[`Filter`] =
|
|
310
|
-
code `export type Filter = ${this.filterTypeLiteral};`;
|
|
311
|
-
staticModuleDeclarations[`filter`] =
|
|
312
|
-
code `export const filter = ${this.filterFunctionExpression};`;
|
|
313
|
-
}
|
|
314
|
-
if (this.configuration.features.has("Object.hash")) {
|
|
315
|
-
staticModuleDeclarations[`hash`] =
|
|
316
|
-
code `export const hash = ${this.hashFunctionExpression};`;
|
|
317
|
-
}
|
|
318
|
-
if (this.configuration.features.has("Object.JSON.type")) {
|
|
319
|
-
staticModuleDeclarations[`Json.type`] =
|
|
320
|
-
code `${this.jsonTypeAliasDeclaration}`;
|
|
321
|
-
}
|
|
322
|
-
if (this.configuration.features.has("Object.JSON.schema")) {
|
|
323
|
-
staticModuleDeclarations[`Json.namespace`] = code `\
|
|
324
|
-
export namespace Json {
|
|
325
|
-
${this.jsonSchemaFunctionDeclaration}
|
|
326
|
-
|
|
327
|
-
export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Json> {
|
|
328
|
-
const jsonSafeParseResult = schema().safeParse(json);
|
|
329
|
-
if (!jsonSafeParseResult.success) { return ${this.reusables.imports.Left}(jsonSafeParseResult.error); }
|
|
330
|
-
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
331
|
-
}
|
|
332
|
-
}`;
|
|
333
|
-
}
|
|
334
|
-
if (this.configuration.features.has("Object.fromJson")) {
|
|
335
|
-
staticModuleDeclarations[`fromJson`] =
|
|
336
|
-
code `export const fromJson = ${this.fromJsonFunctionExpression};`;
|
|
337
|
-
}
|
|
338
|
-
if (this.configuration.features.has("Object.fromRdf")) {
|
|
339
|
-
staticModuleDeclarations[`fromRdfResourceValues`] =
|
|
340
|
-
code `export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${name}, ${this.schemaType}> = ${this.fromRdfResourceValuesFunctionExpression};`;
|
|
341
|
-
}
|
|
342
|
-
if (this.configuration.features.has("Object.schema")) {
|
|
343
|
-
staticModuleDeclarations["schema"] =
|
|
344
|
-
code `export const schema = ${this.schemaExpression}`;
|
|
345
|
-
}
|
|
346
|
-
if (this.configuration.features.has("Object.toJson")) {
|
|
347
|
-
staticModuleDeclarations[`toJson`] =
|
|
348
|
-
code `export const toJson = ${this.toJsonFunctionExpression};`;
|
|
349
|
-
}
|
|
350
|
-
if (this.configuration.features.has("Object.toRdf")) {
|
|
351
|
-
staticModuleDeclarations[`toRdfResourceValues`] =
|
|
352
|
-
code `export const toRdfResourceValues = ${this.toRdfResourceValuesFunctionExpression};`;
|
|
353
|
-
}
|
|
354
|
-
if (this.configuration.features.has("Object.SPARQL")) {
|
|
355
|
-
staticModuleDeclarations[`valueSparqlConstructTriples`] =
|
|
356
|
-
code `export const valueSparqlConstructTriples: ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ${this.valueSparqlConstructTriplesFunctionExpression};`;
|
|
357
|
-
staticModuleDeclarations[`valueSparqlWherePatterns`] =
|
|
358
|
-
code `export const valueSparqlWherePatterns: ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ${this.valueSparqlWherePatternsFunctionExpression};`;
|
|
359
|
-
}
|
|
360
|
-
if (this.configuration.features.has("Object.toString")) {
|
|
361
|
-
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
362
|
-
staticModuleDeclarations[`${syntheticNamePrefix}toString`] =
|
|
363
|
-
code `export const ${syntheticNamePrefix}toString = ${this.toStringFunctionExpression};`;
|
|
364
|
-
}
|
|
365
|
-
return staticModuleDeclarations;
|
|
366
|
-
}
|
|
367
|
-
get equalsFunctionExpression() {
|
|
368
|
-
return code `\
|
|
369
|
-
((left: ${this.expression}, right: ${this.expression}) => {
|
|
370
|
-
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `left`)} && ${typeCheck(code `right`)}) {
|
|
371
|
-
return ${type.equalsFunction}(${unwrap(code `left`)} as ${type.expression}, ${unwrap(code `right`)} as ${type.expression});
|
|
372
|
-
}`))}
|
|
373
|
-
|
|
374
|
-
return ${this.reusables.imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
|
|
375
|
-
})`;
|
|
376
|
-
}
|
|
377
|
-
get filterFunctionExpression() {
|
|
378
|
-
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
379
|
-
return code `\
|
|
380
|
-
((filter: ${this.filterType}, value: ${this.expression}) => {
|
|
381
|
-
${joinCode([
|
|
382
|
-
...this.identifierType
|
|
383
|
-
.map((identifierType) => code `\
|
|
384
|
-
if (filter.${syntheticNamePrefix}identifier !== undefined && !${identifierType.filterFunction}(filter.${syntheticNamePrefix}identifier, value.${syntheticNamePrefix}identifier())) {
|
|
385
|
-
return false;
|
|
386
|
-
}`)
|
|
387
|
-
.toList(),
|
|
388
|
-
...this.members.map(({ primaryDiscriminantValue, type, typeCheck, unwrap }) => code `\
|
|
389
|
-
if (filter.on?.[${literalOf(primaryDiscriminantValue)}] !== undefined && ${typeCheck(code `value`)}) {
|
|
390
|
-
if (!${type.filterFunction}(filter.on[${literalOf(primaryDiscriminantValue)}], ${unwrap(code `value`)})) {
|
|
391
|
-
return false;
|
|
392
|
-
}
|
|
393
|
-
}`),
|
|
394
|
-
])}
|
|
395
|
-
|
|
396
|
-
return true;
|
|
397
|
-
})`;
|
|
398
|
-
}
|
|
399
|
-
get filterTypeLiteral() {
|
|
400
|
-
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
401
|
-
return code `\
|
|
402
|
-
{
|
|
403
|
-
${this.identifierType.map((identifierType) => code `readonly ${syntheticNamePrefix}identifier?: ${identifierType.filterType};`).orDefault(code ``)}
|
|
404
|
-
readonly on?: { ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}?: ${type.filterType}`), { on: ";" })} }
|
|
405
|
-
}`;
|
|
406
|
-
}
|
|
407
|
-
get fromJsonFunctionExpression() {
|
|
408
|
-
return code `\
|
|
409
|
-
((value: ${this.jsonType().expression}): ${this.reusables.imports.Either}<Error, ${this.expression}> => {
|
|
410
|
-
${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) => code `if (${jsonTypeCheck(code `value`)}) { return ${type.fromJsonExpression({
|
|
411
|
-
variables: {
|
|
412
|
-
value: code `(${unwrap(code `value`)} as ${jsonType})`,
|
|
413
|
-
},
|
|
414
|
-
})}.map(value => (${wrap(code `value`)})); }`))}
|
|
415
|
-
|
|
416
|
-
throw new Error("unable to deserialize JSON");
|
|
417
|
-
})`;
|
|
418
|
-
}
|
|
419
|
-
get fromRdfResourceValuesFunctionExpression() {
|
|
420
|
-
return code `\
|
|
421
|
-
(((values, options) =>
|
|
422
|
-
values.chainMap(value => {
|
|
423
|
-
const valueAsValues = value.toValues();
|
|
424
|
-
return ${this.members.reduce((expression, { type, primaryDiscriminantValue }, memberI) => {
|
|
425
|
-
let typeExpression = code `${type.fromRdfResourceValuesFunction}(valueAsValues, { ...options, schema: options.schema.members[${literalOf(primaryDiscriminantValue)}].type })`;
|
|
426
|
-
if (this.discriminant.kind === "Extrinsic" ||
|
|
427
|
-
(this.discriminant.kind === "Hybrid" &&
|
|
428
|
-
this.discriminant.memberValues[memberI].kind === "Extrinsic")) {
|
|
429
|
-
typeExpression = code `${typeExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: ${literalOf(primaryDiscriminantValue)} as const, value }) as (${this.expression})))`;
|
|
430
|
-
}
|
|
431
|
-
typeExpression = code `(${typeExpression} as ${this.reusables.imports.Either}<Error, ${this.reusables.imports.Resource}.Values<${this.expression}>>)`;
|
|
432
|
-
return expression !== null
|
|
433
|
-
? code `${expression}.altLazy(() => ${typeExpression})`
|
|
434
|
-
: typeExpression;
|
|
435
|
-
}, null)}.chain(values => values.head());
|
|
436
|
-
})
|
|
437
|
-
) satisfies ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>)`;
|
|
438
|
-
}
|
|
439
|
-
get hashFunctionExpression() {
|
|
440
|
-
return code `\
|
|
441
|
-
(<HasherT extends ${this.reusables.snippets.Hasher}>(hasher: HasherT, value: ${this.expression}): HasherT => {
|
|
442
|
-
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `value`)}) { return ${type.hashFunction}(hasher, ${unwrap(code `value`)}); }`))}
|
|
443
|
-
return hasher;
|
|
444
|
-
})`;
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* An inline expression of this type rather than a type reference/name.
|
|
448
|
-
*/
|
|
449
|
-
get inlineExpression() {
|
|
450
|
-
const discriminant = this.discriminant; // To get type narrowing to work
|
|
451
|
-
switch (discriminant.kind) {
|
|
452
|
-
case "Extrinsic":
|
|
453
|
-
return code `(${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.expression} }`), { on: "|" })})`;
|
|
454
|
-
case "Hybrid":
|
|
455
|
-
return code `(${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
456
|
-
switch (discriminant.memberValues[memberI].kind) {
|
|
457
|
-
case "Extrinsic":
|
|
458
|
-
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.expression} }`;
|
|
459
|
-
case "Intrinsic":
|
|
460
|
-
return code `${type.expression}`;
|
|
461
|
-
default:
|
|
462
|
-
throw new Error();
|
|
463
|
-
}
|
|
464
|
-
}), { on: "|" })})`;
|
|
465
|
-
case "Intrinsic":
|
|
466
|
-
// If every type shares a discriminant (e.g., RDF/JS "termType" or generated ObjectType "type"),
|
|
467
|
-
// just join their names with "|"
|
|
468
|
-
return code `(${joinCode(this.members.map(({ type }) => code `${type.expression}`), { on: "|" })})`;
|
|
469
|
-
case "Typeof":
|
|
470
|
-
// The type.name may include literal values, but they should still be unambiguous with other member types since the typeofs
|
|
471
|
-
// of the different member types are known to be different.
|
|
472
|
-
return code `(${joinCode(this.members.map(({ type }) => code `${type.expression}`), { on: "|" })})`;
|
|
473
|
-
default:
|
|
474
|
-
discriminant;
|
|
475
|
-
throw new Error("should never reach this point");
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
get jsonSchemaExpression() {
|
|
479
|
-
const discriminant = this.discriminant; // To get type narrowing to work
|
|
480
|
-
switch (discriminant.kind) {
|
|
481
|
-
case "Extrinsic":
|
|
482
|
-
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
|
|
483
|
-
case "Hybrid":
|
|
484
|
-
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
485
|
-
switch (discriminant.memberValues[memberI].kind) {
|
|
486
|
-
case "Extrinsic":
|
|
487
|
-
return code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
|
|
488
|
-
case "Intrinsic":
|
|
489
|
-
return type.jsonSchema({
|
|
490
|
-
includeDiscriminantProperty: true,
|
|
491
|
-
context: "type",
|
|
492
|
-
});
|
|
493
|
-
default:
|
|
494
|
-
throw new Error();
|
|
495
|
-
}
|
|
496
|
-
}), { on: "," })}]).readonly()`;
|
|
497
|
-
case "Intrinsic":
|
|
498
|
-
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
|
|
499
|
-
includeDiscriminantProperty: true,
|
|
500
|
-
context: "type",
|
|
501
|
-
})), { on: "," })}]).readonly()`;
|
|
502
|
-
case "Typeof":
|
|
503
|
-
return code `${this.reusables.imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
|
|
504
|
-
default:
|
|
505
|
-
throw discriminant;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
get jsonTypeLiteral() {
|
|
509
|
-
const discriminant = this.discriminant; // To get type narrowing to work
|
|
510
|
-
switch (discriminant.kind) {
|
|
511
|
-
case "Extrinsic":
|
|
512
|
-
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`), { on: "|" })})`);
|
|
513
|
-
case "Hybrid":
|
|
514
|
-
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }, memberI) => {
|
|
515
|
-
switch (discriminant.memberValues[memberI].kind) {
|
|
516
|
-
case "Extrinsic":
|
|
517
|
-
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`;
|
|
518
|
-
case "Intrinsic":
|
|
519
|
-
return code `${jsonType}`;
|
|
520
|
-
default:
|
|
521
|
-
throw new Error();
|
|
522
|
-
}
|
|
523
|
-
}), { on: "|" })})`);
|
|
524
|
-
case "Intrinsic":
|
|
525
|
-
case "Typeof":
|
|
526
|
-
return new AbstractType.JsonType(joinCode(this.members.map(({ jsonType }) => code `${jsonType}`), { on: "|" }));
|
|
527
|
-
default:
|
|
528
|
-
throw discriminant;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
get toJsonFunctionExpression() {
|
|
532
|
-
return code `\
|
|
533
|
-
((value: ${this.expression}): ${this.jsonType().expression} => {
|
|
534
|
-
${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap }) => code `if (${typeCheck(code `value`)}) { return ${wrap(typeToJsonExpression(unwrap(code `value`)))}; }`))}
|
|
535
|
-
|
|
536
|
-
throw new Error("unable to serialize to JSON");
|
|
537
|
-
})`;
|
|
538
|
-
}
|
|
539
|
-
get toRdfResourceValuesFunctionExpression() {
|
|
540
|
-
return code `\
|
|
541
|
-
(((value, _options): (${joinCode([...this.toRdfResourceValueTypes].map((toRdfResourceValueType) => {
|
|
542
|
-
switch (toRdfResourceValueType) {
|
|
543
|
-
case "BlankNode":
|
|
544
|
-
return code `${this.reusables.imports.BlankNode}`;
|
|
545
|
-
case "Literal":
|
|
546
|
-
return code `${this.reusables.imports.Literal}`;
|
|
547
|
-
case "NamedNode":
|
|
548
|
-
return code `${this.reusables.imports.NamedNode}`;
|
|
549
|
-
default:
|
|
550
|
-
toRdfResourceValueType;
|
|
551
|
-
throw new Error();
|
|
552
|
-
}
|
|
553
|
-
}), { on: " | " })})[] => {
|
|
554
|
-
${joinCode(this.members.map(({ type, unwrap, typeCheck }) => code `if (${typeCheck(code `value`)}) { return ${type.toRdfResourceValuesExpression({
|
|
555
|
-
variables: {
|
|
556
|
-
graph: code `_options.graph`,
|
|
557
|
-
propertyPath: code `_options.propertyPath`,
|
|
558
|
-
resource: code `_options.resource`,
|
|
559
|
-
resourceSet: code `_options.resourceSet`,
|
|
560
|
-
value: unwrap(code `value`),
|
|
561
|
-
},
|
|
562
|
-
})}; }`))}
|
|
563
|
-
|
|
564
|
-
throw new Error("unable to serialize to RDF");
|
|
565
|
-
}) satisfies ${this.reusables.snippets.ToRdfResourceValuesFunction}<${this.expression}>)`;
|
|
566
|
-
}
|
|
567
|
-
get toStringFunctionExpression() {
|
|
568
|
-
return code `\
|
|
569
|
-
((value: ${this.expression}): string => {
|
|
570
|
-
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `value`)}) { return ${type.toStringExpression({
|
|
571
|
-
variables: { value: unwrap(code `value`) },
|
|
572
|
-
})}; }`))}
|
|
573
|
-
|
|
574
|
-
throw new Error("unable to serialize to string");
|
|
575
|
-
})`;
|
|
576
|
-
}
|
|
577
|
-
get valueSparqlConstructTriplesFunctionExpression() {
|
|
578
|
-
return code `\
|
|
579
|
-
((({ ignoreRdfType, filter, schema, ...otherParameters }) => {
|
|
580
|
-
let triples: ${this.reusables.imports.sparqljs}.Triple[] = [];
|
|
581
|
-
|
|
582
|
-
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
583
|
-
triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }));`))}
|
|
584
|
-
|
|
585
|
-
return triples;
|
|
586
|
-
}) satisfies ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
587
|
-
}
|
|
588
|
-
get valueSparqlWherePatternsFunctionExpression() {
|
|
589
|
-
return code `\
|
|
590
|
-
((({ filter, schema, ...otherParameters }) => {
|
|
591
|
-
const unionPatterns: ${this.reusables.imports.sparqljs}.GroupPattern[] = [];
|
|
592
|
-
|
|
593
|
-
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
594
|
-
unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }).concat(), type: "group" });`))}
|
|
595
|
-
|
|
596
|
-
return [{ patterns: unionPatterns, type: "union" }];
|
|
597
|
-
}) satisfies ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
598
|
-
}
|
|
599
|
-
fromJsonExpression({ variables, }) {
|
|
600
|
-
return code `${this.name.map((name) => code `${name}.fromJson`).orDefault(this.fromJsonFunctionExpression)}(${variables.value})`;
|
|
601
|
-
}
|
|
602
|
-
graphqlResolveExpression({ variables, }) {
|
|
603
|
-
return variables.value;
|
|
604
|
-
}
|
|
605
|
-
jsonSchema({ context, }) {
|
|
606
|
-
const expression = this.name
|
|
607
|
-
.map((name) => code `${name}.Json.schema()`)
|
|
608
|
-
.orDefault(this.jsonSchemaExpression);
|
|
609
|
-
if (context === "property" && this.recursive) {
|
|
610
|
-
return code `${this.reusables.imports.z}.lazy((): ${this.reusables.imports.z}.ZodType<${this.jsonType().expression}> => ${expression})`;
|
|
611
|
-
}
|
|
612
|
-
return expression;
|
|
613
|
-
}
|
|
614
|
-
jsonType() {
|
|
615
|
-
return this.name
|
|
616
|
-
.map((name) => new AbstractType.JsonType(code `${name}.Json`))
|
|
617
|
-
.orDefault(this.jsonTypeLiteral);
|
|
618
|
-
}
|
|
619
|
-
jsonUiSchemaElement() {
|
|
620
|
-
return Maybe.empty();
|
|
621
|
-
}
|
|
622
|
-
toJsonExpression({ variables, }) {
|
|
623
|
-
return code `${this.name.map((name) => code `${name}.toJson`).orDefault(this.toJsonFunctionExpression)}(${variables.value})`;
|
|
624
|
-
}
|
|
625
|
-
toRdfResourceValuesExpression({ variables, }) {
|
|
626
|
-
const { value: valueVariable, ...otherVariables } = variables;
|
|
627
|
-
return code `${this.name.map((name) => code `${name}.toRdfResourceValues`).orDefault(this.toRdfResourceValuesFunctionExpression)}(${valueVariable}, ${otherVariables})`;
|
|
628
|
-
}
|
|
629
|
-
toStringExpression({ variables, }) {
|
|
630
|
-
return code `${this.name.map((name) => code `${name}.${this.configuration.syntheticNamePrefix}toString`).orDefault(this.toStringFunctionExpression)}(${variables.value})`;
|
|
631
|
-
}
|
|
632
|
-
lazyMembers;
|
|
633
|
-
}
|
|
634
|
-
__decorate([
|
|
635
|
-
Memoize()
|
|
636
|
-
], UnionType.prototype, "conversionFunction", null);
|
|
637
|
-
__decorate([
|
|
638
|
-
Memoize()
|
|
639
|
-
], UnionType.prototype, "declaration", null);
|
|
640
|
-
__decorate([
|
|
641
|
-
Memoize()
|
|
642
|
-
], UnionType.prototype, "discriminantProperty", null);
|
|
643
|
-
__decorate([
|
|
644
|
-
Memoize()
|
|
645
|
-
], UnionType.prototype, "equalsFunction", null);
|
|
646
|
-
__decorate([
|
|
647
|
-
Memoize()
|
|
648
|
-
], UnionType.prototype, "expression", null);
|
|
649
|
-
__decorate([
|
|
650
|
-
Memoize()
|
|
651
|
-
], UnionType.prototype, "filterFunction", null);
|
|
652
|
-
__decorate([
|
|
653
|
-
Memoize()
|
|
654
|
-
], UnionType.prototype, "filterType", null);
|
|
655
|
-
__decorate([
|
|
656
|
-
Memoize()
|
|
657
|
-
], UnionType.prototype, "fromRdfResourceValuesFunction", null);
|
|
658
|
-
__decorate([
|
|
659
|
-
Memoize()
|
|
660
|
-
], UnionType.prototype, "graphqlType", null);
|
|
661
|
-
__decorate([
|
|
662
|
-
Memoize()
|
|
663
|
-
], UnionType.prototype, "hashFunction", null);
|
|
664
|
-
__decorate([
|
|
665
|
-
Memoize()
|
|
666
|
-
], UnionType.prototype, "jsTypes", null);
|
|
667
|
-
__decorate([
|
|
668
|
-
Memoize()
|
|
669
|
-
], UnionType.prototype, "members", null);
|
|
670
|
-
__decorate([
|
|
671
|
-
Memoize()
|
|
672
|
-
], UnionType.prototype, "mutable", null);
|
|
673
|
-
__decorate([
|
|
674
|
-
Memoize()
|
|
675
|
-
], UnionType.prototype, "schema", null);
|
|
676
|
-
__decorate([
|
|
677
|
-
Memoize()
|
|
678
|
-
], UnionType.prototype, "schemaType", null);
|
|
679
|
-
__decorate([
|
|
680
|
-
Memoize()
|
|
681
|
-
], UnionType.prototype, "toRdfResourceValueTypes", null);
|
|
682
|
-
__decorate([
|
|
683
|
-
Memoize()
|
|
684
|
-
], UnionType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
685
|
-
__decorate([
|
|
686
|
-
Memoize()
|
|
687
|
-
], UnionType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
688
|
-
__decorate([
|
|
689
|
-
Memoize()
|
|
690
|
-
], UnionType.prototype, "schemaTypeExpression", null);
|
|
691
|
-
__decorate([
|
|
692
|
-
Memoize()
|
|
693
|
-
], UnionType.prototype, "equalsFunctionExpression", null);
|
|
694
|
-
__decorate([
|
|
695
|
-
Memoize()
|
|
696
|
-
], UnionType.prototype, "filterFunctionExpression", null);
|
|
697
|
-
__decorate([
|
|
698
|
-
Memoize()
|
|
699
|
-
], UnionType.prototype, "filterTypeLiteral", null);
|
|
700
|
-
__decorate([
|
|
701
|
-
Memoize()
|
|
702
|
-
], UnionType.prototype, "inlineExpression", null);
|
|
703
|
-
__decorate([
|
|
704
|
-
Memoize()
|
|
705
|
-
], UnionType.prototype, "jsonTypeLiteral", null);
|
|
706
|
-
__decorate([
|
|
707
|
-
Memoize()
|
|
708
|
-
], UnionType.prototype, "valueSparqlConstructTriplesFunctionExpression", null);
|
|
709
|
-
__decorate([
|
|
710
|
-
Memoize()
|
|
711
|
-
], UnionType.prototype, "valueSparqlWherePatternsFunctionExpression", null);
|
|
712
|
-
__decorate([
|
|
713
|
-
Memoize()
|
|
714
|
-
], UnionType.prototype, "jsonType", null);
|
|
715
|
-
function termTypes(type) {
|
|
716
|
-
switch (type.kind) {
|
|
717
|
-
case "BlankNode":
|
|
718
|
-
case "Iri":
|
|
719
|
-
case "Identifier":
|
|
720
|
-
case "Literal":
|
|
721
|
-
case "Term":
|
|
722
|
-
return type.termTypes;
|
|
723
|
-
default:
|
|
724
|
-
return emptyTermTypesSet;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
const emptyTermTypesSet = new Set();
|
|
728
|
-
export var Discriminant;
|
|
729
|
-
(function (Discriminant) {
|
|
730
|
-
function infer(members) {
|
|
731
|
-
// extrinsic with user-specified values
|
|
732
|
-
if (members.some((member) => member.discriminantValue.isJust())) {
|
|
733
|
-
return {
|
|
734
|
-
jsonName: "type",
|
|
735
|
-
kind: "Extrinsic",
|
|
736
|
-
memberValues: members.map((member, memberI) => member.discriminantValue.orDefault(memberI)),
|
|
737
|
-
name: "type",
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
const memberTypes = members.map((member) => member.type);
|
|
741
|
-
// intrinsic
|
|
742
|
-
{
|
|
743
|
-
let inlineDiscriminantProperty;
|
|
744
|
-
let memberValues = [];
|
|
745
|
-
for (const memberType of memberTypes) {
|
|
746
|
-
const memberTypeDiscriminantProperty = memberType.discriminantProperty.extract();
|
|
747
|
-
if (!memberTypeDiscriminantProperty) {
|
|
748
|
-
inlineDiscriminantProperty = undefined;
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
if (!inlineDiscriminantProperty) {
|
|
752
|
-
inlineDiscriminantProperty = memberTypeDiscriminantProperty;
|
|
753
|
-
}
|
|
754
|
-
else if (memberTypeDiscriminantProperty.name !==
|
|
755
|
-
inlineDiscriminantProperty.name) {
|
|
756
|
-
inlineDiscriminantProperty = undefined;
|
|
757
|
-
break;
|
|
758
|
-
}
|
|
759
|
-
memberValues = memberValues.concat(memberTypeDiscriminantProperty.values);
|
|
760
|
-
}
|
|
761
|
-
if (inlineDiscriminantProperty) {
|
|
762
|
-
return {
|
|
763
|
-
jsonName: inlineDiscriminantProperty.jsonName,
|
|
764
|
-
kind: "Intrinsic",
|
|
765
|
-
memberValues,
|
|
766
|
-
name: inlineDiscriminantProperty.name,
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
// typeof
|
|
771
|
-
{
|
|
772
|
-
const memberTypeofs = [];
|
|
773
|
-
const memberTypeofsSet = new Set();
|
|
774
|
-
for (const memberType of memberTypes) {
|
|
775
|
-
for (const memberJsType of memberType.jsTypes) {
|
|
776
|
-
memberTypeofs.push(memberJsType.typeof);
|
|
777
|
-
memberTypeofsSet.add(memberJsType.typeof);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
if (memberTypeofsSet.size === memberTypes.length) {
|
|
781
|
-
return {
|
|
782
|
-
memberValues: memberTypeofs,
|
|
783
|
-
kind: "Typeof",
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
// hybrid
|
|
788
|
-
// If some member type is an RDF/JS term then reuse "termType" as the discriminant.
|
|
789
|
-
if (memberTypes.some((memberType) => termTypes(memberType).size > 0)) {
|
|
790
|
-
const extrinsicMemberTypeAliasesSet = new Set();
|
|
791
|
-
let extrinsicMemberTypeCount = 0;
|
|
792
|
-
for (const memberType of memberTypes) {
|
|
793
|
-
if (termTypes(memberType).size > 0) {
|
|
794
|
-
continue;
|
|
795
|
-
}
|
|
796
|
-
extrinsicMemberTypeCount++;
|
|
797
|
-
if (memberType.name.isJust()) {
|
|
798
|
-
extrinsicMemberTypeAliasesSet.add(memberType.name.extract());
|
|
799
|
-
}
|
|
800
|
-
else {
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return {
|
|
805
|
-
jsonName: "termType",
|
|
806
|
-
kind: "Hybrid",
|
|
807
|
-
memberValues: memberTypes.map((memberType, memberTypeI) => {
|
|
808
|
-
const memberTermTypes = termTypes(memberType);
|
|
809
|
-
if (memberTermTypes.size > 0) {
|
|
810
|
-
return {
|
|
811
|
-
kind: "Intrinsic",
|
|
812
|
-
values: [...memberTermTypes],
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
return {
|
|
816
|
-
kind: "Extrinsic",
|
|
817
|
-
values: extrinsicMemberTypeAliasesSet.size === extrinsicMemberTypeCount
|
|
818
|
-
? [memberType.name.unsafeCoerce()]
|
|
819
|
-
: [memberTypeI.toString()],
|
|
820
|
-
};
|
|
821
|
-
}),
|
|
822
|
-
name: "termType",
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
// extrinsic with inferred values
|
|
826
|
-
{
|
|
827
|
-
let memberValues;
|
|
828
|
-
{
|
|
829
|
-
const memberTypeNames = memberTypes.map((memberType) => memberType.name.orDefault(memberType.jsTypes[0].typeof));
|
|
830
|
-
const memberTypeNamesSet = new Set(memberTypeNames);
|
|
831
|
-
if (memberTypeNamesSet.size === memberTypeNames.length) {
|
|
832
|
-
memberValues = memberTypeNames;
|
|
833
|
-
}
|
|
834
|
-
else {
|
|
835
|
-
// Otherwise prefix the non-unique strings with an index and use those as the discriminant values.
|
|
836
|
-
memberValues = memberTypeNames.map((memberTypeName, memberTypeI) => `${memberTypeI}-${memberTypeName}`);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
invariant(memberValues.length === memberTypes.length);
|
|
840
|
-
return {
|
|
841
|
-
jsonName: "type",
|
|
842
|
-
kind: "Extrinsic",
|
|
843
|
-
name: "type",
|
|
844
|
-
memberValues,
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
Discriminant.infer = infer;
|
|
849
|
-
})(Discriminant || (Discriminant = {}));
|
|
850
|
-
//# sourceMappingURL=UnionType.js.map
|