@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
@@ -7,10 +7,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Maybe } from "purify-ts";
8
8
  import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
- import { AbstractType } from "./AbstractType.js";
10
+ import { AbstractBuiltinType } from "./AbstractBuiltinType.js";
11
11
  import { InlineCallable } from "./InlineCallable.js";
12
+ import { SchemaObject } from "./SchemaObject.js";
12
13
  import { code, joinCode } from "./ts-poet-wrapper.js";
13
- export class AbstractLazyType extends AbstractType {
14
+ export class AbstractLazyType extends AbstractBuiltinType {
14
15
  discriminatedType = Maybe.empty();
15
16
  mutable = false;
16
17
  partialType;
@@ -37,13 +38,13 @@ export class AbstractLazyType extends AbstractType {
37
38
  get fromJsonObjectFunction() {
38
39
  return new InlineCallable(code `(jsonObject, fromJsonObjectOptions) => ${this.partialType.fromJsonObjectFunction.annotatedUsage}(jsonObject, { ...fromJsonObjectOptions, schema: fromJsonObjectOptions.schema.partialType })
39
40
  .map(${this.runtimeClass.partialPropertyName} => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}, resolver: ${this.resolverFunctionExpression({ variables: { factoryFunctionOptions: code `fromJsonObjectOptions` } })} }))`, {
40
- type: code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.expression}, ${this.schema}>`,
41
+ type: code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.expression}, ${this.schema.expression}>`,
41
42
  });
42
43
  }
43
44
  get fromJsonValueFunction() {
44
45
  return new InlineCallable(code `(jsonValue, fromJsonValueOptions) => ${this.partialType.fromJsonValueFunction.annotatedUsage}(jsonValue, { ...fromJsonValueOptions, schema: fromJsonValueOptions.schema.partialType })
45
46
  .map(${this.runtimeClass.partialPropertyName} => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}, resolver: ${this.resolverFunctionExpression({ variables: { factoryFunctionOptions: code `fromJsonValueOptions` } })} }))`, {
46
- type: code `${this.reusables.snippets.FromJsonValueFunction}<${this.jsonValueType.expression}, ${this.expression}, ${this.schema}>`,
47
+ type: code `${this.reusables.snippets.FromJsonFunction}<${this.jsonValueType.expression}, ${this.expression}, ${this.schema.expression}>`,
47
48
  });
48
49
  }
49
50
  get fromRdfResourceValuesFunction() {
@@ -51,7 +52,7 @@ export class AbstractLazyType extends AbstractType {
51
52
  (values, fromRdfResourceValuesOptions) =>
52
53
  ${this.partialType.fromRdfResourceValuesFunction.annotatedUsage}(values, { ...fromRdfResourceValuesOptions, schema: fromRdfResourceValuesOptions.schema.partialType })
53
54
  .map(values => values.map(${this.runtimeClass.partialPropertyName} => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}, resolver: ${this.resolverFunctionExpression({ variables: { factoryFunctionOptions: code `fromRdfResourceValuesOptions` } })} })))`, {
54
- type: code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>`,
55
+ type: code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schema.type.expression}>`,
55
56
  });
56
57
  }
57
58
  get graphqlType() {
@@ -84,20 +85,14 @@ export class AbstractLazyType extends AbstractType {
84
85
  get referencesNamedType() {
85
86
  return this.partialType.referencesNamedType;
86
87
  }
87
- get schemaType() {
88
- return code `${{
89
- kind: this.kind,
90
- partialType: this.partialType.schemaType,
91
- }}`;
92
- }
93
88
  get toJsonObjectFunction() {
94
89
  return new InlineCallable(code `(value) => ${this.partialType.toJsonObjectFunction.unannotatedUsage}(value.${this.runtimeClass.partialPropertyName})`, {
95
- type: code `${this.reusables.snippets.ToJsonObjectFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
90
+ type: code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
96
91
  });
97
92
  }
98
93
  get toJsonValueFunction() {
99
94
  return new InlineCallable(code `(value) => ${this.partialType.toJsonValueFunction.unannotatedUsage}(value.${this.runtimeClass.partialPropertyName})`, {
100
- type: code `${this.reusables.snippets.ToJsonValueFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
95
+ type: code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
101
96
  });
102
97
  }
103
98
  get toRdfResourceValueTypes() {
@@ -105,16 +100,23 @@ export class AbstractLazyType extends AbstractType {
105
100
  }
106
101
  get valueSparqlConstructTriplesFunction() {
107
102
  return new InlineCallable(code `(({ schema, ...otherParameters }) => ${this.partialType.valueSparqlConstructTriplesFunction.annotatedUsage}({ ...otherParameters, schema: schema.partialType }))`, {
108
- type: code `${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>`,
103
+ type: code `${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schema.type.expression}>`,
109
104
  });
110
105
  }
111
106
  get valueSparqlWherePatternsFunction() {
112
107
  return new InlineCallable(code `(({ schema, ...otherParameters }) => ${this.partialType.valueSparqlWherePatternsFunction.annotatedUsage}({ ...otherParameters, schema: schema.partialType }))`, {
113
- type: code `${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>`,
108
+ type: code `${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schema.type.expression}>`,
114
109
  });
115
110
  }
116
- get schemaInitializers() {
117
- return super.schemaInitializers.concat(code `get partialType() { return ${this.partialType.schema}; }`);
111
+ get schema() {
112
+ return new SchemaObject({
113
+ properties: {
114
+ ...super.schema.properties,
115
+ partialType: code `get partialType() { return ${this.partialType.schema.expression}; }`,
116
+ },
117
+ type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.LazySchema}<${this.partialType.schema.type.expression}>`),
118
+ variable: super.schema.variable,
119
+ });
118
120
  }
119
121
  toLoggableExpression({ variables, }) {
120
122
  return this.partialType.toLoggableExpression({
@@ -189,16 +191,16 @@ __decorate([
189
191
  __decorate([
190
192
  Memoize()
191
193
  ], AbstractLazyType.prototype, "jsTypes", null);
192
- __decorate([
193
- Memoize()
194
- ], AbstractLazyType.prototype, "schemaType", null);
195
194
  __decorate([
196
195
  Memoize()
197
196
  ], AbstractLazyType.prototype, "valueSparqlConstructTriplesFunction", null);
198
197
  __decorate([
199
198
  Memoize()
200
199
  ], AbstractLazyType.prototype, "valueSparqlWherePatternsFunction", null);
200
+ __decorate([
201
+ Memoize()
202
+ ], AbstractLazyType.prototype, "schema", null);
201
203
  (function (AbstractLazyType) {
202
- AbstractLazyType.GraphqlType = AbstractType.GraphqlType;
204
+ AbstractLazyType.GraphqlType = AbstractBuiltinType.GraphqlType;
203
205
  })(AbstractLazyType || (AbstractLazyType = {}));
204
206
  //# sourceMappingURL=AbstractLazyType.js.map
@@ -1,16 +1,17 @@
1
1
  import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
2
+ import { BuiltinCallable } from "./BuiltinCallable.js";
2
3
  import type { Callable } from "./Callable.js";
3
- import { ReferenceCallable } from "./ReferenceCallable.js";
4
+ import { SchemaObject } from "./SchemaObject.js";
4
5
  import { type Code } from "./ts-poet-wrapper.js";
5
6
  /**
6
7
  * Abstract base class for TypeScript numeric types (bigint | number).
7
8
  */
8
9
  export declare abstract class AbstractNumericType<ValueT extends bigint | number> extends AbstractPrimitiveType<ValueT> {
9
- readonly hashFunction: ReferenceCallable;
10
+ readonly hashFunction: BuiltinCallable;
10
11
  abstract readonly kind: "BigInt" | "Float" | "Int";
11
12
  get filterFunction(): Callable;
12
13
  get filterType(): Code;
13
- get schemaType(): Code;
14
+ get schema(): SchemaObject<SchemaObject.BuiltinType>;
14
15
  get valueSparqlWherePatternsFunction(): Callable;
15
16
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
16
17
  }
@@ -6,24 +6,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Memoize } from "typescript-memoize";
8
8
  import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
9
- import { ReferenceCallable } from "./ReferenceCallable.js";
9
+ import { BuiltinCallable } from "./BuiltinCallable.js";
10
+ import { SchemaObject } from "./SchemaObject.js";
10
11
  import { code } from "./ts-poet-wrapper.js";
11
12
  /**
12
13
  * Abstract base class for TypeScript numeric types (bigint | number).
13
14
  */
14
15
  export class AbstractNumericType extends AbstractPrimitiveType {
15
- hashFunction = new ReferenceCallable(this.reusables.snippets.hashNumeric);
16
+ hashFunction = new BuiltinCallable(this.reusables.snippets.hashNumeric);
16
17
  get filterFunction() {
17
- return new ReferenceCallable(code `${this.reusables.snippets.filterNumeric}<${this.expression}>`);
18
+ return new BuiltinCallable(code `${this.reusables.snippets.filterNumeric}<${this.expression}>`);
18
19
  }
19
20
  get filterType() {
20
21
  return code `${this.reusables.snippets.NumericFilter}<${this.expression}>`;
21
22
  }
22
- get schemaType() {
23
- return code `${this.reusables.snippets.NumericSchema}<${this.expression}>`;
23
+ get schema() {
24
+ return new SchemaObject({
25
+ properties: super.schema.properties,
26
+ type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.NumericSchema}<${this.expression}>`),
27
+ variable: super.schema.variable,
28
+ });
24
29
  }
25
30
  get valueSparqlWherePatternsFunction() {
26
- return new ReferenceCallable(code `${this.reusables.snippets.numericSparqlWherePatterns}<${this.expression}>`);
31
+ return new BuiltinCallable(code `${this.reusables.snippets.numericSparqlWherePatterns}<${this.expression}>`);
27
32
  }
28
33
  toRdfResourceValuesExpression({ variables, }) {
29
34
  return code `[${this.reusables.snippets.literalFactory}.${this.jsTypes[0].typeof}(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
@@ -37,7 +42,7 @@ __decorate([
37
42
  ], AbstractNumericType.prototype, "filterType", null);
38
43
  __decorate([
39
44
  Memoize()
40
- ], AbstractNumericType.prototype, "schemaType", null);
45
+ ], AbstractNumericType.prototype, "schema", null);
41
46
  __decorate([
42
47
  Memoize()
43
48
  ], AbstractNumericType.prototype, "valueSparqlWherePatternsFunction", null);
@@ -1,14 +1,14 @@
1
1
  import type { Primitive } from "@rdfx/literal";
2
2
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
3
3
  import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
4
- import { ReferenceCallable } from "./ReferenceCallable.js";
4
+ import { BuiltinCallable } from "./BuiltinCallable.js";
5
5
  import { type Code } from "./ts-poet-wrapper.js";
6
6
  /**
7
7
  * Abstract base class of typed literals whose datatype corresponds to a JavaScript primitive type.
8
8
  */
9
9
  export declare abstract class AbstractPrimitiveType<ValueT extends Primitive> extends AbstractTypedLiteralType<ValueT> {
10
10
  protected abstract readonly decodedIn: readonly ValueT[];
11
- readonly equalsFunction: ReferenceCallable;
11
+ readonly equalsFunction: BuiltinCallable;
12
12
  get toJsonObjectFunction(): AbstractTypedLiteralType<ValueT>["toJsonObjectFunction"];
13
13
  get toJsonValueFunction(): AbstractTypedLiteralType<ValueT>["toJsonValueFunction"];
14
14
  protected get inlineExpression(): Code;
@@ -7,18 +7,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Memoize } from "typescript-memoize";
8
8
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
9
9
  import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
10
- import { ReferenceCallable } from "./ReferenceCallable.js";
10
+ import { BuiltinCallable } from "./BuiltinCallable.js";
11
11
  import { code, joinCode } from "./ts-poet-wrapper.js";
12
12
  /**
13
13
  * Abstract base class of typed literals whose datatype corresponds to a JavaScript primitive type.
14
14
  */
15
15
  export class AbstractPrimitiveType extends AbstractTypedLiteralType {
16
- equalsFunction = new ReferenceCallable(this.reusables.snippets.strictEquals);
16
+ equalsFunction = new BuiltinCallable(this.reusables.snippets.strictEquals);
17
17
  get toJsonObjectFunction() {
18
- return new ReferenceCallable(code `${this.reusables.snippets.primitiveToJsonObject}<${this.expression}>(${this.rdfjsTermExpression(this.datatype)})`);
18
+ return new BuiltinCallable(code `${this.reusables.snippets.primitiveToJsonObject}<${this.expression}>(${this.rdfjsTermExpression(this.datatype)})`);
19
19
  }
20
20
  get toJsonValueFunction() {
21
- return new ReferenceCallable(code `${this.reusables.snippets.primitiveToJsonValue}<${this.expression}>`);
21
+ return new BuiltinCallable(code `${this.reusables.snippets.primitiveToJsonValue}<${this.expression}>`);
22
22
  }
23
23
  get inlineExpression() {
24
24
  if (this.in_.length > 0) {
@@ -1,8 +1,9 @@
1
1
  import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
2
2
  import { NodeKind } from "@shaclmate/shacl-ast";
3
- import { AbstractType } from "./AbstractType.js";
3
+ import { AbstractBuiltinType } from "./AbstractBuiltinType.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
  /**
8
9
  * Abstract base class for all types that are terms in RDF (i.e., identifiers, literals).
@@ -12,27 +13,27 @@ import { type Code } from "./ts-poet-wrapper.js";
12
13
  *
13
14
  * The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
14
15
  */
15
- export declare abstract class AbstractTermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, _RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractType {
16
- readonly equalsFunction: ReferenceCallable;
17
- readonly graphqlArgs: AbstractType["graphqlArgs"];
16
+ export declare abstract class AbstractTermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, _RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractBuiltinType {
17
+ readonly equalsFunction: BuiltinCallable;
18
+ readonly graphqlArgs: AbstractBuiltinType["graphqlArgs"];
18
19
  readonly hasValues: readonly ConstantTermT[];
19
- readonly hashFunction: ReferenceCallable;
20
+ readonly hashFunction: BuiltinCallable;
20
21
  readonly in_: readonly ConstantTermT[];
21
22
  readonly mutable: boolean;
22
23
  abstract readonly nodeKinds: ReadonlySet<NodeKind>;
23
24
  readonly recursive = false;
24
- readonly validationFunction: AbstractType["validationFunction"];
25
+ readonly validationFunction: AbstractBuiltinType["validationFunction"];
25
26
  constructor({ hasValues, in_, ...superParameters }: {
26
27
  hasValues: readonly ConstantTermT[];
27
28
  in_: readonly ConstantTermT[];
28
- } & ConstructorParameters<typeof AbstractType>[0]);
29
+ } & ConstructorParameters<typeof AbstractBuiltinType>[0]);
29
30
  get referencesNamedType(): boolean;
30
31
  get termTypes(): ReadonlySet<"BlankNode" | "Literal" | "NamedNode">;
31
32
  get toRdfResourceValueTypes(): ReadonlySet<"BlankNode" | "Literal" | "NamedNode">;
32
33
  get valueSparqlConstructTriplesFunction(): Callable;
33
- protected get schemaInitializers(): readonly Code[];
34
- toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
35
- toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
34
+ get schema(): SchemaObject<SchemaObject.AbstractType | SchemaObject.BuiltinType>;
35
+ toRdfResourceValuesExpression({ variables, }: Parameters<AbstractBuiltinType["toRdfResourceValuesExpression"]>[0]): Code;
36
+ toStringExpression({ variables, }: Parameters<AbstractBuiltinType["toStringExpression"]>[0]): Code;
36
37
  /**
37
38
  * An expression that converts a compile-time RDF/JS term into a runtime TypeScript value.
38
39
  *
@@ -41,11 +42,11 @@ export declare abstract class AbstractTermType<ConstantTermT extends Literal | N
41
42
  valueExpression(term: ConstantTermT): Code;
42
43
  }
43
44
  export declare namespace AbstractTermType {
44
- type ConversionFunction = AbstractType.ConversionFunction;
45
- type DiscriminatedType = AbstractType.DiscriminatedType;
45
+ type ConversionFunction = AbstractBuiltinType.ConversionFunction;
46
+ type DiscriminatedType = AbstractBuiltinType.DiscriminatedType;
46
47
  const GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
47
- type GraphqlType = AbstractType.GraphqlType;
48
- type JsType = AbstractType.JsType;
49
- type JsonType = AbstractType.JsonType;
48
+ type GraphqlType = AbstractBuiltinType.GraphqlType;
49
+ type JsType = AbstractBuiltinType.JsType;
50
+ type JsonType = AbstractBuiltinType.JsonType;
50
51
  }
51
52
  //# sourceMappingURL=AbstractTermType.d.ts.map
@@ -7,9 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { NodeKind } from "@shaclmate/shacl-ast";
8
8
  import { Maybe } from "purify-ts";
9
9
  import { Memoize } from "typescript-memoize";
10
- import { AbstractType } from "./AbstractType.js";
10
+ import { AbstractBuiltinType } from "./AbstractBuiltinType.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 { arrayOf, code } from "./ts-poet-wrapper.js";
14
15
  /**
15
16
  * Abstract base class for all types that are terms in RDF (i.e., identifiers, literals).
@@ -19,11 +20,11 @@ import { arrayOf, code } from "./ts-poet-wrapper.js";
19
20
  *
20
21
  * The two are differentiated because identifiers can have BlankNode or NamedNode values at runtime but only NamedNode values for sh:hasValue and sh:in.
21
22
  */
22
- export class AbstractTermType extends AbstractType {
23
- equalsFunction = new ReferenceCallable(this.reusables.snippets.booleanEquals);
23
+ export class AbstractTermType extends AbstractBuiltinType {
24
+ equalsFunction = new BuiltinCallable(this.reusables.snippets.booleanEquals);
24
25
  graphqlArgs = Maybe.empty();
25
26
  hasValues;
26
- hashFunction = new ReferenceCallable(this.reusables.snippets.hashTerm);
27
+ hashFunction = new BuiltinCallable(this.reusables.snippets.hashTerm);
27
28
  in_;
28
29
  mutable = false;
29
30
  recursive = false;
@@ -45,15 +46,21 @@ export class AbstractTermType extends AbstractType {
45
46
  get valueSparqlConstructTriplesFunction() {
46
47
  return new InlineCallable(code `((_: object) => [])`);
47
48
  }
48
- get schemaInitializers() {
49
- let initializers = super.schemaInitializers;
49
+ get schema() {
50
+ const thisProperties = {};
50
51
  if (this.hasValues.length > 0) {
51
- initializers = initializers.concat(code `hasValues: ${arrayOf(...this.hasValues.map((hasValue) => this.rdfjsTermExpression(hasValue)))}`);
52
+ thisProperties["hasValues"] =
53
+ code `hasValues: ${arrayOf(...this.hasValues.map((hasValue) => this.rdfjsTermExpression(hasValue)))}`;
52
54
  }
53
55
  if (this.in_.length > 0) {
54
- initializers = initializers.concat(code `in: ${arrayOf(...this.in_.map((in_) => this.valueExpression(in_)))} as const`);
56
+ thisProperties["in"] =
57
+ code `in: ${arrayOf(...this.in_.map((in_) => this.valueExpression(in_)))} as const`;
55
58
  }
56
- return initializers;
59
+ return new SchemaObject({
60
+ properties: { ...super.schema.properties, ...thisProperties },
61
+ type: new SchemaObject.AbstractType("AbstractTermType"),
62
+ variable: super.schema.variable,
63
+ });
57
64
  }
58
65
  toRdfResourceValuesExpression({ variables, }) {
59
66
  return code `[${variables.value}]`;
@@ -79,7 +86,10 @@ __decorate([
79
86
  __decorate([
80
87
  Memoize()
81
88
  ], AbstractTermType.prototype, "valueSparqlConstructTriplesFunction", null);
89
+ __decorate([
90
+ Memoize()
91
+ ], AbstractTermType.prototype, "schema", null);
82
92
  (function (AbstractTermType) {
83
- AbstractTermType.GraphqlType = AbstractType.GraphqlType;
93
+ AbstractTermType.GraphqlType = AbstractBuiltinType.GraphqlType;
84
94
  })(AbstractTermType || (AbstractTermType = {}));
85
95
  //# sourceMappingURL=AbstractTermType.js.map
@@ -7,6 +7,7 @@ import type { AbstractType_JsonType, AbstractType_JsonTypeFactory } from "./_Abs
7
7
  import { AbstractType_JsType } from "./_AbstractType/AbstractType_JsType.js";
8
8
  import { AbstractConstruct } from "./AbstractConstruct.js";
9
9
  import type { Callable } from "./Callable.js";
10
+ import { SchemaObject } from "./SchemaObject.js";
10
11
  import { type Code } from "./ts-poet-wrapper.js";
11
12
  /**
12
13
  * Abstract base class all types.
@@ -126,9 +127,9 @@ export declare abstract class AbstractType extends AbstractConstruct {
126
127
  */
127
128
  abstract readonly referencesNamedType: boolean;
128
129
  /**
129
- * TypeScript type describing .schema.
130
+ * TypeScript object describing this type, for runtime use.
130
131
  */
131
- abstract readonly schemaType: Code;
132
+ get schema(): SchemaObject<SchemaObject.Type>;
132
133
  /**
133
134
  * Identifier of the shape this type was derived from.
134
135
  */
@@ -147,7 +148,7 @@ export declare abstract class AbstractType extends AbstractConstruct {
147
148
  abstract readonly toRdfResourceValueTypes: ReadonlySet<"BlankNode" | "NamedNode" | "Literal">;
148
149
  /**
149
150
  * Function that takes
150
- * - a schema of this.schemaType
151
+ * - a schema of this.schema.type
151
152
  * - a value of this.type
152
153
  *
153
154
  * and validates the value against the schema, returning
@@ -163,7 +164,7 @@ export declare abstract class AbstractType extends AbstractConstruct {
163
164
  * The function takes a parameters object with the following parameters:
164
165
  * - filter: an instance of filterType | undefined
165
166
  * - ignoreRdfType: boolean
166
- * - schema: instance of this.schemaType
167
+ * - schema: instance of this.schema.type
167
168
  * - valueVariable: rdfjs.Variable of the value of this type
168
169
  * - variablePrefix: string prefix to use for new variables
169
170
  */
@@ -175,7 +176,7 @@ export declare abstract class AbstractType extends AbstractConstruct {
175
176
  * - filter: an instance of filterType | undefined
176
177
  * - preferredLanguages: array of preferred language code (strings) | undefined
177
178
  * - propertyPatterns: array of sparqljs.Pattern's for the property; may be empty
178
- * - schema: instance of this.schemaType
179
+ * - schema: instance of this.schema.type
179
180
  * - valueVariable: rdfjs.Variable of the value of this type
180
181
  * - variablePrefix: string prefix to use for new variables
181
182
  */
@@ -193,15 +194,6 @@ export declare abstract class AbstractType extends AbstractConstruct {
193
194
  * Expression of this type. If the type has a name it will be that name (a reference). Otherwise it will be the .inlineExpression.
194
195
  */
195
196
  get expression(): Code;
196
- /**
197
- * TypeScript object describing this type, for runtime use.
198
- */
199
- get schema(): Code;
200
- get schemaVariable(): Maybe<Code>;
201
- /**
202
- * Helper to compose the result of schema along the type hierarchy.
203
- */
204
- protected get schemaInitializers(): readonly Code[];
205
197
  /**
206
198
  * An expression that resolves a value of this type in the GraphQL server.
207
199
  */
@@ -247,7 +239,6 @@ export declare abstract class AbstractType extends AbstractConstruct {
247
239
  value: Code;
248
240
  };
249
241
  }): Code;
250
- protected schemaExpression(): Code;
251
242
  protected staticModuleDeclarations(_name: string): Record<string, Code>;
252
243
  }
253
244
  export declare namespace AbstractType {
@@ -10,6 +10,7 @@ import { AbstractType_ConversionFunction } from "./_AbstractType/AbstractType_Co
10
10
  import { AbstractType_GraphqlType } from "./_AbstractType/AbstractType_GraphqlType.js";
11
11
  import { AbstractType_JsType } from "./_AbstractType/AbstractType_JsType.js";
12
12
  import { AbstractConstruct } from "./AbstractConstruct.js";
13
+ import { SchemaObject } from "./SchemaObject.js";
13
14
  import { code, def, joinCode, literalOf, } from "./ts-poet-wrapper.js";
14
15
  import { tsComment } from "./tsComment.js";
15
16
  /**
@@ -24,6 +25,18 @@ export class AbstractType extends AbstractConstruct {
24
25
  * Name for this type.
25
26
  */
26
27
  name;
28
+ /**
29
+ * TypeScript object describing this type, for runtime use.
30
+ */
31
+ get schema() {
32
+ return new SchemaObject({
33
+ properties: {
34
+ kind: code `kind: ${literalOf(this.kind)}`,
35
+ },
36
+ type: new SchemaObject.AbstractType(this.kind),
37
+ variable: this.name.map((name) => code `${name}.schema`),
38
+ });
39
+ }
27
40
  /**
28
41
  * Identifier of the shape this type was derived from.
29
42
  */
@@ -68,34 +81,11 @@ ${joinCode(staticModuleDeclarations
68
81
  .map((name) => code `${name}`)
69
82
  .orDefaultLazy(() => this.inlineExpression);
70
83
  }
71
- /**
72
- * TypeScript object describing this type, for runtime use.
73
- */
74
- get schema() {
75
- return this.name
76
- .map((name) => code `${name}.schema`)
77
- .orDefaultLazy(() => this.schemaExpression());
78
- }
79
- get schemaVariable() {
80
- if (!this.configuration.features.has("Object.schema")) {
81
- return Maybe.empty();
82
- }
83
- return this.name.map((name) => code `${name}.schema`);
84
- }
85
- /**
86
- * Helper to compose the result of schema along the type hierarchy.
87
- */
88
- get schemaInitializers() {
89
- return [code `kind: ${literalOf(this.kind)} as const`];
90
- }
91
- schemaExpression() {
92
- return code `{ ${joinCode(this.schemaInitializers.concat(), { on: ", " })} }`;
93
- }
94
84
  staticModuleDeclarations(_name) {
95
85
  const staticModuleDeclarations = {};
96
86
  if (this.configuration.features.has("Object.schema")) {
97
87
  staticModuleDeclarations["schema"] =
98
- code `export const schema = ${this.schemaExpression()}`;
88
+ code `export const schema = ${this.schema.literalExpression};`;
99
89
  staticModuleDeclarations["Schema"] =
100
90
  code `export type Schema = typeof schema;`;
101
91
  }
@@ -108,15 +98,6 @@ __decorate([
108
98
  __decorate([
109
99
  Memoize()
110
100
  ], AbstractType.prototype, "expression", null);
111
- __decorate([
112
- Memoize()
113
- ], AbstractType.prototype, "schema", null);
114
- __decorate([
115
- Memoize()
116
- ], AbstractType.prototype, "schemaVariable", null);
117
- __decorate([
118
- Memoize()
119
- ], AbstractType.prototype, "schemaExpression", null);
120
101
  (function (AbstractType) {
121
102
  let ConversionFunction;
122
103
  (function (ConversionFunction) {
@@ -2,6 +2,7 @@ import type { Literal, NamedNode } from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
4
4
  import { AbstractTermType } from "./AbstractTermType.js";
5
+ import { SchemaObject } from "./SchemaObject.js";
5
6
  import { type Code } from "./ts-poet-wrapper.js";
6
7
  /**
7
8
  * Abstract base class of all types that are typed literals in RDF. In RDF every literal is either
@@ -15,7 +16,7 @@ export declare abstract class AbstractTypedLiteralType<ValueT> extends AbstractL
15
16
  constructor({ datatype, ...superParameters }: {
16
17
  datatype: NamedNode;
17
18
  } & ConstructorParameters<typeof AbstractLiteralType>[0]);
18
- protected get schemaInitializers(): readonly Code[];
19
+ get schema(): SchemaObject<SchemaObject.AbstractType | SchemaObject.BuiltinType>;
19
20
  graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
20
21
  abstract valueExpression(literal: Literal | ValueT): Code;
21
22
  }
@@ -1,6 +1,14 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
1
7
  import { Maybe } from "purify-ts";
8
+ import { Memoize } from "typescript-memoize";
2
9
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
3
10
  import { AbstractTermType } from "./AbstractTermType.js";
11
+ import { SchemaObject } from "./SchemaObject.js";
4
12
  import { code } from "./ts-poet-wrapper.js";
5
13
  /**
6
14
  * Abstract base class of all types that are typed literals in RDF. In RDF every literal is either
@@ -24,13 +32,23 @@ export class AbstractTypedLiteralType extends AbstractLiteralType {
24
32
  super(superParameters);
25
33
  this.datatype = datatype;
26
34
  }
27
- get schemaInitializers() {
28
- return super.schemaInitializers.concat(code `datatype: ${this.rdfjsTermExpression(this.datatype)}`);
35
+ get schema() {
36
+ return new SchemaObject({
37
+ properties: {
38
+ ...super.schema.properties,
39
+ datatype: code `datatype: ${this.rdfjsTermExpression(this.datatype)}`,
40
+ },
41
+ type: new SchemaObject.AbstractType("AbstractTypedLiteralType"),
42
+ variable: super.schema.variable,
43
+ });
29
44
  }
30
45
  graphqlResolveExpression({ variables, }) {
31
46
  return variables.value;
32
47
  }
33
48
  }
49
+ __decorate([
50
+ Memoize()
51
+ ], AbstractTypedLiteralType.prototype, "schema", null);
34
52
  (function (AbstractTypedLiteralType) {
35
53
  AbstractTypedLiteralType.GraphqlType = AbstractTermType.GraphqlType;
36
54
  })(AbstractTypedLiteralType || (AbstractTypedLiteralType = {}));
@@ -2,29 +2,30 @@ import type { Literal } from "@rdfjs/types";
2
2
  import type { Decimal } from "decimal.js";
3
3
  import { Maybe } from "purify-ts";
4
4
  import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
5
- import { ReferenceCallable } from "./ReferenceCallable.js";
5
+ import { BuiltinCallable } from "./BuiltinCallable.js";
6
+ import { SchemaObject } from "./SchemaObject.js";
6
7
  import { type Code } from "./ts-poet-wrapper.js";
7
8
  export declare class BigDecimalType extends AbstractTypedLiteralType<Decimal> {
8
9
  protected readonly inlineExpression: Code;
9
- readonly jsonValueType: AbstractTypedLiteralType.JsonType;
10
10
  readonly jsTypes: readonly [{
11
11
  readonly className: Code;
12
12
  readonly instanceof: "class";
13
13
  readonly typeof: "object";
14
14
  }];
15
15
  readonly conversionFunction: Maybe<AbstractTypedLiteralType.ConversionFunction>;
16
- readonly filterFunction: ReferenceCallable;
16
+ readonly filterFunction: BuiltinCallable;
17
17
  readonly filterType: Code;
18
- readonly fromJsonValueFunction: ReferenceCallable;
19
- readonly fromJsonObjectFunction: ReferenceCallable;
20
- readonly fromRdfResourceValuesFunction: ReferenceCallable;
18
+ readonly fromJsonObjectFunction: BuiltinCallable;
19
+ readonly fromJsonValueFunction: BuiltinCallable;
20
+ readonly fromRdfResourceValuesFunction: BuiltinCallable;
21
21
  readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
22
- readonly hashFunction: ReferenceCallable;
22
+ readonly hashFunction: BuiltinCallable;
23
+ readonly jsonValueType: AbstractTypedLiteralType.JsonType;
23
24
  readonly kind = "BigDecimal";
24
- readonly schemaType: Code;
25
- readonly toJsonValueFunction: ReferenceCallable;
26
- readonly toJsonObjectFunction: ReferenceCallable;
27
- readonly valueSparqlWherePatternsFunction: ReferenceCallable;
25
+ readonly toJsonObjectFunction: BuiltinCallable;
26
+ readonly toJsonValueFunction: BuiltinCallable;
27
+ readonly valueSparqlWherePatternsFunction: BuiltinCallable;
28
+ get schema(): SchemaObject<SchemaObject.BuiltinType>;
28
29
  graphqlResolveExpression({ variables, }: Parameters<AbstractTypedLiteralType<Decimal>["graphqlResolveExpression"]>[0]): Code;
29
30
  toLoggableExpression({ variables, }: Parameters<AbstractTypedLiteralType<Decimal>["toLoggableExpression"]>[0]): Code;
30
31
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractTypedLiteralType<Decimal>["toRdfResourceValuesExpression"]>[0]): Code;