@shaclmate/compiler 4.0.40 → 4.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -8
- package/dist/ShapesGraphToAstTransformer.js +11 -126
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.d.ts +17 -0
- package/dist/_ShapesGraphToAstTransformer/{transformPropertyShapeToAstObjectTypeProperty.js → transformPropertyShapeToAstStructTypeField.js} +71 -48
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +29 -20
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.d.ts → transformShapeToAstStructType.d.ts} +3 -3
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.js → transformShapeToAstStructType.js} +35 -45
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +2 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractCompoundType.d.ts +3 -2
- package/dist/ast/AbstractCompoundType.js +5 -5
- package/dist/ast/AbstractContainerType.d.ts +2 -2
- package/dist/ast/AbstractContainerType.js +4 -4
- package/dist/ast/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +10 -12
- package/dist/ast/{AbstractLazyObjectType.js → AbstractLazyType.js} +3 -3
- package/dist/ast/AbstractType.d.ts +1 -1
- package/dist/ast/AbstractType.js +3 -0
- package/dist/ast/Ast.d.ts +2 -6
- package/dist/ast/DefaultValueType.js +2 -1
- package/dist/ast/IntersectionType.d.ts +2 -2
- package/dist/ast/IntersectionType.js +3 -3
- package/dist/ast/LazyOptionType.d.ts +6 -0
- package/dist/ast/LazyOptionType.js +5 -0
- package/dist/ast/LazySetType.d.ts +6 -0
- package/dist/ast/LazySetType.js +5 -0
- package/dist/ast/LazyType.d.ts +5 -0
- package/dist/ast/LazyType.js +5 -0
- package/dist/ast/ListType.d.ts +2 -2
- package/dist/ast/ListType.js +5 -5
- package/dist/ast/OptionType.js +2 -1
- package/dist/ast/SetType.js +2 -1
- package/dist/ast/StructCompoundType.d.ts +12 -0
- package/dist/ast/{ObjectCompoundType.js → StructCompoundType.js} +18 -18
- package/dist/ast/StructIntersectionType.d.ts +4 -0
- package/dist/ast/StructIntersectionType.js +2 -0
- package/dist/ast/{ObjectType.d.ts → StructType.d.ts} +28 -39
- package/dist/ast/{ObjectType.js → StructType.js} +81 -156
- package/dist/ast/StructUnionType.d.ts +4 -0
- package/dist/ast/StructUnionType.js +2 -0
- package/dist/ast/Type.d.ts +5 -5
- package/dist/ast/Type.js +4 -4
- package/dist/ast/UnionType.d.ts +2 -2
- package/dist/ast/UnionType.js +3 -3
- package/dist/ast/index.d.ts +7 -7
- package/dist/ast/index.js +7 -7
- package/dist/generators/AstJsonGenerator.js +7 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
- package/dist/generators/ts/AbstractCollectionType.d.ts +4 -11
- package/dist/generators/ts/AbstractCollectionType.js +3 -62
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -2
- package/dist/generators/ts/AbstractContainerType.js +7 -10
- package/dist/generators/ts/AbstractDateType.d.ts +5 -8
- package/dist/generators/ts/AbstractDateType.js +7 -12
- package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
- package/dist/generators/ts/AbstractIdentifierType.js +3 -0
- package/dist/generators/ts/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +8 -8
- package/dist/generators/ts/{AbstractLazyObjectType.js → AbstractLazyType.js} +30 -17
- package/dist/generators/ts/AbstractLiteralType.d.ts +3 -5
- package/dist/generators/ts/AbstractLiteralType.js +0 -21
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -7
- package/dist/generators/ts/AbstractNumericType.js +17 -27
- package/dist/generators/ts/AbstractObjectSetType.d.ts +1 -1
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -1
- package/dist/generators/ts/AbstractPrimitiveType.js +1 -1
- package/dist/generators/ts/AbstractTermType.d.ts +7 -23
- package/dist/generators/ts/AbstractTermType.js +27 -58
- package/dist/generators/ts/AbstractType.d.ts +86 -63
- package/dist/generators/ts/AbstractType.js +48 -22
- package/dist/generators/ts/BigDecimalType.d.ts +7 -3
- package/dist/generators/ts/BigDecimalType.js +7 -9
- package/dist/generators/ts/BigIntType.d.ts +5 -3
- package/dist/generators/ts/BigIntType.js +8 -5
- package/dist/generators/ts/BlankNodeType.d.ts +2 -7
- package/dist/generators/ts/BlankNodeType.js +4 -9
- package/dist/generators/ts/BooleanType.d.ts +6 -4
- package/dist/generators/ts/BooleanType.js +13 -15
- package/dist/generators/ts/DateTimeType.d.ts +2 -2
- package/dist/generators/ts/DateTimeType.js +14 -4
- package/dist/generators/ts/DateType.d.ts +2 -2
- package/dist/generators/ts/DateType.js +14 -4
- package/dist/generators/ts/DefaultValueType.d.ts +40 -2
- package/dist/generators/ts/DefaultValueType.js +15 -14
- package/dist/generators/ts/FloatType.d.ts +5 -3
- package/dist/generators/ts/FloatType.js +8 -5
- package/dist/generators/ts/GraphqlSchema.js +2 -2
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +8 -11
- package/dist/generators/ts/IntType.d.ts +5 -3
- package/dist/generators/ts/IntType.js +8 -5
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +16 -16
- package/dist/generators/ts/{LazyObjectOptionType.d.ts → LazyOptionType.d.ts} +13 -11
- package/dist/generators/ts/LazyOptionType.js +75 -0
- package/dist/generators/ts/LazySetType.d.ts +20 -0
- package/dist/generators/ts/LazySetType.js +76 -0
- package/dist/generators/ts/LazyType.d.ts +19 -0
- package/dist/generators/ts/LazyType.js +65 -0
- package/dist/generators/ts/ListType.d.ts +11 -2
- package/dist/generators/ts/ListType.js +53 -26
- package/dist/generators/ts/LiteralType.d.ts +7 -2
- package/dist/generators/ts/LiteralType.js +12 -5
- package/dist/generators/ts/ObjectType.d.ts +24 -25
- package/dist/generators/ts/ObjectType.js +303 -161
- package/dist/generators/ts/ObjectUnionType.js +42 -42
- package/dist/generators/ts/OptionType.d.ts +6 -2
- package/dist/generators/ts/OptionType.js +16 -9
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +1 -4
- package/dist/generators/ts/SetType.d.ts +17 -2
- package/dist/generators/ts/SetType.js +85 -9
- package/dist/generators/ts/Snippets.d.ts +29 -9
- package/dist/generators/ts/Snippets.js +179 -39
- package/dist/generators/ts/StringType.d.ts +7 -4
- package/dist/generators/ts/StringType.js +23 -12
- package/dist/generators/ts/TermType.d.ts +9 -3
- package/dist/generators/ts/TermType.js +29 -7
- package/dist/generators/ts/TsGenerator.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.js +62 -32
- package/dist/generators/ts/Type.d.ts +4 -4
- package/dist/generators/ts/TypeFactory.d.ts +5 -5
- package/dist/generators/ts/TypeFactory.js +90 -82
- package/dist/generators/ts/UnionType.d.ts +25 -23
- package/dist/generators/ts/UnionType.js +254 -261
- package/dist/generators/ts/ZodGenerator.d.ts +1 -1
- package/dist/generators/ts/ZodGenerator.js +29 -14
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +28 -16
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +1 -24
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +15 -17
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +24 -54
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +8 -2
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +48 -20
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.js +28 -0
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.js +15 -0
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_filterTypeDeclaration.js → ObjectType_filterTypeExpression.js} +5 -10
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → ObjectType_focusSparqlConstructTriplesFunctionExpression.js} +5 -13
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.js → ObjectType_focusSparqlWherePatternsFunctionExpression.js} +8 -31
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.js +43 -0
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_graphqlTypeVariableStatement.js → ObjectType_graphqlTypeExpression.js} +6 -13
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.js +30 -0
- package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.js +13 -0
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +11 -8
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +1 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js +2 -6
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.js +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.js +17 -0
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +1 -1
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.js +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +18 -0
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +5 -9
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +4 -8
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.js +14 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_toRdfResourceFunctionDeclaration.js → ObjectType_toRdfResourceFunctionExpression.js} +7 -13
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.js +7 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.d.ts +4 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.js +5 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_valueSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js +8 -0
- package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts} +2 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js +10 -0
- package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +9 -2
- package/dist/generators/ts/_ObjectType/ShaclProperty.js +70 -38
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +4 -3
- package/dist/generators/ts/_snippets/snippets_DateSchema.js +4 -3
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +6 -5
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +2 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +1 -0
- package/dist/generators/ts/_snippets/snippets_Lazy.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_Lazy.js +22 -0
- package/dist/generators/ts/_snippets/snippets_LazyOption.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LazyOption.js +25 -0
- package/dist/generators/ts/_snippets/snippets_LazySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_LazySet.js +40 -0
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +1 -0
- package/dist/generators/ts/_snippets/snippets_NumericSchema.js +2 -1
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +6 -8
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +32 -32
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +5 -3
- package/dist/generators/ts/_snippets/snippets_TermFilter.js +3 -3
- package/dist/generators/ts/_snippets/snippets_TermSchema.js +4 -2
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazy.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazy.js +15 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyOption.js +33 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazySet.js +27 -0
- package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -0
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.js +10 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_filterNumeric.js +1 -1
- package/dist/generators/ts/_snippets/snippets_filterTerm.js +1 -2
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.js +15 -0
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.js +11 -0
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.js +8 -0
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.js +8 -0
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.js +9 -0
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +13 -7
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.js +6 -0
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.js +17 -0
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.js +60 -0
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
- package/dist/input/generated.d.ts +1116 -400
- package/dist/input/generated.js +1879 -1917
- package/package.json +2 -4
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.d.ts +0 -9
- package/dist/ast/LazyObjectOptionType.d.ts +0 -6
- package/dist/ast/LazyObjectOptionType.js +0 -5
- package/dist/ast/LazyObjectSetType.d.ts +0 -6
- package/dist/ast/LazyObjectSetType.js +0 -5
- package/dist/ast/LazyObjectType.d.ts +0 -5
- package/dist/ast/LazyObjectType.js +0 -5
- package/dist/ast/ObjectCompoundType.d.ts +0 -12
- package/dist/ast/ObjectIntersectionType.d.ts +0 -4
- package/dist/ast/ObjectIntersectionType.js +0 -2
- package/dist/ast/ObjectUnionType.d.ts +0 -4
- package/dist/ast/ObjectUnionType.js +0 -2
- package/dist/generators/ts/LazyObjectOptionType.js +0 -62
- package/dist/generators/ts/LazyObjectSetType.d.ts +0 -20
- package/dist/generators/ts/LazyObjectSetType.js +0 -61
- package/dist/generators/ts/LazyObjectType.d.ts +0 -19
- package/dist/generators/ts/LazyObjectType.js +0 -53
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +0 -65
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.js +0 -23
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -24
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +0 -43
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +0 -80
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.js +0 -10
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +0 -45
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +0 -16
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -31
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +0 -16
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +0 -17
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +0 -41
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.js +0 -36
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +0 -11
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js +0 -13
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +0 -27
- package/dist/generators/ts/_snippets/snippets_LazyObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +0 -22
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +0 -25
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +0 -40
- package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +0 -15
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +0 -31
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +0 -25
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +0 -15
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.js +0 -23
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
4
|
-
if (!this.configuration.features.has("Object.filter")) {
|
|
5
|
-
return Maybe.empty();
|
|
6
|
-
}
|
|
2
|
+
export function ObjectType_filterTypeExpression() {
|
|
7
3
|
const members = [];
|
|
8
4
|
if (this.properties.length > 0) {
|
|
9
5
|
const filterProperties = {};
|
|
@@ -16,10 +12,9 @@ export function ObjectType_filterTypeDeclaration() {
|
|
|
16
12
|
members.push(code `{ ${joinCode(Object.entries(filterProperties).map(([name, type]) => code `readonly ${name}?: ${type}`), { on: ";" })} }`);
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
members
|
|
15
|
+
if (members.length > 0) {
|
|
16
|
+
return joinCode(members, { on: " & " });
|
|
21
17
|
}
|
|
22
|
-
return
|
|
23
|
-
export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
18
|
+
return code `object`;
|
|
24
19
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=ObjectType_filterTypeExpression.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import type { ObjectType } from "../ObjectType.js";
|
|
3
2
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function
|
|
5
|
-
//# sourceMappingURL=
|
|
3
|
+
export declare function ObjectType_focusSparqlConstructTriplesFunctionExpression(this: ObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts.map
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
2
|
-
import { Maybe } from "purify-ts";
|
|
3
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
3
|
const variables = {
|
|
5
4
|
filter: code `parameters.filter`,
|
|
6
5
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
7
6
|
variablePrefix: code `parameters.variablePrefix`,
|
|
8
7
|
};
|
|
9
|
-
export function
|
|
10
|
-
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
11
|
-
return Maybe.empty();
|
|
12
|
-
}
|
|
8
|
+
export function ObjectType_focusSparqlConstructTriplesFunctionExpression() {
|
|
13
9
|
const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
14
10
|
const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
15
11
|
let triplesVariableDeclarationKeyword = "const";
|
|
16
12
|
const statements = [];
|
|
17
|
-
for (const parentObjectType of this.parentObjectTypes) {
|
|
18
|
-
statements.push(code `triples = triples.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
|
|
19
|
-
triplesVariableDeclarationKeyword = "let";
|
|
20
|
-
}
|
|
21
13
|
if (this.fromRdfType.isJust()) {
|
|
22
14
|
statements.push(code `\
|
|
23
15
|
if (!parameters?.ignoreRdfType) {
|
|
@@ -40,8 +32,8 @@ if (!parameters?.ignoreRdfType) {
|
|
|
40
32
|
triplesVariableDeclarationKeyword = "let";
|
|
41
33
|
});
|
|
42
34
|
}
|
|
43
|
-
return
|
|
44
|
-
|
|
35
|
+
return code `\
|
|
36
|
+
((${statements.length === 0 ? "_" : ""}parameters) => {
|
|
45
37
|
${statements.length > 0
|
|
46
38
|
? joinCode([
|
|
47
39
|
code `${triplesVariableDeclarationKeyword} triples: ${this.reusables.imports.sparqljs}.Triple[] = [];`,
|
|
@@ -49,6 +41,6 @@ ${statements.length > 0
|
|
|
49
41
|
code `return triples;`,
|
|
50
42
|
])
|
|
51
43
|
: "return [];"}
|
|
52
|
-
}
|
|
44
|
+
})`;
|
|
53
45
|
}
|
|
54
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionExpression.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import type { ObjectType } from "../ObjectType.js";
|
|
3
2
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function
|
|
5
|
-
//# sourceMappingURL=
|
|
3
|
+
export declare function ObjectType_focusSparqlWherePatternsFunctionExpression(this: ObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
2
|
-
import { Maybe } from "purify-ts";
|
|
3
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
3
|
const variables = {
|
|
5
4
|
filter: code `parameters.filter`,
|
|
@@ -7,38 +6,16 @@ const variables = {
|
|
|
7
6
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
8
7
|
variablePrefix: code `parameters.variablePrefix`,
|
|
9
8
|
};
|
|
10
|
-
export function
|
|
11
|
-
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
12
|
-
return Maybe.empty();
|
|
13
|
-
}
|
|
9
|
+
export function ObjectType_focusSparqlWherePatternsFunctionExpression() {
|
|
14
10
|
const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
15
11
|
const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
16
12
|
let patternsVariableDeclarationKeyword = "const";
|
|
17
13
|
const statements = [];
|
|
18
|
-
|
|
19
|
-
statements.push(code `\
|
|
20
|
-
patterns = patterns.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
|
|
21
|
-
patternsVariableDeclarationKeyword = "let";
|
|
22
|
-
}
|
|
23
|
-
if (this.fromRdfType.isJust()) {
|
|
24
|
-
const fromRdfTypeVariables = this.fromRdfTypeVariable
|
|
25
|
-
.toList()
|
|
26
|
-
.concat(this.descendantFromRdfTypeVariables);
|
|
14
|
+
this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
|
|
27
15
|
statements.push(code `const rdfTypeVariable = ${rdfTypeVariable};`, code `\
|
|
28
16
|
if (!parameters?.ignoreRdfType) {
|
|
29
17
|
patterns.push(
|
|
30
|
-
${
|
|
31
|
-
? code `\
|
|
32
|
-
{
|
|
33
|
-
type: "values" as const,
|
|
34
|
-
values: [${joinCode(fromRdfTypeVariables, { on: "," })}].map((identifier) => {
|
|
35
|
-
const valuePatternRow: ${this.reusables.imports.sparqljs}.ValuePatternRow = {};
|
|
36
|
-
valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${this.reusables.imports.NamedNode};
|
|
37
|
-
return valuePatternRow;
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
|
|
41
|
-
: code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
|
|
18
|
+
${code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariable}, subject: ${variables.focusIdentifier} }),`}
|
|
42
19
|
{
|
|
43
20
|
triples: [
|
|
44
21
|
{
|
|
@@ -70,7 +47,7 @@ if (!parameters?.ignoreRdfType) {
|
|
|
70
47
|
}
|
|
71
48
|
);
|
|
72
49
|
}`);
|
|
73
|
-
}
|
|
50
|
+
});
|
|
74
51
|
for (const property of this.properties) {
|
|
75
52
|
if (property.recursive) {
|
|
76
53
|
continue;
|
|
@@ -88,8 +65,8 @@ if (!parameters?.ignoreRdfType) {
|
|
|
88
65
|
patternsVariableDeclarationKeyword = "let";
|
|
89
66
|
});
|
|
90
67
|
}
|
|
91
|
-
return
|
|
92
|
-
|
|
68
|
+
return code `\
|
|
69
|
+
((${statements.length === 0 ? "_" : ""}parameters) => {
|
|
93
70
|
${statements.length > 0
|
|
94
71
|
? joinCode([
|
|
95
72
|
code `${patternsVariableDeclarationKeyword} patterns: ${this.reusables.snippets.SparqlPattern}[] = [];`,
|
|
@@ -97,6 +74,6 @@ ${statements.length > 0
|
|
|
97
74
|
code `return patterns;`,
|
|
98
75
|
])
|
|
99
76
|
: "return [];"}
|
|
100
|
-
}
|
|
77
|
+
})`;
|
|
101
78
|
}
|
|
102
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionExpression.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { invariant } from "ts-invariant";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_fromJsonFunctionExpression() {
|
|
4
|
+
const variables = {
|
|
5
|
+
jsonObject: code `${this.configuration.syntheticNamePrefix}json`,
|
|
6
|
+
};
|
|
7
|
+
const propertyInitializers = this.properties.flatMap((property) => property.fromJsonInitializer({ variables }).toList());
|
|
8
|
+
invariant(propertyInitializers.length > 0);
|
|
9
|
+
return code `\
|
|
10
|
+
((${variables.jsonObject}) => ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(${this.createFunction}))`;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_fromJsonFunctionExpression.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function ObjectType_fromRdfResourceFunctionExpression(this: ObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionExpression.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { invariant } from "ts-invariant";
|
|
2
|
+
import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_fromRdfResourceFunctionExpression() {
|
|
4
|
+
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
5
|
+
const optionsVariable = `_${syntheticNamePrefix}options`;
|
|
6
|
+
const variables = {
|
|
7
|
+
context: code `${optionsVariable}.context`,
|
|
8
|
+
graph: code `${optionsVariable}.graph`,
|
|
9
|
+
ignoreRdfType: code `${optionsVariable}.ignoreRdfType`,
|
|
10
|
+
objectSet: code `${optionsVariable}.objectSet`,
|
|
11
|
+
preferredLanguages: code `${optionsVariable}.preferredLanguages`,
|
|
12
|
+
resource: code `${syntheticNamePrefix}resource`,
|
|
13
|
+
};
|
|
14
|
+
const propertyFromRdfResourceValuesVariables = {
|
|
15
|
+
context: variables.context,
|
|
16
|
+
focusResource: variables.resource,
|
|
17
|
+
graph: variables.graph,
|
|
18
|
+
objectSet: variables.objectSet,
|
|
19
|
+
preferredLanguages: variables.preferredLanguages,
|
|
20
|
+
};
|
|
21
|
+
const chains = [];
|
|
22
|
+
this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
|
|
23
|
+
chains.push({
|
|
24
|
+
expression: code `!${variables.ignoreRdfType} ? ${this.reusables.snippets.ensureRdfResourceType}(${variables.resource}, ${arrayOf(fromRdfTypeVariable)}, ${{ graph: variables.graph }}) : ${this.reusables.imports.Right}(true as const)`,
|
|
25
|
+
variable: `_rdfTypeCheck`,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
const propertyFromRdfResourceValuesInitializers = this.properties.flatMap((property) => property
|
|
29
|
+
.fromRdfResourceValuesInitializer({
|
|
30
|
+
variables: propertyFromRdfResourceValuesVariables,
|
|
31
|
+
})
|
|
32
|
+
.toList());
|
|
33
|
+
invariant(Object.keys(propertyFromRdfResourceValuesInitializers).length > 0);
|
|
34
|
+
chains.push({
|
|
35
|
+
expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyFromRdfResourceValuesInitializers, { on: ", " })} })`,
|
|
36
|
+
variable: "properties",
|
|
37
|
+
});
|
|
38
|
+
return code `\
|
|
39
|
+
((${variables.resource}, ${optionsVariable}) => ${chains
|
|
40
|
+
.reverse()
|
|
41
|
+
.reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(${this.createFunction}(properties))`)})`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionExpression.js.map
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
if (this.synthetic) {
|
|
8
|
-
return Maybe.empty();
|
|
9
|
-
}
|
|
10
|
-
return Maybe.of(code `\
|
|
11
|
-
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
|
|
2
|
+
export function ObjectType_graphqlTypeExpression() {
|
|
3
|
+
return code `\
|
|
4
|
+
new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
|
|
12
5
|
description: this.comment.extract(),
|
|
13
6
|
fields: code `() => (${this.properties.reduce((fields, property) => {
|
|
14
7
|
property.graphqlField.ifJust((field) => {
|
|
@@ -27,7 +20,7 @@ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.ex
|
|
|
27
20
|
});
|
|
28
21
|
return fields;
|
|
29
22
|
}, {})})`,
|
|
30
|
-
name: this.
|
|
31
|
-
}})
|
|
23
|
+
name: this.name.orDefault(this.shapeIdentifier.value),
|
|
24
|
+
}})`;
|
|
32
25
|
}
|
|
33
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=ObjectType_graphqlTypeExpression.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { codeEquals } from "../codeEquals.js";
|
|
2
|
+
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
3
|
+
const hasherVariable = code `hasher`;
|
|
4
|
+
export function ObjectType_hashFunctionExpression() {
|
|
5
|
+
let statements = [];
|
|
6
|
+
const replacePropertyDeclarations = {};
|
|
7
|
+
for (const property of this.properties) {
|
|
8
|
+
const propertyHashStatements = property.hashStatements({
|
|
9
|
+
variables: {
|
|
10
|
+
hasher: hasherVariable,
|
|
11
|
+
value: code `${this.thisVariable}.${property.name}`,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
if (propertyHashStatements.length === 0) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
statements = statements.concat(propertyHashStatements);
|
|
18
|
+
if (!codeEquals(property.hashFunctionParameter, property.declaration)) {
|
|
19
|
+
replacePropertyDeclarations[property.name] =
|
|
20
|
+
code `${property.hashFunctionParameter}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
statements.push(code `return ${hasherVariable};`);
|
|
24
|
+
let thisTypeExpression = this.expression;
|
|
25
|
+
if (Object.keys(replacePropertyDeclarations).length > 0) {
|
|
26
|
+
thisTypeExpression = code `Omit<${thisTypeExpression}, ${joinCode(Object.keys(replacePropertyDeclarations).map((propertyName) => code `${literalOf(propertyName)}`), { on: " | " })}> & { ${joinCode(Object.values(replacePropertyDeclarations))} }`;
|
|
27
|
+
}
|
|
28
|
+
return code `<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${thisTypeExpression}): HasherT => { ${joinCode(statements)} }`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ObjectType_hashFunctionExpression.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function ObjectType_identifierTypeDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
+
//# sourceMappingURL=ObjectType_identifierTypeDeclarations.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
2
|
+
export function ObjectType_identifierTypeDeclarations() {
|
|
3
|
+
// Bespoke identifier type and associated functions
|
|
4
|
+
return [
|
|
5
|
+
code `export type Identifier = ${this.identifierType.expression};`,
|
|
6
|
+
code `\
|
|
7
|
+
export namespace Identifier {
|
|
8
|
+
export const parse = ${this.identifierType.parseFunction};
|
|
9
|
+
export const stringify = ${this.identifierType.stringifyFunction};
|
|
10
|
+
}`,
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ObjectType_identifierTypeDeclarations.js.map
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { code } from "../ts-poet-wrapper.js";
|
|
2
|
+
import { code, literalOf } from "../ts-poet-wrapper.js";
|
|
3
3
|
export function ObjectType_isTypeFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.type")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
|
+
if (this.synthetic) {
|
|
8
|
+
return Maybe.empty();
|
|
9
|
+
}
|
|
10
|
+
const name = this.name.extract();
|
|
11
|
+
const discriminantProperty = this.discriminantProperty.extract();
|
|
12
|
+
if (!name || !discriminantProperty) {
|
|
13
|
+
return Maybe.empty();
|
|
14
|
+
}
|
|
7
15
|
return Maybe.of(code `\
|
|
8
|
-
export function is${
|
|
9
|
-
|
|
10
|
-
${this._discriminantProperty.type.descendantValues
|
|
11
|
-
.concat(this._discriminantProperty.type.ownValues)
|
|
12
|
-
.map((value) => `case "${value}":`)
|
|
13
|
-
.join("\n")} return true; default: return false;
|
|
14
|
-
}
|
|
16
|
+
export function is${name}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${name} {
|
|
17
|
+
return object.${discriminantProperty.name} === ${literalOf(discriminantProperty.value)};
|
|
15
18
|
}`);
|
|
16
19
|
}
|
|
17
20
|
//# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import type { ObjectType } from "../ObjectType.js";
|
|
3
2
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function ObjectType_jsonParseFunctionDeclaration(this: ObjectType):
|
|
3
|
+
export declare function ObjectType_jsonParseFunctionDeclaration(this: ObjectType): Code;
|
|
5
4
|
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.d.ts.map
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
2
|
export function ObjectType_jsonParseFunctionDeclaration() {
|
|
4
|
-
|
|
5
|
-
return Maybe.empty();
|
|
6
|
-
}
|
|
7
|
-
return Maybe.of(code `\
|
|
3
|
+
return code `\
|
|
8
4
|
export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Json> {
|
|
9
5
|
const jsonSafeParseResult = schema().safeParse(json);
|
|
10
6
|
if (!jsonSafeParseResult.success) { return ${this.reusables.imports.Left}(jsonSafeParseResult.error); }
|
|
11
7
|
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
12
|
-
}
|
|
8
|
+
}`;
|
|
13
9
|
}
|
|
14
10
|
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
+
export function ObjectType_jsonSchemaExpression() {
|
|
3
|
+
const properties = this.properties
|
|
4
|
+
.flatMap((property) => property.jsonSchema.toList())
|
|
5
|
+
.map(({ key, schema }) => code `"${key}": ${schema}`);
|
|
6
|
+
const meta = {
|
|
7
|
+
// id: this.name,
|
|
8
|
+
};
|
|
9
|
+
this.comment.ifJust((description) => {
|
|
10
|
+
meta["description"] = description;
|
|
11
|
+
});
|
|
12
|
+
this.label.ifJust((label) => {
|
|
13
|
+
meta["title"] = label;
|
|
14
|
+
});
|
|
15
|
+
// ${this.properties.every((property) => !property.mutable) ? `.readonly()` : ""}
|
|
16
|
+
return code `${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta})`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ObjectType_jsonSchemaExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
+
export function ObjectType_jsonTypeExpression() {
|
|
3
|
+
return code `{ ${joinCode(this.properties.flatMap((property) => property.jsonSignature.toList()), { on: ";" })} }`;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonTypeExpression.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { arrayOf, code, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
+
export function ObjectType_jsonUiSchemaFunctionExpression() {
|
|
3
|
+
const variables = { scopePrefix: code `scopePrefix` };
|
|
4
|
+
const uiSchema = {
|
|
5
|
+
elements: code `${arrayOf(...this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()))}`,
|
|
6
|
+
type: "Group",
|
|
7
|
+
};
|
|
8
|
+
this.name.ifJust((name) => {
|
|
9
|
+
uiSchema["label"] = code `${literalOf(name)}`;
|
|
10
|
+
});
|
|
11
|
+
return code `\
|
|
12
|
+
((parameters?: { scopePrefix?: string }): any => {
|
|
13
|
+
const scopePrefix = parameters?.scopePrefix ?? "#";
|
|
14
|
+
return ${uiSchema};
|
|
15
|
+
})`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionExpression.js.map
|
|
@@ -2,10 +2,10 @@ import { camelCase, trainCase } from "change-case";
|
|
|
2
2
|
import plur from "plur";
|
|
3
3
|
export function ObjectType_objectSetMethodNames() {
|
|
4
4
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
5
|
-
const prefixSingular = camelCase(this.
|
|
5
|
+
const prefixSingular = camelCase(this.name, {
|
|
6
6
|
prefixCharacters: syntheticNamePrefix,
|
|
7
7
|
});
|
|
8
|
-
const thisNameParts = trainCase(this.
|
|
8
|
+
const thisNameParts = trainCase(this.name, {
|
|
9
9
|
prefixCharacters: syntheticNamePrefix,
|
|
10
10
|
}).split("-");
|
|
11
11
|
let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { invariant } from "ts-invariant";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_schemaExpression() {
|
|
4
|
+
const schema = {};
|
|
5
|
+
this.fromRdfType.ifJust((fromRdfType) => {
|
|
6
|
+
schema["fromRdfType"] = this.rdfjsTermExpression(fromRdfType);
|
|
7
|
+
});
|
|
8
|
+
const properties = {};
|
|
9
|
+
for (const property of this.properties) {
|
|
10
|
+
property.schema.ifJust((propertySchema) => {
|
|
11
|
+
properties[property.name] = propertySchema;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
invariant(Object.keys(properties).length > 0);
|
|
15
|
+
schema["properties"] = properties;
|
|
16
|
+
return code `${schema} as const`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ObjectType_schemaExpression.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { invariant } from "ts-invariant";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_schemaTypeExpression() {
|
|
4
|
+
const schemaType = {};
|
|
5
|
+
this.fromRdfType.ifJust(() => {
|
|
6
|
+
schemaType["fromRdfType"] = code `${this.reusables.imports.NamedNode}`;
|
|
7
|
+
});
|
|
8
|
+
const properties = {};
|
|
9
|
+
for (const property of this.properties) {
|
|
10
|
+
property.schemaType.ifJust((propertySchemaType) => {
|
|
11
|
+
properties[property.name] = propertySchemaType;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
invariant(Object.keys(properties).length > 0);
|
|
15
|
+
schemaType["properties"] = properties;
|
|
16
|
+
return code `${schemaType}`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ObjectType_schemaTypeExpression.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import type { Reusables } from "../Reusables.js";
|
|
3
2
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
3
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
4
|
export declare function ObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
6
|
-
readonly
|
|
5
|
+
readonly name: string;
|
|
7
6
|
readonly configuration: TsGenerator.Configuration;
|
|
8
7
|
readonly filterType: Code;
|
|
9
8
|
readonly reusables: Reusables;
|
|
10
|
-
}):
|
|
9
|
+
}): Code;
|
|
11
10
|
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { camelCase } from "change-case";
|
|
2
|
-
import { Maybe } from "purify-ts";
|
|
3
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
4
3
|
export function ObjectType_sparqlConstructQueryFunctionDeclaration() {
|
|
5
|
-
|
|
6
|
-
return Maybe.empty();
|
|
7
|
-
}
|
|
8
|
-
return Maybe.of(code `\
|
|
4
|
+
return code `\
|
|
9
5
|
export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages, prefixes, subject, ...queryParameters }: { filter?: ${this.filterType}; ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; preferredLanguages?: readonly string[]; subject: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable} } & Omit<${this.reusables.imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type">): ${this.reusables.imports.sparqljs}.ConstructQuery {
|
|
10
|
-
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.
|
|
6
|
+
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.name)}";
|
|
11
7
|
|
|
12
8
|
return {
|
|
13
9
|
...queryParameters,
|
|
14
10
|
prefixes: prefixes ?? {},
|
|
15
11
|
queryType: "CONSTRUCT",
|
|
16
12
|
template: (queryParameters.template ?? []).concat(
|
|
17
|
-
${this.
|
|
13
|
+
${this.name}.focusSparqlConstructTriples({
|
|
18
14
|
filter,
|
|
19
15
|
focusIdentifier: subject,
|
|
20
16
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -24,7 +20,7 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
24
20
|
type: "query",
|
|
25
21
|
where: (queryParameters.where ?? []).concat(
|
|
26
22
|
${this.reusables.snippets.normalizeSparqlWherePatterns}(
|
|
27
|
-
${this.
|
|
23
|
+
${this.name}.focusSparqlWherePatterns({
|
|
28
24
|
filter,
|
|
29
25
|
focusIdentifier: subject,
|
|
30
26
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -34,6 +30,6 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
34
30
|
)
|
|
35
31
|
)
|
|
36
32
|
};
|
|
37
|
-
}
|
|
33
|
+
}`;
|
|
38
34
|
}
|
|
39
35
|
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import type { Reusables } from "../Reusables.js";
|
|
3
2
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
3
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
4
|
export declare function ObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
6
|
-
readonly
|
|
5
|
+
readonly name: string;
|
|
7
6
|
readonly configuration: TsGenerator.Configuration;
|
|
8
7
|
readonly filterType: Code;
|
|
9
8
|
readonly reusables: Reusables;
|
|
10
|
-
}):
|
|
9
|
+
}): Code;
|
|
11
10
|
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
1
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
2
|
export function ObjectType_sparqlConstructQueryStringFunctionDeclaration() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.alias}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
|
|
9
|
-
return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.alias}.sparqlConstructQuery(parameters));
|
|
10
|
-
}`);
|
|
3
|
+
return code `\
|
|
4
|
+
export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.name}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
|
|
5
|
+
return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.name}.sparqlConstructQuery(parameters));
|
|
6
|
+
}`;
|
|
11
7
|
}
|
|
12
8
|
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
|