@shaclmate/compiler 2.0.20 → 2.0.23

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 (172) hide show
  1. package/dist/ShapesGraphToAstTransformer.d.ts +1 -0
  2. package/dist/ShapesGraphToAstTransformer.js +56 -12
  3. package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.d.ts +13 -0
  4. package/dist/_ShapesGraphToAstTransformer/flattenAstObjectCompositeTypeMemberTypes.js +51 -0
  5. package/dist/_ShapesGraphToAstTransformer/shapeAstName.js +53 -12
  6. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +5 -0
  7. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +130 -54
  8. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.d.ts +2 -3
  9. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstCompositeType.js +122 -129
  10. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstIdentifierType.d.ts +2 -2
  11. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstLiteralType.d.ts +2 -2
  12. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +127 -5
  13. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstTermType.d.ts +3 -3
  14. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstType.d.ts +2 -3
  15. package/dist/ast/Ast.d.ts +0 -1
  16. package/dist/ast/Curie.d.ts +14 -0
  17. package/dist/ast/Curie.js +21 -0
  18. package/dist/ast/IdentifierType.d.ts +3 -2
  19. package/dist/ast/ListType.d.ts +2 -1
  20. package/dist/ast/LiteralType.d.ts +1 -1
  21. package/dist/ast/Name.d.ts +40 -5
  22. package/dist/ast/ObjectCompositeType.d.ts +11 -0
  23. package/dist/ast/ObjectType.d.ts +18 -13
  24. package/dist/ast/ObjectUnionType.d.ts +0 -11
  25. package/dist/ast/OptionType.d.ts +2 -2
  26. package/dist/ast/SetType.d.ts +2 -2
  27. package/dist/ast/TermType.d.ts +12 -4
  28. package/dist/ast/Type.d.ts +1 -1
  29. package/dist/enums/TsFeature.d.ts +1 -4
  30. package/dist/enums/TsFeature.js +1 -15
  31. package/dist/generators/json/AstJsonGenerator.js +19 -3
  32. package/dist/generators/ts/BooleanType.d.ts +3 -1
  33. package/dist/generators/ts/BooleanType.js +11 -2
  34. package/dist/generators/ts/DateTimeType.d.ts +8 -7
  35. package/dist/generators/ts/DateTimeType.js +31 -7
  36. package/dist/generators/ts/DateType.d.ts +5 -2
  37. package/dist/generators/ts/DateType.js +15 -1
  38. package/dist/generators/ts/DeclaredType.d.ts +2 -2
  39. package/dist/generators/ts/DeclaredType.js +2 -2
  40. package/dist/generators/ts/FloatType.d.ts +6 -0
  41. package/dist/generators/ts/FloatType.js +18 -0
  42. package/dist/generators/ts/IdentifierType.d.ts +12 -7
  43. package/dist/generators/ts/IdentifierType.js +94 -6
  44. package/dist/generators/ts/Import.d.ts +2 -0
  45. package/dist/generators/ts/Import.js +10 -0
  46. package/dist/generators/ts/IntType.d.ts +6 -0
  47. package/dist/generators/ts/IntType.js +18 -0
  48. package/dist/generators/ts/ListType.d.ts +15 -12
  49. package/dist/generators/ts/ListType.js +98 -57
  50. package/dist/generators/ts/LiteralType.d.ts +10 -9
  51. package/dist/generators/ts/LiteralType.js +13 -2
  52. package/dist/generators/ts/NumberType.d.ts +2 -1
  53. package/dist/generators/ts/NumberType.js +7 -2
  54. package/dist/generators/ts/ObjectType.d.ts +66 -43
  55. package/dist/generators/ts/ObjectType.js +144 -123
  56. package/dist/generators/ts/ObjectUnionType.d.ts +49 -8
  57. package/dist/generators/ts/ObjectUnionType.js +290 -97
  58. package/dist/generators/ts/OptionType.d.ts +14 -10
  59. package/dist/generators/ts/OptionType.js +60 -34
  60. package/dist/generators/ts/PrimitiveType.d.ts +4 -4
  61. package/dist/generators/ts/PrimitiveType.js +18 -3
  62. package/dist/generators/ts/SetType.d.ts +16 -12
  63. package/dist/generators/ts/SetType.js +69 -40
  64. package/dist/generators/ts/SnippetDeclarations.d.ts +13 -8
  65. package/dist/generators/ts/SnippetDeclarations.js +215 -101
  66. package/dist/generators/ts/StringType.d.ts +3 -1
  67. package/dist/generators/ts/StringType.js +14 -2
  68. package/dist/generators/ts/TermType.d.ts +22 -14
  69. package/dist/generators/ts/TermType.js +53 -25
  70. package/dist/generators/ts/TsGenerator.d.ts +2 -1
  71. package/dist/generators/ts/TsGenerator.js +23 -12
  72. package/dist/generators/ts/Type.d.ts +89 -31
  73. package/dist/generators/ts/Type.js +57 -54
  74. package/dist/generators/ts/TypeFactory.d.ts +4 -5
  75. package/dist/generators/ts/TypeFactory.js +290 -226
  76. package/dist/generators/ts/UnionType.d.ts +14 -10
  77. package/dist/generators/ts/UnionType.js +319 -142
  78. package/dist/generators/ts/_ObjectType/EagerShaclProperty.d.ts +12 -0
  79. package/dist/generators/ts/_ObjectType/EagerShaclProperty.js +30 -0
  80. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +13 -12
  81. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +46 -47
  82. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +20 -13
  83. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +152 -124
  84. package/dist/generators/ts/_ObjectType/LazyShaclProperty.d.ts +87 -0
  85. package/dist/generators/ts/_ObjectType/LazyShaclProperty.js +237 -0
  86. package/dist/generators/ts/_ObjectType/Property.d.ts +39 -44
  87. package/dist/generators/ts/_ObjectType/Property.js +1 -10
  88. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +25 -30
  89. package/dist/generators/ts/_ObjectType/ShaclProperty.js +108 -85
  90. package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +21 -17
  91. package/dist/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +61 -53
  92. package/dist/generators/ts/_ObjectType/classDeclaration.js +6 -5
  93. package/dist/generators/ts/_ObjectType/createFunctionDeclaration.js +5 -4
  94. package/dist/generators/ts/_ObjectType/equalsFunctionOrMethodDeclaration.js +5 -4
  95. package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.d.ts +1 -1
  96. package/dist/generators/ts/_ObjectType/fromRdfTypeVariableStatement.js +8 -5
  97. package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.d.ts +5 -0
  98. package/dist/generators/ts/_ObjectType/graphqlTypeVariableStatement.js +37 -0
  99. package/dist/generators/ts/_ObjectType/hashFunctionOrMethodDeclarations.js +7 -8
  100. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +7 -0
  101. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +54 -0
  102. package/dist/generators/ts/_ObjectType/index.d.ts +9 -7
  103. package/dist/generators/ts/_ObjectType/index.js +9 -7
  104. package/dist/generators/ts/_ObjectType/interfaceDeclaration.js +1 -1
  105. package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.d.ts +4 -0
  106. package/dist/generators/ts/_ObjectType/jsonFunctionDeclarations.js +189 -0
  107. package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.d.ts +5 -0
  108. package/dist/generators/ts/_ObjectType/jsonTypeAliasDeclaration.js +28 -0
  109. package/dist/generators/ts/_ObjectType/objectSetMethodNames.d.ts +9 -0
  110. package/dist/generators/ts/_ObjectType/objectSetMethodNames.js +18 -0
  111. package/dist/generators/ts/_ObjectType/propertiesVariableStatement.d.ts +5 -0
  112. package/dist/generators/ts/_ObjectType/propertiesVariableStatement.js +37 -0
  113. package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.d.ts +4 -0
  114. package/dist/generators/ts/_ObjectType/rdfFunctionDeclarations.js +152 -0
  115. package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.d.ts +1 -1
  116. package/dist/generators/ts/_ObjectType/sparqlConstructQueryFunctionDeclaration.js +4 -3
  117. package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.d.ts +1 -1
  118. package/dist/generators/ts/_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js +3 -2
  119. package/dist/generators/ts/_ObjectType/sparqlFunctionDeclarations.js +103 -35
  120. package/dist/generators/ts/_ObjectType/toJsonFunctionOrMethodDeclaration.js +6 -6
  121. package/dist/generators/ts/_ObjectType/toRdfFunctionOrMethodDeclaration.js +15 -13
  122. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +9 -0
  123. package/dist/generators/ts/graphqlSchemaVariableStatement.js +86 -0
  124. package/dist/generators/ts/objectSetDeclarations.d.ts +8 -0
  125. package/dist/generators/ts/objectSetDeclarations.js +59 -0
  126. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +8 -0
  127. package/dist/generators/ts/objectSetInterfaceDeclaration.js +46 -0
  128. package/dist/generators/ts/objectSetMethodSignatures.d.ts +11 -0
  129. package/dist/generators/ts/objectSetMethodSignatures.js +52 -0
  130. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +8 -0
  131. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +393 -0
  132. package/dist/generators/ts/rdfjsTermExpression.d.ts +3 -0
  133. package/dist/generators/ts/rdfjsTermExpression.js +57 -0
  134. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +8 -0
  135. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +415 -0
  136. package/dist/generators/ts/syntheticNamePrefix.d.ts +2 -0
  137. package/dist/generators/ts/syntheticNamePrefix.js +2 -0
  138. package/dist/generators/ts/tsName.js +27 -13
  139. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +10 -0
  140. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +19 -0
  141. package/dist/input/NodeShape.d.ts +6 -8
  142. package/dist/input/NodeShape.js +20 -44
  143. package/dist/input/Ontology.d.ts +0 -3
  144. package/dist/input/Ontology.js +0 -9
  145. package/dist/input/PropertyPath.d.ts +6 -5
  146. package/dist/input/PropertyPath.js +14 -22
  147. package/dist/input/PropertyShape.d.ts +3 -1
  148. package/dist/input/PropertyShape.js +8 -2
  149. package/dist/input/ShapesGraph.js +4 -4
  150. package/dist/input/generated.d.ts +923 -105
  151. package/dist/input/generated.js +1865 -969
  152. package/dist/input/tsFeatures.d.ts +3 -2
  153. package/dist/input/tsFeatures.js +44 -27
  154. package/package.json +18 -16
  155. package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.d.ts +0 -4
  156. package/dist/generators/ts/_ObjectType/fromJsonFunctionDeclarations.js +0 -78
  157. package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.d.ts +0 -4
  158. package/dist/generators/ts/_ObjectType/fromRdfFunctionDeclarations.js +0 -91
  159. package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.d.ts +0 -5
  160. package/dist/generators/ts/_ObjectType/jsonSchemaFunctionDeclaration.js +0 -19
  161. package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  162. package/dist/generators/ts/_ObjectType/jsonUiSchemaFunctionDeclaration.js +0 -31
  163. package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  164. package/dist/generators/ts/_ObjectType/jsonZodSchemaFunctionDeclaration.js +0 -37
  165. package/dist/generators/ts/_ObjectType/rdfjsTermExpression.d.ts +0 -6
  166. package/dist/generators/ts/_ObjectType/rdfjsTermExpression.js +0 -17
  167. package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.d.ts +0 -5
  168. package/dist/generators/ts/_ObjectType/toJsonFunctionDeclaration.js +0 -19
  169. package/dist/generators/ts/_ObjectType/toJsonReturnType.d.ts +0 -3
  170. package/dist/generators/ts/_ObjectType/toJsonReturnType.js +0 -17
  171. package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +0 -5
  172. package/dist/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +0 -19
@@ -7,14 +7,90 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { camelCase, pascalCase } from "change-case";
8
8
  import { Maybe } from "purify-ts";
9
9
  import { invariant } from "ts-invariant";
10
- import { StructureKind, } from "ts-morph";
10
+ import { StructureKind, VariableDeclarationKind, } from "ts-morph";
11
11
  import { Memoize } from "typescript-memoize";
12
12
  import { DeclaredType } from "./DeclaredType.js";
13
+ import { Type } from "./Type.js";
13
14
  import { hasherTypeConstraint } from "./_ObjectType/hashFunctionOrMethodDeclarations.js";
15
+ import { objectSetMethodNames } from "./_ObjectType/objectSetMethodNames.js";
14
16
  import { sparqlConstructQueryFunctionDeclaration } from "./_ObjectType/sparqlConstructQueryFunctionDeclaration.js";
15
17
  import { sparqlConstructQueryStringFunctionDeclaration } from "./_ObjectType/sparqlConstructQueryStringFunctionDeclaration.js";
16
18
  import { objectInitializer } from "./objectInitializer.js";
19
+ import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
17
20
  import { tsComment } from "./tsComment.js";
21
+ class MemberType {
22
+ delegate;
23
+ universe;
24
+ constructor({ delegate, universe, }) {
25
+ this.delegate = delegate;
26
+ this.universe = universe;
27
+ }
28
+ get declarationType() {
29
+ return this.delegate.declarationType;
30
+ }
31
+ get discriminatorPropertyValues() {
32
+ // A member type's combined discriminator property values are its "own" values plus any descendant values that are
33
+ // not the "own" values of some other member type.
34
+ // So if you have type A, type B, and B inherits A, then
35
+ // A has
36
+ // own discriminator property values: ["A"]
37
+ // descendant discriminator property values: ["B"]
38
+ // and B has
39
+ // own discriminator property values: ["B"]
40
+ // descendant discriminator property values ["B"]
41
+ // In this case A shouldn't have "B" as a combined discriminator property value since it's "claimed" by B.
42
+ const memberOwnDiscriminatorPropertyValues = new Set();
43
+ for (const memberType of this.universe) {
44
+ for (const ownDiscriminatorPropertyValue of memberType.discriminatorProperty.unsafeCoerce()
45
+ .ownValues) {
46
+ memberOwnDiscriminatorPropertyValues.add(ownDiscriminatorPropertyValue);
47
+ }
48
+ }
49
+ return this.delegate._discriminatorProperty.ownValues.concat(this.delegate._discriminatorProperty.descendantValues.filter((value) => !memberOwnDiscriminatorPropertyValues.has(value)));
50
+ }
51
+ get features() {
52
+ return this.delegate.features;
53
+ }
54
+ get fromRdfType() {
55
+ return this.delegate.fromRdfType;
56
+ }
57
+ get fromRdfTypeVariable() {
58
+ return this.delegate.fromRdfTypeVariable;
59
+ }
60
+ get graphqlName() {
61
+ return this.delegate.graphqlName;
62
+ }
63
+ get identifierTypeAlias() {
64
+ return this.delegate.identifierTypeAlias;
65
+ }
66
+ get jsonName() {
67
+ return this.delegate.jsonName;
68
+ }
69
+ get mutable() {
70
+ return this.delegate.mutable;
71
+ }
72
+ get name() {
73
+ return this.delegate.name;
74
+ }
75
+ get staticModuleName() {
76
+ return this.delegate.staticModuleName;
77
+ }
78
+ get toRdfjsResourceType() {
79
+ return this.delegate.toRdfjsResourceType;
80
+ }
81
+ jsonZodSchema(parameters) {
82
+ return this.delegate.jsonZodSchema(parameters);
83
+ }
84
+ snippetDeclarations(parameters) {
85
+ return this.delegate.snippetDeclarations(parameters);
86
+ }
87
+ useImports() {
88
+ return this.delegate.useImports();
89
+ }
90
+ }
91
+ __decorate([
92
+ Memoize()
93
+ ], MemberType.prototype, "discriminatorPropertyValues", null);
18
94
  /**
19
95
  * A union of object types, generated as a type alias
20
96
  *
@@ -26,28 +102,34 @@ import { tsComment } from "./tsComment.js";
26
102
  * It also generates SPARQL graph patterns that UNION the member object types.
27
103
  */
28
104
  export class ObjectUnionType extends DeclaredType {
29
- kind = "ObjectUnionType";
30
105
  _discriminatorProperty;
31
106
  comment;
32
107
  label;
108
+ identifierType;
109
+ kind = "ObjectUnionType";
33
110
  memberTypes;
34
- constructor({ comment, label, memberTypes, ...superParameters }) {
111
+ typeof = "object";
112
+ constructor({ comment, identifierType, label, memberTypes, ...superParameters }) {
35
113
  super(superParameters);
36
114
  this.comment = comment;
115
+ this.identifierType = identifierType;
37
116
  this.label = label;
38
117
  invariant(memberTypes.length > 0);
39
- this.memberTypes = memberTypes;
118
+ const discriminatorPropertyDescendantValues = [];
40
119
  const discriminatorPropertyName = memberTypes[0].discriminatorProperty.unsafeCoerce().name;
41
- const discriminatorPropertyValues = [];
42
- for (const memberType of this.memberTypes) {
120
+ const discriminatorPropertyOwnValues = [];
121
+ for (const memberType of memberTypes) {
43
122
  invariant(memberType.declarationType === memberTypes[0].declarationType);
44
123
  invariant(memberType._discriminatorProperty.name === discriminatorPropertyName);
45
- discriminatorPropertyValues.push(...memberType._discriminatorProperty.values);
124
+ discriminatorPropertyDescendantValues.push(...memberType._discriminatorProperty.descendantValues);
125
+ discriminatorPropertyOwnValues.push(...memberType._discriminatorProperty.ownValues);
46
126
  }
47
127
  this._discriminatorProperty = {
128
+ descendantValues: discriminatorPropertyDescendantValues,
48
129
  name: discriminatorPropertyName,
49
- values: discriminatorPropertyValues,
130
+ ownValues: discriminatorPropertyOwnValues,
50
131
  };
132
+ this.memberTypes = memberTypes.map((memberType) => new MemberType({ delegate: memberType, universe: memberTypes }));
51
133
  }
52
134
  get conversions() {
53
135
  return [
@@ -59,26 +141,29 @@ export class ObjectUnionType extends DeclaredType {
59
141
  ];
60
142
  }
61
143
  get declarationImports() {
62
- return this.memberTypes.flatMap((memberType) => memberType.useImports(this.features));
144
+ return this.memberTypes.flatMap((memberType) => memberType.useImports());
63
145
  }
64
146
  get declarations() {
65
147
  const declarations = [this.typeAliasDeclaration];
66
- const moduleStatements = [
148
+ const staticModuleStatements = [
67
149
  ...this.equalsFunctionDeclaration.toList(),
68
150
  ...this.fromJsonFunctionDeclaration.toList(),
69
151
  ...this.fromRdfFunctionDeclaration.toList(),
152
+ ...this.graphqlTypeVariableStatement.toList(),
70
153
  ...this.hashFunctionDeclaration.toList(),
154
+ ...this.jsonTypeAliasDeclaration.toList(),
71
155
  ...this.jsonZodSchemaFunctionDeclaration.toList(),
156
+ ...this.identifierTypeDeclarations,
72
157
  ...this.sparqlFunctionDeclarations,
73
158
  ...this.toJsonFunctionDeclaration.toList(),
74
159
  ...this.toRdfFunctionDeclaration.toList(),
75
160
  ];
76
- if (moduleStatements.length > 0) {
161
+ if (staticModuleStatements.length > 0) {
77
162
  declarations.push({
78
163
  isExported: this.export,
79
164
  kind: StructureKind.Module,
80
- name: this.name,
81
- statements: moduleStatements,
165
+ name: this.staticModuleName,
166
+ statements: staticModuleStatements,
82
167
  });
83
168
  }
84
169
  return declarations;
@@ -87,16 +172,26 @@ export class ObjectUnionType extends DeclaredType {
87
172
  return Maybe.of(this._discriminatorProperty);
88
173
  }
89
174
  get equalsFunction() {
90
- return `${this.name}.equals`;
175
+ return `${this.staticModuleName}.${syntheticNamePrefix}equals`;
176
+ }
177
+ get graphqlName() {
178
+ return new Type.GraphqlName(`${this.staticModuleName}.${syntheticNamePrefix}GraphQL`);
179
+ }
180
+ get identifierTypeAlias() {
181
+ return `${this.staticModuleName}.${syntheticNamePrefix}Identifier`;
91
182
  }
92
183
  get jsonName() {
93
- return this.memberTypes
94
- .map((memberType) => memberType.jsonName)
95
- .join(" | ");
184
+ return new Type.JsonName(this.memberTypes.map((memberType) => memberType.jsonName).join(" | "));
96
185
  }
97
186
  get mutable() {
98
187
  return this.memberTypes.some((memberType) => memberType.mutable);
99
188
  }
189
+ get objectSetMethodNames() {
190
+ return objectSetMethodNames.bind(this)();
191
+ }
192
+ get staticModuleName() {
193
+ return this.name;
194
+ }
100
195
  get thisVariable() {
101
196
  return `_${camelCase(this.name)}`;
102
197
  }
@@ -108,18 +203,19 @@ export class ObjectUnionType extends DeclaredType {
108
203
  let returnExpression;
109
204
  switch (memberType.declarationType) {
110
205
  case "class":
111
- returnExpression = `left.equals(right as unknown as ${memberType.name})`;
206
+ returnExpression = `left.${syntheticNamePrefix}equals(right as unknown as ${memberType.name})`;
112
207
  break;
113
208
  case "interface":
114
- returnExpression = `${memberType.name}.equals(left, right as unknown as ${memberType.name})`;
209
+ returnExpression = `${memberType.staticModuleName}.${syntheticNamePrefix}equals(left, right as unknown as ${memberType.name})`;
115
210
  break;
116
211
  }
117
- return `case "${memberType.name}": return ${returnExpression};`;
212
+ return `${memberType.discriminatorPropertyValues.map((discriminatorPropertyValue) => `case "${discriminatorPropertyValue}":`).join("\n")} return ${returnExpression};`;
118
213
  });
214
+ caseBlocks.push('default: left satisfies never; throw new Error("unrecognized type");');
119
215
  return Maybe.of({
120
216
  isExported: true,
121
217
  kind: StructureKind.Function,
122
- name: "equals",
218
+ name: `${syntheticNamePrefix}equals`,
123
219
  parameters: [
124
220
  {
125
221
  name: "left",
@@ -130,9 +226,9 @@ export class ObjectUnionType extends DeclaredType {
130
226
  type: this.name,
131
227
  },
132
228
  ],
133
- returnType: "EqualsResult",
229
+ returnType: `${syntheticNamePrefix}EqualsResult`,
134
230
  statements: `\
135
- return strictEquals(left.type, right.type).chain(() => {
231
+ return ${syntheticNamePrefix}strictEquals(left.${syntheticNamePrefix}type, right.${syntheticNamePrefix}type).chain(() => {
136
232
  switch (left.${this._discriminatorProperty.name}) {
137
233
  ${caseBlocks.join(" ")}
138
234
  }
@@ -140,13 +236,13 @@ return strictEquals(left.type, right.type).chain(() => {
140
236
  });
141
237
  }
142
238
  get fromJsonFunctionDeclaration() {
143
- if (!this.features.has("fromJson")) {
239
+ if (!this.features.has("json")) {
144
240
  return Maybe.empty();
145
241
  }
146
242
  return Maybe.of({
147
243
  isExported: true,
148
244
  kind: StructureKind.Function,
149
- name: "fromJson",
245
+ name: `${syntheticNamePrefix}fromJson`,
150
246
  parameters: [
151
247
  {
152
248
  name: "json",
@@ -156,7 +252,7 @@ return strictEquals(left.type, right.type).chain(() => {
156
252
  returnType: `purify.Either<zod.ZodError, ${this.name}>`,
157
253
  statements: [
158
254
  `return ${this.memberTypes.reduce((expression, memberType) => {
159
- const memberTypeExpression = `(${memberType.name}.fromJson(json) as purify.Either<zod.ZodError, ${this.name}>)`;
255
+ const memberTypeExpression = `(${memberType.staticModuleName}.${syntheticNamePrefix}fromJson(json) as purify.Either<zod.ZodError, ${this.name}>)`;
160
256
  return expression.length > 0
161
257
  ? `${expression}.altLazy(() => ${memberTypeExpression})`
162
258
  : memberTypeExpression;
@@ -165,23 +261,23 @@ return strictEquals(left.type, right.type).chain(() => {
165
261
  });
166
262
  }
167
263
  get fromRdfFunctionDeclaration() {
168
- if (!this.features.has("fromRdf")) {
264
+ if (!this.features.has("rdf")) {
169
265
  return Maybe.empty();
170
266
  }
171
267
  return Maybe.of({
172
268
  isExported: true,
173
269
  kind: StructureKind.Function,
174
- name: "fromRdf",
270
+ name: `${syntheticNamePrefix}fromRdf`,
175
271
  parameters: [
176
272
  {
177
- name: "{ ignoreRdfType, resource, ...context }",
178
- type: `{ [_index: string]: any; ignoreRdfType?: boolean; resource: ${this.rdfjsResourceType().name}; }`,
273
+ name: "{ ignoreRdfType, objectSet, resource, ...context }",
274
+ type: `{ [_index: string]: any; ignoreRdfType?: boolean; objectSet?: ${syntheticNamePrefix}ObjectSet, resource: rdfjsResource.Resource; }`,
179
275
  },
180
276
  ],
181
- returnType: `purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>`,
277
+ returnType: `purify.Either<Error, ${this.name}>`,
182
278
  statements: [
183
279
  `return ${this.memberTypes.reduce((expression, memberType) => {
184
- const memberTypeExpression = `(${memberType.name}.fromRdf({ ...context, resource }) as purify.Either<rdfjsResource.Resource.ValueError, ${this.name}>)`;
280
+ const memberTypeExpression = `(${memberType.staticModuleName}.${syntheticNamePrefix}fromRdf({ ...context, objectSet, resource }) as purify.Either<Error, ${this.name}>)`;
185
281
  return expression.length > 0
186
282
  ? `${expression}.altLazy(() => ${memberTypeExpression})`
187
283
  : memberTypeExpression;
@@ -189,6 +285,27 @@ return strictEquals(left.type, right.type).chain(() => {
189
285
  ],
190
286
  });
191
287
  }
288
+ get graphqlTypeVariableStatement() {
289
+ if (!this.features.has("graphql")) {
290
+ return Maybe.empty();
291
+ }
292
+ return Maybe.of({
293
+ declarationKind: VariableDeclarationKind.Const,
294
+ kind: StructureKind.VariableStatement,
295
+ declarations: [
296
+ {
297
+ name: `${syntheticNamePrefix}GraphQL`,
298
+ initializer: `new graphql.GraphQLUnionType(${objectInitializer({
299
+ description: this.comment.map(JSON.stringify).extract(),
300
+ name: `"${this.name}"`,
301
+ resolveType: `function (value: ${this.name}) { return value.${syntheticNamePrefix}type; }`,
302
+ types: `[${this.memberTypes.map((memberType) => memberType.graphqlName.nullableName).join(", ")}]`,
303
+ })})`,
304
+ },
305
+ ],
306
+ isExported: true,
307
+ });
308
+ }
192
309
  get hashFunctionDeclaration() {
193
310
  if (!this.features.has("hash")) {
194
311
  return Maybe.empty();
@@ -198,18 +315,19 @@ return strictEquals(left.type, right.type).chain(() => {
198
315
  let returnExpression;
199
316
  switch (memberType.declarationType) {
200
317
  case "class":
201
- returnExpression = `${this.thisVariable}.hash(${hasherVariable})`;
318
+ returnExpression = `${this.thisVariable}.${syntheticNamePrefix}hash(${hasherVariable})`;
202
319
  break;
203
320
  case "interface":
204
- returnExpression = `${memberType.name}.${memberType.hashFunctionName}(${this.thisVariable}, ${hasherVariable})`;
321
+ returnExpression = `${memberType.staticModuleName}.${syntheticNamePrefix}hash(${this.thisVariable}, ${hasherVariable})`;
205
322
  break;
206
323
  }
207
- return `case "${memberType.name}": return ${returnExpression};`;
324
+ return `${memberType.discriminatorPropertyValues.map((discriminatorPropertyValue) => `case "${discriminatorPropertyValue}":`).join("\n")} return ${returnExpression};`;
208
325
  });
326
+ caseBlocks.push(`default: ${this.thisVariable} satisfies never; throw new Error("unrecognized type");`);
209
327
  return Maybe.of({
210
328
  isExported: true,
211
329
  kind: StructureKind.Function,
212
- name: "hash",
330
+ name: `${syntheticNamePrefix}hash`,
213
331
  parameters: [
214
332
  {
215
333
  name: this.thisVariable,
@@ -230,16 +348,48 @@ return strictEquals(left.type, right.type).chain(() => {
230
348
  ],
231
349
  });
232
350
  }
351
+ get identifierTypeDeclarations() {
352
+ return [
353
+ {
354
+ isExported: true,
355
+ kind: StructureKind.TypeAlias,
356
+ name: `${syntheticNamePrefix}Identifier`,
357
+ type: this.identifierType.name,
358
+ },
359
+ {
360
+ isExported: true,
361
+ kind: StructureKind.Module,
362
+ name: `${syntheticNamePrefix}Identifier`,
363
+ statements: [
364
+ this.identifierType.fromStringFunctionDeclaration,
365
+ this.identifierType.toStringFunctionDeclaration,
366
+ ],
367
+ },
368
+ ];
369
+ }
370
+ get jsonTypeAliasDeclaration() {
371
+ if (!this.features.has("json")) {
372
+ return Maybe.empty();
373
+ }
374
+ return Maybe.of({
375
+ isExported: true,
376
+ kind: StructureKind.TypeAlias,
377
+ name: `${syntheticNamePrefix}Json`,
378
+ type: this.memberTypes
379
+ .map((memberType) => memberType.jsonName)
380
+ .join(" | "),
381
+ });
382
+ }
233
383
  get jsonZodSchemaFunctionDeclaration() {
234
- if (!this.features.has("fromJson")) {
384
+ if (!this.features.has("json")) {
235
385
  return Maybe.empty();
236
386
  }
237
387
  const variables = { zod: "zod" };
238
388
  return Maybe.of({
239
389
  isExported: true,
240
390
  kind: StructureKind.Function,
241
- name: "jsonZodSchema",
242
- statements: `return ${variables.zod}.discriminatedUnion("${this._discriminatorProperty.name}", [${this.memberTypes.map((memberType) => memberType.jsonZodSchema({ variables })).join(", ")}]);`,
391
+ name: `${syntheticNamePrefix}jsonZodSchema`,
392
+ statements: `return ${variables.zod}.discriminatedUnion("${this._discriminatorProperty.name}", [${this.memberTypes.map((memberType) => memberType.jsonZodSchema({ context: "type", variables })).join(", ")}]);`,
243
393
  });
244
394
  }
245
395
  get sparqlFunctionDeclarations() {
@@ -252,10 +402,11 @@ return strictEquals(left.type, right.type).chain(() => {
252
402
  {
253
403
  isExported: true,
254
404
  kind: StructureKind.Function,
255
- name: "sparqlConstructTemplateTriples",
405
+ name: `${syntheticNamePrefix}sparqlConstructTemplateTriples`,
256
406
  // Accept ignoreRdfType in order to reuse code but don't pass it through, since deserialization may depend on it
257
407
  parameters: [
258
408
  {
409
+ hasQuestionToken: true,
259
410
  name: "parameters",
260
411
  type: '{ ignoreRdfType?: boolean, subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
261
412
  },
@@ -263,17 +414,18 @@ return strictEquals(left.type, right.type).chain(() => {
263
414
  returnType: "readonly sparqljs.Triple[]",
264
415
  statements: [
265
416
  `return [${this.memberTypes
266
- .map((memberType) => `...${memberType.name}.sparqlConstructTemplateTriples({ subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`)
417
+ .map((memberType) => `...${memberType.staticModuleName}.${syntheticNamePrefix}sparqlConstructTemplateTriples({ subject: parameters?.subject ?? dataFactory.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`)
267
418
  .join(", ")}];`,
268
419
  ],
269
420
  },
270
421
  {
271
422
  isExported: true,
272
423
  kind: StructureKind.Function,
273
- name: "sparqlWherePatterns",
424
+ name: `${syntheticNamePrefix}sparqlWherePatterns`,
274
425
  // Accept ignoreRdfType in order to reuse code but don't pass it through, since deserialization may depend on it
275
426
  parameters: [
276
427
  {
428
+ hasQuestionToken: true,
277
429
  name: "parameters",
278
430
  type: '{ ignoreRdfType?: boolean; subject?: sparqljs.Triple["subject"], variablePrefix?: string }',
279
431
  },
@@ -282,7 +434,7 @@ return strictEquals(left.type, right.type).chain(() => {
282
434
  statements: [
283
435
  `return [{ patterns: [${this.memberTypes
284
436
  .map((memberType) => objectInitializer({
285
- patterns: `${memberType.name}.sparqlWherePatterns({ subject: parameters.subject ?? ${this.dataFactoryVariable}.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`,
437
+ patterns: `${memberType.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns({ subject: parameters?.subject ?? dataFactory.variable!("${camelCase(this.name)}${pascalCase(memberType.name)}"), variablePrefix: parameters?.variablePrefix ? \`\${parameters.variablePrefix}${pascalCase(memberType.name)}\` : "${camelCase(this.name)}${pascalCase(memberType.name)}" }).concat()`,
286
438
  type: '"group"',
287
439
  }))
288
440
  .join(", ")}], type: "union" }];`,
@@ -291,37 +443,38 @@ return strictEquals(left.type, right.type).chain(() => {
291
443
  ];
292
444
  }
293
445
  get toJsonFunctionDeclaration() {
294
- if (!this.features.has("toJson")) {
446
+ if (!this.features.has("json")) {
295
447
  return Maybe.empty();
296
448
  }
297
449
  const caseBlocks = this.memberTypes.map((memberType) => {
298
450
  let returnExpression;
299
451
  switch (memberType.declarationType) {
300
452
  case "class":
301
- returnExpression = `${this.thisVariable}.toJson()`;
453
+ returnExpression = `${this.thisVariable}.${syntheticNamePrefix}toJson()`;
302
454
  break;
303
455
  case "interface":
304
- returnExpression = `${memberType.name}.toJson(${this.thisVariable})`;
456
+ returnExpression = `${memberType.staticModuleName}.${syntheticNamePrefix}toJson(${this.thisVariable})`;
305
457
  break;
306
458
  }
307
- return `case "${memberType.name}": return ${returnExpression};`;
459
+ return `${memberType.discriminatorPropertyValues.map((discriminatorPropertyValue) => `case "${discriminatorPropertyValue}":`).join("\n")} return ${returnExpression};`;
308
460
  });
461
+ caseBlocks.push(`default: ${this.thisVariable} satisfies never; throw new Error("unrecognized type");`);
309
462
  return Maybe.of({
310
463
  isExported: true,
311
464
  kind: StructureKind.Function,
312
- name: "toJson",
465
+ name: `${syntheticNamePrefix}toJson`,
313
466
  parameters: [
314
467
  {
315
468
  name: this.thisVariable,
316
469
  type: this.name,
317
470
  },
318
471
  ],
319
- returnType: this.jsonName,
472
+ returnType: this.jsonName.toString(),
320
473
  statements: `switch (${this.thisVariable}.${this._discriminatorProperty.name}) { ${caseBlocks.join(" ")} }`,
321
474
  });
322
475
  }
323
476
  get toRdfFunctionDeclaration() {
324
- if (!this.features.has("toRdf")) {
477
+ if (!this.features.has("rdf")) {
325
478
  return Maybe.empty();
326
479
  }
327
480
  const parametersVariable = "_parameters";
@@ -329,18 +482,19 @@ return strictEquals(left.type, right.type).chain(() => {
329
482
  let returnExpression;
330
483
  switch (memberType.declarationType) {
331
484
  case "class":
332
- returnExpression = `${this.thisVariable}.toRdf(${parametersVariable})`;
485
+ returnExpression = `${this.thisVariable}.${syntheticNamePrefix}toRdf(${parametersVariable})`;
333
486
  break;
334
487
  case "interface":
335
- returnExpression = `${memberType.name}.toRdf(${this.thisVariable}, ${parametersVariable})`;
488
+ returnExpression = `${memberType.staticModuleName}.${syntheticNamePrefix}toRdf(${this.thisVariable}, ${parametersVariable})`;
336
489
  break;
337
490
  }
338
- return `case "${memberType.name}": return ${returnExpression};`;
491
+ return `${memberType.discriminatorPropertyValues.map((discriminatorPropertyValue) => `case "${discriminatorPropertyValue}":`).join("\n")} return ${returnExpression};`;
339
492
  });
493
+ caseBlocks.push(`default: ${this.thisVariable} satisfies never; throw new Error("unrecognized type");`);
340
494
  return Maybe.of({
341
495
  isExported: true,
342
496
  kind: StructureKind.Function,
343
- name: "toRdf",
497
+ name: `${syntheticNamePrefix}toRdf`,
344
498
  parameters: [
345
499
  {
346
500
  name: this.thisVariable,
@@ -351,7 +505,20 @@ return strictEquals(left.type, right.type).chain(() => {
351
505
  type: "{ mutateGraph: rdfjsResource.MutableResource.MutateGraph, resourceSet: rdfjsResource.MutableResourceSet }",
352
506
  },
353
507
  ],
354
- returnType: this.rdfjsResourceType({ mutable: true }).name,
508
+ returnType: (() => {
509
+ let returnType;
510
+ for (const memberType of this.memberTypes) {
511
+ const memberRdfjsResourceType = memberType.toRdfjsResourceType;
512
+ if (typeof returnType === "undefined") {
513
+ returnType = memberRdfjsResourceType;
514
+ }
515
+ else if (memberRdfjsResourceType !== returnType) {
516
+ return "rdfjsResource.Resource";
517
+ }
518
+ }
519
+ // The types agree
520
+ return returnType;
521
+ })(),
355
522
  statements: `switch (${this.thisVariable}.${this._discriminatorProperty.name}) { ${caseBlocks.join(" ")} }`,
356
523
  });
357
524
  }
@@ -366,45 +533,65 @@ return strictEquals(left.type, right.type).chain(() => {
366
533
  }
367
534
  fromJsonExpression({ variables, }) {
368
535
  // Assumes the JSON object has been recursively validated already.
369
- return `${this.name}.fromJson(${variables.value}).unsafeCoerce()`;
536
+ return `${this.staticModuleName}.${syntheticNamePrefix}fromJson(${variables.value}).unsafeCoerce()`;
370
537
  }
371
538
  fromRdfExpression({ variables, }) {
372
539
  // Don't ignoreRdfType, we may need it to distinguish the union members
373
- return `${variables.resourceValues}.head().chain(value => value.to${this.rdfjsResourceType().named ? "Named" : ""}Resource()).chain(_resource => ${this.name}.fromRdf({ ...${variables.context}, languageIn: ${variables.languageIn}, resource: _resource }))`;
540
+ return `${variables.resourceValues}.head().chain(value => value.toResource()).chain(_resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdf({ ...${variables.context}, languageIn: ${variables.languageIn}, objectSet: ${variables.objectSet}, resource: _resource }))`;
541
+ }
542
+ graphqlResolveExpression({ variables, }) {
543
+ return variables.value;
374
544
  }
375
545
  hashStatements({ variables, }) {
376
546
  switch (this.memberTypes[0].declarationType) {
377
547
  case "class":
378
- return [`${variables.value}.hash(${variables.hasher});`];
548
+ return [
549
+ `${variables.value}.${syntheticNamePrefix}hash(${variables.hasher});`,
550
+ ];
379
551
  case "interface":
380
- return [`${this.name}.hash(${variables.value}, ${variables.hasher});`];
552
+ return [
553
+ `${this.staticModuleName}.${syntheticNamePrefix}hash(${variables.value}, ${variables.hasher});`,
554
+ ];
381
555
  }
382
556
  }
557
+ jsonUiSchemaElement() {
558
+ return Maybe.empty();
559
+ }
383
560
  jsonZodSchema() {
384
- return `${this.name}.jsonZodSchema()`;
561
+ return `${this.staticModuleName}.${syntheticNamePrefix}jsonZodSchema()`;
385
562
  }
386
- sparqlConstructTemplateTriples({ context, variables, }) {
387
- switch (context) {
388
- case "property":
389
- return super.sparqlConstructTemplateTriples({ context, variables });
390
- case "type":
563
+ snippetDeclarations(parameters) {
564
+ const { recursionStack } = parameters;
565
+ if (recursionStack.some((type) => Object.is(type, this))) {
566
+ return [];
567
+ }
568
+ recursionStack.push(this);
569
+ const result = this.memberTypes.flatMap((memberType) => memberType.snippetDeclarations(parameters));
570
+ invariant(Object.is(recursionStack.pop(), this));
571
+ return result;
572
+ }
573
+ sparqlConstructTemplateTriples(parameters) {
574
+ switch (parameters.context) {
575
+ case "object":
576
+ return super.sparqlConstructTemplateTriples(parameters);
577
+ case "subject":
391
578
  return [
392
- `...${this.name}.sparqlConstructTemplateTriples(${objectInitializer({
393
- subject: variables.subject,
394
- variablePrefix: variables.variablePrefix,
579
+ `...${this.staticModuleName}.${syntheticNamePrefix}sparqlConstructTemplateTriples(${objectInitializer({
580
+ subject: parameters.variables.subject,
581
+ variablePrefix: parameters.variables.variablePrefix,
395
582
  })})`,
396
583
  ];
397
584
  }
398
585
  }
399
- sparqlWherePatterns({ context, variables, }) {
400
- switch (context) {
401
- case "property":
402
- return super.sparqlWherePatterns({ context, variables });
403
- case "type":
586
+ sparqlWherePatterns(parameters) {
587
+ switch (parameters.context) {
588
+ case "object":
589
+ return super.sparqlWherePatterns(parameters);
590
+ case "subject":
404
591
  return [
405
- `...${this.name}.sparqlWherePatterns(${objectInitializer({
406
- subject: variables.subject,
407
- variablePrefix: variables.variablePrefix,
592
+ `...${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns(${objectInitializer({
593
+ subject: parameters.variables.subject,
594
+ variablePrefix: parameters.variables.variablePrefix,
408
595
  })})`,
409
596
  ];
410
597
  }
@@ -412,7 +599,7 @@ return strictEquals(left.type, right.type).chain(() => {
412
599
  toJsonExpression({ variables, }) {
413
600
  switch (this.memberTypes[0].declarationType) {
414
601
  case "class":
415
- return `${variables.value}.toJson()`;
602
+ return `${variables.value}.${syntheticNamePrefix}toJson()`;
416
603
  case "interface":
417
604
  throw new Error("not implemented: need a freestanding toJson function like the toRdf function");
418
605
  // return `${this.name}.toJson(${variables.value})`;
@@ -422,33 +609,39 @@ return strictEquals(left.type, right.type).chain(() => {
422
609
  const options = `{ mutateGraph: ${variables.mutateGraph}, resourceSet: ${variables.resourceSet} }`;
423
610
  switch (this.memberTypes[0].declarationType) {
424
611
  case "class":
425
- return `${variables.value}.toRdf(${options})`;
612
+ return `${variables.value}.${syntheticNamePrefix}toRdf(${options})`;
426
613
  case "interface":
427
- return `${this.name}.toRdf(${variables.value}, ${options})`;
614
+ return `${this.staticModuleName}.${syntheticNamePrefix}toRdf(${variables.value}, ${options})`;
428
615
  }
429
616
  }
430
617
  useImports() {
431
618
  return [];
432
619
  }
433
- rdfjsResourceType(options) {
434
- const memberRdfjsResourceTypes = [];
435
- for (const memberType of this.memberTypes) {
436
- const memberRdfjsResourceType = memberType.rdfjsResourceType(options);
437
- if (memberRdfjsResourceTypes.some((existingMemberRdfjsResourceType) => existingMemberRdfjsResourceType.name !==
438
- memberRdfjsResourceType.name)) {
439
- // The types don't agree, return a generic type
440
- return {
441
- mutable: !!options?.mutable,
442
- name: "rdfjsResource.Resource",
443
- named: false,
444
- };
445
- }
446
- memberRdfjsResourceTypes.push(memberRdfjsResourceType);
447
- }
448
- // The types agree
449
- return memberRdfjsResourceTypes[0];
450
- }
451
620
  }
621
+ __decorate([
622
+ Memoize()
623
+ ], ObjectUnionType.prototype, "conversions", null);
624
+ __decorate([
625
+ Memoize()
626
+ ], ObjectUnionType.prototype, "discriminatorProperty", null);
627
+ __decorate([
628
+ Memoize()
629
+ ], ObjectUnionType.prototype, "equalsFunction", null);
630
+ __decorate([
631
+ Memoize()
632
+ ], ObjectUnionType.prototype, "graphqlName", null);
633
+ __decorate([
634
+ Memoize()
635
+ ], ObjectUnionType.prototype, "identifierTypeAlias", null);
636
+ __decorate([
637
+ Memoize()
638
+ ], ObjectUnionType.prototype, "jsonName", null);
639
+ __decorate([
640
+ Memoize()
641
+ ], ObjectUnionType.prototype, "mutable", null);
642
+ __decorate([
643
+ Memoize()
644
+ ], ObjectUnionType.prototype, "objectSetMethodNames", null);
452
645
  __decorate([
453
646
  Memoize()
454
647
  ], ObjectUnionType.prototype, "thisVariable", null);