@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 { invariant } from "ts-invariant";
|
|
2
1
|
import * as ast from "../../ast/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ObjectType_jsonSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js";
|
|
3
|
+
import { ObjectType_jsonTypeAliasDeclaration } from "./_ObjectType/ObjectType_jsonTypeAliasDeclaration.js";
|
|
5
4
|
import { Reusables } from "./Reusables.js";
|
|
6
5
|
import { TsGenerator } from "./TsGenerator.js";
|
|
7
6
|
import { TypeFactory } from "./TypeFactory.js";
|
|
@@ -20,20 +19,19 @@ export class ZodGenerator {
|
|
|
20
19
|
reusables,
|
|
21
20
|
});
|
|
22
21
|
const declarations = [];
|
|
23
|
-
for (const namedObjectType of ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.
|
|
22
|
+
for (const namedObjectType of ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.createObjectType(astObjectType))) {
|
|
24
23
|
declarations.push(code `\
|
|
25
|
-
export namespace ${namedObjectType.
|
|
26
|
-
${joinCode(
|
|
24
|
+
export namespace ${namedObjectType.alias.unsafeCoerce()} {
|
|
25
|
+
${joinCode(ObjectType_jsonTypeAliasDeclaration.call(namedObjectType).toList())}
|
|
27
26
|
|
|
28
27
|
export namespace Json {
|
|
29
|
-
${joinCode(
|
|
28
|
+
${joinCode(ObjectType_jsonSchemaFunctionDeclaration.call(namedObjectType).toList())}
|
|
30
29
|
}
|
|
31
30
|
}`);
|
|
32
31
|
}
|
|
33
32
|
for (const astNamedUnionType of ast_.namedUnionTypes.map((astNamedUnionType) => typeFactory.createUnionType(astNamedUnionType))) {
|
|
34
|
-
invariant(astNamedUnionType.kind !== "AnonymousUnionType");
|
|
35
33
|
declarations.push(code `\
|
|
36
|
-
export namespace ${astNamedUnionType.
|
|
34
|
+
export namespace ${astNamedUnionType.alias.unsafeCoerce()} {
|
|
37
35
|
${astNamedUnionType.jsonTypeAliasDeclaration}
|
|
38
36
|
export namespace Json {
|
|
39
37
|
${astNamedUnionType.jsonSchemaFunctionDeclaration}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
2
|
import type { Logger } from "ts-log";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
4
4
|
import type { Reusables } from "../Reusables.js";
|
|
5
5
|
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
6
6
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
7
7
|
import type { Type } from "../Type.js";
|
|
8
8
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
9
|
-
export declare abstract class AbstractProperty<TypeT extends Pick<Type, "
|
|
9
|
+
export declare abstract class AbstractProperty<TypeT extends Pick<Type, "expression" | "filterFunction" | "mutable" | "schema">> {
|
|
10
10
|
protected readonly configuration: TsGenerator.Configuration;
|
|
11
11
|
protected readonly logger: Logger;
|
|
12
|
-
protected readonly
|
|
12
|
+
protected readonly objectType: ObjectType;
|
|
13
13
|
protected readonly reusables: Reusables;
|
|
14
14
|
/**
|
|
15
15
|
* Optional parameter to include in the parameters object of constructor function.
|
|
@@ -50,7 +50,7 @@ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterF
|
|
|
50
50
|
*/
|
|
51
51
|
abstract readonly jsonSignature: Maybe<Code>;
|
|
52
52
|
/**
|
|
53
|
-
* Property type discriminant e.g., "
|
|
53
|
+
* Property type discriminant e.g., "Shacl".
|
|
54
54
|
*/
|
|
55
55
|
abstract readonly kind: string;
|
|
56
56
|
/**
|
|
@@ -62,29 +62,29 @@ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterF
|
|
|
62
62
|
*/
|
|
63
63
|
readonly name: string;
|
|
64
64
|
/**
|
|
65
|
-
* Is the property's type the
|
|
65
|
+
* Is the property's type the ObjectType or does its type indirectly reference the ObjectType?
|
|
66
66
|
*/
|
|
67
67
|
abstract readonly recursive: boolean;
|
|
68
68
|
/**
|
|
69
69
|
* Property type
|
|
70
70
|
. */
|
|
71
71
|
readonly type: TypeT;
|
|
72
|
-
constructor({ configuration, logger, name,
|
|
72
|
+
constructor({ configuration, logger, name, objectType, reusables, type, }: {
|
|
73
73
|
configuration: TsGenerator.Configuration;
|
|
74
74
|
logger: Logger;
|
|
75
75
|
name: string;
|
|
76
|
-
|
|
76
|
+
objectType: ObjectType;
|
|
77
77
|
reusables: Reusables;
|
|
78
78
|
type: TypeT;
|
|
79
79
|
});
|
|
80
80
|
/**
|
|
81
81
|
* TypeScript object describing this type, for runtime use.
|
|
82
82
|
*/
|
|
83
|
-
get schema(): Code
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
get schema(): Maybe<Code>;
|
|
84
|
+
/**
|
|
85
|
+
* Helper to compose the result of schema along the type hierarchy.
|
|
86
|
+
*/
|
|
87
|
+
protected get schemaInitializers(): readonly Code[];
|
|
88
88
|
/**
|
|
89
89
|
* Expression to access the value of this property on an object instance. May evaluate a thunk.
|
|
90
90
|
*/
|
|
@@ -4,15 +4,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
10
|
-
import {
|
|
11
|
-
import { code, literalOf } from "../ts-poet-wrapper.js";
|
|
10
|
+
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
12
11
|
export class AbstractProperty {
|
|
13
12
|
configuration;
|
|
14
13
|
logger;
|
|
15
|
-
|
|
14
|
+
objectType;
|
|
16
15
|
reusables;
|
|
17
16
|
/**
|
|
18
17
|
* TypeScript identifier-safe name of the property.
|
|
@@ -22,11 +21,11 @@ export class AbstractProperty {
|
|
|
22
21
|
* Property type
|
|
23
22
|
. */
|
|
24
23
|
type;
|
|
25
|
-
constructor({ configuration, logger, name,
|
|
24
|
+
constructor({ configuration, logger, name, objectType, reusables, type, }) {
|
|
26
25
|
this.configuration = configuration;
|
|
27
26
|
this.logger = logger;
|
|
28
27
|
this.name = name;
|
|
29
|
-
this.
|
|
28
|
+
this.objectType = objectType;
|
|
30
29
|
this.reusables = reusables;
|
|
31
30
|
this.type = type;
|
|
32
31
|
this.rdfjsTermExpression = rdfjsTermExpression.bind({
|
|
@@ -39,15 +38,13 @@ export class AbstractProperty {
|
|
|
39
38
|
* TypeScript object describing this type, for runtime use.
|
|
40
39
|
*/
|
|
41
40
|
get schema() {
|
|
42
|
-
return code
|
|
41
|
+
return Maybe.of(code `{ ${joinCode(this.schemaInitializers.concat(), { on: ", " })} }`);
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type: code `() => (${this.type.schema})`,
|
|
50
|
-
};
|
|
43
|
+
/**
|
|
44
|
+
* Helper to compose the result of schema along the type hierarchy.
|
|
45
|
+
*/
|
|
46
|
+
get schemaInitializers() {
|
|
47
|
+
return [code `kind: ${literalOf(this.kind)}`];
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
53
50
|
* Expression to access the value of this property on an object instance. May evaluate a thunk.
|
|
@@ -5,7 +5,7 @@ export declare class DiscriminantProperty extends AbstractProperty<DiscriminantP
|
|
|
5
5
|
readonly constructorParameter: Maybe<Code>;
|
|
6
6
|
readonly filterProperty: AbstractProperty<DiscriminantProperty.Type>["filterProperty"];
|
|
7
7
|
readonly graphqlField: AbstractProperty<DiscriminantProperty.Type>["graphqlField"];
|
|
8
|
-
readonly kind = "
|
|
8
|
+
readonly kind = "Discriminant";
|
|
9
9
|
readonly mutable = false;
|
|
10
10
|
readonly recursive = false;
|
|
11
11
|
constructor({ type, ...superParameters }: {
|
|
@@ -15,6 +15,7 @@ export declare class DiscriminantProperty extends AbstractProperty<DiscriminantP
|
|
|
15
15
|
get jsonName(): string;
|
|
16
16
|
get jsonSchema(): AbstractProperty<DiscriminantProperty.Type>["jsonSchema"];
|
|
17
17
|
get jsonSignature(): Maybe<Code>;
|
|
18
|
+
get schema(): Maybe<Code>;
|
|
18
19
|
private get constValue();
|
|
19
20
|
constructorInitializer(): Maybe<Code>;
|
|
20
21
|
fromJsonInitializer(): Maybe<Code>;
|
|
@@ -38,7 +39,7 @@ export declare namespace DiscriminantProperty {
|
|
|
38
39
|
mutable: boolean;
|
|
39
40
|
ownValues: readonly string[];
|
|
40
41
|
});
|
|
41
|
-
get
|
|
42
|
+
get expression(): Code;
|
|
42
43
|
get schema(): Code;
|
|
43
44
|
get values(): string[];
|
|
44
45
|
}
|
|
@@ -6,21 +6,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
|
-
import { removeUndefined } from "../removeUndefined.js";
|
|
10
9
|
import { arrayOf, code, literalOf } from "../ts-poet-wrapper.js";
|
|
11
10
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
12
11
|
export class DiscriminantProperty extends AbstractProperty {
|
|
13
12
|
constructorParameter = Maybe.empty();
|
|
14
13
|
filterProperty = Maybe.empty();
|
|
15
14
|
graphqlField = Maybe.empty();
|
|
16
|
-
kind = "
|
|
15
|
+
kind = "Discriminant";
|
|
17
16
|
mutable = false;
|
|
18
17
|
recursive = false;
|
|
19
18
|
constructor({ type, ...superParameters }) {
|
|
20
19
|
super({ ...superParameters, type });
|
|
21
20
|
}
|
|
22
21
|
get declaration() {
|
|
23
|
-
return code `readonly ${this.name}: ${this.type.
|
|
22
|
+
return code `readonly ${this.name}: ${this.type.expression};`;
|
|
24
23
|
}
|
|
25
24
|
get jsonName() {
|
|
26
25
|
return "@type";
|
|
@@ -34,10 +33,16 @@ export class DiscriminantProperty extends AbstractProperty {
|
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
35
|
get jsonSignature() {
|
|
37
|
-
return Maybe.of(code `readonly "${this.jsonName}": ${this.type.
|
|
36
|
+
return Maybe.of(code `readonly "${this.jsonName}": ${this.type.expression}`);
|
|
38
37
|
}
|
|
38
|
+
get schema() {
|
|
39
|
+
return Maybe.empty();
|
|
40
|
+
}
|
|
41
|
+
// protected override get schemaInitializers(): readonly Code[] {
|
|
42
|
+
// return super.schemaInitializers.concat(code`type: ${this.type.schema}`);
|
|
43
|
+
// }
|
|
39
44
|
get constValue() {
|
|
40
|
-
return code `${literalOf(this.
|
|
45
|
+
return code `${literalOf(this.objectType.discriminantValue)} as const`;
|
|
41
46
|
}
|
|
42
47
|
constructorInitializer() {
|
|
43
48
|
return Maybe.empty();
|
|
@@ -49,13 +54,13 @@ export class DiscriminantProperty extends AbstractProperty {
|
|
|
49
54
|
return Maybe.empty();
|
|
50
55
|
}
|
|
51
56
|
hashStatements({ variables, }) {
|
|
52
|
-
if (this.
|
|
57
|
+
if (this.objectType.parentObjectTypes.length > 0) {
|
|
53
58
|
return [];
|
|
54
59
|
}
|
|
55
60
|
return [code `${variables.hasher}.update(${variables.value});`];
|
|
56
61
|
}
|
|
57
62
|
jsonUiSchemaElement({ variables, }) {
|
|
58
|
-
if (this.
|
|
63
|
+
if (this.objectType.parentObjectTypes.length > 0) {
|
|
59
64
|
return Maybe.empty();
|
|
60
65
|
}
|
|
61
66
|
const scope = code `\`\${${variables.scopePrefix}}/properties/${this.jsonName}\``;
|
|
@@ -97,15 +102,19 @@ __decorate([
|
|
|
97
102
|
this.mutable = mutable;
|
|
98
103
|
this.ownValues = ownValues;
|
|
99
104
|
}
|
|
100
|
-
get
|
|
101
|
-
return `${this.values.map((name) => `"${name}"`).join(" | ")}`;
|
|
105
|
+
get expression() {
|
|
106
|
+
return code `${this.values.map((name) => `"${name}"`).join(" | ")}`;
|
|
102
107
|
}
|
|
103
108
|
get schema() {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
+
throw new Error("should never be called");
|
|
110
|
+
// const initializers: Record<string, unknown> = {};
|
|
111
|
+
// if (this.descendantValues.length > 0) {
|
|
112
|
+
// initializers["descendantValues"] = this.descendantValues;
|
|
113
|
+
// }
|
|
114
|
+
// if (this.ownValues.length > 0) {
|
|
115
|
+
// initializers["ownValues"] = this.ownValues;
|
|
116
|
+
// }
|
|
117
|
+
// return code`${initializers}`;
|
|
109
118
|
}
|
|
110
119
|
get values() {
|
|
111
120
|
return this.ownValues.concat(this.descendantValues);
|
|
@@ -113,7 +122,7 @@ __decorate([
|
|
|
113
122
|
}
|
|
114
123
|
__decorate([
|
|
115
124
|
Memoize()
|
|
116
|
-
], Type.prototype, "
|
|
125
|
+
], Type.prototype, "expression", null);
|
|
117
126
|
__decorate([
|
|
118
127
|
Memoize()
|
|
119
128
|
], Type.prototype, "schema", null);
|
|
@@ -5,14 +5,9 @@ import type { IriType } from "../IriType.js";
|
|
|
5
5
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
6
6
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
7
7
|
export declare class IdentifierProperty extends AbstractProperty<BlankNodeType | IdentifierType | IriType> {
|
|
8
|
-
|
|
9
|
-
readonly kind = "IdentifierProperty";
|
|
8
|
+
readonly kind = "Identifier";
|
|
10
9
|
readonly mutable = false;
|
|
11
10
|
readonly recursive = false;
|
|
12
|
-
constructor({ typeAlias, ...superParameters }: {
|
|
13
|
-
type: BlankNodeType | IdentifierType | IriType;
|
|
14
|
-
typeAlias: Code;
|
|
15
|
-
} & ConstructorParameters<typeof AbstractProperty>[0]);
|
|
16
11
|
get constructorParameter(): Maybe<Code>;
|
|
17
12
|
get declaration(): Code;
|
|
18
13
|
get filterProperty(): Maybe<{
|
|
@@ -22,6 +17,8 @@ export declare class IdentifierProperty extends AbstractProperty<BlankNodeType |
|
|
|
22
17
|
get graphqlField(): AbstractProperty<IdentifierType>["graphqlField"];
|
|
23
18
|
get jsonSchema(): AbstractProperty<IdentifierType>["jsonSchema"];
|
|
24
19
|
get jsonSignature(): Maybe<Code>;
|
|
20
|
+
protected get schemaInitializers(): readonly Code[];
|
|
21
|
+
private get typeExpression();
|
|
25
22
|
accessExpression({ variables, }: Parameters<AbstractProperty<BlankNodeType | IdentifierType | IriType>["accessExpression"]>[0]): Code;
|
|
26
23
|
constructorInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["constructorInitializer"]>[0]): Maybe<Code>;
|
|
27
24
|
fromJsonInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["fromJsonInitializer"]>[0]): Maybe<Code>;
|
|
@@ -12,30 +12,25 @@ import { Memoize } from "typescript-memoize";
|
|
|
12
12
|
import { arrayOf, code, joinCode, literalOf, } from "../ts-poet-wrapper.js";
|
|
13
13
|
import { AbstractProperty } from "./AbstractProperty.js";
|
|
14
14
|
export class IdentifierProperty extends AbstractProperty {
|
|
15
|
-
|
|
16
|
-
kind = "IdentifierProperty";
|
|
15
|
+
kind = "Identifier";
|
|
17
16
|
mutable = false;
|
|
18
17
|
recursive = false;
|
|
19
|
-
constructor({ typeAlias, ...superParameters }) {
|
|
20
|
-
super(superParameters);
|
|
21
|
-
this.typeAlias = typeAlias;
|
|
22
|
-
}
|
|
23
18
|
get constructorParameter() {
|
|
24
19
|
let hasQuestionToken = false;
|
|
25
|
-
const typeNames = [code `(() => ${this.
|
|
20
|
+
const typeNames = [code `(() => ${this.typeExpression})`];
|
|
26
21
|
for (const type of this.type.conversionFunction.unsafeCoerce()
|
|
27
22
|
.sourceTypes) {
|
|
28
23
|
if (type.typeof === "undefined") {
|
|
29
24
|
hasQuestionToken = true;
|
|
30
25
|
}
|
|
31
26
|
else {
|
|
32
|
-
typeNames.push(code `${type.
|
|
27
|
+
typeNames.push(code `${type.expression}`);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
30
|
return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
|
|
36
31
|
}
|
|
37
32
|
get declaration() {
|
|
38
|
-
return code `readonly ${this.name}: () => ${this.
|
|
33
|
+
return code `readonly ${this.name}: () => ${this.typeExpression};`;
|
|
39
34
|
}
|
|
40
35
|
get filterProperty() {
|
|
41
36
|
return Maybe.of({
|
|
@@ -50,13 +45,13 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
50
45
|
args: Maybe.empty(),
|
|
51
46
|
description: Maybe.empty(),
|
|
52
47
|
name: `_${this.name.substring(syntheticNamePrefix.length)}`,
|
|
53
|
-
resolve: code `(source) => ${this.
|
|
48
|
+
resolve: code `(source) => ${this.typeExpression}.stringify(${this.accessExpression({ variables: { object: code `source` } })})`,
|
|
54
49
|
type: this.type.graphqlType.name,
|
|
55
50
|
});
|
|
56
51
|
}
|
|
57
52
|
get jsonSchema() {
|
|
58
53
|
let schema;
|
|
59
|
-
if (this.type.in_.length > 0 && this.type.kind === "
|
|
54
|
+
if (this.type.in_.length > 0 && this.type.kind === "Iri") {
|
|
60
55
|
// Treat sh:in as a union of the IRIs
|
|
61
56
|
// rdfjs.NamedNode<"http://example.com/1" | "http://example.com/2">
|
|
62
57
|
schema = code `${this.reusables.imports.z}.enum(${arrayOf(...this.type.in_.map((iri) => iri.value))})`;
|
|
@@ -75,6 +70,14 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
75
70
|
}
|
|
76
71
|
return Maybe.of(code `readonly "@id": string`);
|
|
77
72
|
}
|
|
73
|
+
get schemaInitializers() {
|
|
74
|
+
return super.schemaInitializers.concat(code `type: ${this.type.schema}`);
|
|
75
|
+
}
|
|
76
|
+
get typeExpression() {
|
|
77
|
+
return this.objectType.alias
|
|
78
|
+
.map((objectTypeAlias) => code `${objectTypeAlias}.Identifier`)
|
|
79
|
+
.orDefault(this.type.expression);
|
|
80
|
+
}
|
|
78
81
|
accessExpression({ variables, }) {
|
|
79
82
|
return code `${variables.object}.${this.name}()`;
|
|
80
83
|
}
|
|
@@ -128,7 +131,9 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
128
131
|
ignoreRdfType: true, // Unused
|
|
129
132
|
preferredLanguages: variables.preferredLanguages,
|
|
130
133
|
propertyPatterns: code `[]`,
|
|
131
|
-
schema:
|
|
134
|
+
schema: this.objectType.alias
|
|
135
|
+
.map((objectTypeAlias) => code `${objectTypeAlias}.schema.properties.${this.name}.type`)
|
|
136
|
+
.orDefault(this.type.schema),
|
|
132
137
|
valueVariable: variables.focusIdentifier,
|
|
133
138
|
variablePrefix: variables.variablePrefix, // Unused
|
|
134
139
|
}})`,
|
|
@@ -177,4 +182,7 @@ __decorate([
|
|
|
177
182
|
__decorate([
|
|
178
183
|
Memoize()
|
|
179
184
|
], IdentifierProperty.prototype, "jsonSignature", null);
|
|
185
|
+
__decorate([
|
|
186
|
+
Memoize()
|
|
187
|
+
], IdentifierProperty.prototype, "typeExpression", null);
|
|
180
188
|
//# sourceMappingURL=IdentifierProperty.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_createFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_createFunctionDeclaration.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
3
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_createFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.create")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
11
11
|
parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
|
|
12
12
|
}
|
|
13
13
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
14
|
-
parametersType.push(code `Parameters<typeof ${parentObjectType.
|
|
14
|
+
parametersType.push(code `Parameters<typeof ${parentObjectType.alias.unsafeCoerce()}.create>[0]`);
|
|
15
15
|
}
|
|
16
16
|
if (parametersType.length === 0) {
|
|
17
17
|
parametersType.push(code `object`);
|
|
@@ -23,7 +23,7 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
23
23
|
const chains = [];
|
|
24
24
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
25
25
|
chains.push({
|
|
26
|
-
expression: code `${parentObjectType.
|
|
26
|
+
expression: code `${parentObjectType.alias.unsafeCoerce()}.create(parameters)`,
|
|
27
27
|
variable: `super${parentObjectTypeI}`,
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -54,12 +54,12 @@ export function NamedObjectType_createFunctionDeclaration() {
|
|
|
54
54
|
.toReversed()
|
|
55
55
|
.reduce((acc, { expression, variable }, chainI) => code `(${expression}).${chainI === 0 ? "map" : "chain"}(${variable} => ${acc})`, returnExpression);
|
|
56
56
|
return Maybe.of(code `\
|
|
57
|
-
export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.
|
|
57
|
+
export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
|
|
58
58
|
return ${returnExpression};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function createUnsafe(${parametersSignature}): ${this.
|
|
61
|
+
export function createUnsafe(${parametersSignature}): ${this.expression} {
|
|
62
62
|
return create(parameters).unsafeCoerce();
|
|
63
63
|
}`);
|
|
64
64
|
}
|
|
65
|
-
//# sourceMappingURL=
|
|
65
|
+
//# sourceMappingURL=ObjectType_createFunctionDeclaration.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_equalsFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_equalsFunctionDeclaration.d.ts.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_equalsFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.equals")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const chain = [];
|
|
8
8
|
// For every parent, find the nearest equals implementation
|
|
9
9
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
10
|
-
chain.push(code `${parentObjectType.
|
|
10
|
+
chain.push(code `${parentObjectType.equalsFunction}(left, right)`);
|
|
11
11
|
}
|
|
12
12
|
for (const property of this.properties) {
|
|
13
|
-
if (property.kind === "
|
|
13
|
+
if (property.kind === "Discriminant") {
|
|
14
14
|
continue;
|
|
15
15
|
}
|
|
16
16
|
chain.push(code `(${property.type.equalsFunction})(${property.accessExpression({ variables: { object: code `left` } })}, ${property.accessExpression({ variables: { object: code `right` } })}).mapLeft(propertyValuesUnequal => ({ left, right, propertyName: "${property.name}", propertyValuesUnequal, type: "property" as const }))`);
|
|
17
17
|
}
|
|
18
18
|
return Maybe.of(code `\
|
|
19
|
-
export function equals(left: ${this.
|
|
19
|
+
export function equals(left: ${this.expression}, right: ${this.expression}): ${this.reusables.snippets.EqualsResult} {
|
|
20
20
|
return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
|
|
21
21
|
}`);
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=ObjectType_equalsFunctionDeclaration.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_filterFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_filterFunctionDeclaration.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_filterFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.filter")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -17,8 +17,8 @@ export function NamedObjectType_filterFunctionDeclaration() {
|
|
|
17
17
|
}
|
|
18
18
|
statements.push(code `return true;`);
|
|
19
19
|
return Maybe.of(code `\
|
|
20
|
-
export function filter(filter: ${this.filterType}, value: ${this.
|
|
20
|
+
export function filter(filter: ${this.filterType}, value: ${this.expression}): boolean {
|
|
21
21
|
${joinCode(statements)}
|
|
22
22
|
}`);
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=ObjectType_filterFunctionDeclaration.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_filterTypeDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_filterTypeDeclaration.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_filterTypeDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.filter")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -17,9 +17,9 @@ export function NamedObjectType_filterTypeDeclaration() {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
20
|
-
members.push(code `${parentObjectType.
|
|
20
|
+
members.push(code `${parentObjectType.alias.unsafeCoerce()}.Filter`);
|
|
21
21
|
}
|
|
22
22
|
return Maybe.of(code `\
|
|
23
23
|
export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=ObjectType_filterTypeDeclaration.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_focusSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
|
|
@@ -6,7 +6,7 @@ const variables = {
|
|
|
6
6
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
7
7
|
variablePrefix: code `parameters.variablePrefix`,
|
|
8
8
|
};
|
|
9
|
-
export function
|
|
9
|
+
export function ObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
|
|
10
10
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
11
11
|
return Maybe.empty();
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration()
|
|
|
15
15
|
let triplesVariableDeclarationKeyword = "const";
|
|
16
16
|
const statements = [];
|
|
17
17
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
18
|
-
statements.push(code `triples = triples.concat(${parentObjectType.
|
|
18
|
+
statements.push(code `triples = triples.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
|
|
19
19
|
triplesVariableDeclarationKeyword = "let";
|
|
20
20
|
}
|
|
21
21
|
if (this.fromRdfType.isJust()) {
|
|
@@ -51,4 +51,4 @@ ${statements.length > 0
|
|
|
51
51
|
: "return [];"}
|
|
52
52
|
};`);
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=
|
|
54
|
+
//# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.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_focusSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
|
|
@@ -7,7 +7,7 @@ const variables = {
|
|
|
7
7
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
8
8
|
variablePrefix: code `parameters.variablePrefix`,
|
|
9
9
|
};
|
|
10
|
-
export function
|
|
10
|
+
export function ObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
11
11
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
12
12
|
return Maybe.empty();
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
|
17
17
|
const statements = [];
|
|
18
18
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
19
19
|
statements.push(code `\
|
|
20
|
-
patterns = patterns.concat(${parentObjectType.
|
|
20
|
+
patterns = patterns.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
|
|
21
21
|
patternsVariableDeclarationKeyword = "let";
|
|
22
22
|
}
|
|
23
23
|
if (this.fromRdfType.isJust()) {
|
|
@@ -99,4 +99,4 @@ ${statements.length > 0
|
|
|
99
99
|
: "return [];"}
|
|
100
100
|
};`);
|
|
101
101
|
}
|
|
102
|
-
//# sourceMappingURL=
|
|
102
|
+
//# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.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_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.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_fromJsonFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.fromJson")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -10,7 +10,7 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
|
|
|
10
10
|
const chains = [];
|
|
11
11
|
this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
|
|
12
12
|
chains.push({
|
|
13
|
-
expression: code `${parentObjectType.
|
|
13
|
+
expression: code `${parentObjectType.alias.unsafeCoerce()}.fromJson(${variables.jsonObject})`,
|
|
14
14
|
variable: `super${parentObjectTypeI}`,
|
|
15
15
|
});
|
|
16
16
|
});
|
|
@@ -36,8 +36,8 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
|
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
return Maybe.of(code `\
|
|
39
|
-
export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.
|
|
39
|
+
export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
|
|
40
40
|
return ${returnExpression};
|
|
41
41
|
}`);
|
|
42
42
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.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_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
|