@shaclmate/compiler 4.0.29 → 4.0.30
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/shapeAstTypeName.js +0 -4
- package/dist/generators/ts/AbstractCollectionType.js +13 -15
- package/dist/generators/ts/AbstractDateType.js +6 -8
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractIdentifierType.js +9 -5
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +2 -3
- package/dist/generators/ts/AbstractLazyObjectType.js +2 -5
- package/dist/generators/ts/AbstractLiteralType.js +2 -3
- package/dist/generators/ts/AbstractNamedUnionType.js +39 -41
- package/dist/generators/ts/AbstractNumericType.js +8 -11
- package/dist/generators/ts/AbstractPrimitiveType.js +1 -2
- package/dist/generators/ts/AbstractTermType.js +10 -13
- package/dist/generators/ts/AbstractType.d.ts +8 -2
- package/dist/generators/ts/AbstractType.js +15 -5
- package/dist/generators/ts/AbstractUnionType.js +17 -19
- package/dist/generators/ts/BigDecimalType.d.ts +3 -3
- package/dist/generators/ts/BigDecimalType.js +24 -21
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +9 -5
- package/dist/generators/ts/BlankNodeType.js +9 -11
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.js +13 -11
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +14 -3
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +14 -3
- package/dist/generators/ts/DefaultValueType.js +5 -8
- package/dist/generators/ts/FloatType.d.ts +1 -1
- package/dist/generators/ts/FloatType.js +13 -2
- package/dist/generators/ts/IdentifierType.js +9 -11
- package/dist/generators/ts/{imports.d.ts → Imports.d.ts} +3 -3
- package/dist/generators/ts/Imports.js +41 -0
- package/dist/generators/ts/IntType.d.ts +1 -1
- package/dist/generators/ts/IntType.js +13 -2
- package/dist/generators/ts/IriType.js +15 -20
- package/dist/generators/ts/LazyObjectOptionType.d.ts +8 -8
- package/dist/generators/ts/LazyObjectOptionType.js +21 -26
- package/dist/generators/ts/LazyObjectSetType.d.ts +5 -1
- package/dist/generators/ts/LazyObjectSetType.js +12 -20
- package/dist/generators/ts/LazyObjectType.d.ts +5 -1
- package/dist/generators/ts/LazyObjectType.js +20 -18
- package/dist/generators/ts/ListType.js +11 -14
- package/dist/generators/ts/LiteralType.js +8 -10
- package/dist/generators/ts/NamedObjectType.d.ts +1 -3
- package/dist/generators/ts/NamedObjectType.js +32 -30
- package/dist/generators/ts/NamedObjectUnionType.js +37 -29
- package/dist/generators/ts/OptionType.js +13 -15
- package/dist/generators/ts/Reusables.d.ts +11 -0
- package/dist/generators/ts/Reusables.js +14 -0
- package/dist/generators/ts/SetType.js +4 -6
- package/dist/generators/ts/Snippet.d.ts +3 -0
- package/dist/generators/ts/Snippet.js +2 -0
- package/dist/generators/ts/SnippetFactory.d.ts +14 -0
- package/dist/generators/ts/SnippetFactory.js +2 -0
- package/dist/generators/ts/Snippets.d.ts +123 -0
- package/dist/generators/ts/Snippets.js +804 -0
- package/dist/generators/ts/StringType.d.ts +2 -2
- package/dist/generators/ts/StringType.js +14 -12
- package/dist/generators/ts/TermType.js +14 -17
- package/dist/generators/ts/TsGenerator.d.ts +7 -1
- package/dist/generators/ts/TsGenerator.js +90 -14
- package/dist/generators/ts/TypeFactory.d.ts +4 -1
- package/dist/generators/ts/TypeFactory.js +29 -3
- package/dist/generators/ts/ZodGenerator.d.ts +1 -0
- package/dist/generators/ts/ZodGenerator.js +10 -8
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +6 -1
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +10 -1
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +3 -4
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -10
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +3 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +2 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +7 -11
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +11 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +2 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +4 -6
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +3 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +3 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +9 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +4 -7
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +2 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +4 -7
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +4 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +2 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +3 -5
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +8 -11
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +4 -5
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_BooleanFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_CollectionFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_DateFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_DateFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_DateSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_DateSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -3
- package/dist/generators/ts/_snippets/snippets_EqualsResult.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_EqualsResult.js +1 -3
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +2 -5
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_Hasher.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_Hasher.js +1 -2
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_IdentifierFilter.js +1 -3
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_IdentifierSet.js +1 -3
- package/dist/generators/ts/_snippets/snippets_IriFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_IriFilter.js +1 -3
- package/dist/generators/ts/_snippets/snippets_IriSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LazyObject.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +1 -3
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +2 -5
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +1 -3
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_MaybeFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_NumericFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_NumericFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_NumericSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_NumericSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +8 -13
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +1 -3
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -4
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.js +1 -3
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_SparqlPattern.js +1 -4
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.js +2 -4
- package/dist/generators/ts/_snippets/snippets_StringFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_StringFilter.js +1 -2
- package/dist/generators/ts/_snippets/snippets_StringSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +1 -2
- package/dist/generators/ts/_snippets/snippets_TermFilter.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_TermFilter.js +1 -3
- package/dist/generators/ts/_snippets/snippets_TermSchema.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_TermSchema.js +1 -3
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +5 -6
- package/dist/generators/ts/_snippets/snippets_UnwrapR.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_UnwrapR.js +1 -3
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +1 -3
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +3 -6
- package/dist/generators/ts/_snippets/snippets_arrayEquals.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_arrayEquals.js +7 -10
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_arrayIntersection.js +1 -2
- package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.js +2 -5
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +11 -19
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -6
- package/dist/generators/ts/_snippets/snippets_booleanEquals.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +4 -6
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +5 -12
- package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_compactRecord.js +1 -2
- package/dist/generators/ts/_snippets/snippets_dateEquals.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_dateEquals.js +4 -6
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +9 -17
- package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.js +1 -3
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.js +3 -5
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +3 -7
- package/dist/generators/ts/_snippets/snippets_filterArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterArray.js +2 -4
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterBigDecimal.js +2 -5
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterBlankNode.js +2 -5
- package/dist/generators/ts/_snippets/snippets_filterBoolean.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterBoolean.js +2 -4
- package/dist/generators/ts/_snippets/snippets_filterDate.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterDate.js +2 -4
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterIdentifier.js +2 -5
- package/dist/generators/ts/_snippets/snippets_filterIri.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterIri.js +2 -5
- package/dist/generators/ts/_snippets/snippets_filterLiteral.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterLiteral.js +3 -7
- package/dist/generators/ts/_snippets/snippets_filterMaybe.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterMaybe.js +2 -5
- package/dist/generators/ts/_snippets/snippets_filterNumeric.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterNumeric.js +2 -4
- package/dist/generators/ts/_snippets/snippets_filterString.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterString.js +2 -4
- package/dist/generators/ts/_snippets/snippets_filterTerm.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_filterTerm.js +2 -5
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -3
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.js +1 -3
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +4 -10
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +5 -12
- package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.js +1 -2
- package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.js +1 -2
- package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.js +1 -2
- package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.js +1 -2
- package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.js +1 -2
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.js +4 -7
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +6 -12
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +9 -18
- package/dist/generators/ts/_snippets/snippets_literalFactory.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_literalFactory.js +1 -3
- package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.js +7 -13
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +3 -8
- package/dist/generators/ts/_snippets/snippets_maybeEquals.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_maybeEquals.js +5 -8
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -6
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +4 -9
- package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.js +9 -14
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +9 -17
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +2 -5
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +1 -3
- package/dist/generators/ts/_snippets/snippets_parseIri.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_parseIri.js +2 -5
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -6
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +3 -8
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +2 -5
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -9
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +8 -15
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.js +5 -7
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.js +3 -6
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -6
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.js +3 -7
- package/dist/generators/ts/_snippets/snippets_strictEquals.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_strictEquals.js +4 -6
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +7 -15
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +4 -9
- package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.js +6 -11
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.d.ts +2 -1
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +3 -9
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -1
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +13 -14
- package/dist/generators/ts/objectSetDeclarations.d.ts +2 -1
- package/dist/generators/ts/objectSetDeclarations.js +3 -3
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +2 -1
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +4 -5
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +2 -1
- package/dist/generators/ts/objectSetMethodSignatures.js +4 -5
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +2 -1
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +49 -51
- package/dist/generators/ts/rdfjsTermExpression.d.ts +6 -2
- package/dist/generators/ts/rdfjsTermExpression.js +13 -15
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +2 -1
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +43 -45
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +2 -1
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +6 -7
- package/dist/input/ShapesGraph.d.ts +4 -4
- package/dist/input/ShapesGraph.js +4 -4
- package/dist/input/generated.d.ts +162 -163
- package/dist/input/generated.js +410 -416
- package/package.json +2 -2
- package/dist/generators/ts/imports.js +0 -41
- package/dist/generators/ts/snippets.d.ts +0 -110
- package/dist/generators/ts/snippets.js +0 -217
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +0 -11
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +0 -68
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { imports } from "../imports.js";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
4
|
-
|
|
5
|
-
import { snippets_SparqlPattern } from "./snippets_SparqlPattern.js";
|
|
6
|
-
import { snippets_sparqlValueInPattern } from "./snippets_sparqlValueInPattern.js";
|
|
7
|
-
export const snippets_termSchemaSparqlPatterns = conditionalOutput(`${syntheticNamePrefix}termSchemaSparqlPatterns`, code `\
|
|
2
|
+
export const snippets_termSchemaSparqlPatterns = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}termSchemaSparqlPatterns`, code `\
|
|
8
3
|
function ${syntheticNamePrefix}termSchemaSparqlPatterns({
|
|
9
4
|
filterPatterns,
|
|
10
5
|
propertyPatterns,
|
|
11
6
|
schema,
|
|
12
7
|
valueVariable
|
|
13
8
|
}: {
|
|
14
|
-
filterPatterns: readonly ${
|
|
15
|
-
propertyPatterns: readonly ${
|
|
9
|
+
filterPatterns: readonly ${snippets.SparqlFilterPattern}[],
|
|
10
|
+
propertyPatterns: readonly ${snippets.SparqlPattern}[];
|
|
16
11
|
schema: Readonly<{
|
|
17
12
|
in?: readonly (bigint | boolean | Date | string | number | ${imports.Literal} | ${imports.NamedNode})[];
|
|
18
13
|
}>,
|
|
19
14
|
valueVariable: ${imports.Variable};
|
|
20
|
-
}): readonly ${
|
|
21
|
-
let patterns: ${
|
|
15
|
+
}): readonly ${snippets.SparqlPattern}[] {
|
|
16
|
+
let patterns: ${snippets.SparqlPattern}[] = propertyPatterns.concat();
|
|
22
17
|
|
|
23
18
|
if (schema.in && schema.in.length > 0) {
|
|
24
|
-
patterns.push(${
|
|
19
|
+
patterns.push(${snippets.sparqlValueInPattern}({ valueVariable, valueIn: schema.in }));
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
return patterns.concat(filterPatterns);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SnippetFactory } from "../SnippetFactory.js";
|
|
2
|
+
export declare const snippets_termSparqlWherePatterns: SnippetFactory;
|
|
2
3
|
//# sourceMappingURL=snippets_termSparqlWherePatterns.d.ts.map
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { snippets_termSchemaSparqlPatterns } from "./snippets_termSchemaSparqlPatterns.js";
|
|
7
|
-
import { snippets_ValueSparqlWherePatternsFunction } from "./snippets_ValueSparqlWherePatternsFunction.js";
|
|
8
|
-
export const snippets_termSparqlWherePatterns = conditionalOutput(`${syntheticNamePrefix}termSparqlWherePatterns`, code `\
|
|
9
|
-
const ${syntheticNamePrefix}termSparqlWherePatterns: ${snippets_ValueSparqlWherePatternsFunction}<${snippets_TermFilter}, ${snippets_TermSchema}> =
|
|
10
|
-
(parameters) => ${snippets_termSchemaSparqlPatterns}({ filterPatterns: ${snippets_termFilterSparqlPatterns}(parameters), ...parameters })`);
|
|
2
|
+
export const snippets_termSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}termSparqlWherePatterns`, code `\
|
|
3
|
+
const ${syntheticNamePrefix}termSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.TermFilter}, ${snippets.TermSchema}> =
|
|
4
|
+
(parameters) => ${snippets.termSchemaSparqlPatterns}({ filterPatterns: ${snippets.termFilterSparqlPatterns}(parameters), ...parameters })`);
|
|
11
5
|
//# sourceMappingURL=snippets_termSparqlWherePatterns.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
3
3
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
4
|
+
import type { TsGenerator } from "./TsGenerator.js";
|
|
4
5
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
|
-
export declare function graphqlSchemaVariableStatement(parameters: {
|
|
6
|
+
export declare function graphqlSchemaVariableStatement(this: TsGenerator, parameters: {
|
|
6
7
|
namedObjectTypes: readonly NamedObjectType[];
|
|
7
8
|
namedObjectUnionTypes: NamedObjectUnionType[];
|
|
8
9
|
}): Maybe<Code>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { imports } from "./imports.js";
|
|
3
2
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
3
|
import { code } from "./ts-poet-wrapper.js";
|
|
5
4
|
function graphqlQueryObjectType({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
6
|
-
return code `new ${imports.GraphQLObjectType}<null, { objectSet: ${syntheticNamePrefix}ObjectSet }>({ name: "Query", fields: ${[
|
|
5
|
+
return code `new ${this.reusables.imports.GraphQLObjectType}<null, { objectSet: ${syntheticNamePrefix}ObjectSet }>({ name: "Query", fields: ${[
|
|
7
6
|
...namedObjectTypes,
|
|
8
7
|
...namedObjectUnionTypes,
|
|
9
8
|
].reduce((fields, namedObjectType) => {
|
|
10
9
|
fields[namedObjectType.objectSetMethodNames.object] = {
|
|
11
10
|
args: {
|
|
12
11
|
identifier: {
|
|
13
|
-
type: code `new ${imports.GraphQLNonNull}(${imports.GraphQLID})`,
|
|
12
|
+
type: code `new ${this.reusables.imports.GraphQLNonNull}(${this.reusables.imports.GraphQLID})`,
|
|
14
13
|
},
|
|
15
14
|
},
|
|
16
15
|
resolve: code `\
|
|
17
16
|
async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.name}> =>
|
|
18
|
-
(await ${imports.EitherAsync}<Error, ${namedObjectType.name}>(async ({ liftEither }) =>
|
|
17
|
+
(await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.name}>(async ({ liftEither }) =>
|
|
19
18
|
liftEither(await objectSet.${namedObjectType.objectSetMethodNames.object}(await liftEither(${namedObjectType.identifierTypeAlias}.parse(args.identifier))))
|
|
20
19
|
)).unsafeCoerce()`,
|
|
21
20
|
type: namedObjectType.graphqlType.name,
|
|
@@ -23,32 +22,32 @@ async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObj
|
|
|
23
22
|
fields[namedObjectType.objectSetMethodNames.objectIdentifiers] = {
|
|
24
23
|
args: {
|
|
25
24
|
limit: {
|
|
26
|
-
type: code `${imports.GraphQLInt}`,
|
|
25
|
+
type: code `${this.reusables.imports.GraphQLInt}`,
|
|
27
26
|
},
|
|
28
27
|
offset: {
|
|
29
|
-
type: code `${imports.GraphQLInt}`,
|
|
28
|
+
type: code `${this.reusables.imports.GraphQLInt}`,
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
31
|
resolve: code `\
|
|
33
32
|
async (_source, args: { limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly string[]> =>
|
|
34
33
|
(await objectSet.${namedObjectType.objectSetMethodNames.objectIdentifiers}({ limit: args.limit !== null ? args.limit : undefined, offset: args.offset !== null ? args.offset : undefined })).unsafeCoerce().map(${namedObjectType.identifierTypeAlias}.stringify)`,
|
|
35
|
-
type: code `new ${imports.GraphQLNonNull}(new ${imports.GraphQLList}(${imports.GraphQLString}))`,
|
|
34
|
+
type: code `new ${this.reusables.imports.GraphQLNonNull}(new ${this.reusables.imports.GraphQLList}(${this.reusables.imports.GraphQLString}))`,
|
|
36
35
|
};
|
|
37
36
|
fields[namedObjectType.objectSetMethodNames.objects] = {
|
|
38
37
|
args: {
|
|
39
38
|
identifiers: {
|
|
40
|
-
type: code `new ${imports.GraphQLList}(new ${imports.GraphQLNonNull}(${imports.GraphQLID}))`,
|
|
39
|
+
type: code `new ${this.reusables.imports.GraphQLList}(new ${this.reusables.imports.GraphQLNonNull}(${this.reusables.imports.GraphQLID}))`,
|
|
41
40
|
},
|
|
42
41
|
limit: {
|
|
43
|
-
type: code `${imports.GraphQLInt}`,
|
|
42
|
+
type: code `${this.reusables.imports.GraphQLInt}`,
|
|
44
43
|
},
|
|
45
44
|
offset: {
|
|
46
|
-
type: code `${imports.GraphQLInt}`,
|
|
45
|
+
type: code `${this.reusables.imports.GraphQLInt}`,
|
|
47
46
|
},
|
|
48
47
|
},
|
|
49
48
|
resolve: code `\
|
|
50
49
|
async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.name}[]> =>
|
|
51
|
-
(await ${imports.EitherAsync}<Error, readonly ${namedObjectType.name}[]>(async ({ liftEither }) => {
|
|
50
|
+
(await ${this.reusables.imports.EitherAsync}<Error, readonly ${namedObjectType.name}[]>(async ({ liftEither }) => {
|
|
52
51
|
let filter: ${namedObjectType.filterType} | undefined;
|
|
53
52
|
if (args.identifiers) {
|
|
54
53
|
const identifiers: ${namedObjectType.identifierTypeAlias}[] = [];
|
|
@@ -59,12 +58,12 @@ async (_source, args: { identifiers: readonly string[] | null; limit: number | n
|
|
|
59
58
|
}
|
|
60
59
|
return await liftEither(await objectSet.${namedObjectType.objectSetMethodNames.objects}({ filter, limit: args.limit !== null ? args.limit : undefined, offset: args.offset !== null ? args.offset : undefined }));
|
|
61
60
|
})).unsafeCoerce()`,
|
|
62
|
-
type: code `new ${imports.GraphQLNonNull}(new ${imports.GraphQLList}(${namedObjectType.graphqlType.name}))`,
|
|
61
|
+
type: code `new ${this.reusables.imports.GraphQLNonNull}(new ${this.reusables.imports.GraphQLList}(${namedObjectType.graphqlType.name}))`,
|
|
63
62
|
};
|
|
64
63
|
fields[namedObjectType.objectSetMethodNames.objectCount] = {
|
|
65
64
|
resolve: code `\
|
|
66
65
|
async (_source, _args, { objectSet }): Promise<number> => (await objectSet.${namedObjectType.objectSetMethodNames.objectCount}()).unsafeCoerce()`,
|
|
67
|
-
type: code `new ${imports.GraphQLNonNull}(${imports.GraphQLInt})`,
|
|
66
|
+
type: code `new ${this.reusables.imports.GraphQLNonNull}(${this.reusables.imports.GraphQLInt})`,
|
|
68
67
|
};
|
|
69
68
|
return fields;
|
|
70
69
|
}, {})} })`;
|
|
@@ -76,7 +75,7 @@ export function graphqlSchemaVariableStatement(parameters) {
|
|
|
76
75
|
return Maybe.empty();
|
|
77
76
|
}
|
|
78
77
|
return Maybe.of(code `\
|
|
79
|
-
export const graphqlSchema = new ${imports.GraphQLSchema}({ query: ${graphqlQueryObjectType({ namedObjectTypes: namedObjectTypes, namedObjectUnionTypes })} });
|
|
78
|
+
export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query: ${graphqlQueryObjectType.call(this, { namedObjectTypes: namedObjectTypes, namedObjectUnionTypes })} });
|
|
80
79
|
`);
|
|
81
80
|
}
|
|
82
81
|
//# sourceMappingURL=graphqlSchemaVariableStatement.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
2
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
|
+
import type { TsGenerator } from "./TsGenerator.js";
|
|
3
4
|
import type { Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function objectSetDeclarations({ namedObjectUnionTypes, ...parameters }: {
|
|
5
|
+
export declare function objectSetDeclarations(this: TsGenerator, { namedObjectUnionTypes, ...parameters }: {
|
|
5
6
|
namedObjectTypes: readonly NamedObjectType[];
|
|
6
7
|
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
8
|
}): readonly Code[];
|
|
@@ -38,19 +38,19 @@ export function objectSetDeclarations({ namedObjectUnionTypes, ...parameters })
|
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
40
|
const declarations = [
|
|
41
|
-
objectSetInterfaceDeclaration({
|
|
41
|
+
objectSetInterfaceDeclaration.call(this, {
|
|
42
42
|
namedObjectTypes: namedObjectTypes,
|
|
43
43
|
namedObjectUnionTypes,
|
|
44
44
|
}),
|
|
45
45
|
];
|
|
46
46
|
if (namedObjectTypesWithRdfFeatureCount > 0) {
|
|
47
|
-
declarations.push(rdfjsDatasetObjectSetClassDeclaration({
|
|
47
|
+
declarations.push(rdfjsDatasetObjectSetClassDeclaration.call(this, {
|
|
48
48
|
namedObjectTypes: namedObjectTypes,
|
|
49
49
|
namedObjectUnionTypes,
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
52
|
if (namedObjectTypesWithSparqlFeatureCount > 0) {
|
|
53
|
-
declarations.push(sparqlObjectSetClassDeclaration({
|
|
53
|
+
declarations.push(sparqlObjectSetClassDeclaration.call(this, {
|
|
54
54
|
namedObjectTypes: namedObjectTypes,
|
|
55
55
|
namedObjectUnionTypes,
|
|
56
56
|
}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
2
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
|
+
import type { TsGenerator } from "./TsGenerator.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function objectSetInterfaceDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
|
+
export declare function objectSetInterfaceDeclaration(this: TsGenerator, { namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
6
|
namedObjectTypes: readonly NamedObjectType[];
|
|
6
7
|
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
8
|
}): Code;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { imports } from "./imports.js";
|
|
2
1
|
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
3
2
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
3
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
@@ -6,17 +5,17 @@ export function objectSetInterfaceDeclaration({ namedObjectTypes, namedObjectUni
|
|
|
6
5
|
return code `\
|
|
7
6
|
export interface ${syntheticNamePrefix}ObjectSet {
|
|
8
7
|
${joinCode(namedObjectTypes
|
|
9
|
-
.flatMap((namedObjectType) => Object.values(objectSetMethodSignatures({ namedObjectType })))
|
|
10
|
-
.concat(namedObjectUnionTypes.flatMap((namedObjectUnionType) => Object.values(objectSetMethodSignatures({
|
|
8
|
+
.flatMap((namedObjectType) => Object.values(objectSetMethodSignatures.call(this, { namedObjectType })))
|
|
9
|
+
.concat(namedObjectUnionTypes.flatMap((namedObjectUnionType) => Object.values(objectSetMethodSignatures.call(this, {
|
|
11
10
|
namedObjectType: namedObjectUnionType,
|
|
12
11
|
}))))
|
|
13
12
|
.map((methodSignature) => code `${methodSignature.name}(${methodSignature.parameters}): ${methodSignature.returnType};`), { on: "\n\n" })}
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export namespace ${syntheticNamePrefix}ObjectSet {
|
|
17
|
-
export interface Query<ObjectFilterT, ObjectIdentifierT extends ${imports.BlankNode} | ${imports.NamedNode}> {
|
|
16
|
+
export interface Query<ObjectFilterT, ObjectIdentifierT extends ${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode}> {
|
|
18
17
|
readonly filter?: ObjectFilterT;
|
|
19
|
-
readonly graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
|
|
18
|
+
readonly graph?: Exclude<${this.reusables.imports.Quad_Graph}, ${this.reusables.imports.Variable}>;
|
|
20
19
|
readonly identifiers?: readonly ObjectIdentifierT[];
|
|
21
20
|
readonly limit?: number;
|
|
22
21
|
readonly offset?: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
|
+
import type { TsGenerator } from "./TsGenerator.js";
|
|
2
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
3
|
-
export declare function objectSetMethodSignatures(parameters: {
|
|
4
|
+
export declare function objectSetMethodSignatures(this: TsGenerator, parameters: {
|
|
4
5
|
namedObjectType: {
|
|
5
6
|
readonly filterType: Code;
|
|
6
7
|
readonly identifierTypeAlias: Code;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { imports } from "./imports.js";
|
|
2
1
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
3
2
|
import { code } from "./ts-poet-wrapper.js";
|
|
4
3
|
export function objectSetMethodSignatures(parameters) {
|
|
@@ -10,22 +9,22 @@ export function objectSetMethodSignatures(parameters) {
|
|
|
10
9
|
object: {
|
|
11
10
|
name: methodNames.object,
|
|
12
11
|
parameters: code `${parameterNamePrefix}identifier: ${namedObjectType.identifierTypeAlias}, options?: { preferredLanguages?: readonly string[]; }`,
|
|
13
|
-
returnType: code `Promise<${imports.Either}<Error, ${namedObjectType.name}>>`,
|
|
12
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, ${namedObjectType.name}>>`,
|
|
14
13
|
},
|
|
15
14
|
objectCount: {
|
|
16
15
|
name: methodNames.objectCount,
|
|
17
16
|
parameters: code `${parameterNamePrefix}query?: Pick<${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>, "filter">`,
|
|
18
|
-
returnType: code `Promise<${imports.Either}<Error, number>>`,
|
|
17
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, number>>`,
|
|
19
18
|
},
|
|
20
19
|
objectIdentifiers: {
|
|
21
20
|
name: methodNames.objectIdentifiers,
|
|
22
21
|
parameters: code `${parameterNamePrefix}query?: ${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>`,
|
|
23
|
-
returnType: code `Promise<${imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]>>`,
|
|
22
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]>>`,
|
|
24
23
|
},
|
|
25
24
|
objects: {
|
|
26
25
|
name: methodNames.objects,
|
|
27
26
|
parameters: code `${parameterNamePrefix}query?: ${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>`,
|
|
28
|
-
returnType: code `Promise<${imports.Either}<Error, readonly ${namedObjectType.name}[]>>`,
|
|
27
|
+
returnType: code `Promise<${this.reusables.imports.Either}<Error, readonly ${namedObjectType.name}[]>>`,
|
|
29
28
|
},
|
|
30
29
|
};
|
|
31
30
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
2
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
|
+
import type { TsGenerator } from "./TsGenerator.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
|
+
export declare function rdfjsDatasetObjectSetClassDeclaration(this: TsGenerator, { namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
6
|
namedObjectTypes: readonly NamedObjectType[];
|
|
6
7
|
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
8
|
}): Code;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { imports } from "./imports.js";
|
|
2
1
|
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
3
|
-
import { snippets } from "./snippets.js";
|
|
4
2
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
5
3
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
6
4
|
import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
|
|
7
5
|
export function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
8
6
|
const namedObjectTypeType = code `\
|
|
9
7
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
|
|
9
|
+
fromRdfResource: ${this.reusables.snippets.FromRdfResourceFunction}<ObjectT>;
|
|
10
|
+
fromRdfTypes: readonly ${this.reusables.imports.NamedNode}[]
|
|
13
11
|
}`;
|
|
14
12
|
const parameters = {
|
|
15
13
|
query: `query?: ${syntheticNamePrefix}ObjectSet.Query<ObjectFilterT, ObjectIdentifierT>`,
|
|
@@ -17,16 +15,16 @@ export function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedO
|
|
|
17
15
|
const typeParameters = {
|
|
18
16
|
ObjectT: code `ObjectT extends { readonly $identifier: () => ObjectIdentifierT }`,
|
|
19
17
|
ObjectFilterT: code `ObjectFilterT`,
|
|
20
|
-
ObjectIdentifierT: code `ObjectIdentifierT extends ${imports.BlankNode} | ${imports.NamedNode}`,
|
|
18
|
+
ObjectIdentifierT: code `ObjectIdentifierT extends ${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode}`,
|
|
21
19
|
};
|
|
22
20
|
return code `\
|
|
23
21
|
export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticNamePrefix}ObjectSet {
|
|
24
|
-
|
|
25
|
-
readonly #
|
|
22
|
+
readonly #dataset: ${this.reusables.imports.DatasetCore} | (() => ${this.reusables.imports.DatasetCore});
|
|
23
|
+
readonly #graph?: Exclude<${this.reusables.imports.Quad_Graph}, ${this.reusables.imports.Variable}>;
|
|
26
24
|
|
|
27
|
-
constructor(dataset: ${imports.DatasetCore} | (() => ${imports.DatasetCore}), options?: { graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}> }) {
|
|
25
|
+
constructor(dataset: ${this.reusables.imports.DatasetCore} | (() => ${this.reusables.imports.DatasetCore}), options?: { graph?: Exclude<${this.reusables.imports.Quad_Graph}, ${this.reusables.imports.Variable}> }) {
|
|
28
26
|
this.#dataset = dataset;
|
|
29
|
-
this
|
|
27
|
+
this.#graph = options?.graph;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
protected ${syntheticNamePrefix}dataset(): DatasetCore {
|
|
@@ -36,18 +34,18 @@ export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticN
|
|
|
36
34
|
return this.#dataset();
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
protected ${syntheticNamePrefix}resourceSet(): ${imports.ResourceSet} {
|
|
40
|
-
return new ${imports.ResourceSet}({ dataFactory: ${imports.dataFactory}, dataset: this.${syntheticNamePrefix}dataset() });
|
|
37
|
+
protected ${syntheticNamePrefix}resourceSet(): ${this.reusables.imports.ResourceSet} {
|
|
38
|
+
return new ${this.reusables.imports.ResourceSet}({ dataFactory: ${this.reusables.imports.dataFactory}, dataset: this.${syntheticNamePrefix}dataset() });
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
${joinCode([
|
|
44
42
|
...[...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
|
|
45
43
|
if (!namedObjectType.features.has("rdf")) {
|
|
46
|
-
return Object.values(unsupportedObjectSetMethodDeclarations({
|
|
44
|
+
return Object.values(unsupportedObjectSetMethodDeclarations.call(this, {
|
|
47
45
|
namedObjectType,
|
|
48
46
|
}));
|
|
49
47
|
}
|
|
50
|
-
const methodSignatures = objectSetMethodSignatures({
|
|
48
|
+
const methodSignatures = objectSetMethodSignatures.call(this, {
|
|
51
49
|
namedObjectType,
|
|
52
50
|
});
|
|
53
51
|
const delegatingMethods = [
|
|
@@ -58,7 +56,7 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
|
|
|
58
56
|
}`,
|
|
59
57
|
// objectSync
|
|
60
58
|
code `\
|
|
61
|
-
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${imports.Either}<Error, ${namedObjectType.name}> {
|
|
59
|
+
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${this.reusables.imports.Either}<Error, ${namedObjectType.name}> {
|
|
62
60
|
return this.${methodSignatures.objects.name}Sync({ identifiers: [identifier], preferredLanguages: options?.preferredLanguages }).map(objects => objects[0]);
|
|
63
61
|
}`,
|
|
64
62
|
// objectCount
|
|
@@ -68,7 +66,7 @@ async ${methodSignatures.objectCount.name}(${methodSignatures.objectCount.parame
|
|
|
68
66
|
}`,
|
|
69
67
|
// objectCountSync
|
|
70
68
|
code `\
|
|
71
|
-
${methodSignatures.objectCount.name}Sync(${methodSignatures.objectCount.parameters}): ${imports.Either}<Error, number> {
|
|
69
|
+
${methodSignatures.objectCount.name}Sync(${methodSignatures.objectCount.parameters}): ${this.reusables.imports.Either}<Error, number> {
|
|
72
70
|
return this.${methodSignatures.objects.name}Sync(query).map(objects => objects.length);
|
|
73
71
|
}`,
|
|
74
72
|
// objectIdentifiers
|
|
@@ -78,7 +76,7 @@ async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdenti
|
|
|
78
76
|
}`,
|
|
79
77
|
// objectIdentifiersSync
|
|
80
78
|
code `\
|
|
81
|
-
${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]> {
|
|
79
|
+
${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]> {
|
|
82
80
|
return this.${methodSignatures.objects.name}Sync(query).map(objects => objects.map(object => object.${syntheticNamePrefix}identifier()));
|
|
83
81
|
}`,
|
|
84
82
|
// objects
|
|
@@ -92,18 +90,18 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
92
90
|
const fromRdfTypes = namedObjectType.fromRdfTypeVariable
|
|
93
91
|
.toList()
|
|
94
92
|
.concat(namedObjectType.descendantFromRdfTypeVariables);
|
|
95
|
-
return code `{
|
|
93
|
+
return code `{ filter: ${filterFunction}, fromRdfResource: ${namedObjectType.name}.fromRdfResource, fromRdfTypes: ${fromRdfTypes.length > 0 ? code `[${joinCode(fromRdfTypes, { on: ", " })}]` : "[]"} }`;
|
|
96
94
|
};
|
|
97
95
|
switch (namedObjectType.kind) {
|
|
98
96
|
case "NamedObjectType": {
|
|
99
97
|
return delegatingMethods.concat(code `\
|
|
100
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
98
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
101
99
|
return this.#objectsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
|
|
102
100
|
}`);
|
|
103
101
|
}
|
|
104
102
|
case "NamedObjectUnionType":
|
|
105
103
|
return delegatingMethods.concat(code `\
|
|
106
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
104
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${this.reusables.imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
107
105
|
return this.#objectUnionsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
|
|
108
106
|
${joinCode(namedObjectType.members.map((member) => runtimeObjectType(namedObjectType.filterFunction, member.type)), { on: ", " })}
|
|
109
107
|
], query);
|
|
@@ -116,28 +114,28 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
116
114
|
...(namedObjectTypes.length > 0
|
|
117
115
|
? [
|
|
118
116
|
code `\
|
|
119
|
-
#objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
|
|
120
|
-
const graph = query?.graph ?? this
|
|
117
|
+
#objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${this.reusables.imports.Either}<Error, readonly ObjectT[]> {
|
|
118
|
+
const graph = query?.graph ?? this.#graph;
|
|
121
119
|
|
|
122
120
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
123
|
-
if (limit <= 0) { return ${imports.Right}([]); }
|
|
121
|
+
if (limit <= 0) { return ${this.reusables.imports.Right}([]); }
|
|
124
122
|
|
|
125
123
|
let offset = query?.offset ?? 0;
|
|
126
124
|
if (offset < 0) { offset = 0; }
|
|
127
125
|
|
|
128
|
-
const fromRdfResourceOptions: Parameters<${snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
126
|
+
const fromRdfResourceOptions: Parameters<${this.reusables.snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
129
127
|
|
|
130
|
-
let resources: { object?: ObjectT, resource: ${imports.Resource} }[];
|
|
128
|
+
let resources: { object?: ObjectT, resource: ${this.reusables.imports.Resource} }[];
|
|
131
129
|
const resourceSet = this.${syntheticNamePrefix}resourceSet(); // Access once, in case it's instantiated lazily
|
|
132
130
|
let sortResources: boolean;
|
|
133
131
|
if (query?.identifiers) {
|
|
134
132
|
resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
|
|
135
133
|
sortResources = false;
|
|
136
|
-
} else if (namedObjectType
|
|
137
|
-
const identifierSet = new ${snippets.IdentifierSet}();
|
|
134
|
+
} else if (namedObjectType.fromRdfTypes.length > 0) {
|
|
135
|
+
const identifierSet = new ${this.reusables.snippets.IdentifierSet}();
|
|
138
136
|
resources = [];
|
|
139
137
|
sortResources = true;
|
|
140
|
-
for (const fromRdfType of namedObjectType
|
|
138
|
+
for (const fromRdfType of namedObjectType.fromRdfTypes) {
|
|
141
139
|
for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
|
|
142
140
|
if (!identifierSet.has(resource.identifier)) {
|
|
143
141
|
identifierSet.add(resource.identifier);
|
|
@@ -146,7 +144,7 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
} else {
|
|
149
|
-
const identifierSet = new ${snippets.IdentifierSet}();
|
|
147
|
+
const identifierSet = new ${this.reusables.snippets.IdentifierSet}();
|
|
150
148
|
resources = [];
|
|
151
149
|
sortResources = true;
|
|
152
150
|
for (const quad of resourceSet.dataset) {
|
|
@@ -168,7 +166,7 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
168
166
|
identifierSet.add(quad.subject);
|
|
169
167
|
const resource = resourceSet.resource(quad.subject);
|
|
170
168
|
// Eagerly eliminate the majority of resources that won't match the object type
|
|
171
|
-
namedObjectType
|
|
169
|
+
namedObjectType.fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
|
|
172
170
|
resources.push({ object, resource });
|
|
173
171
|
});
|
|
174
172
|
}
|
|
@@ -183,54 +181,54 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
183
181
|
const objects: ObjectT[] = [];
|
|
184
182
|
for (let { object, resource } of resources) {
|
|
185
183
|
if (!object) {
|
|
186
|
-
const objectEither = namedObjectType
|
|
184
|
+
const objectEither = namedObjectType.fromRdfResource(resource, fromRdfResourceOptions);
|
|
187
185
|
if (objectEither.isLeft()) {
|
|
188
186
|
return objectEither;
|
|
189
187
|
}
|
|
190
188
|
object = objectEither.unsafeCoerce();
|
|
191
189
|
}
|
|
192
190
|
|
|
193
|
-
if (query?.filter && !namedObjectType
|
|
191
|
+
if (query?.filter && !namedObjectType.filter(query.filter, object)) {
|
|
194
192
|
continue;
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
if (objectI++ >= offset) {
|
|
198
196
|
objects.push(object);
|
|
199
197
|
if (objects.length === limit) {
|
|
200
|
-
return ${imports.Right}(objects);
|
|
198
|
+
return ${this.reusables.imports.Right}(objects);
|
|
201
199
|
}
|
|
202
200
|
}
|
|
203
201
|
}
|
|
204
|
-
return ${imports.Right}(objects);
|
|
202
|
+
return ${this.reusables.imports.Right}(objects);
|
|
205
203
|
}`,
|
|
206
204
|
]
|
|
207
205
|
: []),
|
|
208
206
|
...(namedObjectUnionTypes.length > 0
|
|
209
207
|
? [
|
|
210
208
|
code `\
|
|
211
|
-
#objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
|
|
212
|
-
const graph = query?.graph ?? this
|
|
209
|
+
#objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${this.reusables.imports.Either}<Error, readonly ObjectT[]> {
|
|
210
|
+
const graph = query?.graph ?? this.#graph;
|
|
213
211
|
|
|
214
212
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
215
|
-
if (limit <= 0) { return ${imports.Right}([]); }
|
|
213
|
+
if (limit <= 0) { return ${this.reusables.imports.Right}([]); }
|
|
216
214
|
|
|
217
215
|
let offset = query?.offset ?? 0;
|
|
218
216
|
if (offset < 0) { offset = 0; }
|
|
219
217
|
|
|
220
|
-
const fromRdfResourceOptions: Parameters<${snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
218
|
+
const fromRdfResourceOptions: Parameters<${this.reusables.snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
221
219
|
|
|
222
|
-
let resources: { object?: ObjectT, namedObjectType?: ${namedObjectTypeType}, resource: ${imports.Resource} }[];
|
|
220
|
+
let resources: { object?: ObjectT, namedObjectType?: ${namedObjectTypeType}, resource: ${this.reusables.imports.Resource} }[];
|
|
223
221
|
const resourceSet = this.${syntheticNamePrefix}resourceSet(); // Access once, in case it's instantiated lazily
|
|
224
222
|
let sortResources: boolean;
|
|
225
223
|
if (query?.identifiers) {
|
|
226
224
|
resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
|
|
227
225
|
sortResources = false;
|
|
228
|
-
} else if (namedObjectTypes.every(namedObjectType => namedObjectType
|
|
229
|
-
const identifierSet = new ${snippets.IdentifierSet}();
|
|
226
|
+
} else if (namedObjectTypes.every(namedObjectType => namedObjectType.fromRdfTypes.length > 0)) {
|
|
227
|
+
const identifierSet = new ${this.reusables.snippets.IdentifierSet}();
|
|
230
228
|
resources = [];
|
|
231
229
|
sortResources = true;
|
|
232
230
|
for (const namedObjectType of namedObjectTypes) {
|
|
233
|
-
for (const fromRdfType of namedObjectType
|
|
231
|
+
for (const fromRdfType of namedObjectType.fromRdfTypes) {
|
|
234
232
|
for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
|
|
235
233
|
if (!identifierSet.has(resource.identifier)) {
|
|
236
234
|
identifierSet.add(resource.identifier);
|
|
@@ -240,7 +238,7 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
240
238
|
}
|
|
241
239
|
}
|
|
242
240
|
} else {
|
|
243
|
-
const identifierSet = new ${snippets.IdentifierSet}();
|
|
241
|
+
const identifierSet = new ${this.reusables.snippets.IdentifierSet}();
|
|
244
242
|
resources = [];
|
|
245
243
|
sortResources = true;
|
|
246
244
|
for (const quad of resourceSet.dataset) {
|
|
@@ -263,7 +261,7 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
263
261
|
// Eagerly eliminate the majority of resources that won't match the object types
|
|
264
262
|
const resource = resourceSet.resource(quad.subject);
|
|
265
263
|
for (const namedObjectType of namedObjectTypes) {
|
|
266
|
-
if (namedObjectType
|
|
264
|
+
if (namedObjectType.fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
|
|
267
265
|
resources.push({ object, namedObjectType, resource });
|
|
268
266
|
}).isRight()) {
|
|
269
267
|
break;
|
|
@@ -281,13 +279,13 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
281
279
|
const objects: ObjectT[] = [];
|
|
282
280
|
for (let { object, namedObjectType, resource } of resources) {
|
|
283
281
|
if (!object) {
|
|
284
|
-
let objectEither: ${imports.Either}<Error, ObjectT>;
|
|
282
|
+
let objectEither: ${this.reusables.imports.Either}<Error, ObjectT>;
|
|
285
283
|
if (namedObjectType) {
|
|
286
|
-
objectEither = namedObjectType
|
|
284
|
+
objectEither = namedObjectType.fromRdfResource(resource, fromRdfResourceOptions);
|
|
287
285
|
} else {
|
|
288
|
-
objectEither = ${imports.Left}(new Error("no object types"));
|
|
286
|
+
objectEither = ${this.reusables.imports.Left}(new Error("no object types"));
|
|
289
287
|
for (const tryObjectType of namedObjectTypes) {
|
|
290
|
-
objectEither = tryObjectType
|
|
288
|
+
objectEither = tryObjectType.fromRdfResource(resource, fromRdfResourceOptions);
|
|
291
289
|
if (objectEither.isRight()) {
|
|
292
290
|
namedObjectType = tryObjectType;
|
|
293
291
|
break;
|
|
@@ -303,18 +301,18 @@ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${
|
|
|
303
301
|
throw new Error("namedObjectType should be set here");
|
|
304
302
|
}
|
|
305
303
|
|
|
306
|
-
if (query?.filter && !namedObjectType
|
|
304
|
+
if (query?.filter && !namedObjectType.filter(query.filter, object)) {
|
|
307
305
|
continue;
|
|
308
306
|
}
|
|
309
307
|
|
|
310
308
|
if (objectI++ >= offset) {
|
|
311
309
|
objects.push(object);
|
|
312
310
|
if (objects.length === limit) {
|
|
313
|
-
return ${imports.Right}(objects);
|
|
311
|
+
return ${this.reusables.imports.Right}(objects);
|
|
314
312
|
}
|
|
315
313
|
}
|
|
316
314
|
}
|
|
317
|
-
return ${imports.Right}(objects);
|
|
315
|
+
return ${this.reusables.imports.Right}(objects);
|
|
318
316
|
}`,
|
|
319
317
|
]
|
|
320
318
|
: []),
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { BlankNode, Literal, NamedNode, Variable } from "@rdfjs/types";
|
|
2
2
|
import type { Logger } from "ts-log";
|
|
3
|
+
import type { Imports } from "./Imports.js";
|
|
4
|
+
import type { Snippets } from "./Snippets.js";
|
|
3
5
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function rdfjsTermExpression(
|
|
6
|
+
export declare function rdfjsTermExpression(this: {
|
|
7
|
+
imports: Imports;
|
|
5
8
|
logger: Logger;
|
|
6
|
-
|
|
9
|
+
snippets: Snippets;
|
|
10
|
+
}, rdfjsTerm: Omit<BlankNode, "equals"> | Omit<Literal, "equals"> | Omit<NamedNode, "equals"> | Omit<Variable, "equals">): Code;
|
|
7
11
|
//# sourceMappingURL=rdfjsTermExpression.d.ts.map
|