@shaclmate/compiler 4.0.50 → 4.0.51
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/Compiler.d.ts +14 -0
- package/dist/Compiler.js +18 -0
- package/dist/Eithers.d.ts +14 -0
- package/dist/Eithers.js +67 -0
- package/dist/ShapesGraphToAstTransformer.d.ts +18 -0
- package/dist/ShapesGraphToAstTransformer.js +50 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.d.ts +15 -0
- package/dist/_ShapesGraphToAstTransformer/ShapeStack.js +51 -0
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +3 -0
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +5 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +4 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +24 -0
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.d.ts +9 -0
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +150 -0
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.d.ts +5 -0
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +26 -0
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.d.ts +17 -0
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.js +285 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +10 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +92 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +149 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.d.ts +7 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.js +171 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.d.ts +12 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +110 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +11 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +46 -0
- package/dist/ast/AbstractCollectionType.d.ts +30 -0
- package/dist/ast/AbstractCollectionType.js +33 -0
- package/dist/ast/AbstractCompoundType.d.ts +45 -0
- package/dist/ast/AbstractCompoundType.js +81 -0
- package/dist/ast/AbstractContainerType.d.ts +44 -0
- package/dist/ast/AbstractContainerType.js +63 -0
- package/dist/ast/AbstractLazyType.d.ts +117 -0
- package/dist/ast/AbstractLazyType.js +40 -0
- package/dist/ast/AbstractTermType.d.ts +33 -0
- package/dist/ast/AbstractTermType.js +47 -0
- package/dist/ast/AbstractType.d.ts +55 -0
- package/dist/ast/AbstractType.js +55 -0
- package/dist/ast/Ast.d.ts +6 -0
- package/dist/ast/Ast.js +2 -0
- package/dist/ast/BlankNodeType.d.ts +11 -0
- package/dist/ast/BlankNodeType.js +17 -0
- package/dist/ast/DefaultValueType.d.ts +35 -0
- package/dist/ast/DefaultValueType.js +50 -0
- package/dist/ast/IdentifierType.d.ts +12 -0
- package/dist/ast/IdentifierType.js +20 -0
- package/dist/ast/IntersectionType.d.ts +14 -0
- package/dist/ast/IntersectionType.js +17 -0
- package/dist/ast/IriType.d.ts +10 -0
- package/dist/ast/IriType.js +10 -0
- 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 +44 -0
- package/dist/ast/ListType.js +56 -0
- package/dist/ast/LiteralType.d.ts +40 -0
- package/dist/ast/LiteralType.js +59 -0
- package/dist/ast/OptionType.d.ts +13 -0
- package/dist/ast/OptionType.js +21 -0
- package/dist/ast/SetType.d.ts +31 -0
- package/dist/ast/SetType.js +42 -0
- package/dist/ast/StructCompoundType.d.ts +12 -0
- package/dist/ast/StructCompoundType.js +87 -0
- package/dist/ast/StructIntersectionType.d.ts +4 -0
- package/dist/ast/StructIntersectionType.js +2 -0
- package/dist/ast/StructType.d.ts +178 -0
- package/dist/ast/StructType.js +314 -0
- package/dist/ast/StructUnionType.d.ts +4 -0
- package/dist/ast/StructUnionType.js +2 -0
- package/dist/ast/TermType.d.ts +14 -0
- package/dist/ast/TermType.js +16 -0
- package/dist/ast/Type.d.ts +20 -0
- package/dist/ast/Type.js +42 -0
- package/dist/ast/UnionType.d.ts +30 -0
- package/dist/ast/UnionType.js +27 -0
- package/dist/ast/equals.d.ts +12 -0
- package/dist/ast/equals.js +65 -0
- package/dist/ast/index.d.ts +21 -0
- package/dist/ast/index.js +21 -0
- package/dist/generators/AstJsonGenerator.d.ts +6 -0
- package/dist/generators/AstJsonGenerator.js +15 -0
- package/dist/generators/Cx2Generator.d.ts +10 -0
- package/dist/generators/Cx2Generator.js +140 -0
- package/dist/generators/Generator.d.ts +5 -0
- package/dist/generators/Generator.js +2 -0
- package/dist/generators/LabeledPropertyGraph.d.ts +42 -0
- package/dist/generators/LabeledPropertyGraph.js +2 -0
- package/dist/generators/index.d.ts +6 -0
- package/dist/generators/index.js +6 -0
- package/dist/generators/transformAstToLabeledPropertyGraph.d.ts +4 -0
- package/dist/generators/transformAstToLabeledPropertyGraph.js +78 -0
- package/dist/generators/ts/AbstractCollectionType.d.ts +37 -0
- package/dist/generators/ts/AbstractCollectionType.js +88 -0
- package/dist/generators/ts/AbstractContainerType.d.ts +53 -0
- package/dist/generators/ts/AbstractContainerType.js +97 -0
- package/dist/generators/ts/AbstractDateType.d.ts +23 -0
- package/dist/generators/ts/AbstractDateType.js +37 -0
- package/dist/generators/ts/AbstractIdentifierType.d.ts +21 -0
- package/dist/generators/ts/AbstractIdentifierType.js +25 -0
- package/dist/generators/ts/AbstractLazyType.d.ts +67 -0
- package/dist/generators/ts/AbstractLazyType.js +154 -0
- package/dist/generators/ts/AbstractLiteralType.d.ts +26 -0
- package/dist/generators/ts/AbstractLiteralType.js +15 -0
- package/dist/generators/ts/AbstractNumericType.d.ts +21 -0
- package/dist/generators/ts/AbstractNumericType.js +65 -0
- package/dist/generators/ts/AbstractObjectSetType.d.ts +36 -0
- package/dist/generators/ts/AbstractObjectSetType.js +44 -0
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +32 -0
- package/dist/generators/ts/AbstractPrimitiveType.js +51 -0
- package/dist/generators/ts/AbstractTermType.d.ts +50 -0
- package/dist/generators/ts/AbstractTermType.js +102 -0
- package/dist/generators/ts/AbstractType.d.ts +345 -0
- package/dist/generators/ts/AbstractType.js +135 -0
- package/dist/generators/ts/BigDecimalType.d.ts +28 -0
- package/dist/generators/ts/BigDecimalType.js +58 -0
- package/dist/generators/ts/BigIntType.d.ts +17 -0
- package/dist/generators/ts/BigIntType.js +56 -0
- package/dist/generators/ts/BlankNodeType.d.ts +22 -0
- package/dist/generators/ts/BlankNodeType.js +67 -0
- package/dist/generators/ts/BooleanType.d.ts +21 -0
- package/dist/generators/ts/BooleanType.js +53 -0
- package/dist/generators/ts/DateTimeType.d.ts +13 -0
- package/dist/generators/ts/DateTimeType.js +31 -0
- package/dist/generators/ts/DateType.d.ts +14 -0
- package/dist/generators/ts/DateType.js +32 -0
- package/dist/generators/ts/DefaultValueType.d.ts +83 -0
- package/dist/generators/ts/DefaultValueType.js +143 -0
- package/dist/generators/ts/FloatType.d.ts +13 -0
- package/dist/generators/ts/FloatType.js +30 -0
- package/dist/generators/ts/GraphqlSchema.d.ts +22 -0
- package/dist/generators/ts/GraphqlSchema.js +87 -0
- package/dist/generators/ts/IdentifierType.d.ts +23 -0
- package/dist/generators/ts/IdentifierType.js +83 -0
- package/dist/generators/ts/Imports.d.ts +40 -0
- package/dist/generators/ts/Imports.js +41 -0
- package/dist/generators/ts/IntType.d.ts +13 -0
- package/dist/generators/ts/IntType.js +30 -0
- package/dist/generators/ts/IriType.d.ts +23 -0
- package/dist/generators/ts/IriType.js +112 -0
- package/dist/generators/ts/LazyOptionType.d.ts +36 -0
- 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 +49 -0
- package/dist/generators/ts/ListType.js +161 -0
- package/dist/generators/ts/LiteralType.d.ts +27 -0
- package/dist/generators/ts/LiteralType.js +71 -0
- package/dist/generators/ts/ObjectSetType.d.ts +6 -0
- package/dist/generators/ts/ObjectSetType.js +36 -0
- package/dist/generators/ts/ObjectType.d.ts +105 -0
- package/dist/generators/ts/ObjectType.js +503 -0
- package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
- package/dist/generators/ts/ObjectUnionType.js +223 -0
- package/dist/generators/ts/OptionType.d.ts +39 -0
- package/dist/generators/ts/OptionType.js +157 -0
- package/dist/generators/ts/RdfjsDatasetObjectSetType.d.ts +6 -0
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +323 -0
- package/dist/generators/ts/Reusables.d.ts +13 -0
- package/dist/generators/ts/Reusables.js +15 -0
- package/dist/generators/ts/SetType.d.ts +32 -0
- package/dist/generators/ts/SetType.js +132 -0
- package/dist/generators/ts/Snippet.d.ts +3 -0
- package/dist/generators/ts/Snippet.js +2 -0
- package/dist/generators/ts/SnippetFactory.d.ts +16 -0
- package/dist/generators/ts/SnippetFactory.js +2 -0
- package/dist/generators/ts/Snippets.d.ts +180 -0
- package/dist/generators/ts/Snippets.js +1184 -0
- package/dist/generators/ts/SparqlObjectSetType.d.ts +6 -0
- package/dist/generators/ts/SparqlObjectSetType.js +241 -0
- package/dist/generators/ts/StringType.d.ts +22 -0
- package/dist/generators/ts/StringType.js +68 -0
- package/dist/generators/ts/TermType.d.ts +31 -0
- package/dist/generators/ts/TermType.js +143 -0
- package/dist/generators/ts/TsFeature.d.ts +3 -0
- package/dist/generators/ts/TsFeature.js +28 -0
- package/dist/generators/ts/TsGenerator.d.ts +30 -0
- package/dist/generators/ts/TsGenerator.js +292 -0
- package/dist/generators/ts/Type.d.ts +25 -0
- package/dist/generators/ts/Type.js +2 -0
- package/dist/generators/ts/TypeFactory.d.ts +43 -0
- package/dist/generators/ts/TypeFactory.js +540 -0
- package/dist/generators/ts/Typeof.d.ts +2 -0
- package/dist/generators/ts/Typeof.js +2 -0
- package/dist/generators/ts/UnionType.d.ts +126 -0
- package/dist/generators/ts/UnionType.js +850 -0
- package/dist/generators/ts/ZodGenerator.d.ts +11 -0
- package/dist/generators/ts/ZodGenerator.js +60 -0
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +217 -0
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +37 -0
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +45 -0
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +104 -0
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +43 -0
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +205 -0
- 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 +19 -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_filterTypeExpression.js +20 -0
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionExpression.js +46 -0
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionExpression.js +79 -0
- 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 +38 -0
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.js +26 -0
- 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.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js +10 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.js +22 -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 +11 -0
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.js +23 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +21 -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 +10 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +35 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +10 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +8 -0
- 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_toRdfResourceFunctionExpression.js +33 -0
- 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_valueSparqlConstructTriplesFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js +8 -0
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js +10 -0
- package/dist/generators/ts/_ObjectType/Property.d.ts +6 -0
- package/dist/generators/ts/_ObjectType/Property.js +2 -0
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +53 -0
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +284 -0
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.js +5 -0
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.js +6 -0
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.js +6 -0
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.js +7 -0
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_DateFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_DateFilter.js +10 -0
- package/dist/generators/ts/_snippets/snippets_DateSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_DateSchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_EqualsFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_EqualsFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_EqualsResult.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_EqualsResult.js +63 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +10 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +11 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_HashFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_HashFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_Hasher.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_Hasher.js +3 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.js +7 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +7 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.js +27 -0
- package/dist/generators/ts/_snippets/snippets_IriFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_IriFilter.js +6 -0
- package/dist/generators/ts/_snippets/snippets_IriSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +8 -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.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +4 -0
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +9 -0
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.js +4 -0
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +7 -0
- package/dist/generators/ts/_snippets/snippets_NumericFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_NumericFilter.js +10 -0
- package/dist/generators/ts/_snippets/snippets_NumericSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_NumericSchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +6 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +46 -0
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +40 -0
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +8 -0
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.js +3 -0
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.js +3 -0
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.js +30 -0
- package/dist/generators/ts/_snippets/snippets_StringFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_StringFilter.js +8 -0
- package/dist/generators/ts/_snippets/snippets_StringSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +9 -0
- package/dist/generators/ts/_snippets/snippets_TermFilter.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_TermFilter.js +9 -0
- package/dist/generators/ts/_snippets/snippets_TermSchema.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_TermSchema.js +9 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +11 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_UnwrapR.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_UnwrapR.js +4 -0
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +11 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.js +12 -0
- package/dist/generators/ts/_snippets/snippets_arrayEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_arrayEquals.js +68 -0
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.js +29 -0
- 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_bigDecimalLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.js +9 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +83 -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_blankNodeSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +5 -0
- package/dist/generators/ts/_snippets/snippets_booleanEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +16 -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_booleanSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +15 -0
- package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_compactRecord.js +15 -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_convertToBlankNode.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +11 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.js +17 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +13 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +21 -0
- package/dist/generators/ts/_snippets/snippets_convertToIri.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +11 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +17 -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_convertToLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +13 -0
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +19 -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_convertWithDefaultValue.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +11 -0
- package/dist/generators/ts/_snippets/snippets_dateEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateEquals.js +13 -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_dateSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +71 -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_decodeBigDecimalLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.js +9 -0
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.js +19 -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.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +9 -0
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +16 -0
- package/dist/generators/ts/_snippets/snippets_filterArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterArray.js +22 -0
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.js +26 -0
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.js +6 -0
- package/dist/generators/ts/_snippets/snippets_filterBoolean.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterBoolean.js +10 -0
- package/dist/generators/ts/_snippets/snippets_filterDate.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterDate.js +26 -0
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.js +14 -0
- package/dist/generators/ts/_snippets/snippets_filterIri.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterIri.js +10 -0
- package/dist/generators/ts/_snippets/snippets_filterLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterLiteral.js +6 -0
- package/dist/generators/ts/_snippets/snippets_filterMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterMaybe.js +22 -0
- package/dist/generators/ts/_snippets/snippets_filterNumeric.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterNumeric.js +26 -0
- package/dist/generators/ts/_snippets/snippets_filterString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterString.js +18 -0
- package/dist/generators/ts/_snippets/snippets_filterTerm.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_filterTerm.js +22 -0
- 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_hashArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashArray.js +11 -0
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashBoolean.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashBoolean.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashDate.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashDate.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashDateTime.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashDateTime.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashMaybe.js +11 -0
- package/dist/generators/ts/_snippets/snippets_hashNumeric.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashNumeric.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashString.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashTerm.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashTerm.js +12 -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_identifierSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +30 -0
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.js +6 -0
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.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_iriSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +13 -0
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.js +15 -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_listSparqlConstructTriples.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +37 -0
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +116 -0
- package/dist/generators/ts/_snippets/snippets_literalFactory.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_literalFactory.js +3 -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_literalSchemaSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.js +39 -0
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +5 -0
- package/dist/generators/ts/_snippets/snippets_maybeEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_maybeEquals.js +31 -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_maybeSparqlConstructTriples.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +6 -0
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +21 -0
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.js +16 -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_normalizeSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.js +92 -0
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +62 -0
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +9 -0
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +4 -0
- package/dist/generators/ts/_snippets/snippets_parseIri.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_parseIri.js +9 -0
- package/dist/generators/ts/_snippets/snippets_propertyEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_propertyEquals.js +11 -0
- package/dist/generators/ts/_snippets/snippets_rdfResourceIdentifierValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_rdfResourceIdentifierValues.js +12 -0
- package/dist/generators/ts/_snippets/snippets_sequenceRecord.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_sequenceRecord.js +18 -0
- 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_setSparqlConstructTriples.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +6 -0
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +17 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +17 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +90 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +86 -0
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.js +24 -0
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.js +29 -0
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +59 -0
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.js +23 -0
- package/dist/generators/ts/_snippets/snippets_strictEquals.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_strictEquals.js +12 -0
- 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_stringSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +39 -0
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +93 -0
- 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_termSchemaSparqlPatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.js +24 -0
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +5 -0
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.js +6 -0
- package/dist/generators/ts/_snippets/snippets_validateArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_validateArray.js +13 -0
- package/dist/generators/ts/_snippets/snippets_validateMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +7 -0
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +9 -0
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.js +14 -0
- package/dist/generators/ts/codeEquals.d.ts +3 -0
- package/dist/generators/ts/codeEquals.js +7 -0
- package/dist/generators/ts/rdfjsTermExpression.d.ts +11 -0
- package/dist/generators/ts/rdfjsTermExpression.js +72 -0
- package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
- package/dist/generators/ts/singleEntryRecord.js +6 -0
- package/dist/generators/ts/ts-poet-wrapper.d.ts +5 -0
- package/dist/generators/ts/ts-poet-wrapper.js +13 -0
- package/dist/generators/ts/tsComment.d.ts +5 -0
- package/dist/generators/ts/tsComment.js +11 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/input/ShapesGraph.d.ts +44 -0
- package/dist/input/ShapesGraph.js +66 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.js +3 -0
- package/dist/input/input.shaclmate.d.ts +4567 -0
- package/dist/input/input.shaclmate.js +3595 -0
- package/package.json +600 -600
|
@@ -0,0 +1,850 @@
|
|
|
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
|