@shaclmate/compiler 4.0.29 → 4.0.31
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 +12 -14
- package/dist/generators/ts/AbstractType.d.ts +9 -2
- package/dist/generators/ts/AbstractType.js +15 -5
- package/dist/generators/ts/AbstractUnionType.d.ts +3 -0
- package/dist/generators/ts/AbstractUnionType.js +37 -28
- 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 +12 -15
- package/dist/generators/ts/LiteralType.js +8 -10
- package/dist/generators/ts/NamedObjectType.d.ts +1 -3
- package/dist/generators/ts/NamedObjectType.js +33 -32
- 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 +126 -0
- package/dist/generators/ts/Snippets.js +825 -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 +9 -4
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +10 -1
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +2 -2
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +17 -24
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +1 -1
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +10 -14
- 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 +21 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +83 -8
- 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_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 +14 -23
- 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.d.ts +1 -1
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +12 -15
- 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_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 +9 -5
- 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__FromRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets__ToRdfResourceFunction.js +12 -0
- 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/_snippets/snippets_wrap_FromRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +10 -0
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_wrap_ToRdfResourceFunction.js +14 -0
- 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 +184 -267
- package/dist/input/generated.js +721 -779
- package/package.json +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +0 -38
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +0 -101
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +0 -15
- 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,5 +1,7 @@
|
|
|
1
1
|
import type { Maybe, NonEmptyList } from "purify-ts";
|
|
2
2
|
import type { Logger } from "ts-log";
|
|
3
|
+
import type { Reusables } from "./Reusables.js";
|
|
4
|
+
import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
3
5
|
import type { Typeof } from "./Typeof.js";
|
|
4
6
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
7
|
/**
|
|
@@ -7,6 +9,8 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
7
9
|
*/
|
|
8
10
|
export declare abstract class AbstractType {
|
|
9
11
|
protected readonly logger: Logger;
|
|
12
|
+
protected readonly reusables: Reusables;
|
|
13
|
+
protected readonly rdfjsTermExpression: (parameters: Parameters<typeof rdfjsTermExpression>[0]) => Code;
|
|
10
14
|
/**
|
|
11
15
|
* Comment from rdfs:comment.
|
|
12
16
|
*/
|
|
@@ -106,10 +110,11 @@ export declare abstract class AbstractType {
|
|
|
106
110
|
* - variablePrefix: string prefix to use for new variables
|
|
107
111
|
*/
|
|
108
112
|
abstract readonly valueSparqlWherePatternsFunction: Code;
|
|
109
|
-
constructor({ comment, label, logger, }: {
|
|
113
|
+
constructor({ comment, label, logger, reusables, }: {
|
|
110
114
|
comment: Maybe<string>;
|
|
111
115
|
label: Maybe<string>;
|
|
112
116
|
logger: Logger;
|
|
117
|
+
reusables: Reusables;
|
|
113
118
|
});
|
|
114
119
|
/**
|
|
115
120
|
* Helper to compose the result of schema along the type hierarchy.
|
|
@@ -255,6 +260,7 @@ export declare namespace AbstractType {
|
|
|
255
260
|
}
|
|
256
261
|
interface DiscriminantProperty {
|
|
257
262
|
readonly descendantValues: readonly DiscriminantProperty.Value[];
|
|
263
|
+
readonly jsonName: string;
|
|
258
264
|
readonly name: string;
|
|
259
265
|
readonly ownValues: readonly DiscriminantProperty.Value[];
|
|
260
266
|
}
|
|
@@ -270,7 +276,8 @@ export declare namespace AbstractType {
|
|
|
270
276
|
* The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
|
|
271
277
|
*/
|
|
272
278
|
readonly nullableName: Code;
|
|
273
|
-
|
|
279
|
+
private readonly reusables;
|
|
280
|
+
constructor(nullableName: Code, reusables: Reusables, options?: {
|
|
274
281
|
nullable: boolean;
|
|
275
282
|
});
|
|
276
283
|
get name(): Code;
|
|
@@ -6,13 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { invariant } from "ts-invariant";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
|
-
import {
|
|
9
|
+
import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
10
10
|
import { code, literalOf } from "./ts-poet-wrapper.js";
|
|
11
11
|
/**
|
|
12
12
|
* Abstract base class all types.
|
|
13
13
|
*/
|
|
14
14
|
export class AbstractType {
|
|
15
15
|
logger;
|
|
16
|
+
reusables;
|
|
17
|
+
rdfjsTermExpression;
|
|
16
18
|
/**
|
|
17
19
|
* Comment from rdfs:comment.
|
|
18
20
|
*/
|
|
@@ -21,10 +23,16 @@ export class AbstractType {
|
|
|
21
23
|
* Label from rdfs:label.
|
|
22
24
|
*/
|
|
23
25
|
label;
|
|
24
|
-
constructor({ comment, label, logger, }) {
|
|
26
|
+
constructor({ comment, label, logger, reusables, }) {
|
|
25
27
|
this.comment = comment;
|
|
26
28
|
this.label = label;
|
|
27
29
|
this.logger = logger;
|
|
30
|
+
this.reusables = reusables;
|
|
31
|
+
this.rdfjsTermExpression = rdfjsTermExpression.bind({
|
|
32
|
+
imports: this.reusables.imports,
|
|
33
|
+
logger: this.logger,
|
|
34
|
+
snippets: this.reusables.snippets,
|
|
35
|
+
});
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* Helper to compose the result of schema along the type hierarchy.
|
|
@@ -46,14 +54,16 @@ export class AbstractType {
|
|
|
46
54
|
* The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
|
|
47
55
|
*/
|
|
48
56
|
nullableName;
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
reusables;
|
|
58
|
+
constructor(nullableName, reusables, options) {
|
|
59
|
+
this.nullable = !!options?.nullable;
|
|
51
60
|
this.nullableName = nullableName;
|
|
61
|
+
this.reusables = reusables;
|
|
52
62
|
}
|
|
53
63
|
get name() {
|
|
54
64
|
return this.nullable
|
|
55
65
|
? this.nullableName
|
|
56
|
-
: code `new ${imports.GraphQLNonNull}(${this.nullableName})`;
|
|
66
|
+
: code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableName})`;
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
__decorate([
|
|
@@ -48,11 +48,13 @@ export declare abstract class AbstractUnionType<MemberTypeT extends Type> extend
|
|
|
48
48
|
}
|
|
49
49
|
type Discriminant = ExtrinsicDiscriminant | HybridDiscriminant | IntrinsicDiscriminant | TypeofDiscriminant;
|
|
50
50
|
type ExtrinsicDiscriminant = {
|
|
51
|
+
readonly jsonName: string;
|
|
51
52
|
readonly kind: "extrinsic";
|
|
52
53
|
readonly memberValues: readonly AbstractType.DiscriminantProperty.Value[];
|
|
53
54
|
readonly name: string;
|
|
54
55
|
};
|
|
55
56
|
type HybridDiscriminant = {
|
|
57
|
+
readonly jsonName: string;
|
|
56
58
|
readonly kind: "hybrid";
|
|
57
59
|
readonly memberValues: readonly {
|
|
58
60
|
readonly kind: "extrinsic" | "intrinsic";
|
|
@@ -61,6 +63,7 @@ type HybridDiscriminant = {
|
|
|
61
63
|
readonly name: string;
|
|
62
64
|
};
|
|
63
65
|
type IntrinsicDiscriminant = {
|
|
66
|
+
readonly jsonName: string;
|
|
64
67
|
readonly kind: "intrinsic";
|
|
65
68
|
readonly memberValues: readonly {
|
|
66
69
|
readonly descendantValues: readonly AbstractType.DiscriminantProperty.Value[];
|
|
@@ -8,9 +8,7 @@ import { Maybe, NonEmptyList } from "purify-ts";
|
|
|
8
8
|
import { invariant } from "ts-invariant";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractType } from "./AbstractType.js";
|
|
11
|
-
import { imports } from "./imports.js";
|
|
12
11
|
import { removeUndefined } from "./removeUndefined.js";
|
|
13
|
-
import { snippets } from "./snippets.js";
|
|
14
12
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
15
13
|
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
16
14
|
export class AbstractUnionType extends AbstractType {
|
|
@@ -79,7 +77,10 @@ export class AbstractUnionType extends AbstractType {
|
|
|
79
77
|
return code `${member.type.name}.is${member.type.name}(${instance})`;
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
|
|
80
|
+
const discriminantName = json
|
|
81
|
+
? discriminant.jsonName
|
|
82
|
+
: discriminant.name;
|
|
83
|
+
return code `(${joinCode(discriminantValues.map((discriminantValue) => code `${instance}["${discriminantName}"] === ${literalOf(discriminantValue)}`), { on: " || " })})`;
|
|
83
84
|
};
|
|
84
85
|
return {
|
|
85
86
|
discriminantValues,
|
|
@@ -158,18 +159,21 @@ export class AbstractUnionType extends AbstractType {
|
|
|
158
159
|
case "extrinsic":
|
|
159
160
|
return Maybe.of({
|
|
160
161
|
descendantValues: [],
|
|
162
|
+
jsonName: this.discriminant.jsonName,
|
|
161
163
|
ownValues: this.discriminant.memberValues,
|
|
162
164
|
name: this.discriminant.name,
|
|
163
165
|
});
|
|
164
166
|
case "hybrid":
|
|
165
167
|
return Maybe.of({
|
|
166
168
|
descendantValues: [],
|
|
169
|
+
jsonName: this.discriminant.jsonName,
|
|
167
170
|
ownValues: this.discriminant.memberValues.flatMap((_) => _.ownValues),
|
|
168
171
|
name: "termType",
|
|
169
172
|
});
|
|
170
173
|
case "intrinsic":
|
|
171
174
|
return Maybe.of({
|
|
172
175
|
descendantValues: this.discriminant.memberValues.flatMap((_) => _.descendantValues),
|
|
176
|
+
jsonName: this.discriminant.jsonName,
|
|
173
177
|
name: this.discriminant.name,
|
|
174
178
|
ownValues: this.discriminant.memberValues.flatMap((_) => _.ownValues),
|
|
175
179
|
});
|
|
@@ -220,7 +224,7 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
220
224
|
return ${type.equalsFunction}(${unwrap(code `left`)} as ${type.name}, ${unwrap(code `right`)} as ${type.name});
|
|
221
225
|
}`))}
|
|
222
226
|
|
|
223
|
-
return ${imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
|
|
227
|
+
return ${this.reusables.imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
|
|
224
228
|
})`;
|
|
225
229
|
}
|
|
226
230
|
get inlineFilterFunction() {
|
|
@@ -276,7 +280,7 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
|
|
|
276
280
|
return code `\
|
|
277
281
|
(((values, _options) =>
|
|
278
282
|
values.chain(values => values.chainMap(value => {
|
|
279
|
-
const valueAsValues = ${imports.Right}(value.toValues());
|
|
283
|
+
const valueAsValues = ${this.reusables.imports.Right}(value.toValues());
|
|
280
284
|
return ${this.members.reduce((expression, { type, primaryDiscriminantValue }, memberI) => {
|
|
281
285
|
let typeExpression = type.fromRdfResourceValuesExpression({
|
|
282
286
|
variables: {
|
|
@@ -295,24 +299,24 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
|
|
|
295
299
|
this.discriminant.memberValues[memberI].kind === "extrinsic")) {
|
|
296
300
|
typeExpression = code `${typeExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: ${literalOf(primaryDiscriminantValue)} as const, value }) as (${this.name})))`;
|
|
297
301
|
}
|
|
298
|
-
typeExpression = code `(${typeExpression} as ${imports.Either}<Error, ${imports.Resource}.Values<${this.name}>>)`;
|
|
302
|
+
typeExpression = code `(${typeExpression} as ${this.reusables.imports.Either}<Error, ${this.reusables.imports.Resource}.Values<${this.name}>>)`;
|
|
299
303
|
return expression !== null
|
|
300
304
|
? code `${expression}.altLazy(() => ${typeExpression})`
|
|
301
305
|
: typeExpression;
|
|
302
306
|
}, null)}.chain(values => values.head());
|
|
303
307
|
}))
|
|
304
|
-
) satisfies ${snippets.FromRdfResourceValuesFunction}<${this.name}>)`;
|
|
308
|
+
) satisfies ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.name}>)`;
|
|
305
309
|
}
|
|
306
310
|
get inlineJsonSchema() {
|
|
307
311
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
308
312
|
switch (discriminant.kind) {
|
|
309
313
|
case "extrinsic":
|
|
310
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
|
|
314
|
+
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
|
|
311
315
|
case "hybrid":
|
|
312
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
316
|
+
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
313
317
|
switch (discriminant.memberValues[memberI].kind) {
|
|
314
318
|
case "extrinsic":
|
|
315
|
-
return code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
|
|
319
|
+
return code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
|
|
316
320
|
case "intrinsic":
|
|
317
321
|
return type.jsonSchema({
|
|
318
322
|
includeDiscriminantProperty: true,
|
|
@@ -323,12 +327,12 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
|
|
|
323
327
|
}
|
|
324
328
|
}), { on: "," })}]).readonly()`;
|
|
325
329
|
case "intrinsic":
|
|
326
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
|
|
330
|
+
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
|
|
327
331
|
includeDiscriminantProperty: true,
|
|
328
332
|
context: "type",
|
|
329
333
|
})), { on: "," })}]).readonly()`;
|
|
330
334
|
case "typeof":
|
|
331
|
-
return code `${imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
|
|
335
|
+
return code `${this.reusables.imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
|
|
332
336
|
default:
|
|
333
337
|
throw discriminant;
|
|
334
338
|
}
|
|
@@ -398,11 +402,11 @@ ${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap })
|
|
|
398
402
|
(((value, _options): (${joinCode([...this.toRdfResourceValueTypes].map((toRdfResourceValueType) => {
|
|
399
403
|
switch (toRdfResourceValueType) {
|
|
400
404
|
case "BlankNode":
|
|
401
|
-
return code `${imports.BlankNode}`;
|
|
405
|
+
return code `${this.reusables.imports.BlankNode}`;
|
|
402
406
|
case "Literal":
|
|
403
|
-
return code `${imports.Literal}`;
|
|
407
|
+
return code `${this.reusables.imports.Literal}`;
|
|
404
408
|
case "NamedNode":
|
|
405
|
-
return code `${imports.NamedNode}`;
|
|
409
|
+
return code `${this.reusables.imports.NamedNode}`;
|
|
406
410
|
default:
|
|
407
411
|
toRdfResourceValueType;
|
|
408
412
|
throw new Error();
|
|
@@ -419,7 +423,7 @@ ${joinCode(this.members.map(({ type, unwrap, typeCheck }) => code `if (${typeChe
|
|
|
419
423
|
})}; }`))}
|
|
420
424
|
|
|
421
425
|
throw new Error("unable to serialize to RDF");
|
|
422
|
-
}) satisfies ${snippets.ToRdfResourceValuesFunction}<${this.name}>)`;
|
|
426
|
+
}) satisfies ${this.reusables.snippets.ToRdfResourceValuesFunction}<${this.name}>)`;
|
|
423
427
|
}
|
|
424
428
|
get inlineToStringFunction() {
|
|
425
429
|
return code `\
|
|
@@ -434,24 +438,24 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
434
438
|
get inlineValueSparqlConstructTriplesFunction() {
|
|
435
439
|
return code `\
|
|
436
440
|
((({ ignoreRdfType, filter, schema, ...otherParameters }) => {
|
|
437
|
-
let triples: ${imports.sparqljs}.Triple[] = [];
|
|
441
|
+
let triples: ${this.reusables.imports.sparqljs}.Triple[] = [];
|
|
438
442
|
|
|
439
443
|
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
440
444
|
triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }));`))}
|
|
441
445
|
|
|
442
446
|
return triples;
|
|
443
|
-
}) satisfies ${snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
447
|
+
}) satisfies ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
444
448
|
}
|
|
445
449
|
get inlineValueSparqlWherePatternsFunction() {
|
|
446
450
|
return code `\
|
|
447
451
|
((({ filter, schema, ...otherParameters }) => {
|
|
448
|
-
const unionPatterns: ${imports.sparqljs}.GroupPattern[] = [];
|
|
452
|
+
const unionPatterns: ${this.reusables.imports.sparqljs}.GroupPattern[] = [];
|
|
449
453
|
|
|
450
454
|
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
451
455
|
unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }).concat(), type: "group" });`))}
|
|
452
456
|
|
|
453
457
|
return [{ patterns: unionPatterns, type: "union" }];
|
|
454
|
-
}) satisfies ${snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
458
|
+
}) satisfies ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
455
459
|
}
|
|
456
460
|
get schemaObject() {
|
|
457
461
|
return {
|
|
@@ -539,6 +543,7 @@ export var Discriminant;
|
|
|
539
543
|
// extrinsic with user-specified values
|
|
540
544
|
if (members.some((member) => member.discriminantValue.isJust())) {
|
|
541
545
|
return {
|
|
546
|
+
jsonName: "type",
|
|
542
547
|
kind: "extrinsic",
|
|
543
548
|
memberValues: members.map((member, memberI) => member.discriminantValue.orDefault(memberI)),
|
|
544
549
|
name: "type",
|
|
@@ -547,19 +552,20 @@ export var Discriminant;
|
|
|
547
552
|
const memberTypes = members.map((member) => member.type);
|
|
548
553
|
// intrinsic
|
|
549
554
|
{
|
|
550
|
-
let
|
|
555
|
+
let inlineDiscriminantProperty;
|
|
551
556
|
const memberValues = [];
|
|
552
557
|
for (const memberType of memberTypes) {
|
|
553
558
|
const memberTypeDiscriminantProperty = memberType.discriminantProperty.extract();
|
|
554
559
|
if (!memberTypeDiscriminantProperty) {
|
|
555
|
-
|
|
560
|
+
inlineDiscriminantProperty = undefined;
|
|
556
561
|
break;
|
|
557
562
|
}
|
|
558
|
-
if (!
|
|
559
|
-
|
|
563
|
+
if (!inlineDiscriminantProperty) {
|
|
564
|
+
inlineDiscriminantProperty = memberTypeDiscriminantProperty;
|
|
560
565
|
}
|
|
561
|
-
else if (memberTypeDiscriminantProperty.name !==
|
|
562
|
-
|
|
566
|
+
else if (memberTypeDiscriminantProperty.name !==
|
|
567
|
+
inlineDiscriminantProperty.name) {
|
|
568
|
+
inlineDiscriminantProperty = undefined;
|
|
563
569
|
break;
|
|
564
570
|
}
|
|
565
571
|
memberValues.push({
|
|
@@ -567,11 +573,12 @@ export var Discriminant;
|
|
|
567
573
|
ownValues: memberTypeDiscriminantProperty.ownValues,
|
|
568
574
|
});
|
|
569
575
|
}
|
|
570
|
-
if (
|
|
576
|
+
if (inlineDiscriminantProperty) {
|
|
571
577
|
return {
|
|
578
|
+
jsonName: inlineDiscriminantProperty.jsonName,
|
|
572
579
|
kind: "intrinsic",
|
|
573
580
|
memberValues,
|
|
574
|
-
name:
|
|
581
|
+
name: inlineDiscriminantProperty.name,
|
|
575
582
|
};
|
|
576
583
|
}
|
|
577
584
|
}
|
|
@@ -608,6 +615,7 @@ export var Discriminant;
|
|
|
608
615
|
}
|
|
609
616
|
}
|
|
610
617
|
return {
|
|
618
|
+
jsonName: "termType",
|
|
611
619
|
kind: "hybrid",
|
|
612
620
|
memberValues: memberTypes.map((memberType, memberTypeI) => {
|
|
613
621
|
const memberTermTypes = termTypes(memberType);
|
|
@@ -650,6 +658,7 @@ export var Discriminant;
|
|
|
650
658
|
}
|
|
651
659
|
invariant(memberValues.length === memberTypes.length);
|
|
652
660
|
return {
|
|
661
|
+
jsonName: "type",
|
|
653
662
|
kind: "extrinsic",
|
|
654
663
|
name: "type",
|
|
655
664
|
memberValues: memberValues,
|
|
@@ -3,19 +3,19 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
3
3
|
export declare class BigDecimalType extends AbstractLiteralType {
|
|
4
4
|
readonly filterFunction: Code;
|
|
5
5
|
readonly filterType: Code;
|
|
6
|
-
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
7
6
|
readonly kind = "BigDecimalType";
|
|
8
7
|
readonly name: Code;
|
|
9
8
|
readonly schemaType: Code;
|
|
10
9
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
11
10
|
get conversions(): readonly AbstractLiteralType.Conversion[];
|
|
11
|
+
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
12
12
|
fromJsonExpression({ variables, }: Parameters<AbstractLiteralType["fromJsonExpression"]>[0]): Code;
|
|
13
13
|
graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
|
|
14
14
|
hashStatements({ variables, }: Parameters<AbstractLiteralType["hashStatements"]>[0]): readonly Code[];
|
|
15
|
-
jsonType(): AbstractLiteralType.JsonType;
|
|
16
15
|
jsonSchema(): Code;
|
|
16
|
+
jsonType(): AbstractLiteralType.JsonType;
|
|
17
17
|
toJsonExpression({ variables, }: Parameters<AbstractLiteralType["toJsonExpression"]>[0]): Code;
|
|
18
|
-
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractLiteralType["fromRdfExpressionChain"]>[0]): ReturnType<AbstractLiteralType["fromRdfExpressionChain"]>;
|
|
19
18
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractLiteralType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
19
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractLiteralType["fromRdfExpressionChain"]>[0]): ReturnType<AbstractLiteralType["fromRdfExpressionChain"]>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=BigDecimalType.d.ts.map
|
|
@@ -6,22 +6,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Memoize } from "typescript-memoize";
|
|
8
8
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
9
|
-
import { imports } from "./imports.js";
|
|
10
|
-
import { snippets } from "./snippets.js";
|
|
11
9
|
import { code } from "./ts-poet-wrapper.js";
|
|
12
10
|
export class BigDecimalType extends AbstractLiteralType {
|
|
13
|
-
filterFunction = code `${snippets.filterBigDecimal}`;
|
|
14
|
-
filterType = code `${snippets.NumericFilter}<${imports.BigDecimal}>`;
|
|
15
|
-
graphqlType = new AbstractLiteralType.GraphqlType(code `${imports.GraphQLString}`);
|
|
11
|
+
filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
|
|
12
|
+
filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
|
|
16
13
|
kind = "BigDecimalType";
|
|
17
|
-
name = code `${imports.BigDecimal}`;
|
|
18
|
-
schemaType = code `${snippets.NumericSchema}<${imports.BigDecimal}>`;
|
|
19
|
-
valueSparqlWherePatternsFunction = code `${snippets.bigDecimalSparqlWherePatterns}`;
|
|
14
|
+
name = code `${this.reusables.imports.BigDecimal}`;
|
|
15
|
+
schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
|
|
16
|
+
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
|
|
20
17
|
get conversions() {
|
|
21
18
|
return [
|
|
22
19
|
// {
|
|
23
20
|
// conversionExpression: (value) =>
|
|
24
|
-
// code`new ${imports.BigDecimal}(${value}.toString())`,
|
|
21
|
+
// code`new ${this.reusables.imports.BigDecimal}(${value}.toString())`,
|
|
25
22
|
// sourceTypeCheckExpression: (value) =>
|
|
26
23
|
// code`typeof ${value} === "bigint"`,
|
|
27
24
|
// sourceTypeName: code`bigint`,
|
|
@@ -30,12 +27,12 @@ export class BigDecimalType extends AbstractLiteralType {
|
|
|
30
27
|
{
|
|
31
28
|
conversionExpression: (value) => value,
|
|
32
29
|
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
|
|
33
|
-
sourceTypeName: code `${imports.BigDecimal}`,
|
|
30
|
+
sourceTypeName: code `${this.reusables.imports.BigDecimal}`,
|
|
34
31
|
sourceTypeof: "object",
|
|
35
32
|
},
|
|
36
33
|
// {
|
|
37
34
|
// conversionExpression: (value) =>
|
|
38
|
-
// code`new ${imports.BigDecimal}(${value})`,
|
|
35
|
+
// code`new ${this.reusables.imports.BigDecimal}(${value})`,
|
|
39
36
|
// sourceTypeCheckExpression: (value) =>
|
|
40
37
|
// code`typeof ${value} === "number"`,
|
|
41
38
|
// sourceTypeName: code`number`,
|
|
@@ -43,7 +40,7 @@ export class BigDecimalType extends AbstractLiteralType {
|
|
|
43
40
|
// },
|
|
44
41
|
// {
|
|
45
42
|
// conversionExpression: (value) =>
|
|
46
|
-
// code`new ${imports.BigDecimal}(${value})`,
|
|
43
|
+
// code`new ${this.reusables.imports.BigDecimal}(${value})`,
|
|
47
44
|
// sourceTypeCheckExpression: (value) =>
|
|
48
45
|
// code`typeof ${value} === "string"`,
|
|
49
46
|
// sourceTypeName: code`string`,
|
|
@@ -51,8 +48,11 @@ export class BigDecimalType extends AbstractLiteralType {
|
|
|
51
48
|
// },
|
|
52
49
|
];
|
|
53
50
|
}
|
|
51
|
+
get graphqlType() {
|
|
52
|
+
return new AbstractLiteralType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
|
|
53
|
+
}
|
|
54
54
|
fromJsonExpression({ variables, }) {
|
|
55
|
-
return code `new ${imports.BigDecimal}(${variables.value})`;
|
|
55
|
+
return code `new ${this.reusables.imports.BigDecimal}(${variables.value})`;
|
|
56
56
|
}
|
|
57
57
|
graphqlResolveExpression({ variables, }) {
|
|
58
58
|
return code `${variables.value}.toFixed()`;
|
|
@@ -60,32 +60,35 @@ export class BigDecimalType extends AbstractLiteralType {
|
|
|
60
60
|
hashStatements({ variables, }) {
|
|
61
61
|
return [code `${variables.hasher}.update(${variables.value}.toFixed());`];
|
|
62
62
|
}
|
|
63
|
+
jsonSchema() {
|
|
64
|
+
return code `${this.reusables.imports.z}.string()`;
|
|
65
|
+
}
|
|
63
66
|
jsonType() {
|
|
64
67
|
return new AbstractLiteralType.JsonType("string");
|
|
65
68
|
}
|
|
66
|
-
jsonSchema() {
|
|
67
|
-
return code `${imports.z}.string()`;
|
|
68
|
-
}
|
|
69
69
|
toJsonExpression({ variables, }) {
|
|
70
70
|
return code `${variables.value}.toFixed()`;
|
|
71
71
|
}
|
|
72
|
+
toRdfResourceValuesExpression({ variables, }) {
|
|
73
|
+
return code `[${this.reusables.snippets.bigDecimalLiteral}(${variables.value})]`;
|
|
74
|
+
}
|
|
72
75
|
fromRdfExpressionChain({ variables, }) {
|
|
73
76
|
return {
|
|
74
77
|
...super.fromRdfExpressionChain({ variables }),
|
|
75
|
-
valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${snippets.decodeBigDecimalLiteral})))`,
|
|
78
|
+
valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${this.reusables.snippets.decodeBigDecimalLiteral})))`,
|
|
76
79
|
};
|
|
77
80
|
}
|
|
78
|
-
toRdfResourceValuesExpression({ variables, }) {
|
|
79
|
-
return code `[${snippets.bigDecimalLiteral}(${variables.value})]`;
|
|
80
|
-
}
|
|
81
81
|
}
|
|
82
82
|
__decorate([
|
|
83
83
|
Memoize()
|
|
84
84
|
], BigDecimalType.prototype, "conversions", null);
|
|
85
85
|
__decorate([
|
|
86
86
|
Memoize()
|
|
87
|
-
], BigDecimalType.prototype, "
|
|
87
|
+
], BigDecimalType.prototype, "graphqlType", null);
|
|
88
88
|
__decorate([
|
|
89
89
|
Memoize()
|
|
90
90
|
], BigDecimalType.prototype, "jsonSchema", null);
|
|
91
|
+
__decorate([
|
|
92
|
+
Memoize()
|
|
93
|
+
], BigDecimalType.prototype, "jsonType", null);
|
|
91
94
|
//# sourceMappingURL=BigDecimalType.js.map
|
|
@@ -2,9 +2,9 @@ import { NonEmptyList } from "purify-ts";
|
|
|
2
2
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare class BigIntType extends AbstractNumericType<bigint> {
|
|
5
|
-
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
6
5
|
readonly kind = "BigIntType";
|
|
7
6
|
readonly typeofs: NonEmptyList<"bigint">;
|
|
7
|
+
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
8
|
get conversions(): readonly AbstractNumericType.Conversion[];
|
|
9
9
|
fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
|
|
10
10
|
jsonSchema(_parameters: Parameters<AbstractNumericType<bigint>["jsonSchema"]>[0]): Code;
|
|
@@ -7,12 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { NonEmptyList } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
|
-
import { imports } from "./imports.js";
|
|
11
10
|
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
12
11
|
export class BigIntType extends AbstractNumericType {
|
|
13
|
-
graphqlType = new AbstractNumericType.GraphqlType(code `${imports.GraphQLBigInt}`);
|
|
14
12
|
kind = "BigIntType";
|
|
15
13
|
typeofs = NonEmptyList(["bigint"]);
|
|
14
|
+
get graphqlType() {
|
|
15
|
+
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
|
|
16
|
+
}
|
|
16
17
|
get conversions() {
|
|
17
18
|
if (this.in_.length > 0) {
|
|
18
19
|
return super.conversions;
|
|
@@ -34,11 +35,11 @@ export class BigIntType extends AbstractNumericType {
|
|
|
34
35
|
jsonSchema(_parameters) {
|
|
35
36
|
switch (this.primitiveIn.length) {
|
|
36
37
|
case 0:
|
|
37
|
-
return code `${imports.z}.string()`;
|
|
38
|
+
return code `${this.reusables.imports.z}.string()`;
|
|
38
39
|
case 1:
|
|
39
|
-
return code `${imports.z}.literal(${literalOf(this.primitiveIn[0].toString())})`;
|
|
40
|
+
return code `${this.reusables.imports.z}.literal(${literalOf(this.primitiveIn[0].toString())})`;
|
|
40
41
|
default:
|
|
41
|
-
return code `${imports.z}.enum([${joinCode(this.primitiveIn.map((value) => code `${literalOf(value.toString())}`), { on: "," })}])`;
|
|
42
|
+
return code `${this.reusables.imports.z}.enum([${joinCode(this.primitiveIn.map((value) => code `${literalOf(value.toString())}`), { on: "," })}])`;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
jsonType() {
|
|
@@ -54,6 +55,9 @@ export class BigIntType extends AbstractNumericType {
|
|
|
54
55
|
return `${value.toString()}n`;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
__decorate([
|
|
59
|
+
Memoize()
|
|
60
|
+
], BigIntType.prototype, "graphqlType", null);
|
|
57
61
|
__decorate([
|
|
58
62
|
Memoize()
|
|
59
63
|
], BigIntType.prototype, "jsonType", null);
|
|
@@ -7,18 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Memoize } from "typescript-memoize";
|
|
8
8
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
9
9
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
10
|
-
import { imports } from "./imports.js";
|
|
11
|
-
import { snippets } from "./snippets.js";
|
|
12
10
|
import { code } from "./ts-poet-wrapper.js";
|
|
13
11
|
export class BlankNodeType extends AbstractIdentifierType {
|
|
14
|
-
filterFunction = code `${snippets.filterBlankNode}`;
|
|
15
|
-
filterType = code `${snippets.BlankNodeFilter}`;
|
|
16
|
-
parseFunction = code `${snippets.parseBlankNode};`;
|
|
12
|
+
filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
|
|
13
|
+
filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
|
|
14
|
+
parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
|
|
17
15
|
kind = "BlankNodeType";
|
|
18
|
-
name = code `${imports.BlankNode}`;
|
|
16
|
+
name = code `${this.reusables.imports.BlankNode}`;
|
|
19
17
|
nodeKinds = nodeKinds;
|
|
20
|
-
schemaType = code `${snippets.BlankNodeSchema}`;
|
|
21
|
-
valueSparqlWherePatternsFunction = code `${snippets.blankNodeSparqlWherePatterns}`;
|
|
18
|
+
schemaType = code `${this.reusables.snippets.BlankNodeSchema}`;
|
|
19
|
+
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.blankNodeSparqlWherePatterns}`;
|
|
22
20
|
constructor(superParameters) {
|
|
23
21
|
super({
|
|
24
22
|
...superParameters,
|
|
@@ -27,7 +25,7 @@ export class BlankNodeType extends AbstractIdentifierType {
|
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
fromJsonExpression({ variables, }) {
|
|
30
|
-
return code `${imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2))`;
|
|
28
|
+
return code `${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2))`;
|
|
31
29
|
}
|
|
32
30
|
jsonType(parameters) {
|
|
33
31
|
const discriminantProperty = parameters?.includeDiscriminantProperty
|
|
@@ -37,9 +35,9 @@ export class BlankNodeType extends AbstractIdentifierType {
|
|
|
37
35
|
}
|
|
38
36
|
jsonSchema({ includeDiscriminantProperty, }) {
|
|
39
37
|
const discriminantProperty = includeDiscriminantProperty
|
|
40
|
-
? code `, termType: ${imports.z}.literal("BlankNode")`
|
|
38
|
+
? code `, termType: ${this.reusables.imports.z}.literal("BlankNode")`
|
|
41
39
|
: "";
|
|
42
|
-
return code `${imports.z}.object({ "@id": ${imports.z}.string().min(1)${discriminantProperty} })`;
|
|
40
|
+
return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
|
|
43
41
|
}
|
|
44
42
|
toJsonExpression({ includeDiscriminantProperty, variables, }) {
|
|
45
43
|
const discriminantProperty = includeDiscriminantProperty
|
|
@@ -4,11 +4,11 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
4
4
|
export declare class BooleanType extends AbstractPrimitiveType<boolean> {
|
|
5
5
|
readonly filterFunction: Code;
|
|
6
6
|
readonly filterType: Code;
|
|
7
|
-
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
7
|
readonly kind = "BooleanType";
|
|
9
8
|
readonly schemaType: Code;
|
|
10
9
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
11
10
|
readonly typeofs: NonEmptyList<"boolean">;
|
|
11
|
+
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
12
12
|
get name(): string;
|
|
13
13
|
protected get schemaObject(): {
|
|
14
14
|
in: boolean[] | undefined;
|
|
@@ -7,18 +7,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { NonEmptyList } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
10
|
-
import { imports } from "./imports.js";
|
|
11
|
-
import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
12
|
-
import { snippets } from "./snippets.js";
|
|
13
10
|
import { code } from "./ts-poet-wrapper.js";
|
|
14
11
|
export class BooleanType extends AbstractPrimitiveType {
|
|
15
|
-
filterFunction = code `${snippets.filterBoolean}`;
|
|
16
|
-
filterType = code `${snippets.BooleanFilter}`;
|
|
17
|
-
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${imports.GraphQLBoolean}`);
|
|
12
|
+
filterFunction = code `${this.reusables.snippets.filterBoolean}`;
|
|
13
|
+
filterType = code `${this.reusables.snippets.BooleanFilter}`;
|
|
18
14
|
kind = "BooleanType";
|
|
19
|
-
schemaType = code `${snippets.BooleanSchema}`;
|
|
20
|
-
valueSparqlWherePatternsFunction = code `${snippets.booleanSparqlWherePatterns}`;
|
|
15
|
+
schemaType = code `${this.reusables.snippets.BooleanSchema}`;
|
|
16
|
+
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
|
|
21
17
|
typeofs = NonEmptyList(["boolean"]);
|
|
18
|
+
get graphqlType() {
|
|
19
|
+
return new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
|
|
20
|
+
}
|
|
22
21
|
get name() {
|
|
23
22
|
if (this.primitiveIn.length > 0) {
|
|
24
23
|
return `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
|
|
@@ -33,12 +32,12 @@ export class BooleanType extends AbstractPrimitiveType {
|
|
|
33
32
|
}
|
|
34
33
|
jsonSchema(_parameters) {
|
|
35
34
|
if (this.primitiveIn.length === 1) {
|
|
36
|
-
return code `${imports.z}.literal(${this.primitiveIn[0]})`;
|
|
35
|
+
return code `${this.reusables.imports.z}.literal(${this.primitiveIn[0]})`;
|
|
37
36
|
}
|
|
38
|
-
return code `${imports.z}.boolean()`;
|
|
37
|
+
return code `${this.reusables.imports.z}.boolean()`;
|
|
39
38
|
}
|
|
40
39
|
toRdfResourceValuesExpression({ variables, }) {
|
|
41
|
-
return code `[${snippets.literalFactory}.boolean(${variables.value}, ${rdfjsTermExpression(this.datatype
|
|
40
|
+
return code `[${this.reusables.snippets.literalFactory}.boolean(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
|
|
42
41
|
}
|
|
43
42
|
fromRdfExpressionChain({ variables, }) {
|
|
44
43
|
return {
|
|
@@ -49,6 +48,9 @@ export class BooleanType extends AbstractPrimitiveType {
|
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
50
|
}
|
|
51
|
+
__decorate([
|
|
52
|
+
Memoize()
|
|
53
|
+
], BooleanType.prototype, "graphqlType", null);
|
|
52
54
|
__decorate([
|
|
53
55
|
Memoize()
|
|
54
56
|
], BooleanType.prototype, "name", null);
|