@shaclmate/compiler 4.0.40 → 4.0.41

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 (114) hide show
  1. package/dist/ShapesGraphToAstTransformer.d.ts +0 -8
  2. package/dist/ShapesGraphToAstTransformer.js +5 -85
  3. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
  4. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +1 -1
  5. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +0 -16
  6. package/dist/ast/AbstractCompoundType.d.ts +2 -1
  7. package/dist/ast/AbstractCompoundType.js +1 -1
  8. package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
  9. package/dist/ast/Ast.d.ts +1 -3
  10. package/dist/ast/ListType.d.ts +1 -1
  11. package/dist/ast/ListType.js +1 -1
  12. package/dist/ast/ObjectType.d.ts +0 -12
  13. package/dist/ast/ObjectType.js +0 -78
  14. package/dist/generators/AstJsonGenerator.js +7 -3
  15. package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
  16. package/dist/generators/ts/AbstractCollectionType.d.ts +4 -11
  17. package/dist/generators/ts/AbstractCollectionType.js +3 -62
  18. package/dist/generators/ts/AbstractContainerType.d.ts +0 -1
  19. package/dist/generators/ts/AbstractContainerType.js +1 -4
  20. package/dist/generators/ts/AbstractDateType.d.ts +4 -1
  21. package/dist/generators/ts/AbstractDateType.js +6 -1
  22. package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
  23. package/dist/generators/ts/AbstractIdentifierType.js +3 -0
  24. package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -1
  25. package/dist/generators/ts/AbstractLazyObjectType.js +12 -1
  26. package/dist/generators/ts/AbstractLiteralType.d.ts +1 -0
  27. package/dist/generators/ts/AbstractNumericType.js +7 -7
  28. package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
  29. package/dist/generators/ts/AbstractTermType.d.ts +1 -2
  30. package/dist/generators/ts/AbstractTermType.js +1 -3
  31. package/dist/generators/ts/AbstractType.d.ts +46 -16
  32. package/dist/generators/ts/AbstractType.js +31 -16
  33. package/dist/generators/ts/BigDecimalType.d.ts +4 -0
  34. package/dist/generators/ts/BigDecimalType.js +4 -1
  35. package/dist/generators/ts/BigIntType.d.ts +3 -1
  36. package/dist/generators/ts/BigIntType.js +1 -1
  37. package/dist/generators/ts/BlankNodeType.d.ts +1 -1
  38. package/dist/generators/ts/BlankNodeType.js +3 -3
  39. package/dist/generators/ts/BooleanType.d.ts +3 -1
  40. package/dist/generators/ts/BooleanType.js +1 -1
  41. package/dist/generators/ts/DefaultValueType.d.ts +39 -1
  42. package/dist/generators/ts/DefaultValueType.js +6 -3
  43. package/dist/generators/ts/FloatType.d.ts +3 -1
  44. package/dist/generators/ts/FloatType.js +1 -1
  45. package/dist/generators/ts/GraphqlSchema.js +2 -2
  46. package/dist/generators/ts/IdentifierType.d.ts +1 -1
  47. package/dist/generators/ts/IdentifierType.js +7 -5
  48. package/dist/generators/ts/IntType.d.ts +3 -1
  49. package/dist/generators/ts/IntType.js +1 -1
  50. package/dist/generators/ts/IriType.js +4 -2
  51. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
  52. package/dist/generators/ts/LazyObjectOptionType.js +8 -4
  53. package/dist/generators/ts/LazyObjectSetType.js +9 -3
  54. package/dist/generators/ts/LazyObjectType.js +5 -2
  55. package/dist/generators/ts/ListType.d.ts +10 -1
  56. package/dist/generators/ts/ListType.js +45 -8
  57. package/dist/generators/ts/LiteralType.d.ts +4 -0
  58. package/dist/generators/ts/LiteralType.js +6 -3
  59. package/dist/generators/ts/ObjectType.d.ts +8 -22
  60. package/dist/generators/ts/ObjectType.js +6 -74
  61. package/dist/generators/ts/ObjectUnionType.js +2 -2
  62. package/dist/generators/ts/OptionType.d.ts +5 -1
  63. package/dist/generators/ts/OptionType.js +10 -5
  64. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +1 -4
  65. package/dist/generators/ts/SetType.d.ts +16 -1
  66. package/dist/generators/ts/SetType.js +80 -2
  67. package/dist/generators/ts/Snippets.d.ts +3 -1
  68. package/dist/generators/ts/Snippets.js +18 -4
  69. package/dist/generators/ts/StringType.d.ts +3 -1
  70. package/dist/generators/ts/StringType.js +5 -1
  71. package/dist/generators/ts/TermType.d.ts +4 -0
  72. package/dist/generators/ts/TermType.js +3 -0
  73. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  74. package/dist/generators/ts/TsGenerator.js +53 -28
  75. package/dist/generators/ts/TypeFactory.js +12 -25
  76. package/dist/generators/ts/UnionType.d.ts +3 -6
  77. package/dist/generators/ts/UnionType.js +42 -55
  78. package/dist/generators/ts/ZodGenerator.d.ts +1 -1
  79. package/dist/generators/ts/ZodGenerator.js +19 -12
  80. package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +6 -3
  81. package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +8 -12
  82. package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +18 -35
  83. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +5 -5
  84. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +9 -30
  85. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.js +0 -4
  86. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -3
  87. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.js +0 -3
  88. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +0 -4
  89. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js +3 -22
  90. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +4 -29
  91. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +10 -39
  92. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +25 -29
  93. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +1 -5
  94. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +11 -8
  95. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +3 -9
  96. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +1 -8
  97. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +1 -3
  98. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +2 -4
  99. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +10 -31
  100. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  101. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.js +2 -9
  102. package/dist/generators/ts/_ObjectType/ShaclProperty.js +6 -6
  103. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +0 -11
  104. package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +3 -0
  105. package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -0
  106. package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +3 -0
  107. package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
  108. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
  109. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -0
  110. package/dist/input/generated.d.ts +756 -115
  111. package/dist/input/generated.js +634 -126
  112. package/package.json +2 -4
  113. package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +0 -3
  114. package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
@@ -3,7 +3,6 @@ import type { Logger } from "ts-log";
3
3
  import type { Reusables } from "./Reusables.js";
4
4
  import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
5
5
  import type { TsGenerator } from "./TsGenerator.js";
6
- import type { Typeof } from "./Typeof.js";
7
6
  import { type Code } from "./ts-poet-wrapper.js";
8
7
  /**
9
8
  * Abstract base class all types.
@@ -70,6 +69,10 @@ export declare abstract class AbstractType {
70
69
  * A function (reference or declaration) that takes a Hasher and a value of this type, calls hasher.update on the value, and returns the Hasher.
71
70
  */
72
71
  abstract readonly hashFunction: Code;
72
+ /**
73
+ * JavaScript type(s) the type.
74
+ */
75
+ abstract readonly jsTypes: readonly AbstractType.JsType[];
73
76
  /**
74
77
  * Type discriminant.
75
78
  */
@@ -98,10 +101,6 @@ export declare abstract class AbstractType {
98
101
  * The type(s) of the array elements produced by the toRdfResourceValuesExpression.
99
102
  */
100
103
  abstract readonly toRdfResourceValueTypes: ReadonlySet<"BlankNode" | "NamedNode" | "Literal">;
101
- /**
102
- * JavaScript typeof(s) the type.
103
- */
104
- abstract readonly typeofs: readonly Typeof[];
105
104
  /**
106
105
  * Function that takes
107
106
  * - a schema of this.schemaType
@@ -277,14 +276,13 @@ export declare namespace AbstractType {
277
276
  readonly code: Code;
278
277
  readonly sourceTypes: {
279
278
  readonly expression: Code;
280
- readonly typeof: Typeof;
279
+ readonly jsType: JsType;
281
280
  }[];
282
281
  }
283
282
  interface DiscriminantProperty {
284
- readonly descendantValues: readonly DiscriminantProperty.Value[];
285
283
  readonly jsonName: string;
286
284
  readonly name: string;
287
- readonly ownValues: readonly DiscriminantProperty.Value[];
285
+ readonly values: readonly DiscriminantProperty.Value[];
288
286
  }
289
287
  namespace DiscriminantProperty {
290
288
  type Value = number | string;
@@ -295,14 +293,46 @@ export declare namespace AbstractType {
295
293
  */
296
294
  readonly nullable: boolean;
297
295
  /**
298
- * The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
296
+ * The expression of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
299
297
  */
300
- readonly nullableName: Code;
298
+ readonly nullableExpression: Code;
301
299
  private readonly reusables;
302
- constructor(nullableName: Code, reusables: Reusables, options?: {
300
+ constructor(nullableExpression: Code, reusables: Reusables, options?: {
303
301
  nullable: boolean;
304
302
  });
305
- get name(): Code;
303
+ get expression(): Code;
304
+ }
305
+ type JsType = {
306
+ typeof: "bigint";
307
+ } | {
308
+ typeof: "boolean";
309
+ } | {
310
+ typeof: "function";
311
+ } | {
312
+ typeof: "number";
313
+ } | {
314
+ instanceof: "Array";
315
+ typeof: "object";
316
+ } | {
317
+ className: Code;
318
+ instanceof: "class";
319
+ typeof: "object";
320
+ } | {
321
+ instanceof: "Date";
322
+ typeof: "object";
323
+ } | {
324
+ instanceof: "Maybe";
325
+ typeof: "object";
326
+ } | {
327
+ instanceof: "Object";
328
+ typeof: "object";
329
+ } | {
330
+ typeof: "string";
331
+ } | {
332
+ typeof: "undefined";
333
+ };
334
+ namespace JsType {
335
+ function equals(left: JsType, right: JsType): boolean;
306
336
  }
307
337
  class JsonType {
308
338
  /**
@@ -310,13 +340,13 @@ export declare namespace AbstractType {
310
340
  */
311
341
  readonly optional: boolean;
312
342
  /**
313
- * The name of the type when it's required i.e. -- so it should never include "| undefined".
343
+ * The expression of the type when it's required i.e. -- so it should never include "| undefined".
314
344
  */
315
- readonly requiredName: Code | string;
316
- constructor(requiredName: Code | string, parameters?: {
345
+ readonly requiredExpression: Code;
346
+ constructor(requiredExpression: Code, parameters?: {
317
347
  optional: boolean;
318
348
  });
319
- get name(): Code | string;
349
+ get expression(): Code;
320
350
  }
321
351
  }
322
352
  //# sourceMappingURL=AbstractType.d.ts.map
@@ -63,47 +63,62 @@ __decorate([
63
63
  */
64
64
  nullable;
65
65
  /**
66
- * The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
66
+ * The expression of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
67
67
  */
68
- nullableName;
68
+ nullableExpression;
69
69
  reusables;
70
- constructor(nullableName, reusables, options) {
70
+ constructor(nullableExpression, reusables, options) {
71
71
  this.nullable = !!options?.nullable;
72
- this.nullableName = nullableName;
72
+ this.nullableExpression = nullableExpression;
73
73
  this.reusables = reusables;
74
74
  }
75
- get name() {
75
+ get expression() {
76
76
  return this.nullable
77
- ? this.nullableName
78
- : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableName})`;
77
+ ? this.nullableExpression
78
+ : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableExpression})`;
79
79
  }
80
80
  }
81
81
  __decorate([
82
82
  Memoize()
83
- ], GraphqlType.prototype, "name", null);
83
+ ], GraphqlType.prototype, "expression", null);
84
84
  AbstractType.GraphqlType = GraphqlType;
85
+ let JsType;
86
+ (function (JsType) {
87
+ function equals(left, right) {
88
+ if (left.typeof !== right.typeof) {
89
+ return false;
90
+ }
91
+ if (left.typeof === "object" &&
92
+ right.typeof === "object" &&
93
+ left.instanceof !== right.instanceof) {
94
+ return false;
95
+ }
96
+ return true;
97
+ }
98
+ JsType.equals = equals;
99
+ })(JsType = AbstractType.JsType || (AbstractType.JsType = {}));
85
100
  class JsonType {
86
101
  /**
87
102
  * Is the type optional in JSON? Equivalent to ? in TypeScript or | undefined.
88
103
  */
89
104
  optional;
90
105
  /**
91
- * The name of the type when it's required i.e. -- so it should never include "| undefined".
106
+ * The expression of the type when it's required i.e. -- so it should never include "| undefined".
92
107
  */
93
- requiredName;
94
- constructor(requiredName, parameters) {
108
+ requiredExpression;
109
+ constructor(requiredExpression, parameters) {
95
110
  this.optional = !!parameters?.optional;
96
- this.requiredName = requiredName;
111
+ this.requiredExpression = requiredExpression;
97
112
  }
98
- get name() {
113
+ get expression() {
99
114
  return this.optional
100
- ? code `(${this.requiredName}) | undefined`
101
- : this.requiredName;
115
+ ? code `(${this.requiredExpression}) | undefined`
116
+ : this.requiredExpression;
102
117
  }
103
118
  }
104
119
  __decorate([
105
120
  Memoize()
106
- ], JsonType.prototype, "name", null);
121
+ ], JsonType.prototype, "expression", null);
107
122
  AbstractType.JsonType = JsonType;
108
123
  })(AbstractType || (AbstractType = {}));
109
124
  //# sourceMappingURL=AbstractType.js.map
@@ -8,6 +8,10 @@ export declare class BigDecimalType extends AbstractLiteralType {
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
10
10
  readonly hashFunction: Code;
11
+ readonly jsTypes: readonly [{
12
+ readonly instanceof: "Object";
13
+ readonly typeof: "object";
14
+ }];
11
15
  readonly kind = "BigDecimal";
12
16
  readonly schemaType: Code;
13
17
  readonly valueSparqlWherePatternsFunction: Code;
@@ -14,6 +14,9 @@ export class BigDecimalType extends AbstractLiteralType {
14
14
  filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
15
15
  filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
16
16
  hashFunction = code `${this.reusables.snippets.hashBigDecimal}`;
17
+ jsTypes = [
18
+ { instanceof: "Object", typeof: "object" },
19
+ ];
17
20
  kind = "BigDecimal";
18
21
  schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
19
22
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
@@ -30,7 +33,7 @@ export class BigDecimalType extends AbstractLiteralType {
30
33
  return code `${this.reusables.imports.z}.string()`;
31
34
  }
32
35
  jsonType() {
33
- return new AbstractLiteralType.JsonType("string");
36
+ return new AbstractLiteralType.JsonType(code `string`);
34
37
  }
35
38
  literalExpression(literal) {
36
39
  return code `new ${this.reusables.imports.BigDecimal}(${literalOf(literal.value)})`;
@@ -2,8 +2,10 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class BigIntType extends AbstractNumericType<bigint> {
5
+ readonly jsTypes: {
6
+ readonly typeof: "bigint";
7
+ }[];
5
8
  readonly kind = "BigInt";
6
- readonly typeofs: "bigint"[];
7
9
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
10
  fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
9
11
  jsonSchema(_parameters: Parameters<AbstractNumericType<bigint>["jsonSchema"]>[0]): Code;
@@ -9,8 +9,8 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
11
11
  export class BigIntType extends AbstractNumericType {
12
+ jsTypes = [{ typeof: "bigint" }];
12
13
  kind = "BigInt";
13
- typeofs = ["bigint"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
16
16
  }
@@ -3,8 +3,8 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
6
- readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
7
6
  readonly expression: Code;
7
+ readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
10
10
  readonly kind = "BlankNode";
@@ -9,20 +9,20 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class BlankNodeType extends AbstractIdentifierType {
12
+ expression = code `${this.reusables.imports.BlankNode}`;
12
13
  conversionFunction = Maybe.of({
13
14
  code: code `${this.reusables.snippets.convertToBlankNode}`,
14
15
  sourceTypes: [
15
16
  {
16
17
  expression: code `${this.reusables.imports.BlankNode}`,
17
- typeof: "object",
18
+ jsType: this.jsTypes[0],
18
19
  },
19
20
  {
20
21
  expression: code `undefined`,
21
- typeof: "undefined",
22
+ jsType: { typeof: "undefined" },
22
23
  },
23
24
  ],
24
25
  });
25
- expression = code `${this.reusables.imports.BlankNode}`;
26
26
  filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
27
27
  filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
28
28
  kind = "BlankNode";
@@ -6,8 +6,10 @@ export declare class BooleanType extends AbstractPrimitiveType<boolean> {
6
6
  readonly filterType: Code;
7
7
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  readonly hashFunction: Code;
9
+ readonly jsTypes: readonly [{
10
+ readonly typeof: "boolean";
11
+ }];
9
12
  readonly kind = "Boolean";
10
- readonly typeofs: "boolean"[];
11
13
  readonly valueSparqlWherePatternsFunction: Code;
12
14
  get expression(): Code;
13
15
  get schemaType(): Code;
@@ -13,8 +13,8 @@ export class BooleanType extends AbstractPrimitiveType {
13
13
  filterType = code `${this.reusables.snippets.BooleanFilter}`;
14
14
  graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
15
15
  hashFunction = code `${this.reusables.snippets.hashBoolean}`;
16
+ jsTypes = [{ typeof: "boolean" }];
16
17
  kind = "Boolean";
17
- typeofs = ["boolean"];
18
18
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
19
19
  get expression() {
20
20
  if (this.primitiveIn.length > 0) {
@@ -10,7 +10,44 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
10
10
  readonly discriminantProperty: Maybe<AbstractType.DiscriminantProperty>;
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
12
  readonly kind = "DefaultValue";
13
- readonly typeofs: "object"[];
13
+ readonly jsTypes: readonly AbstractType.JsType[] | readonly [{
14
+ readonly instanceof: "Object";
15
+ readonly typeof: "object";
16
+ }] | {
17
+ readonly typeof: "bigint";
18
+ }[] | readonly [{
19
+ readonly typeof: "boolean";
20
+ }] | readonly [{
21
+ readonly instanceof: "Date";
22
+ readonly typeof: "object";
23
+ }] | readonly [{
24
+ readonly instanceof: "Date";
25
+ readonly typeof: "object";
26
+ }] | readonly [{
27
+ readonly typeof: "number";
28
+ }] | readonly [{
29
+ readonly instanceof: "Object";
30
+ readonly typeof: "object";
31
+ }] | readonly [{
32
+ readonly typeof: "number";
33
+ }] | readonly [{
34
+ readonly instanceof: "Object";
35
+ readonly typeof: "object";
36
+ }] | readonly [{
37
+ readonly instanceof: "Object";
38
+ readonly typeof: "object";
39
+ }] | readonly [{
40
+ readonly instanceof: "Object";
41
+ readonly typeof: "object";
42
+ }] | readonly [{
43
+ readonly typeof: "string";
44
+ }] | readonly [{
45
+ readonly instanceof: "Array";
46
+ readonly typeof: "object";
47
+ }] | readonly [{
48
+ readonly instanceof: "Object";
49
+ readonly typeof: "object";
50
+ }];
14
51
  readonly validationFunction: Maybe<Code>;
15
52
  constructor({ defaultValue, ...superParameters }: {
16
53
  defaultValue: Literal | NamedNode;
@@ -24,6 +61,7 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
24
61
  get hashFunction(): Code;
25
62
  get mutable(): boolean;
26
63
  get schemaType(): Code;
64
+ get toRdfResourceValueTypes(): AbstractContainerType<ItemTypeT>["toRdfResourceValueTypes"];
27
65
  get valueSparqlConstructTriplesFunction(): Code;
28
66
  get valueSparqlWherePatternsFunction(): Code;
29
67
  protected get schemaInitializers(): Code[];
@@ -14,7 +14,7 @@ export class DefaultValueType extends AbstractContainerType {
14
14
  discriminantProperty = Maybe.empty();
15
15
  graphqlArgs = Maybe.empty();
16
16
  kind = "DefaultValue";
17
- typeofs = ["object"];
17
+ jsTypes = this.itemType.jsTypes;
18
18
  validationFunction = this.itemType.validationFunction;
19
19
  constructor({ defaultValue, ...superParameters }) {
20
20
  super(superParameters);
@@ -25,10 +25,10 @@ export class DefaultValueType extends AbstractContainerType {
25
25
  return Maybe.of({
26
26
  code: code `${this.reusables.snippets.convertWithDefaultValue}(${itemConversionFunction.code}, ${this.defaultValueExpression})`,
27
27
  sourceTypes: itemConversionFunction.sourceTypes
28
- .filter((sourceType) => sourceType.typeof !== "undefined")
28
+ .filter((sourceType) => sourceType.jsType.typeof !== "undefined")
29
29
  .concat({
30
30
  expression: code `undefined`,
31
- typeof: "undefined",
31
+ jsType: { typeof: "undefined" },
32
32
  }),
33
33
  });
34
34
  }
@@ -56,6 +56,9 @@ export class DefaultValueType extends AbstractContainerType {
56
56
  get schemaType() {
57
57
  return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.expression}, ${this.itemType.schemaType}>`;
58
58
  }
59
+ get toRdfResourceValueTypes() {
60
+ return this.itemType.toRdfResourceValueTypes;
61
+ }
59
62
  get valueSparqlConstructTriplesFunction() {
60
63
  return this.itemType.valueSparqlConstructTriplesFunction;
61
64
  }
@@ -2,8 +2,10 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class FloatType extends AbstractNumericType<number> {
5
+ readonly jsTypes: readonly [{
6
+ readonly typeof: "number";
7
+ }];
5
8
  readonly kind = "Float";
6
- readonly typeofs: "number"[];
7
9
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
10
  literalExpression(literal: Literal | number): Code;
9
11
  protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractNumericType<number>["fromRdfResourceValueExpression"]>[0]): Code;
@@ -9,8 +9,8 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class FloatType extends AbstractNumericType {
12
+ jsTypes = [{ typeof: "number" }];
12
13
  kind = "Float";
13
- typeofs = ["number"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLFloat}`, this.reusables);
16
16
  }
@@ -32,7 +32,7 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
32
32
  (await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.expression}>(async ({ liftEither }) =>
33
33
  liftEither(await objectSet.${namedObjectType.objectSetMethodNames.object}(await liftEither(${namedObjectType.identifierTypeAlias}.parse(args.identifier))))
34
34
  )).unsafeCoerce()`,
35
- type: namedObjectType.graphqlType.name,
35
+ type: namedObjectType.graphqlType.expression,
36
36
  };
37
37
  fields[namedObjectType.objectSetMethodNames.objectIdentifiers] = {
38
38
  args: {
@@ -73,7 +73,7 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
73
73
  }
74
74
  return await liftEither(await objectSet.${namedObjectType.objectSetMethodNames.objects}({ filter, limit: args.limit !== null ? args.limit : undefined, offset: args.offset !== null ? args.offset : undefined }));
75
75
  })).unsafeCoerce()`,
76
- type: code `new ${this.reusables.imports.GraphQLNonNull}(new ${this.reusables.imports.GraphQLList}(${namedObjectType.graphqlType.name}))`,
76
+ type: code `new ${this.reusables.imports.GraphQLNonNull}(new ${this.reusables.imports.GraphQLList}(${namedObjectType.graphqlType.expression}))`,
77
77
  };
78
78
  fields[namedObjectType.objectSetMethodNames.objectCount] = {
79
79
  resolve: code `\
@@ -4,8 +4,8 @@ import { Maybe } from "purify-ts";
4
4
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
5
5
  import { type Code } from "./ts-poet-wrapper.js";
6
6
  export declare class IdentifierType extends AbstractIdentifierType<BlankNode | NamedNode> {
7
- readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
8
7
  readonly expression: Code;
8
+ readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
9
9
  readonly filterFunction: Code;
10
10
  readonly filterType: Code;
11
11
  readonly kind = "Identifier";
@@ -10,28 +10,30 @@ import { Memoize } from "typescript-memoize";
10
10
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
11
11
  import { arrayOf, code } from "./ts-poet-wrapper.js";
12
12
  export class IdentifierType extends AbstractIdentifierType {
13
+ expression = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
13
14
  conversionFunction = Maybe.of({
14
15
  code: code `${this.reusables.snippets.convertToIdentifier}`,
15
16
  sourceTypes: [
16
17
  {
17
18
  expression: code `${this.reusables.imports.BlankNode}`,
18
- typeof: "object",
19
+ jsType: this.jsTypes[0],
19
20
  },
20
21
  {
21
22
  expression: code `${this.reusables.imports.NamedNode}`,
22
- typeof: "object",
23
+ jsType: this.jsTypes[0],
23
24
  },
24
25
  {
26
+ // To NamedNode
25
27
  expression: code `string`,
26
- typeof: "string",
28
+ jsType: { typeof: "string" },
27
29
  },
28
30
  {
31
+ // To BlankNode
29
32
  expression: code `undefined`,
30
- typeof: "undefined",
33
+ jsType: { typeof: "undefined" },
31
34
  },
32
35
  ],
33
36
  });
34
- expression = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
35
37
  filterFunction = code `${this.reusables.snippets.filterIdentifier}`;
36
38
  filterType = code `${this.reusables.snippets.IdentifierFilter}`;
37
39
  kind = "Identifier";
@@ -2,8 +2,10 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class IntType extends AbstractNumericType<number> {
5
+ readonly jsTypes: readonly [{
6
+ readonly typeof: "number";
7
+ }];
5
8
  readonly kind = "Int";
6
- readonly typeofs: "number"[];
7
9
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
10
  literalExpression(literal: Literal | number): Code;
9
11
  protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractNumericType<number>["fromRdfResourceValueExpression"]>[0]): Code;
@@ -9,8 +9,8 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class IntType extends AbstractNumericType {
12
+ jsTypes = [{ typeof: "number" }];
12
13
  kind = "Int";
13
- typeofs = ["number"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLInt}`, this.reusables);
16
16
  }
@@ -5,6 +5,7 @@ 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 { Maybe } from "purify-ts";
8
+ import { invariant } from "ts-invariant";
8
9
  import { Memoize } from "typescript-memoize";
9
10
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
10
11
  import { arrayOf, code, joinCode } from "./ts-poet-wrapper.js";
@@ -16,16 +17,17 @@ export class IriType extends AbstractIdentifierType {
16
17
  schemaType = code `${this.reusables.snippets.IriSchema}<${this.valueTypeExpression}>`;
17
18
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.iriSparqlWherePatterns}`;
18
19
  get conversionFunction() {
20
+ invariant(this.jsTypes.length === 1);
19
21
  return Maybe.of({
20
22
  code: code `${this.reusables.snippets.convertToIri}<${this.valueTypeExpression}>`,
21
23
  sourceTypes: [
22
24
  {
23
25
  expression: this.valueTypeExpression,
24
- typeof: "string",
26
+ jsType: { typeof: "string" },
25
27
  },
26
28
  {
27
29
  expression: this.expression,
28
- typeof: "object",
30
+ jsType: this.jsTypes[0],
29
31
  },
30
32
  ],
31
33
  });
@@ -16,6 +16,7 @@ declare const Super: (abstract new ({ partialType, resolveType, ...superParamete
16
16
  }) => AbstractLazyObjectType<OptionType<AbstractLazyObjectType.ObjectTypeConstraint>, OptionType<AbstractLazyObjectType.ObjectTypeConstraint>>) & {
17
17
  readonly GraphqlType: typeof import("./AbstractType.js").AbstractType.GraphqlType;
18
18
  readonly JsonType: typeof import("./AbstractType.js").AbstractType.JsonType;
19
+ JsType: typeof import("./AbstractType.js").AbstractType.JsType;
19
20
  };
20
21
  export declare class LazyObjectOptionType extends Super {
21
22
  readonly graphqlArgs: Super["graphqlArgs"];
@@ -5,6 +5,7 @@ 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 { Maybe } from "purify-ts";
8
+ import { invariant } from "ts-invariant";
8
9
  import { Memoize } from "typescript-memoize";
9
10
  import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
10
11
  import { code } from "./ts-poet-wrapper.js";
@@ -13,24 +14,27 @@ export class LazyObjectOptionType extends Super {
13
14
  graphqlArgs = Maybe.empty();
14
15
  kind = "LazyObjectOption";
15
16
  get conversionFunction() {
17
+ invariant(this.jsTypes.length === 1);
18
+ invariant(this.resolveType.jsTypes.length === 1);
19
+ invariant(this.resolveType.itemType.jsTypes.length === 1);
16
20
  return Maybe.of({
17
21
  code: code `${this.reusables.snippets.convertToLazyObjectOption}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
18
22
  sourceTypes: [
19
23
  {
20
24
  expression: this.expression,
21
- typeof: "object",
25
+ jsType: this.jsTypes[0],
22
26
  },
23
27
  {
24
28
  expression: this.resolveType.expression,
25
- typeof: "object",
29
+ jsType: this.resolveType.jsTypes[0],
26
30
  },
27
31
  {
28
32
  expression: this.resolveType.itemType.expression,
29
- typeof: "object",
33
+ jsType: this.resolveType.itemType.jsTypes[0],
30
34
  },
31
35
  {
32
36
  expression: code `undefined`,
33
- typeof: "undefined",
37
+ jsType: { typeof: "undefined" },
34
38
  },
35
39
  ],
36
40
  });
@@ -5,6 +5,7 @@ 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 { Maybe } from "purify-ts";
8
+ import { invariant } from "ts-invariant";
8
9
  import { Memoize } from "typescript-memoize";
9
10
  import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
10
11
  import { code } from "./ts-poet-wrapper.js";
@@ -19,20 +20,22 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
19
20
  });
20
21
  kind = "LazyObjectSet";
21
22
  get conversionFunction() {
23
+ invariant(this.jsTypes.length === 1);
24
+ invariant(this.resolveType.jsTypes.length === 1);
22
25
  return Maybe.of({
23
26
  code: code `${this.reusables.snippets.convertToLazyObjectSet}<${this.resolveType.itemType.identifierTypeAlias}, ${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
24
27
  sourceTypes: [
25
28
  {
26
29
  expression: this.expression,
27
- typeof: "object",
30
+ jsType: this.jsTypes[0],
28
31
  },
29
32
  {
30
33
  expression: this.resolveType.expression,
31
- typeof: "object",
34
+ jsType: this.resolveType.jsTypes[0],
32
35
  },
33
36
  {
34
37
  expression: code `undefined`,
35
- typeof: "undefined",
38
+ jsType: { typeof: "undefined" },
36
39
  },
37
40
  ],
38
41
  });
@@ -58,4 +61,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
58
61
  __decorate([
59
62
  Memoize()
60
63
  ], LazyObjectSetType.prototype, "conversionFunction", null);
64
+ __decorate([
65
+ Memoize()
66
+ ], LazyObjectSetType.prototype, "runtimeClass", null);
61
67
  //# sourceMappingURL=LazyObjectSetType.js.map