@shaclmate/compiler 4.0.38 → 4.0.40
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.js +12 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +24 -24
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -4
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/ast/AbstractCollectionType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.js +15 -15
- package/dist/ast/AbstractContainerType.d.ts +1 -1
- package/dist/ast/AbstractContainerType.js +15 -15
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -1
- package/dist/ast/AbstractTermType.d.ts +1 -1
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/BlankNodeType.js +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -1
- package/dist/ast/DefaultValueType.js +2 -2
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IdentifierType.js +1 -1
- package/dist/ast/IntersectionType.d.ts +1 -1
- package/dist/ast/IntersectionType.js +3 -3
- package/dist/ast/IriType.d.ts +1 -1
- package/dist/ast/IriType.js +1 -1
- package/dist/ast/LazyObjectOptionType.d.ts +1 -1
- package/dist/ast/LazyObjectOptionType.js +1 -1
- package/dist/ast/LazyObjectSetType.d.ts +1 -1
- package/dist/ast/LazyObjectSetType.js +1 -1
- package/dist/ast/LazyObjectType.d.ts +1 -1
- package/dist/ast/LazyObjectType.js +1 -1
- package/dist/ast/ListType.d.ts +1 -1
- package/dist/ast/ListType.js +16 -16
- package/dist/ast/LiteralType.d.ts +1 -1
- package/dist/ast/LiteralType.js +1 -1
- package/dist/ast/ObjectCompoundType.js +3 -3
- package/dist/ast/ObjectType.d.ts +1 -1
- package/dist/ast/ObjectType.js +16 -16
- package/dist/ast/OptionType.d.ts +1 -1
- package/dist/ast/OptionType.js +1 -1
- package/dist/ast/SetType.d.ts +1 -1
- package/dist/ast/SetType.js +1 -1
- package/dist/ast/TermType.d.ts +1 -1
- package/dist/ast/TermType.js +1 -1
- package/dist/ast/Type.js +15 -15
- package/dist/ast/UnionType.d.ts +1 -1
- package/dist/ast/UnionType.js +3 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +10 -10
- package/dist/generators/ts/AbstractCollectionType.d.ts +2 -6
- package/dist/generators/ts/AbstractCollectionType.js +16 -15
- package/dist/generators/ts/AbstractContainerType.d.ts +7 -11
- package/dist/generators/ts/AbstractContainerType.js +35 -36
- package/dist/generators/ts/AbstractDateType.d.ts +4 -4
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +14 -17
- package/dist/generators/ts/AbstractLazyObjectType.js +26 -38
- package/dist/generators/ts/AbstractLiteralType.d.ts +1 -5
- package/dist/generators/ts/AbstractLiteralType.js +7 -6
- package/dist/generators/ts/AbstractNumericType.d.ts +2 -2
- package/dist/generators/ts/AbstractNumericType.js +3 -3
- package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -6
- package/dist/generators/ts/AbstractPrimitiveType.js +9 -10
- package/dist/generators/ts/AbstractTermType.d.ts +1 -5
- package/dist/generators/ts/AbstractTermType.js +3 -17
- package/dist/generators/ts/AbstractType.d.ts +22 -15
- package/dist/generators/ts/AbstractType.js +18 -8
- package/dist/generators/ts/BigDecimalType.d.ts +2 -2
- package/dist/generators/ts/BigDecimalType.js +3 -3
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +3 -3
- package/dist/generators/ts/BlankNodeType.d.ts +4 -4
- package/dist/generators/ts/BlankNodeType.js +12 -12
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +11 -6
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +3 -7
- package/dist/generators/ts/DefaultValueType.js +17 -21
- package/dist/generators/ts/FloatType.d.ts +1 -1
- package/dist/generators/ts/FloatType.js +1 -1
- package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
- package/dist/generators/ts/GraphqlSchema.js +4 -4
- package/dist/generators/ts/IdentifierType.d.ts +4 -4
- package/dist/generators/ts/IdentifierType.js +14 -14
- package/dist/generators/ts/IntType.d.ts +1 -1
- package/dist/generators/ts/IntType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +4 -2
- package/dist/generators/ts/IriType.js +27 -22
- package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
- package/dist/generators/ts/LazyObjectOptionType.js +7 -7
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +6 -6
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +5 -5
- package/dist/generators/ts/ListType.d.ts +5 -6
- package/dist/generators/ts/ListType.js +24 -25
- package/dist/generators/ts/LiteralType.d.ts +3 -2
- package/dist/generators/ts/LiteralType.js +14 -7
- package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +24 -24
- package/dist/generators/ts/ObjectType.js +350 -0
- package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
- package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +54 -64
- package/dist/generators/ts/OptionType.d.ts +2 -6
- package/dist/generators/ts/OptionType.js +12 -18
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
- package/dist/generators/ts/SetType.d.ts +1 -1
- package/dist/generators/ts/SetType.js +1 -1
- package/dist/generators/ts/Snippets.d.ts +1 -0
- package/dist/generators/ts/Snippets.js +7 -0
- package/dist/generators/ts/SparqlObjectSetType.js +2 -2
- package/dist/generators/ts/StringType.d.ts +3 -3
- package/dist/generators/ts/StringType.js +11 -6
- package/dist/generators/ts/TermType.d.ts +3 -3
- package/dist/generators/ts/TermType.js +13 -13
- package/dist/generators/ts/TsGenerator.js +12 -9
- package/dist/generators/ts/Type.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.d.ts +7 -8
- package/dist/generators/ts/TypeFactory.js +79 -80
- package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +40 -15
- package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +328 -135
- package/dist/generators/ts/ZodGenerator.js +7 -9
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +13 -13
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +11 -14
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +3 -2
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +24 -15
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +3 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +20 -12
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +7 -31
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +8 -8
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +5 -5
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +14 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +2 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +24 -28
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +16 -0
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +3 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateArray.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +1 -1
- package/dist/generators/ts/tsComment.js +1 -1
- package/dist/input/generated.d.ts +1399 -1468
- package/dist/input/generated.js +518 -655
- package/package.json +4 -4
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
- package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
- package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
- package/dist/generators/ts/AnonymousUnionType.js +0 -59
- package/dist/generators/ts/NamedObjectType.js +0 -341
- package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
- package/dist/generators/ts/NamedUnionType.d.ts +0 -11
- package/dist/generators/ts/NamedUnionType.js +0 -13
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/removeUndefined.d.ts +0 -2
- package/dist/generators/ts/removeUndefined.js +0 -17
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
8
8
|
export const valueSparqlConstructTriples: ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, valueVariable, variablePrefix }) =>
|
|
9
|
-
${this.
|
|
9
|
+
${this.alias.unsafeCoerce()}.focusSparqlConstructTriples({ filter, focusIdentifier: valueVariable, ignoreRdfType, variablePrefix });`);
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_valueSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_valueSparqlWherePatternsFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
8
8
|
export const valueSparqlWherePatterns: ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, preferredLanguages, propertyPatterns, valueVariable, variablePrefix }) =>
|
|
9
9
|
(propertyPatterns as readonly ${this.reusables.snippets.SparqlPattern}[]).concat(
|
|
10
|
-
${this.
|
|
10
|
+
${this.alias.unsafeCoerce()}.focusSparqlWherePatterns({ filter, focusIdentifier: valueVariable, ignoreRdfType, preferredLanguages, variablePrefix })
|
|
11
11
|
);`);
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.js.map
|
|
@@ -8,7 +8,7 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
|
|
|
8
8
|
private readonly description;
|
|
9
9
|
private readonly display;
|
|
10
10
|
private readonly label;
|
|
11
|
-
readonly kind = "
|
|
11
|
+
readonly kind = "Shacl";
|
|
12
12
|
readonly mutable: boolean;
|
|
13
13
|
readonly path: PropertyPath;
|
|
14
14
|
readonly recursive: boolean;
|
|
@@ -30,11 +30,7 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
|
|
|
30
30
|
get graphqlField(): AbstractProperty<TypeT>["graphqlField"];
|
|
31
31
|
get jsonSchema(): AbstractProperty<TypeT>["jsonSchema"];
|
|
32
32
|
get jsonSignature(): Maybe<Code>;
|
|
33
|
-
protected get
|
|
34
|
-
path: Code | undefined;
|
|
35
|
-
kind: Code;
|
|
36
|
-
type: Code;
|
|
37
|
-
};
|
|
33
|
+
protected get schemaInitializers(): readonly Code[];
|
|
38
34
|
constructorInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["constructorInitializer"]>[0]): Maybe<Code>;
|
|
39
35
|
fromJsonInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["fromJsonInitializer"]>[0]): Maybe<Code>;
|
|
40
36
|
fromRdfResourceValuesInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["fromRdfResourceValuesInitializer"]>[0]): Maybe<Code>;
|
|
@@ -14,7 +14,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
14
14
|
description;
|
|
15
15
|
display;
|
|
16
16
|
label;
|
|
17
|
-
kind = "
|
|
17
|
+
kind = "Shacl";
|
|
18
18
|
mutable;
|
|
19
19
|
path;
|
|
20
20
|
recursive;
|
|
@@ -31,7 +31,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
31
31
|
get constructorParameter() {
|
|
32
32
|
const conversionFunction = this.type.conversionFunction.extract();
|
|
33
33
|
if (!conversionFunction) {
|
|
34
|
-
return Maybe.of(code `readonly ${this.name}: ${this.type.
|
|
34
|
+
return Maybe.of(code `readonly ${this.name}: ${this.type.expression};`);
|
|
35
35
|
}
|
|
36
36
|
let hasQuestionToken = false;
|
|
37
37
|
const typeNames = [];
|
|
@@ -40,7 +40,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
40
40
|
hasQuestionToken = true;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
typeNames.push(code `${type.
|
|
43
|
+
typeNames.push(code `${type.expression}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
|
|
@@ -55,7 +55,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
55
55
|
.alt(this.description)
|
|
56
56
|
.alt(this.label)
|
|
57
57
|
.map(tsComment)
|
|
58
|
-
.orDefault("")}${joinCode(lhs, { on: " " })}: ${this.type.
|
|
58
|
+
.orDefault("")}${joinCode(lhs, { on: " " })}: ${this.type.expression};`;
|
|
59
59
|
}
|
|
60
60
|
get filterProperty() {
|
|
61
61
|
return Maybe.of({
|
|
@@ -97,24 +97,20 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
97
97
|
const typeJsonType = this.type.jsonType();
|
|
98
98
|
return Maybe.of(code `${!this.mutable ? "readonly " : ""}${this.name}${typeJsonType.optional ? "?" : ""}: ${typeJsonType.requiredName}`);
|
|
99
99
|
}
|
|
100
|
-
get
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// this.visibility !== "public"
|
|
115
|
-
// ? `${JSON.stringify(this.visibility)} as const`
|
|
116
|
-
// : undefined,
|
|
117
|
-
};
|
|
100
|
+
get schemaInitializers() {
|
|
101
|
+
const initializers = super.schemaInitializers.concat();
|
|
102
|
+
if (this.configuration.features.has("Object.fromRdf") ||
|
|
103
|
+
this.configuration.features.has("Object.toRdf")) {
|
|
104
|
+
initializers.push(code `path: ${this.propertyPathToCode(this.path)}`);
|
|
105
|
+
}
|
|
106
|
+
// Use a getter if the type is recursive or the type is an object type, which may have forward references in the file
|
|
107
|
+
if (this.recursive || this.type.referencesObjectType) {
|
|
108
|
+
initializers.push(code `get type() { return ${this.type.schema}; }`);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
initializers.push(code `type: ${this.type.schema}`);
|
|
112
|
+
}
|
|
113
|
+
return initializers;
|
|
118
114
|
}
|
|
119
115
|
constructorInitializer({ variables, }) {
|
|
120
116
|
const parameterVariable = code `${variables.parameters}.${this.name}`;
|
|
@@ -122,13 +118,13 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
122
118
|
const validationFunction = this.type.validationFunction.extract();
|
|
123
119
|
let rhs;
|
|
124
120
|
if (conversionFunction && validationFunction) {
|
|
125
|
-
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.
|
|
121
|
+
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.type, value))`;
|
|
126
122
|
}
|
|
127
123
|
else if (conversionFunction) {
|
|
128
124
|
rhs = code `${conversionFunction}(${parameterVariable})`;
|
|
129
125
|
}
|
|
130
126
|
else if (validationFunction) {
|
|
131
|
-
rhs = code `${validationFunction}(${this.
|
|
127
|
+
rhs = code `${validationFunction}(${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.type, ${parameterVariable})`;
|
|
132
128
|
}
|
|
133
129
|
else {
|
|
134
130
|
rhs = code `${this.reusables.imports.Either}.of(${parameterVariable})`;
|
|
@@ -152,7 +148,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
152
148
|
variables: {
|
|
153
149
|
...variables,
|
|
154
150
|
ignoreRdfType: true,
|
|
155
|
-
propertyPath: code `${this.
|
|
151
|
+
propertyPath: code `${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.path`,
|
|
156
152
|
resourceValues: code `resourceValues`,
|
|
157
153
|
},
|
|
158
154
|
})})`,
|
|
@@ -213,7 +209,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
213
209
|
default:
|
|
214
210
|
return [];
|
|
215
211
|
}
|
|
216
|
-
const propertyPath = code `${this.
|
|
212
|
+
const propertyPath = code `${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.path`;
|
|
217
213
|
return [
|
|
218
214
|
code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfResourceValuesExpression({
|
|
219
215
|
variables: { ...variables, propertyPath },
|
|
@@ -230,12 +226,12 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
230
226
|
switch (propertyPath.termType) {
|
|
231
227
|
case "AlternativePath":
|
|
232
228
|
case "SequencePath":
|
|
233
|
-
return code `{ members: [${joinCode(propertyPath.members.map((member) => this.propertyPathToCode(member)), { on: "," })}]
|
|
229
|
+
return code `{ members: [${joinCode(propertyPath.members.map((member) => this.propertyPathToCode(member)), { on: "," })}], termType: ${literalOf(propertyPath.termType)} }`;
|
|
234
230
|
case "InversePath":
|
|
235
231
|
case "OneOrMorePath":
|
|
236
232
|
case "ZeroOrMorePath":
|
|
237
233
|
case "ZeroOrOnePath":
|
|
238
|
-
return code `{ path: ${this.propertyPathToCode(propertyPath.path)}, termType: ${literalOf(propertyPath.termType)}
|
|
234
|
+
return code `{ path: ${this.propertyPathToCode(propertyPath.path)}, termType: ${literalOf(propertyPath.termType)} }`;
|
|
239
235
|
case "NamedNode":
|
|
240
236
|
return this.rdfjsTermExpression(propertyPath);
|
|
241
237
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { codeEquals } from "../codeEquals.js";
|
|
1
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
2
3
|
export function identifierTypeDeclarations() {
|
|
3
4
|
if (!this.configuration.features.has("Object.type")) {
|
|
4
5
|
return [];
|
|
5
6
|
}
|
|
6
|
-
const ancestorObjectTypeWithSameIdentifierType = this.ancestorObjectTypes.find((ancestorObjectType) => ancestorObjectType.identifierType.
|
|
7
|
+
const ancestorObjectTypeWithSameIdentifierType = this.ancestorObjectTypes.find((ancestorObjectType) => ancestorObjectType.identifierType.kind === this.identifierType.kind &&
|
|
8
|
+
codeEquals(ancestorObjectType.identifierType.expression, this.identifierType.expression));
|
|
7
9
|
if (ancestorObjectTypeWithSameIdentifierType) {
|
|
8
10
|
// This object type's identifier type has the same identifier type as an ancestor object type,
|
|
9
11
|
// so just reuse the latter.
|
|
@@ -14,7 +16,7 @@ export function identifierTypeDeclarations() {
|
|
|
14
16
|
}
|
|
15
17
|
// Bespoke identifier type and associated functions
|
|
16
18
|
return [
|
|
17
|
-
code `export type Identifier = ${this.identifierType.
|
|
19
|
+
code `export type Identifier = ${this.identifierType.expression};`,
|
|
18
20
|
code `\
|
|
19
21
|
export namespace Identifier {
|
|
20
22
|
export const parse = ${this.identifierType.parseFunction};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_BooleanSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}BooleanSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}BooleanSchema {
|
|
3
|
+
interface ${syntheticNamePrefix}BooleanSchema<T extends boolean> {
|
|
4
|
+
readonly in?: readonly T[];
|
|
4
5
|
readonly kind: "Boolean";
|
|
5
|
-
readonly in?: readonly boolean[];
|
|
6
6
|
}`);
|
|
7
7
|
//# sourceMappingURL=snippets_BooleanSchema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_CollectionSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}CollectionSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}CollectionSchema<ItemSchemaT> {
|
|
4
|
-
readonly
|
|
4
|
+
readonly itemType: ItemSchemaT;
|
|
5
5
|
readonly kind: "List" | "Set";
|
|
6
6
|
readonly minCount?: number;
|
|
7
7
|
}`);
|
|
@@ -2,7 +2,7 @@ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
|
2
2
|
export const snippets_DefaultValueSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DefaultValueSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}DefaultValueSchema<DefaultValueT, ItemSchemaT> {
|
|
4
4
|
readonly defaultValue: DefaultValueT;
|
|
5
|
-
readonly
|
|
5
|
+
readonly itemType: ItemSchemaT;
|
|
6
6
|
readonly kind: "DefaultValue";
|
|
7
7
|
}`);
|
|
8
8
|
//# sourceMappingURL=snippets_DefaultValueSchema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_IriSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}IriSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}IriSchema {
|
|
4
|
-
readonly in?: readonly ${imports.NamedNode}[];
|
|
3
|
+
interface ${syntheticNamePrefix}IriSchema<IriT extends string = string> {
|
|
4
|
+
readonly in?: readonly ${imports.NamedNode}<IriT>[];
|
|
5
5
|
readonly kind: "Iri";
|
|
6
6
|
}`);
|
|
7
7
|
//# sourceMappingURL=snippets_IriSchema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_MaybeSchema = ({ syntheticNamePrefix }) => conditionalOutput(`${syntheticNamePrefix}MaybeSchema`, code `\
|
|
3
3
|
interface ${syntheticNamePrefix}MaybeSchema<ItemSchemaT>{
|
|
4
|
-
readonly
|
|
5
|
-
readonly kind: "
|
|
4
|
+
readonly itemType: ItemSchemaT;
|
|
5
|
+
readonly kind: "Option";
|
|
6
6
|
}`);
|
|
7
7
|
//# sourceMappingURL=snippets_MaybeSchema.js.map
|
|
@@ -3,6 +3,6 @@ export const snippets_ShaclPropertySchema = ({ snippets, syntheticNamePrefix, })
|
|
|
3
3
|
export interface ${syntheticNamePrefix}ShaclPropertySchema<TypeSchemaT = object> {
|
|
4
4
|
readonly kind: "Shacl";
|
|
5
5
|
readonly path: ${snippets.PropertyPath};
|
|
6
|
-
readonly type:
|
|
6
|
+
readonly type: TypeSchemaT;
|
|
7
7
|
}`);
|
|
8
8
|
//# sourceMappingURL=snippets_ShaclPropertySchema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_StringSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}StringSchema`, code `\
|
|
3
|
-
interface ${syntheticNamePrefix}StringSchema {
|
|
4
|
-
readonly in?: readonly
|
|
3
|
+
interface ${syntheticNamePrefix}StringSchema<T extends string> {
|
|
4
|
+
readonly in?: readonly T[];
|
|
5
5
|
readonly kind: "String";
|
|
6
6
|
}`);
|
|
7
7
|
//# sourceMappingURL=snippets_StringSchema.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_booleanSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanSparqlWherePatterns`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}booleanSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.BooleanFilter}, ${snippets.BooleanSchema}
|
|
3
|
+
const ${syntheticNamePrefix}booleanSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.BooleanFilter}, ${snippets.BooleanSchema}<boolean>> =
|
|
4
4
|
({ filter, valueVariable, ...otherParameters }) => {
|
|
5
5
|
const filterPatterns: ${snippets.SparqlFilterPattern}[] = [];
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_convertToIri = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIri`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}convertToIri<IriT extends string
|
|
3
|
+
function ${syntheticNamePrefix}convertToIri<IriT extends string>(value: IriT | ${imports.NamedNode}<IriT>): ${imports.Either}<Error, ${imports.NamedNode}<IriT>> {
|
|
4
4
|
switch (typeof value) {
|
|
5
5
|
case "object":
|
|
6
6
|
return ${imports.Either}.of(value);
|
|
@@ -2,7 +2,7 @@ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
|
2
2
|
export const snippets_defaultValueSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}defaultValueSparqlWherePatterns`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}defaultValueSparqlWherePatterns<ItemFilterT, ItemSchemaT>(itemSparqlWherePatternsFunction: ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ${snippets.DefaultValueSchema}<unknown, ItemSchemaT>> {
|
|
4
4
|
return ({ schema, ...otherParameters }) => {
|
|
5
|
-
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, schema: schema.
|
|
5
|
+
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, schema: schema.itemType }));
|
|
6
6
|
return [{ patterns: itemSparqlWherePatterns.concat(), type: "optional" }, ...liftSparqlPatterns];
|
|
7
7
|
}
|
|
8
8
|
}`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
3
|
+
export const snippets_ensureRdfResourceType = ({ imports, rdfjsTermExpression, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ensureRdfResourceType`, code `\
|
|
4
|
+
function ${syntheticNamePrefix}ensureRdfResourceType(resource: ${imports.Resource}, types: readonly ${imports.NamedNode}[], options: { graph: Exclude<${imports.Quad_Graph}, ${imports.Variable}> | undefined }): ${imports.Either}<Error, undefined> {
|
|
5
|
+
return resource.value(${rdfjsTermExpression(rdf.type)}, options).chain(actualRdfTypeValue => actualRdfTypeValue.toIri()).chain(actualRdfType => {
|
|
6
|
+
// Check the expected type and its known subtypes
|
|
7
|
+
for (const type of types) {
|
|
8
|
+
if (resource.isInstanceOf(type, options)) {
|
|
9
|
+
return ${imports.Right}(undefined);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return ${imports.Left}(new Error(\`\${resource.identifier} has unexpected RDF type (actual: \${actualRdfType}, expected one of \${types})\`));
|
|
14
|
+
});
|
|
15
|
+
}`);
|
|
16
|
+
//# sourceMappingURL=snippets_ensureRdfResourceType.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_iriSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}iriSparqlWherePatterns`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}iriSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.IriFilter}, ${snippets.IriSchema}
|
|
3
|
+
const ${syntheticNamePrefix}iriSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.IriFilter}, ${snippets.IriSchema}<string>> =
|
|
4
4
|
({ filter, valueVariable, ...otherParameters }) => {
|
|
5
5
|
const filterPatterns: ${snippets.SparqlFilterPattern}[] = [];
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ function ${syntheticNamePrefix}listSparqlConstructTriples<ItemFilterT, ItemSchem
|
|
|
10
10
|
// ?list rdf:first ?item0
|
|
11
11
|
const item0Variable = variable("Item0");
|
|
12
12
|
triples.push({ subject: listVariable, predicate: ${snippets.RdfVocabularies}.rdf.first, object: item0Variable });
|
|
13
|
-
triples = triples.concat(itemSparqlConstructTriplesFunction({ filter, ignoreRdfType: false, schema: schema.
|
|
13
|
+
triples = triples.concat(itemSparqlConstructTriplesFunction({ filter, ignoreRdfType: false, schema: schema.itemType, valueVariable: item0Variable, variablePrefix: variablePrefix("Item0") }));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
{
|
|
@@ -25,7 +25,7 @@ function ${syntheticNamePrefix}listSparqlConstructTriples<ItemFilterT, ItemSchem
|
|
|
25
25
|
// ?rest rdf:first ?itemN
|
|
26
26
|
const itemNVariable = variable("ItemN");
|
|
27
27
|
triples.push({ subject: restNVariable, predicate: ${snippets.RdfVocabularies}.rdf.first, object: itemNVariable });
|
|
28
|
-
triples = triples.concat(itemSparqlConstructTriplesFunction({ filter, ignoreRdfType: false, schema: schema.
|
|
28
|
+
triples = triples.concat(itemSparqlConstructTriplesFunction({ filter, ignoreRdfType: false, schema: schema.itemType, valueVariable: itemNVariable, variablePrefix: variablePrefix("ItemN") }));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// ?restN rdf:rest ?restNBasic to get the rdf:rest statement in the CONSTRUCT
|
|
@@ -32,7 +32,7 @@ function ${syntheticNamePrefix}listSparqlWherePatterns<ItemFilterT, ItemSchemaT>
|
|
|
32
32
|
ignoreRdfType: parameters.ignoreRdfType,
|
|
33
33
|
preferredLanguages: parameters.preferredLanguages,
|
|
34
34
|
propertyPatterns: [],
|
|
35
|
-
schema: parameters.schema.
|
|
35
|
+
schema: parameters.schema.itemType,
|
|
36
36
|
valueVariable: item0Variable,
|
|
37
37
|
variablePrefix: variablePrefix("Item0"),
|
|
38
38
|
}),
|
|
@@ -88,7 +88,7 @@ function ${syntheticNamePrefix}listSparqlWherePatterns<ItemFilterT, ItemSchemaT>
|
|
|
88
88
|
ignoreRdfType: parameters.ignoreRdfType,
|
|
89
89
|
preferredLanguages: parameters.preferredLanguages,
|
|
90
90
|
propertyPatterns: [],
|
|
91
|
-
schema: parameters.schema.
|
|
91
|
+
schema: parameters.schema.itemType,
|
|
92
92
|
valueVariable: itemNVariable,
|
|
93
93
|
variablePrefix: variablePrefix("ItemN"),
|
|
94
94
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_maybeSparqlConstructTriples = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}maybeSparqlConstructTriples`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}maybeSparqlConstructTriples<ItemFilterT, ItemSchemaT>(itemSparqlConstructTriplesFunction: ${snippets.ValueSparqlConstructTriplesFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlConstructTriplesFunction}<${snippets.MaybeFilter}<ItemFilterT>, ${snippets.MaybeSchema}<ItemSchemaT>> {
|
|
4
|
-
return ({ filter, schema, ...otherParameters }) => itemSparqlConstructTriplesFunction({ ...otherParameters, filter: filter ?? undefined, schema: schema.
|
|
4
|
+
return ({ filter, schema, ...otherParameters }) => itemSparqlConstructTriplesFunction({ ...otherParameters, filter: filter ?? undefined, schema: schema.itemType });
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_maybeSparqlConstructTriples.js.map
|
|
@@ -4,18 +4,18 @@ function ${syntheticNamePrefix}maybeSparqlWherePatterns<ItemFilterT, ItemSchemaT
|
|
|
4
4
|
return ({ filter, schema, ...otherParameters }) => {
|
|
5
5
|
if (filter === undefined) {
|
|
6
6
|
// Treat the item's patterns as optional
|
|
7
|
-
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.
|
|
7
|
+
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.itemType }));
|
|
8
8
|
return [{ patterns: itemSparqlWherePatterns.concat(), type: "optional" }, ...liftSparqlPatterns];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
if (filter === null) {
|
|
12
12
|
// Use FILTER NOT EXISTS around the item's patterns
|
|
13
|
-
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, filter: undefined, schema: schema.
|
|
13
|
+
const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, filter: undefined, schema: schema.itemType }));
|
|
14
14
|
return [{ expression: { args: itemSparqlWherePatterns.concat(), operator: "notexists", type: "operation" }, lift: true, type: "filter" }, ...liftSparqlPatterns]
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// Treat the item as required.
|
|
18
|
-
return itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.
|
|
18
|
+
return itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.itemType });
|
|
19
19
|
}
|
|
20
20
|
}`);
|
|
21
21
|
//# sourceMappingURL=snippets_maybeSparqlWherePatterns.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_setSparqlConstructTriples = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}setSparqlConstructTriples`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}setSparqlConstructTriples<ItemFilterT, ItemSchemaT>(itemSparqlConstructTriplesFunction: ${snippets.ValueSparqlConstructTriplesFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlConstructTriplesFunction}<${snippets.CollectionFilter}<ItemFilterT>, ${snippets.CollectionSchema}<ItemSchemaT>> {
|
|
4
|
-
return ({ schema, ...otherParameters }) => itemSparqlConstructTriplesFunction({ ...otherParameters, schema: schema.
|
|
4
|
+
return ({ schema, ...otherParameters }) => itemSparqlConstructTriplesFunction({ ...otherParameters, schema: schema.itemType });
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_setSparqlConstructTriples.js.map
|
|
@@ -2,7 +2,7 @@ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
|
2
2
|
export const snippets_setSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}setSparqlWherePatterns`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}setSparqlWherePatterns<ItemFilterT, ItemSchemaT>(itemSparqlWherePatternsFunction: ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlWherePatternsFunction}<${snippets.CollectionFilter}<ItemFilterT>, ${snippets.CollectionSchema}<ItemSchemaT>> {
|
|
4
4
|
return ({ filter, schema, ...otherParameters }) => {
|
|
5
|
-
const itemSparqlWherePatterns = itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.
|
|
5
|
+
const itemSparqlWherePatterns = itemSparqlWherePatternsFunction({ ...otherParameters, filter, schema: schema.itemType });
|
|
6
6
|
|
|
7
7
|
const minCount = filter?.${syntheticNamePrefix}minCount ?? schema.minCount ?? 0;
|
|
8
8
|
if (minCount > 0) {
|
|
@@ -82,7 +82,7 @@ function ${syntheticNamePrefix}shaclPropertySparqlConstructTriples<FilterT, Type
|
|
|
82
82
|
.concat(typeSparqlConstructTriples({
|
|
83
83
|
filter,
|
|
84
84
|
ignoreRdfType,
|
|
85
|
-
schema: propertySchema.type
|
|
85
|
+
schema: propertySchema.type,
|
|
86
86
|
valueVariable,
|
|
87
87
|
variablePrefix: valueString
|
|
88
88
|
}));
|
|
@@ -78,7 +78,7 @@ function ${syntheticNamePrefix}shaclPropertySparqlWherePatterns<FilterT, TypeSch
|
|
|
78
78
|
ignoreRdfType,
|
|
79
79
|
preferredLanguages,
|
|
80
80
|
propertyPatterns,
|
|
81
|
-
schema: propertySchema.type
|
|
81
|
+
schema: propertySchema.type,
|
|
82
82
|
valueVariable,
|
|
83
83
|
variablePrefix: valueString
|
|
84
84
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_stringSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}stringSparqlWherePatterns`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}stringSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.StringFilter}, ${snippets.StringSchema}
|
|
3
|
+
const ${syntheticNamePrefix}stringSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${snippets.StringFilter}, ${snippets.StringSchema}<string>> =
|
|
4
4
|
({ filter, valueVariable, ...otherParameters }) => {
|
|
5
5
|
const filterPatterns: ${snippets.SparqlFilterPattern}[] = [];
|
|
6
6
|
|
|
@@ -7,7 +7,7 @@ function ${syntheticNamePrefix}validateArray<ItemSchemaT, ItemValueT, Readonly e
|
|
|
7
7
|
return ${imports.Left}(new Error(\`value array has length (\${valueArray.length}) less than minCount (\${schema.minCount})\`)) as ${imports.Either}<Error, EitherR>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
return ${imports.Either}.sequence(valueArray.map(value => validateItem(schema.
|
|
10
|
+
return ${imports.Either}.sequence(valueArray.map(value => validateItem(schema.itemType, value))) as ${imports.Either}<Error, EitherR>;
|
|
11
11
|
}
|
|
12
12
|
}`);
|
|
13
13
|
//# sourceMappingURL=snippets_validateArray.js.map
|
|
@@ -2,6 +2,6 @@ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
|
2
2
|
export const snippets_validateMaybe = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}validateMaybe`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}validateMaybe<ItemSchemaT, ItemValueT>(validateItem: ${snippets.ValidationFunction}<ItemSchemaT, ItemValueT>) {
|
|
4
4
|
return (schema: ${snippets.MaybeSchema}<ItemSchemaT>, valueMaybe: ${imports.Maybe}<ItemValueT>): ${imports.Either}<Error, ${imports.Maybe}<ItemValueT>> =>
|
|
5
|
-
valueMaybe.map(value => validateItem(schema.
|
|
5
|
+
valueMaybe.map(value => validateItem(schema.itemType, value).map(() => valueMaybe)).orDefault(${imports.Either}.of(valueMaybe));
|
|
6
6
|
}`);
|
|
7
7
|
//# sourceMappingURL=snippets_validateMaybe.js.map
|