@shaclmate/compiler 4.0.57 → 4.0.60

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 (95) hide show
  1. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.js +5 -5
  2. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
  3. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.js +1 -1
  4. package/dist/ast/AbstractCompoundType.d.ts +3 -3
  5. package/dist/ast/AbstractCompoundType.js +1 -1
  6. package/dist/ast/AbstractContainerType.d.ts +2 -2
  7. package/dist/ast/AbstractContainerType.js +1 -1
  8. package/dist/ast/AbstractLazyType.d.ts +2 -2
  9. package/dist/ast/{UnionType.d.ts → DiscriminatedUnionType.d.ts} +7 -7
  10. package/dist/ast/{UnionType.js → DiscriminatedUnionType.js} +9 -8
  11. package/dist/ast/ListType.d.ts +2 -2
  12. package/dist/ast/ListType.js +1 -1
  13. package/dist/ast/StructCompoundType.d.ts +2 -2
  14. package/dist/ast/StructCompoundType.js +1 -1
  15. package/dist/ast/StructDiscriminatedUnionType.d.ts +4 -0
  16. package/dist/ast/StructDiscriminatedUnionType.js +2 -0
  17. package/dist/ast/StructType.js +1 -1
  18. package/dist/ast/Type.d.ts +2 -2
  19. package/dist/ast/Type.js +1 -1
  20. package/dist/ast/index.d.ts +2 -2
  21. package/dist/ast/index.js +2 -2
  22. package/dist/generators/transformAstToLabeledPropertyGraph.js +2 -2
  23. package/dist/generators/ts/AbstractCollectionType.d.ts +2 -2
  24. package/dist/generators/ts/AbstractContainerType.d.ts +5 -5
  25. package/dist/generators/ts/AbstractContainerType.js +2 -2
  26. package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
  27. package/dist/generators/ts/AbstractLazyType.d.ts +8 -8
  28. package/dist/generators/ts/AbstractLazyType.js +9 -9
  29. package/dist/generators/ts/AbstractLiteralType.d.ts +2 -2
  30. package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
  31. package/dist/generators/ts/AbstractObjectSetType.d.ts +4 -4
  32. package/dist/generators/ts/AbstractObjectSetType.js +4 -3
  33. package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -2
  34. package/dist/generators/ts/AbstractTermType.d.ts +2 -2
  35. package/dist/generators/ts/AbstractType.d.ts +15 -75
  36. package/dist/generators/ts/AbstractType.js +6 -63
  37. package/dist/generators/ts/AbstractTypedLiteralType.d.ts +2 -2
  38. package/dist/generators/ts/BigDecimalType.d.ts +1 -1
  39. package/dist/generators/ts/BigIntType.d.ts +1 -1
  40. package/dist/generators/ts/BooleanType.d.ts +1 -1
  41. package/dist/generators/ts/DateTimeType.d.ts +1 -1
  42. package/dist/generators/ts/DateType.d.ts +1 -1
  43. package/dist/generators/ts/DefaultValueType.d.ts +4 -4
  44. package/dist/generators/ts/DefaultValueType.js +2 -2
  45. package/dist/generators/ts/{UnionType.d.ts → DiscriminatedUnionType.d.ts} +6 -6
  46. package/dist/generators/ts/{UnionType.js → DiscriminatedUnionType.js} +31 -31
  47. package/dist/generators/ts/FloatType.d.ts +1 -1
  48. package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
  49. package/dist/generators/ts/GraphqlSchema.js +5 -4
  50. package/dist/generators/ts/IntType.d.ts +1 -1
  51. package/dist/generators/ts/LazyOptionType.d.ts +3 -3
  52. package/dist/generators/ts/ListType.d.ts +3 -3
  53. package/dist/generators/ts/ListType.js +2 -2
  54. package/dist/generators/ts/{ObjectUnionType.d.ts → ObjectDiscriminatedUnionType.d.ts} +4 -4
  55. package/dist/generators/ts/{ObjectUnionType.js → ObjectDiscriminatedUnionType.js} +8 -8
  56. package/dist/generators/ts/ObjectSetType.js +1 -1
  57. package/dist/generators/ts/ObjectType.d.ts +11 -11
  58. package/dist/generators/ts/ObjectType.js +6 -6
  59. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -5
  60. package/dist/generators/ts/SparqlObjectSetType.js +4 -1
  61. package/dist/generators/ts/StringType.d.ts +1 -1
  62. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  63. package/dist/generators/ts/TsGenerator.js +19 -19
  64. package/dist/generators/ts/Type.d.ts +3 -3
  65. package/dist/generators/ts/TypeFactory.d.ts +5 -5
  66. package/dist/generators/ts/TypeFactory.js +16 -16
  67. package/dist/generators/ts/ZodGenerator.js +5 -5
  68. package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.d.ts +10 -0
  69. package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.js +2 -0
  70. package/dist/generators/ts/_AbstractType/AbstractType_DiscriminantProperty.d.ts +9 -0
  71. package/dist/generators/ts/_AbstractType/AbstractType_DiscriminantProperty.js +2 -0
  72. package/dist/generators/ts/_AbstractType/AbstractType_GraphqlType.d.ts +18 -0
  73. package/dist/generators/ts/_AbstractType/AbstractType_GraphqlType.js +33 -0
  74. package/dist/generators/ts/_AbstractType/AbstractType_JsType.d.ts +34 -0
  75. package/dist/generators/ts/_AbstractType/AbstractType_JsType.js +16 -0
  76. package/dist/generators/ts/_AbstractType/AbstractType_JsonType.d.ts +16 -0
  77. package/dist/generators/ts/_AbstractType/AbstractType_JsonType.js +31 -0
  78. package/dist/generators/ts/_ObjectType/{AbstractProperty.d.ts → ObjectType_AbstractProperty.d.ts} +2 -2
  79. package/dist/generators/ts/_ObjectType/{AbstractProperty.js → ObjectType_AbstractProperty.js} +2 -2
  80. package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts +45 -0
  81. package/dist/generators/ts/_ObjectType/{DiscriminantProperty.js → ObjectType_DiscriminantProperty.js} +12 -9
  82. package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.d.ts +43 -0
  83. package/dist/generators/ts/_ObjectType/{IdentifierProperty.js → ObjectType_IdentifierProperty.js} +11 -11
  84. package/dist/generators/ts/_ObjectType/ObjectType_Property.d.ts +6 -0
  85. package/dist/generators/ts/_ObjectType/ObjectType_Property.js +2 -0
  86. package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.d.ts +53 -0
  87. package/dist/generators/ts/_ObjectType/{ShaclProperty.js → ObjectType_ShaclProperty.js} +10 -10
  88. package/package.json +34 -24
  89. package/dist/ast/StructUnionType.d.ts +0 -4
  90. package/dist/ast/StructUnionType.js +0 -2
  91. package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +0 -45
  92. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +0 -43
  93. package/dist/generators/ts/_ObjectType/Property.d.ts +0 -6
  94. package/dist/generators/ts/_ObjectType/Property.js +0 -2
  95. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +0 -53
@@ -19,9 +19,9 @@ export declare namespace AbstractPrimitiveType {
19
19
  type ConversionFunction = AbstractLiteralType.ConversionFunction;
20
20
  type DiscriminantProperty = AbstractLiteralType.DiscriminantProperty;
21
21
  type JsType = AbstractLiteralType.JsType;
22
- const GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
22
+ const GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
23
23
  type GraphqlType = AbstractLiteralType.GraphqlType;
24
- const JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
24
+ const JsonType: typeof import("./_AbstractType/AbstractType_JsonType.js").AbstractType_JsonType;
25
25
  type JsonType = AbstractLiteralType.JsonType;
26
26
  }
27
27
  //# sourceMappingURL=AbstractPrimitiveType.d.ts.map
@@ -41,10 +41,10 @@ export declare abstract class AbstractTermType<ConstantTermT extends Literal | N
41
41
  export declare namespace AbstractTermType {
42
42
  type ConversionFunction = AbstractType.ConversionFunction;
43
43
  type DiscriminantProperty = AbstractType.DiscriminantProperty;
44
- const GraphqlType: typeof AbstractType.GraphqlType;
44
+ const GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
45
45
  type GraphqlType = AbstractType.GraphqlType;
46
46
  type JsType = AbstractType.JsType;
47
- const JsonType: typeof AbstractType.JsonType;
47
+ const JsonType: typeof import("./_AbstractType/AbstractType_JsonType.js").AbstractType_JsonType;
48
48
  type JsonType = AbstractType.JsonType;
49
49
  }
50
50
  //# sourceMappingURL=AbstractTermType.d.ts.map
@@ -1,6 +1,11 @@
1
1
  import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import type { Maybe } from "purify-ts";
3
3
  import type { Logger } from "ts-log";
4
+ import type { AbstractType_ConversionFunction } from "./_AbstractType/AbstractType_ConversionFunction.js";
5
+ import type { AbstractType_DiscriminantProperty } from "./_AbstractType/AbstractType_DiscriminantProperty.js";
6
+ import { AbstractType_GraphqlType } from "./_AbstractType/AbstractType_GraphqlType.js";
7
+ import { AbstractType_JsonType } from "./_AbstractType/AbstractType_JsonType.js";
8
+ import { AbstractType_JsType } from "./_AbstractType/AbstractType_JsType.js";
4
9
  import type { Reusables } from "./Reusables.js";
5
10
  import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
6
11
  import type { TsGenerator } from "./TsGenerator.js";
@@ -202,7 +207,7 @@ export declare abstract class AbstractType {
202
207
  *
203
208
  * This method is called in two contexts:
204
209
  * "property": from a ShaclProperty, while generating the z.object properties of an ObjectType
205
- * "type": from another Type e.g., an OptionType or UnionType
210
+ * "type": from another Type e.g., an OptionType or DiscriminatedUnionType
206
211
  *
207
212
  * z.lazy() should only be returned for "property".
208
213
  */
@@ -265,81 +270,16 @@ export declare abstract class AbstractType {
265
270
  protected readonly rdfjsTermExpression: (parameters: Parameters<typeof rdfjsTermExpression>[0]) => Code;
266
271
  }
267
272
  export declare namespace AbstractType {
268
- interface ConversionFunction {
269
- readonly code: Code;
270
- readonly sourceTypes: {
271
- readonly expression: Code;
272
- readonly jsType: JsType;
273
- }[];
274
- }
275
- interface DiscriminantProperty {
276
- readonly jsonName: string;
277
- readonly name: string;
278
- readonly values: readonly DiscriminantProperty.Value[];
279
- }
273
+ type ConversionFunction = AbstractType_ConversionFunction;
274
+ type DiscriminantProperty = AbstractType_DiscriminantProperty;
280
275
  namespace DiscriminantProperty {
281
- type Value = number | string;
282
- }
283
- class GraphqlType {
284
- /**
285
- * Is the type nullable in GraphQL?
286
- */
287
- readonly nullable: boolean;
288
- /**
289
- * The expression of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
290
- */
291
- readonly nullableExpression: Code;
292
- private readonly reusables;
293
- constructor(nullableExpression: Code, reusables: Reusables, options?: {
294
- nullable: boolean;
295
- });
296
- get expression(): Code;
297
- }
298
- type JsType = {
299
- typeof: "bigint";
300
- } | {
301
- typeof: "boolean";
302
- } | {
303
- typeof: "function";
304
- } | {
305
- typeof: "number";
306
- } | {
307
- instanceof: "Array";
308
- typeof: "object";
309
- } | {
310
- className: Code;
311
- instanceof: "class";
312
- typeof: "object";
313
- } | {
314
- instanceof: "Date";
315
- typeof: "object";
316
- } | {
317
- instanceof: "Maybe";
318
- typeof: "object";
319
- } | {
320
- instanceof: "Object";
321
- typeof: "object";
322
- } | {
323
- typeof: "string";
324
- } | {
325
- typeof: "undefined";
326
- };
327
- namespace JsType {
328
- function equals(left: JsType, right: JsType): boolean;
329
- }
330
- class JsonType {
331
- /**
332
- * Is the type optional in JSON? Equivalent to ? in TypeScript or | undefined.
333
- */
334
- readonly optional: boolean;
335
- /**
336
- * The expression of the type when it's required i.e. -- so it should never include "| undefined".
337
- */
338
- readonly requiredExpression: Code;
339
- constructor(requiredExpression: Code, parameters?: {
340
- optional: boolean;
341
- });
342
- get expression(): Code;
276
+ type Value = AbstractType_DiscriminantProperty.Value;
343
277
  }
278
+ const GraphqlType: typeof AbstractType_GraphqlType;
279
+ type GraphqlType = AbstractType_GraphqlType;
280
+ type JsType = AbstractType_JsType;
281
+ const JsType: typeof AbstractType_JsType;
282
+ const JsonType: typeof AbstractType_JsonType;
283
+ type JsonType = AbstractType_JsonType;
344
284
  }
345
285
  //# sourceMappingURL=AbstractType.d.ts.map
@@ -5,6 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { Memoize } from "typescript-memoize";
8
+ import { AbstractType_GraphqlType } from "./_AbstractType/AbstractType_GraphqlType.js";
9
+ import { AbstractType_JsonType } from "./_AbstractType/AbstractType_JsonType.js";
10
+ import { AbstractType_JsType } from "./_AbstractType/AbstractType_JsType.js";
8
11
  import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
9
12
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
10
13
  /**
@@ -68,68 +71,8 @@ __decorate([
68
71
  Memoize()
69
72
  ], AbstractType.prototype, "schemaExpression", null);
70
73
  (function (AbstractType) {
71
- class GraphqlType {
72
- /**
73
- * Is the type nullable in GraphQL?
74
- */
75
- nullable;
76
- /**
77
- * The expression of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
78
- */
79
- nullableExpression;
80
- reusables;
81
- constructor(nullableExpression, reusables, options) {
82
- this.nullable = !!options?.nullable;
83
- this.nullableExpression = nullableExpression;
84
- this.reusables = reusables;
85
- }
86
- get expression() {
87
- return this.nullable
88
- ? this.nullableExpression
89
- : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableExpression})`;
90
- }
91
- }
92
- __decorate([
93
- Memoize()
94
- ], GraphqlType.prototype, "expression", null);
95
- AbstractType.GraphqlType = GraphqlType;
96
- let JsType;
97
- (function (JsType) {
98
- function equals(left, right) {
99
- if (left.typeof !== right.typeof) {
100
- return false;
101
- }
102
- if (left.typeof === "object" &&
103
- right.typeof === "object" &&
104
- left.instanceof !== right.instanceof) {
105
- return false;
106
- }
107
- return true;
108
- }
109
- JsType.equals = equals;
110
- })(JsType = AbstractType.JsType || (AbstractType.JsType = {}));
111
- class JsonType {
112
- /**
113
- * Is the type optional in JSON? Equivalent to ? in TypeScript or | undefined.
114
- */
115
- optional;
116
- /**
117
- * The expression of the type when it's required i.e. -- so it should never include "| undefined".
118
- */
119
- requiredExpression;
120
- constructor(requiredExpression, parameters) {
121
- this.optional = !!parameters?.optional;
122
- this.requiredExpression = requiredExpression;
123
- }
124
- get expression() {
125
- return this.optional
126
- ? code `(${this.requiredExpression}) | undefined`
127
- : this.requiredExpression;
128
- }
129
- }
130
- __decorate([
131
- Memoize()
132
- ], JsonType.prototype, "expression", null);
133
- AbstractType.JsonType = JsonType;
74
+ AbstractType.GraphqlType = AbstractType_GraphqlType;
75
+ AbstractType.JsType = AbstractType_JsType;
76
+ AbstractType.JsonType = AbstractType_JsonType;
134
77
  })(AbstractType || (AbstractType = {}));
135
78
  //# sourceMappingURL=AbstractType.js.map
@@ -23,10 +23,10 @@ export declare abstract class AbstractTypedLiteralType<ValueT> extends AbstractL
23
23
  export declare namespace AbstractTypedLiteralType {
24
24
  type ConversionFunction = AbstractTermType.ConversionFunction;
25
25
  type DiscriminantProperty = AbstractTermType.DiscriminantProperty;
26
- const GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
26
+ const GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
27
27
  type GraphqlType = AbstractTermType.GraphqlType;
28
28
  type JsType = AbstractTermType.JsType;
29
- const JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
29
+ const JsonType: typeof import("./_AbstractType/AbstractType_JsonType.js").AbstractType_JsonType;
30
30
  type JsonType = AbstractTermType.JsonType;
31
31
  }
32
32
  //# sourceMappingURL=AbstractTypedLiteralType.d.ts.map
@@ -18,7 +18,7 @@ export declare class BigDecimalType extends AbstractTypedLiteralType<Decimal> {
18
18
  readonly kind = "BigDecimal";
19
19
  readonly schemaType: Code;
20
20
  readonly valueSparqlWherePatternsFunction: Code;
21
- get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
21
+ get graphqlType(): import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
22
22
  fromJsonExpression({ variables, }: Parameters<AbstractLiteralType["fromJsonExpression"]>[0]): Code;
23
23
  graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
24
24
  jsonSchema(): Code;
@@ -7,7 +7,7 @@ export declare class BigIntType extends AbstractNumericType<bigint> {
7
7
  }[];
8
8
  readonly kind = "BigInt";
9
9
  get fromRdfResourceValuesFunction(): Code;
10
- get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
10
+ get graphqlType(): import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
11
11
  fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
12
12
  jsonSchema(_parameters: Parameters<AbstractNumericType<bigint>["jsonSchema"]>[0]): Code;
13
13
  jsonType(): AbstractNumericType.JsonType;
@@ -4,7 +4,7 @@ import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class BooleanType extends AbstractPrimitiveType<boolean> {
5
5
  readonly filterFunction: Code;
6
6
  readonly filterType: Code;
7
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
+ readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
8
8
  readonly hashFunction: Code;
9
9
  readonly jsTypes: readonly [{
10
10
  readonly typeof: "boolean";
@@ -2,7 +2,7 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class DateTimeType extends AbstractDateType {
5
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
5
+ readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
6
6
  readonly hashFunction: Code;
7
7
  readonly kind = "DateTime";
8
8
  get fromRdfResourceValuesFunction(): Code;
@@ -2,7 +2,7 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractDateType } from "./AbstractDateType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class DateType extends AbstractDateType {
5
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
5
+ readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
6
6
  readonly hashFunction: Code;
7
7
  readonly kind = "Date";
8
8
  get fromRdfResourceValuesFunction(): Code;
@@ -9,7 +9,7 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
9
9
  readonly defaultValue: Literal | NamedNode;
10
10
  readonly discriminantProperty: Maybe<AbstractType.DiscriminantProperty>;
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
- readonly jsTypes: readonly AbstractType.JsType[] | readonly [{
12
+ readonly jsTypes: readonly import("./_AbstractType/AbstractType_JsType.js").AbstractType_JsType[] | readonly [{
13
13
  readonly instanceof: "Object";
14
14
  readonly typeof: "object";
15
15
  }] | readonly [{
@@ -35,6 +35,9 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
35
35
  }] | readonly [{
36
36
  readonly instanceof: "Object";
37
37
  readonly typeof: "object";
38
+ }] | readonly [{
39
+ readonly instanceof: "Array";
40
+ readonly typeof: "object";
38
41
  }] | readonly [{
39
42
  readonly instanceof: "Object";
40
43
  readonly typeof: "object";
@@ -43,9 +46,6 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
43
46
  readonly typeof: "object";
44
47
  }] | readonly [{
45
48
  readonly typeof: "string";
46
- }] | readonly [{
47
- readonly instanceof: "Array";
48
- readonly typeof: "object";
49
49
  }] | readonly [{
50
50
  readonly instanceof: "Object";
51
51
  readonly typeof: "object";
@@ -80,8 +80,8 @@ export class DefaultValueType extends AbstractContainerType {
80
80
  return this.rdfjsTermExpression(this.defaultValue);
81
81
  case "List":
82
82
  case "Object":
83
- case "ObjectUnion":
84
- case "Union":
83
+ case "ObjectDiscriminatedUnion":
84
+ case "DiscriminatedUnion":
85
85
  throw new RangeError(`not implemented ${this.itemType.kind}`);
86
86
  }
87
87
  invariant(this.defaultValue.termType === "Literal");
@@ -6,17 +6,17 @@ import type { IriType } from "./IriType.js";
6
6
  import type { Type } from "./Type.js";
7
7
  import type { Typeof } from "./Typeof.js";
8
8
  import { type Code } from "./ts-poet-wrapper.js";
9
- export declare class UnionType<MemberTypeT extends Type> extends AbstractType {
9
+ export declare class DiscriminatedUnionType<MemberTypeT extends Type> extends AbstractType {
10
10
  private readonly discriminant;
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
12
  readonly identifierType: Maybe<BlankNodeType | IdentifierType | IriType>;
13
- readonly kind: "ObjectUnion" | "Union";
13
+ readonly kind: "ObjectDiscriminatedUnion" | "DiscriminatedUnion";
14
14
  readonly recursive: boolean;
15
15
  readonly synthetic: boolean;
16
16
  readonly validationFunction: Maybe<Code>;
17
17
  constructor({ identifierType, members, recursive, synthetic, ...superParameters }: {
18
18
  identifierType: Maybe<BlankNodeType | IdentifierType | IriType>;
19
- members: readonly (Pick<AbstractUnionType.Member<MemberTypeT>, "type"> & {
19
+ members: readonly (Pick<DiscriminatedUnionType.Member<MemberTypeT>, "type"> & {
20
20
  readonly discriminantValue: Maybe<number | string>;
21
21
  })[];
22
22
  recursive: boolean;
@@ -35,7 +35,7 @@ export declare class UnionType<MemberTypeT extends Type> extends AbstractType {
35
35
  get jsTypes(): AbstractType["jsTypes"];
36
36
  get jsonSchemaFunctionDeclaration(): Code;
37
37
  get jsonTypeAliasDeclaration(): Code;
38
- get members(): readonly AbstractUnionType.Member<MemberTypeT>[];
38
+ get members(): readonly DiscriminatedUnionType.Member<MemberTypeT>[];
39
39
  get mutable(): boolean;
40
40
  get referencesNamedType(): boolean;
41
41
  get schema(): Code;
@@ -109,7 +109,7 @@ export declare namespace Discriminant {
109
109
  readonly type: Type;
110
110
  }[]): Discriminant;
111
111
  }
112
- export declare namespace AbstractUnionType {
112
+ export declare namespace DiscriminatedUnionType {
113
113
  interface Member<TypeT extends Type> {
114
114
  readonly discriminantValues: readonly AbstractType.DiscriminantProperty.Value[];
115
115
  readonly jsonType: Code;
@@ -123,4 +123,4 @@ export declare namespace AbstractUnionType {
123
123
  }
124
124
  }
125
125
  export {};
126
- //# sourceMappingURL=UnionType.d.ts.map
126
+ //# sourceMappingURL=DiscriminatedUnionType.d.ts.map
@@ -9,11 +9,11 @@ import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
10
  import { AbstractType } from "./AbstractType.js";
11
11
  import { code, def, joinCode, literalOf, } from "./ts-poet-wrapper.js";
12
- export class UnionType extends AbstractType {
12
+ export class DiscriminatedUnionType extends AbstractType {
13
13
  discriminant;
14
14
  graphqlArgs = Maybe.empty();
15
15
  identifierType;
16
- kind = "Union";
16
+ kind = "DiscriminatedUnion";
17
17
  recursive;
18
18
  synthetic;
19
19
  validationFunction = Maybe.empty();
@@ -54,7 +54,7 @@ export class UnionType extends AbstractType {
54
54
  if (discriminant.kind === "Intrinsic" && !json) {
55
55
  switch (member.type.kind) {
56
56
  case "Object":
57
- case "ObjectUnion":
57
+ case "ObjectDiscriminatedUnion":
58
58
  return code `${member.type.name.unsafeCoerce()}.is${member.type.name.unsafeCoerce()}(${instance})`;
59
59
  }
60
60
  }
@@ -633,85 +633,85 @@ unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...oth
633
633
  }
634
634
  __decorate([
635
635
  Memoize()
636
- ], UnionType.prototype, "conversionFunction", null);
636
+ ], DiscriminatedUnionType.prototype, "conversionFunction", null);
637
637
  __decorate([
638
638
  Memoize()
639
- ], UnionType.prototype, "declaration", null);
639
+ ], DiscriminatedUnionType.prototype, "declaration", null);
640
640
  __decorate([
641
641
  Memoize()
642
- ], UnionType.prototype, "discriminantProperty", null);
642
+ ], DiscriminatedUnionType.prototype, "discriminantProperty", null);
643
643
  __decorate([
644
644
  Memoize()
645
- ], UnionType.prototype, "equalsFunction", null);
645
+ ], DiscriminatedUnionType.prototype, "equalsFunction", null);
646
646
  __decorate([
647
647
  Memoize()
648
- ], UnionType.prototype, "expression", null);
648
+ ], DiscriminatedUnionType.prototype, "expression", null);
649
649
  __decorate([
650
650
  Memoize()
651
- ], UnionType.prototype, "filterFunction", null);
651
+ ], DiscriminatedUnionType.prototype, "filterFunction", null);
652
652
  __decorate([
653
653
  Memoize()
654
- ], UnionType.prototype, "filterType", null);
654
+ ], DiscriminatedUnionType.prototype, "filterType", null);
655
655
  __decorate([
656
656
  Memoize()
657
- ], UnionType.prototype, "fromRdfResourceValuesFunction", null);
657
+ ], DiscriminatedUnionType.prototype, "fromRdfResourceValuesFunction", null);
658
658
  __decorate([
659
659
  Memoize()
660
- ], UnionType.prototype, "graphqlType", null);
660
+ ], DiscriminatedUnionType.prototype, "graphqlType", null);
661
661
  __decorate([
662
662
  Memoize()
663
- ], UnionType.prototype, "hashFunction", null);
663
+ ], DiscriminatedUnionType.prototype, "hashFunction", null);
664
664
  __decorate([
665
665
  Memoize()
666
- ], UnionType.prototype, "jsTypes", null);
666
+ ], DiscriminatedUnionType.prototype, "jsTypes", null);
667
667
  __decorate([
668
668
  Memoize()
669
- ], UnionType.prototype, "members", null);
669
+ ], DiscriminatedUnionType.prototype, "members", null);
670
670
  __decorate([
671
671
  Memoize()
672
- ], UnionType.prototype, "mutable", null);
672
+ ], DiscriminatedUnionType.prototype, "mutable", null);
673
673
  __decorate([
674
674
  Memoize()
675
- ], UnionType.prototype, "schema", null);
675
+ ], DiscriminatedUnionType.prototype, "schema", null);
676
676
  __decorate([
677
677
  Memoize()
678
- ], UnionType.prototype, "schemaType", null);
678
+ ], DiscriminatedUnionType.prototype, "schemaType", null);
679
679
  __decorate([
680
680
  Memoize()
681
- ], UnionType.prototype, "toRdfResourceValueTypes", null);
681
+ ], DiscriminatedUnionType.prototype, "toRdfResourceValueTypes", null);
682
682
  __decorate([
683
683
  Memoize()
684
- ], UnionType.prototype, "valueSparqlConstructTriplesFunction", null);
684
+ ], DiscriminatedUnionType.prototype, "valueSparqlConstructTriplesFunction", null);
685
685
  __decorate([
686
686
  Memoize()
687
- ], UnionType.prototype, "valueSparqlWherePatternsFunction", null);
687
+ ], DiscriminatedUnionType.prototype, "valueSparqlWherePatternsFunction", null);
688
688
  __decorate([
689
689
  Memoize()
690
- ], UnionType.prototype, "schemaTypeExpression", null);
690
+ ], DiscriminatedUnionType.prototype, "schemaTypeExpression", null);
691
691
  __decorate([
692
692
  Memoize()
693
- ], UnionType.prototype, "equalsFunctionExpression", null);
693
+ ], DiscriminatedUnionType.prototype, "equalsFunctionExpression", null);
694
694
  __decorate([
695
695
  Memoize()
696
- ], UnionType.prototype, "filterFunctionExpression", null);
696
+ ], DiscriminatedUnionType.prototype, "filterFunctionExpression", null);
697
697
  __decorate([
698
698
  Memoize()
699
- ], UnionType.prototype, "filterTypeLiteral", null);
699
+ ], DiscriminatedUnionType.prototype, "filterTypeLiteral", null);
700
700
  __decorate([
701
701
  Memoize()
702
- ], UnionType.prototype, "inlineExpression", null);
702
+ ], DiscriminatedUnionType.prototype, "inlineExpression", null);
703
703
  __decorate([
704
704
  Memoize()
705
- ], UnionType.prototype, "jsonTypeLiteral", null);
705
+ ], DiscriminatedUnionType.prototype, "jsonTypeLiteral", null);
706
706
  __decorate([
707
707
  Memoize()
708
- ], UnionType.prototype, "valueSparqlConstructTriplesFunctionExpression", null);
708
+ ], DiscriminatedUnionType.prototype, "valueSparqlConstructTriplesFunctionExpression", null);
709
709
  __decorate([
710
710
  Memoize()
711
- ], UnionType.prototype, "valueSparqlWherePatternsFunctionExpression", null);
711
+ ], DiscriminatedUnionType.prototype, "valueSparqlWherePatternsFunctionExpression", null);
712
712
  __decorate([
713
713
  Memoize()
714
- ], UnionType.prototype, "jsonType", null);
714
+ ], DiscriminatedUnionType.prototype, "jsonType", null);
715
715
  function termTypes(type) {
716
716
  switch (type.kind) {
717
717
  case "BlankNode":
@@ -847,4 +847,4 @@ export var Discriminant;
847
847
  }
848
848
  Discriminant.infer = infer;
849
849
  })(Discriminant || (Discriminant = {}));
850
- //# sourceMappingURL=UnionType.js.map
850
+ //# sourceMappingURL=DiscriminatedUnionType.js.map
@@ -7,7 +7,7 @@ export declare class FloatType extends AbstractNumericType<number> {
7
7
  }];
8
8
  readonly kind = "Float";
9
9
  get fromRdfResourceValuesFunction(): Code;
10
- get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
10
+ get graphqlType(): import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
11
11
  literalValueExpression(literal: Literal | number): Code;
12
12
  }
13
13
  //# sourceMappingURL=FloatType.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from "ts-log";
2
+ import type { ObjectDiscriminatedUnionType } from "./ObjectDiscriminatedUnionType.js";
2
3
  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";
@@ -8,12 +8,12 @@ export declare class GraphqlSchema {
8
8
  private readonly configuration;
9
9
  private readonly reusables;
10
10
  private readonly namedObjectTypes;
11
- private readonly namedObjectUnionTypes;
12
- constructor({ configuration, namedObjectTypes, namedObjectUnionTypes, reusables, }: {
11
+ private readonly namedObjectDiscriminatedUnionTypes;
12
+ constructor({ configuration, namedObjectTypes, namedObjectDiscriminatedUnionTypes, reusables, }: {
13
13
  configuration: TsGenerator.Configuration;
14
14
  logger: Logger;
15
15
  namedObjectTypes: readonly ObjectType[];
16
- namedObjectUnionTypes: readonly ObjectUnionType[];
16
+ namedObjectDiscriminatedUnionTypes: readonly ObjectDiscriminatedUnionType[];
17
17
  reusables: Reusables;
18
18
  });
19
19
  get declaration(): Code;
@@ -3,11 +3,12 @@ export class GraphqlSchema {
3
3
  configuration;
4
4
  reusables;
5
5
  namedObjectTypes;
6
- namedObjectUnionTypes;
7
- constructor({ configuration, namedObjectTypes, namedObjectUnionTypes, reusables, }) {
6
+ namedObjectDiscriminatedUnionTypes;
7
+ constructor({ configuration, namedObjectTypes, namedObjectDiscriminatedUnionTypes, reusables, }) {
8
8
  this.configuration = configuration;
9
9
  this.namedObjectTypes = namedObjectTypes;
10
- this.namedObjectUnionTypes = namedObjectUnionTypes;
10
+ this.namedObjectDiscriminatedUnionTypes =
11
+ namedObjectDiscriminatedUnionTypes;
11
12
  this.reusables = reusables;
12
13
  }
13
14
  get declaration() {
@@ -19,7 +20,7 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
19
20
  const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
20
21
  return code `new ${this.reusables.imports.GraphQLObjectType}<null, { objectSet: ${syntheticNamePrefix}ObjectSet }>({ name: "Query", fields: ${[
21
22
  ...this.namedObjectTypes,
22
- ...this.namedObjectUnionTypes,
23
+ ...this.namedObjectDiscriminatedUnionTypes,
23
24
  ].reduce((fields, namedObjectType) => {
24
25
  fields[namedObjectType.objectSetMethodNames.object] = {
25
26
  args: {
@@ -7,7 +7,7 @@ export declare class IntType extends AbstractNumericType<number> {
7
7
  }];
8
8
  readonly kind = "Int";
9
9
  get fromRdfResourceValuesFunction(): Code;
10
- get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
10
+ get graphqlType(): import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
11
11
  literalValueExpression(literal: Literal | number): Code;
12
12
  }
13
13
  //# sourceMappingURL=IntType.d.ts.map
@@ -15,9 +15,9 @@ declare const Super: (abstract new ({ partialType, resolveType, ...superParamete
15
15
  reusables: import("./Reusables.js").Reusables;
16
16
  shapeIdentifier: import("@rdfjs/types").BlankNode | import("@rdfjs/types").NamedNode;
17
17
  }) => AbstractLazyType<OptionType<AbstractLazyType.ItemTypeConstraint>, OptionType<AbstractLazyType.ItemTypeConstraint>>) & {
18
- readonly GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
19
- readonly JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
20
- JsType: typeof import("./AbstractType.js").AbstractType.JsType;
18
+ readonly GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
19
+ readonly JsonType: typeof import("./_AbstractType/AbstractType_JsonType.js").AbstractType_JsonType;
20
+ readonly JsType: typeof import("./_AbstractType/AbstractType_JsType.js").AbstractType_JsType;
21
21
  };
22
22
  export declare class LazyOptionType extends Super {
23
23
  readonly graphqlArgs: Super["graphqlArgs"];
@@ -7,19 +7,19 @@ import type { BlankNodeType } from "./BlankNodeType.js";
7
7
  import type { BooleanType } from "./BooleanType.js";
8
8
  import type { DateTimeType } from "./DateTimeType.js";
9
9
  import type { DateType } from "./DateType.js";
10
+ import type { DiscriminatedUnionType } from "./DiscriminatedUnionType.js";
10
11
  import type { FloatType } from "./FloatType.js";
11
12
  import type { IdentifierType } from "./IdentifierType.js";
12
13
  import type { IntType } from "./IntType.js";
13
14
  import type { IriType } from "./IriType.js";
14
15
  import type { LangStringType } from "./LangStringType.js";
15
16
  import type { LiteralType } from "./LiteralType.js";
17
+ import type { ObjectDiscriminatedUnionType } from "./ObjectDiscriminatedUnionType.js";
16
18
  import type { ObjectType } from "./ObjectType.js";
17
- import type { ObjectUnionType } from "./ObjectUnionType.js";
18
19
  import type { StringType } from "./StringType.js";
19
20
  import type { TermType } from "./TermType.js";
20
21
  import type { Type } from "./Type.js";
21
22
  import { type Code } from "./ts-poet-wrapper.js";
22
- import type { UnionType } from "./UnionType.js";
23
23
  export declare class ListType<ItemTypeT extends ListType.ItemType> extends AbstractCollectionType<ItemTypeT> {
24
24
  private readonly identifierNodeKind;
25
25
  private readonly toRdfTypes;
@@ -44,7 +44,7 @@ export declare class ListType<ItemTypeT extends ListType.ItemType> extends Abstr
44
44
  toStringExpression({ variables, }: Parameters<AbstractCollectionType<ItemTypeT>["toStringExpression"]>[0]): Code;
45
45
  }
46
46
  export declare namespace ListType {
47
- type ItemType = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | LangStringType | ListType<ListType.ItemType> | LiteralType | ObjectUnionType | ObjectType | StringType | TermType | UnionType<Type>;
47
+ type ItemType = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | LangStringType | ListType<ListType.ItemType> | LiteralType | ObjectDiscriminatedUnionType | ObjectType | StringType | TermType | DiscriminatedUnionType<Type>;
48
48
  function isItemType(type: Type): type is ItemType;
49
49
  }
50
50
  //# sourceMappingURL=ListType.d.ts.map
@@ -142,11 +142,11 @@ __decorate([
142
142
  case "LangString":
143
143
  case "List":
144
144
  case "Literal":
145
- case "ObjectUnion":
145
+ case "ObjectDiscriminatedUnion":
146
146
  case "Object":
147
147
  case "String":
148
148
  case "Term":
149
- case "Union":
149
+ case "DiscriminatedUnion":
150
150
  return true;
151
151
  case "DefaultValue":
152
152
  case "LazyOption":