@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,7 +1,6 @@
|
|
|
1
|
-
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
1
|
import { Maybe } from "purify-ts";
|
|
3
|
-
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
2
|
+
import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_fromRdfResourceFunctionDeclaration() {
|
|
5
4
|
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
6
5
|
return Maybe.empty();
|
|
7
6
|
}
|
|
@@ -26,37 +25,14 @@ export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
|
|
|
26
25
|
const partials = [];
|
|
27
26
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
28
27
|
chains.push({
|
|
29
|
-
expression: code `${parentObjectType.
|
|
28
|
+
expression: code `${parentObjectType.alias.unsafeCoerce()}._fromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
|
|
30
29
|
variable: `super${parentObjectTypeI}`,
|
|
31
30
|
});
|
|
32
31
|
partials.push(`super${parentObjectTypeI}`);
|
|
33
32
|
});
|
|
34
|
-
this.
|
|
35
|
-
const fromRdfTypeVariable = this.fromRdfTypeVariable.unsafeCoerce();
|
|
36
|
-
const predicate = this.rdfjsTermExpression(rdf.type);
|
|
37
|
-
// Check the expected type and its known subtypes
|
|
38
|
-
const cases = new Set();
|
|
39
|
-
cases.add(fromRdfType.value);
|
|
40
|
-
for (const descendantFromRdfType of this.descendantFromRdfTypes) {
|
|
41
|
-
cases.add(descendantFromRdfType.value);
|
|
42
|
-
}
|
|
33
|
+
this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
|
|
43
34
|
chains.push({
|
|
44
|
-
expression: code `!${variables.ignoreRdfType} ? ${variables.resource}
|
|
45
|
-
.chain(actualRdfType => actualRdfType.toIri())
|
|
46
|
-
.chain((actualRdfType) => {
|
|
47
|
-
// Check the expected type and its known subtypes
|
|
48
|
-
switch (actualRdfType.value) {
|
|
49
|
-
${[...cases].map((fromRdfType) => `case "${fromRdfType}":`).join("\n")}
|
|
50
|
-
return ${this.reusables.imports.Right}(true as const);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Check arbitrary rdfs:subClassOf's of the expected type
|
|
54
|
-
if (${variables.resource}.isInstanceOf(${fromRdfTypeVariable}, ${{ graph: variables.graph }})) {
|
|
55
|
-
return ${this.reusables.imports.Right}(true as const);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return ${this.reusables.imports.Left}(new Error(\`\${${variables.resource}.identifier} has unexpected RDF type (actual: \${actualRdfType.value}, expected: ${fromRdfType.value})\`));
|
|
59
|
-
}) : ${this.reusables.imports.Right}(true as const)`,
|
|
35
|
+
expression: code `!${variables.ignoreRdfType} ? ${this.reusables.snippets.ensureRdfResourceType}(${variables.resource}, ${arrayOf(fromRdfTypeVariable, ...this.descendantFromRdfTypeVariables)}, ${{ graph: variables.graph }}) : ${this.reusables.imports.Right}(true as const)`,
|
|
60
36
|
variable: `_rdfTypeCheck`,
|
|
61
37
|
});
|
|
62
38
|
});
|
|
@@ -95,10 +71,10 @@ export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
|
|
|
95
71
|
.reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(${resultExpression})`)}`;
|
|
96
72
|
}
|
|
97
73
|
return Maybe.of(code `\
|
|
98
|
-
export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.
|
|
74
|
+
export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.expression}> = (${variables.resource}, ${optionsVariable}) => {
|
|
99
75
|
return ${returnExpression};
|
|
100
76
|
}
|
|
101
77
|
|
|
102
78
|
export const fromRdfResource = ${this.reusables.snippets.wrap_FromRdfResourceFunction}(_fromRdfResource);`);
|
|
103
79
|
}
|
|
104
|
-
//# sourceMappingURL=
|
|
80
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.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_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_fromRdfResourceValuesFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.alias.unsafeCoerce()}> = (values, options) =>
|
|
9
|
+
values.chain(
|
|
10
|
+
values => values.chainMap(
|
|
11
|
+
value => value.toResource().chain(resource => ${this.alias.unsafeCoerce()}.fromRdfResource(resource, options))
|
|
12
|
+
)
|
|
13
|
+
);`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.js.map
|
|
@@ -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_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_fromRdfTypeVariableStatement() {
|
|
4
4
|
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return this.fromRdfType.map((fromRdfType) => code `\
|
|
8
8
|
export const fromRdfType: ${this.reusables.imports.NamedNode}<string> = ${this.rdfjsTermExpression(fromRdfType)};`);
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.js.map
|
|
@@ -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_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_graphqlTypeVariableStatement() {
|
|
4
4
|
if (!this.configuration.features.has("GraphQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ export function NamedObjectType_graphqlTypeVariableStatement() {
|
|
|
8
8
|
return Maybe.empty();
|
|
9
9
|
}
|
|
10
10
|
return Maybe.of(code `\
|
|
11
|
-
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.
|
|
11
|
+
export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
|
|
12
12
|
description: this.comment.extract(),
|
|
13
13
|
fields: code `() => (${this.properties.reduce((fields, property) => {
|
|
14
14
|
property.graphqlField.ifJust((field) => {
|
|
@@ -27,7 +27,7 @@ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.na
|
|
|
27
27
|
});
|
|
28
28
|
return fields;
|
|
29
29
|
}, {})})`,
|
|
30
|
-
name: this.
|
|
30
|
+
name: this.alias.unsafeCoerce(),
|
|
31
31
|
}});`);
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
2
|
const hasherVariable = code `hasher`;
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_hashFunctionDeclarations() {
|
|
4
4
|
if (!this.configuration.features.has("Object.hash")) {
|
|
5
5
|
return [];
|
|
6
6
|
}
|
|
7
|
-
const hashOwnShaclPropertiesStatements = this.properties.flatMap((property) => property.kind === "
|
|
7
|
+
const hashOwnShaclPropertiesStatements = this.properties.flatMap((property) => property.kind === "Shacl"
|
|
8
8
|
? property.hashStatements({
|
|
9
9
|
variables: {
|
|
10
10
|
hasher: hasherVariable,
|
|
@@ -17,13 +17,13 @@ export function NamedObjectType_hashFunctionDeclarations() {
|
|
|
17
17
|
const hashShaclPropertiesStatements = [];
|
|
18
18
|
const hashStatements = [];
|
|
19
19
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
20
|
-
hashShaclPropertiesStatements.push(code `${parentObjectType.
|
|
20
|
+
hashShaclPropertiesStatements.push(code `${parentObjectType.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
|
|
21
21
|
}
|
|
22
|
-
hashStatements.push(code `${this.
|
|
22
|
+
hashStatements.push(code `${this.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
|
|
23
23
|
hashShaclPropertiesStatements.push(...hashOwnShaclPropertiesStatements);
|
|
24
24
|
hashShaclPropertiesStatements.push(code `return ${hasherVariable};`);
|
|
25
25
|
hashStatements.push(...this.properties
|
|
26
|
-
.filter((property) => property.kind !== "
|
|
26
|
+
.filter((property) => property.kind !== "Shacl")
|
|
27
27
|
.flatMap((property) => property.hashStatements({
|
|
28
28
|
variables: {
|
|
29
29
|
hasher: hasherVariable,
|
|
@@ -33,13 +33,13 @@ export function NamedObjectType_hashFunctionDeclarations() {
|
|
|
33
33
|
hashStatements.push(code `return ${hasherVariable};`);
|
|
34
34
|
return [
|
|
35
35
|
code `\
|
|
36
|
-
export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.
|
|
36
|
+
export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
|
|
37
37
|
${joinCode(hashStatements)}
|
|
38
38
|
}`,
|
|
39
39
|
code `\
|
|
40
|
-
export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.
|
|
40
|
+
export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
|
|
41
41
|
${joinCode(hashShaclPropertiesStatements)}
|
|
42
42
|
}`,
|
|
43
43
|
];
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=ObjectType_hashFunctionDeclarations.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
2
|
import { tsComment } from "../tsComment.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_interfaceDeclaration() {
|
|
4
4
|
return code `\
|
|
5
5
|
${this.comment
|
|
6
6
|
.alt(this.label)
|
|
7
7
|
.map(tsComment)
|
|
8
|
-
.orDefault("")}export interface ${this.
|
|
8
|
+
.orDefault("")}export interface ${this.alias.unsafeCoerce()}${this.parentObjectTypes.length > 0
|
|
9
9
|
? ` extends ${this.parentObjectTypes
|
|
10
|
-
.map((parentObjectType) => parentObjectType.
|
|
10
|
+
.map((parentObjectType) => parentObjectType.alias.unsafeCoerce())
|
|
11
11
|
.join(", ")}`
|
|
12
12
|
: ""} {
|
|
13
|
-
${joinCode(this.properties.map((property) => property.declaration))}
|
|
13
|
+
${joinCode(this.properties.map((property) => property.declaration), { on: "\n\n" })}
|
|
14
14
|
}`;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=ObjectType_interfaceDeclaration.js.map
|
|
@@ -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_isTypeFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.d.ts.map
|
|
@@ -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_isTypeFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.type")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
8
|
-
export function is${this.
|
|
8
|
+
export function is${this.alias.unsafeCoerce()}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${this.alias.unsafeCoerce()} {
|
|
9
9
|
switch (object.${this._discriminantProperty.name}) {
|
|
10
10
|
${this._discriminantProperty.type.descendantValues
|
|
11
11
|
.concat(this._discriminantProperty.type.ownValues)
|
|
@@ -14,4 +14,4 @@ export function is${this.name}(object: ${this.configuration.syntheticNamePrefix}
|
|
|
14
14
|
}
|
|
15
15
|
}`);
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map
|
|
@@ -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_jsonParseFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonParseFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.parse")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -11,4 +11,4 @@ export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Js
|
|
|
11
11
|
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
12
12
|
}`);
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.js.map
|
|
@@ -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_jsonSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.schema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -28,4 +28,4 @@ export function schema() {
|
|
|
28
28
|
return ${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${this.reusables.imports.z}.ZodType<Json>;
|
|
29
29
|
}`);
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.js.map
|
|
@@ -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_jsonTypeAliasDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonTypeAliasDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.type")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -13,4 +13,4 @@ export function NamedObjectType_jsonTypeAliasDeclaration() {
|
|
|
13
13
|
}
|
|
14
14
|
return Maybe.of(code `export type Json = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.js.map
|
|
@@ -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_jsonUiSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.uiSchema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const variables = { scopePrefix: code `scopePrefix` };
|
|
8
8
|
const elements = this.parentObjectTypes
|
|
9
|
-
.map((parentObjectType) => code `${parentObjectType.
|
|
9
|
+
.map((parentObjectType) => code `${parentObjectType.alias.unsafeCoerce()}.Json.uiSchema({ scopePrefix })`)
|
|
10
10
|
.concat(this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
11
11
|
return Maybe.of(code `\
|
|
12
12
|
export function uiSchema(parameters?: { scopePrefix?: string }): any {
|
|
13
13
|
const scopePrefix = parameters?.scopePrefix ?? "#";
|
|
14
|
-
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.
|
|
14
|
+
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.alias.unsafeCoerce())}", type: "Group" };
|
|
15
15
|
}`);
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function ObjectType_objectSetMethodNames(this: {
|
|
3
|
+
readonly alias: string;
|
|
3
4
|
readonly configuration: TsGenerator.Configuration;
|
|
4
|
-
readonly name: string;
|
|
5
5
|
}): {
|
|
6
6
|
object: string;
|
|
7
7
|
objectCount: string;
|
|
8
8
|
objectIdentifiers: string;
|
|
9
9
|
objects: string;
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { camelCase, trainCase } from "change-case";
|
|
2
2
|
import plur from "plur";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_objectSetMethodNames() {
|
|
4
4
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
5
|
-
const prefixSingular = camelCase(this.
|
|
5
|
+
const prefixSingular = camelCase(this.alias, {
|
|
6
6
|
prefixCharacters: syntheticNamePrefix,
|
|
7
7
|
});
|
|
8
|
-
const thisNameParts = trainCase(this.
|
|
8
|
+
const thisNameParts = trainCase(this.alias, {
|
|
9
9
|
prefixCharacters: syntheticNamePrefix,
|
|
10
10
|
}).split("-");
|
|
11
11
|
let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
|
|
@@ -20,4 +20,4 @@ export function NamedObjectType_objectSetMethodNames() {
|
|
|
20
20
|
objects: prefixPlural,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.js.map
|
|
@@ -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_schemaVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_schemaVariableStatement() {
|
|
4
|
+
if (!this.configuration.features.has("Object.schema")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export const schema = { properties: { ${joinCode(this.parentObjectTypes
|
|
9
|
+
.map((parentObjectType) => code `...${parentObjectType.alias.unsafeCoerce()}.schema.properties`)
|
|
10
|
+
.concat(this.properties.flatMap((property) => property.schema
|
|
11
|
+
.toList()
|
|
12
|
+
.map((propertySchema) => code `${property.name}: ${propertySchema}`))), { on: ", " })} } } as const;`);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { camelCase } from "change-case";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_sparqlConstructQueryFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
8
|
return Maybe.of(code `\
|
|
9
9
|
export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages, prefixes, subject, ...queryParameters }: { filter?: ${this.filterType}; ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; preferredLanguages?: readonly string[]; subject: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable} } & Omit<${this.reusables.imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type">): ${this.reusables.imports.sparqljs}.ConstructQuery {
|
|
10
|
-
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.
|
|
10
|
+
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.alias)}";
|
|
11
11
|
|
|
12
12
|
return {
|
|
13
13
|
...queryParameters,
|
|
14
14
|
prefixes: prefixes ?? {},
|
|
15
15
|
queryType: "CONSTRUCT",
|
|
16
16
|
template: (queryParameters.template ?? []).concat(
|
|
17
|
-
${this.
|
|
17
|
+
${this.alias}.focusSparqlConstructTriples({
|
|
18
18
|
filter,
|
|
19
19
|
focusIdentifier: subject,
|
|
20
20
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -24,7 +24,7 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
24
24
|
type: "query",
|
|
25
25
|
where: (queryParameters.where ?? []).concat(
|
|
26
26
|
${this.reusables.snippets.normalizeSparqlWherePatterns}(
|
|
27
|
-
${this.
|
|
27
|
+
${this.alias}.focusSparqlWherePatterns({
|
|
28
28
|
filter,
|
|
29
29
|
focusIdentifier: subject,
|
|
30
30
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -36,4 +36,4 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
36
36
|
};
|
|
37
37
|
}`);
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_sparqlConstructQueryStringFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.alias}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
|
|
9
|
+
return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.alias}.sparqlConstructQuery(parameters));
|
|
10
|
+
}`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
|
|
@@ -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_toJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_toJsonFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.toJson")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const jsonObjectMembers = [];
|
|
8
8
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
9
|
-
jsonObjectMembers.push(code `...${parentObjectType.
|
|
9
|
+
jsonObjectMembers.push(code `...${parentObjectType.alias.unsafeCoerce()}.toJson(${this.thisVariable})`);
|
|
10
10
|
}
|
|
11
11
|
if (this.properties.length > 0) {
|
|
12
12
|
jsonObjectMembers.push(...this.properties.flatMap((property) => property
|
|
@@ -34,8 +34,8 @@ export function NamedObjectType_toJsonFunctionDeclaration() {
|
|
|
34
34
|
// break;
|
|
35
35
|
// }
|
|
36
36
|
return Maybe.of(code `\
|
|
37
|
-
export function toJson(${this.thisVariable}: ${this.
|
|
37
|
+
export function toJson(${this.thisVariable}: ${this.expression}): ${returnType} {
|
|
38
38
|
return JSON.parse(JSON.stringify({ ${joinCode(jsonObjectMembers, { on: "," })} } satisfies ${this.jsonType().name}));
|
|
39
39
|
}`);
|
|
40
40
|
}
|
|
41
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.js.map
|
|
@@ -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_toRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_toRdfResourceFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.toRdf")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
|
-
const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.
|
|
8
|
+
const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.alias.unsafeCoerce()}._toRdfResource({ ...parameters, ignoreRdfType: true });`);
|
|
9
9
|
if (this.toRdfTypes.length > 0) {
|
|
10
10
|
statements.push(code `if (!${variables.ignoreRdfType}) { ${joinCode(this.toRdfTypes.map((toRdfType) => code `${variables.resource}.add(${this.rdfjsTermExpression(rdf.type)}, ${this.reusables.imports.dataFactory}.namedNode("${toRdfType.value}"), ${variables.graph});`), { on: " " })} }`);
|
|
11
11
|
}
|
|
@@ -23,7 +23,7 @@ export function NamedObjectType_toRdfResourceFunctionDeclaration() {
|
|
|
23
23
|
}
|
|
24
24
|
statements.push(code `return ${variables.resource};`);
|
|
25
25
|
return Maybe.of(code `\
|
|
26
|
-
export const _toRdfResource: ${this.reusables.snippets._ToRdfResourceFunction}<${this.identifierTypeAlias}, ${this.
|
|
26
|
+
export const _toRdfResource: ${this.reusables.snippets._ToRdfResourceFunction}<${this.identifierTypeAlias}, ${this.expression}> = (parameters) => {
|
|
27
27
|
${joinCode(statements)}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -36,4 +36,4 @@ const variables = {
|
|
|
36
36
|
resource: code `parameters.resource`,
|
|
37
37
|
resourceSet: code `parameters.resourceSet`,
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function ObjectType_toStringFunctionDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
+
//# sourceMappingURL=ObjectType_toStringFunctionDeclarations.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function ObjectType_toStringFunctionDeclarations() {
|
|
3
3
|
if (!this.configuration.features.has("Object.toString")) {
|
|
4
4
|
return [];
|
|
5
5
|
}
|
|
6
6
|
let propertiesToStringInitializers = [];
|
|
7
7
|
if (this.parentObjectTypes.length > 0) {
|
|
8
8
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
9
|
-
propertiesToStringInitializers.push(code `...${parentObjectType.
|
|
9
|
+
propertiesToStringInitializers.push(code `...${parentObjectType.alias.unsafeCoerce()}._propertiesToStrings(${this.thisVariable})`);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
propertiesToStringInitializers = propertiesToStringInitializers.concat(this.properties.flatMap((property) => property
|
|
@@ -19,18 +19,18 @@ export function NamedObjectType_toStringFunctionDeclarations() {
|
|
|
19
19
|
})
|
|
20
20
|
.toList()));
|
|
21
21
|
const propertiesToStringsReturnExpression = code `${this.reusables.snippets.compactRecord}({${joinCode(propertiesToStringInitializers, { on: "," })}})`;
|
|
22
|
-
const toStringReturnExpression = (propertiesToStrings) => code `\`${this.
|
|
22
|
+
const toStringReturnExpression = (propertiesToStrings) => code `\`${this.alias.unsafeCoerce()}(\${JSON.stringify(${propertiesToStrings})})\``;
|
|
23
23
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
24
24
|
return [
|
|
25
25
|
// Use overloads to allow the function to be attached to an instance or used freestanding
|
|
26
26
|
code `\
|
|
27
|
-
export function _propertiesToStrings(${this.thisVariable}: ${this.
|
|
27
|
+
export function _propertiesToStrings(${this.thisVariable}: ${this.expression}): Record<string, string> {
|
|
28
28
|
return ${propertiesToStringsReturnExpression};
|
|
29
29
|
}`,
|
|
30
30
|
code `\
|
|
31
|
-
export function ${syntheticNamePrefix}toString(${this.thisVariable}: ${this.
|
|
31
|
+
export function ${syntheticNamePrefix}toString(${this.thisVariable}: ${this.expression}): string {
|
|
32
32
|
return ${toStringReturnExpression(code `_propertiesToStrings(${this.thisVariable})`)};
|
|
33
33
|
}`,
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=ObjectType_toStringFunctionDeclarations.js.map
|
|
@@ -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_valueSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts.map
|