@shaclmate/compiler 4.0.37 → 4.0.39
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.js +12 -12
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +24 -24
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -4
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/ast/AbstractCollectionType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.js +15 -15
- package/dist/ast/AbstractContainerType.d.ts +1 -1
- package/dist/ast/AbstractContainerType.js +15 -15
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -1
- package/dist/ast/AbstractTermType.d.ts +1 -1
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/BlankNodeType.js +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -1
- package/dist/ast/DefaultValueType.js +2 -2
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IdentifierType.js +1 -1
- package/dist/ast/IntersectionType.d.ts +1 -1
- package/dist/ast/IntersectionType.js +3 -3
- package/dist/ast/IriType.d.ts +1 -1
- package/dist/ast/IriType.js +1 -1
- package/dist/ast/LazyObjectOptionType.d.ts +1 -1
- package/dist/ast/LazyObjectOptionType.js +1 -1
- package/dist/ast/LazyObjectSetType.d.ts +1 -1
- package/dist/ast/LazyObjectSetType.js +1 -1
- package/dist/ast/LazyObjectType.d.ts +1 -1
- package/dist/ast/LazyObjectType.js +1 -1
- package/dist/ast/ListType.d.ts +1 -1
- package/dist/ast/ListType.js +16 -16
- package/dist/ast/LiteralType.d.ts +1 -1
- package/dist/ast/LiteralType.js +1 -1
- package/dist/ast/ObjectCompoundType.js +3 -3
- package/dist/ast/ObjectType.d.ts +1 -1
- package/dist/ast/ObjectType.js +16 -16
- package/dist/ast/OptionType.d.ts +1 -1
- package/dist/ast/OptionType.js +1 -1
- package/dist/ast/SetType.d.ts +1 -1
- package/dist/ast/SetType.js +1 -1
- package/dist/ast/TermType.d.ts +1 -1
- package/dist/ast/TermType.js +1 -1
- package/dist/ast/Type.js +15 -15
- package/dist/ast/UnionType.d.ts +1 -1
- package/dist/ast/UnionType.js +3 -3
- package/dist/generators/transformAstToLabeledPropertyGraph.js +10 -10
- package/dist/generators/ts/AbstractCollectionType.d.ts +1 -5
- package/dist/generators/ts/AbstractCollectionType.js +6 -5
- package/dist/generators/ts/AbstractContainerType.d.ts +3 -6
- package/dist/generators/ts/AbstractContainerType.js +34 -34
- package/dist/generators/ts/AbstractDateType.d.ts +1 -1
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +7 -10
- package/dist/generators/ts/AbstractLazyObjectType.js +20 -32
- package/dist/generators/ts/AbstractLiteralType.d.ts +1 -5
- package/dist/generators/ts/AbstractLiteralType.js +7 -6
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -6
- package/dist/generators/ts/AbstractPrimitiveType.js +7 -8
- package/dist/generators/ts/AbstractTermType.d.ts +1 -5
- package/dist/generators/ts/AbstractTermType.js +1 -15
- package/dist/generators/ts/AbstractType.d.ts +7 -5
- package/dist/generators/ts/AbstractType.js +12 -7
- package/dist/generators/ts/AbstractUnionType.d.ts +7 -10
- package/dist/generators/ts/AbstractUnionType.js +70 -81
- package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
- package/dist/generators/ts/AnonymousUnionType.js +1 -1
- package/dist/generators/ts/BigDecimalType.d.ts +1 -1
- package/dist/generators/ts/BigDecimalType.js +1 -1
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +1 -1
- package/dist/generators/ts/BlankNodeType.js +1 -1
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.js +2 -2
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +2 -6
- package/dist/generators/ts/DefaultValueType.js +12 -15
- package/dist/generators/ts/FloatType.d.ts +1 -1
- package/dist/generators/ts/FloatType.js +1 -1
- package/dist/generators/ts/IdentifierType.d.ts +1 -1
- package/dist/generators/ts/IdentifierType.js +1 -1
- package/dist/generators/ts/IntType.d.ts +1 -1
- package/dist/generators/ts/IntType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +3 -1
- package/dist/generators/ts/IriType.js +22 -17
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +1 -1
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +1 -1
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +1 -1
- package/dist/generators/ts/ListType.d.ts +1 -1
- package/dist/generators/ts/ListType.js +24 -24
- package/dist/generators/ts/LiteralType.d.ts +2 -1
- package/dist/generators/ts/LiteralType.js +9 -2
- package/dist/generators/ts/NamedObjectType.d.ts +1 -0
- package/dist/generators/ts/NamedObjectType.js +2 -1
- package/dist/generators/ts/NamedObjectUnionType.d.ts +1 -1
- package/dist/generators/ts/NamedObjectUnionType.js +6 -8
- package/dist/generators/ts/NamedUnionType.d.ts +1 -1
- package/dist/generators/ts/NamedUnionType.js +1 -1
- package/dist/generators/ts/OptionType.d.ts +1 -5
- package/dist/generators/ts/OptionType.js +2 -8
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +1 -1
- package/dist/generators/ts/SetType.d.ts +1 -1
- package/dist/generators/ts/SetType.js +1 -1
- package/dist/generators/ts/Snippets.d.ts +1 -0
- package/dist/generators/ts/Snippets.js +7 -0
- package/dist/generators/ts/StringType.d.ts +1 -1
- package/dist/generators/ts/StringType.js +2 -2
- package/dist/generators/ts/TermType.d.ts +1 -1
- package/dist/generators/ts/TermType.js +1 -1
- package/dist/generators/ts/TypeFactory.js +18 -18
- package/dist/generators/ts/ZodGenerator.js +1 -1
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +7 -7
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +8 -11
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +16 -7
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +3 -27
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +2 -6
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +19 -23
- package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_IriSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
- package/dist/generators/ts/_snippets/snippets_StringSchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +16 -0
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +3 -3
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.js +2 -2
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +1 -1
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateArray.js +1 -1
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +1 -1
- package/dist/generators/ts/tsComment.js +1 -1
- package/dist/input/generated.d.ts +1397 -1466
- package/dist/input/generated.js +520 -655
- package/package.json +6 -6
- package/dist/generators/ts/removeUndefined.d.ts +0 -2
- package/dist/generators/ts/removeUndefined.js +0 -17
|
@@ -8,7 +8,6 @@ import { Maybe } from "purify-ts";
|
|
|
8
8
|
import { invariant } from "ts-invariant";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractType } from "./AbstractType.js";
|
|
11
|
-
import { removeUndefined } from "./removeUndefined.js";
|
|
12
11
|
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
13
12
|
export class AbstractUnionType extends AbstractType {
|
|
14
13
|
discriminant;
|
|
@@ -25,14 +24,14 @@ export class AbstractUnionType extends AbstractType {
|
|
|
25
24
|
let discriminantValues;
|
|
26
25
|
invariant(this.discriminant.memberValues.length === members.length);
|
|
27
26
|
switch (this.discriminant.kind) {
|
|
28
|
-
case "
|
|
27
|
+
case "Extrinsic":
|
|
29
28
|
discriminantValues = [this.discriminant.memberValues[memberI]];
|
|
30
29
|
break;
|
|
31
|
-
case "
|
|
30
|
+
case "Hybrid":
|
|
32
31
|
discriminantValues =
|
|
33
32
|
this.discriminant.memberValues[memberI].ownValues;
|
|
34
33
|
break;
|
|
35
|
-
case "
|
|
34
|
+
case "Intrinsic": {
|
|
36
35
|
// A member type's combined discriminant property values are its "own" values plus any descendant values that are
|
|
37
36
|
// not the "own" values of some other member type.
|
|
38
37
|
// So if you have type A, type B, and B inherits A, then
|
|
@@ -57,7 +56,7 @@ export class AbstractUnionType extends AbstractType {
|
|
|
57
56
|
.descendantValues.filter((value) => !memberOwnDiscriminantPropertyValues.has(value)));
|
|
58
57
|
break;
|
|
59
58
|
}
|
|
60
|
-
case "
|
|
59
|
+
case "Typeof":
|
|
61
60
|
discriminantValues = [this.discriminant.memberValues[memberI]];
|
|
62
61
|
break;
|
|
63
62
|
default:
|
|
@@ -66,13 +65,13 @@ export class AbstractUnionType extends AbstractType {
|
|
|
66
65
|
invariant(discriminantValues.length > 0);
|
|
67
66
|
const typeCheck = (json) => (instance) => {
|
|
68
67
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
69
|
-
if (discriminant.kind === "
|
|
68
|
+
if (discriminant.kind === "Typeof") {
|
|
70
69
|
return code `(${joinCode(discriminantValues.map((discriminantValue) => code `typeof ${instance} === ${literalOf(discriminantValue)}`), { on: " || " })})`;
|
|
71
70
|
}
|
|
72
|
-
if (discriminant.kind === "
|
|
71
|
+
if (discriminant.kind === "Intrinsic" && !json) {
|
|
73
72
|
switch (member.type.kind) {
|
|
74
|
-
case "
|
|
75
|
-
case "
|
|
73
|
+
case "NamedObjectUnion":
|
|
74
|
+
case "NamedUnion":
|
|
76
75
|
case "NamedObjectType":
|
|
77
76
|
return code `${member.type.name}.is${member.type.name}(${instance})`;
|
|
78
77
|
}
|
|
@@ -85,45 +84,45 @@ export class AbstractUnionType extends AbstractType {
|
|
|
85
84
|
return {
|
|
86
85
|
discriminantValues,
|
|
87
86
|
jsonType: member.type.jsonType({
|
|
88
|
-
includeDiscriminantProperty: this.discriminant.kind === "
|
|
89
|
-
(this.discriminant.kind === "
|
|
90
|
-
this.discriminant.memberValues[memberI].kind === "
|
|
87
|
+
includeDiscriminantProperty: this.discriminant.kind === "Intrinsic" ||
|
|
88
|
+
(this.discriminant.kind === "Hybrid" &&
|
|
89
|
+
this.discriminant.memberValues[memberI].kind === "Intrinsic"),
|
|
91
90
|
}).name,
|
|
92
91
|
jsonTypeCheck: typeCheck(true),
|
|
93
92
|
primaryDiscriminantValue: discriminantValues[0],
|
|
94
93
|
type: member.type,
|
|
95
94
|
typeCheck: typeCheck(false),
|
|
96
95
|
typeToJsonExpression: (valueVariable) => member.type.toJsonExpression({
|
|
97
|
-
includeDiscriminantProperty: this.discriminant.kind === "
|
|
98
|
-
(this.discriminant.kind === "
|
|
99
|
-
this.discriminant.memberValues[memberI].kind === "
|
|
96
|
+
includeDiscriminantProperty: this.discriminant.kind === "Intrinsic" ||
|
|
97
|
+
(this.discriminant.kind === "Hybrid" &&
|
|
98
|
+
this.discriminant.memberValues[memberI].kind === "Intrinsic"),
|
|
100
99
|
variables: { value: valueVariable },
|
|
101
100
|
}),
|
|
102
101
|
unwrap: (instance) => {
|
|
103
102
|
switch (this.discriminant.kind) {
|
|
104
|
-
case "
|
|
103
|
+
case "Extrinsic":
|
|
105
104
|
return code `${instance}.value`;
|
|
106
|
-
case "
|
|
105
|
+
case "Hybrid":
|
|
107
106
|
return this.discriminant.memberValues[memberI].kind ===
|
|
108
|
-
"
|
|
107
|
+
"Intrinsic"
|
|
109
108
|
? instance
|
|
110
109
|
: code `${instance}.value`;
|
|
111
|
-
case "
|
|
112
|
-
case "
|
|
110
|
+
case "Intrinsic":
|
|
111
|
+
case "Typeof":
|
|
113
112
|
return instance;
|
|
114
113
|
}
|
|
115
114
|
},
|
|
116
115
|
wrap: (instance) => {
|
|
117
116
|
switch (this.discriminant.kind) {
|
|
118
|
-
case "
|
|
117
|
+
case "Extrinsic":
|
|
119
118
|
return code `{ ${this.discriminant.name}: ${literalOf(discriminantValues[0])} as const, value: ${instance} }`;
|
|
120
|
-
case "
|
|
119
|
+
case "Hybrid":
|
|
121
120
|
return this.discriminant.memberValues[memberI].kind ===
|
|
122
|
-
"
|
|
121
|
+
"Intrinsic"
|
|
123
122
|
? instance
|
|
124
123
|
: code `{ ${this.discriminant.name}: ${literalOf(discriminantValues[0])} as const, value: ${instance} }`;
|
|
125
|
-
case "
|
|
126
|
-
case "
|
|
124
|
+
case "Intrinsic":
|
|
125
|
+
case "Typeof":
|
|
127
126
|
return instance;
|
|
128
127
|
}
|
|
129
128
|
},
|
|
@@ -133,7 +132,7 @@ export class AbstractUnionType extends AbstractType {
|
|
|
133
132
|
get conversionFunction() {
|
|
134
133
|
return Maybe.of({
|
|
135
134
|
code: code `${this.reusables.snippets.identityConversionFunction}`,
|
|
136
|
-
sourceTypes: this.discriminant.kind === "
|
|
135
|
+
sourceTypes: this.discriminant.kind === "Typeof"
|
|
137
136
|
? this.members.map(({ primaryDiscriminantValue, type }) => ({
|
|
138
137
|
name: type.name,
|
|
139
138
|
typeof: primaryDiscriminantValue,
|
|
@@ -148,28 +147,28 @@ export class AbstractUnionType extends AbstractType {
|
|
|
148
147
|
}
|
|
149
148
|
get discriminantProperty() {
|
|
150
149
|
switch (this.discriminant.kind) {
|
|
151
|
-
case "
|
|
150
|
+
case "Extrinsic":
|
|
152
151
|
return Maybe.of({
|
|
153
152
|
descendantValues: [],
|
|
154
153
|
jsonName: this.discriminant.jsonName,
|
|
155
154
|
ownValues: this.discriminant.memberValues,
|
|
156
155
|
name: this.discriminant.name,
|
|
157
156
|
});
|
|
158
|
-
case "
|
|
157
|
+
case "Hybrid":
|
|
159
158
|
return Maybe.of({
|
|
160
159
|
descendantValues: [],
|
|
161
160
|
jsonName: this.discriminant.jsonName,
|
|
162
161
|
ownValues: this.discriminant.memberValues.flatMap((_) => _.ownValues),
|
|
163
162
|
name: "termType",
|
|
164
163
|
});
|
|
165
|
-
case "
|
|
164
|
+
case "Intrinsic":
|
|
166
165
|
return Maybe.of({
|
|
167
166
|
descendantValues: this.discriminant.memberValues.flatMap((_) => _.descendantValues),
|
|
168
167
|
jsonName: this.discriminant.jsonName,
|
|
169
168
|
name: this.discriminant.name,
|
|
170
169
|
ownValues: this.discriminant.memberValues.flatMap((_) => _.ownValues),
|
|
171
170
|
});
|
|
172
|
-
case "
|
|
171
|
+
case "Typeof":
|
|
173
172
|
return Maybe.empty();
|
|
174
173
|
default:
|
|
175
174
|
throw this.discriminant;
|
|
@@ -181,16 +180,12 @@ export class AbstractUnionType extends AbstractType {
|
|
|
181
180
|
get mutable() {
|
|
182
181
|
return this.members.some((member) => member.type.mutable);
|
|
183
182
|
}
|
|
184
|
-
get
|
|
185
|
-
return
|
|
183
|
+
get referencesObjectType() {
|
|
184
|
+
return this.members.some((member) => member.type.referencesObjectType);
|
|
186
185
|
}
|
|
187
186
|
get schemaType() {
|
|
188
|
-
invariant(this.kind.endsWith("Type"));
|
|
189
187
|
return code `${{
|
|
190
|
-
|
|
191
|
-
// kind: '"extrinsic" | "intrinsic" | "typeof"',
|
|
192
|
-
// },
|
|
193
|
-
kind: code `${literalOf(this.kind.substring(0, this.kind.length - "Type".length))}`,
|
|
188
|
+
kind: this.kind,
|
|
194
189
|
members: code `{ ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}: ${{
|
|
195
190
|
discriminantValues: code `readonly (number | string)[]`,
|
|
196
191
|
type: type.schemaType,
|
|
@@ -288,9 +283,9 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
|
|
|
288
283
|
resourceValues: code `valueAsValues`,
|
|
289
284
|
},
|
|
290
285
|
});
|
|
291
|
-
if (this.discriminant.kind === "
|
|
292
|
-
(this.discriminant.kind === "
|
|
293
|
-
this.discriminant.memberValues[memberI].kind === "
|
|
286
|
+
if (this.discriminant.kind === "Extrinsic" ||
|
|
287
|
+
(this.discriminant.kind === "Hybrid" &&
|
|
288
|
+
this.discriminant.memberValues[memberI].kind === "Extrinsic")) {
|
|
294
289
|
typeExpression = code `${typeExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: ${literalOf(primaryDiscriminantValue)} as const, value }) as (${this.name})))`;
|
|
295
290
|
}
|
|
296
291
|
typeExpression = code `(${typeExpression} as ${this.reusables.imports.Either}<Error, ${this.reusables.imports.Resource}.Values<${this.name}>>)`;
|
|
@@ -311,14 +306,14 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
311
306
|
get inlineJsonSchema() {
|
|
312
307
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
313
308
|
switch (discriminant.kind) {
|
|
314
|
-
case "
|
|
309
|
+
case "Extrinsic":
|
|
315
310
|
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
|
|
316
|
-
case "
|
|
311
|
+
case "Hybrid":
|
|
317
312
|
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
318
313
|
switch (discriminant.memberValues[memberI].kind) {
|
|
319
|
-
case "
|
|
314
|
+
case "Extrinsic":
|
|
320
315
|
return code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
|
|
321
|
-
case "
|
|
316
|
+
case "Intrinsic":
|
|
322
317
|
return type.jsonSchema({
|
|
323
318
|
includeDiscriminantProperty: true,
|
|
324
319
|
context: "type",
|
|
@@ -327,12 +322,12 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
327
322
|
throw new Error();
|
|
328
323
|
}
|
|
329
324
|
}), { on: "," })}]).readonly()`;
|
|
330
|
-
case "
|
|
325
|
+
case "Intrinsic":
|
|
331
326
|
return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
|
|
332
327
|
includeDiscriminantProperty: true,
|
|
333
328
|
context: "type",
|
|
334
329
|
})), { on: "," })}]).readonly()`;
|
|
335
|
-
case "
|
|
330
|
+
case "Typeof":
|
|
336
331
|
return code `${this.reusables.imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
|
|
337
332
|
default:
|
|
338
333
|
throw discriminant;
|
|
@@ -341,21 +336,21 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
341
336
|
get inlineJsonType() {
|
|
342
337
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
343
338
|
switch (discriminant.kind) {
|
|
344
|
-
case "
|
|
339
|
+
case "Extrinsic":
|
|
345
340
|
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`), { on: "|" })})`);
|
|
346
|
-
case "
|
|
341
|
+
case "Hybrid":
|
|
347
342
|
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }, memberI) => {
|
|
348
343
|
switch (discriminant.memberValues[memberI].kind) {
|
|
349
|
-
case "
|
|
344
|
+
case "Extrinsic":
|
|
350
345
|
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`;
|
|
351
|
-
case "
|
|
346
|
+
case "Intrinsic":
|
|
352
347
|
return code `${jsonType}`;
|
|
353
348
|
default:
|
|
354
349
|
throw new Error();
|
|
355
350
|
}
|
|
356
351
|
}), { on: "|" })})`);
|
|
357
|
-
case "
|
|
358
|
-
case "
|
|
352
|
+
case "Intrinsic":
|
|
353
|
+
case "Typeof":
|
|
359
354
|
return new AbstractType.JsonType(joinCode(this.members.map(({ jsonType }) => code `${jsonType}`), { on: "|" }));
|
|
360
355
|
default:
|
|
361
356
|
throw discriminant;
|
|
@@ -364,24 +359,24 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
364
359
|
get inlineName() {
|
|
365
360
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
366
361
|
switch (discriminant.kind) {
|
|
367
|
-
case "
|
|
362
|
+
case "Extrinsic":
|
|
368
363
|
return code `(${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.name} }`), { on: "|" })})`;
|
|
369
|
-
case "
|
|
364
|
+
case "Hybrid":
|
|
370
365
|
return code `(${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
371
366
|
switch (discriminant.memberValues[memberI].kind) {
|
|
372
|
-
case "
|
|
367
|
+
case "Extrinsic":
|
|
373
368
|
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.name} }`;
|
|
374
|
-
case "
|
|
369
|
+
case "Intrinsic":
|
|
375
370
|
return code `${type.name}`;
|
|
376
371
|
default:
|
|
377
372
|
throw new Error();
|
|
378
373
|
}
|
|
379
374
|
}), { on: "|" })})`;
|
|
380
|
-
case "
|
|
375
|
+
case "Intrinsic":
|
|
381
376
|
// If every type shares a discriminant (e.g., RDF/JS "termType" or generated NamedObjectType "type"),
|
|
382
377
|
// just join their names with "|"
|
|
383
378
|
return code `(${joinCode(this.members.map(({ type }) => code `${type.name}`), { on: "|" })})`;
|
|
384
|
-
case "
|
|
379
|
+
case "Typeof":
|
|
385
380
|
// The type.name may include literal values, but they should still be unambiguous with other member types since the typeofs
|
|
386
381
|
// of the different member types are known to be different.
|
|
387
382
|
return code `(${joinCode(this.members.map(({ type }) => code `${type.name}`), { on: "|" })})`;
|
|
@@ -458,14 +453,11 @@ unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...oth
|
|
|
458
453
|
return [{ patterns: unionPatterns, type: "union" }];
|
|
459
454
|
}) satisfies ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
460
455
|
}
|
|
461
|
-
get
|
|
462
|
-
return {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
type: type.schema,
|
|
467
|
-
}}`), { on: "," })} }`,
|
|
468
|
-
};
|
|
456
|
+
get schemaInitializers() {
|
|
457
|
+
return super.schemaInitializers.concat(code `members: { ${joinCode(this.members.map(({ discriminantValues, type, primaryDiscriminantValue }) => code `${literalOf(primaryDiscriminantValue)}: ${{
|
|
458
|
+
discriminantValues: discriminantValues,
|
|
459
|
+
type: type.schema,
|
|
460
|
+
}}`), { on: "," })} }`);
|
|
469
461
|
}
|
|
470
462
|
jsonUiSchemaElement() {
|
|
471
463
|
return Maybe.empty();
|
|
@@ -484,9 +476,6 @@ __decorate([
|
|
|
484
476
|
__decorate([
|
|
485
477
|
Memoize()
|
|
486
478
|
], AbstractUnionType.prototype, "mutable", null);
|
|
487
|
-
__decorate([
|
|
488
|
-
Memoize()
|
|
489
|
-
], AbstractUnionType.prototype, "schema", null);
|
|
490
479
|
__decorate([
|
|
491
480
|
Memoize()
|
|
492
481
|
], AbstractUnionType.prototype, "toRdfResourceValueTypes", null);
|
|
@@ -516,11 +505,11 @@ __decorate([
|
|
|
516
505
|
], AbstractUnionType.prototype, "inlineValueSparqlWherePatternsFunction", null);
|
|
517
506
|
function termTypes(type) {
|
|
518
507
|
switch (type.kind) {
|
|
519
|
-
case "
|
|
520
|
-
case "
|
|
521
|
-
case "
|
|
522
|
-
case "
|
|
523
|
-
case "
|
|
508
|
+
case "BlankNode":
|
|
509
|
+
case "Iri":
|
|
510
|
+
case "Identifier":
|
|
511
|
+
case "Literal":
|
|
512
|
+
case "Term":
|
|
524
513
|
return type.termTypes;
|
|
525
514
|
default:
|
|
526
515
|
return emptyTermTypesSet;
|
|
@@ -534,7 +523,7 @@ export var Discriminant;
|
|
|
534
523
|
if (members.some((member) => member.discriminantValue.isJust())) {
|
|
535
524
|
return {
|
|
536
525
|
jsonName: "type",
|
|
537
|
-
kind: "
|
|
526
|
+
kind: "Extrinsic",
|
|
538
527
|
memberValues: members.map((member, memberI) => member.discriminantValue.orDefault(memberI)),
|
|
539
528
|
name: "type",
|
|
540
529
|
};
|
|
@@ -566,7 +555,7 @@ export var Discriminant;
|
|
|
566
555
|
if (inlineDiscriminantProperty) {
|
|
567
556
|
return {
|
|
568
557
|
jsonName: inlineDiscriminantProperty.jsonName,
|
|
569
|
-
kind: "
|
|
558
|
+
kind: "Intrinsic",
|
|
570
559
|
memberValues,
|
|
571
560
|
name: inlineDiscriminantProperty.name,
|
|
572
561
|
};
|
|
@@ -583,7 +572,7 @@ export var Discriminant;
|
|
|
583
572
|
if (memberTypeofsSet.size === memberTypes.length) {
|
|
584
573
|
return {
|
|
585
574
|
memberValues: memberTypes.flatMap((memberType) => memberType.typeofs),
|
|
586
|
-
kind: "
|
|
575
|
+
kind: "Typeof",
|
|
587
576
|
};
|
|
588
577
|
}
|
|
589
578
|
}
|
|
@@ -606,17 +595,17 @@ export var Discriminant;
|
|
|
606
595
|
}
|
|
607
596
|
return {
|
|
608
597
|
jsonName: "termType",
|
|
609
|
-
kind: "
|
|
598
|
+
kind: "Hybrid",
|
|
610
599
|
memberValues: memberTypes.map((memberType, memberTypeI) => {
|
|
611
600
|
const memberTermTypes = termTypes(memberType);
|
|
612
601
|
if (memberTermTypes.size > 0) {
|
|
613
602
|
return {
|
|
614
|
-
kind: "
|
|
603
|
+
kind: "Intrinsic",
|
|
615
604
|
ownValues: [...memberTermTypes],
|
|
616
605
|
};
|
|
617
606
|
}
|
|
618
607
|
return {
|
|
619
|
-
kind: "
|
|
608
|
+
kind: "Extrinsic",
|
|
620
609
|
ownValues: extrinsicMemberTypeNamesSet.size === extrinsicMemberTypeCount
|
|
621
610
|
? [memberType.name]
|
|
622
611
|
: [memberTypeI.toString()],
|
|
@@ -649,7 +638,7 @@ export var Discriminant;
|
|
|
649
638
|
invariant(memberValues.length === memberTypes.length);
|
|
650
639
|
return {
|
|
651
640
|
jsonName: "type",
|
|
652
|
-
kind: "
|
|
641
|
+
kind: "Extrinsic",
|
|
653
642
|
name: "type",
|
|
654
643
|
memberValues: memberValues,
|
|
655
644
|
};
|
|
@@ -6,7 +6,7 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
6
6
|
export declare class AnonymousUnionType extends AbstractUnionType<Type> {
|
|
7
7
|
readonly declaration: Maybe<Code>;
|
|
8
8
|
readonly graphqlArgs: AbstractType["graphqlArgs"];
|
|
9
|
-
readonly kind = "
|
|
9
|
+
readonly kind = "AnonymousUnion";
|
|
10
10
|
get equalsFunction(): Code;
|
|
11
11
|
get filterFunction(): Code;
|
|
12
12
|
get filterType(): Code;
|
|
@@ -4,7 +4,7 @@ import { code } from "./ts-poet-wrapper.js";
|
|
|
4
4
|
export class AnonymousUnionType extends AbstractUnionType {
|
|
5
5
|
declaration = Maybe.empty();
|
|
6
6
|
graphqlArgs = Maybe.empty();
|
|
7
|
-
kind = "
|
|
7
|
+
kind = "AnonymousUnion";
|
|
8
8
|
get equalsFunction() {
|
|
9
9
|
return this.inlineEqualsFunction;
|
|
10
10
|
}
|
|
@@ -8,7 +8,7 @@ export declare class BigDecimalType extends AbstractLiteralType {
|
|
|
8
8
|
readonly filterFunction: Code;
|
|
9
9
|
readonly filterType: Code;
|
|
10
10
|
readonly hashFunction: Code;
|
|
11
|
-
readonly kind = "
|
|
11
|
+
readonly kind = "BigDecimal";
|
|
12
12
|
readonly schemaType: Code;
|
|
13
13
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
14
14
|
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
@@ -14,7 +14,7 @@ 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
|
-
kind = "
|
|
17
|
+
kind = "BigDecimal";
|
|
18
18
|
schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
|
|
19
19
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
|
|
20
20
|
get graphqlType() {
|
|
@@ -2,7 +2,7 @@ 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 kind = "
|
|
5
|
+
readonly kind = "BigInt";
|
|
6
6
|
readonly typeofs: "bigint"[];
|
|
7
7
|
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
8
|
fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
|
|
@@ -9,7 +9,7 @@ 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
|
-
kind = "
|
|
12
|
+
kind = "BigInt";
|
|
13
13
|
typeofs = ["bigint"];
|
|
14
14
|
get graphqlType() {
|
|
15
15
|
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
|
|
@@ -7,7 +7,7 @@ export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
|
|
|
7
7
|
readonly filterFunction: Code;
|
|
8
8
|
readonly filterType: Code;
|
|
9
9
|
readonly parseFunction: Code;
|
|
10
|
-
readonly kind = "
|
|
10
|
+
readonly kind = "BlankNode";
|
|
11
11
|
readonly name: Code;
|
|
12
12
|
readonly nodeKinds: ReadonlySet<"BlankNode">;
|
|
13
13
|
readonly schemaType: Code;
|
|
@@ -25,7 +25,7 @@ export class BlankNodeType extends AbstractIdentifierType {
|
|
|
25
25
|
filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
|
|
26
26
|
filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
|
|
27
27
|
parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
|
|
28
|
-
kind = "
|
|
28
|
+
kind = "BlankNode";
|
|
29
29
|
name = code `${this.reusables.imports.BlankNode}`;
|
|
30
30
|
nodeKinds = nodeKinds;
|
|
31
31
|
schemaType = code `${this.reusables.snippets.BlankNodeSchema}`;
|
|
@@ -6,7 +6,7 @@ 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 kind = "
|
|
9
|
+
readonly kind = "Boolean";
|
|
10
10
|
readonly schemaType: Code;
|
|
11
11
|
readonly typeofs: "boolean"[];
|
|
12
12
|
readonly valueSparqlWherePatternsFunction: 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
|
-
kind = "
|
|
17
|
-
schemaType = code `${this.reusables.snippets.BooleanSchema}
|
|
16
|
+
kind = "Boolean";
|
|
17
|
+
schemaType = code `${this.reusables.snippets.BooleanSchema}<${this.name}>`;
|
|
18
18
|
typeofs = ["boolean"];
|
|
19
19
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
|
|
20
20
|
get name() {
|
|
@@ -4,7 +4,7 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
4
4
|
export declare class DateTimeType extends AbstractDateType {
|
|
5
5
|
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
6
6
|
readonly hashFunction: Code;
|
|
7
|
-
readonly kind = "
|
|
7
|
+
readonly kind = "DateTime";
|
|
8
8
|
jsonSchema(_parameters: Parameters<AbstractDateType["jsonSchema"]>[0]): Code;
|
|
9
9
|
literalExpression(literal: Date | Literal): Code;
|
|
10
10
|
toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
|
|
@@ -4,7 +4,7 @@ import { code } from "./ts-poet-wrapper.js";
|
|
|
4
4
|
export class DateTimeType extends AbstractDateType {
|
|
5
5
|
graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
|
|
6
6
|
hashFunction = code `${this.reusables.snippets.hashDateTime}`;
|
|
7
|
-
kind = "
|
|
7
|
+
kind = "DateTime";
|
|
8
8
|
jsonSchema(_parameters) {
|
|
9
9
|
return code `${this.reusables.imports.z}.iso.datetime()`;
|
|
10
10
|
}
|
|
@@ -5,7 +5,7 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
5
5
|
export declare class DateType extends AbstractDateType {
|
|
6
6
|
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
7
7
|
readonly hashFunction: Code;
|
|
8
|
-
readonly kind = "
|
|
8
|
+
readonly kind = "Date";
|
|
9
9
|
jsonSchema(_parameters: Parameters<DateTimeType["jsonSchema"]>[0]): Code;
|
|
10
10
|
literalExpression(literal: Date | Literal): Code;
|
|
11
11
|
toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
|
|
@@ -5,7 +5,7 @@ import { code } from "./ts-poet-wrapper.js";
|
|
|
5
5
|
export class DateType extends AbstractDateType {
|
|
6
6
|
graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
|
|
7
7
|
hashFunction = code `${this.reusables.snippets.hashDate}`;
|
|
8
|
-
kind = "
|
|
8
|
+
kind = "Date";
|
|
9
9
|
jsonSchema(_parameters) {
|
|
10
10
|
return code `${this.reusables.imports.z}.iso.date()`;
|
|
11
11
|
}
|
|
@@ -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 kind = "
|
|
12
|
+
readonly kind = "DefaultValue";
|
|
13
13
|
readonly typeofs: "object"[];
|
|
14
14
|
readonly validationFunction: Maybe<Code>;
|
|
15
15
|
constructor({ defaultValue, ...superParameters }: {
|
|
@@ -26,11 +26,7 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
|
|
|
26
26
|
get schemaType(): Code;
|
|
27
27
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
28
28
|
get valueSparqlWherePatternsFunction(): Code;
|
|
29
|
-
protected get
|
|
30
|
-
defaultValue: Code;
|
|
31
|
-
item: Code;
|
|
32
|
-
kind: Code;
|
|
33
|
-
};
|
|
29
|
+
protected get schemaInitializers(): Code[];
|
|
34
30
|
private get defaultValueExpression();
|
|
35
31
|
fromJsonExpression(parameters: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
|
|
36
32
|
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
@@ -13,7 +13,7 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
13
13
|
defaultValue;
|
|
14
14
|
discriminantProperty = Maybe.empty();
|
|
15
15
|
graphqlArgs = Maybe.empty();
|
|
16
|
-
kind = "
|
|
16
|
+
kind = "DefaultValue";
|
|
17
17
|
typeofs = ["object"];
|
|
18
18
|
validationFunction = this.itemType.validationFunction;
|
|
19
19
|
constructor({ defaultValue, ...superParameters }) {
|
|
@@ -62,24 +62,21 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
62
62
|
get valueSparqlWherePatternsFunction() {
|
|
63
63
|
return code `${this.reusables.snippets.defaultValueSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
|
|
64
64
|
}
|
|
65
|
-
get
|
|
66
|
-
return {
|
|
67
|
-
...super.schemaObject,
|
|
68
|
-
defaultValue: this.defaultValueExpression,
|
|
69
|
-
};
|
|
65
|
+
get schemaInitializers() {
|
|
66
|
+
return super.schemaInitializers.concat(code `defaultValue: ${this.defaultValueExpression}`);
|
|
70
67
|
}
|
|
71
68
|
get defaultValueExpression() {
|
|
72
69
|
switch (this.itemType.kind) {
|
|
73
|
-
case "
|
|
74
|
-
case "
|
|
75
|
-
case "
|
|
76
|
-
case "
|
|
70
|
+
case "Identifier":
|
|
71
|
+
case "Iri":
|
|
72
|
+
case "Literal":
|
|
73
|
+
case "Term":
|
|
77
74
|
return this.rdfjsTermExpression(this.defaultValue);
|
|
78
|
-
case "
|
|
79
|
-
case "
|
|
75
|
+
case "AnonymousUnion":
|
|
76
|
+
case "List":
|
|
80
77
|
case "NamedObjectType":
|
|
81
|
-
case "
|
|
82
|
-
case "
|
|
78
|
+
case "NamedObjectUnion":
|
|
79
|
+
case "NamedUnion":
|
|
83
80
|
throw new RangeError(`not implemented ${this.itemType.kind}`);
|
|
84
81
|
}
|
|
85
82
|
invariant(this.defaultValue.termType === "Literal");
|
|
@@ -136,7 +133,7 @@ __decorate([
|
|
|
136
133
|
], DefaultValueType.prototype, "defaultValueExpression", null);
|
|
137
134
|
(function (DefaultValueType) {
|
|
138
135
|
function isItemType(type) {
|
|
139
|
-
if (type.kind === "
|
|
136
|
+
if (type.kind === "BlankNode") {
|
|
140
137
|
return false;
|
|
141
138
|
}
|
|
142
139
|
return AbstractContainerType.isItemType(type);
|
|
@@ -2,7 +2,7 @@ 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 kind = "
|
|
5
|
+
readonly kind = "Float";
|
|
6
6
|
readonly typeofs: "number"[];
|
|
7
7
|
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
8
|
literalExpression(literal: Literal | number): Code;
|
|
@@ -9,7 +9,7 @@ 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
|
-
kind = "
|
|
12
|
+
kind = "Float";
|
|
13
13
|
typeofs = ["number"];
|
|
14
14
|
get graphqlType() {
|
|
15
15
|
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLFloat}`, this.reusables);
|
|
@@ -8,7 +8,7 @@ export declare class IdentifierType extends AbstractIdentifierType<BlankNode | N
|
|
|
8
8
|
readonly filterFunction: Code;
|
|
9
9
|
readonly filterType: Code;
|
|
10
10
|
readonly parseFunction: Code;
|
|
11
|
-
readonly kind = "
|
|
11
|
+
readonly kind = "Identifier";
|
|
12
12
|
readonly name: Code;
|
|
13
13
|
readonly nodeKinds: ReadonlySet<IdentifierNodeKind>;
|
|
14
14
|
readonly schemaType: Code;
|