@shaclmate/compiler 4.0.8 → 4.0.10
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 +1 -4
- package/dist/Compiler.js +1 -5
- package/dist/ShapesGraphToAstTransformer.d.ts +2 -11
- package/dist/ShapesGraphToAstTransformer.js +25 -27
- 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 +27 -0
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +74 -19
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +45 -91
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +146 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +7 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +182 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +9 -7
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +3 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +33 -10
- package/dist/ast/AbstractCompoundType.d.ts +26 -8
- package/dist/ast/AbstractCompoundType.js +84 -16
- package/dist/ast/AbstractContainerType.d.ts +2 -4
- package/dist/ast/AbstractContainerType.js +3 -4
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -0
- package/dist/ast/AbstractLazyObjectType.js +3 -0
- package/dist/ast/AbstractTermType.d.ts +1 -0
- package/dist/ast/AbstractTermType.js +1 -0
- package/dist/ast/AbstractType.d.ts +16 -1
- package/dist/ast/AbstractType.js +11 -1
- package/dist/ast/Ast.d.ts +5 -5
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -2
- package/dist/ast/DefaultValueType.js +2 -0
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IntersectionType.d.ts +7 -2
- package/dist/ast/IntersectionType.js +8 -0
- package/dist/ast/ListType.d.ts +2 -9
- package/dist/ast/ListType.js +1 -9
- package/dist/ast/LiteralType.d.ts +1 -0
- package/dist/ast/LiteralType.js +26 -0
- package/dist/ast/ObjectCompoundType.d.ts +12 -0
- package/dist/ast/ObjectCompoundType.js +88 -0
- package/dist/ast/ObjectIntersectionType.d.ts +3 -7
- package/dist/ast/ObjectIntersectionType.js +1 -7
- package/dist/ast/ObjectType.d.ts +14 -31
- package/dist/ast/ObjectType.js +41 -73
- package/dist/ast/ObjectUnionType.d.ts +3 -7
- package/dist/ast/ObjectUnionType.js +1 -7
- package/dist/ast/OptionType.d.ts +1 -2
- package/dist/ast/OptionType.js +2 -0
- package/dist/ast/SetType.d.ts +1 -2
- package/dist/ast/SetType.js +2 -0
- package/dist/ast/Type.d.ts +1 -4
- package/dist/ast/Type.js +0 -6
- package/dist/ast/UnionType.d.ts +11 -6
- package/dist/ast/UnionType.js +6 -4
- package/dist/ast/index.d.ts +1 -2
- package/dist/ast/index.js +1 -2
- package/dist/generators/json/AstJsonGenerator.js +17 -15
- package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
- package/dist/generators/ts/AbstractCollectionType.js +10 -12
- package/dist/generators/ts/AbstractContainerType.d.ts +9 -4
- package/dist/generators/ts/AbstractContainerType.js +10 -3
- package/dist/generators/ts/AbstractDateType.d.ts +2 -2
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractIdentifierType.js +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +13 -10
- package/dist/generators/ts/AbstractLazyObjectType.js +21 -16
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +33 -0
- package/dist/generators/ts/AbstractNamedUnionType.js +195 -0
- package/dist/generators/ts/AbstractNumericType.d.ts +3 -3
- package/dist/generators/ts/AbstractNumericType.js +4 -4
- package/dist/generators/ts/AbstractTermType.d.ts +7 -4
- package/dist/generators/ts/AbstractTermType.js +7 -4
- package/dist/generators/ts/AbstractType.d.ts +34 -19
- package/dist/generators/ts/AbstractUnionType.d.ts +80 -0
- package/dist/generators/ts/AbstractUnionType.js +514 -0
- package/dist/generators/ts/AnonymousUnionType.d.ts +26 -0
- package/dist/generators/ts/AnonymousUnionType.js +56 -0
- package/dist/generators/ts/BigDecimalType.d.ts +4 -4
- package/dist/generators/ts/BigDecimalType.js +5 -5
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +2 -2
- package/dist/generators/ts/BlankNodeType.js +2 -2
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +3 -3
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +5 -5
- package/dist/generators/ts/DefaultValueType.js +17 -16
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +2 -2
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +2 -2
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +10 -10
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +8 -8
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +9 -10
- package/dist/generators/ts/ListType.d.ts +9 -8
- package/dist/generators/ts/ListType.js +15 -14
- package/dist/generators/ts/LiteralType.d.ts +2 -2
- package/dist/generators/ts/LiteralType.js +3 -3
- package/dist/generators/ts/NamedObjectType.d.ts +126 -0
- package/dist/generators/ts/NamedObjectType.js +420 -0
- package/dist/generators/ts/NamedObjectUnionType.d.ts +35 -0
- package/dist/generators/ts/NamedObjectUnionType.js +217 -0
- package/dist/generators/ts/NamedUnionType.d.ts +11 -0
- package/dist/generators/ts/NamedUnionType.js +13 -0
- package/dist/generators/ts/OptionType.d.ts +5 -5
- package/dist/generators/ts/OptionType.js +12 -12
- package/dist/generators/ts/SetType.d.ts +4 -4
- package/dist/generators/ts/SetType.js +13 -11
- package/dist/generators/ts/StringType.d.ts +3 -3
- package/dist/generators/ts/StringType.js +3 -3
- package/dist/generators/ts/TermType.d.ts +2 -2
- package/dist/generators/ts/TermType.js +3 -3
- package/dist/generators/ts/TsGenerator.js +28 -20
- package/dist/generators/ts/Type.d.ts +5 -4
- package/dist/generators/ts/TypeFactory.d.ts +9 -7
- package/dist/generators/ts/TypeFactory.js +139 -112
- package/dist/generators/ts/ZodGenerator.js +18 -16
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.d.ts +9 -9
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.d.ts → _NamedObjectType/DiscriminantProperty.d.ts} +14 -14
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.js → _NamedObjectType/DiscriminantProperty.js} +22 -20
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.js +6 -6
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.js +31 -28
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_classDeclaration.js → _NamedObjectType/NamedObjectType_classDeclaration.js} +15 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_createFunctionDeclaration.js → _NamedObjectType/NamedObjectType_createFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterFunctionDeclaration.js → _NamedObjectType/NamedObjectType_filterFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterTypeDeclaration.js → _NamedObjectType/NamedObjectType_filterTypeDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +6 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.js → _NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js} +6 -7
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfTypeVariableStatement.js → _NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_graphqlTypeVariableStatement.js → _NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js → _NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_interfaceDeclaration.js → _NamedObjectType/NamedObjectType_interfaceDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_isTypeFunctionDeclaration.js → _NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +19 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonTypeAliasDeclaration.js → _NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_objectSetMethodNames.js → _NamedObjectType/NamedObjectType_objectSetMethodNames.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +38 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +16 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_schemaVariableStatement.js → _NamedObjectType/NamedObjectType_schemaVariableStatement.js} +3 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +10 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +13 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +15 -0
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.d.ts +2 -2
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.js +14 -14
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +12 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +14 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +17 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +5 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +35 -0
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +7 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +1 -1
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +2 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +4 -3
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -2
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +4 -4
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +25 -25
- package/dist/generators/ts/imports.d.ts +1 -1
- package/dist/generators/ts/imports.js +1 -1
- package/dist/generators/ts/objectSetDeclarations.d.ts +5 -5
- package/dist/generators/ts/objectSetDeclarations.js +34 -31
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +5 -5
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +6 -4
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +4 -4
- package/dist/generators/ts/objectSetMethodSignatures.js +9 -9
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +54 -53
- package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
- package/dist/generators/ts/singleEntryRecord.js +6 -0
- package/dist/generators/ts/snippets.d.ts +10 -6
- package/dist/generators/ts/snippets.js +20 -12
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +19 -20
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +4 -4
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +14 -9
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +5 -5
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +2 -2
- package/dist/input/NodeShape.d.ts +0 -1
- package/dist/input/NodeShape.js +0 -3
- package/dist/input/ShapesGraph.d.ts +3 -2
- package/dist/input/ShapesGraph.js +12 -7
- package/dist/input/generated.d.ts +1899 -88
- package/dist/input/generated.js +676 -564
- package/package.json +5 -7
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
- package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
- package/dist/ast/AbstractObjectCompoundType.js +0 -180
- package/dist/ast/Curie.d.ts +0 -21
- package/dist/ast/Curie.js +0 -29
- package/dist/ast/PlaceholderType.d.ts +0 -15
- package/dist/ast/PlaceholderType.js +0 -19
- package/dist/generators/codeName.d.ts +0 -6
- package/dist/generators/codeName.js +0 -66
- package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
- package/dist/generators/ts/AbstractDeclaredType.js +0 -17
- package/dist/generators/ts/ObjectType.d.ts +0 -117
- package/dist/generators/ts/ObjectType.js +0 -402
- package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
- package/dist/generators/ts/ObjectUnionType.js +0 -257
- package/dist/generators/ts/UnionType.d.ts +0 -40
- package/dist/generators/ts/UnionType.js +0 -527
- package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
- package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/identifierTypeDeclarations.js +0 -0
|
@@ -1,527 +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, NonEmptyList } from "purify-ts";
|
|
8
|
-
import { invariant } from "ts-invariant";
|
|
9
|
-
import { Memoize } from "typescript-memoize";
|
|
10
|
-
import { AbstractType } from "./AbstractType.js";
|
|
11
|
-
import { codeEquals } from "./codeEquals.js";
|
|
12
|
-
import { imports } from "./imports.js";
|
|
13
|
-
import { snippets } from "./snippets.js";
|
|
14
|
-
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
15
|
-
class MemberType {
|
|
16
|
-
delegate;
|
|
17
|
-
delegateIndex;
|
|
18
|
-
discriminant;
|
|
19
|
-
universe;
|
|
20
|
-
constructor({ delegate, delegateIndex, discriminant, universe, }) {
|
|
21
|
-
this.delegate = delegate;
|
|
22
|
-
this.delegateIndex = delegateIndex;
|
|
23
|
-
this.discriminant = discriminant;
|
|
24
|
-
this.universe = universe;
|
|
25
|
-
}
|
|
26
|
-
get discriminantValues() {
|
|
27
|
-
switch (this.discriminant.kind) {
|
|
28
|
-
case "envelope":
|
|
29
|
-
return [this.discriminant.ownValues[this.delegateIndex]];
|
|
30
|
-
case "inline": {
|
|
31
|
-
// A member type's combined discriminant property values are its "own" values plus any descendant values that are
|
|
32
|
-
// not the "own" values of some other member type.
|
|
33
|
-
// So if you have type A, type B, and B inherits A, then
|
|
34
|
-
// A has
|
|
35
|
-
// own discriminant property values: ["A"]
|
|
36
|
-
// descendant discriminant property values: ["B"]
|
|
37
|
-
// and B has
|
|
38
|
-
// own discriminant property values: ["B"]
|
|
39
|
-
// descendant discriminant property values ["B"]
|
|
40
|
-
// In this case A shouldn't have "B" as a combined discriminant property value since it's "claimed" by B.
|
|
41
|
-
const memberOwnDiscriminantPropertyValues = new Set();
|
|
42
|
-
for (const memberType of this.universe) {
|
|
43
|
-
for (const ownDiscriminantPropertyValue of memberType.discriminantProperty.unsafeCoerce()
|
|
44
|
-
.ownValues) {
|
|
45
|
-
memberOwnDiscriminantPropertyValues.add(ownDiscriminantPropertyValue);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return this.delegate.discriminantProperty
|
|
49
|
-
.unsafeCoerce()
|
|
50
|
-
.ownValues.concat(this.delegate.discriminantProperty
|
|
51
|
-
.unsafeCoerce()
|
|
52
|
-
.descendantValues.filter((value) => !memberOwnDiscriminantPropertyValues.has(value)));
|
|
53
|
-
}
|
|
54
|
-
case "typeof":
|
|
55
|
-
return this.delegate.typeofs;
|
|
56
|
-
default:
|
|
57
|
-
throw this.discriminant;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
get equalsFunction() {
|
|
61
|
-
return this.delegate.equalsFunction;
|
|
62
|
-
}
|
|
63
|
-
get filterFunction() {
|
|
64
|
-
return this.delegate.filterFunction;
|
|
65
|
-
}
|
|
66
|
-
get filterType() {
|
|
67
|
-
return this.delegate.filterType;
|
|
68
|
-
}
|
|
69
|
-
get mutable() {
|
|
70
|
-
return this.delegate.mutable;
|
|
71
|
-
}
|
|
72
|
-
get name() {
|
|
73
|
-
return this.delegate.name;
|
|
74
|
-
}
|
|
75
|
-
get schema() {
|
|
76
|
-
return this.delegate.schema;
|
|
77
|
-
}
|
|
78
|
-
get schemaType() {
|
|
79
|
-
return this.delegate.schemaType;
|
|
80
|
-
}
|
|
81
|
-
get sparqlConstructTriplesFunction() {
|
|
82
|
-
return this.delegate.sparqlConstructTriplesFunction;
|
|
83
|
-
}
|
|
84
|
-
get sparqlWherePatternsFunction() {
|
|
85
|
-
return this.delegate.sparqlWherePatternsFunction;
|
|
86
|
-
}
|
|
87
|
-
get typeofs() {
|
|
88
|
-
return this.delegate.typeofs;
|
|
89
|
-
}
|
|
90
|
-
fromJsonExpression(parameters) {
|
|
91
|
-
return this.delegate.fromJsonExpression(parameters);
|
|
92
|
-
}
|
|
93
|
-
fromRdfExpression(parameters) {
|
|
94
|
-
return this.delegate.fromRdfExpression(parameters);
|
|
95
|
-
}
|
|
96
|
-
hashStatements(parameters) {
|
|
97
|
-
return this.delegate.hashStatements(parameters);
|
|
98
|
-
}
|
|
99
|
-
jsonType(parameters) {
|
|
100
|
-
return this.delegate.jsonType(parameters);
|
|
101
|
-
}
|
|
102
|
-
jsonZodSchema(parameters) {
|
|
103
|
-
return this.delegate.jsonZodSchema(parameters);
|
|
104
|
-
}
|
|
105
|
-
payload(instance) {
|
|
106
|
-
switch (this.discriminant.kind) {
|
|
107
|
-
case "envelope":
|
|
108
|
-
return code `${instance}.value`;
|
|
109
|
-
case "inline":
|
|
110
|
-
case "typeof":
|
|
111
|
-
return instance;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
toJsonExpression(parameters) {
|
|
115
|
-
return this.delegate.toJsonExpression(parameters);
|
|
116
|
-
}
|
|
117
|
-
toRdfExpression(parameters) {
|
|
118
|
-
return this.delegate.toRdfExpression(parameters);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
__decorate([
|
|
122
|
-
Memoize()
|
|
123
|
-
], MemberType.prototype, "discriminantValues", null);
|
|
124
|
-
export class UnionType extends AbstractType {
|
|
125
|
-
discriminant;
|
|
126
|
-
memberTypes;
|
|
127
|
-
#name;
|
|
128
|
-
graphqlArgs = Maybe.empty();
|
|
129
|
-
kind = "UnionType";
|
|
130
|
-
constructor({ memberDiscriminantValues, memberTypes, ...superParameters }) {
|
|
131
|
-
super(superParameters);
|
|
132
|
-
invariant(memberTypes.length >= 2);
|
|
133
|
-
invariant(memberDiscriminantValues.length === 0 ||
|
|
134
|
-
memberDiscriminantValues.length === memberTypes.length);
|
|
135
|
-
let discriminant;
|
|
136
|
-
if (memberDiscriminantValues.length === 0) {
|
|
137
|
-
// Infer the discriminant kind
|
|
138
|
-
const inlineDiscriminantProperty_ = inlineDiscriminantProperty(memberTypes);
|
|
139
|
-
if (inlineDiscriminantProperty_) {
|
|
140
|
-
discriminant = {
|
|
141
|
-
...inlineDiscriminantProperty_,
|
|
142
|
-
kind: "inline",
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
const memberTypeofs = new Set();
|
|
147
|
-
for (const memberType of memberTypes) {
|
|
148
|
-
for (const typeof_ of memberType.typeofs) {
|
|
149
|
-
memberTypeofs.add(typeof_);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (memberTypeofs.size === memberTypes.length) {
|
|
153
|
-
discriminant = {
|
|
154
|
-
kind: "typeof",
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (!discriminant) {
|
|
160
|
-
discriminant = {
|
|
161
|
-
descendantValues: [],
|
|
162
|
-
kind: "envelope",
|
|
163
|
-
name: "type",
|
|
164
|
-
ownValues: memberDiscriminantValues.length > 0
|
|
165
|
-
? memberDiscriminantValues
|
|
166
|
-
: memberTypes.map((memberType, memberTypeIndex) => `${memberTypeIndex}-${memberType.name}`),
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
this.discriminant = discriminant;
|
|
170
|
-
this.memberTypes = memberTypes.map((memberType, memberTypeIndex) => new MemberType({
|
|
171
|
-
delegate: memberType,
|
|
172
|
-
delegateIndex: memberTypeIndex,
|
|
173
|
-
discriminant: this.discriminant,
|
|
174
|
-
universe: memberTypes,
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
get conversions() {
|
|
178
|
-
switch (this.discriminant.kind) {
|
|
179
|
-
case "envelope":
|
|
180
|
-
case "inline":
|
|
181
|
-
return [
|
|
182
|
-
{
|
|
183
|
-
conversionExpression: (value) => value,
|
|
184
|
-
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
|
|
185
|
-
sourceTypeName: this.name,
|
|
186
|
-
sourceTypeof: "object",
|
|
187
|
-
},
|
|
188
|
-
];
|
|
189
|
-
case "typeof":
|
|
190
|
-
return this.memberTypes.map((memberType) => ({
|
|
191
|
-
conversionExpression: (value) => value,
|
|
192
|
-
sourceTypeCheckExpression: (value) => code `typeof ${value} === "${memberType.discriminantValues[0]}"`,
|
|
193
|
-
sourceTypeName: memberType.name,
|
|
194
|
-
sourceTypeof: memberType.discriminantValues[0],
|
|
195
|
-
}));
|
|
196
|
-
default:
|
|
197
|
-
throw this.discriminant;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
get discriminantProperty() {
|
|
201
|
-
switch (this.discriminant.kind) {
|
|
202
|
-
case "envelope":
|
|
203
|
-
case "inline":
|
|
204
|
-
return Maybe.of(this.discriminant);
|
|
205
|
-
case "typeof":
|
|
206
|
-
return Maybe.empty();
|
|
207
|
-
default:
|
|
208
|
-
throw this.discriminant;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
get equalsFunction() {
|
|
212
|
-
return code `\
|
|
213
|
-
((left: ${this.name}, right: ${this.name}) => {
|
|
214
|
-
${joinCode(this.memberTypes.flatMap((memberType) => memberType.discriminantValues.map((value) => code `if (${this.discriminantVariable(code `left`)} === "${value}" && ${this.discriminantVariable(code `right`)} === "${value}") {
|
|
215
|
-
return ${memberType.equalsFunction}(${memberType.payload(code `left`)}, ${memberType.payload(code `right`)});
|
|
216
|
-
}`)))}
|
|
217
|
-
|
|
218
|
-
return ${imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
|
|
219
|
-
})`;
|
|
220
|
-
}
|
|
221
|
-
get filterFunction() {
|
|
222
|
-
return code `\
|
|
223
|
-
((filter: ${this.filterType}, value: ${this.name}) => {
|
|
224
|
-
${joinCode(this.memberTypes.map((memberType) => code `\
|
|
225
|
-
if (filter.on?.["${memberType.discriminantValues[0]}"] !== undefined) {
|
|
226
|
-
switch (${this.discriminantVariable(code `value`)}) {
|
|
227
|
-
${memberType.discriminantValues.map((discriminantValue) => `case "${discriminantValue}":`)}
|
|
228
|
-
if (!${memberType.filterFunction}(filter.on["${memberType.discriminantValues[0]}"], ${memberType.payload(code `value`)})) {
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}`))}
|
|
234
|
-
|
|
235
|
-
return true;
|
|
236
|
-
})`;
|
|
237
|
-
}
|
|
238
|
-
get filterType() {
|
|
239
|
-
return code `{ readonly on?: { ${joinCode(this.memberTypes.map((memberType) => code `readonly "${memberType.discriminantValues[0]}"?: ${memberType.filterType}`), { on: ";" })} } }`;
|
|
240
|
-
}
|
|
241
|
-
get graphqlType() {
|
|
242
|
-
throw new Error("GraphQL doesn't support scalar unions");
|
|
243
|
-
}
|
|
244
|
-
get mutable() {
|
|
245
|
-
return this.memberTypes.some((memberType) => memberType.mutable);
|
|
246
|
-
}
|
|
247
|
-
get name() {
|
|
248
|
-
if (this.#name === undefined) {
|
|
249
|
-
switch (this.discriminant.kind) {
|
|
250
|
-
case "envelope":
|
|
251
|
-
this.#name = code `(${joinCode(this.memberTypes.map((memberType) => code `{ ${this.discriminant.name}: ${literalOf(memberType.discriminantValues[0])}, value: ${memberType.name} }`), { on: "|" })})`;
|
|
252
|
-
break;
|
|
253
|
-
case "inline":
|
|
254
|
-
// If every type shares a discriminant (e.g., RDF/JS "termType" or generated ObjectType "type"),
|
|
255
|
-
// just join their names with "|"
|
|
256
|
-
this.#name = code `(${joinCode(this.memberTypes.map((memberType) => code `${memberType.name}`), { on: "|" })})`;
|
|
257
|
-
break;
|
|
258
|
-
case "typeof":
|
|
259
|
-
// The memberType.name may include literal values, but they should still be unambiguous with other member types since the typeofs
|
|
260
|
-
// of the different member types are known to be different.
|
|
261
|
-
this.#name = code `(${joinCode(this.memberTypes.map((memberType) => code `${memberType.name}`), { on: "|" })})`;
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return this.#name;
|
|
266
|
-
}
|
|
267
|
-
get schema() {
|
|
268
|
-
return code `${{
|
|
269
|
-
// discriminant: {
|
|
270
|
-
// kind: `${JSON.stringify(this.discriminant.kind)} as const`,
|
|
271
|
-
// },
|
|
272
|
-
kind: code `${literalOf("Union")} as const`,
|
|
273
|
-
members: code `{ ${joinCode(this.memberTypes.map((memberType) => code `"${memberType.discriminantValues[0]}": ${{
|
|
274
|
-
discriminantValues: memberType.discriminantValues,
|
|
275
|
-
type: memberType.schema,
|
|
276
|
-
}}`), { on: "," })} }`,
|
|
277
|
-
}}`;
|
|
278
|
-
}
|
|
279
|
-
get schemaType() {
|
|
280
|
-
return code `${{
|
|
281
|
-
// discriminant: {
|
|
282
|
-
// kind: '"envelope" | "inline" | "typeof"',
|
|
283
|
-
// },
|
|
284
|
-
kind: literalOf("Union"),
|
|
285
|
-
members: code `{ ${joinCode(this.memberTypes.map((memberType) => code `readonly "${memberType.discriminantValues[0]}": ${{
|
|
286
|
-
discriminantValues: code `readonly string[]`,
|
|
287
|
-
type: memberType.schemaType,
|
|
288
|
-
}}`), { on: ";" })} }`,
|
|
289
|
-
}}`;
|
|
290
|
-
}
|
|
291
|
-
get sparqlConstructTriplesFunction() {
|
|
292
|
-
return code `\
|
|
293
|
-
(({ ignoreRdfType, filter, schema, ...otherParameters }: ${snippets.SparqlConstructTriplesFunctionParameters}<${this.filterType}, ${this.schemaType}>) => {
|
|
294
|
-
let triples: ${imports.sparqljs}.Triple[] = [];
|
|
295
|
-
|
|
296
|
-
${joinCode(this.memberTypes.map((memberType) => code `\
|
|
297
|
-
triples = triples.concat(${memberType.sparqlConstructTriplesFunction}({ ...otherParameters, filter: filter?.on?.["${memberType.discriminantValues[0]}"], ignoreRdfType: false, schema: schema.members["${memberType.discriminantValues[0]}"].type }));`))}
|
|
298
|
-
|
|
299
|
-
return triples;
|
|
300
|
-
})`;
|
|
301
|
-
}
|
|
302
|
-
get sparqlWherePatternsFunction() {
|
|
303
|
-
return code `\
|
|
304
|
-
(({ filter, schema, ...otherParameters }: ${snippets.SparqlWherePatternsFunctionParameters}<${this.filterType}, ${this.schemaType}>) => {
|
|
305
|
-
const unionPatterns: ${imports.sparqljs}.GroupPattern[] = [];
|
|
306
|
-
|
|
307
|
-
${joinCode(this.memberTypes.map((memberType) => code `\
|
|
308
|
-
unionPatterns.push({ patterns: ${memberType.sparqlWherePatternsFunction}({ ...otherParameters, filter: filter?.on?.["${memberType.discriminantValues[0]}"], ignoreRdfType: false, schema: schema.members["${memberType.discriminantValues[0]}"].type }).concat(), type: "group" });`))}
|
|
309
|
-
|
|
310
|
-
return [{ patterns: unionPatterns, type: "union" }];
|
|
311
|
-
})`;
|
|
312
|
-
}
|
|
313
|
-
get typeofs() {
|
|
314
|
-
return NonEmptyList.fromArray(this.memberTypes.flatMap((memberType) => memberType.typeofs)).unsafeCoerce();
|
|
315
|
-
}
|
|
316
|
-
fromJsonExpression({ variables, }) {
|
|
317
|
-
return this.ternaryExpression({
|
|
318
|
-
memberTypeExpression: (memberType) => {
|
|
319
|
-
let typeExpression = memberType.fromJsonExpression({
|
|
320
|
-
variables: {
|
|
321
|
-
value: memberType.payload(variables.value),
|
|
322
|
-
},
|
|
323
|
-
});
|
|
324
|
-
if (this.discriminant.kind === "envelope") {
|
|
325
|
-
typeExpression = code `{ ${this.discriminant.name}: "${memberType.discriminantValues[0]}" as const, value: ${typeExpression} }`;
|
|
326
|
-
}
|
|
327
|
-
return typeExpression;
|
|
328
|
-
},
|
|
329
|
-
variables,
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
fromRdfExpression({ variables, }) {
|
|
333
|
-
return code `${variables.resourceValues}.chain(values => values.chainMap(value => {
|
|
334
|
-
const valueAsValues = ${imports.Right}(value.toValues());
|
|
335
|
-
return ${this.memberTypes.reduce((expression, memberType) => {
|
|
336
|
-
let typeExpression = memberType.fromRdfExpression({
|
|
337
|
-
variables: {
|
|
338
|
-
...variables,
|
|
339
|
-
ignoreRdfType: false,
|
|
340
|
-
resourceValues: code `valueAsValues`,
|
|
341
|
-
},
|
|
342
|
-
});
|
|
343
|
-
if (this.discriminant.kind === "envelope") {
|
|
344
|
-
typeExpression = code `${typeExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: "${memberType.discriminantValues[0]}" as const, value }) as (${this.name})))`;
|
|
345
|
-
}
|
|
346
|
-
typeExpression = code `(${typeExpression} as ${imports.Either}<Error, ${imports.Resource}.Values<${this.name}>>)`;
|
|
347
|
-
return expression !== null
|
|
348
|
-
? code `${expression}.altLazy(() => ${typeExpression})`
|
|
349
|
-
: typeExpression;
|
|
350
|
-
}, null)}.chain(values => values.head());
|
|
351
|
-
}))`;
|
|
352
|
-
}
|
|
353
|
-
graphqlResolveExpression(_parameters) {
|
|
354
|
-
throw new Error("not implemented");
|
|
355
|
-
}
|
|
356
|
-
hashStatements({ depth, variables, }) {
|
|
357
|
-
const caseBlocks = [];
|
|
358
|
-
for (const memberType of this.memberTypes) {
|
|
359
|
-
caseBlocks.push(code `${memberType.discriminantValues.map((discriminantPropertyValue) => `case "${discriminantPropertyValue}":`).join()} { ${joinCode(memberType
|
|
360
|
-
.hashStatements({
|
|
361
|
-
depth: depth + 1,
|
|
362
|
-
variables: {
|
|
363
|
-
hasher: variables.hasher,
|
|
364
|
-
value: memberType.payload(variables.value),
|
|
365
|
-
},
|
|
366
|
-
})
|
|
367
|
-
.concat())}; break; }`);
|
|
368
|
-
}
|
|
369
|
-
caseBlocks.push(code `default: ${variables.value} satisfies never; throw new Error("unrecognized type");`);
|
|
370
|
-
return [
|
|
371
|
-
code `switch (${this.discriminantVariable(variables.value)}) { ${joinCode(caseBlocks)} }`,
|
|
372
|
-
];
|
|
373
|
-
}
|
|
374
|
-
jsonType() {
|
|
375
|
-
switch (this.discriminant.kind) {
|
|
376
|
-
case "envelope":
|
|
377
|
-
return new AbstractType.JsonType(code `(${joinCode(this.memberTypes.map((memberType) => code `{ ${this.discriminant.name}: "${memberType.discriminantValues[0]}", value: ${memberType.jsonType().name} }`), { on: "|" })})`);
|
|
378
|
-
case "inline":
|
|
379
|
-
case "typeof":
|
|
380
|
-
return new AbstractType.JsonType(joinCode(this.memberTypes.map((memberType) => code `${memberType.jsonType({
|
|
381
|
-
includeDiscriminantProperty: this.discriminant.kind === "inline",
|
|
382
|
-
}).name}`), { on: "|" }));
|
|
383
|
-
default:
|
|
384
|
-
throw this.discriminant;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
jsonUiSchemaElement() {
|
|
388
|
-
return Maybe.empty();
|
|
389
|
-
}
|
|
390
|
-
jsonZodSchema(_parameters) {
|
|
391
|
-
switch (this.discriminant.kind) {
|
|
392
|
-
case "envelope":
|
|
393
|
-
return code `${imports.z}.discriminatedUnion("${this.discriminant.name}", [${joinCode(this.memberTypes.map((memberType) => code `${imports.z}.object({ ${this.discriminant.name}: ${imports.z}.literal("${memberType.discriminantValues[0]}"), value: ${memberType.jsonZodSchema({ context: "type" })} })`), { on: "," })}])`;
|
|
394
|
-
case "inline":
|
|
395
|
-
return code `${imports.z}.discriminatedUnion("${this.discriminant.name}", [${joinCode(this.memberTypes.map((memberType) => memberType.jsonZodSchema({
|
|
396
|
-
includeDiscriminantProperty: true,
|
|
397
|
-
context: "type",
|
|
398
|
-
})), { on: "," })}])`;
|
|
399
|
-
case "typeof":
|
|
400
|
-
return code `${imports.z}.union([${joinCode(this.memberTypes.map((memberType) => memberType.jsonZodSchema({ context: "type" })), { on: "," })}])`;
|
|
401
|
-
default:
|
|
402
|
-
throw this.discriminant;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
toJsonExpression({ variables, }) {
|
|
406
|
-
switch (this.discriminant.kind) {
|
|
407
|
-
case "envelope":
|
|
408
|
-
return this.ternaryExpression({
|
|
409
|
-
memberTypeExpression: (memberType) => code `{ ${this.discriminant.name}: "${memberType.discriminantValues[0]}" as const, value: ${memberType.toJsonExpression({
|
|
410
|
-
variables: {
|
|
411
|
-
...variables,
|
|
412
|
-
value: memberType.payload(variables.value),
|
|
413
|
-
},
|
|
414
|
-
})} }`,
|
|
415
|
-
variables,
|
|
416
|
-
});
|
|
417
|
-
case "inline":
|
|
418
|
-
case "typeof":
|
|
419
|
-
return this.ternaryExpression({
|
|
420
|
-
memberTypeExpression: (memberType) => memberType.toJsonExpression({
|
|
421
|
-
includeDiscriminantProperty: this.discriminant.kind === "inline",
|
|
422
|
-
variables: {
|
|
423
|
-
...variables,
|
|
424
|
-
value: memberType.payload(variables.value),
|
|
425
|
-
},
|
|
426
|
-
}),
|
|
427
|
-
variables,
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
toRdfExpression({ variables, }) {
|
|
432
|
-
return this.ternaryExpression({
|
|
433
|
-
memberTypeExpression: (memberType) => code `(${memberType.toRdfExpression({
|
|
434
|
-
variables: {
|
|
435
|
-
...variables,
|
|
436
|
-
value: memberType.payload(variables.value),
|
|
437
|
-
},
|
|
438
|
-
})} as (bigint | boolean | number | string | ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode})[])`,
|
|
439
|
-
variables,
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
discriminantVariable(variableValue) {
|
|
443
|
-
switch (this.discriminant.kind) {
|
|
444
|
-
case "envelope":
|
|
445
|
-
case "inline":
|
|
446
|
-
return code `${variableValue}.${this.discriminant.name}`;
|
|
447
|
-
case "typeof":
|
|
448
|
-
return code `(typeof ${variableValue})`;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
ternaryExpression({ memberTypeExpression, variables, }) {
|
|
452
|
-
return this.memberTypes.reduce((expression, memberType) => {
|
|
453
|
-
if (expression === null) {
|
|
454
|
-
return memberTypeExpression(memberType);
|
|
455
|
-
}
|
|
456
|
-
const memberTypeExpression_ = memberTypeExpression(memberType);
|
|
457
|
-
if (codeEquals(memberTypeExpression_, expression)) {
|
|
458
|
-
return expression;
|
|
459
|
-
}
|
|
460
|
-
return code `(${joinCode(memberType.discriminantValues.map((value) => code `${this.discriminantVariable(variables.value)} === "${value}"`), { on: "||" })}) ? ${memberTypeExpression_} : ${expression}`;
|
|
461
|
-
}, null);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
__decorate([
|
|
465
|
-
Memoize()
|
|
466
|
-
], UnionType.prototype, "conversions", null);
|
|
467
|
-
__decorate([
|
|
468
|
-
Memoize()
|
|
469
|
-
], UnionType.prototype, "discriminantProperty", null);
|
|
470
|
-
__decorate([
|
|
471
|
-
Memoize()
|
|
472
|
-
], UnionType.prototype, "equalsFunction", null);
|
|
473
|
-
__decorate([
|
|
474
|
-
Memoize()
|
|
475
|
-
], UnionType.prototype, "filterFunction", null);
|
|
476
|
-
__decorate([
|
|
477
|
-
Memoize()
|
|
478
|
-
], UnionType.prototype, "filterType", null);
|
|
479
|
-
__decorate([
|
|
480
|
-
Memoize()
|
|
481
|
-
], UnionType.prototype, "mutable", null);
|
|
482
|
-
__decorate([
|
|
483
|
-
Memoize()
|
|
484
|
-
], UnionType.prototype, "name", null);
|
|
485
|
-
__decorate([
|
|
486
|
-
Memoize()
|
|
487
|
-
], UnionType.prototype, "schema", null);
|
|
488
|
-
__decorate([
|
|
489
|
-
Memoize()
|
|
490
|
-
], UnionType.prototype, "sparqlConstructTriplesFunction", null);
|
|
491
|
-
__decorate([
|
|
492
|
-
Memoize()
|
|
493
|
-
], UnionType.prototype, "sparqlWherePatternsFunction", null);
|
|
494
|
-
__decorate([
|
|
495
|
-
Memoize()
|
|
496
|
-
], UnionType.prototype, "typeofs", null);
|
|
497
|
-
__decorate([
|
|
498
|
-
Memoize()
|
|
499
|
-
], UnionType.prototype, "jsonType", null);
|
|
500
|
-
function inlineDiscriminantProperty(memberTypes) {
|
|
501
|
-
let inlineDiscriminantProperty;
|
|
502
|
-
for (const memberType of memberTypes) {
|
|
503
|
-
const memberTypeDiscriminantProperty = memberType.discriminantProperty.extract();
|
|
504
|
-
if (!memberTypeDiscriminantProperty) {
|
|
505
|
-
inlineDiscriminantProperty = undefined;
|
|
506
|
-
break;
|
|
507
|
-
}
|
|
508
|
-
if (!inlineDiscriminantProperty) {
|
|
509
|
-
inlineDiscriminantProperty = {
|
|
510
|
-
name: memberTypeDiscriminantProperty.name,
|
|
511
|
-
ownValues: memberTypeDiscriminantProperty.ownValues.concat(),
|
|
512
|
-
descendantValues: memberTypeDiscriminantProperty.descendantValues.concat(),
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
else if (memberTypeDiscriminantProperty.name === inlineDiscriminantProperty.name) {
|
|
516
|
-
inlineDiscriminantProperty.descendantValues =
|
|
517
|
-
inlineDiscriminantProperty.descendantValues.concat(memberTypeDiscriminantProperty.descendantValues);
|
|
518
|
-
inlineDiscriminantProperty.ownValues =
|
|
519
|
-
inlineDiscriminantProperty.ownValues.concat(memberTypeDiscriminantProperty.ownValues);
|
|
520
|
-
}
|
|
521
|
-
else {
|
|
522
|
-
return undefined;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
return inlineDiscriminantProperty;
|
|
526
|
-
}
|
|
527
|
-
//# sourceMappingURL=UnionType.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_createFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
-
//# sourceMappingURL=ObjectType_createFunctionDeclaration.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_equalsFunctionOrMethodDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
-
//# sourceMappingURL=ObjectType_equalsFunctionOrMethodDeclaration.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export declare function ObjectType_fromJsonFunctionDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
-
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclarations.d.ts.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { imports } from "../imports.js";
|
|
2
|
-
import { snippets } from "../snippets.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
|
-
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
const variables = {
|
|
6
|
-
jsonObject: code `${syntheticNamePrefix}jsonObject`,
|
|
7
|
-
};
|
|
8
|
-
export function ObjectType_fromJsonFunctionDeclarations() {
|
|
9
|
-
if (!this.features.has("json")) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const initializers = [];
|
|
13
|
-
const propertiesFromJsonReturnType = [];
|
|
14
|
-
const propertiesFromJsonStatements = [];
|
|
15
|
-
const propertyReturnTypeSignatures = [];
|
|
16
|
-
propertiesFromJsonStatements.push(code `const ${syntheticNamePrefix}jsonSafeParseResult = ${syntheticNamePrefix}jsonZodSchema().safeParse(_json);`, code `if (!${syntheticNamePrefix}jsonSafeParseResult.success) { return ${imports.Left}(${syntheticNamePrefix}jsonSafeParseResult.error); }`, code `const ${variables.jsonObject} = ${syntheticNamePrefix}jsonSafeParseResult.data;`);
|
|
17
|
-
const chains = [];
|
|
18
|
-
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
19
|
-
chains.push({
|
|
20
|
-
expression: code `${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromJson(${variables.jsonObject})`,
|
|
21
|
-
variable: `${syntheticNamePrefix}super${parentObjectTypeI}`,
|
|
22
|
-
});
|
|
23
|
-
initializers.push(`...${syntheticNamePrefix}super${parentObjectTypeI}`);
|
|
24
|
-
propertiesFromJsonReturnType.push(code `${snippets.UnwrapR}<ReturnType<typeof ${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromJson>>`);
|
|
25
|
-
});
|
|
26
|
-
for (const property of this.properties) {
|
|
27
|
-
const propertyFromJsonStatements = property.fromJsonStatements({
|
|
28
|
-
variables,
|
|
29
|
-
});
|
|
30
|
-
if (propertyFromJsonStatements.length > 0) {
|
|
31
|
-
propertiesFromJsonStatements.push(...propertyFromJsonStatements);
|
|
32
|
-
initializers.push(property.name);
|
|
33
|
-
propertyReturnTypeSignatures.push(code `${property.name}: ${property.type.name};`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const resultExpression = `{ ${initializers.join(", ")} }`;
|
|
37
|
-
if (chains.length === 0) {
|
|
38
|
-
propertiesFromJsonStatements.push(code `return ${imports.Right}(${resultExpression})`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
propertiesFromJsonStatements.push(code `return ${chains
|
|
42
|
-
.reverse()
|
|
43
|
-
.reduce((acc, { expression, variable }, chainI) => code `(${expression}).${chainI === 0 ? "map" : "chain"}(${variable} => ${acc})`, code `(${resultExpression})`)}`);
|
|
44
|
-
}
|
|
45
|
-
if (propertyReturnTypeSignatures.length > 0) {
|
|
46
|
-
propertiesFromJsonReturnType.splice(0, 0, code `{ ${joinCode(propertyReturnTypeSignatures, { on: " " })} }`);
|
|
47
|
-
}
|
|
48
|
-
const functionDeclarations = [];
|
|
49
|
-
functionDeclarations.push(code `\
|
|
50
|
-
export function ${syntheticNamePrefix}propertiesFromJson(_json: unknown): ${imports.Either}<${imports.z}.ZodError, ${joinCode(propertiesFromJsonReturnType, { on: " & " })}> {
|
|
51
|
-
${joinCode(propertiesFromJsonStatements)}
|
|
52
|
-
}`);
|
|
53
|
-
if (this.abstract) {
|
|
54
|
-
return functionDeclarations;
|
|
55
|
-
}
|
|
56
|
-
let propertiesFromJsonExpression = code `${syntheticNamePrefix}propertiesFromJson(json)`;
|
|
57
|
-
if (this.declarationType === "class") {
|
|
58
|
-
propertiesFromJsonExpression = code `${propertiesFromJsonExpression}.map(properties => new ${this.name}(properties))`;
|
|
59
|
-
}
|
|
60
|
-
functionDeclarations.push(code `\
|
|
61
|
-
export function ${syntheticNamePrefix}fromJson(json: unknown): ${imports.Either}<${imports.z}.ZodError, ${this.name}> {
|
|
62
|
-
return ${propertiesFromJsonExpression};
|
|
63
|
-
}`);
|
|
64
|
-
return functionDeclarations;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclarations.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_fromRdfFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
-
//# sourceMappingURL=ObjectType_fromRdfFunctionDeclaration.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
-
//# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
-
//# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export declare function ObjectType_hashFunctionOrMethodDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
-
//# sourceMappingURL=ObjectType_hashFunctionOrMethodDeclarations.d.ts.map
|