@shaclmate/compiler 4.0.97 → 4.0.99

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 (173) hide show
  1. package/dist/generators/ts/AbstractCollectionType.d.ts +2 -1
  2. package/dist/generators/ts/AbstractCollectionType.js +10 -5
  3. package/dist/generators/ts/AbstractCompoundType.d.ts +11 -8
  4. package/dist/generators/ts/AbstractCompoundType.js +5 -2
  5. package/dist/generators/ts/AbstractContainerType.d.ts +11 -11
  6. package/dist/generators/ts/AbstractContainerType.js +21 -15
  7. package/dist/generators/ts/AbstractDateType.d.ts +7 -6
  8. package/dist/generators/ts/AbstractDateType.js +16 -6
  9. package/dist/generators/ts/AbstractDiscriminatedUnionType.d.ts +2 -3
  10. package/dist/generators/ts/AbstractDiscriminatedUnionType.js +25 -7
  11. package/dist/generators/ts/AbstractIntersectionType.d.ts +2 -2
  12. package/dist/generators/ts/AbstractIntersectionType.js +19 -8
  13. package/dist/generators/ts/AbstractLazyType.d.ts +23 -23
  14. package/dist/generators/ts/AbstractLazyType.js +23 -21
  15. package/dist/generators/ts/AbstractNumericType.d.ts +4 -3
  16. package/dist/generators/ts/AbstractNumericType.js +12 -7
  17. package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -2
  18. package/dist/generators/ts/AbstractPrimitiveType.js +4 -4
  19. package/dist/generators/ts/AbstractTermType.d.ts +17 -16
  20. package/dist/generators/ts/AbstractTermType.js +21 -11
  21. package/dist/generators/ts/AbstractType.d.ts +6 -15
  22. package/dist/generators/ts/AbstractType.js +14 -33
  23. package/dist/generators/ts/AbstractTypedLiteralType.d.ts +2 -1
  24. package/dist/generators/ts/AbstractTypedLiteralType.js +20 -2
  25. package/dist/generators/ts/BigDecimalType.d.ts +12 -11
  26. package/dist/generators/ts/BigDecimalType.js +28 -11
  27. package/dist/generators/ts/BigIntType.js +6 -6
  28. package/dist/generators/ts/BlankNodeType.d.ts +11 -10
  29. package/dist/generators/ts/BlankNodeType.js +27 -10
  30. package/dist/generators/ts/BooleanType.d.ts +6 -5
  31. package/dist/generators/ts/BooleanType.js +18 -8
  32. package/dist/generators/ts/Callable.d.ts +2 -2
  33. package/dist/generators/ts/DateTimeType.d.ts +6 -6
  34. package/dist/generators/ts/DateTimeType.js +6 -6
  35. package/dist/generators/ts/DateType.d.ts +6 -6
  36. package/dist/generators/ts/DateType.js +6 -6
  37. package/dist/generators/ts/DefaultValueType.d.ts +2 -2
  38. package/dist/generators/ts/DefaultValueType.js +18 -8
  39. package/dist/generators/ts/FloatType.js +4 -4
  40. package/dist/generators/ts/IdentifierType.d.ts +11 -10
  41. package/dist/generators/ts/IdentifierType.js +27 -10
  42. package/dist/generators/ts/Imports.d.ts +1 -0
  43. package/dist/generators/ts/Imports.js +1 -0
  44. package/dist/generators/ts/IntType.js +4 -4
  45. package/dist/generators/ts/IriType.d.ts +5 -5
  46. package/dist/generators/ts/IriType.js +36 -21
  47. package/dist/generators/ts/LangStringType.d.ts +10 -10
  48. package/dist/generators/ts/LangStringType.js +21 -13
  49. package/dist/generators/ts/ListType.js +7 -7
  50. package/dist/generators/ts/LiteralType.d.ts +10 -10
  51. package/dist/generators/ts/LiteralType.js +21 -13
  52. package/dist/generators/ts/ObjectType.d.ts +13 -15
  53. package/dist/generators/ts/ObjectType.js +32 -9
  54. package/dist/generators/ts/OptionType.d.ts +2 -1
  55. package/dist/generators/ts/OptionType.js +16 -11
  56. package/dist/generators/ts/SetType.d.ts +2 -1
  57. package/dist/generators/ts/SetType.js +22 -10
  58. package/dist/generators/ts/Snippets.d.ts +8 -6
  59. package/dist/generators/ts/Snippets.js +48 -34
  60. package/dist/generators/ts/StringType.d.ts +6 -6
  61. package/dist/generators/ts/StringType.js +20 -17
  62. package/dist/generators/ts/TermType.d.ts +7 -7
  63. package/dist/generators/ts/TermType.js +18 -13
  64. package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromJsonObjectFunction.js +1 -1
  65. package/dist/generators/ts/_AbstractType/AbstractType_JsonType.d.ts +39 -16
  66. package/dist/generators/ts/_AbstractType/AbstractType_JsonType.js +49 -33
  67. package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunction.js +1 -1
  68. package/dist/generators/ts/_ObjectIntersectionType/ObjectIntersectionType_fromJsonObjectFunction.js +1 -1
  69. package/dist/generators/ts/_ObjectIntersectionType/ObjectIntersectionType_fromRdfResourceValuesFunction.js +1 -1
  70. package/dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.d.ts +4 -7
  71. package/dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.js +1 -3
  72. package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts +0 -1
  73. package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.js +0 -1
  74. package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.d.ts +3 -2
  75. package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.js +31 -11
  76. package/dist/generators/ts/_ObjectType/ObjectType_RdfTypeProperty.d.ts +3 -2
  77. package/dist/generators/ts/_ObjectType/ObjectType_RdfTypeProperty.js +26 -10
  78. package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.d.ts +3 -2
  79. package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.js +46 -22
  80. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonObjectFunction.js +7 -2
  81. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunction.js +1 -1
  82. package/dist/generators/ts/_ObjectType/ObjectType_toJsonObjectFunction.js +1 -1
  83. package/dist/generators/ts/_snippets/snippets_FromJsonFunction.d.ts +3 -0
  84. package/dist/generators/ts/_snippets/snippets_FromJsonFunction.js +28 -0
  85. package/dist/generators/ts/_snippets/snippets_ToJsonFunction.d.ts +3 -0
  86. package/dist/generators/ts/_snippets/snippets_ToJsonFunction.js +3 -0
  87. package/dist/generators/ts/_snippets/snippets_arrayFromJsonArray.js +1 -1
  88. package/dist/generators/ts/_snippets/snippets_arrayToJsonArray.js +1 -1
  89. package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonObject.js +1 -1
  90. package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonString.js +1 -1
  91. package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonObject.js +1 -1
  92. package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonString.js +1 -1
  93. package/dist/generators/ts/_snippets/snippets_bigIntFromJsonObject.js +1 -1
  94. package/dist/generators/ts/_snippets/snippets_bigIntFromJsonString.js +1 -1
  95. package/dist/generators/ts/_snippets/snippets_bigIntToJsonObject.js +1 -1
  96. package/dist/generators/ts/_snippets/snippets_bigIntToJsonString.js +1 -1
  97. package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonObject.js +1 -1
  98. package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonString.js +1 -1
  99. package/dist/generators/ts/_snippets/snippets_blankNodeToJsonObject.js +1 -1
  100. package/dist/generators/ts/_snippets/snippets_blankNodeToJsonString.js +1 -1
  101. package/dist/generators/ts/_snippets/snippets_booleanFromJsonBoolean.js +1 -1
  102. package/dist/generators/ts/_snippets/snippets_booleanFromJsonObject.js +1 -1
  103. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +1 -1
  104. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +2 -4
  105. package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
  106. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +1 -2
  107. package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.d.ts +3 -0
  108. package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.js +11 -0
  109. package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.d.ts +3 -0
  110. package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.js +17 -0
  111. package/dist/generators/ts/_snippets/snippets_dateFromJsonObject.js +1 -1
  112. package/dist/generators/ts/_snippets/snippets_dateFromJsonString.js +1 -1
  113. package/dist/generators/ts/_snippets/snippets_dateTimeFromJsonObject.js +1 -1
  114. package/dist/generators/ts/_snippets/snippets_dateTimeToJsonString.js +1 -1
  115. package/dist/generators/ts/_snippets/snippets_dateToJsonObject.js +1 -1
  116. package/dist/generators/ts/_snippets/snippets_dateToJsonString.js +1 -1
  117. package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonObject.js +1 -1
  118. package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonValue.js +1 -1
  119. package/dist/generators/ts/_snippets/snippets_floatFromJsonNumber.js +1 -1
  120. package/dist/generators/ts/_snippets/snippets_floatFromJsonObject.js +1 -1
  121. package/dist/generators/ts/_snippets/snippets_identifierFromJsonObject.js +1 -1
  122. package/dist/generators/ts/_snippets/snippets_identifierFromJsonString.js +1 -1
  123. package/dist/generators/ts/_snippets/snippets_identifierToJsonObject.js +1 -1
  124. package/dist/generators/ts/_snippets/snippets_identifierToJsonString.js +1 -1
  125. package/dist/generators/ts/_snippets/snippets_intFromJsonNumber.js +1 -1
  126. package/dist/generators/ts/_snippets/snippets_intFromJsonObject.js +1 -1
  127. package/dist/generators/ts/_snippets/snippets_iriFromJsonObject.js +1 -1
  128. package/dist/generators/ts/_snippets/snippets_iriFromJsonString.js +2 -2
  129. package/dist/generators/ts/_snippets/snippets_iriFromString.d.ts +3 -0
  130. package/dist/generators/ts/_snippets/snippets_iriFromString.js +76 -0
  131. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.d.ts +3 -0
  132. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.js +6 -0
  133. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.d.ts +3 -0
  134. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.js +6 -0
  135. package/dist/generators/ts/_snippets/snippets_langStringFromJsonObject.js +1 -1
  136. package/dist/generators/ts/_snippets/snippets_langStringToJsonObject.js +1 -1
  137. package/dist/generators/ts/_snippets/snippets_listFromJsonObject.js +1 -1
  138. package/dist/generators/ts/_snippets/snippets_listToJsonObject.js +1 -1
  139. package/dist/generators/ts/_snippets/snippets_literalFromJsonObject.js +1 -1
  140. package/dist/generators/ts/_snippets/snippets_literalToJsonObject.js +1 -1
  141. package/dist/generators/ts/_snippets/snippets_maybeFromJsonObject.js +1 -1
  142. package/dist/generators/ts/_snippets/snippets_maybeFromJsonValue.js +1 -1
  143. package/dist/generators/ts/_snippets/snippets_maybeToJsonObject.js +1 -1
  144. package/dist/generators/ts/_snippets/snippets_maybeToJsonValue.js +1 -1
  145. package/dist/generators/ts/_snippets/snippets_primitiveToJsonObject.js +1 -1
  146. package/dist/generators/ts/_snippets/snippets_stringFromJsonObject.js +1 -1
  147. package/dist/generators/ts/_snippets/snippets_stringFromJsonString.js +1 -1
  148. package/dist/generators/ts/_snippets/snippets_termFromJsonObject.js +1 -1
  149. package/dist/generators/ts/_snippets/snippets_termToJsonObject.js +1 -1
  150. package/dist/generators/ts/_snippets/snippets_typedLiteralToJsonObject.js +1 -1
  151. package/package.json +16 -14
  152. package/dist/generators/ts/AbstractStructuredType.d.ts +0 -71
  153. package/dist/generators/ts/AbstractStructuredType.js +0 -273
  154. package/dist/generators/ts/ReferenceCallable.d.ts +0 -14
  155. package/dist/generators/ts/ReferenceCallable.js +0 -16
  156. package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.d.ts +0 -5
  157. package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.js +0 -11
  158. package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +0 -4
  159. package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +0 -15
  160. package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +0 -4
  161. package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +0 -15
  162. package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.d.ts +0 -3
  163. package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.js +0 -21
  164. package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.d.ts +0 -3
  165. package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.js +0 -21
  166. package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.d.ts +0 -3
  167. package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.js +0 -3
  168. package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.d.ts +0 -3
  169. package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.js +0 -3
  170. package/dist/generators/ts/_snippets/snippets_convertToInIri.d.ts +0 -3
  171. package/dist/generators/ts/_snippets/snippets_convertToInIri.js +0 -11
  172. package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.d.ts +0 -3
  173. package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.js +0 -17
@@ -8,9 +8,10 @@ import { Maybe } from "purify-ts";
8
8
  import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
10
  import { AbstractContainerType } from "./AbstractContainerType.js";
11
+ import { BuiltinCallable } from "./BuiltinCallable.js";
11
12
  import { codeEquals } from "./codeEquals.js";
12
13
  import { InlineCallable } from "./InlineCallable.js";
13
- import { ReferenceCallable } from "./ReferenceCallable.js";
14
+ import { SchemaObject } from "./SchemaObject.js";
14
15
  import { code } from "./ts-poet-wrapper.js";
15
16
  export class OptionType extends AbstractContainerType {
16
17
  graphqlArgs = Maybe.empty();
@@ -47,13 +48,13 @@ export class OptionType extends AbstractContainerType {
47
48
  return code `${this.reusables.snippets.MaybeFilter}<${this.itemType.filterType}>`;
48
49
  }
49
50
  get fromJsonValueFunction() {
50
- return new ReferenceCallable(code `${this.reusables.snippets.maybeFromJsonValue}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
51
+ return new BuiltinCallable(code `${this.reusables.snippets.maybeFromJsonValue}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
51
52
  }
52
53
  get fromJsonObjectFunction() {
53
- return new ReferenceCallable(code `${this.reusables.snippets.maybeFromJsonObject}(${this.itemType.fromJsonObjectFunction.annotatedUsage})`);
54
+ return new BuiltinCallable(code `${this.reusables.snippets.maybeFromJsonObject}(${this.itemType.fromJsonObjectFunction.annotatedUsage})`);
54
55
  }
55
56
  get fromRdfResourceValuesFunction() {
56
- return new InlineCallable(code `${this.reusables.snippets.maybeFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schemaType}>(${this.itemType.fromRdfResourceValuesFunction.unannotatedUsage})`);
57
+ return new InlineCallable(code `${this.reusables.snippets.maybeFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schema.type.expression}>(${this.itemType.fromRdfResourceValuesFunction.unannotatedUsage})`);
57
58
  }
58
59
  get graphqlType() {
59
60
  invariant(!this.itemType.graphqlType.nullable);
@@ -67,14 +68,18 @@ export class OptionType extends AbstractContainerType {
67
68
  get mutable() {
68
69
  return this.itemType.mutable;
69
70
  }
70
- get schemaType() {
71
- return code `${this.reusables.snippets.MaybeSchema}<${this.itemType.schemaType}>`;
71
+ get schema() {
72
+ return new SchemaObject({
73
+ properties: super.schema.properties,
74
+ type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.MaybeSchema}<${this.itemType.schema.type.expression}>`),
75
+ variable: super.schema.variable,
76
+ });
72
77
  }
73
78
  get toJsonValueFunction() {
74
- return new ReferenceCallable(code `${this.reusables.snippets.maybeToJsonValue}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
79
+ return new BuiltinCallable(code `${this.reusables.snippets.maybeToJsonValue}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
75
80
  }
76
81
  get toJsonObjectFunction() {
77
- return new ReferenceCallable(code `${this.reusables.snippets.maybeToJsonObject}(${this.itemType.toJsonObjectFunction.annotatedUsage})`);
82
+ return new BuiltinCallable(code `${this.reusables.snippets.maybeToJsonObject}(${this.itemType.toJsonObjectFunction.annotatedUsage})`);
78
83
  }
79
84
  get toRdfResourceValueTypes() {
80
85
  return this.itemType.toRdfResourceValueTypes;
@@ -85,10 +90,10 @@ export class OptionType extends AbstractContainerType {
85
90
  .orDefault(this.itemValidationFunctionDefault.annotatedUsage)})`));
86
91
  }
87
92
  get valueSparqlConstructTriplesFunction() {
88
- return new InlineCallable(code `${this.reusables.snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction.unannotatedUsage})`);
93
+ return new InlineCallable(code `${this.reusables.snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlConstructTriplesFunction.unannotatedUsage})`);
89
94
  }
90
95
  get valueSparqlWherePatternsFunction() {
91
- return new InlineCallable(code `${this.reusables.snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction.unannotatedUsage})`);
96
+ return new InlineCallable(code `${this.reusables.snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlWherePatternsFunction.unannotatedUsage})`);
92
97
  }
93
98
  get inlineExpression() {
94
99
  return code `${this.reusables.imports.Maybe}<${this.itemType.expression}>`;
@@ -142,7 +147,7 @@ __decorate([
142
147
  ], OptionType.prototype, "hashFunction", null);
143
148
  __decorate([
144
149
  Memoize()
145
- ], OptionType.prototype, "schemaType", null);
150
+ ], OptionType.prototype, "schema", null);
146
151
  __decorate([
147
152
  Memoize()
148
153
  ], OptionType.prototype, "toJsonValueFunction", null);
@@ -1,6 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
3
3
  import type { Callable } from "./Callable.js";
4
+ import { SchemaObject } from "./SchemaObject.js";
4
5
  import { type Code } from "./ts-poet-wrapper.js";
5
6
  export declare class SetType<ItemTypeT extends SetType.ItemType> extends AbstractCollectionType<ItemTypeT> {
6
7
  readonly graphqlArgs: AbstractCollectionType<ItemTypeT>["graphqlArgs"];
@@ -24,7 +25,7 @@ export declare class SetType<ItemTypeT extends SetType.ItemType> extends Abstrac
24
25
  get toRdfResourceValueTypes(): AbstractCollectionType<ItemTypeT>["toRdfResourceValueTypes"];
25
26
  get valueSparqlConstructTriplesFunction(): Callable;
26
27
  get valueSparqlWherePatternsFunction(): Callable;
27
- protected get schemaInitializers(): readonly Code[];
28
+ get schema(): SchemaObject<SchemaObject.BuiltinType>;
28
29
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractCollectionType<ItemTypeT>["toRdfResourceValuesExpression"]>[0]): Code;
29
30
  toStringExpression({ variables, }: Parameters<AbstractCollectionType<ItemTypeT>["toStringExpression"]>[0]): Code;
30
31
  }
@@ -8,8 +8,9 @@ import { Maybe } from "purify-ts";
8
8
  import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
10
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
11
+ import { BuiltinCallable } from "./BuiltinCallable.js";
11
12
  import { InlineCallable } from "./InlineCallable.js";
12
- import { ReferenceCallable } from "./ReferenceCallable.js";
13
+ import { SchemaObject } from "./SchemaObject.js";
13
14
  import { code, joinCode } from "./ts-poet-wrapper.js";
14
15
  export class SetType extends AbstractCollectionType {
15
16
  graphqlArgs = Maybe.empty();
@@ -70,16 +71,16 @@ export class SetType extends AbstractCollectionType {
70
71
  throw new Error("should never be called");
71
72
  }
72
73
  get fromJsonValueFunction() {
73
- return new ReferenceCallable(code `${this.reusables.snippets.arrayFromJsonArray}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
74
+ return new BuiltinCallable(code `${this.reusables.snippets.arrayFromJsonArray}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
74
75
  }
75
76
  get fromJsonObjectFunction() {
76
77
  throw new Error("should never be called");
77
78
  }
78
79
  get fromRdfResourceValuesFunction() {
79
- return new InlineCallable(code `${this._mutable ? this.reusables.snippets.mutableSetFromRdfResourceValues : this.reusables.snippets.setFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schemaType}>(${this.itemType.fromRdfResourceValuesFunction.unannotatedUsage})`);
80
+ return new InlineCallable(code `${this._mutable ? this.reusables.snippets.mutableSetFromRdfResourceValues : this.reusables.snippets.setFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schema.type.expression}>(${this.itemType.fromRdfResourceValuesFunction.unannotatedUsage})`);
80
81
  }
81
82
  get toJsonValueFunction() {
82
- return new ReferenceCallable(code `${this.reusables.snippets.arrayToJsonArray}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
83
+ return new BuiltinCallable(code `${this.reusables.snippets.arrayToJsonArray}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
83
84
  }
84
85
  get toJsonObjectFunction() {
85
86
  throw new Error("should never be called");
@@ -88,17 +89,25 @@ export class SetType extends AbstractCollectionType {
88
89
  return this.itemType.toRdfResourceValueTypes;
89
90
  }
90
91
  get valueSparqlConstructTriplesFunction() {
91
- return new InlineCallable(code `${this.reusables.snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction.unannotatedUsage})`);
92
+ return new InlineCallable(code `${this.reusables.snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlConstructTriplesFunction.unannotatedUsage})`);
92
93
  }
93
94
  get valueSparqlWherePatternsFunction() {
94
- return new InlineCallable(code `${this.reusables.snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction.unannotatedUsage})`);
95
+ return new InlineCallable(code `${this.reusables.snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlWherePatternsFunction.unannotatedUsage})`);
95
96
  }
96
- get schemaInitializers() {
97
- let schemaInitializers = super.schemaInitializers;
97
+ get schema() {
98
98
  if (this.minCount > 0n) {
99
- schemaInitializers = schemaInitializers.concat(code `minCount: ${Number(this.minCount)}`);
99
+ return new SchemaObject({
100
+ properties: {
101
+ ...super.schema.properties,
102
+ minCount: code `minCount: ${Number(this.minCount)}`,
103
+ },
104
+ type: super.schema.type,
105
+ variable: super.schema.variable,
106
+ });
107
+ }
108
+ else {
109
+ return super.schema;
100
110
  }
101
- return schemaInitializers;
102
111
  }
103
112
  toRdfResourceValuesExpression({ variables, }) {
104
113
  return code `${variables.value}.flatMap((item) => ${this.itemType.toRdfResourceValuesExpression({
@@ -130,6 +139,9 @@ __decorate([
130
139
  __decorate([
131
140
  Memoize()
132
141
  ], SetType.prototype, "valueSparqlWherePatternsFunction", null);
142
+ __decorate([
143
+ Memoize()
144
+ ], SetType.prototype, "schema", null);
133
145
  (function (SetType) {
134
146
  SetType.isItemType = AbstractCollectionType.isItemType;
135
147
  })(SetType || (SetType = {}));
@@ -30,8 +30,7 @@ export declare class Snippets {
30
30
  get FilterFunction(): Snippet;
31
31
  get FocusSparqlConstructTriplesFunction(): Snippet;
32
32
  get FocusSparqlWherePatternsFunction(): Snippet;
33
- get FromJsonObjectFunction(): Snippet;
34
- get FromJsonValueFunction(): Snippet;
33
+ get FromJsonFunction(): Snippet;
35
34
  get FromRdfResourceFunction(): Snippet;
36
35
  get FromRdfResourceValuesFunction(): Snippet;
37
36
  get HashFunction(): Snippet;
@@ -46,6 +45,7 @@ export declare class Snippets {
46
45
  get LangStringSchema(): Snippet;
47
46
  get Lazy(): Snippet;
48
47
  get LazyOption(): Snippet;
48
+ get LazySchema(): Snippet;
49
49
  get LazySet(): Snippet;
50
50
  get LiteralFilter(): Snippet;
51
51
  get LiteralJsonObject(): Snippet;
@@ -70,8 +70,7 @@ export declare class Snippets {
70
70
  get TermFilter(): Snippet;
71
71
  get TermJsonObject(): Snippet;
72
72
  get TermSchema(): Snippet;
73
- get ToJsonObjectFunction(): Snippet;
74
- get ToJsonValueFunction(): Snippet;
73
+ get ToJsonFunction(): Snippet;
75
74
  get ToLoggableFunction(): Snippet;
76
75
  get ToRdfResourceFunction(): Snippet;
77
76
  get ToRdfResourceValuesFunction(): Snippet;
@@ -120,10 +119,10 @@ export declare class Snippets {
120
119
  get convertToBlankNodeIdentifierProperty(): Snippet;
121
120
  get convertToIdentifier(): Snippet;
122
121
  get convertToIdentifierProperty(): Snippet;
123
- get convertToInIri(): Snippet;
124
- get convertToInIriIdentifierProperty(): Snippet;
125
122
  get convertToIri(): Snippet;
126
123
  get convertToIriIdentifierProperty(): Snippet;
124
+ get convertToIriLiteral(): Snippet;
125
+ get convertToIriLiteralIdentifierProperty(): Snippet;
127
126
  get convertToLangString(): Snippet;
128
127
  get convertToLazy(): Snippet;
129
128
  get convertToLazyOption(): Snippet;
@@ -191,6 +190,9 @@ export declare class Snippets {
191
190
  get iriFromJsonObject(): Snippet;
192
191
  get iriFromJsonString(): Snippet;
193
192
  get iriFromRdfResourceValues(): Snippet;
193
+ get iriFromString(): Snippet;
194
+ get iriLiteralFromJsonObject(): Snippet;
195
+ get iriLiteralFromJsonString(): Snippet;
194
196
  get iriSparqlWherePatterns(): Snippet;
195
197
  get iriToJsonObject(): Snippet;
196
198
  get iriToJsonString(): Snippet;
@@ -24,8 +24,7 @@ import { snippets_EqualsResult } from "./_snippets/snippets_EqualsResult.js";
24
24
  import { snippets_FilterFunction } from "./_snippets/snippets_FilterFunction.js";
25
25
  import { snippets_FocusSparqlConstructTriplesFunction } from "./_snippets/snippets_FocusSparqlConstructTriplesFunction.js";
26
26
  import { snippets_FocusSparqlWherePatternsFunction } from "./_snippets/snippets_FocusSparqlWherePatternsFunction.js";
27
- import { snippets_FromJsonObjectFunction } from "./_snippets/snippets_FromJsonObjectFunction.js";
28
- import { snippets_FromJsonValueFunction } from "./_snippets/snippets_FromJsonValueFunction.js";
27
+ import { snippets_FromJsonFunction } from "./_snippets/snippets_FromJsonFunction.js";
29
28
  import { snippets_FromRdfResourceFunction } from "./_snippets/snippets_FromRdfResourceFunction.js";
30
29
  import { snippets_FromRdfResourceValuesFunction } from "./_snippets/snippets_FromRdfResourceValuesFunction.js";
31
30
  import { snippets_HashFunction } from "./_snippets/snippets_HashFunction.js";
@@ -40,6 +39,7 @@ import { snippets_LangStringJsonObject } from "./_snippets/snippets_LangStringJs
40
39
  import { snippets_LangStringSchema } from "./_snippets/snippets_LangStringSchema.js";
41
40
  import { snippets_Lazy } from "./_snippets/snippets_Lazy.js";
42
41
  import { snippets_LazyOption } from "./_snippets/snippets_LazyOption.js";
42
+ import { snippets_LazySchema } from "./_snippets/snippets_LazySchema.js";
43
43
  import { snippets_LazySet } from "./_snippets/snippets_LazySet.js";
44
44
  import { snippets_LiteralFilter } from "./_snippets/snippets_LiteralFilter.js";
45
45
  import { snippets_LiteralJsonObject } from "./_snippets/snippets_LiteralJsonObject.js";
@@ -64,8 +64,7 @@ import { snippets_StringSchema } from "./_snippets/snippets_StringSchema.js";
64
64
  import { snippets_TermFilter } from "./_snippets/snippets_TermFilter.js";
65
65
  import { snippets_TermJsonObject } from "./_snippets/snippets_TermJsonObject.js";
66
66
  import { snippets_TermSchema } from "./_snippets/snippets_TermSchema.js";
67
- import { snippets_ToJsonObjectFunction } from "./_snippets/snippets_ToJsonObjectFunction.js";
68
- import { snippets_ToJsonValueFunction } from "./_snippets/snippets_ToJsonValueFunction.js";
67
+ import { snippets_ToJsonFunction } from "./_snippets/snippets_ToJsonFunction.js";
69
68
  import { snippets_ToLoggableFunction } from "./_snippets/snippets_ToLoggableFunction.js";
70
69
  import { snippets_ToRdfResourceFunction } from "./_snippets/snippets_ToRdfResourceFunction.js";
71
70
  import { snippets_ToRdfResourceValuesFunction } from "./_snippets/snippets_ToRdfResourceValuesFunction.js";
@@ -114,10 +113,10 @@ import { snippets_convertToBlankNode } from "./_snippets/snippets_convertToBlank
114
113
  import { snippets_convertToBlankNodeIdentifierProperty } from "./_snippets/snippets_convertToBlankNodeIdentifierProperty.js";
115
114
  import { snippets_convertToIdentifier } from "./_snippets/snippets_convertToIdentifier.js";
116
115
  import { snippets_convertToIdentifierProperty } from "./_snippets/snippets_convertToIdentifierProperty.js";
117
- import { snippets_convertToInIri } from "./_snippets/snippets_convertToInIri.js";
118
- import { snippets_convertToInIriIdentifierProperty } from "./_snippets/snippets_convertToInIriIdentifierProperty.js";
119
116
  import { snippets_convertToIri } from "./_snippets/snippets_convertToIri.js";
120
117
  import { snippets_convertToIriIdentifierProperty } from "./_snippets/snippets_convertToIriIdentifierProperty.js";
118
+ import { snippets_convertToIriLiteral } from "./_snippets/snippets_convertToIriLiteral.js";
119
+ import { snippets_convertToIriLiteralIdentifierProperty } from "./_snippets/snippets_convertToIriLiteralIdentifierProperty.js";
121
120
  import { snippets_convertToLangString } from "./_snippets/snippets_convertToLangString.js";
122
121
  import { snippets_convertToLazy } from "./_snippets/snippets_convertToLazy.js";
123
122
  import { snippets_convertToLazyOption } from "./_snippets/snippets_convertToLazyOption.js";
@@ -185,6 +184,9 @@ import { snippets_intFromRdfResourceValues } from "./_snippets/snippets_intFromR
185
184
  import { snippets_iriFromJsonObject } from "./_snippets/snippets_iriFromJsonObject.js";
186
185
  import { snippets_iriFromJsonString } from "./_snippets/snippets_iriFromJsonString.js";
187
186
  import { snippets_iriFromRdfResourceValues } from "./_snippets/snippets_iriFromRdfResourceValues.js";
187
+ import { snippets_iriFromString } from "./_snippets/snippets_iriFromString.js";
188
+ import { snippets_iriLiteralFromJsonObject } from "./_snippets/snippets_iriLiteralFromJsonObject.js";
189
+ import { snippets_iriLiteralFromJsonString } from "./_snippets/snippets_iriLiteralFromJsonString.js";
188
190
  import { snippets_iriSparqlWherePatterns } from "./_snippets/snippets_iriSparqlWherePatterns.js";
189
191
  import { snippets_iriToJsonObject } from "./_snippets/snippets_iriToJsonObject.js";
190
192
  import { snippets_iriToJsonString } from "./_snippets/snippets_iriToJsonString.js";
@@ -313,11 +315,8 @@ export class Snippets {
313
315
  get FocusSparqlWherePatternsFunction() {
314
316
  return this.snippet(snippets_FocusSparqlWherePatternsFunction);
315
317
  }
316
- get FromJsonObjectFunction() {
317
- return this.snippet(snippets_FromJsonObjectFunction);
318
- }
319
- get FromJsonValueFunction() {
320
- return this.snippet(snippets_FromJsonValueFunction);
318
+ get FromJsonFunction() {
319
+ return this.snippet(snippets_FromJsonFunction);
321
320
  }
322
321
  get FromRdfResourceFunction() {
323
322
  return this.snippet(snippets_FromRdfResourceFunction);
@@ -361,6 +360,9 @@ export class Snippets {
361
360
  get LazyOption() {
362
361
  return this.snippet(snippets_LazyOption);
363
362
  }
363
+ get LazySchema() {
364
+ return this.snippet(snippets_LazySchema);
365
+ }
364
366
  get LazySet() {
365
367
  return this.snippet(snippets_LazySet);
366
368
  }
@@ -433,11 +435,8 @@ export class Snippets {
433
435
  get TermSchema() {
434
436
  return this.snippet(snippets_TermSchema);
435
437
  }
436
- get ToJsonObjectFunction() {
437
- return this.snippet(snippets_ToJsonObjectFunction);
438
- }
439
- get ToJsonValueFunction() {
440
- return this.snippet(snippets_ToJsonValueFunction);
438
+ get ToJsonFunction() {
439
+ return this.snippet(snippets_ToJsonFunction);
441
440
  }
442
441
  get ToLoggableFunction() {
443
442
  return this.snippet(snippets_ToLoggableFunction);
@@ -583,18 +582,18 @@ export class Snippets {
583
582
  get convertToIdentifierProperty() {
584
583
  return this.snippet(snippets_convertToIdentifierProperty);
585
584
  }
586
- get convertToInIri() {
587
- return this.snippet(snippets_convertToInIri);
588
- }
589
- get convertToInIriIdentifierProperty() {
590
- return this.snippet(snippets_convertToInIriIdentifierProperty);
591
- }
592
585
  get convertToIri() {
593
586
  return this.snippet(snippets_convertToIri);
594
587
  }
595
588
  get convertToIriIdentifierProperty() {
596
589
  return this.snippet(snippets_convertToIriIdentifierProperty);
597
590
  }
591
+ get convertToIriLiteral() {
592
+ return this.snippet(snippets_convertToIriLiteral);
593
+ }
594
+ get convertToIriLiteralIdentifierProperty() {
595
+ return this.snippet(snippets_convertToIriLiteralIdentifierProperty);
596
+ }
598
597
  get convertToLangString() {
599
598
  return this.snippet(snippets_convertToLangString);
600
599
  }
@@ -796,6 +795,15 @@ export class Snippets {
796
795
  get iriFromRdfResourceValues() {
797
796
  return this.snippet(snippets_iriFromRdfResourceValues);
798
797
  }
798
+ get iriFromString() {
799
+ return this.snippet(snippets_iriFromString);
800
+ }
801
+ get iriLiteralFromJsonObject() {
802
+ return this.snippet(snippets_iriLiteralFromJsonObject);
803
+ }
804
+ get iriLiteralFromJsonString() {
805
+ return this.snippet(snippets_iriLiteralFromJsonString);
806
+ }
799
807
  get iriSparqlWherePatterns() {
800
808
  return this.snippet(snippets_iriSparqlWherePatterns);
801
809
  }
@@ -1119,10 +1127,7 @@ __decorate([
1119
1127
  ], Snippets.prototype, "FocusSparqlWherePatternsFunction", null);
1120
1128
  __decorate([
1121
1129
  Memoize()
1122
- ], Snippets.prototype, "FromJsonObjectFunction", null);
1123
- __decorate([
1124
- Memoize()
1125
- ], Snippets.prototype, "FromJsonValueFunction", null);
1130
+ ], Snippets.prototype, "FromJsonFunction", null);
1126
1131
  __decorate([
1127
1132
  Memoize()
1128
1133
  ], Snippets.prototype, "FromRdfResourceFunction", null);
@@ -1165,6 +1170,9 @@ __decorate([
1165
1170
  __decorate([
1166
1171
  Memoize()
1167
1172
  ], Snippets.prototype, "LazyOption", null);
1173
+ __decorate([
1174
+ Memoize()
1175
+ ], Snippets.prototype, "LazySchema", null);
1168
1176
  __decorate([
1169
1177
  Memoize()
1170
1178
  ], Snippets.prototype, "LazySet", null);
@@ -1239,10 +1247,7 @@ __decorate([
1239
1247
  ], Snippets.prototype, "TermSchema", null);
1240
1248
  __decorate([
1241
1249
  Memoize()
1242
- ], Snippets.prototype, "ToJsonObjectFunction", null);
1243
- __decorate([
1244
- Memoize()
1245
- ], Snippets.prototype, "ToJsonValueFunction", null);
1250
+ ], Snippets.prototype, "ToJsonFunction", null);
1246
1251
  __decorate([
1247
1252
  Memoize()
1248
1253
  ], Snippets.prototype, "ToLoggableFunction", null);
@@ -1389,16 +1394,16 @@ __decorate([
1389
1394
  ], Snippets.prototype, "convertToIdentifierProperty", null);
1390
1395
  __decorate([
1391
1396
  Memoize()
1392
- ], Snippets.prototype, "convertToInIri", null);
1397
+ ], Snippets.prototype, "convertToIri", null);
1393
1398
  __decorate([
1394
1399
  Memoize()
1395
- ], Snippets.prototype, "convertToInIriIdentifierProperty", null);
1400
+ ], Snippets.prototype, "convertToIriIdentifierProperty", null);
1396
1401
  __decorate([
1397
1402
  Memoize()
1398
- ], Snippets.prototype, "convertToIri", null);
1403
+ ], Snippets.prototype, "convertToIriLiteral", null);
1399
1404
  __decorate([
1400
1405
  Memoize()
1401
- ], Snippets.prototype, "convertToIriIdentifierProperty", null);
1406
+ ], Snippets.prototype, "convertToIriLiteralIdentifierProperty", null);
1402
1407
  __decorate([
1403
1408
  Memoize()
1404
1409
  ], Snippets.prototype, "convertToLangString", null);
@@ -1600,6 +1605,15 @@ __decorate([
1600
1605
  __decorate([
1601
1606
  Memoize()
1602
1607
  ], Snippets.prototype, "iriFromRdfResourceValues", null);
1608
+ __decorate([
1609
+ Memoize()
1610
+ ], Snippets.prototype, "iriFromString", null);
1611
+ __decorate([
1612
+ Memoize()
1613
+ ], Snippets.prototype, "iriLiteralFromJsonObject", null);
1614
+ __decorate([
1615
+ Memoize()
1616
+ ], Snippets.prototype, "iriLiteralFromJsonString", null);
1603
1617
  __decorate([
1604
1618
  Memoize()
1605
1619
  ], Snippets.prototype, "iriSparqlWherePatterns", null);
@@ -1,31 +1,31 @@
1
1
  import type { Literal } from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
4
+ import { BuiltinCallable } from "./BuiltinCallable.js";
4
5
  import type { Callable } from "./Callable.js";
5
- import { ReferenceCallable } from "./ReferenceCallable.js";
6
+ import { SchemaObject } from "./SchemaObject.js";
6
7
  import { type Code } from "./ts-poet-wrapper.js";
7
8
  export declare class StringType extends AbstractPrimitiveType<string> {
8
9
  private readonly languageIn;
9
10
  protected readonly decodedIn: string[];
10
11
  readonly conversionFunction: Maybe<AbstractPrimitiveType.ConversionFunction>;
11
- readonly filterFunction: ReferenceCallable;
12
+ readonly filterFunction: BuiltinCallable;
12
13
  readonly filterType: Code;
13
14
  readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
14
- readonly hashFunction: ReferenceCallable;
15
+ readonly hashFunction: BuiltinCallable;
15
16
  readonly jsTypes: readonly [{
16
17
  readonly typeof: "string";
17
18
  }];
18
19
  readonly jsonValueType: AbstractPrimitiveType.JsonType;
19
20
  readonly kind = "String";
20
- readonly valueSparqlWherePatternsFunction: ReferenceCallable;
21
+ readonly valueSparqlWherePatternsFunction: BuiltinCallable;
21
22
  constructor({ languageIn, ...superParameters }: {
22
23
  languageIn: readonly string[];
23
24
  } & ConstructorParameters<typeof AbstractPrimitiveType<string>>[0]);
24
25
  get fromJsonObjectFunction(): Callable;
25
26
  get fromJsonValueFunction(): Callable;
26
27
  get fromRdfResourceValuesFunction(): Callable;
27
- get schemaType(): Code;
28
- protected get schemaInitializers(): readonly Code[];
28
+ get schema(): SchemaObject<SchemaObject.BuiltinType>;
29
29
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
30
30
  valueExpression(literal: Literal | string): Code;
31
31
  }
@@ -9,16 +9,17 @@ import { xsd } from "@tpluscode/rdf-ns-builders";
9
9
  import { Maybe } from "purify-ts";
10
10
  import { Memoize } from "typescript-memoize";
11
11
  import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
12
- import { ReferenceCallable } from "./ReferenceCallable.js";
12
+ import { BuiltinCallable } from "./BuiltinCallable.js";
13
+ import { SchemaObject } from "./SchemaObject.js";
13
14
  import { arrayOf, code, literalOf } from "./ts-poet-wrapper.js";
14
15
  export class StringType extends AbstractPrimitiveType {
15
16
  languageIn;
16
17
  decodedIn = this.in_.map((in_) => LiteralDecoder.decodeStringLiteral(in_).unsafeCoerce());
17
18
  conversionFunction = Maybe.empty();
18
- filterFunction = new ReferenceCallable(this.reusables.snippets.filterString);
19
+ filterFunction = new BuiltinCallable(this.reusables.snippets.filterString);
19
20
  filterType = code `${this.reusables.snippets.StringFilter}`;
20
21
  graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
21
- hashFunction = new ReferenceCallable(this.reusables.snippets.hashString);
22
+ hashFunction = new BuiltinCallable(this.reusables.snippets.hashString);
22
23
  jsTypes = [
23
24
  {
24
25
  typeof: "string",
@@ -31,29 +32,31 @@ export class StringType extends AbstractPrimitiveType {
31
32
  : undefined,
32
33
  });
33
34
  kind = "String";
34
- valueSparqlWherePatternsFunction = new ReferenceCallable(this.reusables.snippets.stringSparqlWherePatterns);
35
+ valueSparqlWherePatternsFunction = new BuiltinCallable(this.reusables.snippets.stringSparqlWherePatterns);
35
36
  constructor({ languageIn, ...superParameters }) {
36
37
  super(superParameters);
37
38
  this.languageIn = languageIn;
38
39
  }
39
40
  get fromJsonObjectFunction() {
40
- return new ReferenceCallable(code `${this.reusables.snippets.stringFromJsonObject}<${this.expression}>`);
41
+ return new BuiltinCallable(code `${this.reusables.snippets.stringFromJsonObject}<${this.expression}>`);
41
42
  }
42
43
  get fromJsonValueFunction() {
43
- return new ReferenceCallable(code `${this.reusables.snippets.stringFromJsonString}<${this.expression}>`);
44
+ return new BuiltinCallable(code `${this.reusables.snippets.stringFromJsonString}<${this.expression}>`);
44
45
  }
45
46
  get fromRdfResourceValuesFunction() {
46
- return new ReferenceCallable(code `${this.reusables.snippets.stringFromRdfResourceValues}<${this.expression}>`);
47
+ return new BuiltinCallable(code `${this.reusables.snippets.stringFromRdfResourceValues}<${this.expression}>`);
47
48
  }
48
- get schemaType() {
49
- return code `${this.reusables.snippets.StringSchema}<${this.expression}>`;
50
- }
51
- get schemaInitializers() {
52
- let initializers = super.schemaInitializers;
53
- if (this.languageIn.length > 0) {
54
- initializers = initializers.concat(code `languageIn: ${arrayOf(...this.languageIn)}`);
55
- }
56
- return initializers;
49
+ get schema() {
50
+ return new SchemaObject({
51
+ properties: this.languageIn.length > 0
52
+ ? {
53
+ ...super.schema.properties,
54
+ languageIn: code `languageIn: ${arrayOf(...this.languageIn)}`,
55
+ }
56
+ : super.schema.properties,
57
+ type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.StringSchema}<${this.expression}>`),
58
+ variable: super.schema.variable,
59
+ });
57
60
  }
58
61
  toRdfResourceValuesExpression({ variables, }) {
59
62
  return code `[${this.reusables.snippets.literalFactory}.string(${variables.value}${!this.datatype.equals(xsd.string) ? `, ${this.rdfjsTermExpression(this.datatype)}` : ""})]`;
@@ -73,5 +76,5 @@ __decorate([
73
76
  ], StringType.prototype, "fromRdfResourceValuesFunction", null);
74
77
  __decorate([
75
78
  Memoize()
76
- ], StringType.prototype, "schemaType", null);
79
+ ], StringType.prototype, "schema", null);
77
80
  //# sourceMappingURL=StringType.js.map
@@ -2,21 +2,22 @@ import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
2
2
  import { NodeKind } from "@shaclmate/shacl-ast";
3
3
  import { Maybe } from "purify-ts";
4
4
  import { AbstractTermType } from "./AbstractTermType.js";
5
+ import { BuiltinCallable } from "./BuiltinCallable.js";
5
6
  import type { Callable } from "./Callable.js";
6
- import { ReferenceCallable } from "./ReferenceCallable.js";
7
+ import { SchemaObject } from "./SchemaObject.js";
7
8
  import { type Code } from "./ts-poet-wrapper.js";
8
9
  export declare class TermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractTermType {
9
10
  readonly conversionFunction: Maybe<AbstractTermType.ConversionFunction>;
10
- readonly filterFunction: ReferenceCallable;
11
+ readonly filterFunction: BuiltinCallable;
11
12
  readonly jsTypes: readonly [{
12
13
  readonly instanceof: "Object";
13
14
  readonly typeof: "object";
14
15
  }];
15
16
  readonly kind = "Term";
16
17
  readonly nodeKinds: ReadonlySet<NodeKind>;
17
- readonly toJsonObjectFunction: ReferenceCallable;
18
- readonly toJsonValueFunction: ReferenceCallable;
19
- readonly valueSparqlWherePatternsFunction: ReferenceCallable;
18
+ readonly toJsonObjectFunction: BuiltinCallable;
19
+ readonly toJsonValueFunction: BuiltinCallable;
20
+ readonly valueSparqlWherePatternsFunction: BuiltinCallable;
20
21
  constructor({ nodeKinds, ...superParameters }: ConstructorParameters<typeof AbstractTermType<ConstantTermT, RuntimeTermT>>[0] & {
21
22
  nodeKinds: ReadonlySet<NodeKind>;
22
23
  });
@@ -28,9 +29,8 @@ export declare class TermType<ConstantTermT extends Literal | NamedNode = Litera
28
29
  get graphqlType(): AbstractTermType.GraphqlType;
29
30
  get jsonObjectType(): AbstractTermType["jsonObjectType"];
30
31
  get jsonValueType(): AbstractTermType["jsonValueType"];
31
- get schemaType(): Code;
32
32
  protected get inlineExpression(): Code;
33
- protected get schemaInitializers(): Code[];
33
+ get schema(): SchemaObject<SchemaObject.BuiltinType>;
34
34
  graphqlResolveExpression(_parameters: Parameters<AbstractTermType["graphqlResolveExpression"]>[0]): Code;
35
35
  toLoggableExpression({ variables, }: Parameters<AbstractTermType["toLoggableExpression"]>[0]): Code;
36
36
  }
@@ -9,19 +9,20 @@ import { Maybe } from "purify-ts";
9
9
  import { invariant } from "ts-invariant";
10
10
  import { Memoize } from "typescript-memoize";
11
11
  import { AbstractTermType } from "./AbstractTermType.js";
12
- import { ReferenceCallable } from "./ReferenceCallable.js";
12
+ import { BuiltinCallable } from "./BuiltinCallable.js";
13
+ import { SchemaObject } from "./SchemaObject.js";
13
14
  import { arrayOf, code, joinCode } from "./ts-poet-wrapper.js";
14
15
  export class TermType extends AbstractTermType {
15
16
  conversionFunction = Maybe.empty();
16
- filterFunction = new ReferenceCallable(this.reusables.snippets.filterTerm);
17
+ filterFunction = new BuiltinCallable(this.reusables.snippets.filterTerm);
17
18
  jsTypes = [
18
19
  { instanceof: "Object", typeof: "object" },
19
20
  ];
20
21
  kind = "Term";
21
22
  nodeKinds;
22
- toJsonObjectFunction = new ReferenceCallable(this.reusables.snippets.termToJsonObject);
23
+ toJsonObjectFunction = new BuiltinCallable(this.reusables.snippets.termToJsonObject);
23
24
  toJsonValueFunction = this.toJsonObjectFunction;
24
- valueSparqlWherePatternsFunction = new ReferenceCallable(this.reusables.snippets.termSparqlWherePatterns);
25
+ valueSparqlWherePatternsFunction = new BuiltinCallable(this.reusables.snippets.termSparqlWherePatterns);
25
26
  constructor({ nodeKinds, ...superParameters }) {
26
27
  super(superParameters);
27
28
  this.nodeKinds = nodeKinds;
@@ -42,13 +43,13 @@ export class TermType extends AbstractTermType {
42
43
  return code `${this.reusables.snippets.TermFilter}<${this.expression}>`;
43
44
  }
44
45
  get fromJsonObjectFunction() {
45
- return new ReferenceCallable(code `${this.reusables.snippets.termFromJsonObject}<${this.expression}>`);
46
+ return new BuiltinCallable(code `${this.reusables.snippets.termFromJsonObject}<${this.expression}>`);
46
47
  }
47
48
  get fromJsonValueFunction() {
48
49
  return this.fromJsonObjectFunction;
49
50
  }
50
51
  get fromRdfResourceValuesFunction() {
51
- return new ReferenceCallable(code `${this.reusables.snippets.termFromRdfResourceValues}<${this.expression}>`);
52
+ return new BuiltinCallable(code `${this.reusables.snippets.termFromRdfResourceValues}<${this.expression}>`);
52
53
  }
53
54
  get graphqlType() {
54
55
  throw new Error("not implemented");
@@ -79,9 +80,6 @@ export class TermType extends AbstractTermType {
79
80
  get jsonValueType() {
80
81
  return this.jsonObjectType;
81
82
  }
82
- get schemaType() {
83
- return code `${this.reusables.snippets.TermSchema}<${this.expression}>`;
84
- }
85
83
  get inlineExpression() {
86
84
  return code `(${joinCode([...this.nodeKinds]
87
85
  .map((nodeKind) => {
@@ -99,8 +97,15 @@ export class TermType extends AbstractTermType {
99
97
  })
100
98
  .map((import_) => code `${import_}`), { on: " | " })})`;
101
99
  }
102
- get schemaInitializers() {
103
- return super.schemaInitializers.concat(code `types: ${arrayOf(...[...this.nodeKinds].map(NodeKind.toTermType))}`);
100
+ get schema() {
101
+ return new SchemaObject({
102
+ properties: {
103
+ ...super.schema.properties,
104
+ types: code `types: ${arrayOf(...[...this.nodeKinds].map(NodeKind.toTermType))}`,
105
+ },
106
+ type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.TermSchema}<${this.expression}>`),
107
+ variable: super.schema.variable,
108
+ });
104
109
  }
105
110
  graphqlResolveExpression(_parameters) {
106
111
  throw new Error("not implemented");
@@ -126,8 +131,8 @@ __decorate([
126
131
  ], TermType.prototype, "jsonObjectType", null);
127
132
  __decorate([
128
133
  Memoize()
129
- ], TermType.prototype, "schemaType", null);
134
+ ], TermType.prototype, "inlineExpression", null);
130
135
  __decorate([
131
136
  Memoize()
132
- ], TermType.prototype, "inlineExpression", null);
137
+ ], TermType.prototype, "schema", null);
133
138
  //# sourceMappingURL=TermType.js.map