@shaclmate/compiler 4.0.28 → 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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- 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
|
@@ -6,7 +6,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
|
-
import { imports } from "../imports.js";
|
|
10
9
|
import { removeUndefined } from "../removeUndefined.js";
|
|
11
10
|
import { arrayOf, code, literalOf } from "../ts-poet-wrapper.js";
|
|
12
11
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
@@ -30,8 +29,8 @@ export class DiscriminantProperty extends AbstractProperty {
|
|
|
30
29
|
return Maybe.of({
|
|
31
30
|
key: this.name,
|
|
32
31
|
schema: this.type.values.length > 1
|
|
33
|
-
? code `${imports.z}.enum(${arrayOf(...this.type.values)})`
|
|
34
|
-
: code `${imports.z}.literal(${literalOf(this.type.values[0])})`,
|
|
32
|
+
? code `${this.reusables.imports.z}.enum(${arrayOf(...this.type.values)})`
|
|
33
|
+
: code `${this.reusables.imports.z}.literal(${literalOf(this.type.values[0])})`,
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
get jsonSignature() {
|
|
@@ -53,7 +52,7 @@ export class DiscriminantProperty extends AbstractProperty {
|
|
|
53
52
|
return [code `const ${this.name} = ${this.initializer};`];
|
|
54
53
|
}
|
|
55
54
|
fromRdfResourceValuesExpression() {
|
|
56
|
-
return Maybe.of(code `${imports.Right}<${literalOf(this.namedObjectType.discriminantValue)}>(${this.initializer})`);
|
|
55
|
+
return Maybe.of(code `${this.reusables.imports.Right}<${literalOf(this.namedObjectType.discriminantValue)}>(${this.initializer})`);
|
|
57
56
|
}
|
|
58
57
|
hashStatements({ variables, }) {
|
|
59
58
|
if (this.override) {
|
|
@@ -10,8 +10,6 @@ import { Maybe } from "purify-ts";
|
|
|
10
10
|
import { invariant } from "ts-invariant";
|
|
11
11
|
import { Memoize } from "typescript-memoize";
|
|
12
12
|
import { codeEquals } from "../codeEquals.js";
|
|
13
|
-
import { imports } from "../imports.js";
|
|
14
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
15
13
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
16
14
|
import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
|
|
17
15
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
@@ -59,10 +57,10 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
59
57
|
if (this.type.in_.length > 0 && this.type.kind === "IriType") {
|
|
60
58
|
// Treat sh:in as a union of the IRIs
|
|
61
59
|
// rdfjs.NamedNode<"http://example.com/1" | "http://example.com/2">
|
|
62
|
-
schema = code `${imports.z}.enum(${arrayOf(...this.type.in_.map((iri) => iri.value))})`;
|
|
60
|
+
schema = code `${this.reusables.imports.z}.enum(${arrayOf(...this.type.in_.map((iri) => iri.value))})`;
|
|
63
61
|
}
|
|
64
62
|
else {
|
|
65
|
-
schema = code `${imports.z}.string().min(1)`;
|
|
63
|
+
schema = code `${this.reusables.imports.z}.string().min(1)`;
|
|
66
64
|
}
|
|
67
65
|
return Maybe.of({
|
|
68
66
|
key: "@id",
|
|
@@ -95,7 +93,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
95
93
|
conversionBranches.push(code `if (${conversion.sourceTypeCheckExpression(parameterVariable)}) { ${this.name} = () => ${conversion.conversionExpression(parameterVariable)}; }`);
|
|
96
94
|
}
|
|
97
95
|
if (this.type.nodeKinds.has("BlankNode")) {
|
|
98
|
-
conversionBranches.push(code `if (${parameterVariable} === undefined) { const ${syntheticNamePrefix}eagerIdentifier = ${imports.dataFactory}.blankNode(); ${this.name} = () => ${syntheticNamePrefix}eagerIdentifier; }`);
|
|
96
|
+
conversionBranches.push(code `if (${parameterVariable} === undefined) { const ${syntheticNamePrefix}eagerIdentifier = ${this.reusables.imports.dataFactory}.blankNode(); ${this.name} = () => ${syntheticNamePrefix}eagerIdentifier; }`);
|
|
99
97
|
}
|
|
100
98
|
// We shouldn't need this else, since the parameter now has the never type, but have to add it to appease the TypeScript compiler
|
|
101
99
|
conversionBranches.push(code `{ ${this.name} = (${parameterVariable}) satisfies never;\n }`);
|
|
@@ -111,10 +109,8 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
111
109
|
return Maybe.of(code `${this.type.fromRdfResourceValuesExpression({
|
|
112
110
|
variables: {
|
|
113
111
|
...variables,
|
|
114
|
-
propertyPath: rdfjsTermExpression(rdf.subject,
|
|
115
|
-
|
|
116
|
-
}),
|
|
117
|
-
resourceValues: code `${imports.Right}(new ${imports.Resource}.Value(${{ dataFactory: imports.dataFactory, focusResource: variables.resource, propertyPath: rdfjsTermExpression(rdf.subject, { logger: this.logger }), term: code `${variables.resource}.identifier` }}).toValues())`,
|
|
112
|
+
propertyPath: this.rdfjsTermExpression(rdf.subject),
|
|
113
|
+
resourceValues: code `${this.reusables.imports.Right}(new ${this.reusables.imports.Resource}.Value(${{ dataFactory: this.reusables.imports.dataFactory, focusResource: variables.resource, propertyPath: this.rdfjsTermExpression(rdf.subject), term: code `${variables.resource}.identifier` }}).toValues())`,
|
|
118
114
|
},
|
|
119
115
|
})}.chain(values => values.head())`);
|
|
120
116
|
}
|
|
@@ -135,7 +131,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
135
131
|
ignoreRdfType: true, // Unused
|
|
136
132
|
preferredLanguages: variables.preferredLanguages,
|
|
137
133
|
propertyPatterns: code `[]`,
|
|
138
|
-
schema: code `${this.namedObjectType.name}
|
|
134
|
+
schema: code `${this.namedObjectType.name}.schema.properties.${this.name}.type()`,
|
|
139
135
|
valueVariable: variables.focusIdentifier,
|
|
140
136
|
variablePrefix: variables.variablePrefix, // Unused
|
|
141
137
|
}})`,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
4
|
export function NamedObjectType_createFunctionDeclaration() {
|
|
6
5
|
if (!this.features.has("create")) {
|
|
@@ -12,7 +11,7 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
12
11
|
parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
|
|
13
12
|
}
|
|
14
13
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
15
|
-
parametersType.push(code `Parameters<typeof ${parentObjectType.name}
|
|
14
|
+
parametersType.push(code `Parameters<typeof ${parentObjectType.name}.create>[0]`);
|
|
16
15
|
}
|
|
17
16
|
if (parametersType.length === 0) {
|
|
18
17
|
parametersType.push(code `object`);
|
|
@@ -21,7 +20,7 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
21
20
|
const omitPropertyNames = [];
|
|
22
21
|
const propertyStatements = [];
|
|
23
22
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
24
|
-
propertyInitializers.push(`...${parentObjectType.name}
|
|
23
|
+
propertyInitializers.push(`...${parentObjectType.name}.create(parameters)`);
|
|
25
24
|
}
|
|
26
25
|
const parametersHasQuestionToken = this.parentObjectTypes.length === 0 &&
|
|
27
26
|
parametersPropertySignatures.every((propertySignature) => propertySignature.toCodeString([]).indexOf("?:") !== -1);
|
|
@@ -44,7 +43,7 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
44
43
|
invariant(propertyInitializers.length > 0);
|
|
45
44
|
invariant(propertyStatements.length > 0);
|
|
46
45
|
return Maybe.of(code `\
|
|
47
|
-
export function
|
|
46
|
+
export function create(parameters${parametersHasQuestionToken ? "?" : ""}: ${joinCode(parametersType, { on: " & " })}): ${omitPropertyNames.length === 0 ? this.name : `Omit<${this.name}, ${omitPropertyNames.map((omitPropertyName) => `"${omitPropertyName}"`).join(" | ")}>`} {
|
|
48
47
|
${joinCode(propertyStatements)}
|
|
49
48
|
return { ${propertyInitializers.join(", ")} };
|
|
50
49
|
}`);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { snippets } from "../snippets.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
3
|
export function NamedObjectType_equalsFunctionDeclaration() {
|
|
6
4
|
if (!this.features.has("equals")) {
|
|
@@ -9,7 +7,7 @@ export function NamedObjectType_equalsFunctionDeclaration() {
|
|
|
9
7
|
const chain = [];
|
|
10
8
|
// For every parent, find the nearest equals implementation
|
|
11
9
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
12
|
-
chain.push(code `${parentObjectType.name}
|
|
10
|
+
chain.push(code `${parentObjectType.name}.equals(left, right)`);
|
|
13
11
|
}
|
|
14
12
|
for (const property of this.properties) {
|
|
15
13
|
if (property.kind === "DiscriminantProperty") {
|
|
@@ -18,7 +16,7 @@ export function NamedObjectType_equalsFunctionDeclaration() {
|
|
|
18
16
|
chain.push(code `(${property.type.equalsFunction})(${property.accessExpression({ variables: { object: code `left` } })}, ${property.accessExpression({ variables: { object: code `right` } })}).mapLeft(propertyValuesUnequal => ({ left, right, propertyName: "${property.name}", propertyValuesUnequal, type: "property" as const }))`);
|
|
19
17
|
}
|
|
20
18
|
return Maybe.of(code `\
|
|
21
|
-
export function
|
|
19
|
+
export function equals(left: ${this.name}, right: ${this.name}): ${this.reusables.snippets.EqualsResult} {
|
|
22
20
|
return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
|
|
23
21
|
}`);
|
|
24
22
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
2
|
export function NamedObjectType_filterFunctionDeclaration() {
|
|
4
3
|
const statements = [];
|
|
@@ -14,7 +13,7 @@ export function NamedObjectType_filterFunctionDeclaration() {
|
|
|
14
13
|
}
|
|
15
14
|
statements.push(code `return true;`);
|
|
16
15
|
return code `\
|
|
17
|
-
export function
|
|
16
|
+
export function filter(filter: ${this.filterType}, value: ${this.name}): boolean {
|
|
18
17
|
${joinCode(statements)}
|
|
19
18
|
}`;
|
|
20
19
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
2
|
export function NamedObjectType_filterTypeDeclaration() {
|
|
4
3
|
const members = [];
|
|
@@ -14,9 +13,9 @@ export function NamedObjectType_filterTypeDeclaration() {
|
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
17
|
-
members.push(code `${parentObjectType.name}
|
|
16
|
+
members.push(code `${parentObjectType.name}.Filter`);
|
|
18
17
|
}
|
|
19
18
|
return code `\
|
|
20
|
-
export type
|
|
19
|
+
export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=NamedObjectType_filterTypeDeclaration.js.map
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { imports } from "../imports.js";
|
|
4
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
5
|
-
import { snippets } from "../snippets.js";
|
|
6
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
7
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
8
4
|
const variables = {
|
|
9
5
|
filter: code `parameters.filter`,
|
|
@@ -14,20 +10,20 @@ export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration()
|
|
|
14
10
|
if (!this.features.has("sparql")) {
|
|
15
11
|
return Maybe.empty();
|
|
16
12
|
}
|
|
17
|
-
const rdfClassVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
18
|
-
const rdfTypeVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
13
|
+
const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
14
|
+
const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
19
15
|
let triplesVariableDeclarationKeyword = "const";
|
|
20
16
|
const statements = [];
|
|
21
17
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
22
|
-
statements.push(code `triples = triples.concat(${parentObjectType.name}
|
|
18
|
+
statements.push(code `triples = triples.concat(${parentObjectType.name}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
|
|
23
19
|
triplesVariableDeclarationKeyword = "let";
|
|
24
20
|
}
|
|
25
21
|
if (this.fromRdfType.isJust()) {
|
|
26
22
|
statements.push(code `\
|
|
27
23
|
if (!parameters?.ignoreRdfType) {
|
|
28
24
|
triples.push(
|
|
29
|
-
{ subject: ${variables.focusIdentifier}, predicate: ${rdfjsTermExpression(rdf.type
|
|
30
|
-
{ subject: ${rdfTypeVariable}, predicate: ${rdfjsTermExpression(rdfs.subClassOf
|
|
25
|
+
{ subject: ${variables.focusIdentifier}, predicate: ${this.rdfjsTermExpression(rdf.type)}, object: ${rdfTypeVariable} },
|
|
26
|
+
{ subject: ${rdfTypeVariable}, predicate: ${this.rdfjsTermExpression(rdfs.subClassOf)}, object: ${rdfClassVariable} }
|
|
31
27
|
);
|
|
32
28
|
}`);
|
|
33
29
|
}
|
|
@@ -45,10 +41,10 @@ if (!parameters?.ignoreRdfType) {
|
|
|
45
41
|
});
|
|
46
42
|
}
|
|
47
43
|
return Maybe.of(code `\
|
|
48
|
-
export const
|
|
44
|
+
export const focusSparqlConstructTriples: ${this.reusables.snippets.FocusSparqlConstructTriplesFunction}<${this.filterType}> = (${statements.length === 0 ? "_" : ""}parameters) => {
|
|
49
45
|
${statements.length > 0
|
|
50
46
|
? joinCode([
|
|
51
|
-
code `${triplesVariableDeclarationKeyword} triples: ${imports.sparqljs}.Triple[] = [];`,
|
|
47
|
+
code `${triplesVariableDeclarationKeyword} triples: ${this.reusables.imports.sparqljs}.Triple[] = [];`,
|
|
52
48
|
...statements,
|
|
53
49
|
code `return triples;`,
|
|
54
50
|
])
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { imports } from "../imports.js";
|
|
4
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
5
|
-
import { snippets } from "../snippets.js";
|
|
6
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
7
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
8
4
|
const variables = {
|
|
9
5
|
filter: code `parameters.filter`,
|
|
@@ -15,13 +11,13 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
|
15
11
|
if (!this.features.has("sparql")) {
|
|
16
12
|
return Maybe.empty();
|
|
17
13
|
}
|
|
18
|
-
const rdfClassVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
19
|
-
const rdfTypeVariable = code `${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
14
|
+
const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
|
|
15
|
+
const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
|
|
20
16
|
let patternsVariableDeclarationKeyword = "const";
|
|
21
17
|
const statements = [];
|
|
22
18
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
23
19
|
statements.push(code `\
|
|
24
|
-
patterns = patterns.concat(${parentObjectType.name}
|
|
20
|
+
patterns = patterns.concat(${parentObjectType.name}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
|
|
25
21
|
patternsVariableDeclarationKeyword = "let";
|
|
26
22
|
}
|
|
27
23
|
if (this.fromRdfType.isJust()) {
|
|
@@ -36,18 +32,18 @@ if (!parameters?.ignoreRdfType) {
|
|
|
36
32
|
{
|
|
37
33
|
type: "values" as const,
|
|
38
34
|
values: [${joinCode(fromRdfTypeVariables, { on: "," })}].map((identifier) => {
|
|
39
|
-
const valuePatternRow: ${imports.sparqljs}.ValuePatternRow = {};
|
|
40
|
-
valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${imports.NamedNode};
|
|
35
|
+
const valuePatternRow: ${this.reusables.imports.sparqljs}.ValuePatternRow = {};
|
|
36
|
+
valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${this.reusables.imports.NamedNode};
|
|
41
37
|
return valuePatternRow;
|
|
42
38
|
}),
|
|
43
39
|
},
|
|
44
|
-
${snippets.sparqlInstancesOfPattern}({ rdfType: ${imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
|
|
45
|
-
: code `${snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
|
|
40
|
+
${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
|
|
41
|
+
: code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
|
|
46
42
|
{
|
|
47
43
|
triples: [
|
|
48
44
|
{
|
|
49
45
|
subject: ${variables.focusIdentifier},
|
|
50
|
-
predicate: ${rdfjsTermExpression(rdf.type
|
|
46
|
+
predicate: ${this.rdfjsTermExpression(rdf.type)},
|
|
51
47
|
object: rdfTypeVariable
|
|
52
48
|
}
|
|
53
49
|
],
|
|
@@ -60,7 +56,7 @@ if (!parameters?.ignoreRdfType) {
|
|
|
60
56
|
{
|
|
61
57
|
subject: rdfTypeVariable,
|
|
62
58
|
predicate: {
|
|
63
|
-
items: [${rdfjsTermExpression(rdfs.subClassOf
|
|
59
|
+
items: [${this.rdfjsTermExpression(rdfs.subClassOf)}],
|
|
64
60
|
pathType: "+" as const,
|
|
65
61
|
type: "path" as const
|
|
66
62
|
},
|
|
@@ -93,10 +89,10 @@ if (!parameters?.ignoreRdfType) {
|
|
|
93
89
|
});
|
|
94
90
|
}
|
|
95
91
|
return Maybe.of(code `\
|
|
96
|
-
export const
|
|
92
|
+
export const focusSparqlWherePatterns: ${this.reusables.snippets.FocusSparqlWherePatternsFunction}<${this.filterType}> = (${statements.length === 0 ? "_" : ""}parameters) => {
|
|
97
93
|
${statements.length > 0
|
|
98
94
|
? joinCode([
|
|
99
|
-
code `${patternsVariableDeclarationKeyword} patterns: ${snippets.SparqlPattern}[] = [];`,
|
|
95
|
+
code `${patternsVariableDeclarationKeyword} patterns: ${this.reusables.snippets.SparqlPattern}[] = [];`,
|
|
100
96
|
...statements,
|
|
101
97
|
code `return patterns;`,
|
|
102
98
|
])
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
4
3
|
export function NamedObjectType_fromJsonFunctionDeclaration() {
|
|
5
4
|
if (!this.features.has("json")) {
|
|
6
5
|
return Maybe.empty();
|
|
7
6
|
}
|
|
8
7
|
return Maybe.of(code `\
|
|
9
|
-
export function
|
|
10
|
-
return
|
|
8
|
+
export function fromJson(json: ${this.jsonType().name}): ${this.name} {
|
|
9
|
+
return create(propertiesFromJson(json));
|
|
11
10
|
}`);
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { snippets } from "../snippets.js";
|
|
3
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
4
|
export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
|
|
@@ -7,11 +6,11 @@ export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
|
|
|
7
6
|
return Maybe.empty();
|
|
8
7
|
}
|
|
9
8
|
return Maybe.of(code `\
|
|
10
|
-
export const
|
|
9
|
+
export const fromRdfResource: ${this.reusables.snippets.FromRdfResourceFunction}<${this.name}> = (resource, options) => {
|
|
11
10
|
${joinCode([
|
|
12
11
|
code `let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages } = (options ?? {});`,
|
|
13
12
|
code `if (!objectSet) { objectSet = new ${syntheticNamePrefix}RdfjsDatasetObjectSet(resource.dataset); }`,
|
|
14
|
-
code `return ${code `${this.name}
|
|
13
|
+
code `return ${code `${this.name}.propertiesFromRdfResource(resource, { context, graph, ignoreRdfType, objectSet, preferredLanguages }).map(create)`};`,
|
|
15
14
|
])}
|
|
16
15
|
};`);
|
|
17
16
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { snippets } from "../snippets.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
5
3
|
export function NamedObjectType_fromRdfResourceValuesFunctionDeclaration() {
|
|
6
4
|
if (!this.features.has("rdf")) {
|
|
7
5
|
return Maybe.empty();
|
|
8
6
|
}
|
|
9
7
|
return Maybe.of(code `\
|
|
10
|
-
export const
|
|
8
|
+
export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.name}> = (values, options) =>
|
|
11
9
|
values.chain(
|
|
12
10
|
values => values.chainMap(
|
|
13
|
-
value => value.toResource().chain(resource => ${this.name}
|
|
11
|
+
value => value.toResource().chain(resource => ${this.name}.fromRdfResource(resource, options))
|
|
14
12
|
)
|
|
15
13
|
);`);
|
|
16
14
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { imports } from "../imports.js";
|
|
3
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
4
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
5
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
6
3
|
export function NamedObjectType_fromRdfTypeVariableStatement() {
|
|
7
4
|
if (!this.features.has("rdf")) {
|
|
8
5
|
return Maybe.empty();
|
|
9
6
|
}
|
|
10
7
|
return this.fromRdfType.map((fromRdfType) => code `\
|
|
11
|
-
export const
|
|
8
|
+
export const fromRdfType: ${this.reusables.imports.NamedNode}<string> = ${this.rdfjsTermExpression(fromRdfType)};`);
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=NamedObjectType_fromRdfTypeVariableStatement.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
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
|
export function NamedObjectType_graphqlTypeVariableStatement() {
|
|
@@ -10,7 +9,7 @@ export function NamedObjectType_graphqlTypeVariableStatement() {
|
|
|
10
9
|
return Maybe.empty();
|
|
11
10
|
}
|
|
12
11
|
return Maybe.of(code `\
|
|
13
|
-
export const
|
|
12
|
+
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.name}, { objectSet: ${syntheticNamePrefix}ObjectSet }>(${{
|
|
14
13
|
description: this.comment.extract(),
|
|
15
14
|
fields: code `() => (${this.properties.reduce((fields, property) => {
|
|
16
15
|
property.graphqlField.ifJust((field) => {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { snippets } from "../snippets.js";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
2
|
const hasherVariable = code `_hasher`;
|
|
5
3
|
export function NamedObjectType_hashFunctionDeclarations() {
|
|
@@ -20,9 +18,9 @@ export function NamedObjectType_hashFunctionDeclarations() {
|
|
|
20
18
|
const hashShaclPropertiesStatements = [];
|
|
21
19
|
const hashStatements = [];
|
|
22
20
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
23
|
-
hashShaclPropertiesStatements.push(code `${parentObjectType.name}
|
|
21
|
+
hashShaclPropertiesStatements.push(code `${parentObjectType.name}.hashShaclProperties(${this.thisVariable}, ${hasherVariable});`);
|
|
24
22
|
}
|
|
25
|
-
hashStatements.push(code `${this.name}
|
|
23
|
+
hashStatements.push(code `${this.name}.hashShaclProperties(${this.thisVariable}, ${hasherVariable});`);
|
|
26
24
|
hashShaclPropertiesStatements.push(...hashOwnShaclPropertiesStatements);
|
|
27
25
|
hashShaclPropertiesStatements.push(code `return ${hasherVariable};`);
|
|
28
26
|
hashStatements.push(...this.properties
|
|
@@ -37,11 +35,11 @@ export function NamedObjectType_hashFunctionDeclarations() {
|
|
|
37
35
|
hashStatements.push(code `return ${hasherVariable};`);
|
|
38
36
|
return [
|
|
39
37
|
code `\
|
|
40
|
-
export function
|
|
38
|
+
export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${this.thisVariable}: ${this.name}, ${hasherVariable}: HasherT): HasherT {
|
|
41
39
|
${joinCode(hashStatements)}
|
|
42
40
|
}`,
|
|
43
41
|
code `\
|
|
44
|
-
export function
|
|
42
|
+
export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${this.thisVariable}: ${this.name}, ${hasherVariable}: HasherT): HasherT {
|
|
45
43
|
${joinCode(hashShaclPropertiesStatements)}
|
|
46
44
|
}`,
|
|
47
45
|
];
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { imports } from "../imports.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
5
3
|
export function NamedObjectType_jsonParseFunctionDeclaration() {
|
|
6
4
|
if (!this.features.has("json")) {
|
|
7
5
|
return Maybe.empty();
|
|
8
6
|
}
|
|
9
7
|
return Maybe.of(code `\
|
|
10
|
-
export function parse(json: unknown): ${imports.Either}<Error,
|
|
8
|
+
export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Json> {
|
|
11
9
|
const jsonSafeParseResult = schema().safeParse(json);
|
|
12
|
-
if (!jsonSafeParseResult.success) { return ${imports.Left}(jsonSafeParseResult.error); }
|
|
13
|
-
return ${imports.Right}(jsonSafeParseResult.data);
|
|
10
|
+
if (!jsonSafeParseResult.success) { return ${this.reusables.imports.Left}(jsonSafeParseResult.error); }
|
|
11
|
+
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
14
12
|
}`);
|
|
15
13
|
}
|
|
16
14
|
//# sourceMappingURL=NamedObjectType_jsonParseFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { imports } from "../imports.js";
|
|
3
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
3
|
export function NamedObjectType_jsonSchemaFunctionDeclaration() {
|
|
6
4
|
if (!this.features.has("json")) {
|
|
@@ -27,7 +25,7 @@ export function NamedObjectType_jsonSchemaFunctionDeclaration() {
|
|
|
27
25
|
// ${this.properties.every((property) => !property.mutable) ? `.readonly()` : ""}
|
|
28
26
|
return Maybe.of(code `\
|
|
29
27
|
export function schema() {
|
|
30
|
-
return ${imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${imports.z}.ZodType
|
|
28
|
+
return ${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${this.reusables.imports.z}.ZodType<Json>;
|
|
31
29
|
}`);
|
|
32
30
|
}
|
|
33
31
|
//# sourceMappingURL=NamedObjectType_jsonSchemaFunctionDeclaration.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
3
|
export function NamedObjectType_jsonTypeAliasDeclaration() {
|
|
5
4
|
if (!this.features.has("json")) {
|
|
@@ -12,6 +11,6 @@ export function NamedObjectType_jsonTypeAliasDeclaration() {
|
|
|
12
11
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
13
12
|
members.push(code `${parentObjectType.jsonType().name}`);
|
|
14
13
|
}
|
|
15
|
-
return Maybe.of(code `export type
|
|
14
|
+
return Maybe.of(code `export type Json = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=NamedObjectType_jsonTypeAliasDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
3
|
export function NamedObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
5
4
|
if (!this.features.has("json")) {
|
|
@@ -7,7 +6,7 @@ export function NamedObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
|
7
6
|
}
|
|
8
7
|
const variables = { scopePrefix: code `scopePrefix` };
|
|
9
8
|
const elements = this.parentObjectTypes
|
|
10
|
-
.map((parentObjectType) => code `${parentObjectType.name}
|
|
9
|
+
.map((parentObjectType) => code `${parentObjectType.name}.Json.uiSchema({ scopePrefix })`)
|
|
11
10
|
.concat(this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
12
11
|
return Maybe.of(code `\
|
|
13
12
|
export function uiSchema(parameters?: { scopePrefix?: string }): any {
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js
CHANGED
|
@@ -13,8 +13,8 @@ export function NamedObjectType_propertiesFromJsonFunctionDeclaration() {
|
|
|
13
13
|
const propertyReturnTypeSignatures = [];
|
|
14
14
|
const returnType = [];
|
|
15
15
|
this.parentObjectTypes.forEach((parentObjectType) => {
|
|
16
|
-
initializers.push(code `...${parentObjectType.name}
|
|
17
|
-
returnType.push(code `ReturnType<typeof ${parentObjectType.name}
|
|
16
|
+
initializers.push(code `...${parentObjectType.name}.propertiesFromJson(${variables.jsonObject})`);
|
|
17
|
+
returnType.push(code `ReturnType<typeof ${parentObjectType.name}.propertiesFromJson>`);
|
|
18
18
|
});
|
|
19
19
|
for (const property of this.properties) {
|
|
20
20
|
const propertyFromJsonStatements = property.fromJsonStatements({
|
|
@@ -31,7 +31,7 @@ export function NamedObjectType_propertiesFromJsonFunctionDeclaration() {
|
|
|
31
31
|
returnType.splice(0, 0, code `{ ${joinCode(propertyReturnTypeSignatures, { on: " " })} }`);
|
|
32
32
|
}
|
|
33
33
|
return Maybe.of(code `\
|
|
34
|
-
export function
|
|
34
|
+
export function propertiesFromJson(${variables.jsonObject}: ${this.jsonType().name}): ${joinCode(returnType, { on: " & " })} {
|
|
35
35
|
${joinCode(statements)}
|
|
36
36
|
}`);
|
|
37
37
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { imports } from "../imports.js";
|
|
4
|
-
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
5
|
-
import { snippets } from "../snippets.js";
|
|
6
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
7
4
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
8
5
|
const optionsVariable = `_${syntheticNamePrefix}options`;
|
|
@@ -24,15 +21,15 @@ export function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration() {
|
|
|
24
21
|
const returnType = [];
|
|
25
22
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
26
23
|
chains.push({
|
|
27
|
-
expression: code `${parentObjectType.name}
|
|
24
|
+
expression: code `${parentObjectType.name}.propertiesFromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
|
|
28
25
|
variable: `${syntheticNamePrefix}super${parentObjectTypeI}`,
|
|
29
26
|
});
|
|
30
27
|
initializers.push(code `...${syntheticNamePrefix}super${parentObjectTypeI}`);
|
|
31
|
-
returnType.push(code `${snippets.UnwrapR}<ReturnType<typeof ${parentObjectType.name}
|
|
28
|
+
returnType.push(code `${this.reusables.snippets.UnwrapR}<ReturnType<typeof ${parentObjectType.name}.propertiesFromRdfResource>>`);
|
|
32
29
|
});
|
|
33
30
|
this.fromRdfType.ifJust((fromRdfType) => {
|
|
34
31
|
const fromRdfTypeVariable = this.fromRdfTypeVariable.unsafeCoerce();
|
|
35
|
-
const predicate = rdfjsTermExpression(rdf.type
|
|
32
|
+
const predicate = this.rdfjsTermExpression(rdf.type);
|
|
36
33
|
// Check the expected type and its known subtypes
|
|
37
34
|
const cases = new Set();
|
|
38
35
|
cases.add(fromRdfType.value);
|
|
@@ -46,16 +43,16 @@ export function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration() {
|
|
|
46
43
|
// Check the expected type and its known subtypes
|
|
47
44
|
switch (actualRdfType.value) {
|
|
48
45
|
${[...cases].map((fromRdfType) => `case "${fromRdfType}":`).join("\n")}
|
|
49
|
-
return ${imports.Right}(true as const);
|
|
46
|
+
return ${this.reusables.imports.Right}(true as const);
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
53
50
|
if (${variables.resource}.isInstanceOf(${fromRdfTypeVariable}, ${{ graph: variables.graph }})) {
|
|
54
|
-
return ${imports.Right}(true as const);
|
|
51
|
+
return ${this.reusables.imports.Right}(true as const);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
return ${imports.Left}(new Error(\`\${${variables.resource}.identifier} has unexpected RDF type (actual: \${actualRdfType.value}, expected: ${fromRdfType.value})\`));
|
|
58
|
-
}) : ${imports.Right}(true as const)`,
|
|
54
|
+
return ${this.reusables.imports.Left}(new Error(\`\${${variables.resource}.identifier} has unexpected RDF type (actual: \${actualRdfType.value}, expected: ${fromRdfType.value})\`));
|
|
55
|
+
}) : ${this.reusables.imports.Right}(true as const)`,
|
|
59
56
|
variable: "_rdfTypeCheck",
|
|
60
57
|
});
|
|
61
58
|
});
|
|
@@ -83,7 +80,7 @@ export function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration() {
|
|
|
83
80
|
const statements = [];
|
|
84
81
|
const resultExpression = code `{ ${joinCode(initializers, { on: "," })} }`;
|
|
85
82
|
if (chains.length === 0) {
|
|
86
|
-
statements.push(code `return ${imports.Right}(${resultExpression});`);
|
|
83
|
+
statements.push(code `return ${this.reusables.imports.Right}(${resultExpression});`);
|
|
87
84
|
}
|
|
88
85
|
else {
|
|
89
86
|
statements.push(code `return ${chains
|
|
@@ -94,7 +91,7 @@ export function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration() {
|
|
|
94
91
|
returnType.splice(0, 0, code `{ ${joinCode(propertySignatures, { on: " " })} }`);
|
|
95
92
|
}
|
|
96
93
|
return Maybe.of(code `\
|
|
97
|
-
export const
|
|
94
|
+
export const propertiesFromRdfResource: ${this.reusables.snippets.PropertiesFromRdfResourceFunction}<${joinCode(returnType, { on: " & " })}> = (${syntheticNamePrefix}resource, ${optionsVariable}) => {
|
|
98
95
|
${joinCode(statements)}
|
|
99
96
|
};`);
|
|
100
97
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
2
|
export function NamedObjectType_schemaVariableStatement() {
|
|
4
3
|
return code `\
|
|
5
|
-
export const
|
|
6
|
-
.map((parentObjectType) => code `...${parentObjectType.name}
|
|
4
|
+
export const schema = { properties: { ${joinCode(this.parentObjectTypes
|
|
5
|
+
.map((parentObjectType) => code `...${parentObjectType.name}.schema.properties`)
|
|
7
6
|
.concat(this.properties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;`;
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=NamedObjectType_schemaVariableStatement.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { Reusables } from "../Reusables.js";
|
|
2
3
|
import type { TsFeature } from "../TsFeature.js";
|
|
3
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
5
|
export declare function NamedObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
5
6
|
readonly features: ReadonlySet<TsFeature>;
|
|
6
7
|
readonly filterType: Code;
|
|
7
8
|
readonly name: string;
|
|
9
|
+
readonly reusables: Reusables;
|
|
8
10
|
}): Maybe<Code>;
|
|
9
11
|
//# sourceMappingURL=NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|