@shaclmate/compiler 4.0.39 → 4.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
  2. package/dist/generators/ts/AbstractCollectionType.js +10 -10
  3. package/dist/generators/ts/AbstractContainerType.d.ts +4 -5
  4. package/dist/generators/ts/AbstractContainerType.js +4 -5
  5. package/dist/generators/ts/AbstractDateType.d.ts +3 -3
  6. package/dist/generators/ts/AbstractDateType.js +2 -2
  7. package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -8
  8. package/dist/generators/ts/AbstractLazyObjectType.js +19 -19
  9. package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
  10. package/dist/generators/ts/AbstractNumericType.js +3 -3
  11. package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
  12. package/dist/generators/ts/AbstractObjectSetType.js +2 -2
  13. package/dist/generators/ts/AbstractPrimitiveType.js +2 -2
  14. package/dist/generators/ts/AbstractTermType.js +2 -2
  15. package/dist/generators/ts/AbstractType.d.ts +15 -10
  16. package/dist/generators/ts/AbstractType.js +6 -1
  17. package/dist/generators/ts/BigDecimalType.d.ts +1 -1
  18. package/dist/generators/ts/BigDecimalType.js +2 -2
  19. package/dist/generators/ts/BigIntType.js +2 -2
  20. package/dist/generators/ts/BlankNodeType.d.ts +3 -3
  21. package/dist/generators/ts/BlankNodeType.js +11 -11
  22. package/dist/generators/ts/BooleanType.d.ts +2 -2
  23. package/dist/generators/ts/BooleanType.js +10 -5
  24. package/dist/generators/ts/DefaultValueType.d.ts +1 -1
  25. package/dist/generators/ts/DefaultValueType.js +8 -9
  26. package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
  27. package/dist/generators/ts/GraphqlSchema.js +4 -4
  28. package/dist/generators/ts/IdentifierType.d.ts +3 -3
  29. package/dist/generators/ts/IdentifierType.js +13 -13
  30. package/dist/generators/ts/IriType.d.ts +2 -2
  31. package/dist/generators/ts/IriType.js +17 -17
  32. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
  33. package/dist/generators/ts/LazyObjectOptionType.js +6 -6
  34. package/dist/generators/ts/LazyObjectSetType.js +5 -5
  35. package/dist/generators/ts/LazyObjectType.js +4 -4
  36. package/dist/generators/ts/ListType.d.ts +4 -5
  37. package/dist/generators/ts/ListType.js +3 -4
  38. package/dist/generators/ts/LiteralType.d.ts +1 -1
  39. package/dist/generators/ts/LiteralType.js +5 -5
  40. package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +23 -24
  41. package/dist/generators/ts/ObjectType.js +350 -0
  42. package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
  43. package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +50 -58
  44. package/dist/generators/ts/OptionType.d.ts +1 -1
  45. package/dist/generators/ts/OptionType.js +10 -10
  46. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
  47. package/dist/generators/ts/SparqlObjectSetType.js +2 -2
  48. package/dist/generators/ts/StringType.d.ts +2 -2
  49. package/dist/generators/ts/StringType.js +10 -5
  50. package/dist/generators/ts/TermType.d.ts +2 -2
  51. package/dist/generators/ts/TermType.js +12 -12
  52. package/dist/generators/ts/TsGenerator.js +12 -9
  53. package/dist/generators/ts/Type.d.ts +4 -5
  54. package/dist/generators/ts/TypeFactory.d.ts +7 -8
  55. package/dist/generators/ts/TypeFactory.js +61 -62
  56. package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +33 -5
  57. package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +262 -58
  58. package/dist/generators/ts/ZodGenerator.js +7 -9
  59. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +6 -6
  60. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +3 -3
  61. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +1 -1
  62. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +8 -8
  63. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +1 -5
  64. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +15 -10
  65. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
  66. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
  67. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
  68. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +4 -4
  69. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
  70. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
  71. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
  72. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
  73. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  74. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  75. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  76. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
  77. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  78. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
  79. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  80. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +4 -4
  81. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  82. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
  83. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
  84. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
  85. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
  86. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
  87. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
  88. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +6 -6
  89. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
  90. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +4 -4
  91. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
  92. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
  93. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
  94. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
  95. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
  96. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +2 -2
  97. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
  98. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
  99. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
  100. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
  101. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
  102. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
  103. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
  104. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +14 -0
  105. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
  106. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
  107. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
  108. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
  109. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
  110. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
  111. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
  112. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
  113. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
  114. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +6 -6
  115. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  116. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  117. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  118. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
  119. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +7 -7
  120. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
  121. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
  122. package/dist/input/generated.d.ts +2 -2
  123. package/dist/input/generated.js +2 -2
  124. package/package.json +4 -4
  125. package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
  126. package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
  127. package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
  128. package/dist/generators/ts/AnonymousUnionType.js +0 -59
  129. package/dist/generators/ts/NamedObjectType.js +0 -342
  130. package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
  131. package/dist/generators/ts/NamedUnionType.d.ts +0 -11
  132. package/dist/generators/ts/NamedUnionType.js +0 -13
  133. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
  134. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
  135. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
  136. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
  137. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  138. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  139. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  140. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  141. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  142. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
  143. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  144. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  145. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
  146. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
  147. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
  148. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
  149. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  150. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  151. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  152. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
  153. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
  154. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
  155. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
  156. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
  157. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
  158. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  159. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  160. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
  161. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
  162. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
  163. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +0 -0
@@ -13,21 +13,21 @@ export class BlankNodeType extends AbstractIdentifierType {
13
13
  code: code `${this.reusables.snippets.convertToBlankNode}`,
14
14
  sourceTypes: [
15
15
  {
16
- name: code `${this.reusables.imports.BlankNode}`,
16
+ expression: code `${this.reusables.imports.BlankNode}`,
17
17
  typeof: "object",
18
18
  },
19
19
  {
20
- name: "undefined",
20
+ expression: code `undefined`,
21
21
  typeof: "undefined",
22
22
  },
23
23
  ],
24
24
  });
25
+ expression = code `${this.reusables.imports.BlankNode}`;
25
26
  filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
26
27
  filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
27
- parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
28
28
  kind = "BlankNode";
29
- name = code `${this.reusables.imports.BlankNode}`;
30
29
  nodeKinds = nodeKinds;
30
+ parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
31
31
  schemaType = code `${this.reusables.snippets.BlankNodeSchema}`;
32
32
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.blankNodeSparqlWherePatterns}`;
33
33
  constructor(superParameters) {
@@ -38,13 +38,7 @@ export class BlankNodeType extends AbstractIdentifierType {
38
38
  });
39
39
  }
40
40
  fromJsonExpression({ variables, }) {
41
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)))`;
42
- }
43
- jsonType(parameters) {
44
- const discriminantProperty = parameters?.includeDiscriminantProperty
45
- ? `, readonly termType: "BlankNode"`
46
- : "";
47
- return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
41
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)))`;
48
42
  }
49
43
  jsonSchema({ includeDiscriminantProperty, }) {
50
44
  const discriminantProperty = includeDiscriminantProperty
@@ -52,6 +46,12 @@ export class BlankNodeType extends AbstractIdentifierType {
52
46
  : "";
53
47
  return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
54
48
  }
49
+ jsonType(parameters) {
50
+ const discriminantProperty = parameters?.includeDiscriminantProperty
51
+ ? `, readonly termType: "BlankNode"`
52
+ : "";
53
+ return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
54
+ }
55
55
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
56
56
  const discriminantProperty = includeDiscriminantProperty
57
57
  ? code `, termType: ${variables.value}.termType`
@@ -7,10 +7,10 @@ export declare class BooleanType extends AbstractPrimitiveType<boolean> {
7
7
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  readonly hashFunction: Code;
9
9
  readonly kind = "Boolean";
10
- readonly schemaType: Code;
11
10
  readonly typeofs: "boolean"[];
12
11
  readonly valueSparqlWherePatternsFunction: Code;
13
- get name(): string;
12
+ get expression(): Code;
13
+ get schemaType(): Code;
14
14
  jsonSchema(_parameters: Parameters<AbstractPrimitiveType<number>["jsonSchema"]>[0]): Code;
15
15
  literalExpression(literal: boolean | Literal): Code;
16
16
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<boolean>["toRdfResourceValuesExpression"]>[0]): Code;
@@ -14,14 +14,16 @@ export class BooleanType extends AbstractPrimitiveType {
14
14
  graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
15
15
  hashFunction = code `${this.reusables.snippets.hashBoolean}`;
16
16
  kind = "Boolean";
17
- schemaType = code `${this.reusables.snippets.BooleanSchema}<${this.name}>`;
18
17
  typeofs = ["boolean"];
19
18
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
20
- get name() {
19
+ get expression() {
21
20
  if (this.primitiveIn.length > 0) {
22
- return `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
21
+ return code `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
23
22
  }
24
- return `boolean`;
23
+ return code `boolean`;
24
+ }
25
+ get schemaType() {
26
+ return code `${this.reusables.snippets.BooleanSchema}<${this.expression}>`;
25
27
  }
26
28
  jsonSchema(_parameters) {
27
29
  if (this.primitiveIn.length === 1) {
@@ -46,5 +48,8 @@ export class BooleanType extends AbstractPrimitiveType {
46
48
  }
47
49
  __decorate([
48
50
  Memoize()
49
- ], BooleanType.prototype, "name", null);
51
+ ], BooleanType.prototype, "expression", null);
52
+ __decorate([
53
+ Memoize()
54
+ ], BooleanType.prototype, "schemaType", null);
50
55
  //# sourceMappingURL=BooleanType.js.map
@@ -17,12 +17,12 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
17
17
  } & ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0]);
18
18
  get conversionFunction(): Maybe<AbstractContainerType.ConversionFunction>;
19
19
  get equalsFunction(): Code;
20
+ get expression(): Code;
20
21
  get filterFunction(): Code;
21
22
  get filterType(): Code;
22
23
  get graphqlType(): AbstractContainerType.GraphqlType;
23
24
  get hashFunction(): Code;
24
25
  get mutable(): boolean;
25
- get name(): Code | string;
26
26
  get schemaType(): Code;
27
27
  get valueSparqlConstructTriplesFunction(): Code;
28
28
  get valueSparqlWherePatternsFunction(): Code;
@@ -27,7 +27,7 @@ export class DefaultValueType extends AbstractContainerType {
27
27
  sourceTypes: itemConversionFunction.sourceTypes
28
28
  .filter((sourceType) => sourceType.typeof !== "undefined")
29
29
  .concat({
30
- name: "undefined",
30
+ expression: code `undefined`,
31
31
  typeof: "undefined",
32
32
  }),
33
33
  });
@@ -35,6 +35,9 @@ export class DefaultValueType extends AbstractContainerType {
35
35
  get equalsFunction() {
36
36
  return this.itemType.equalsFunction;
37
37
  }
38
+ get expression() {
39
+ return this.itemType.expression;
40
+ }
38
41
  get filterFunction() {
39
42
  return this.itemType.filterFunction;
40
43
  }
@@ -50,11 +53,8 @@ export class DefaultValueType extends AbstractContainerType {
50
53
  get mutable() {
51
54
  return this.itemType.mutable;
52
55
  }
53
- get name() {
54
- return this.itemType.name;
55
- }
56
56
  get schemaType() {
57
- return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.name}, ${this.itemType.schemaType}>`;
57
+ return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.expression}, ${this.itemType.schemaType}>`;
58
58
  }
59
59
  get valueSparqlConstructTriplesFunction() {
60
60
  return this.itemType.valueSparqlConstructTriplesFunction;
@@ -72,11 +72,10 @@ export class DefaultValueType extends AbstractContainerType {
72
72
  case "Literal":
73
73
  case "Term":
74
74
  return this.rdfjsTermExpression(this.defaultValue);
75
- case "AnonymousUnion":
76
75
  case "List":
77
- case "NamedObjectType":
78
- case "NamedObjectUnion":
79
- case "NamedUnion":
76
+ case "Object":
77
+ case "ObjectUnion":
78
+ case "Union":
80
79
  throw new RangeError(`not implemented ${this.itemType.kind}`);
81
80
  }
82
81
  invariant(this.defaultValue.termType === "Literal");
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from "ts-log";
2
- import type { NamedObjectType } from "./NamedObjectType.js";
3
- import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
2
+ import type { ObjectType } from "./ObjectType.js";
3
+ import type { ObjectUnionType } from "./ObjectUnionType.js";
4
4
  import type { Reusables } from "./Reusables.js";
5
5
  import type { TsGenerator } from "./TsGenerator.js";
6
6
  import { type Code } from "./ts-poet-wrapper.js";
@@ -12,8 +12,8 @@ export declare class GraphqlSchema {
12
12
  constructor({ configuration, namedObjectTypes, namedObjectUnionTypes, reusables, }: {
13
13
  configuration: TsGenerator.Configuration;
14
14
  logger: Logger;
15
- namedObjectTypes: readonly NamedObjectType[];
16
- namedObjectUnionTypes: readonly NamedObjectUnionType[];
15
+ namedObjectTypes: readonly ObjectType[];
16
+ namedObjectUnionTypes: readonly ObjectUnionType[];
17
17
  reusables: Reusables;
18
18
  });
19
19
  get declaration(): Code;
@@ -28,8 +28,8 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
28
28
  },
29
29
  },
30
30
  resolve: code `\
31
- async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.name}> =>
32
- (await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.name}>(async ({ liftEither }) =>
31
+ async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.expression}> =>
32
+ (await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.expression}>(async ({ liftEither }) =>
33
33
  liftEither(await objectSet.${namedObjectType.objectSetMethodNames.object}(await liftEither(${namedObjectType.identifierTypeAlias}.parse(args.identifier))))
34
34
  )).unsafeCoerce()`,
35
35
  type: namedObjectType.graphqlType.name,
@@ -61,8 +61,8 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
61
61
  },
62
62
  },
63
63
  resolve: code `\
64
- async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.name}[]> =>
65
- (await ${this.reusables.imports.EitherAsync}<Error, readonly ${namedObjectType.name}[]>(async ({ liftEither }) => {
64
+ async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.expression}[]> =>
65
+ (await ${this.reusables.imports.EitherAsync}<Error, readonly ${namedObjectType.expression}[]>(async ({ liftEither }) => {
66
66
  let filter: ${namedObjectType.filterType} | undefined;
67
67
  if (args.identifiers) {
68
68
  const identifiers: ${namedObjectType.identifierTypeAlias}[] = [];
@@ -5,18 +5,18 @@ import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
5
5
  import { type Code } from "./ts-poet-wrapper.js";
6
6
  export declare class IdentifierType extends AbstractIdentifierType<BlankNode | NamedNode> {
7
7
  readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
8
+ readonly expression: Code;
8
9
  readonly filterFunction: Code;
9
10
  readonly filterType: Code;
10
- readonly parseFunction: Code;
11
11
  readonly kind = "Identifier";
12
- readonly name: Code;
13
12
  readonly nodeKinds: ReadonlySet<IdentifierNodeKind>;
13
+ readonly parseFunction: Code;
14
14
  readonly schemaType: Code;
15
15
  readonly valueSparqlWherePatternsFunction: Code;
16
16
  constructor(parameters: Omit<ConstructorParameters<typeof AbstractIdentifierType<BlankNode | NamedNode>>[0], "hasValues" | "in_">);
17
17
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromJsonExpression"]>[0]): Code;
18
- jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
19
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonSchema"]>[0]): Code;
19
+ jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
20
20
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["toJsonExpression"]>[0]): Code;
21
21
  protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>;
22
22
  }
@@ -14,29 +14,29 @@ export class IdentifierType extends AbstractIdentifierType {
14
14
  code: code `${this.reusables.snippets.convertToIdentifier}`,
15
15
  sourceTypes: [
16
16
  {
17
- name: code `${this.reusables.imports.BlankNode}`,
17
+ expression: code `${this.reusables.imports.BlankNode}`,
18
18
  typeof: "object",
19
19
  },
20
20
  {
21
- name: code `${this.reusables.imports.NamedNode}`,
21
+ expression: code `${this.reusables.imports.NamedNode}`,
22
22
  typeof: "object",
23
23
  },
24
24
  {
25
- name: "string",
25
+ expression: code `string`,
26
26
  typeof: "string",
27
27
  },
28
28
  {
29
- name: "undefined",
29
+ expression: code `undefined`,
30
30
  typeof: "undefined",
31
31
  },
32
32
  ],
33
33
  });
34
+ expression = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
34
35
  filterFunction = code `${this.reusables.snippets.filterIdentifier}`;
35
36
  filterType = code `${this.reusables.snippets.IdentifierFilter}`;
36
- parseFunction = code `${this.reusables.snippets.parseIdentifier};`;
37
37
  kind = "Identifier";
38
- name = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
39
38
  nodeKinds = nodeKinds;
39
+ parseFunction = code `${this.reusables.snippets.parseIdentifier};`;
40
40
  schemaType = code `${this.reusables.snippets.IdentifierSchema}`;
41
41
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.identifierSparqlWherePatterns}`;
42
42
  constructor(parameters) {
@@ -47,13 +47,7 @@ export class IdentifierType extends AbstractIdentifierType {
47
47
  });
48
48
  }
49
49
  fromJsonExpression({ variables, }) {
50
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>((${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])))`;
51
- }
52
- jsonType(parameters) {
53
- const discriminantProperty = parameters?.includeDiscriminantProperty
54
- ? `, readonly termType: "BlankNode" | "NamedNode"`
55
- : "";
56
- return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
50
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>((${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])))`;
57
51
  }
58
52
  jsonSchema({ includeDiscriminantProperty, }) {
59
53
  const discriminantProperty = includeDiscriminantProperty
@@ -61,6 +55,12 @@ export class IdentifierType extends AbstractIdentifierType {
61
55
  : "";
62
56
  return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
63
57
  }
58
+ jsonType(parameters) {
59
+ const discriminantProperty = parameters?.includeDiscriminantProperty
60
+ ? `, readonly termType: "BlankNode" | "NamedNode"`
61
+ : "";
62
+ return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
63
+ }
64
64
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
65
65
  const discriminantProperty = includeDiscriminantProperty
66
66
  ? code `, termType: ${variables.value}.termType as ${[...this.nodeKinds].map((nodeKind) => `"${NodeKind.toTermType(nodeKind)}"`).join(" | ")}`
@@ -10,10 +10,10 @@ export declare class IriType extends AbstractIdentifierType<NamedNode> {
10
10
  readonly schemaType: Code;
11
11
  readonly valueSparqlWherePatternsFunction: Code;
12
12
  get conversionFunction(): Maybe<AbstractIdentifierType.ConversionFunction>;
13
- get name(): Code;
14
- private get valueTypeName();
13
+ get expression(): Code;
15
14
  get parseFunction(): Code;
16
15
  protected get schemaInitializers(): readonly Code[];
16
+ private get valueTypeExpression();
17
17
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<NamedNode>["fromJsonExpression"]>[0]): Code;
18
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<NamedNode>["jsonSchema"]>[0]): Code;
19
19
  jsonType(parameters?: Parameters<AbstractIdentifierType<NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
@@ -13,37 +13,32 @@ export class IriType extends AbstractIdentifierType {
13
13
  filterType = code `${this.reusables.snippets.IriFilter}`;
14
14
  kind = "Iri";
15
15
  nodeKinds = nodeKinds;
16
- schemaType = code `${this.reusables.snippets.IriSchema}<${this.valueTypeName}>`;
16
+ schemaType = code `${this.reusables.snippets.IriSchema}<${this.valueTypeExpression}>`;
17
17
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.iriSparqlWherePatterns}`;
18
18
  get conversionFunction() {
19
19
  return Maybe.of({
20
- code: code `${this.reusables.snippets.convertToIri}<${this.valueTypeName}>`,
20
+ code: code `${this.reusables.snippets.convertToIri}<${this.valueTypeExpression}>`,
21
21
  sourceTypes: [
22
22
  {
23
- name: this.valueTypeName,
23
+ expression: this.valueTypeExpression,
24
24
  typeof: "string",
25
25
  },
26
26
  {
27
- name: this.name,
27
+ expression: this.expression,
28
28
  typeof: "object",
29
29
  },
30
30
  ],
31
31
  });
32
32
  }
33
- get name() {
33
+ get expression() {
34
34
  if (this.in_.length > 0) {
35
- return code `${this.reusables.imports.NamedNode}<${this.valueTypeName}>`;
35
+ return code `${this.reusables.imports.NamedNode}<${this.valueTypeExpression}>`;
36
36
  }
37
37
  return code `${this.reusables.imports.NamedNode}`;
38
38
  }
39
- get valueTypeName() {
40
- return this.in_.length > 0
41
- ? `(${this.in_.map((in_) => `"${in_.value}"`).join(" | ")})`
42
- : "string";
43
- }
44
39
  get parseFunction() {
45
40
  if (this.in_.length > 0) {
46
- return code `(identifier: string) => ${this.reusables.snippets.parseIri}(identifier).chain((identifier) => { switch (identifier.value) { ${joinCode(this.in_.map((iri) => code `case "${iri.value}": return ${this.reusables.imports.Right}(identifier as ${this.name});`))} default: return ${this.reusables.imports.Left}(new Error("expected NamedNode identifier to be one of ${this.in_.map((iri) => iri.value).join(" ")}")); } })`;
41
+ return code `(identifier: string) => ${this.reusables.snippets.parseIri}(identifier).chain((identifier) => { switch (identifier.value) { ${joinCode(this.in_.map((iri) => code `case "${iri.value}": return ${this.reusables.imports.Right}(identifier as ${this.expression});`))} default: return ${this.reusables.imports.Left}(new Error("expected NamedNode identifier to be one of ${this.in_.map((iri) => iri.value).join(" ")}")); } })`;
47
42
  }
48
43
  return code `${this.reusables.snippets.parseIri}`;
49
44
  }
@@ -54,8 +49,13 @@ export class IriType extends AbstractIdentifierType {
54
49
  }
55
50
  return initializers;
56
51
  }
52
+ get valueTypeExpression() {
53
+ return this.in_.length > 0
54
+ ? code `(${this.in_.map((in_) => `"${in_.value}"`).join(" | ")})`
55
+ : code `string`;
56
+ }
57
57
  fromJsonExpression({ variables, }) {
58
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"]))`;
58
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"]))`;
59
59
  }
60
60
  jsonSchema({ includeDiscriminantProperty, }) {
61
61
  let idSchema;
@@ -76,7 +76,7 @@ export class IriType extends AbstractIdentifierType {
76
76
  const discriminantProperty = parameters?.includeDiscriminantProperty
77
77
  ? `, readonly termType: "NamedNode"`
78
78
  : "";
79
- return new AbstractIdentifierType.JsonType(code `{ readonly "@id": ${this.valueTypeName}${discriminantProperty} }`);
79
+ return new AbstractIdentifierType.JsonType(code `{ readonly "@id": ${this.valueTypeExpression}${discriminantProperty} }`);
80
80
  }
81
81
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
82
82
  const discriminantProperty = includeDiscriminantProperty
@@ -98,13 +98,13 @@ __decorate([
98
98
  ], IriType.prototype, "conversionFunction", null);
99
99
  __decorate([
100
100
  Memoize()
101
- ], IriType.prototype, "name", null);
101
+ ], IriType.prototype, "expression", null);
102
102
  __decorate([
103
103
  Memoize()
104
- ], IriType.prototype, "valueTypeName", null);
104
+ ], IriType.prototype, "parseFunction", null);
105
105
  __decorate([
106
106
  Memoize()
107
- ], IriType.prototype, "parseFunction", null);
107
+ ], IriType.prototype, "valueTypeExpression", null);
108
108
  __decorate([
109
109
  Memoize()
110
110
  ], IriType.prototype, "jsonType", null);
@@ -7,6 +7,7 @@ declare const Super: (abstract new ({ partialType, resolveType, ...superParamete
7
7
  partialType: OptionType<AbstractLazyObjectType.ObjectTypeConstraint>;
8
8
  resolveType: OptionType<AbstractLazyObjectType.ObjectTypeConstraint>;
9
9
  } & {
10
+ alias: Maybe<string>;
10
11
  comment: Maybe<string>;
11
12
  configuration: import("./TsGenerator.js").TsGenerator.Configuration;
12
13
  label: Maybe<string>;
@@ -14,22 +14,22 @@ export class LazyObjectOptionType extends Super {
14
14
  kind = "LazyObjectOption";
15
15
  get conversionFunction() {
16
16
  return Maybe.of({
17
- code: code `${this.reusables.snippets.convertToLazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
17
+ code: code `${this.reusables.snippets.convertToLazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
18
18
  sourceTypes: [
19
19
  {
20
- name: this.name,
20
+ expression: this.expression,
21
21
  typeof: "object",
22
22
  },
23
23
  {
24
- name: this.resolveType.name,
24
+ expression: this.resolveType.expression,
25
25
  typeof: "object",
26
26
  },
27
27
  {
28
- name: this.resolveType.itemType.name,
28
+ expression: this.resolveType.itemType.expression,
29
29
  typeof: "object",
30
30
  },
31
31
  {
32
- name: "undefined",
32
+ expression: code `undefined`,
33
33
  typeof: "undefined",
34
34
  },
35
35
  ],
@@ -37,7 +37,7 @@ export class LazyObjectOptionType extends Super {
37
37
  }
38
38
  get runtimeClass() {
39
39
  return {
40
- name: code `${this.reusables.snippets.LazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>`,
40
+ name: code `${this.reusables.snippets.LazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>`,
41
41
  partialPropertyName: "partial",
42
42
  rawName: code `${this.reusables.snippets.LazyObjectOption}`,
43
43
  };
@@ -20,18 +20,18 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
20
20
  kind = "LazyObjectSet";
21
21
  get conversionFunction() {
22
22
  return Maybe.of({
23
- code: code `${this.reusables.snippets.convertToLazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
23
+ code: code `${this.reusables.snippets.convertToLazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
24
24
  sourceTypes: [
25
25
  {
26
- name: this.name,
26
+ expression: this.expression,
27
27
  typeof: "object",
28
28
  },
29
29
  {
30
- name: this.resolveType.name,
30
+ expression: this.resolveType.expression,
31
31
  typeof: "object",
32
32
  },
33
33
  {
34
- name: "undefined",
34
+ expression: code `undefined`,
35
35
  typeof: "undefined",
36
36
  },
37
37
  ],
@@ -39,7 +39,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
39
39
  }
40
40
  get runtimeClass() {
41
41
  return {
42
- name: code `${this.reusables.snippets.LazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.name}, ${this.resolveType.itemType.name}>`,
42
+ name: code `${this.reusables.snippets.LazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>`,
43
43
  partialPropertyName: "partials",
44
44
  rawName: code `${this.reusables.snippets.LazyObjectSet}`,
45
45
  };
@@ -13,14 +13,14 @@ export class LazyObjectType extends AbstractLazyObjectType {
13
13
  kind = "LazyObject";
14
14
  get conversionFunction() {
15
15
  return Maybe.of({
16
- code: code `${this.reusables.snippets.convertToLazyObject}<${this.resolveType.identifierTypeAlias}, ${this.partialType.name}, ${this.resolveType.name}>(${this.resolveToPartialFunction({ partialType: this.partialType, resolveType: this.resolveType })})`,
16
+ code: code `${this.reusables.snippets.convertToLazyObject}<${this.resolveType.identifierTypeAlias}, ${this.partialType.expression}, ${this.resolveType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType, resolveType: this.resolveType })})`,
17
17
  sourceTypes: [
18
18
  {
19
- name: this.name,
19
+ expression: this.expression,
20
20
  typeof: "object",
21
21
  },
22
22
  {
23
- name: this.resolveType.name,
23
+ expression: this.resolveType.expression,
24
24
  typeof: "object",
25
25
  },
26
26
  ],
@@ -28,7 +28,7 @@ export class LazyObjectType extends AbstractLazyObjectType {
28
28
  }
29
29
  get runtimeClass() {
30
30
  return {
31
- name: code `${this.reusables.snippets.LazyObject}<${this.resolveType.identifierTypeAlias}, ${this.partialType.name}, ${this.resolveType.name}>`,
31
+ name: code `${this.reusables.snippets.LazyObject}<${this.resolveType.identifierTypeAlias}, ${this.partialType.expression}, ${this.resolveType.expression}>`,
32
32
  partialPropertyName: "partial",
33
33
  rawName: code `${this.reusables.snippets.LazyObject}`,
34
34
  };
@@ -1,6 +1,5 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
3
- import type { AnonymousUnionType } from "./AnonymousUnionType.js";
4
3
  import type { BigDecimalType } from "./BigDecimalType.js";
5
4
  import type { BigIntType } from "./BigIntType.js";
6
5
  import type { BlankNodeType } from "./BlankNodeType.js";
@@ -12,13 +11,13 @@ import type { IdentifierType } from "./IdentifierType.js";
12
11
  import type { IntType } from "./IntType.js";
13
12
  import type { IriType } from "./IriType.js";
14
13
  import type { LiteralType } from "./LiteralType.js";
15
- import type { NamedObjectType } from "./NamedObjectType.js";
16
- import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
17
- import type { NamedUnionType } from "./NamedUnionType.js";
14
+ import type { ObjectType } from "./ObjectType.js";
15
+ import type { ObjectUnionType } from "./ObjectUnionType.js";
18
16
  import type { StringType } from "./StringType.js";
19
17
  import type { TermType } from "./TermType.js";
20
18
  import type { Type } from "./Type.js";
21
19
  import { type Code } from "./ts-poet-wrapper.js";
20
+ import type { UnionType } from "./UnionType.js";
22
21
  export declare class ListType<ItemTypeT extends ListType.ItemType> extends AbstractCollectionType<ItemTypeT> {
23
22
  private readonly identifierNodeKind;
24
23
  private readonly toRdfTypes;
@@ -35,7 +34,7 @@ export declare class ListType<ItemTypeT extends ListType.ItemType> extends Abstr
35
34
  toStringExpression({ variables, }: Parameters<AbstractCollectionType<ItemTypeT>["toStringExpression"]>[0]): Code;
36
35
  }
37
36
  export declare namespace ListType {
38
- type ItemType = AnonymousUnionType | BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | LiteralType | NamedObjectUnionType | NamedUnionType | NamedObjectType | StringType | TermType;
37
+ type ItemType = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | LiteralType | ObjectUnionType | ObjectType | StringType | TermType | UnionType<Type>;
39
38
  function isItemType(type: Type): type is ItemType;
40
39
  }
41
40
  //# sourceMappingURL=ListType.d.ts.map
@@ -102,7 +102,6 @@ __decorate([
102
102
  (function (ListType) {
103
103
  function isItemType(type) {
104
104
  switch (type.kind) {
105
- case "AnonymousUnion":
106
105
  case "BigDecimal":
107
106
  case "BigInt":
108
107
  case "BlankNode":
@@ -114,11 +113,11 @@ __decorate([
114
113
  case "Iri":
115
114
  case "Int":
116
115
  case "Literal":
117
- case "NamedObjectUnion":
118
- case "NamedUnion":
119
- case "NamedObjectType":
116
+ case "ObjectUnion":
117
+ case "Object":
120
118
  case "String":
121
119
  case "Term":
120
+ case "Union":
122
121
  return true;
123
122
  case "DefaultValue":
124
123
  case "LazyObjectOption":
@@ -3,7 +3,7 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class LiteralType extends AbstractLiteralType {
6
- readonly name: Code;
6
+ readonly expression: Code;
7
7
  readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
@@ -3,20 +3,20 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
4
4
  import { arrayOf, code } from "./ts-poet-wrapper.js";
5
5
  export class LiteralType extends AbstractLiteralType {
6
- name = code `${this.reusables.imports.Literal}`;
6
+ expression = code `${this.reusables.imports.Literal}`;
7
7
  conversionFunction = Maybe.of({
8
8
  code: code `${this.reusables.snippets.convertToLiteral}`,
9
9
  sourceTypes: [
10
10
  ...["bigint", "boolean", "number", "string"].map((typeof_) => ({
11
- name: typeof_,
11
+ expression: code `${typeof_}`,
12
12
  typeof: typeof_,
13
13
  })),
14
14
  {
15
- name: "Date",
15
+ expression: code `Date`,
16
16
  typeof: "object",
17
17
  },
18
18
  {
19
- name: code `${this.reusables.imports.Literal}`,
19
+ expression: code `${this.reusables.imports.Literal}`,
20
20
  typeof: "object",
21
21
  },
22
22
  ],
@@ -37,7 +37,7 @@ export class LiteralType extends AbstractLiteralType {
37
37
  return initializers;
38
38
  }
39
39
  fromJsonExpression({ variables, }) {
40
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined)))`;
40
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${this.reusables.imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined)))`;
41
41
  }
42
42
  graphqlResolveExpression(_parameters) {
43
43
  throw new Error("not implemented");