@shaclmate/compiler 4.0.41 → 4.0.43
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 -0
- package/dist/ShapesGraphToAstTransformer.js +11 -43
- 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} +2 -2
- package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.js → transformShapeToAstStructType.js} +35 -29
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +2 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +9 -4
- package/dist/ast/AbstractCompoundType.d.ts +2 -2
- package/dist/ast/AbstractCompoundType.js +4 -4
- 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 -10
- 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 -4
- 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 +4 -4
- 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 -27
- package/dist/ast/{ObjectType.js → StructType.js} +81 -78
- 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 +2 -2
- package/dist/generators/transformAstToLabeledPropertyGraph.js +8 -8
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
- package/dist/generators/ts/AbstractContainerType.js +6 -6
- package/dist/generators/ts/AbstractDateType.d.ts +1 -7
- package/dist/generators/ts/AbstractDateType.js +1 -11
- package/dist/generators/ts/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +7 -7
- package/dist/generators/ts/{AbstractLazyObjectType.js → AbstractLazyType.js} +19 -17
- package/dist/generators/ts/AbstractLiteralType.d.ts +2 -5
- package/dist/generators/ts/AbstractLiteralType.js +0 -21
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -7
- package/dist/generators/ts/AbstractNumericType.js +15 -25
- package/dist/generators/ts/AbstractObjectSetType.d.ts +1 -1
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -1
- package/dist/generators/ts/AbstractPrimitiveType.js +1 -1
- package/dist/generators/ts/AbstractTermType.d.ts +6 -21
- package/dist/generators/ts/AbstractTermType.js +26 -55
- package/dist/generators/ts/AbstractType.d.ts +40 -47
- package/dist/generators/ts/AbstractType.js +17 -6
- package/dist/generators/ts/BigDecimalType.d.ts +3 -3
- package/dist/generators/ts/BigDecimalType.js +3 -8
- package/dist/generators/ts/BigIntType.d.ts +2 -2
- package/dist/generators/ts/BigIntType.js +7 -4
- package/dist/generators/ts/BlankNodeType.d.ts +2 -7
- package/dist/generators/ts/BlankNodeType.js +2 -7
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +12 -14
- 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 +8 -8
- package/dist/generators/ts/DefaultValueType.js +10 -12
- package/dist/generators/ts/FloatType.d.ts +2 -2
- package/dist/generators/ts/FloatType.js +7 -4
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +2 -7
- package/dist/generators/ts/IntType.d.ts +2 -2
- package/dist/generators/ts/IntType.js +7 -4
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +12 -14
- package/dist/generators/ts/{LazyObjectOptionType.d.ts → LazyOptionType.d.ts} +12 -11
- package/dist/generators/ts/{LazyObjectOptionType.js → LazyOptionType.js} +23 -14
- package/dist/generators/ts/LazySetType.d.ts +20 -0
- package/dist/generators/ts/{LazyObjectSetType.js → LazySetType.js} +22 -13
- package/dist/generators/ts/LazyType.d.ts +19 -0
- package/dist/generators/ts/{LazyObjectType.js → LazyType.js} +22 -13
- package/dist/generators/ts/ListType.d.ts +1 -1
- package/dist/generators/ts/ListType.js +9 -19
- package/dist/generators/ts/LiteralType.d.ts +3 -2
- package/dist/generators/ts/LiteralType.js +6 -2
- package/dist/generators/ts/ObjectType.d.ts +16 -3
- package/dist/generators/ts/ObjectType.js +301 -91
- package/dist/generators/ts/ObjectUnionType.js +40 -40
- package/dist/generators/ts/OptionType.d.ts +2 -2
- package/dist/generators/ts/OptionType.js +7 -5
- package/dist/generators/ts/SetType.d.ts +3 -3
- package/dist/generators/ts/SetType.js +8 -10
- package/dist/generators/ts/Snippets.d.ts +26 -8
- package/dist/generators/ts/Snippets.js +161 -35
- package/dist/generators/ts/StringType.d.ts +4 -3
- package/dist/generators/ts/StringType.js +18 -11
- package/dist/generators/ts/TermType.d.ts +7 -5
- package/dist/generators/ts/TermType.js +28 -9
- package/dist/generators/ts/TsGenerator.js +11 -6
- package/dist/generators/ts/Type.d.ts +4 -4
- package/dist/generators/ts/TypeFactory.d.ts +5 -5
- package/dist/generators/ts/TypeFactory.js +79 -58
- package/dist/generators/ts/UnionType.d.ts +23 -18
- package/dist/generators/ts/UnionType.js +227 -221
- package/dist/generators/ts/ZodGenerator.js +15 -7
- package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +24 -15
- package/dist/generators/ts/_ObjectType/AbstractProperty.js +1 -24
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +8 -6
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +11 -24
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +8 -2
- package/dist/generators/ts/_ObjectType/IdentifierProperty.js +44 -16
- 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_equalsFunctionDeclaration.js → ObjectType_equalsFunctionExpression.js} +6 -10
- 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} +6 -8
- 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 -9
- 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} +5 -9
- 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_fromRdfResourceFunctionDeclaration.js → ObjectType_fromRdfResourceFunctionExpression.js} +8 -16
- 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/{identifierTypeDeclarations.js → ObjectType_identifierTypeDeclarations.js} +2 -5
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +3 -3
- 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_jsonSchemaFunctionDeclaration.js → ObjectType_jsonSchemaExpression.js} +3 -10
- 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} +6 -12
- 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 +65 -33
- 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_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_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 +511 -386
- package/dist/input/generated.js +1780 -2293
- package/package.json +2 -2
- 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/LazyObjectSetType.d.ts +0 -20
- package/dist/generators/ts/LazyObjectType.d.ts +0 -19
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +0 -44
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -21
- 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 -18
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- 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 -41
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +0 -12
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +0 -20
- 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 -29
- 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/_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_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
|
@@ -31,7 +31,10 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
31
31
|
get constructorParameter() {
|
|
32
32
|
const conversionFunction = this.type.conversionFunction.extract();
|
|
33
33
|
if (!conversionFunction) {
|
|
34
|
-
return Maybe.of(
|
|
34
|
+
return Maybe.of({
|
|
35
|
+
hasQuestionToken: false,
|
|
36
|
+
signature: code `readonly ${this.name}: ${this.type.expression};`,
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
let hasQuestionToken = false;
|
|
37
40
|
const typeExpressions = [];
|
|
@@ -43,19 +46,21 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
43
46
|
typeExpressions.push(code `${type.expression}`);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
return Maybe.of(
|
|
49
|
+
return Maybe.of({
|
|
50
|
+
hasQuestionToken,
|
|
51
|
+
signature: code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeExpressions, { on: "|" })};`,
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
get declaration() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
lhs.push(code `readonly`);
|
|
52
|
-
}
|
|
53
|
-
lhs.push(code `${this.name}`);
|
|
54
|
-
return code `${this.comment
|
|
55
|
+
let declaration = code `${!this.mutable ? "readonly " : ""}${this.name}: ${this.type.expression};`;
|
|
56
|
+
this.comment
|
|
55
57
|
.alt(this.description)
|
|
56
58
|
.alt(this.label)
|
|
57
59
|
.map(tsComment)
|
|
58
|
-
.
|
|
60
|
+
.ifJust((comment) => {
|
|
61
|
+
declaration = code `${comment}${declaration}`;
|
|
62
|
+
});
|
|
63
|
+
return declaration;
|
|
59
64
|
}
|
|
60
65
|
get filterProperty() {
|
|
61
66
|
return Maybe.of({
|
|
@@ -74,6 +79,9 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
74
79
|
type: this.type.graphqlType.expression,
|
|
75
80
|
});
|
|
76
81
|
}
|
|
82
|
+
get hashFunctionParameter() {
|
|
83
|
+
return this.declaration;
|
|
84
|
+
}
|
|
77
85
|
get jsonSchema() {
|
|
78
86
|
let schema = this.type.jsonSchema({
|
|
79
87
|
context: "property",
|
|
@@ -97,20 +105,39 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
97
105
|
const typeJsonType = this.type.jsonType();
|
|
98
106
|
return Maybe.of(code `${!this.mutable ? "readonly " : ""}${this.name}${typeJsonType.optional ? "?" : ""}: ${typeJsonType.requiredExpression}`);
|
|
99
107
|
}
|
|
100
|
-
get
|
|
101
|
-
const initializers =
|
|
108
|
+
get schema() {
|
|
109
|
+
const initializers = [code `kind: ${literalOf(this.kind)}`];
|
|
102
110
|
if (this.configuration.features.has("Object.fromRdf") ||
|
|
103
111
|
this.configuration.features.has("Object.toRdf")) {
|
|
104
112
|
initializers.push(code `path: ${this.propertyPathToCode(this.path)}`);
|
|
105
113
|
}
|
|
106
114
|
// Use a getter if the type is recursive or the type is an object type, which may have forward references in the file
|
|
107
|
-
if (this.recursive || this.type.
|
|
115
|
+
if (this.recursive || this.type.referencesNamedType) {
|
|
108
116
|
initializers.push(code `get type() { return ${this.type.schema}; }`);
|
|
109
117
|
}
|
|
110
118
|
else {
|
|
111
119
|
initializers.push(code `type: ${this.type.schema}`);
|
|
112
120
|
}
|
|
113
|
-
return initializers;
|
|
121
|
+
return Maybe.of(code `{ ${joinCode(initializers, { on: ", " })} }`);
|
|
122
|
+
}
|
|
123
|
+
get schemaType() {
|
|
124
|
+
const initializers = [code `readonly kind: ${literalOf(this.kind)}`];
|
|
125
|
+
if (this.configuration.features.has("Object.fromRdf") ||
|
|
126
|
+
this.configuration.features.has("Object.toRdf")) {
|
|
127
|
+
initializers.push(code `readonly path: ${this.reusables.snippets.PropertyPath}`);
|
|
128
|
+
}
|
|
129
|
+
initializers.push(code `readonly type: ${this.type.schemaType}`);
|
|
130
|
+
return Maybe.of(code `{ ${joinCode(initializers, { on: ", " })} }`);
|
|
131
|
+
}
|
|
132
|
+
get schemaVariable() {
|
|
133
|
+
return this.objectType.name
|
|
134
|
+
.map((name) => code `${name}.schema.properties.${this.name}`)
|
|
135
|
+
.orDefaultLazy(() => this.schema.unsafeCoerce());
|
|
136
|
+
}
|
|
137
|
+
get typeSchemaVariable() {
|
|
138
|
+
return this.objectType.name
|
|
139
|
+
.map((name) => code `${name}.schema.properties.${this.name}.type`)
|
|
140
|
+
.orDefaultLazy(() => this.type.schema);
|
|
114
141
|
}
|
|
115
142
|
constructorInitializer({ variables, }) {
|
|
116
143
|
const parameterVariable = code `${variables.parameters}.${this.name}`;
|
|
@@ -118,13 +145,13 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
118
145
|
const validationFunction = this.type.validationFunction.extract();
|
|
119
146
|
let rhs;
|
|
120
147
|
if (conversionFunction && validationFunction) {
|
|
121
|
-
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.
|
|
148
|
+
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.typeSchemaVariable}, value))`;
|
|
122
149
|
}
|
|
123
150
|
else if (conversionFunction) {
|
|
124
151
|
rhs = code `${conversionFunction}(${parameterVariable})`;
|
|
125
152
|
}
|
|
126
153
|
else if (validationFunction) {
|
|
127
|
-
rhs = code `${validationFunction}(${this.
|
|
154
|
+
rhs = code `${validationFunction}(${this.typeSchemaVariable}, ${parameterVariable})`;
|
|
128
155
|
}
|
|
129
156
|
else {
|
|
130
157
|
rhs = code `${this.reusables.imports.Either}.of(${parameterVariable})`;
|
|
@@ -137,22 +164,22 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
137
164
|
})}`);
|
|
138
165
|
}
|
|
139
166
|
fromRdfResourceValuesInitializer({ variables, }) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// subject of any statements.
|
|
143
|
-
return Maybe.of(code `${this.name}: ${this.reusables.snippets.shaclPropertyFromRdf}(${{
|
|
167
|
+
const parameters = {
|
|
168
|
+
context: variables.context,
|
|
144
169
|
graph: variables.graph,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
focusResource: variables.focusResource,
|
|
171
|
+
// Assume the property has the correct range and ignore the object's RDF type.
|
|
172
|
+
// This also accommodates the case where the object of a property is a dangling identifier that's not the
|
|
173
|
+
// subject of any statements.
|
|
174
|
+
ignoreRdfType: true,
|
|
175
|
+
preferredLanguages: variables.preferredLanguages,
|
|
176
|
+
propertySchema: this.schemaVariable,
|
|
177
|
+
typeFromRdfResourceValues: this.type.fromRdfResourceValuesFunction,
|
|
178
|
+
};
|
|
179
|
+
if (this.configuration.features.has("ObjectSet")) {
|
|
180
|
+
parameters["objectSet"] = variables.objectSet;
|
|
181
|
+
}
|
|
182
|
+
return Maybe.of(code `${this.name}: ${this.reusables.snippets.shaclPropertyFromRdf}<${this.type.expression}, ${this.type.schemaType}>(${parameters})`);
|
|
156
183
|
}
|
|
157
184
|
hashStatements({ variables, }) {
|
|
158
185
|
return [
|
|
@@ -173,7 +200,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
173
200
|
focusIdentifier: variables.focusIdentifier,
|
|
174
201
|
ignoreRdfType: true,
|
|
175
202
|
propertyName: this.name,
|
|
176
|
-
propertySchema:
|
|
203
|
+
propertySchema: this.schemaVariable,
|
|
177
204
|
typeSparqlConstructTriples: this.type.valueSparqlConstructTriplesFunction,
|
|
178
205
|
variablePrefix: variables.variablePrefix,
|
|
179
206
|
}})`);
|
|
@@ -188,7 +215,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
188
215
|
ignoreRdfType: true,
|
|
189
216
|
preferredLanguages: variables.preferredLanguages,
|
|
190
217
|
propertyName: this.name,
|
|
191
|
-
propertySchema:
|
|
218
|
+
propertySchema: this.schemaVariable,
|
|
192
219
|
typeSparqlWherePatterns: this.type.valueSparqlWherePatternsFunction,
|
|
193
220
|
variablePrefix: variables.variablePrefix,
|
|
194
221
|
}})`,
|
|
@@ -209,7 +236,9 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
209
236
|
default:
|
|
210
237
|
return [];
|
|
211
238
|
}
|
|
212
|
-
const propertyPath =
|
|
239
|
+
const propertyPath = this.objectType.name
|
|
240
|
+
.map(() => code `${this.schemaVariable}.path`)
|
|
241
|
+
.orDefault(this.propertyPathToCode(this.path));
|
|
213
242
|
return [
|
|
214
243
|
code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfResourceValuesExpression({
|
|
215
244
|
variables: { ...variables, propertyPath },
|
|
@@ -255,4 +284,7 @@ __decorate([
|
|
|
255
284
|
__decorate([
|
|
256
285
|
Memoize()
|
|
257
286
|
], ShaclProperty.prototype, "jsonSignature", null);
|
|
287
|
+
__decorate([
|
|
288
|
+
Memoize()
|
|
289
|
+
], ShaclProperty.prototype, "schemaVariable", null);
|
|
258
290
|
//# sourceMappingURL=ShaclProperty.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_BooleanSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}BooleanSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}BooleanSchema<
|
|
4
|
-
readonly
|
|
2
|
+
export const snippets_BooleanSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}BooleanSchema`, code `\
|
|
3
|
+
interface ${syntheticNamePrefix}BooleanSchema<BooleanT extends boolean> {
|
|
4
|
+
readonly hasValues?: readonly ${imports.Literal}[];
|
|
5
|
+
readonly in?: readonly BooleanT[];
|
|
5
6
|
readonly kind: "Boolean";
|
|
6
7
|
}`);
|
|
7
8
|
//# sourceMappingURL=snippets_BooleanSchema.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_DateSchema = ({ syntheticNamePrefix }) => conditionalOutput(`${syntheticNamePrefix}DateSchema`, code `\
|
|
2
|
+
export const snippets_DateSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DateSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}DateSchema {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
readonly hasValues?: readonly ${imports.Literal}[];
|
|
5
|
+
readonly in?: readonly Date[];
|
|
6
|
+
readonly kind: "Date" | "DateTime",
|
|
6
7
|
}`);
|
|
7
8
|
//# sourceMappingURL=snippets_DateSchema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_DefaultValueSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DefaultValueSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}DefaultValueSchema<
|
|
4
|
-
readonly defaultValue:
|
|
2
|
+
export const snippets_DefaultValueSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DefaultValueSchema`, code `\
|
|
3
|
+
interface ${syntheticNamePrefix}DefaultValueSchema<ItemSchemaT> {
|
|
4
|
+
readonly defaultValue: ${imports.Literal} | ${imports.NamedNode};
|
|
5
5
|
readonly itemType: ItemSchemaT;
|
|
6
6
|
readonly kind: "DefaultValue";
|
|
7
7
|
}`);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_FromRdfResourceValuesFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromRdfResourceValuesFunction`, code `\
|
|
3
|
-
export type ${syntheticNamePrefix}FromRdfResourceValuesFunction<
|
|
4
|
-
resourceValues: ${imports.
|
|
3
|
+
export type ${syntheticNamePrefix}FromRdfResourceValuesFunction<ValueT, ValueSchemaT> = (
|
|
4
|
+
resourceValues: ${imports.Resource}.Values,
|
|
5
5
|
options: {
|
|
6
6
|
context?: unknown;
|
|
7
7
|
graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
|
|
8
|
+
focusResource: ${imports.Resource};
|
|
8
9
|
ignoreRdfType?: boolean;
|
|
9
|
-
${configuration.features.has("ObjectSet") ? code `objectSet
|
|
10
|
+
${configuration.features.has("ObjectSet") ? code `objectSet: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
11
|
preferredLanguages?: readonly string[];
|
|
11
12
|
propertyPath: ${syntheticNamePrefix}PropertyPath;
|
|
12
|
-
|
|
13
|
+
schema: ValueSchemaT;
|
|
13
14
|
}
|
|
14
|
-
) => ${imports.Either}<Error, ${imports.Resource}.Values<
|
|
15
|
+
) => ${imports.Either}<Error, ${imports.Resource}.Values<ValueT>>;`);
|
|
15
16
|
//# sourceMappingURL=snippets_FromRdfResourceValuesFunction.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_IdentifierSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}IdentifierSchema`, code `\
|
|
2
|
+
export const snippets_IdentifierSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}IdentifierSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}IdentifierSchema {
|
|
4
|
+
readonly hasValues?: readonly ${imports.NamedNode}[];
|
|
4
5
|
readonly kind: "Identifier";
|
|
5
6
|
}`);
|
|
6
7
|
//# sourceMappingURL=snippets_IdentifierSchema.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_IriSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}IriSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}IriSchema<IriT extends string = string> {
|
|
4
|
+
readonly hasValues?: readonly ${imports.NamedNode}[];
|
|
4
5
|
readonly in?: readonly ${imports.NamedNode}<IriT>[];
|
|
5
6
|
readonly kind: "Iri";
|
|
6
7
|
}`);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_Lazy = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}Lazy`, code `\
|
|
3
|
+
/**
|
|
4
|
+
* Type of lazy properties that return a single required value. This is a class instead of an interface so it can be instanceof'd elsewhere.
|
|
5
|
+
*/
|
|
6
|
+
export class ${syntheticNamePrefix}Lazy<PartialT, ResolvedT> {
|
|
7
|
+
readonly partial: PartialT;
|
|
8
|
+
private readonly resolver: (partial: PartialT, options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, ResolvedT>>;
|
|
9
|
+
|
|
10
|
+
constructor({ partial, resolver }: {
|
|
11
|
+
partial: PartialT
|
|
12
|
+
resolver: (partial: PartialT, options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, ResolvedT>>,
|
|
13
|
+
}) {
|
|
14
|
+
this.partial = partial;
|
|
15
|
+
this.resolver = resolver;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
resolve(options?: { preferredLanguages?: readonly string[] }): Promise<${imports.Either}<Error, ResolvedT>> {
|
|
19
|
+
return this.resolver(this.partial, options);
|
|
20
|
+
}
|
|
21
|
+
}`);
|
|
22
|
+
//# sourceMappingURL=snippets_Lazy.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_LazyOption = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}LazyOption`, code `\
|
|
3
|
+
/**
|
|
4
|
+
* Type of lazy properties that return a single optional value. This is a class instead of an interface so it can be instanceof'd elsewhere.
|
|
5
|
+
*/
|
|
6
|
+
export class ${syntheticNamePrefix}LazyOption<PartialT, ResolvedT> {
|
|
7
|
+
readonly partial: ${imports.Maybe}<PartialT>;
|
|
8
|
+
private readonly resolver: (partial: PartialT, options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, ResolvedT>>;
|
|
9
|
+
|
|
10
|
+
constructor({ partial, resolver }: {
|
|
11
|
+
partial: ${imports.Maybe}<PartialT>
|
|
12
|
+
resolver: (partial: PartialT, options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, ResolvedT>>,
|
|
13
|
+
}) {
|
|
14
|
+
this.partial = partial;
|
|
15
|
+
this.resolver = resolver;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async resolve(options?: { preferredLanguages?: readonly string[] }): Promise<${imports.Either}<Error, ${imports.Maybe}<ResolvedT>>> {
|
|
19
|
+
if (this.partial.isNothing()) {
|
|
20
|
+
return ${imports.Right}(${imports.Maybe}.empty());
|
|
21
|
+
}
|
|
22
|
+
return (await this.resolver(this.partial.unsafeCoerce(), options)).map(${imports.Maybe}.of);
|
|
23
|
+
}
|
|
24
|
+
}`);
|
|
25
|
+
//# sourceMappingURL=snippets_LazyOption.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_LazySet = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}LazySet`, code `\
|
|
3
|
+
/**
|
|
4
|
+
* Type of lazy properties that return a set of values. This is a class instead of an interface so it can be instanceof'd elsewhere.
|
|
5
|
+
*/
|
|
6
|
+
export class ${syntheticNamePrefix}LazySet<PartialT, ResolvedT> {
|
|
7
|
+
readonly partials: readonly PartialT[];
|
|
8
|
+
private readonly resolver: (partials: readonly PartialT[], options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, readonly ResolvedT[]>>;
|
|
9
|
+
|
|
10
|
+
constructor({ partials, resolver }: {
|
|
11
|
+
partials: readonly PartialT[]
|
|
12
|
+
resolver: (partials: readonly PartialT[], options?: { preferredLanguages?: readonly string[] }) => Promise<${imports.Either}<Error, readonly ResolvedT[]>>,
|
|
13
|
+
}) {
|
|
14
|
+
this.partials = partials;
|
|
15
|
+
this.resolver = resolver;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get length(): number {
|
|
19
|
+
return this.partials.length;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async resolve(options?: { limit?: number; offset?: number; preferredLanguages?: readonly string[] }): Promise<${imports.Either}<Error, readonly ResolvedT[]>> {
|
|
23
|
+
if (this.partials.length === 0) {
|
|
24
|
+
return ${imports.Right}([]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const limit = options?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
28
|
+
if (limit <= 0) {
|
|
29
|
+
return ${imports.Right}([]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let offset = options?.offset ?? 0;
|
|
33
|
+
if (offset < 0) {
|
|
34
|
+
offset = 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return await this.resolver(this.partials.slice(offset, offset + limit), { preferredLanguages: options?.preferredLanguages });
|
|
38
|
+
}
|
|
39
|
+
}`);
|
|
40
|
+
//# sourceMappingURL=snippets_LazySet.js.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_LiteralFilter = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}LiteralFilter`, code `\
|
|
3
|
-
|
|
4
|
-
readonly in?: readonly ${imports.Literal}[];
|
|
5
|
-
}`);
|
|
3
|
+
type ${syntheticNamePrefix}LiteralFilter = Omit<${snippets.TermFilter}<${imports.Literal}>, "typeIn">;`);
|
|
6
4
|
//# sourceMappingURL=snippets_LiteralFilter.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_LiteralSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}LiteralSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}LiteralSchema {
|
|
4
|
+
readonly hasValues?: readonly ${imports.Literal}[];
|
|
4
5
|
readonly in?: readonly ${imports.Literal}[];
|
|
5
6
|
readonly kind: "Literal";
|
|
6
7
|
readonly languageIn?: readonly string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_NumericSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}NumericSchema`, code `\
|
|
2
|
+
export const snippets_NumericSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}NumericSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}NumericSchema<T> {
|
|
4
|
+
readonly hasValues?: readonly ${imports.Literal}[];
|
|
4
5
|
readonly in?: readonly T[];
|
|
5
6
|
readonly kind: "BigDecimal" | "BigInt" | "Float" | "Int";
|
|
6
7
|
}`);
|
|
@@ -19,17 +19,15 @@ export function filter(_filter: Filter, _value: ${syntheticNamePrefix}PropertyPa
|
|
|
19
19
|
if (configuration.features.has("Object.fromRdf")) {
|
|
20
20
|
companionDeclarations.push(code `\
|
|
21
21
|
export const fromRdfResource: ${snippets.FromRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.fromResource;`, code `\
|
|
22
|
-
export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${syntheticNamePrefix}PropertyPath> = (values, options) =>
|
|
23
|
-
values.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.chain((resource) => fromRdfResource(resource, options)),
|
|
28
|
-
),
|
|
22
|
+
export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${syntheticNamePrefix}PropertyPath, object> = (values, options) =>
|
|
23
|
+
values.chainMap((value) =>
|
|
24
|
+
value
|
|
25
|
+
.toResource()
|
|
26
|
+
.chain((resource) => fromRdfResource(resource, options)),
|
|
29
27
|
);`);
|
|
30
28
|
}
|
|
31
29
|
if (configuration.features.has("Object.schema")) {
|
|
32
|
-
companionDeclarations.push(code `export const schema: Readonly<object> = {}`);
|
|
30
|
+
companionDeclarations.push(code `export const schema: Readonly<object> = {};`, code `export type Schema = typeof schema;`);
|
|
33
31
|
}
|
|
34
32
|
if (configuration.features.has("Object.toRdf")) {
|
|
35
33
|
companionDeclarations.push(code `\
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_RdfVocabularies = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}RdfVocabularies`, code `\
|
|
3
3
|
namespace ${syntheticNamePrefix}RdfVocabularies {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
4
|
+
export const rdf = {
|
|
5
|
+
first: ${imports.dataFactory}.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),
|
|
6
|
+
nil: ${imports.dataFactory}.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"),
|
|
7
|
+
rest: ${imports.dataFactory}.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),
|
|
8
|
+
subject: ${imports.dataFactory}.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"),
|
|
9
|
+
type: ${imports.dataFactory}.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
|
|
10
|
+
};
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
}
|
|
12
|
+
export const rdfs = {
|
|
13
|
+
subClassOf: ${imports.dataFactory}.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf")
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
16
|
+
export const xsd = {
|
|
17
|
+
boolean: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),
|
|
18
|
+
byte: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#byte"),
|
|
19
|
+
date: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#date"),
|
|
20
|
+
dateTime: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),
|
|
21
|
+
decimal: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),
|
|
22
|
+
double: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#double"),
|
|
23
|
+
float: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#float"),
|
|
24
|
+
int: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#int"),
|
|
25
|
+
integer: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#integer"),
|
|
26
|
+
long: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#long"),
|
|
27
|
+
negativeInteger: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#negativeInteger"),
|
|
28
|
+
nonNegativeInteger: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#nonNegativeInteger"),
|
|
29
|
+
nonPositiveInteger: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#nonPositiveInteger"),
|
|
30
|
+
positiveInteger: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#positiveInteger"),
|
|
31
|
+
short: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#short"),
|
|
32
|
+
string: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#string"),
|
|
33
|
+
unsignedByte: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#unsignedByte"),
|
|
34
|
+
unsignedInt: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#unsignedInt"),
|
|
35
|
+
unsignedLong: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#unsignedLong"),
|
|
36
|
+
unsignedShort: ${imports.dataFactory}.namedNode("http://www.w3.org/2001/XMLSchema#unsignedShort")
|
|
37
|
+
};
|
|
38
38
|
}
|
|
39
39
|
`);
|
|
40
40
|
//# sourceMappingURL=snippets_RdfVocabularies.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_ShaclPropertySchema = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ShaclPropertySchema`, code `\
|
|
3
|
-
export interface ${syntheticNamePrefix}ShaclPropertySchema<TypeSchemaT
|
|
3
|
+
export interface ${syntheticNamePrefix}ShaclPropertySchema<TypeSchemaT> {
|
|
4
4
|
readonly kind: "Shacl";
|
|
5
5
|
readonly path: ${snippets.PropertyPath};
|
|
6
6
|
readonly type: TypeSchemaT;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_StringSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}StringSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}StringSchema<
|
|
4
|
-
readonly
|
|
2
|
+
export const snippets_StringSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}StringSchema`, code `\
|
|
3
|
+
interface ${syntheticNamePrefix}StringSchema<StringT extends string> {
|
|
4
|
+
readonly hasValues?: readonly ${imports.Literal}[];
|
|
5
|
+
readonly in?: readonly StringT[];
|
|
6
|
+
readonly languageIn?: readonly string[];
|
|
5
7
|
readonly kind: "String";
|
|
6
8
|
}`);
|
|
7
9
|
//# sourceMappingURL=snippets_StringSchema.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_TermFilter = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}TermFilter`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}TermFilter {
|
|
3
|
+
interface ${syntheticNamePrefix}TermFilter<TermT extends ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}> {
|
|
4
4
|
readonly datatypeIn?: readonly ${imports.NamedNode}[];
|
|
5
|
-
readonly in?: readonly
|
|
5
|
+
readonly in?: readonly Exclude<TermT, ${imports.BlankNode}>[];
|
|
6
6
|
readonly languageIn?: readonly string[];
|
|
7
|
-
readonly typeIn?: readonly
|
|
7
|
+
readonly typeIn?: readonly TermT["termType"][];
|
|
8
8
|
}`);
|
|
9
9
|
//# sourceMappingURL=snippets_TermFilter.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_TermSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}TermSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}TermSchema {
|
|
4
|
-
readonly
|
|
3
|
+
interface ${syntheticNamePrefix}TermSchema<TermT extends ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}> {
|
|
4
|
+
readonly hasValues?: readonly Exclude<TermT, ${imports.BlankNode}>[];
|
|
5
|
+
readonly in?: readonly Exclude<TermT, ${imports.BlankNode}>[];
|
|
5
6
|
readonly kind: "Term";
|
|
7
|
+
readonly types: readonly TermT["termType"][];
|
|
6
8
|
}`);
|
|
7
9
|
//# sourceMappingURL=snippets_TermSchema.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_bigDecimalFromRdfResourceValues = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalFromRdfResourceValues`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}bigDecimalFromRdfResourceValues(values: ${imports.Resource}.Values, options: Parameters<${snippets.FromRdfResourceValuesFunction}<${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>>>[1]): ${imports.Either}<Error, ${imports.Resource}.Values<${imports.BigDecimal}>> {
|
|
4
|
+
return ${snippets.termLikeFromRdfResourceValues}(values, options).chain(values => values.chainMap(value => value.toLiteral().chain(${snippets.decodeBigDecimalLiteral})));
|
|
5
|
+
}`);
|
|
6
|
+
//# sourceMappingURL=snippets_bigDecimalFromRdfResourceValues.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_bigIntFromRdfResourceValues = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntFromRdfResourceValues`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}bigIntFromRdfResourceValues<BigintT extends bigint>(values: ${imports.Resource}.Values, options: Parameters<${snippets.FromRdfResourceValuesFunction}<BigintT, ${snippets.NumericSchema}<BigintT>>>[1]): ${imports.Either}<Error, ${imports.Resource}.Values<BigintT>> {
|
|
4
|
+
return ${snippets.termLikeFromRdfResourceValues}(values, options).chain(values => values.chainMap(value => options.schema.in ? value.toBigInt(options.schema.in) : value.toBigInt() as ${imports.Either}<Error, BigintT>));
|
|
5
|
+
}`);
|
|
6
|
+
//# sourceMappingURL=snippets_bigIntFromRdfResourceValues.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_blankNodeFromRdfResourceValues = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeFromRdfResourceValues`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}blankNodeFromRdfResourceValues(values: ${imports.Resource}.Values, _options: Parameters<${snippets.FromRdfResourceValuesFunction}<${imports.BlankNode}, ${snippets.BlankNodeSchema}>>[1]): ${imports.Either}<Error, ${imports.Resource}.Values<${imports.BlankNode}>> {
|
|
4
|
+
return values.chainMap(value => value.toBlankNode());
|
|
5
|
+
}`);
|
|
6
|
+
//# sourceMappingURL=snippets_blankNodeFromRdfResourceValues.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_booleanFromRdfResourceValues = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanFromRdfResourceValues`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}booleanFromRdfResourceValues<BooleanT extends boolean>(values: ${imports.Resource}.Values, options: Parameters<${snippets.FromRdfResourceValuesFunction}<BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, ${imports.Resource}.Values<BooleanT>> {
|
|
4
|
+
return ${snippets.termLikeFromRdfResourceValues}(values, options).chain(values => values.chainMap(value => options.schema.in ? value.toBoolean(options.schema.in) : value.toBoolean() as ${imports.Either}<Error, BooleanT>));
|
|
5
|
+
}`);
|
|
6
|
+
//# sourceMappingURL=snippets_booleanFromRdfResourceValues.js.map
|