@shaclmate/compiler 4.0.57 → 4.0.59
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.
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.js +5 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstStructType.js +1 -1
- package/dist/ast/AbstractCompoundType.d.ts +3 -3
- package/dist/ast/AbstractCompoundType.js +1 -1
- package/dist/ast/AbstractContainerType.d.ts +2 -2
- package/dist/ast/AbstractContainerType.js +1 -1
- package/dist/ast/AbstractLazyType.d.ts +2 -2
- package/dist/ast/{UnionType.d.ts → DiscriminatedUnionType.d.ts} +7 -7
- package/dist/ast/{UnionType.js → DiscriminatedUnionType.js} +9 -8
- package/dist/ast/ListType.d.ts +2 -2
- package/dist/ast/ListType.js +1 -1
- package/dist/ast/StructCompoundType.d.ts +2 -2
- package/dist/ast/StructCompoundType.js +1 -1
- package/dist/ast/StructDiscriminatedUnionType.d.ts +4 -0
- package/dist/ast/StructDiscriminatedUnionType.js +2 -0
- package/dist/ast/StructType.js +1 -1
- package/dist/ast/Type.d.ts +2 -2
- package/dist/ast/Type.js +1 -1
- package/dist/ast/index.d.ts +2 -2
- package/dist/ast/index.js +2 -2
- package/dist/generators/transformAstToLabeledPropertyGraph.js +2 -2
- package/dist/generators/ts/AbstractCollectionType.d.ts +2 -2
- package/dist/generators/ts/AbstractContainerType.d.ts +5 -5
- package/dist/generators/ts/AbstractContainerType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractLazyType.d.ts +8 -8
- package/dist/generators/ts/AbstractLazyType.js +9 -9
- package/dist/generators/ts/AbstractLiteralType.d.ts +2 -2
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
- package/dist/generators/ts/AbstractObjectSetType.d.ts +4 -4
- package/dist/generators/ts/AbstractObjectSetType.js +4 -3
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -2
- package/dist/generators/ts/AbstractTermType.d.ts +2 -2
- package/dist/generators/ts/AbstractType.d.ts +15 -75
- package/dist/generators/ts/AbstractType.js +6 -63
- package/dist/generators/ts/AbstractTypedLiteralType.d.ts +2 -2
- package/dist/generators/ts/BigDecimalType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +4 -4
- package/dist/generators/ts/DefaultValueType.js +2 -2
- package/dist/generators/ts/{UnionType.d.ts → DiscriminatedUnionType.d.ts} +6 -6
- package/dist/generators/ts/{UnionType.js → DiscriminatedUnionType.js} +31 -31
- package/dist/generators/ts/FloatType.d.ts +1 -1
- package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
- package/dist/generators/ts/GraphqlSchema.js +5 -4
- package/dist/generators/ts/IntType.d.ts +1 -1
- package/dist/generators/ts/LazyOptionType.d.ts +3 -3
- package/dist/generators/ts/ListType.d.ts +3 -3
- package/dist/generators/ts/ListType.js +2 -2
- package/dist/generators/ts/{ObjectUnionType.d.ts → ObjectDiscriminatedUnionType.d.ts} +4 -4
- package/dist/generators/ts/{ObjectUnionType.js → ObjectDiscriminatedUnionType.js} +8 -8
- package/dist/generators/ts/ObjectSetType.js +1 -1
- package/dist/generators/ts/ObjectType.d.ts +11 -11
- package/dist/generators/ts/ObjectType.js +6 -6
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -5
- package/dist/generators/ts/SparqlObjectSetType.js +4 -1
- package/dist/generators/ts/StringType.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.js +19 -19
- package/dist/generators/ts/Type.d.ts +3 -3
- package/dist/generators/ts/TypeFactory.d.ts +5 -5
- package/dist/generators/ts/TypeFactory.js +16 -16
- package/dist/generators/ts/ZodGenerator.js +5 -5
- package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.d.ts +10 -0
- package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.js +2 -0
- package/dist/generators/ts/_AbstractType/AbstractType_DiscriminantProperty.d.ts +9 -0
- package/dist/generators/ts/_AbstractType/AbstractType_DiscriminantProperty.js +2 -0
- package/dist/generators/ts/_AbstractType/AbstractType_GraphqlType.d.ts +18 -0
- package/dist/generators/ts/_AbstractType/AbstractType_GraphqlType.js +33 -0
- package/dist/generators/ts/_AbstractType/AbstractType_JsType.d.ts +34 -0
- package/dist/generators/ts/_AbstractType/AbstractType_JsType.js +16 -0
- package/dist/generators/ts/_AbstractType/AbstractType_JsonType.d.ts +16 -0
- package/dist/generators/ts/_AbstractType/AbstractType_JsonType.js +31 -0
- package/dist/generators/ts/_ObjectType/{AbstractProperty.d.ts → ObjectType_AbstractProperty.d.ts} +2 -2
- package/dist/generators/ts/_ObjectType/{AbstractProperty.js → ObjectType_AbstractProperty.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts +45 -0
- package/dist/generators/ts/_ObjectType/{DiscriminantProperty.js → ObjectType_DiscriminantProperty.js} +12 -9
- package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.d.ts +43 -0
- package/dist/generators/ts/_ObjectType/{IdentifierProperty.js → ObjectType_IdentifierProperty.js} +11 -11
- package/dist/generators/ts/_ObjectType/ObjectType_Property.d.ts +6 -0
- package/dist/generators/ts/_ObjectType/ObjectType_Property.js +2 -0
- package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.d.ts +53 -0
- package/dist/generators/ts/_ObjectType/{ShaclProperty.js → ObjectType_ShaclProperty.js} +10 -10
- package/package.json +34 -24
- package/dist/ast/StructUnionType.d.ts +0 -4
- package/dist/ast/StructUnionType.js +0 -2
- package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +0 -45
- package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +0 -43
- package/dist/generators/ts/_ObjectType/Property.d.ts +0 -6
- package/dist/generators/ts/_ObjectType/Property.js +0 -2
- 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("./
|
|
22
|
+
const GraphqlType: typeof import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
|
|
23
23
|
type GraphqlType = AbstractLiteralType.GraphqlType;
|
|
24
|
-
const JsonType: typeof import("./
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
269
|
-
|
|
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 =
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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
|
|
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 "
|
|
84
|
-
case "
|
|
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
|
|
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: "
|
|
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<
|
|
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
|
|
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
|
|
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=
|
|
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
|
|
12
|
+
export class DiscriminatedUnionType extends AbstractType {
|
|
13
13
|
discriminant;
|
|
14
14
|
graphqlArgs = Maybe.empty();
|
|
15
15
|
identifierType;
|
|
16
|
-
kind = "
|
|
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 "
|
|
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
|
-
],
|
|
636
|
+
], DiscriminatedUnionType.prototype, "conversionFunction", null);
|
|
637
637
|
__decorate([
|
|
638
638
|
Memoize()
|
|
639
|
-
],
|
|
639
|
+
], DiscriminatedUnionType.prototype, "declaration", null);
|
|
640
640
|
__decorate([
|
|
641
641
|
Memoize()
|
|
642
|
-
],
|
|
642
|
+
], DiscriminatedUnionType.prototype, "discriminantProperty", null);
|
|
643
643
|
__decorate([
|
|
644
644
|
Memoize()
|
|
645
|
-
],
|
|
645
|
+
], DiscriminatedUnionType.prototype, "equalsFunction", null);
|
|
646
646
|
__decorate([
|
|
647
647
|
Memoize()
|
|
648
|
-
],
|
|
648
|
+
], DiscriminatedUnionType.prototype, "expression", null);
|
|
649
649
|
__decorate([
|
|
650
650
|
Memoize()
|
|
651
|
-
],
|
|
651
|
+
], DiscriminatedUnionType.prototype, "filterFunction", null);
|
|
652
652
|
__decorate([
|
|
653
653
|
Memoize()
|
|
654
|
-
],
|
|
654
|
+
], DiscriminatedUnionType.prototype, "filterType", null);
|
|
655
655
|
__decorate([
|
|
656
656
|
Memoize()
|
|
657
|
-
],
|
|
657
|
+
], DiscriminatedUnionType.prototype, "fromRdfResourceValuesFunction", null);
|
|
658
658
|
__decorate([
|
|
659
659
|
Memoize()
|
|
660
|
-
],
|
|
660
|
+
], DiscriminatedUnionType.prototype, "graphqlType", null);
|
|
661
661
|
__decorate([
|
|
662
662
|
Memoize()
|
|
663
|
-
],
|
|
663
|
+
], DiscriminatedUnionType.prototype, "hashFunction", null);
|
|
664
664
|
__decorate([
|
|
665
665
|
Memoize()
|
|
666
|
-
],
|
|
666
|
+
], DiscriminatedUnionType.prototype, "jsTypes", null);
|
|
667
667
|
__decorate([
|
|
668
668
|
Memoize()
|
|
669
|
-
],
|
|
669
|
+
], DiscriminatedUnionType.prototype, "members", null);
|
|
670
670
|
__decorate([
|
|
671
671
|
Memoize()
|
|
672
|
-
],
|
|
672
|
+
], DiscriminatedUnionType.prototype, "mutable", null);
|
|
673
673
|
__decorate([
|
|
674
674
|
Memoize()
|
|
675
|
-
],
|
|
675
|
+
], DiscriminatedUnionType.prototype, "schema", null);
|
|
676
676
|
__decorate([
|
|
677
677
|
Memoize()
|
|
678
|
-
],
|
|
678
|
+
], DiscriminatedUnionType.prototype, "schemaType", null);
|
|
679
679
|
__decorate([
|
|
680
680
|
Memoize()
|
|
681
|
-
],
|
|
681
|
+
], DiscriminatedUnionType.prototype, "toRdfResourceValueTypes", null);
|
|
682
682
|
__decorate([
|
|
683
683
|
Memoize()
|
|
684
|
-
],
|
|
684
|
+
], DiscriminatedUnionType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
685
685
|
__decorate([
|
|
686
686
|
Memoize()
|
|
687
|
-
],
|
|
687
|
+
], DiscriminatedUnionType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
688
688
|
__decorate([
|
|
689
689
|
Memoize()
|
|
690
|
-
],
|
|
690
|
+
], DiscriminatedUnionType.prototype, "schemaTypeExpression", null);
|
|
691
691
|
__decorate([
|
|
692
692
|
Memoize()
|
|
693
|
-
],
|
|
693
|
+
], DiscriminatedUnionType.prototype, "equalsFunctionExpression", null);
|
|
694
694
|
__decorate([
|
|
695
695
|
Memoize()
|
|
696
|
-
],
|
|
696
|
+
], DiscriminatedUnionType.prototype, "filterFunctionExpression", null);
|
|
697
697
|
__decorate([
|
|
698
698
|
Memoize()
|
|
699
|
-
],
|
|
699
|
+
], DiscriminatedUnionType.prototype, "filterTypeLiteral", null);
|
|
700
700
|
__decorate([
|
|
701
701
|
Memoize()
|
|
702
|
-
],
|
|
702
|
+
], DiscriminatedUnionType.prototype, "inlineExpression", null);
|
|
703
703
|
__decorate([
|
|
704
704
|
Memoize()
|
|
705
|
-
],
|
|
705
|
+
], DiscriminatedUnionType.prototype, "jsonTypeLiteral", null);
|
|
706
706
|
__decorate([
|
|
707
707
|
Memoize()
|
|
708
|
-
],
|
|
708
|
+
], DiscriminatedUnionType.prototype, "valueSparqlConstructTriplesFunctionExpression", null);
|
|
709
709
|
__decorate([
|
|
710
710
|
Memoize()
|
|
711
|
-
],
|
|
711
|
+
], DiscriminatedUnionType.prototype, "valueSparqlWherePatternsFunctionExpression", null);
|
|
712
712
|
__decorate([
|
|
713
713
|
Memoize()
|
|
714
|
-
],
|
|
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=
|
|
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("./
|
|
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
|
|
12
|
-
constructor({ configuration, namedObjectTypes,
|
|
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
|
-
|
|
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
|
-
|
|
7
|
-
constructor({ configuration, namedObjectTypes,
|
|
6
|
+
namedObjectDiscriminatedUnionTypes;
|
|
7
|
+
constructor({ configuration, namedObjectTypes, namedObjectDiscriminatedUnionTypes, reusables, }) {
|
|
8
8
|
this.configuration = configuration;
|
|
9
9
|
this.namedObjectTypes = namedObjectTypes;
|
|
10
|
-
this.
|
|
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.
|
|
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("./
|
|
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("./
|
|
19
|
-
readonly JsonType: typeof import("./
|
|
20
|
-
JsType: typeof import("./
|
|
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 |
|
|
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 "
|
|
145
|
+
case "ObjectDiscriminatedUnion":
|
|
146
146
|
case "Object":
|
|
147
147
|
case "String":
|
|
148
148
|
case "Term":
|
|
149
|
-
case "
|
|
149
|
+
case "DiscriminatedUnion":
|
|
150
150
|
return true;
|
|
151
151
|
case "DefaultValue":
|
|
152
152
|
case "LazyOption":
|