@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
@@ -19,7 +19,7 @@ export class DiscriminantProperty extends AbstractProperty {
19
19
  super({ ...superParameters, type });
20
20
  }
21
21
  get declaration() {
22
- return code `readonly ${this.name}: ${this.type.name};`;
22
+ return code `readonly ${this.name}: ${this.type.expression};`;
23
23
  }
24
24
  get jsonName() {
25
25
  return "@type";
@@ -33,7 +33,7 @@ export class DiscriminantProperty extends AbstractProperty {
33
33
  });
34
34
  }
35
35
  get jsonSignature() {
36
- return Maybe.of(code `readonly "${this.jsonName}": ${this.type.name}`);
36
+ return Maybe.of(code `readonly "${this.jsonName}": ${this.type.expression}`);
37
37
  }
38
38
  get schema() {
39
39
  return Maybe.empty();
@@ -42,7 +42,7 @@ export class DiscriminantProperty extends AbstractProperty {
42
42
  // return super.schemaInitializers.concat(code`type: ${this.type.schema}`);
43
43
  // }
44
44
  get constValue() {
45
- return code `${literalOf(this.namedObjectType.discriminantValue)} as const`;
45
+ return code `${literalOf(this.objectType.discriminantValue)} as const`;
46
46
  }
47
47
  constructorInitializer() {
48
48
  return Maybe.empty();
@@ -54,13 +54,13 @@ export class DiscriminantProperty extends AbstractProperty {
54
54
  return Maybe.empty();
55
55
  }
56
56
  hashStatements({ variables, }) {
57
- if (this.namedObjectType.parentObjectTypes.length > 0) {
57
+ if (this.objectType.parentObjectTypes.length > 0) {
58
58
  return [];
59
59
  }
60
60
  return [code `${variables.hasher}.update(${variables.value});`];
61
61
  }
62
62
  jsonUiSchemaElement({ variables, }) {
63
- if (this.namedObjectType.parentObjectTypes.length > 0) {
63
+ if (this.objectType.parentObjectTypes.length > 0) {
64
64
  return Maybe.empty();
65
65
  }
66
66
  const scope = code `\`\${${variables.scopePrefix}}/properties/${this.jsonName}\``;
@@ -102,8 +102,8 @@ __decorate([
102
102
  this.mutable = mutable;
103
103
  this.ownValues = ownValues;
104
104
  }
105
- get name() {
106
- return `${this.values.map((name) => `"${name}"`).join(" | ")}`;
105
+ get expression() {
106
+ return code `${this.values.map((name) => `"${name}"`).join(" | ")}`;
107
107
  }
108
108
  get schema() {
109
109
  throw new Error("should never be called");
@@ -122,7 +122,7 @@ __decorate([
122
122
  }
123
123
  __decorate([
124
124
  Memoize()
125
- ], Type.prototype, "name", null);
125
+ ], Type.prototype, "expression", null);
126
126
  __decorate([
127
127
  Memoize()
128
128
  ], Type.prototype, "schema", null);
@@ -5,14 +5,9 @@ import type { IriType } from "../IriType.js";
5
5
  import { type Code } from "../ts-poet-wrapper.js";
6
6
  import { AbstractProperty } from "./AbstractProperty.js";
7
7
  export declare class IdentifierProperty extends AbstractProperty<BlankNodeType | IdentifierType | IriType> {
8
- private readonly typeAlias;
9
8
  readonly kind = "Identifier";
10
9
  readonly mutable = false;
11
10
  readonly recursive = false;
12
- constructor({ typeAlias, ...superParameters }: {
13
- type: BlankNodeType | IdentifierType | IriType;
14
- typeAlias: Code;
15
- } & ConstructorParameters<typeof AbstractProperty>[0]);
16
11
  get constructorParameter(): Maybe<Code>;
17
12
  get declaration(): Code;
18
13
  get filterProperty(): Maybe<{
@@ -23,6 +18,7 @@ export declare class IdentifierProperty extends AbstractProperty<BlankNodeType |
23
18
  get jsonSchema(): AbstractProperty<IdentifierType>["jsonSchema"];
24
19
  get jsonSignature(): Maybe<Code>;
25
20
  protected get schemaInitializers(): readonly Code[];
21
+ private get typeExpression();
26
22
  accessExpression({ variables, }: Parameters<AbstractProperty<BlankNodeType | IdentifierType | IriType>["accessExpression"]>[0]): Code;
27
23
  constructorInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["constructorInitializer"]>[0]): Maybe<Code>;
28
24
  fromJsonInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["fromJsonInitializer"]>[0]): Maybe<Code>;
@@ -12,30 +12,25 @@ import { Memoize } from "typescript-memoize";
12
12
  import { arrayOf, code, joinCode, literalOf, } from "../ts-poet-wrapper.js";
13
13
  import { AbstractProperty } from "./AbstractProperty.js";
14
14
  export class IdentifierProperty extends AbstractProperty {
15
- typeAlias;
16
15
  kind = "Identifier";
17
16
  mutable = false;
18
17
  recursive = false;
19
- constructor({ typeAlias, ...superParameters }) {
20
- super(superParameters);
21
- this.typeAlias = typeAlias;
22
- }
23
18
  get constructorParameter() {
24
19
  let hasQuestionToken = false;
25
- const typeNames = [code `(() => ${this.typeAlias})`];
20
+ const typeNames = [code `(() => ${this.typeExpression})`];
26
21
  for (const type of this.type.conversionFunction.unsafeCoerce()
27
22
  .sourceTypes) {
28
23
  if (type.typeof === "undefined") {
29
24
  hasQuestionToken = true;
30
25
  }
31
26
  else {
32
- typeNames.push(code `${type.name}`);
27
+ typeNames.push(code `${type.expression}`);
33
28
  }
34
29
  }
35
30
  return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
36
31
  }
37
32
  get declaration() {
38
- return code `readonly ${this.name}: () => ${this.typeAlias};`;
33
+ return code `readonly ${this.name}: () => ${this.typeExpression};`;
39
34
  }
40
35
  get filterProperty() {
41
36
  return Maybe.of({
@@ -50,7 +45,7 @@ export class IdentifierProperty extends AbstractProperty {
50
45
  args: Maybe.empty(),
51
46
  description: Maybe.empty(),
52
47
  name: `_${this.name.substring(syntheticNamePrefix.length)}`,
53
- resolve: code `(source) => ${this.typeAlias}.stringify(${this.accessExpression({ variables: { object: code `source` } })})`,
48
+ resolve: code `(source) => ${this.typeExpression}.stringify(${this.accessExpression({ variables: { object: code `source` } })})`,
54
49
  type: this.type.graphqlType.name,
55
50
  });
56
51
  }
@@ -78,6 +73,11 @@ export class IdentifierProperty extends AbstractProperty {
78
73
  get schemaInitializers() {
79
74
  return super.schemaInitializers.concat(code `type: ${this.type.schema}`);
80
75
  }
76
+ get typeExpression() {
77
+ return this.objectType.alias
78
+ .map((objectTypeAlias) => code `${objectTypeAlias}.Identifier`)
79
+ .orDefault(this.type.expression);
80
+ }
81
81
  accessExpression({ variables, }) {
82
82
  return code `${variables.object}.${this.name}()`;
83
83
  }
@@ -131,7 +131,9 @@ export class IdentifierProperty extends AbstractProperty {
131
131
  ignoreRdfType: true, // Unused
132
132
  preferredLanguages: variables.preferredLanguages,
133
133
  propertyPatterns: code `[]`,
134
- schema: code `${this.namedObjectType.name}.schema.properties.${this.name}.type`,
134
+ schema: this.objectType.alias
135
+ .map((objectTypeAlias) => code `${objectTypeAlias}.schema.properties.${this.name}.type`)
136
+ .orDefault(this.type.schema),
135
137
  valueVariable: variables.focusIdentifier,
136
138
  variablePrefix: variables.variablePrefix, // Unused
137
139
  }})`,
@@ -180,4 +182,7 @@ __decorate([
180
182
  __decorate([
181
183
  Memoize()
182
184
  ], IdentifierProperty.prototype, "jsonSignature", null);
185
+ __decorate([
186
+ Memoize()
187
+ ], IdentifierProperty.prototype, "typeExpression", null);
183
188
  //# sourceMappingURL=IdentifierProperty.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_createFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_createFunctionDeclaration.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { invariant } from "ts-invariant";
3
3
  import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
4
- export function NamedObjectType_createFunctionDeclaration() {
4
+ export function ObjectType_createFunctionDeclaration() {
5
5
  if (!this.configuration.features.has("Object.create")) {
6
6
  return Maybe.empty();
7
7
  }
@@ -11,7 +11,7 @@ export function NamedObjectType_createFunctionDeclaration() {
11
11
  parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
12
12
  }
13
13
  for (const parentObjectType of this.parentObjectTypes) {
14
- parametersType.push(code `Parameters<typeof ${parentObjectType.name}.create>[0]`);
14
+ parametersType.push(code `Parameters<typeof ${parentObjectType.alias.unsafeCoerce()}.create>[0]`);
15
15
  }
16
16
  if (parametersType.length === 0) {
17
17
  parametersType.push(code `object`);
@@ -23,7 +23,7 @@ export function NamedObjectType_createFunctionDeclaration() {
23
23
  const chains = [];
24
24
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
25
25
  chains.push({
26
- expression: code `${parentObjectType.name}.create(parameters)`,
26
+ expression: code `${parentObjectType.alias.unsafeCoerce()}.create(parameters)`,
27
27
  variable: `super${parentObjectTypeI}`,
28
28
  });
29
29
  });
@@ -54,12 +54,12 @@ export function NamedObjectType_createFunctionDeclaration() {
54
54
  .toReversed()
55
55
  .reduce((acc, { expression, variable }, chainI) => code `(${expression}).${chainI === 0 ? "map" : "chain"}(${variable} => ${acc})`, returnExpression);
56
56
  return Maybe.of(code `\
57
- export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.name}> {
57
+ export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
58
58
  return ${returnExpression};
59
59
  }
60
60
 
61
- export function createUnsafe(${parametersSignature}): ${this.name} {
61
+ export function createUnsafe(${parametersSignature}): ${this.expression} {
62
62
  return create(parameters).unsafeCoerce();
63
63
  }`);
64
64
  }
65
- //# sourceMappingURL=NamedObjectType_createFunctionDeclaration.js.map
65
+ //# sourceMappingURL=ObjectType_createFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_equalsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_equalsFunctionDeclaration.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_equalsFunctionDeclaration() {
3
+ export function ObjectType_equalsFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.equals")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const chain = [];
8
8
  // For every parent, find the nearest equals implementation
9
9
  for (const parentObjectType of this.parentObjectTypes) {
10
- chain.push(code `${parentObjectType.name}.equals(left, right)`);
10
+ chain.push(code `${parentObjectType.equalsFunction}(left, right)`);
11
11
  }
12
12
  for (const property of this.properties) {
13
13
  if (property.kind === "Discriminant") {
@@ -16,8 +16,8 @@ export function NamedObjectType_equalsFunctionDeclaration() {
16
16
  chain.push(code `(${property.type.equalsFunction})(${property.accessExpression({ variables: { object: code `left` } })}, ${property.accessExpression({ variables: { object: code `right` } })}).mapLeft(propertyValuesUnequal => ({ left, right, propertyName: "${property.name}", propertyValuesUnequal, type: "property" as const }))`);
17
17
  }
18
18
  return Maybe.of(code `\
19
- export function equals(left: ${this.name}, right: ${this.name}): ${this.reusables.snippets.EqualsResult} {
19
+ export function equals(left: ${this.expression}, right: ${this.expression}): ${this.reusables.snippets.EqualsResult} {
20
20
  return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
21
21
  }`);
22
22
  }
23
- //# sourceMappingURL=NamedObjectType_equalsFunctionDeclaration.js.map
23
+ //# sourceMappingURL=ObjectType_equalsFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_filterFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_filterFunctionDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_filterFunctionDeclaration() {
3
+ export function ObjectType_filterFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.filter")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -17,8 +17,8 @@ export function NamedObjectType_filterFunctionDeclaration() {
17
17
  }
18
18
  statements.push(code `return true;`);
19
19
  return Maybe.of(code `\
20
- export function filter(filter: ${this.filterType}, value: ${this.name}): boolean {
20
+ export function filter(filter: ${this.filterType}, value: ${this.expression}): boolean {
21
21
  ${joinCode(statements)}
22
22
  }`);
23
23
  }
24
- //# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.js.map
24
+ //# sourceMappingURL=ObjectType_filterFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_filterTypeDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_filterTypeDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_filterTypeDeclaration() {
3
+ export function ObjectType_filterTypeDeclaration() {
4
4
  if (!this.configuration.features.has("Object.filter")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -17,9 +17,9 @@ export function NamedObjectType_filterTypeDeclaration() {
17
17
  }
18
18
  }
19
19
  for (const parentObjectType of this.parentObjectTypes) {
20
- members.push(code `${parentObjectType.name}.Filter`);
20
+ members.push(code `${parentObjectType.alias.unsafeCoerce()}.Filter`);
21
21
  }
22
22
  return Maybe.of(code `\
23
23
  export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
24
24
  }
25
- //# sourceMappingURL=NamedObjectType_filterTypeDeclaration.js.map
25
+ //# sourceMappingURL=ObjectType_filterTypeDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_focusSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
@@ -6,7 +6,7 @@ const variables = {
6
6
  focusIdentifier: code `parameters.focusIdentifier`,
7
7
  variablePrefix: code `parameters.variablePrefix`,
8
8
  };
9
- export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
9
+ export function ObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
10
10
  if (!this.configuration.features.has("Object.SPARQL")) {
11
11
  return Maybe.empty();
12
12
  }
@@ -15,7 +15,7 @@ export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration()
15
15
  let triplesVariableDeclarationKeyword = "const";
16
16
  const statements = [];
17
17
  for (const parentObjectType of this.parentObjectTypes) {
18
- statements.push(code `triples = triples.concat(${parentObjectType.name}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
18
+ statements.push(code `triples = triples.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
19
19
  triplesVariableDeclarationKeyword = "let";
20
20
  }
21
21
  if (this.fromRdfType.isJust()) {
@@ -51,4 +51,4 @@ ${statements.length > 0
51
51
  : "return [];"}
52
52
  };`);
53
53
  }
54
- //# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
54
+ //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_focusSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -7,7 +7,7 @@ const variables = {
7
7
  focusIdentifier: code `parameters.focusIdentifier`,
8
8
  variablePrefix: code `parameters.variablePrefix`,
9
9
  };
10
- export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
10
+ export function ObjectType_focusSparqlWherePatternsFunctionDeclaration() {
11
11
  if (!this.configuration.features.has("Object.SPARQL")) {
12
12
  return Maybe.empty();
13
13
  }
@@ -17,7 +17,7 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
17
17
  const statements = [];
18
18
  for (const parentObjectType of this.parentObjectTypes) {
19
19
  statements.push(code `\
20
- patterns = patterns.concat(${parentObjectType.name}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
20
+ patterns = patterns.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
21
21
  patternsVariableDeclarationKeyword = "let";
22
22
  }
23
23
  if (this.fromRdfType.isJust()) {
@@ -99,4 +99,4 @@ ${statements.length > 0
99
99
  : "return [];"}
100
100
  };`);
101
101
  }
102
- //# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
102
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromJsonFunctionDeclaration() {
3
+ export function ObjectType_fromJsonFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.fromJson")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -10,7 +10,7 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
10
10
  const chains = [];
11
11
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
12
12
  chains.push({
13
- expression: code `${parentObjectType.name}.fromJson(${variables.jsonObject})`,
13
+ expression: code `${parentObjectType.alias.unsafeCoerce()}.fromJson(${variables.jsonObject})`,
14
14
  variable: `super${parentObjectTypeI}`,
15
15
  });
16
16
  });
@@ -36,8 +36,8 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
36
36
  break;
37
37
  }
38
38
  return Maybe.of(code `\
39
- export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.name}> {
39
+ export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
40
40
  return ${returnExpression};
41
41
  }`);
42
42
  }
43
- //# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.js.map
43
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
3
+ export function ObjectType_fromRdfResourceFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.fromRdf")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -25,7 +25,7 @@ export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
25
25
  const partials = [];
26
26
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
27
27
  chains.push({
28
- expression: code `${parentObjectType.name}._fromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
28
+ expression: code `${parentObjectType.alias.unsafeCoerce()}._fromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
29
29
  variable: `super${parentObjectTypeI}`,
30
30
  });
31
31
  partials.push(`super${parentObjectTypeI}`);
@@ -71,10 +71,10 @@ export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
71
71
  .reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(${resultExpression})`)}`;
72
72
  }
73
73
  return Maybe.of(code `\
74
- export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.name}> = (${variables.resource}, ${optionsVariable}) => {
74
+ export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.expression}> = (${variables.resource}, ${optionsVariable}) => {
75
75
  return ${returnExpression};
76
76
  }
77
77
 
78
78
  export const fromRdfResource = ${this.reusables.snippets.wrap_FromRdfResourceFunction}(_fromRdfResource);`);
79
79
  }
80
- //# sourceMappingURL=NamedObjectType_fromRdfResourceFunctionDeclaration.js.map
80
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_fromRdfResourceValuesFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.fromRdf")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
8
+ export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.alias.unsafeCoerce()}> = (values, options) =>
9
+ values.chain(
10
+ values => values.chainMap(
11
+ value => value.toResource().chain(resource => ${this.alias.unsafeCoerce()}.fromRdfResource(resource, options))
12
+ )
13
+ );`);
14
+ }
15
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromRdfTypeVariableStatement() {
3
+ export function ObjectType_fromRdfTypeVariableStatement() {
4
4
  if (!this.configuration.features.has("Object.fromRdf")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return this.fromRdfType.map((fromRdfType) => code `\
8
8
  export const fromRdfType: ${this.reusables.imports.NamedNode}<string> = ${this.rdfjsTermExpression(fromRdfType)};`);
9
9
  }
10
- //# sourceMappingURL=NamedObjectType_fromRdfTypeVariableStatement.js.map
10
+ //# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_graphqlTypeVariableStatement() {
3
+ export function ObjectType_graphqlTypeVariableStatement() {
4
4
  if (!this.configuration.features.has("GraphQL")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -8,7 +8,7 @@ export function NamedObjectType_graphqlTypeVariableStatement() {
8
8
  return Maybe.empty();
9
9
  }
10
10
  return Maybe.of(code `\
11
- export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.name}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
11
+ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
12
12
  description: this.comment.extract(),
13
13
  fields: code `() => (${this.properties.reduce((fields, property) => {
14
14
  property.graphqlField.ifJust((field) => {
@@ -27,7 +27,7 @@ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.na
27
27
  });
28
28
  return fields;
29
29
  }, {})})`,
30
- name: this.name,
30
+ name: this.alias.unsafeCoerce(),
31
31
  }});`);
32
32
  }
33
- //# sourceMappingURL=NamedObjectType_graphqlTypeVariableStatement.js.map
33
+ //# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.js.map
@@ -0,0 +1,4 @@
1
+ import type { ObjectType } from "../ObjectType.js";
2
+ import { type Code } from "../ts-poet-wrapper.js";
3
+ export declare function ObjectType_hashFunctionDeclarations(this: ObjectType): readonly Code[];
4
+ //# sourceMappingURL=ObjectType_hashFunctionDeclarations.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
2
  const hasherVariable = code `hasher`;
3
- export function NamedObjectType_hashFunctionDeclarations() {
3
+ export function ObjectType_hashFunctionDeclarations() {
4
4
  if (!this.configuration.features.has("Object.hash")) {
5
5
  return [];
6
6
  }
@@ -17,9 +17,9 @@ export function NamedObjectType_hashFunctionDeclarations() {
17
17
  const hashShaclPropertiesStatements = [];
18
18
  const hashStatements = [];
19
19
  for (const parentObjectType of this.parentObjectTypes) {
20
- hashShaclPropertiesStatements.push(code `${parentObjectType.name}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
20
+ hashShaclPropertiesStatements.push(code `${parentObjectType.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
21
21
  }
22
- hashStatements.push(code `${this.name}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
22
+ hashStatements.push(code `${this.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`);
23
23
  hashShaclPropertiesStatements.push(...hashOwnShaclPropertiesStatements);
24
24
  hashShaclPropertiesStatements.push(code `return ${hasherVariable};`);
25
25
  hashStatements.push(...this.properties
@@ -33,13 +33,13 @@ export function NamedObjectType_hashFunctionDeclarations() {
33
33
  hashStatements.push(code `return ${hasherVariable};`);
34
34
  return [
35
35
  code `\
36
- export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.name}): HasherT {
36
+ export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
37
37
  ${joinCode(hashStatements)}
38
38
  }`,
39
39
  code `\
40
- export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.name}): HasherT {
40
+ export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
41
41
  ${joinCode(hashShaclPropertiesStatements)}
42
42
  }`,
43
43
  ];
44
44
  }
45
- //# sourceMappingURL=NamedObjectType_hashFunctionDeclarations.js.map
45
+ //# sourceMappingURL=ObjectType_hashFunctionDeclarations.js.map
@@ -0,0 +1,4 @@
1
+ import type { ObjectType } from "../ObjectType.js";
2
+ import { type Code } from "../ts-poet-wrapper.js";
3
+ export declare function ObjectType_interfaceDeclaration(this: ObjectType): Code;
4
+ //# sourceMappingURL=ObjectType_interfaceDeclaration.d.ts.map
@@ -1,16 +1,16 @@
1
1
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
2
  import { tsComment } from "../tsComment.js";
3
- export function NamedObjectType_interfaceDeclaration() {
3
+ export function ObjectType_interfaceDeclaration() {
4
4
  return code `\
5
5
  ${this.comment
6
6
  .alt(this.label)
7
7
  .map(tsComment)
8
- .orDefault("")}export interface ${this.name}${this.parentObjectTypes.length > 0
8
+ .orDefault("")}export interface ${this.alias.unsafeCoerce()}${this.parentObjectTypes.length > 0
9
9
  ? ` extends ${this.parentObjectTypes
10
- .map((parentObjectType) => parentObjectType.name)
10
+ .map((parentObjectType) => parentObjectType.alias.unsafeCoerce())
11
11
  .join(", ")}`
12
12
  : ""} {
13
13
  ${joinCode(this.properties.map((property) => property.declaration), { on: "\n\n" })}
14
14
  }`;
15
15
  }
16
- //# sourceMappingURL=NamedObjectType_interfaceDeclaration.js.map
16
+ //# sourceMappingURL=ObjectType_interfaceDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_isTypeFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_isTypeFunctionDeclaration() {
3
+ export function ObjectType_isTypeFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.type")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
8
- export function is${this.name}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${this.name} {
8
+ export function is${this.alias.unsafeCoerce()}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${this.alias.unsafeCoerce()} {
9
9
  switch (object.${this._discriminantProperty.name}) {
10
10
  ${this._discriminantProperty.type.descendantValues
11
11
  .concat(this._discriminantProperty.type.ownValues)
@@ -14,4 +14,4 @@ export function is${this.name}(object: ${this.configuration.syntheticNamePrefix}
14
14
  }
15
15
  }`);
16
16
  }
17
- //# sourceMappingURL=NamedObjectType_isTypeFunctionDeclaration.js.map
17
+ //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_jsonParseFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.d.ts.map