@shaclmate/compiler 4.0.34 → 4.0.36

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.
Files changed (147) hide show
  1. package/dist/generators/ts/AbstractCollectionType.d.ts +2 -1
  2. package/dist/generators/ts/AbstractCollectionType.js +14 -13
  3. package/dist/generators/ts/AbstractContainerType.d.ts +2 -0
  4. package/dist/generators/ts/AbstractContainerType.js +20 -0
  5. package/dist/generators/ts/AbstractDateType.d.ts +1 -1
  6. package/dist/generators/ts/AbstractDateType.js +3 -3
  7. package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -0
  8. package/dist/generators/ts/AbstractLazyObjectType.js +1 -0
  9. package/dist/generators/ts/AbstractLiteralType.d.ts +1 -1
  10. package/dist/generators/ts/AbstractLiteralType.js +2 -2
  11. package/dist/generators/ts/AbstractNamedUnionType.js +33 -20
  12. package/dist/generators/ts/AbstractNumericType.d.ts +1 -8
  13. package/dist/generators/ts/AbstractNumericType.js +2 -16
  14. package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
  15. package/dist/generators/ts/AbstractPrimitiveType.js +2 -1
  16. package/dist/generators/ts/AbstractTermType.d.ts +2 -1
  17. package/dist/generators/ts/AbstractTermType.js +3 -2
  18. package/dist/generators/ts/AbstractType.d.ts +19 -8
  19. package/dist/generators/ts/AbstractUnionType.d.ts +3 -2
  20. package/dist/generators/ts/AbstractUnionType.js +14 -13
  21. package/dist/generators/ts/BigDecimalType.d.ts +3 -2
  22. package/dist/generators/ts/BigDecimalType.js +5 -12
  23. package/dist/generators/ts/BigIntType.js +1 -1
  24. package/dist/generators/ts/BlankNodeType.d.ts +3 -2
  25. package/dist/generators/ts/BlankNodeType.js +6 -5
  26. package/dist/generators/ts/BooleanType.d.ts +1 -2
  27. package/dist/generators/ts/BooleanType.js +2 -16
  28. package/dist/generators/ts/DateTimeType.d.ts +0 -1
  29. package/dist/generators/ts/DateTimeType.js +0 -9
  30. package/dist/generators/ts/DateType.d.ts +0 -1
  31. package/dist/generators/ts/DateType.js +0 -9
  32. package/dist/generators/ts/DefaultValueType.d.ts +2 -1
  33. package/dist/generators/ts/DefaultValueType.js +5 -4
  34. package/dist/generators/ts/IdentifierType.d.ts +3 -2
  35. package/dist/generators/ts/IdentifierType.js +6 -5
  36. package/dist/generators/ts/IriType.d.ts +3 -11
  37. package/dist/generators/ts/IriType.js +6 -5
  38. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
  39. package/dist/generators/ts/LazyObjectOptionType.js +3 -3
  40. package/dist/generators/ts/LazyObjectSetType.d.ts +2 -1
  41. package/dist/generators/ts/LazyObjectSetType.js +3 -3
  42. package/dist/generators/ts/LazyObjectType.d.ts +2 -1
  43. package/dist/generators/ts/LazyObjectType.js +3 -3
  44. package/dist/generators/ts/LiteralType.d.ts +2 -1
  45. package/dist/generators/ts/LiteralType.js +4 -3
  46. package/dist/generators/ts/NamedObjectType.d.ts +2 -1
  47. package/dist/generators/ts/NamedObjectType.js +9 -16
  48. package/dist/generators/ts/NamedObjectUnionType.js +14 -5
  49. package/dist/generators/ts/OptionType.d.ts +4 -3
  50. package/dist/generators/ts/OptionType.js +20 -17
  51. package/dist/generators/ts/Snippets.d.ts +7 -11
  52. package/dist/generators/ts/Snippets.js +46 -74
  53. package/dist/generators/ts/StringType.d.ts +1 -2
  54. package/dist/generators/ts/StringType.js +2 -16
  55. package/dist/generators/ts/TermType.d.ts +2 -1
  56. package/dist/generators/ts/TermType.js +6 -16
  57. package/dist/generators/ts/TsFeature.d.ts +1 -1
  58. package/dist/generators/ts/TsFeature.js +25 -7
  59. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  60. package/dist/generators/ts/TsGenerator.js +66 -8
  61. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +2 -1
  62. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +1 -1
  63. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
  64. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +2 -1
  65. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +6 -2
  66. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +2 -1
  67. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +6 -2
  68. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  69. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  70. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +30 -9
  71. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +6 -6
  72. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
  73. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  74. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -1
  75. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +1 -1
  76. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +2 -1
  77. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +6 -2
  78. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
  79. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  80. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
  81. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  82. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +2 -1
  83. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +6 -2
  84. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
  85. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
  86. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +1 -1
  87. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  88. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +3 -0
  89. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  90. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  91. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +26 -4
  92. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +3 -0
  93. package/dist/generators/ts/_snippets/snippets_ConversionFunction.d.ts +3 -0
  94. package/dist/generators/ts/_snippets/snippets_ConversionFunction.js +4 -0
  95. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +12 -6
  96. package/dist/generators/ts/_snippets/snippets_ValidationFunction.d.ts +3 -0
  97. package/dist/generators/ts/_snippets/snippets_ValidationFunction.js +4 -0
  98. package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +3 -0
  99. package/dist/generators/ts/_snippets/snippets_convertToArray.js +8 -0
  100. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +2 -2
  101. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +2 -2
  102. package/dist/generators/ts/_snippets/snippets_convertToIri.js +2 -2
  103. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +1 -1
  104. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +1 -1
  105. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +1 -1
  106. package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +1 -1
  107. package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +3 -3
  108. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +4 -4
  109. package/dist/generators/ts/_snippets/snippets_identityConversionFunction.d.ts +3 -0
  110. package/dist/generators/ts/_snippets/snippets_identityConversionFunction.js +6 -0
  111. package/dist/generators/ts/_snippets/snippets_identityValidationFunction.d.ts +3 -0
  112. package/dist/generators/ts/_snippets/snippets_identityValidationFunction.js +6 -0
  113. package/dist/generators/ts/_snippets/snippets_validateArray.d.ts +3 -0
  114. package/dist/generators/ts/_snippets/snippets_validateArray.js +13 -0
  115. package/dist/generators/ts/_snippets/snippets_validateMaybe.d.ts +3 -0
  116. package/dist/generators/ts/_snippets/snippets_validateMaybe.js +7 -0
  117. package/dist/generators/ts/graphqlSchemaVariableStatement.js +1 -1
  118. package/dist/generators/ts/objectSetDeclarations.js +7 -10
  119. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +0 -6
  120. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +0 -6
  121. package/dist/input/generated.d.ts +8 -8
  122. package/dist/input/generated.js +188 -191
  123. package/package.json +2 -2
  124. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +0 -3
  125. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +0 -6
  126. package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +0 -3
  127. package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +0 -6
  128. package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +0 -3
  129. package/dist/generators/ts/_snippets/snippets_convertToDate.js +0 -6
  130. package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +0 -3
  131. package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +0 -6
  132. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +0 -3
  133. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +0 -14
  134. package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +0 -3
  135. package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +0 -6
  136. package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +0 -3
  137. package/dist/generators/ts/_snippets/snippets_convertToObject.js +0 -6
  138. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +0 -3
  139. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +0 -14
  140. package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +0 -3
  141. package/dist/generators/ts/_snippets/snippets_convertToString.js +0 -6
  142. package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +0 -3
  143. package/dist/generators/ts/_snippets/snippets_convertToTerm.js +0 -6
  144. package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +0 -3
  145. package/dist/generators/ts/_snippets/snippets_convertToUnion.js +0 -6
  146. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +0 -12
  147. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +0 -21
@@ -4,20 +4,13 @@ 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 { Maybe } from "purify-ts";
7
8
  import { Memoize } from "typescript-memoize";
8
9
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
9
10
  import { code, literalOf } from "./ts-poet-wrapper.js";
10
11
  export class BigDecimalType extends AbstractLiteralType {
11
12
  name = code `${this.reusables.imports.BigDecimal}`;
12
- conversionFunction = {
13
- code: code `${this.reusables.snippets.convertToBigDecimal}`,
14
- sourceTypes: [
15
- {
16
- name: code `${this.reusables.imports.BigDecimal}`,
17
- typeof: "object",
18
- },
19
- ],
20
- };
13
+ conversionFunction = Maybe.empty();
21
14
  filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
22
15
  filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
23
16
  hashFunction = code `${this.reusables.snippets.hashBigDecimal}`;
@@ -28,7 +21,7 @@ export class BigDecimalType extends AbstractLiteralType {
28
21
  return new AbstractLiteralType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
29
22
  }
30
23
  fromJsonExpression({ variables, }) {
31
- return code `new ${this.reusables.imports.BigDecimal}(${variables.value})`;
24
+ return code `${this.reusables.imports.Either}.encase<Error, ${this.name}>(() => new ${this.name}(${variables.value}))`;
32
25
  }
33
26
  graphqlResolveExpression({ variables, }) {
34
27
  return code `${variables.value}.toFixed()`;
@@ -48,9 +41,9 @@ export class BigDecimalType extends AbstractLiteralType {
48
41
  toRdfResourceValuesExpression({ variables, }) {
49
42
  return code `[${this.reusables.snippets.bigDecimalLiteral}(${variables.value})]`;
50
43
  }
51
- fromRdfExpressionChain({ variables, }) {
44
+ fromRdfResourceValuesExpressionChain({ variables, }) {
52
45
  return {
53
- ...super.fromRdfExpressionChain({ variables }),
46
+ ...super.fromRdfResourceValuesExpressionChain({ variables }),
54
47
  valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${this.reusables.snippets.decodeBigDecimalLiteral})))`,
55
48
  };
56
49
  }
@@ -19,7 +19,7 @@ export class BigIntType extends AbstractNumericType {
19
19
  if (this.primitiveIn.length > 0) {
20
20
  expression = code `${expression} as ${this.name}`;
21
21
  }
22
- return expression;
22
+ return code `${this.reusables.imports.Either}.encase<Error, ${this.name}>(() => ${expression})`;
23
23
  }
24
24
  jsonSchema(_parameters) {
25
25
  switch (this.primitiveIn.length) {
@@ -1,8 +1,9 @@
1
1
  import type { BlankNode } from "@rdfjs/types";
2
+ import { Maybe } from "purify-ts";
2
3
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
3
4
  import { type Code } from "./ts-poet-wrapper.js";
4
5
  export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
5
- readonly conversionFunction: AbstractIdentifierType.ConversionFunction;
6
+ readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
6
7
  readonly filterFunction: Code;
7
8
  readonly filterType: Code;
8
9
  readonly parseFunction: Code;
@@ -16,7 +17,7 @@ export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
16
17
  jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
17
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode>["jsonSchema"]>[0]): Code;
18
19
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode>["toJsonExpression"]>[0]): Code;
19
- protected fromRdfExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromRdfExpressionChain"]>[0]): {
20
+ protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromRdfResourceValuesExpressionChain"]>[0]): {
20
21
  valueTo: Code;
21
22
  hasValues?: Code;
22
23
  languageIn?: Code;
@@ -4,11 +4,12 @@ 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 { Maybe } from "purify-ts";
7
8
  import { Memoize } from "typescript-memoize";
8
9
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
9
10
  import { code } from "./ts-poet-wrapper.js";
10
11
  export class BlankNodeType extends AbstractIdentifierType {
11
- conversionFunction = {
12
+ conversionFunction = Maybe.of({
12
13
  code: code `${this.reusables.snippets.convertToBlankNode}`,
13
14
  sourceTypes: [
14
15
  {
@@ -20,7 +21,7 @@ export class BlankNodeType extends AbstractIdentifierType {
20
21
  typeof: "undefined",
21
22
  },
22
23
  ],
23
- };
24
+ });
24
25
  filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
25
26
  filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
26
27
  parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
@@ -37,7 +38,7 @@ export class BlankNodeType extends AbstractIdentifierType {
37
38
  });
38
39
  }
39
40
  fromJsonExpression({ variables, }) {
40
- return code `${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2))`;
41
+ return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)))`;
41
42
  }
42
43
  jsonType(parameters) {
43
44
  const discriminantProperty = parameters?.includeDiscriminantProperty
@@ -57,9 +58,9 @@ export class BlankNodeType extends AbstractIdentifierType {
57
58
  : "";
58
59
  return code `{ "@id": \`_:\${${variables.value}.value}\`${discriminantProperty} }`;
59
60
  }
60
- fromRdfExpressionChain({ variables, }) {
61
+ fromRdfResourceValuesExpressionChain({ variables, }) {
61
62
  return {
62
- ...super.fromRdfExpressionChain({ variables }),
63
+ ...super.fromRdfResourceValuesExpressionChain({ variables }),
63
64
  valueTo: code `chain(values => values.chainMap(value => value.toBlankNode()))`,
64
65
  };
65
66
  }
@@ -10,11 +10,10 @@ export declare class BooleanType extends AbstractPrimitiveType<boolean> {
10
10
  readonly schemaType: Code;
11
11
  readonly typeofs: "boolean"[];
12
12
  readonly valueSparqlWherePatternsFunction: Code;
13
- get conversionFunction(): AbstractPrimitiveType.ConversionFunction;
14
13
  get name(): string;
15
14
  jsonSchema(_parameters: Parameters<AbstractPrimitiveType<number>["jsonSchema"]>[0]): Code;
16
15
  literalExpression(literal: boolean | Literal): Code;
17
16
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<boolean>["toRdfResourceValuesExpression"]>[0]): Code;
18
- protected fromRdfExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<boolean>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<boolean>["fromRdfExpressionChain"]>;
17
+ protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<boolean>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<boolean>["fromRdfResourceValuesExpressionChain"]>;
19
18
  }
20
19
  //# sourceMappingURL=BooleanType.d.ts.map
@@ -17,17 +17,6 @@ export class BooleanType extends AbstractPrimitiveType {
17
17
  schemaType = code `${this.reusables.snippets.BooleanSchema}`;
18
18
  typeofs = ["boolean"];
19
19
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
20
- get conversionFunction() {
21
- return {
22
- code: code `${this.reusables.snippets.convertToBoolean}<${this.name}>`,
23
- sourceTypes: [
24
- {
25
- name: this.name,
26
- typeof: "boolean",
27
- },
28
- ],
29
- };
30
- }
31
20
  get name() {
32
21
  if (this.primitiveIn.length > 0) {
33
22
  return `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
@@ -46,18 +35,15 @@ export class BooleanType extends AbstractPrimitiveType {
46
35
  toRdfResourceValuesExpression({ variables, }) {
47
36
  return code `[${this.reusables.snippets.literalFactory}.boolean(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
48
37
  }
49
- fromRdfExpressionChain({ variables, }) {
38
+ fromRdfResourceValuesExpressionChain({ variables, }) {
50
39
  return {
51
- ...super.fromRdfExpressionChain({ variables }),
40
+ ...super.fromRdfResourceValuesExpressionChain({ variables }),
52
41
  languageIn: undefined,
53
42
  preferredLanguages: undefined,
54
43
  valueTo: code `chain(values => values.chainMap(value => value.toBoolean(${this.primitiveIn.length === 1 ? `[${this.primitiveIn[0]}] as const` : ""})))`,
55
44
  };
56
45
  }
57
46
  }
58
- __decorate([
59
- Memoize()
60
- ], BooleanType.prototype, "conversionFunction", null);
61
47
  __decorate([
62
48
  Memoize()
63
49
  ], BooleanType.prototype, "name", null);
@@ -2,7 +2,6 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class DateTimeType extends AbstractDateType {
5
- readonly conversionFunction: AbstractDateType.ConversionFunction;
6
5
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
6
  readonly hashFunction: Code;
8
7
  readonly kind = "DateTimeType";
@@ -2,15 +2,6 @@ import { LiteralDecoder } from "@rdfx/literal";
2
2
  import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { code } from "./ts-poet-wrapper.js";
4
4
  export class DateTimeType extends AbstractDateType {
5
- conversionFunction = {
6
- code: code `${this.reusables.snippets.convertToDateTime}`,
7
- sourceTypes: [
8
- {
9
- name: "Date",
10
- typeof: "object",
11
- },
12
- ],
13
- };
14
5
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
15
6
  hashFunction = code `${this.reusables.snippets.hashDateTime}`;
16
7
  kind = "DateTimeType";
@@ -3,7 +3,6 @@ import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { DateTimeType } from "./DateTimeType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class DateType extends AbstractDateType {
6
- readonly conversionFunction: AbstractDateType.ConversionFunction;
7
6
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
7
  readonly hashFunction: Code;
9
8
  readonly kind = "DateType";
@@ -3,15 +3,6 @@ import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { DateTimeType } from "./DateTimeType.js";
4
4
  import { code } from "./ts-poet-wrapper.js";
5
5
  export class DateType extends AbstractDateType {
6
- conversionFunction = {
7
- code: code `${this.reusables.snippets.convertToDate}`,
8
- sourceTypes: [
9
- {
10
- name: "Date",
11
- typeof: "object",
12
- },
13
- ],
14
- };
15
6
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
16
7
  hashFunction = code `${this.reusables.snippets.hashDate}`;
17
8
  kind = "DateType";
@@ -11,10 +11,11 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
12
  readonly kind = "DefaultValueType";
13
13
  readonly typeofs: "object"[];
14
+ readonly validationFunction: Maybe<Code>;
14
15
  constructor({ defaultValue, ...superParameters }: {
15
16
  defaultValue: Literal | NamedNode;
16
17
  } & ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0]);
17
- get conversionFunction(): AbstractContainerType.ConversionFunction;
18
+ get conversionFunction(): Maybe<AbstractContainerType.ConversionFunction>;
18
19
  get equalsFunction(): Code;
19
20
  get filterFunction(): Code;
20
21
  get filterType(): Code;
@@ -15,21 +15,22 @@ export class DefaultValueType extends AbstractContainerType {
15
15
  graphqlArgs = Maybe.empty();
16
16
  kind = "DefaultValueType";
17
17
  typeofs = ["object"];
18
+ validationFunction = this.itemType.validationFunction;
18
19
  constructor({ defaultValue, ...superParameters }) {
19
20
  super(superParameters);
20
21
  this.defaultValue = defaultValue;
21
22
  }
22
23
  get conversionFunction() {
23
- const itemConversionFunction = this.itemType.conversionFunction;
24
- return {
25
- code: code `${this.reusables.snippets.convertWithDefaultValue}(${itemConversionFunction.code})`,
24
+ const itemConversionFunction = this.itemType.conversionFunction.orDefault(this.itemConversionFunctionDefault);
25
+ return Maybe.of({
26
+ code: code `${this.reusables.snippets.convertWithDefaultValue}(${itemConversionFunction.code}, ${this.defaultValueExpression})`,
26
27
  sourceTypes: itemConversionFunction.sourceTypes
27
28
  .filter((sourceType) => sourceType.typeof !== "undefined")
28
29
  .concat({
29
30
  name: "undefined",
30
31
  typeof: "undefined",
31
32
  }),
32
- };
33
+ });
33
34
  }
34
35
  get equalsFunction() {
35
36
  return this.itemType.equalsFunction;
@@ -1,9 +1,10 @@
1
1
  import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import { type IdentifierNodeKind } from "@shaclmate/shacl-ast";
3
+ import { Maybe } from "purify-ts";
3
4
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
4
5
  import { type Code } from "./ts-poet-wrapper.js";
5
6
  export declare class IdentifierType extends AbstractIdentifierType<BlankNode | NamedNode> {
6
- readonly conversionFunction: AbstractIdentifierType.ConversionFunction;
7
+ readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
7
8
  readonly filterFunction: Code;
8
9
  readonly filterType: Code;
9
10
  readonly parseFunction: Code;
@@ -17,6 +18,6 @@ export declare class IdentifierType extends AbstractIdentifierType<BlankNode | N
17
18
  jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
18
19
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonSchema"]>[0]): Code;
19
20
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["toJsonExpression"]>[0]): Code;
20
- protected fromRdfExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfExpressionChain"]>;
21
+ protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>;
21
22
  }
22
23
  //# sourceMappingURL=IdentifierType.d.ts.map
@@ -5,11 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { NodeKind } from "@shaclmate/shacl-ast";
8
+ import { Maybe } from "purify-ts";
8
9
  import { Memoize } from "typescript-memoize";
9
10
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
10
11
  import { arrayOf, code } from "./ts-poet-wrapper.js";
11
12
  export class IdentifierType extends AbstractIdentifierType {
12
- conversionFunction = {
13
+ conversionFunction = Maybe.of({
13
14
  code: code `${this.reusables.snippets.convertToIdentifier}`,
14
15
  sourceTypes: [
15
16
  {
@@ -29,7 +30,7 @@ export class IdentifierType extends AbstractIdentifierType {
29
30
  typeof: "undefined",
30
31
  },
31
32
  ],
32
- };
33
+ });
33
34
  filterFunction = code `${this.reusables.snippets.filterIdentifier}`;
34
35
  filterType = code `${this.reusables.snippets.IdentifierFilter}`;
35
36
  parseFunction = code `${this.reusables.snippets.parseIdentifier};`;
@@ -46,7 +47,7 @@ export class IdentifierType extends AbstractIdentifierType {
46
47
  });
47
48
  }
48
49
  fromJsonExpression({ variables, }) {
49
- return code `(${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"]))`;
50
+ return code `${this.reusables.imports.Either}.of<Error, ${this.name}>((${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])))`;
50
51
  }
51
52
  jsonType(parameters) {
52
53
  const discriminantProperty = parameters?.includeDiscriminantProperty
@@ -68,9 +69,9 @@ export class IdentifierType extends AbstractIdentifierType {
68
69
  const valueToNamedNode = code `{ "@id": ${variables.value}.value${discriminantProperty} }`;
69
70
  return code `(${variables.value}.termType === "BlankNode" ? ${valueToBlankNode} : ${valueToNamedNode})`;
70
71
  }
71
- fromRdfExpressionChain({ variables, }) {
72
+ fromRdfResourceValuesExpressionChain({ variables, }) {
72
73
  return {
73
- ...super.fromRdfExpressionChain({ variables }),
74
+ ...super.fromRdfResourceValuesExpressionChain({ variables }),
74
75
  valueTo: code `chain(values => values.chainMap(value => value.toIdentifier()))`,
75
76
  };
76
77
  }
@@ -1,4 +1,5 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
+ import { Maybe } from "purify-ts";
2
3
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
3
4
  import { type Code } from "./ts-poet-wrapper.js";
4
5
  export declare class IriType extends AbstractIdentifierType<NamedNode> {
@@ -8,22 +9,13 @@ export declare class IriType extends AbstractIdentifierType<NamedNode> {
8
9
  readonly nodeKinds: ReadonlySet<"IRI">;
9
10
  readonly schemaType: Code;
10
11
  readonly valueSparqlWherePatternsFunction: Code;
11
- get conversionFunction(): {
12
- code: Code;
13
- sourceTypes: ({
14
- name: Code;
15
- typeof: "string";
16
- } | {
17
- name: Code;
18
- typeof: "object";
19
- })[];
20
- };
12
+ get conversionFunction(): Maybe<AbstractIdentifierType.ConversionFunction>;
21
13
  get name(): Code;
22
14
  get parseFunction(): Code;
23
15
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<NamedNode>["fromJsonExpression"]>[0]): Code;
24
16
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<NamedNode>["jsonSchema"]>[0]): Code;
25
17
  jsonType(parameters?: Parameters<AbstractIdentifierType<NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
26
18
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<NamedNode>["toJsonExpression"]>[0]): Code;
27
- protected fromRdfExpressionChain({ variables, }: Parameters<AbstractIdentifierType<NamedNode>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<NamedNode>["fromRdfExpressionChain"]>;
19
+ protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<NamedNode>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<NamedNode>["fromRdfResourceValuesExpressionChain"]>;
28
20
  }
29
21
  //# sourceMappingURL=IriType.d.ts.map
@@ -4,6 +4,7 @@ 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 { Maybe } from "purify-ts";
7
8
  import { Memoize } from "typescript-memoize";
8
9
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
9
10
  import { arrayOf, code, joinCode, literalOf, } from "./ts-poet-wrapper.js";
@@ -18,7 +19,7 @@ export class IriType extends AbstractIdentifierType {
18
19
  const IriT = this.in_.length > 0
19
20
  ? code `${joinCode(this.in_.map((iri) => code `${literalOf(iri.value)}`), { on: "| " })}`
20
21
  : code `string`;
21
- return {
22
+ return Maybe.of({
22
23
  code: code `${this.reusables.snippets.convertToIri}<${IriT}>`,
23
24
  sourceTypes: [
24
25
  {
@@ -30,7 +31,7 @@ export class IriType extends AbstractIdentifierType {
30
31
  typeof: "object",
31
32
  },
32
33
  ],
33
- };
34
+ });
34
35
  }
35
36
  get name() {
36
37
  if (this.in_.length > 0) {
@@ -47,7 +48,7 @@ export class IriType extends AbstractIdentifierType {
47
48
  return code `${this.reusables.snippets.parseIri}`;
48
49
  }
49
50
  fromJsonExpression({ variables, }) {
50
- return code `${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])`;
51
+ return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"]))`;
51
52
  }
52
53
  jsonSchema({ includeDiscriminantProperty, }) {
53
54
  let idSchema;
@@ -81,9 +82,9 @@ export class IriType extends AbstractIdentifierType {
81
82
  : "";
82
83
  return code `{ "@id": ${variables.value}.value${discriminantProperty} }`;
83
84
  }
84
- fromRdfExpressionChain({ variables, }) {
85
+ fromRdfResourceValuesExpressionChain({ variables, }) {
85
86
  return {
86
- ...super.fromRdfExpressionChain({ variables }),
87
+ ...super.fromRdfResourceValuesExpressionChain({ variables }),
87
88
  valueTo: code `chain(values => values.chainMap(value => value.toIri(${this.in_.length > 0
88
89
  ? code `[${joinCode(this.in_.map((in_) => this.rdfjsTermExpression(in_)), { on: ", " })}]`
89
90
  : ""})))`,
@@ -19,7 +19,7 @@ declare const Super: (abstract new ({ partialType, resolveType, ...superParamete
19
19
  export declare class LazyObjectOptionType extends Super {
20
20
  readonly graphqlArgs: Super["graphqlArgs"];
21
21
  readonly kind = "LazyObjectOptionType";
22
- get conversionFunction(): AbstractLazyObjectType.ConversionFunction;
22
+ get conversionFunction(): Maybe<AbstractLazyObjectType.ConversionFunction>;
23
23
  protected get runtimeClass(): {
24
24
  name: Code;
25
25
  partialPropertyName: string;
@@ -13,7 +13,7 @@ export class LazyObjectOptionType extends Super {
13
13
  graphqlArgs = Maybe.empty();
14
14
  kind = "LazyObjectOptionType";
15
15
  get conversionFunction() {
16
- return {
16
+ return Maybe.of({
17
17
  code: code `${this.reusables.snippets.convertToLazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
18
18
  sourceTypes: [
19
19
  {
@@ -33,7 +33,7 @@ export class LazyObjectOptionType extends Super {
33
33
  typeof: "undefined",
34
34
  },
35
35
  ],
36
- };
36
+ });
37
37
  }
38
38
  get runtimeClass() {
39
39
  return {
@@ -43,7 +43,7 @@ export class LazyObjectOptionType extends Super {
43
43
  };
44
44
  }
45
45
  fromJsonExpression(parameters) {
46
- return code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${this.partialType.fromJsonExpression(parameters)}, resolver: (identifier) => Promise.resolve(${this.reusables.imports.Left}(new Error(\`unable to resolve identifier \${identifier} deserialized from JSON\`))) })`;
46
+ return code `${this.partialType.fromJsonExpression(parameters)}.map(partial => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: partial, resolver: (identifier) => Promise.resolve(${this.reusables.imports.Left}(new Error(\`unable to resolve identifier \${identifier} deserialized from JSON\`))) }))`;
47
47
  }
48
48
  fromRdfResourceValuesExpression(parameters) {
49
49
  const { variables } = parameters;
@@ -1,10 +1,11 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
2
3
  import type { SetType } from "./SetType.js";
3
4
  import { type Code } from "./ts-poet-wrapper.js";
4
5
  export declare class LazyObjectSetType extends AbstractLazyObjectType<SetType<AbstractLazyObjectType.ObjectTypeConstraint>, SetType<AbstractLazyObjectType.ObjectTypeConstraint>> {
5
6
  readonly graphqlArgs: Super["graphqlArgs"];
6
7
  readonly kind = "LazyObjectSetType";
7
- get conversionFunction(): AbstractLazyObjectType.ConversionFunction;
8
+ get conversionFunction(): Maybe<AbstractLazyObjectType.ConversionFunction>;
8
9
  protected get runtimeClass(): {
9
10
  name: Code;
10
11
  partialPropertyName: string;
@@ -19,7 +19,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
19
19
  });
20
20
  kind = "LazyObjectSetType";
21
21
  get conversionFunction() {
22
- return {
22
+ return Maybe.of({
23
23
  code: code `${this.reusables.snippets.convertToLazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
24
24
  sourceTypes: [
25
25
  {
@@ -35,7 +35,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
35
35
  typeof: "undefined",
36
36
  },
37
37
  ],
38
- };
38
+ });
39
39
  }
40
40
  get runtimeClass() {
41
41
  return {
@@ -45,7 +45,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
45
45
  };
46
46
  }
47
47
  fromJsonExpression(parameters) {
48
- return code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${this.partialType.fromJsonExpression(parameters)}, resolver: () => Promise.resolve(${this.reusables.imports.Left}(new Error("unable to resolve identifiers deserialized from JSON"))) })`;
48
+ return code `${this.partialType.fromJsonExpression(parameters)}.map(partial => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: partial, resolver: () => Promise.resolve(${this.reusables.imports.Left}(new Error("unable to resolve identifiers deserialized from JSON"))) }))`;
49
49
  }
50
50
  fromRdfResourceValuesExpression(parameters) {
51
51
  const { variables } = parameters;
@@ -1,9 +1,10 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
2
3
  import { type Code } from "./ts-poet-wrapper.js";
3
4
  export declare class LazyObjectType extends AbstractLazyObjectType<AbstractLazyObjectType.ObjectTypeConstraint, AbstractLazyObjectType.ObjectTypeConstraint> {
4
5
  readonly graphqlArgs: Super["graphqlArgs"];
5
6
  readonly kind = "LazyObjectType";
6
- get conversionFunction(): AbstractLazyObjectType.ConversionFunction;
7
+ get conversionFunction(): Maybe<AbstractLazyObjectType.ConversionFunction>;
7
8
  protected get runtimeClass(): {
8
9
  name: Code;
9
10
  partialPropertyName: string;
@@ -12,7 +12,7 @@ export class LazyObjectType extends AbstractLazyObjectType {
12
12
  graphqlArgs = Maybe.empty();
13
13
  kind = "LazyObjectType";
14
14
  get conversionFunction() {
15
- return {
15
+ return Maybe.of({
16
16
  code: code `${this.reusables.snippets.convertToLazyObject}<${this.resolveType.identifierTypeAlias}, ${this.partialType.name}, ${this.resolveType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType, resolveType: this.resolveType })})`,
17
17
  sourceTypes: [
18
18
  {
@@ -24,7 +24,7 @@ export class LazyObjectType extends AbstractLazyObjectType {
24
24
  typeof: "object",
25
25
  },
26
26
  ],
27
- };
27
+ });
28
28
  }
29
29
  get runtimeClass() {
30
30
  return {
@@ -34,7 +34,7 @@ export class LazyObjectType extends AbstractLazyObjectType {
34
34
  };
35
35
  }
36
36
  fromJsonExpression(parameters) {
37
- return code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${this.partialType.fromJsonExpression(parameters)}, resolver: (identifier) => Promise.resolve(${this.reusables.imports.Left}(new Error(\`unable to resolve identifier \${identifier} deserialized from JSON\`))) })`;
37
+ return code `${this.partialType.fromJsonExpression(parameters)}.map(partial => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: partial, resolver: (identifier) => Promise.resolve(${this.reusables.imports.Left}(new Error(\`unable to resolve identifier \${identifier} deserialized from JSON\`))) }))`;
38
38
  }
39
39
  fromRdfResourceValuesExpression(parameters) {
40
40
  const { variables } = parameters;
@@ -1,9 +1,10 @@
1
1
  import type { Literal } from "@rdfjs/types";
2
+ import { Maybe } from "purify-ts";
2
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
3
4
  import { type Code } from "./ts-poet-wrapper.js";
4
5
  export declare class LiteralType extends AbstractLiteralType {
5
6
  readonly name: Code;
6
- readonly conversionFunction: AbstractLiteralType.ConversionFunction;
7
+ readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
7
8
  readonly filterFunction: Code;
8
9
  readonly filterType: Code;
9
10
  readonly kind = "LiteralType";
@@ -1,9 +1,10 @@
1
1
  import { xsd } from "@tpluscode/rdf-ns-builders";
2
+ import { Maybe } from "purify-ts";
2
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
3
4
  import { code } from "./ts-poet-wrapper.js";
4
5
  export class LiteralType extends AbstractLiteralType {
5
6
  name = code `${this.reusables.imports.Literal}`;
6
- conversionFunction = {
7
+ conversionFunction = Maybe.of({
7
8
  code: code `${this.reusables.snippets.convertToLiteral}`,
8
9
  sourceTypes: [
9
10
  ...["bigint", "boolean", "number", "string"].map((typeof_) => ({
@@ -19,7 +20,7 @@ export class LiteralType extends AbstractLiteralType {
19
20
  typeof: "object",
20
21
  },
21
22
  ],
22
- };
23
+ });
23
24
  filterFunction = code `${this.reusables.snippets.filterLiteral}`;
24
25
  filterType = code `${this.reusables.snippets.LiteralFilter}`;
25
26
  kind = "LiteralType";
@@ -29,7 +30,7 @@ export class LiteralType extends AbstractLiteralType {
29
30
  throw new Error("not implemented");
30
31
  }
31
32
  fromJsonExpression({ variables, }) {
32
- return code `${this.reusables.imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined))`;
33
+ return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined)))`;
33
34
  }
34
35
  graphqlResolveExpression(_parameters) {
35
36
  throw new Error("not implemented");
@@ -12,6 +12,7 @@ import type { Type } from "./Type.js";
12
12
  import { type Code } from "./ts-poet-wrapper.js";
13
13
  export declare class NamedObjectType extends AbstractType {
14
14
  protected readonly toRdfTypes: readonly NamedNode[];
15
+ readonly conversionFunction: Maybe<AbstractType.ConversionFunction>;
15
16
  readonly extern: boolean;
16
17
  readonly fromRdfType: Maybe<NamedNode>;
17
18
  readonly graphqlArgs: AbstractType["graphqlArgs"];
@@ -21,6 +22,7 @@ export declare class NamedObjectType extends AbstractType {
21
22
  readonly recursive: boolean;
22
23
  readonly synthetic: boolean;
23
24
  readonly typeofs: "object"[];
25
+ readonly validationFunction: Maybe<Code>;
24
26
  constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }: {
25
27
  comment: Maybe<string>;
26
28
  extern: boolean;
@@ -41,7 +43,6 @@ export declare class NamedObjectType extends AbstractType {
41
43
  get _discriminantProperty(): NamedObjectType.DiscriminantProperty;
42
44
  get ancestorObjectTypes(): readonly NamedObjectType[];
43
45
  get childObjectTypes(): readonly NamedObjectType[];
44
- get conversionFunction(): AbstractType.ConversionFunction;
45
46
  get declaration(): Maybe<Code>;
46
47
  get descendantFromRdfTypeVariables(): readonly Code[];
47
48
  get descendantFromRdfTypes(): readonly NamedNode[];