@shaclmate/compiler 4.0.23 → 4.0.25
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/Compiler.d.ts +1 -1
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -1
- package/dist/ShapesGraphToAstTransformer.js +16 -16
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +5 -2
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +6 -5
- package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/shapeOntology.js +4 -3
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +11 -17
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +3 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +6 -11
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +21 -40
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
- package/dist/ast/AbstractCompoundType.d.ts +1 -1
- package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
- package/dist/ast/ListType.d.ts +1 -8
- package/dist/ast/ListType.js +1 -6
- package/dist/ast/ObjectType.d.ts +3 -30
- package/dist/ast/ObjectType.js +2 -26
- package/dist/generators/ts/AbstractContainerType.d.ts +0 -1
- package/dist/generators/ts/AbstractContainerType.js +0 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +0 -1
- package/dist/generators/ts/AbstractLazyObjectType.js +2 -2
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +1 -2
- package/dist/generators/ts/AbstractNamedUnionType.js +16 -19
- package/dist/generators/ts/AbstractTermType.d.ts +0 -1
- package/dist/generators/ts/AbstractTermType.js +0 -1
- package/dist/generators/ts/AbstractType.d.ts +0 -4
- package/dist/generators/ts/AbstractUnionType.d.ts +1 -10
- package/dist/generators/ts/AbstractUnionType.js +27 -40
- package/dist/generators/ts/LazyObjectOptionType.js +3 -2
- package/dist/generators/ts/LazyObjectSetType.js +2 -1
- package/dist/generators/ts/LazyObjectType.js +2 -1
- package/dist/generators/ts/ListType.d.ts +1 -5
- package/dist/generators/ts/ListType.js +8 -27
- package/dist/generators/ts/NamedObjectType.d.ts +2 -21
- package/dist/generators/ts/NamedObjectType.js +33 -132
- package/dist/generators/ts/NamedObjectUnionType.js +14 -25
- package/dist/generators/ts/TypeFactory.js +11 -67
- package/dist/generators/ts/ZodGenerator.js +2 -2
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +11 -17
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +7 -6
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +1 -4
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +19 -34
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +5 -15
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +31 -212
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +25 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -13
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +49 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +0 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +41 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/{NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js → NamedObjectType_toRdfResourceFunctionDeclaration.js} +8 -27
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +40 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/Property.d.ts +1 -2
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -3
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +8 -39
- package/dist/generators/ts/_snippets/snippets_LazyObject.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +2 -2
- package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +2 -2
- package/dist/generators/ts/imports.d.ts +0 -2
- package/dist/generators/ts/imports.js +0 -2
- package/dist/generators/ts/objectSetDeclarations.js +1 -3
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +4 -6
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +2 -2
- package/dist/input/ShapesGraph.d.ts +1 -1
- package/dist/input/generated.d.ts +10 -181
- package/dist/input/generated.js +116 -392
- package/package.json +2 -4
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/nodeShapeIdentifierMintingStrategy.js +0 -32
- package/dist/enums/IdentifierMintingStrategy.d.ts +0 -9
- package/dist/enums/IdentifierMintingStrategy.js +0 -18
- package/dist/enums/TsObjectDeclarationType.d.ts +0 -9
- package/dist/enums/TsObjectDeclarationType.js +0 -16
- package/dist/enums/Visibility.d.ts +0 -6
- package/dist/enums/Visibility.js +0 -18
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.d.ts +0 -33
- package/dist/generators/ts/_NamedObjectType/IdentifierPrefixProperty.js +0 -92
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +0 -62
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +0 -51
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +0 -73
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js +0 -59
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +0 -62
- /package/dist/{enums → generators/ts}/TsFeature.d.ts +0 -0
- /package/dist/{enums → generators/ts}/TsFeature.js +0 -0
|
@@ -16,7 +16,6 @@ import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
|
16
16
|
export class AbstractUnionType extends AbstractType {
|
|
17
17
|
discriminant;
|
|
18
18
|
identifierType;
|
|
19
|
-
abstract = false;
|
|
20
19
|
recursive;
|
|
21
20
|
constructor({ identifierType, members, recursive, ...superParameters }) {
|
|
22
21
|
super(superParameters);
|
|
@@ -25,9 +24,6 @@ export class AbstractUnionType extends AbstractType {
|
|
|
25
24
|
this.recursive = recursive;
|
|
26
25
|
this.discriminant = Discriminant.infer(members);
|
|
27
26
|
this.lazyMembers = () => members.map((member, memberI) => {
|
|
28
|
-
if (member.type.abstract) {
|
|
29
|
-
return { abstract: true, discriminantValues: [], type: member.type };
|
|
30
|
-
}
|
|
31
27
|
let discriminantValues;
|
|
32
28
|
invariant(this.discriminant.memberValues.length === members.length);
|
|
33
29
|
switch (this.discriminant.kind) {
|
|
@@ -69,9 +65,7 @@ export class AbstractUnionType extends AbstractType {
|
|
|
69
65
|
default:
|
|
70
66
|
throw this.discriminant;
|
|
71
67
|
}
|
|
72
|
-
|
|
73
|
-
return { abstract: true, discriminantValues: [], type: member.type };
|
|
74
|
-
}
|
|
68
|
+
invariant(discriminantValues.length > 0);
|
|
75
69
|
const typeCheck = (json) => (instance) => {
|
|
76
70
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
77
71
|
if (discriminant.kind === "typeof") {
|
|
@@ -82,13 +76,12 @@ export class AbstractUnionType extends AbstractType {
|
|
|
82
76
|
case "NamedObjectUnionType":
|
|
83
77
|
case "NamedUnionType":
|
|
84
78
|
case "NamedObjectType":
|
|
85
|
-
return code `${member.type.
|
|
79
|
+
return code `${member.type.name}.is${member.type.name}(${instance})`;
|
|
86
80
|
}
|
|
87
81
|
}
|
|
88
82
|
return code `(${joinCode(discriminantValues.map((discriminantValue) => code `${instance}.${discriminant.name} === ${literalOf(discriminantValue)}`), { on: " || " })})`;
|
|
89
83
|
};
|
|
90
84
|
return {
|
|
91
|
-
abstract: false,
|
|
92
85
|
discriminantValues,
|
|
93
86
|
jsonType: member.type.jsonType({
|
|
94
87
|
includeDiscriminantProperty: this.discriminant.kind === "intrinsic" ||
|
|
@@ -150,7 +143,7 @@ export class AbstractUnionType extends AbstractType {
|
|
|
150
143
|
},
|
|
151
144
|
];
|
|
152
145
|
case "typeof":
|
|
153
|
-
return this.
|
|
146
|
+
return this.members.map(({ primaryDiscriminantValue, type, typeCheck }) => ({
|
|
154
147
|
conversionExpression: (value) => value,
|
|
155
148
|
sourceTypeCheckExpression: (value) => typeCheck(value),
|
|
156
149
|
sourceTypeName: type.name,
|
|
@@ -202,7 +195,7 @@ export class AbstractUnionType extends AbstractType {
|
|
|
202
195
|
// kind: '"extrinsic" | "intrinsic" | "typeof"',
|
|
203
196
|
// },
|
|
204
197
|
kind: code `${literalOf(this.kind.substring(0, this.kind.length - "Type".length))}`,
|
|
205
|
-
members: code `{ ${joinCode(this.
|
|
198
|
+
members: code `{ ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}: ${{
|
|
206
199
|
discriminantValues: code `readonly (number | string)[]`,
|
|
207
200
|
type: type.schemaType,
|
|
208
201
|
}}`), { on: ";" })} }`,
|
|
@@ -218,15 +211,12 @@ export class AbstractUnionType extends AbstractType {
|
|
|
218
211
|
return set;
|
|
219
212
|
}
|
|
220
213
|
get typeofs() {
|
|
221
|
-
return NonEmptyList.fromArray(this.
|
|
222
|
-
}
|
|
223
|
-
get concreteMembers() {
|
|
224
|
-
return this.members.filter((member) => !member.abstract);
|
|
214
|
+
return NonEmptyList.fromArray(this.members.flatMap((member) => member.type.typeofs)).unsafeCoerce();
|
|
225
215
|
}
|
|
226
216
|
get inlineEqualsFunction() {
|
|
227
217
|
return code `\
|
|
228
218
|
((left: ${this.name}, right: ${this.name}) => {
|
|
229
|
-
${joinCode(this.
|
|
219
|
+
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `left`)} && ${typeCheck(code `right`)}) {
|
|
230
220
|
return ${type.equalsFunction}(${unwrap(code `left`)} as ${type.name}, ${unwrap(code `right`)} as ${type.name});
|
|
231
221
|
}`))}
|
|
232
222
|
|
|
@@ -239,11 +229,11 @@ ${joinCode(this.concreteMembers.map(({ type, typeCheck, unwrap }) => code `if ($
|
|
|
239
229
|
${joinCode([
|
|
240
230
|
...this.identifierType
|
|
241
231
|
.map((identifierType) => code `\
|
|
242
|
-
if (filter.${syntheticNamePrefix}identifier !== undefined && !${identifierType.filterFunction}(filter.${syntheticNamePrefix}identifier, value.${syntheticNamePrefix}identifier)) {
|
|
232
|
+
if (filter.${syntheticNamePrefix}identifier !== undefined && !${identifierType.filterFunction}(filter.${syntheticNamePrefix}identifier, value.${syntheticNamePrefix}identifier())) {
|
|
243
233
|
return false;
|
|
244
234
|
}`)
|
|
245
235
|
.toList(),
|
|
246
|
-
...this.
|
|
236
|
+
...this.members.map(({ primaryDiscriminantValue, type, typeCheck, unwrap }) => code `\
|
|
247
237
|
if (filter.on?.[${literalOf(primaryDiscriminantValue)}] !== undefined && ${typeCheck(code `value`)}) {
|
|
248
238
|
if (!${type.filterFunction}(filter.on[${literalOf(primaryDiscriminantValue)}], ${unwrap(code `value`)})) {
|
|
249
239
|
return false;
|
|
@@ -258,13 +248,13 @@ if (filter.on?.[${literalOf(primaryDiscriminantValue)}] !== undefined && ${typeC
|
|
|
258
248
|
return code `\
|
|
259
249
|
{
|
|
260
250
|
${this.identifierType.map((identifierType) => code `readonly ${syntheticNamePrefix}identifier?: ${identifierType.filterType};`).orDefault(code ``)}
|
|
261
|
-
readonly on?: { ${joinCode(this.
|
|
251
|
+
readonly on?: { ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}?: ${type.filterType}`), { on: ";" })} }
|
|
262
252
|
}`;
|
|
263
253
|
}
|
|
264
254
|
get inlineFromJsonFunction() {
|
|
265
255
|
return code `\
|
|
266
256
|
((value: ${this.jsonType().name}): ${this.name} => {
|
|
267
|
-
${joinCode(this.
|
|
257
|
+
${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) => code `if (${jsonTypeCheck(code `value`)}) { return ${wrap(type.fromJsonExpression({
|
|
268
258
|
variables: {
|
|
269
259
|
value: code `(${unwrap(code `value`)} as ${jsonType})`,
|
|
270
260
|
},
|
|
@@ -287,7 +277,7 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
287
277
|
(((values, _options) =>
|
|
288
278
|
values.chain(values => values.chainMap(value => {
|
|
289
279
|
const valueAsValues = ${imports.Right}(value.toValues());
|
|
290
|
-
return ${this.
|
|
280
|
+
return ${this.members.reduce((expression, { type, primaryDiscriminantValue }, memberI) => {
|
|
291
281
|
let typeExpression = type.fromRdfResourceValuesExpression({
|
|
292
282
|
variables: {
|
|
293
283
|
context: variables.context,
|
|
@@ -317,9 +307,9 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
317
307
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
318
308
|
switch (discriminant.kind) {
|
|
319
309
|
case "extrinsic":
|
|
320
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.
|
|
310
|
+
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
|
|
321
311
|
case "hybrid":
|
|
322
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.
|
|
312
|
+
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
323
313
|
switch (discriminant.memberValues[memberI].kind) {
|
|
324
314
|
case "extrinsic":
|
|
325
315
|
return code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
|
|
@@ -333,12 +323,12 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
333
323
|
}
|
|
334
324
|
}), { on: "," })}]).readonly()`;
|
|
335
325
|
case "intrinsic":
|
|
336
|
-
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.
|
|
326
|
+
return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
|
|
337
327
|
includeDiscriminantProperty: true,
|
|
338
328
|
context: "type",
|
|
339
329
|
})), { on: "," })}]).readonly()`;
|
|
340
330
|
case "typeof":
|
|
341
|
-
return code `${imports.z}.union([${joinCode(this.
|
|
331
|
+
return code `${imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
|
|
342
332
|
default:
|
|
343
333
|
throw discriminant;
|
|
344
334
|
}
|
|
@@ -347,9 +337,9 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
347
337
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
348
338
|
switch (discriminant.kind) {
|
|
349
339
|
case "extrinsic":
|
|
350
|
-
return new AbstractType.JsonType(code `(${joinCode(this.
|
|
340
|
+
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`), { on: "|" })})`);
|
|
351
341
|
case "hybrid":
|
|
352
|
-
return new AbstractType.JsonType(code `(${joinCode(this.
|
|
342
|
+
return new AbstractType.JsonType(code `(${joinCode(this.members.map(({ jsonType, primaryDiscriminantValue }, memberI) => {
|
|
353
343
|
switch (discriminant.memberValues[memberI].kind) {
|
|
354
344
|
case "extrinsic":
|
|
355
345
|
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${jsonType} }`;
|
|
@@ -361,7 +351,7 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
361
351
|
}), { on: "|" })})`);
|
|
362
352
|
case "intrinsic":
|
|
363
353
|
case "typeof":
|
|
364
|
-
return new AbstractType.JsonType(joinCode(this.
|
|
354
|
+
return new AbstractType.JsonType(joinCode(this.members.map(({ jsonType }) => code `${jsonType}`), { on: "|" }));
|
|
365
355
|
default:
|
|
366
356
|
throw discriminant;
|
|
367
357
|
}
|
|
@@ -370,9 +360,9 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
370
360
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
371
361
|
switch (discriminant.kind) {
|
|
372
362
|
case "extrinsic":
|
|
373
|
-
return code `(${joinCode(this.
|
|
363
|
+
return code `(${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.name} }`), { on: "|" })})`;
|
|
374
364
|
case "hybrid":
|
|
375
|
-
return code `(${joinCode(this.
|
|
365
|
+
return code `(${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
|
|
376
366
|
switch (discriminant.memberValues[memberI].kind) {
|
|
377
367
|
case "extrinsic":
|
|
378
368
|
return code `{ ${discriminant.name}: ${literalOf(primaryDiscriminantValue)}, value: ${type.name} }`;
|
|
@@ -398,7 +388,7 @@ ${joinCode(this.concreteMembers.map(({ jsonType, jsonTypeCheck, type, unwrap, wr
|
|
|
398
388
|
get inlineToJsonFunction() {
|
|
399
389
|
return code `\
|
|
400
390
|
((value: ${this.name}): ${this.jsonType().name} => {
|
|
401
|
-
${joinCode(this.
|
|
391
|
+
${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap }) => code `if (${typeCheck(code `value`)}) { return ${wrap(typeToJsonExpression(unwrap(code `value`)))}; }`))}
|
|
402
392
|
|
|
403
393
|
throw new Error("unable to serialize to JSON");
|
|
404
394
|
})`;
|
|
@@ -418,7 +408,7 @@ ${joinCode(this.concreteMembers.map(({ typeCheck, typeToJsonExpression, unwrap,
|
|
|
418
408
|
throw new Error();
|
|
419
409
|
}
|
|
420
410
|
}), { on: " | " })})[] => {
|
|
421
|
-
${joinCode(this.
|
|
411
|
+
${joinCode(this.members.map(({ type, unwrap, typeCheck }) => code `if (${typeCheck(code `value`)}) { return ${type.toRdfResourceValuesExpression({
|
|
422
412
|
variables: {
|
|
423
413
|
graph: code `_options.graph`,
|
|
424
414
|
propertyPath: code `_options.propertyPath`,
|
|
@@ -434,7 +424,7 @@ ${joinCode(this.concreteMembers.map(({ type, unwrap, typeCheck }) => code `if ($
|
|
|
434
424
|
get inlineToStringFunction() {
|
|
435
425
|
return code `\
|
|
436
426
|
((value: ${this.name}): string => {
|
|
437
|
-
${joinCode(this.
|
|
427
|
+
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `value`)}) { return ${type.toStringExpression({
|
|
438
428
|
variables: { value: unwrap(code `value`) },
|
|
439
429
|
})}; }`))}
|
|
440
430
|
|
|
@@ -446,7 +436,7 @@ ${joinCode(this.concreteMembers.map(({ type, typeCheck, unwrap }) => code `if ($
|
|
|
446
436
|
((({ ignoreRdfType, filter, schema, ...otherParameters }) => {
|
|
447
437
|
let triples: ${imports.sparqljs}.Triple[] = [];
|
|
448
438
|
|
|
449
|
-
${joinCode(this.
|
|
439
|
+
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
450
440
|
triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }));`))}
|
|
451
441
|
|
|
452
442
|
return triples;
|
|
@@ -457,7 +447,7 @@ triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherP
|
|
|
457
447
|
((({ filter, schema, ...otherParameters }) => {
|
|
458
448
|
const unionPatterns: ${imports.sparqljs}.GroupPattern[] = [];
|
|
459
449
|
|
|
460
|
-
${joinCode(this.
|
|
450
|
+
${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
|
|
461
451
|
unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }).concat(), type: "group" });`))}
|
|
462
452
|
|
|
463
453
|
return [{ patterns: unionPatterns, type: "union" }];
|
|
@@ -466,7 +456,7 @@ unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...oth
|
|
|
466
456
|
get schemaObject() {
|
|
467
457
|
return {
|
|
468
458
|
...super.schemaObject,
|
|
469
|
-
members: code `{ ${joinCode(this.
|
|
459
|
+
members: code `{ ${joinCode(this.members.map(({ discriminantValues, type, primaryDiscriminantValue }) => code `${literalOf(primaryDiscriminantValue)}: ${{
|
|
470
460
|
discriminantValues: discriminantValues,
|
|
471
461
|
type: type.schema,
|
|
472
462
|
}}`), { on: "," })} }`,
|
|
@@ -476,7 +466,7 @@ unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...oth
|
|
|
476
466
|
return Maybe.empty();
|
|
477
467
|
}
|
|
478
468
|
inlineHashStatements({ depth, variables, }) {
|
|
479
|
-
return this.
|
|
469
|
+
return this.members.map(({ type, unwrap, typeCheck }) => code `if (${typeCheck(variables.value)}) { ${joinCode(type
|
|
480
470
|
.hashStatements({
|
|
481
471
|
depth: depth + 1,
|
|
482
472
|
variables: {
|
|
@@ -509,9 +499,6 @@ __decorate([
|
|
|
509
499
|
__decorate([
|
|
510
500
|
Memoize()
|
|
511
501
|
], AbstractUnionType.prototype, "typeofs", null);
|
|
512
|
-
__decorate([
|
|
513
|
-
Memoize()
|
|
514
|
-
], AbstractUnionType.prototype, "concreteMembers", null);
|
|
515
502
|
__decorate([
|
|
516
503
|
Memoize()
|
|
517
504
|
], AbstractUnionType.prototype, "inlineEqualsFunction", null);
|
|
@@ -9,6 +9,7 @@ import { Memoize } from "typescript-memoize";
|
|
|
9
9
|
import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
|
|
10
10
|
import { imports } from "./imports.js";
|
|
11
11
|
import { snippets } from "./snippets.js";
|
|
12
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
12
13
|
import { code } from "./ts-poet-wrapper.js";
|
|
13
14
|
const Super = (AbstractLazyObjectType);
|
|
14
15
|
export class LazyObjectOptionType extends Super {
|
|
@@ -30,12 +31,12 @@ export class LazyObjectOptionType extends Super {
|
|
|
30
31
|
const conversions = super.conversions.concat();
|
|
31
32
|
if (this.partialType.itemType.kind === "NamedObjectType") {
|
|
32
33
|
conversions.push({
|
|
33
|
-
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${value}.map(
|
|
34
|
+
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${value}.map(${this.partialType.itemType.name}.${syntheticNamePrefix}create), resolver: async () => ${imports.Right}((${value} as ${imports.Maybe}<${this.resolveType.itemType.name}>).unsafeCoerce()) })`,
|
|
34
35
|
sourceTypeCheckExpression: (value) => code `${imports.Maybe}.isMaybe(${value})`,
|
|
35
36
|
sourceTypeName: code `${imports.Maybe}<${this.resolveType.itemType.name}>`,
|
|
36
37
|
sourceTypeof: "object",
|
|
37
38
|
}, {
|
|
38
|
-
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${imports.Maybe}.of(${this.partialType.itemType.
|
|
39
|
+
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${imports.Maybe}.of(${this.partialType.itemType.name}.${syntheticNamePrefix}create(${value})), resolver: async () => ${imports.Right}(${value} as ${this.resolveType.itemType.name}) })`,
|
|
39
40
|
// Don't check instanceof value since the NamedObjectUnionType may be an interface
|
|
40
41
|
// Rely on the fact that this will be the last type check on an object
|
|
41
42
|
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
|
|
@@ -9,6 +9,7 @@ import { Memoize } from "typescript-memoize";
|
|
|
9
9
|
import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
|
|
10
10
|
import { imports } from "./imports.js";
|
|
11
11
|
import { snippets } from "./snippets.js";
|
|
12
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
12
13
|
import { code } from "./ts-poet-wrapper.js";
|
|
13
14
|
export class LazyObjectSetType extends AbstractLazyObjectType {
|
|
14
15
|
graphqlArgs = Maybe.of({
|
|
@@ -36,7 +37,7 @@ export class LazyObjectSetType extends AbstractLazyObjectType {
|
|
|
36
37
|
const conversions = super.conversions.concat();
|
|
37
38
|
if (this.partialType.itemType.kind === "NamedObjectType") {
|
|
38
39
|
conversions.push({
|
|
39
|
-
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${value}.map(
|
|
40
|
+
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${value}.map(${this.partialType.itemType.name}.${syntheticNamePrefix}create), resolver: async () => ${imports.Right}(${value} as readonly ${this.resolveType.itemType.name}[]) })`,
|
|
40
41
|
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
|
|
41
42
|
sourceTypeName: code `readonly ${this.resolveType.itemType.name}[]`,
|
|
42
43
|
sourceTypeof: "object",
|
|
@@ -2,6 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { AbstractLazyObjectType } from "./AbstractLazyObjectType.js";
|
|
3
3
|
import { imports } from "./imports.js";
|
|
4
4
|
import { snippets } from "./snippets.js";
|
|
5
|
+
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
5
6
|
import { code } from "./ts-poet-wrapper.js";
|
|
6
7
|
export class LazyObjectType extends AbstractLazyObjectType {
|
|
7
8
|
graphqlArgs = Maybe.empty();
|
|
@@ -22,7 +23,7 @@ export class LazyObjectType extends AbstractLazyObjectType {
|
|
|
22
23
|
const conversions = super.conversions.concat();
|
|
23
24
|
if (this.partialType.kind === "NamedObjectType") {
|
|
24
25
|
conversions.push({
|
|
25
|
-
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${this.partialType.
|
|
26
|
+
conversionExpression: (value) => code `new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}: ${this.partialType.name}.${syntheticNamePrefix}create(${value}), resolver: async () => ${imports.Right}(${value} as ${this.resolveType.name}) })`,
|
|
26
27
|
// Don't check instanceof value since the NamedObjectType may be an interface
|
|
27
28
|
// Rely on the fact that this will be the last type check on an object
|
|
28
29
|
sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
|
-
import type { Maybe } from "purify-ts";
|
|
3
|
-
import type { IdentifierMintingStrategy } from "../../enums/IdentifierMintingStrategy.js";
|
|
4
2
|
import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
5
3
|
import type { AnonymousUnionType } from "./AnonymousUnionType.js";
|
|
6
4
|
import type { BigDecimalType } from "./BigDecimalType.js";
|
|
@@ -22,13 +20,11 @@ import type { TermType } from "./TermType.js";
|
|
|
22
20
|
import type { Type } from "./Type.js";
|
|
23
21
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
24
22
|
export declare class ListType<ItemTypeT extends ListType.ItemType> extends AbstractCollectionType<ItemTypeT> {
|
|
25
|
-
private readonly identifierMintingStrategy;
|
|
26
23
|
private readonly identifierNodeKind;
|
|
27
24
|
private readonly toRdfTypes;
|
|
28
25
|
readonly kind = "ListType";
|
|
29
|
-
constructor({ identifierNodeKind,
|
|
26
|
+
constructor({ identifierNodeKind, toRdfTypes, ...superParameters }: {
|
|
30
27
|
identifierNodeKind: ListType<ItemTypeT>["identifierNodeKind"];
|
|
31
|
-
identifierMintingStrategy: Maybe<IdentifierMintingStrategy>;
|
|
32
28
|
toRdfTypes: readonly NamedNode[];
|
|
33
29
|
} & ConstructorParameters<typeof AbstractCollectionType<ItemTypeT>>[0]);
|
|
34
30
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
@@ -12,14 +12,12 @@ import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
|
12
12
|
import { snippets } from "./snippets.js";
|
|
13
13
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
14
14
|
export class ListType extends AbstractCollectionType {
|
|
15
|
-
identifierMintingStrategy;
|
|
16
15
|
identifierNodeKind;
|
|
17
16
|
toRdfTypes;
|
|
18
17
|
kind = "ListType";
|
|
19
|
-
constructor({ identifierNodeKind,
|
|
18
|
+
constructor({ identifierNodeKind, toRdfTypes, ...superParameters }) {
|
|
20
19
|
super(superParameters);
|
|
21
20
|
this.identifierNodeKind = identifierNodeKind;
|
|
22
|
-
this.identifierMintingStrategy = identifierMintingStrategy.orDefault(identifierNodeKind === "BlankNode" ? "blankNode" : "sha256");
|
|
23
21
|
this.toRdfTypes = toRdfTypes;
|
|
24
22
|
}
|
|
25
23
|
get valueSparqlConstructTriplesFunction() {
|
|
@@ -48,43 +46,26 @@ export class ListType extends AbstractCollectionType {
|
|
|
48
46
|
return new AbstractCollectionType.JsonType(code `${!this.mutable ? "readonly " : ""}(${this.itemType.jsonType().name})[]`);
|
|
49
47
|
}
|
|
50
48
|
toRdfResourceValuesExpression({ variables, }) {
|
|
51
|
-
let
|
|
49
|
+
let mintListIdentifierFunction;
|
|
50
|
+
let mintSubListIdentifierFunction;
|
|
52
51
|
let resourceTypeName;
|
|
53
|
-
let subListIdentifier;
|
|
54
52
|
switch (this.identifierNodeKind) {
|
|
55
53
|
case "BlankNode": {
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
mintListIdentifierFunction =
|
|
55
|
+
mintSubListIdentifierFunction = code `(() => ${imports.dataFactory}.blankNode())`;
|
|
58
56
|
resourceTypeName = code `${imports.Resource}<${imports.BlankNode}>`;
|
|
59
57
|
break;
|
|
60
58
|
}
|
|
61
59
|
case "IRI": {
|
|
62
|
-
switch (this.identifierMintingStrategy) {
|
|
63
|
-
case "blankNode":
|
|
64
|
-
throw new RangeError(this.identifierMintingStrategy);
|
|
65
|
-
case "sha256":
|
|
66
|
-
listIdentifier = code `${imports.dataFactory}.namedNode(\`urn:shaclmate:list:\${${variables.value}.reduce(
|
|
67
|
-
(hasher, item) => {
|
|
68
|
-
${joinCode(this.itemType.hashStatements({ depth: 0, variables: { hasher: code `hasher`, value: code `item` } }).concat())}
|
|
69
|
-
return hasher;
|
|
70
|
-
},
|
|
71
|
-
${imports.sha256}.create(),
|
|
72
|
-
)}\`)`;
|
|
73
|
-
break;
|
|
74
|
-
case "uuidv4":
|
|
75
|
-
listIdentifier = code `${imports.dataFactory}.namedNode(\`urn:shaclmate:list:\${${imports.uuid}.v4()}\`)`;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
60
|
resourceTypeName = code `${imports.Resource}<${imports.NamedNode}>`;
|
|
79
|
-
|
|
80
|
-
break;
|
|
61
|
+
throw new RangeError("list IRI minting is unsupported");
|
|
81
62
|
}
|
|
82
63
|
}
|
|
83
64
|
return code `[${variables.value}.length > 0 ? ${variables.value}.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
|
|
84
65
|
if (itemIndex === 0) {
|
|
85
66
|
currentSubListResource = listResource;
|
|
86
67
|
} else {
|
|
87
|
-
const newSubListResource = ${variables.resourceSet}.resource(${
|
|
68
|
+
const newSubListResource = ${variables.resourceSet}.resource(${mintSubListIdentifierFunction}());
|
|
88
69
|
currentSubListResource!.add(${rdfjsTermExpression(rdf.rest, { logger: this.logger })}, newSubListResource.identifier, ${variables.graph});
|
|
89
70
|
currentSubListResource = newSubListResource;
|
|
90
71
|
}
|
|
@@ -101,7 +82,7 @@ export class ListType extends AbstractCollectionType {
|
|
|
101
82
|
},
|
|
102
83
|
{
|
|
103
84
|
currentSubListResource: null,
|
|
104
|
-
listResource: resourceSet.resource(${
|
|
85
|
+
listResource: resourceSet.resource(${mintListIdentifierFunction}()),
|
|
105
86
|
} as {
|
|
106
87
|
currentSubListResource: ${resourceTypeName} | null;
|
|
107
88
|
listResource: ${resourceTypeName};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { Maybe, NonEmptyList } from "purify-ts";
|
|
3
|
-
import type { TsFeature } from "../../enums/TsFeature.js";
|
|
4
|
-
import type { TsObjectDeclarationType } from "../../enums/TsObjectDeclarationType.js";
|
|
5
3
|
import { DiscriminantProperty as _DiscriminantProperty } from "./_NamedObjectType/DiscriminantProperty.js";
|
|
6
|
-
import { IdentifierPrefixProperty as _IdentifierPrefixProperty } from "./_NamedObjectType/IdentifierPrefixProperty.js";
|
|
7
4
|
import { IdentifierProperty as _IdentifierProperty } from "./_NamedObjectType/IdentifierProperty.js";
|
|
8
5
|
import type { Property as _Property } from "./_NamedObjectType/Property.js";
|
|
9
6
|
import { ShaclProperty as _ShaclProperty } from "./_NamedObjectType/ShaclProperty.js";
|
|
@@ -11,13 +8,12 @@ import { AbstractType } from "./AbstractType.js";
|
|
|
11
8
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
12
9
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
13
10
|
import type { IriType } from "./IriType.js";
|
|
11
|
+
import type { TsFeature } from "./TsFeature.js";
|
|
14
12
|
import type { Type } from "./Type.js";
|
|
15
13
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
16
14
|
export declare class NamedObjectType extends AbstractType {
|
|
17
15
|
private readonly imports;
|
|
18
16
|
protected readonly toRdfTypes: readonly NamedNode[];
|
|
19
|
-
readonly abstract: boolean;
|
|
20
|
-
readonly declarationType: TsObjectDeclarationType;
|
|
21
17
|
readonly extern: boolean;
|
|
22
18
|
readonly features: ReadonlySet<TsFeature>;
|
|
23
19
|
readonly fromRdfType: Maybe<NamedNode>;
|
|
@@ -26,13 +22,10 @@ export declare class NamedObjectType extends AbstractType {
|
|
|
26
22
|
readonly kind = "NamedObjectType";
|
|
27
23
|
readonly name: string;
|
|
28
24
|
readonly recursive: boolean;
|
|
29
|
-
readonly staticModuleName: string;
|
|
30
25
|
readonly synthetic: boolean;
|
|
31
26
|
readonly typeofs: NonEmptyList<"object">;
|
|
32
|
-
constructor({
|
|
33
|
-
abstract: boolean;
|
|
27
|
+
constructor({ extern, features, fromRdfType, identifierType, imports, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }: {
|
|
34
28
|
comment: Maybe<string>;
|
|
35
|
-
declarationType: TsObjectDeclarationType;
|
|
36
29
|
extern: boolean;
|
|
37
30
|
features: ReadonlySet<TsFeature>;
|
|
38
31
|
fromRdfType: Maybe<NamedNode>;
|
|
@@ -42,13 +35,11 @@ export declare class NamedObjectType extends AbstractType {
|
|
|
42
35
|
lazyAncestorObjectTypes: () => readonly NamedObjectType[];
|
|
43
36
|
lazyChildObjectTypes: () => readonly NamedObjectType[];
|
|
44
37
|
lazyDiscriminantProperty: (namedObjectType: NamedObjectType) => NamedObjectType.DiscriminantProperty;
|
|
45
|
-
lazyIdentifierProperty: (namedObjectType: NamedObjectType) => NamedObjectType.IdentifierProperty;
|
|
46
38
|
lazyDescendantObjectTypes: () => readonly NamedObjectType[];
|
|
47
39
|
lazyParentObjectTypes: () => readonly NamedObjectType[];
|
|
48
40
|
lazyProperties: (namedObjectType: NamedObjectType) => readonly NamedObjectType.Property[];
|
|
49
41
|
name: string;
|
|
50
42
|
recursive: boolean;
|
|
51
|
-
staticModuleName: string;
|
|
52
43
|
synthetic: boolean;
|
|
53
44
|
toRdfTypes: readonly NamedNode[];
|
|
54
45
|
} & ConstructorParameters<typeof AbstractType>[0]);
|
|
@@ -67,12 +58,9 @@ export declare class NamedObjectType extends AbstractType {
|
|
|
67
58
|
get filterType(): Code;
|
|
68
59
|
get fromRdfTypeVariable(): Maybe<Code>;
|
|
69
60
|
get graphqlType(): AbstractType.GraphqlType;
|
|
70
|
-
get identifierProperty(): NamedObjectType.IdentifierProperty;
|
|
71
61
|
get identifierTypeAlias(): Code;
|
|
72
62
|
get mutable(): boolean;
|
|
73
63
|
get objectSetMethodNames(): NamedObjectType.ObjectSetMethodNames;
|
|
74
|
-
get ownProperties(): readonly NamedObjectType.Property[];
|
|
75
|
-
get ownShaclProperties(): readonly NamedObjectType.ShaclProperty<Type>[];
|
|
76
64
|
get parentObjectTypes(): readonly NamedObjectType[];
|
|
77
65
|
get properties(): readonly NamedObjectType.Property[];
|
|
78
66
|
get schema(): Code;
|
|
@@ -93,24 +81,17 @@ export declare class NamedObjectType extends AbstractType {
|
|
|
93
81
|
jsonSchema({ context, }: Parameters<AbstractType["jsonSchema"]>[0]): Code;
|
|
94
82
|
jsonType(): AbstractType.JsonType;
|
|
95
83
|
jsonUiSchemaElement({ variables, }: Parameters<AbstractType["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
96
|
-
newExpression({ parameters }: {
|
|
97
|
-
parameters: Code;
|
|
98
|
-
}): Code;
|
|
99
84
|
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
100
85
|
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
101
86
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
102
|
-
protected ensureAtMostOneSuperObjectType(): void;
|
|
103
87
|
private readonly lazyAncestorObjectTypes;
|
|
104
88
|
private readonly lazyChildObjectTypes;
|
|
105
89
|
private readonly lazyDescendantObjectTypes;
|
|
106
90
|
private readonly lazyDiscriminantProperty;
|
|
107
|
-
private readonly lazyIdentifierProperty;
|
|
108
91
|
private readonly lazyParentObjectTypes;
|
|
109
92
|
private readonly lazyProperties;
|
|
110
93
|
}
|
|
111
94
|
export declare namespace NamedObjectType {
|
|
112
|
-
const IdentifierPrefixProperty: typeof _IdentifierPrefixProperty;
|
|
113
|
-
type IdentifierPrefixProperty = _IdentifierPrefixProperty;
|
|
114
95
|
const IdentifierProperty: typeof _IdentifierProperty;
|
|
115
96
|
type IdentifierProperty = _IdentifierProperty;
|
|
116
97
|
type ObjectSetMethodNames = {
|