@shaclmate/compiler 4.0.97 → 4.0.99
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/generators/ts/AbstractCollectionType.d.ts +2 -1
- package/dist/generators/ts/AbstractCollectionType.js +10 -5
- package/dist/generators/ts/AbstractCompoundType.d.ts +11 -8
- package/dist/generators/ts/AbstractCompoundType.js +5 -2
- package/dist/generators/ts/AbstractContainerType.d.ts +11 -11
- package/dist/generators/ts/AbstractContainerType.js +21 -15
- package/dist/generators/ts/AbstractDateType.d.ts +7 -6
- package/dist/generators/ts/AbstractDateType.js +16 -6
- package/dist/generators/ts/AbstractDiscriminatedUnionType.d.ts +2 -3
- package/dist/generators/ts/AbstractDiscriminatedUnionType.js +25 -7
- package/dist/generators/ts/AbstractIntersectionType.d.ts +2 -2
- package/dist/generators/ts/AbstractIntersectionType.js +19 -8
- package/dist/generators/ts/AbstractLazyType.d.ts +23 -23
- package/dist/generators/ts/AbstractLazyType.js +23 -21
- package/dist/generators/ts/AbstractNumericType.d.ts +4 -3
- package/dist/generators/ts/AbstractNumericType.js +12 -7
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.js +4 -4
- package/dist/generators/ts/AbstractTermType.d.ts +17 -16
- package/dist/generators/ts/AbstractTermType.js +21 -11
- package/dist/generators/ts/AbstractType.d.ts +6 -15
- package/dist/generators/ts/AbstractType.js +14 -33
- package/dist/generators/ts/AbstractTypedLiteralType.d.ts +2 -1
- package/dist/generators/ts/AbstractTypedLiteralType.js +20 -2
- package/dist/generators/ts/BigDecimalType.d.ts +12 -11
- package/dist/generators/ts/BigDecimalType.js +28 -11
- package/dist/generators/ts/BigIntType.js +6 -6
- package/dist/generators/ts/BlankNodeType.d.ts +11 -10
- package/dist/generators/ts/BlankNodeType.js +27 -10
- package/dist/generators/ts/BooleanType.d.ts +6 -5
- package/dist/generators/ts/BooleanType.js +18 -8
- package/dist/generators/ts/Callable.d.ts +2 -2
- package/dist/generators/ts/DateTimeType.d.ts +6 -6
- package/dist/generators/ts/DateTimeType.js +6 -6
- package/dist/generators/ts/DateType.d.ts +6 -6
- package/dist/generators/ts/DateType.js +6 -6
- package/dist/generators/ts/DefaultValueType.d.ts +2 -2
- package/dist/generators/ts/DefaultValueType.js +18 -8
- package/dist/generators/ts/FloatType.js +4 -4
- package/dist/generators/ts/IdentifierType.d.ts +11 -10
- package/dist/generators/ts/IdentifierType.js +27 -10
- package/dist/generators/ts/Imports.d.ts +1 -0
- package/dist/generators/ts/Imports.js +1 -0
- package/dist/generators/ts/IntType.js +4 -4
- package/dist/generators/ts/IriType.d.ts +5 -5
- package/dist/generators/ts/IriType.js +36 -21
- package/dist/generators/ts/LangStringType.d.ts +10 -10
- package/dist/generators/ts/LangStringType.js +21 -13
- package/dist/generators/ts/ListType.js +7 -7
- package/dist/generators/ts/LiteralType.d.ts +10 -10
- package/dist/generators/ts/LiteralType.js +21 -13
- package/dist/generators/ts/ObjectType.d.ts +13 -15
- package/dist/generators/ts/ObjectType.js +32 -9
- package/dist/generators/ts/OptionType.d.ts +2 -1
- package/dist/generators/ts/OptionType.js +16 -11
- package/dist/generators/ts/SetType.d.ts +2 -1
- package/dist/generators/ts/SetType.js +22 -10
- package/dist/generators/ts/Snippets.d.ts +8 -6
- package/dist/generators/ts/Snippets.js +48 -34
- package/dist/generators/ts/StringType.d.ts +6 -6
- package/dist/generators/ts/StringType.js +20 -17
- package/dist/generators/ts/TermType.d.ts +7 -7
- package/dist/generators/ts/TermType.js +18 -13
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromJsonObjectFunction.js +1 -1
- package/dist/generators/ts/_AbstractType/AbstractType_JsonType.d.ts +39 -16
- package/dist/generators/ts/_AbstractType/AbstractType_JsonType.js +49 -33
- package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunction.js +1 -1
- package/dist/generators/ts/_ObjectIntersectionType/ObjectIntersectionType_fromJsonObjectFunction.js +1 -1
- package/dist/generators/ts/_ObjectIntersectionType/ObjectIntersectionType_fromRdfResourceValuesFunction.js +1 -1
- package/dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.d.ts +4 -7
- package/dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.js +1 -3
- package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts +0 -1
- package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.js +0 -1
- package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.d.ts +3 -2
- package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.js +31 -11
- package/dist/generators/ts/_ObjectType/ObjectType_RdfTypeProperty.d.ts +3 -2
- package/dist/generators/ts/_ObjectType/ObjectType_RdfTypeProperty.js +26 -10
- package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.d.ts +3 -2
- package/dist/generators/ts/_ObjectType/ObjectType_ShaclProperty.js +46 -22
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonObjectFunction.js +7 -2
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunction.js +1 -1
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonObjectFunction.js +1 -1
- package/dist/generators/ts/_snippets/snippets_FromJsonFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_FromJsonFunction.js +28 -0
- package/dist/generators/ts/_snippets/snippets_ToJsonFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ToJsonFunction.js +3 -0
- package/dist/generators/ts/_snippets/snippets_arrayFromJsonArray.js +1 -1
- package/dist/generators/ts/_snippets/snippets_arrayToJsonArray.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigIntFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigIntFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigIntToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_bigIntToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_blankNodeToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_blankNodeToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_booleanFromJsonBoolean.js +1 -1
- package/dist/generators/ts/_snippets/snippets_booleanFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +2 -4
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +1 -2
- package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.js +11 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.js +17 -0
- package/dist/generators/ts/_snippets/snippets_dateFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_dateFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_dateTimeFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_dateTimeToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_dateToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_dateToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonValue.js +1 -1
- package/dist/generators/ts/_snippets/snippets_floatFromJsonNumber.js +1 -1
- package/dist/generators/ts/_snippets/snippets_floatFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierToJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_intFromJsonNumber.js +1 -1
- package/dist/generators/ts/_snippets/snippets_intFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_iriFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_iriFromJsonString.js +2 -2
- package/dist/generators/ts/_snippets/snippets_iriFromString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriFromString.js +76 -0
- package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.js +6 -0
- package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.js +6 -0
- package/dist/generators/ts/_snippets/snippets_langStringFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_langStringToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_listFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_listToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_literalFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_literalToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeFromJsonValue.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_maybeToJsonValue.js +1 -1
- package/dist/generators/ts/_snippets/snippets_primitiveToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_stringFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_stringFromJsonString.js +1 -1
- package/dist/generators/ts/_snippets/snippets_termFromJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_termToJsonObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_typedLiteralToJsonObject.js +1 -1
- package/package.json +16 -14
- package/dist/generators/ts/AbstractStructuredType.d.ts +0 -71
- package/dist/generators/ts/AbstractStructuredType.js +0 -273
- package/dist/generators/ts/ReferenceCallable.d.ts +0 -14
- package/dist/generators/ts/ReferenceCallable.js +0 -16
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.d.ts +0 -5
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.js +0 -11
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +0 -15
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +0 -15
- package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.js +0 -21
- package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.js +0 -21
- package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.js +0 -3
- package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.js +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToInIri.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToInIri.js +0 -11
- package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.js +0 -17
|
@@ -8,7 +8,7 @@ import { LiteralDecoder } from "@rdfx/literal";
|
|
|
8
8
|
import { Maybe } from "purify-ts";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
11
|
-
import {
|
|
11
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
12
12
|
import { code } from "./ts-poet-wrapper.js";
|
|
13
13
|
export class IntType extends AbstractNumericType {
|
|
14
14
|
decodedIn = this.in_.map((in_) => LiteralDecoder.decodeFloatLiteral(in_).unsafeCoerce());
|
|
@@ -17,13 +17,13 @@ export class IntType extends AbstractNumericType {
|
|
|
17
17
|
jsonValueType = this.jsonTypeFactory.createJsonNumberType({ in_: this.decodedIn });
|
|
18
18
|
kind = "Int";
|
|
19
19
|
get fromJsonObjectFunction() {
|
|
20
|
-
return new
|
|
20
|
+
return new BuiltinCallable(code `${this.reusables.snippets.intFromJsonObject}<${this.expression}>`);
|
|
21
21
|
}
|
|
22
22
|
get fromJsonValueFunction() {
|
|
23
|
-
return new
|
|
23
|
+
return new BuiltinCallable(code `${this.reusables.snippets.intFromJsonNumber}<${this.expression}>`);
|
|
24
24
|
}
|
|
25
25
|
get fromRdfResourceValuesFunction() {
|
|
26
|
-
return new
|
|
26
|
+
return new BuiltinCallable(code `${this.reusables.snippets.intFromRdfResourceValues}<${this.expression}>`);
|
|
27
27
|
}
|
|
28
28
|
get graphqlType() {
|
|
29
29
|
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLInt}`, this.reusables);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
4
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
4
5
|
import type { Callable } from "./Callable.js";
|
|
5
|
-
import {
|
|
6
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
6
7
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
7
8
|
export declare class IriType extends AbstractIdentifierType<NamedNode> {
|
|
8
|
-
readonly filterFunction:
|
|
9
|
+
readonly filterFunction: BuiltinCallable;
|
|
9
10
|
readonly filterType: Code;
|
|
10
11
|
readonly kind = "Iri";
|
|
11
12
|
readonly nodeKinds: ReadonlySet<"IRI">;
|
|
12
|
-
readonly
|
|
13
|
-
readonly valueSparqlWherePatternsFunction: ReferenceCallable;
|
|
13
|
+
readonly valueSparqlWherePatternsFunction: BuiltinCallable;
|
|
14
14
|
get fromJsonValueFunction(): AbstractIdentifierType<NamedNode>["fromJsonValueFunction"];
|
|
15
15
|
get fromJsonObjectFunction(): AbstractIdentifierType<NamedNode>["fromJsonObjectFunction"];
|
|
16
16
|
get toJsonValueFunction(): AbstractIdentifierType<NamedNode>["toJsonValueFunction"];
|
|
@@ -22,7 +22,7 @@ export declare class IriType extends AbstractIdentifierType<NamedNode> {
|
|
|
22
22
|
get parseFunction(): Callable;
|
|
23
23
|
protected get inlineExpression(): Code;
|
|
24
24
|
protected staticModuleDeclarations(name: string): Record<string, Code>;
|
|
25
|
-
|
|
25
|
+
get schema(): SchemaObject<SchemaObject.BuiltinType>;
|
|
26
26
|
protected get inlineValueTypeExpression(): Code;
|
|
27
27
|
private get valueTypeExpression();
|
|
28
28
|
}
|
|
@@ -8,27 +8,37 @@ import { Maybe } from "purify-ts";
|
|
|
8
8
|
import { invariant } from "ts-invariant";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
11
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
11
12
|
import { InlineCallable } from "./InlineCallable.js";
|
|
12
|
-
import {
|
|
13
|
-
import { arrayOf, code, joinCode
|
|
13
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
14
|
+
import { arrayOf, code, joinCode } from "./ts-poet-wrapper.js";
|
|
14
15
|
export class IriType extends AbstractIdentifierType {
|
|
15
|
-
filterFunction = new
|
|
16
|
+
filterFunction = new BuiltinCallable(this.reusables.snippets.filterIri);
|
|
16
17
|
filterType = code `${this.reusables.snippets.IriFilter}`;
|
|
17
18
|
kind = "Iri";
|
|
18
19
|
nodeKinds = nodeKinds;
|
|
19
|
-
|
|
20
|
-
valueSparqlWherePatternsFunction = new ReferenceCallable(this.reusables.snippets.iriSparqlWherePatterns);
|
|
20
|
+
valueSparqlWherePatternsFunction = new BuiltinCallable(this.reusables.snippets.iriSparqlWherePatterns);
|
|
21
21
|
get fromJsonValueFunction() {
|
|
22
|
-
|
|
22
|
+
if (this.in_.length > 0) {
|
|
23
|
+
return new BuiltinCallable(code `${this.reusables.snippets.iriLiteralFromJsonString}<${this.valueTypeExpression}>`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return new BuiltinCallable(this.reusables.snippets.iriFromJsonString);
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
get fromJsonObjectFunction() {
|
|
25
|
-
|
|
30
|
+
if (this.in_.length > 0) {
|
|
31
|
+
return new BuiltinCallable(code `${this.reusables.snippets.iriLiteralFromJsonObject}<${this.valueTypeExpression}>`);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return new BuiltinCallable(this.reusables.snippets.iriFromJsonObject);
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
get toJsonValueFunction() {
|
|
28
|
-
return new
|
|
38
|
+
return new BuiltinCallable(code `${this.reusables.snippets.iriToJsonString}<${this.valueTypeExpression}>`);
|
|
29
39
|
}
|
|
30
40
|
get toJsonObjectFunction() {
|
|
31
|
-
return new
|
|
41
|
+
return new BuiltinCallable(code `${this.reusables.snippets.iriToJsonObject}<${this.valueTypeExpression}>`);
|
|
32
42
|
}
|
|
33
43
|
get jsonValueType() {
|
|
34
44
|
if (this.in_.length === 0) {
|
|
@@ -53,7 +63,7 @@ export class IriType extends AbstractIdentifierType {
|
|
|
53
63
|
invariant(this.jsTypes.length === 1);
|
|
54
64
|
return Maybe.of({
|
|
55
65
|
code: this.in_.length > 0
|
|
56
|
-
? code `${this.reusables.snippets.
|
|
66
|
+
? code `${this.reusables.snippets.convertToIriLiteral}<${this.valueTypeExpression}>`
|
|
57
67
|
: code `${this.reusables.snippets.convertToIri}`,
|
|
58
68
|
sourceTypes: [
|
|
59
69
|
{
|
|
@@ -70,13 +80,13 @@ export class IriType extends AbstractIdentifierType {
|
|
|
70
80
|
});
|
|
71
81
|
}
|
|
72
82
|
get fromRdfResourceValuesFunction() {
|
|
73
|
-
return new
|
|
83
|
+
return new BuiltinCallable(code `${this.reusables.snippets.iriFromRdfResourceValues}<${this.valueTypeExpression}>`);
|
|
74
84
|
}
|
|
75
85
|
get parseFunction() {
|
|
76
86
|
if (this.in_.length > 0) {
|
|
77
87
|
return new InlineCallable(code `(identifier: string) => ${this.reusables.snippets.parseIri}(identifier).chain((identifier) => { switch (identifier.value) { ${joinCode(this.in_.map((iri) => code `case "${iri.value}": return ${this.reusables.imports.Right}(identifier as ${this.expression});`))} default: return ${this.reusables.imports.Left}(new Error("expected NamedNode identifier to be one of ${this.in_.map((iri) => iri.value).join(" ")}")); } })`);
|
|
78
88
|
}
|
|
79
|
-
return new
|
|
89
|
+
return new BuiltinCallable(this.reusables.snippets.parseIri);
|
|
80
90
|
}
|
|
81
91
|
get inlineExpression() {
|
|
82
92
|
if (this.in_.length > 0) {
|
|
@@ -93,16 +103,18 @@ export class IriType extends AbstractIdentifierType {
|
|
|
93
103
|
inValues: code `const inValues = ${arrayOf(...this.in_.map((in_) => in_.value))} as const;`,
|
|
94
104
|
};
|
|
95
105
|
}
|
|
96
|
-
get
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
initializers = initializers.concat(code `hasValues: ${arrayOf(...this.hasValues.map((hasValue) => this.rdfjsTermExpression(hasValue)))}`);
|
|
106
|
+
get schema() {
|
|
107
|
+
const thisProperties = {};
|
|
108
|
+
if (this.in_.length > 0 && this.name.isJust()) {
|
|
109
|
+
thisProperties["in"] =
|
|
110
|
+
code `in: inValues.map(inValue => ${this.reusables.imports.dataFactory}.namedNode(inValue))`;
|
|
111
|
+
thisProperties["inValues"] = code `inValues`;
|
|
103
112
|
}
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
return new SchemaObject({
|
|
114
|
+
properties: { ...super.schema.properties, ...thisProperties },
|
|
115
|
+
type: new SchemaObject.BuiltinType(code `${this.reusables.snippets.IriSchema}<${this.valueTypeExpression}>`),
|
|
116
|
+
variable: super.schema.variable,
|
|
117
|
+
});
|
|
106
118
|
}
|
|
107
119
|
get inlineValueTypeExpression() {
|
|
108
120
|
if (this.in_.length === 0) {
|
|
@@ -151,6 +163,9 @@ __decorate([
|
|
|
151
163
|
__decorate([
|
|
152
164
|
Memoize()
|
|
153
165
|
], IriType.prototype, "inlineExpression", null);
|
|
166
|
+
__decorate([
|
|
167
|
+
Memoize()
|
|
168
|
+
], IriType.prototype, "schema", null);
|
|
154
169
|
__decorate([
|
|
155
170
|
Memoize()
|
|
156
171
|
], IriType.prototype, "inlineValueTypeExpression", null);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
5
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
5
6
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
6
7
|
export declare class LangStringType extends AbstractLiteralType {
|
|
7
8
|
private readonly languageIn;
|
|
8
9
|
protected readonly inlineExpression: Code;
|
|
9
10
|
readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
|
|
10
|
-
readonly filterFunction:
|
|
11
|
+
readonly filterFunction: BuiltinCallable;
|
|
11
12
|
readonly filterType: Code;
|
|
12
|
-
readonly fromJsonObjectFunction:
|
|
13
|
-
readonly fromJsonValueFunction:
|
|
14
|
-
readonly fromRdfResourceValuesFunction:
|
|
13
|
+
readonly fromJsonObjectFunction: BuiltinCallable;
|
|
14
|
+
readonly fromJsonValueFunction: BuiltinCallable;
|
|
15
|
+
readonly fromRdfResourceValuesFunction: BuiltinCallable;
|
|
15
16
|
readonly jsTypes: readonly [{
|
|
16
17
|
readonly instanceof: "Object";
|
|
17
18
|
readonly typeof: "object";
|
|
@@ -19,16 +20,15 @@ export declare class LangStringType extends AbstractLiteralType {
|
|
|
19
20
|
readonly jsonObjectType: AbstractLiteralType["jsonObjectType"];
|
|
20
21
|
readonly jsonValueType: AbstractLiteralType["jsonValueType"];
|
|
21
22
|
readonly kind = "LangString";
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
readonly valueSparqlWherePatternsFunction: ReferenceCallable;
|
|
23
|
+
readonly toJsonObjectFunction: BuiltinCallable;
|
|
24
|
+
readonly toJsonValueFunction: BuiltinCallable;
|
|
25
|
+
readonly valueSparqlWherePatternsFunction: BuiltinCallable;
|
|
26
26
|
constructor({ languageIn, ...superParameters }: {
|
|
27
27
|
languageIn: readonly string[];
|
|
28
28
|
} & ConstructorParameters<typeof AbstractLiteralType>[0]);
|
|
29
29
|
get discriminatedType(): Maybe<AbstractLiteralType.DiscriminatedType>;
|
|
30
30
|
get graphqlType(): AbstractLiteralType.GraphqlType;
|
|
31
|
-
|
|
31
|
+
get schema(): SchemaObject<SchemaObject.BuiltinType>;
|
|
32
32
|
graphqlResolveExpression(_parameters: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
|
|
33
33
|
toLoggableExpression({ variables, }: Parameters<AbstractLiteralType["toLoggableExpression"]>[0]): Code;
|
|
34
34
|
valueExpression(literal: Literal): Code;
|
|
@@ -7,7 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
10
|
-
import {
|
|
10
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
11
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
11
12
|
import { arrayOf, code } from "./ts-poet-wrapper.js";
|
|
12
13
|
export class LangStringType extends AbstractLiteralType {
|
|
13
14
|
languageIn;
|
|
@@ -21,11 +22,11 @@ export class LangStringType extends AbstractLiteralType {
|
|
|
21
22
|
},
|
|
22
23
|
],
|
|
23
24
|
});
|
|
24
|
-
filterFunction = new
|
|
25
|
+
filterFunction = new BuiltinCallable(this.reusables.snippets.filterLiteral);
|
|
25
26
|
filterType = code `${this.reusables.snippets.LiteralFilter}`;
|
|
26
|
-
fromJsonObjectFunction = new
|
|
27
|
+
fromJsonObjectFunction = new BuiltinCallable(this.reusables.snippets.langStringFromJsonObject);
|
|
27
28
|
fromJsonValueFunction = this.fromJsonObjectFunction;
|
|
28
|
-
fromRdfResourceValuesFunction = new
|
|
29
|
+
fromRdfResourceValuesFunction = new BuiltinCallable(this.reusables.snippets.langStringFromRdfResourceValues);
|
|
29
30
|
jsTypes = [
|
|
30
31
|
{ instanceof: "Object", typeof: "object" },
|
|
31
32
|
];
|
|
@@ -37,10 +38,9 @@ export class LangStringType extends AbstractLiteralType {
|
|
|
37
38
|
}, { snippet: this.reusables.snippets.LangStringJsonObject });
|
|
38
39
|
jsonValueType = this.jsonObjectType;
|
|
39
40
|
kind = "LangString";
|
|
40
|
-
|
|
41
|
-
toJsonObjectFunction = new ReferenceCallable(this.reusables.snippets.langStringToJsonObject);
|
|
41
|
+
toJsonObjectFunction = new BuiltinCallable(this.reusables.snippets.langStringToJsonObject);
|
|
42
42
|
toJsonValueFunction = this.toJsonObjectFunction;
|
|
43
|
-
valueSparqlWherePatternsFunction = new
|
|
43
|
+
valueSparqlWherePatternsFunction = new BuiltinCallable(this.reusables.snippets.langStringSparqlWherePatterns);
|
|
44
44
|
constructor({ languageIn, ...superParameters }) {
|
|
45
45
|
super(superParameters);
|
|
46
46
|
this.languageIn = languageIn;
|
|
@@ -58,12 +58,17 @@ export class LangStringType extends AbstractLiteralType {
|
|
|
58
58
|
get graphqlType() {
|
|
59
59
|
throw new Error("not implemented");
|
|
60
60
|
}
|
|
61
|
-
get
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
get schema() {
|
|
62
|
+
return new SchemaObject({
|
|
63
|
+
properties: this.languageIn.length > 0
|
|
64
|
+
? {
|
|
65
|
+
...super.schema.properties,
|
|
66
|
+
languageIn: code `languageIn: ${arrayOf(...this.languageIn)}`,
|
|
67
|
+
}
|
|
68
|
+
: super.schema.properties,
|
|
69
|
+
type: new SchemaObject.BuiltinType(this.reusables.snippets.LangStringSchema),
|
|
70
|
+
variable: super.schema.variable,
|
|
71
|
+
});
|
|
67
72
|
}
|
|
68
73
|
graphqlResolveExpression(_parameters) {
|
|
69
74
|
throw new Error("not implemented");
|
|
@@ -78,4 +83,7 @@ export class LangStringType extends AbstractLiteralType {
|
|
|
78
83
|
__decorate([
|
|
79
84
|
Memoize()
|
|
80
85
|
], LangStringType.prototype, "discriminatedType", null);
|
|
86
|
+
__decorate([
|
|
87
|
+
Memoize()
|
|
88
|
+
], LangStringType.prototype, "schema", null);
|
|
81
89
|
//# sourceMappingURL=LangStringType.js.map
|
|
@@ -8,8 +8,8 @@ import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
|
8
8
|
import { Maybe } from "purify-ts";
|
|
9
9
|
import { Memoize } from "typescript-memoize";
|
|
10
10
|
import { AbstractCollectionType } from "./AbstractCollectionType.js";
|
|
11
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
11
12
|
import { InlineCallable } from "./InlineCallable.js";
|
|
12
|
-
import { ReferenceCallable } from "./ReferenceCallable.js";
|
|
13
13
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
14
14
|
export class ListType extends AbstractCollectionType {
|
|
15
15
|
identifierNodeKind;
|
|
@@ -44,16 +44,16 @@ export class ListType extends AbstractCollectionType {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
get fromJsonValueFunction() {
|
|
47
|
-
return new
|
|
47
|
+
return new BuiltinCallable(code `${this.reusables.snippets.arrayFromJsonArray}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
|
|
48
48
|
}
|
|
49
49
|
get fromJsonObjectFunction() {
|
|
50
|
-
return new
|
|
50
|
+
return new BuiltinCallable(code `${this.reusables.snippets.listFromJsonObject}(${this.itemType.fromJsonValueFunction.annotatedUsage})`);
|
|
51
51
|
}
|
|
52
52
|
get fromRdfResourceValuesFunction() {
|
|
53
|
-
return new InlineCallable(code `${this._mutable ? this.reusables.snippets.mutableListFromRdfResourceValues : this.reusables.snippets.listFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.
|
|
53
|
+
return new InlineCallable(code `${this._mutable ? this.reusables.snippets.mutableListFromRdfResourceValues : this.reusables.snippets.listFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schema.type.expression}>(${this.itemType.fromRdfResourceValuesFunction.unannotatedUsage})`);
|
|
54
54
|
}
|
|
55
55
|
get toJsonValueFunction() {
|
|
56
|
-
return new
|
|
56
|
+
return new BuiltinCallable(code `${this.reusables.snippets.arrayToJsonArray}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
|
|
57
57
|
}
|
|
58
58
|
get toJsonObjectFunction() {
|
|
59
59
|
return new InlineCallable(code `${this.reusables.snippets.listToJsonObject}(${this.itemType.toJsonValueFunction.annotatedUsage})`);
|
|
@@ -62,10 +62,10 @@ export class ListType extends AbstractCollectionType {
|
|
|
62
62
|
return new Set(["BlankNode", "NamedNode"]); // List or rdf:nil
|
|
63
63
|
}
|
|
64
64
|
get valueSparqlConstructTriplesFunction() {
|
|
65
|
-
return new InlineCallable(code `${this.reusables.snippets.listSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.
|
|
65
|
+
return new InlineCallable(code `${this.reusables.snippets.listSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlConstructTriplesFunction.unannotatedUsage})`);
|
|
66
66
|
}
|
|
67
67
|
get valueSparqlWherePatternsFunction() {
|
|
68
|
-
return new InlineCallable(code `${this.reusables.snippets.listSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.
|
|
68
|
+
return new InlineCallable(code `${this.reusables.snippets.listSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schema.type.expression}>(${this.itemType.valueSparqlWherePatternsFunction.unannotatedUsage})`);
|
|
69
69
|
}
|
|
70
70
|
toRdfResourceValuesExpression({ variables, }) {
|
|
71
71
|
let mintListIdentifierFunction;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
5
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
5
6
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
6
7
|
export declare class LiteralType extends AbstractLiteralType {
|
|
7
8
|
private readonly languageIn;
|
|
8
9
|
protected readonly inlineExpression: Code;
|
|
9
10
|
readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
|
|
10
|
-
readonly filterFunction:
|
|
11
|
+
readonly filterFunction: BuiltinCallable;
|
|
11
12
|
readonly filterType: Code;
|
|
12
|
-
readonly fromJsonObjectFunction:
|
|
13
|
-
readonly fromJsonValueFunction:
|
|
14
|
-
readonly fromRdfResourceValuesFunction:
|
|
13
|
+
readonly fromJsonObjectFunction: BuiltinCallable;
|
|
14
|
+
readonly fromJsonValueFunction: BuiltinCallable;
|
|
15
|
+
readonly fromRdfResourceValuesFunction: BuiltinCallable;
|
|
15
16
|
readonly jsTypes: readonly [{
|
|
16
17
|
readonly instanceof: "Object";
|
|
17
18
|
readonly typeof: "object";
|
|
18
19
|
}];
|
|
19
20
|
readonly jsonValueType: AbstractLiteralType["jsonValueType"];
|
|
20
21
|
readonly kind = "Literal";
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly valueSparqlWherePatternsFunction: ReferenceCallable;
|
|
22
|
+
readonly toJsonObjectFunction: BuiltinCallable;
|
|
23
|
+
readonly toJsonValueFunction: BuiltinCallable;
|
|
24
|
+
readonly valueSparqlWherePatternsFunction: BuiltinCallable;
|
|
25
25
|
constructor({ languageIn, ...superParameters }: {
|
|
26
26
|
languageIn: readonly string[];
|
|
27
27
|
} & ConstructorParameters<typeof AbstractLiteralType>[0]);
|
|
28
28
|
get discriminatedType(): Maybe<AbstractLiteralType.DiscriminatedType>;
|
|
29
29
|
get graphqlType(): AbstractLiteralType.GraphqlType;
|
|
30
|
-
|
|
30
|
+
get schema(): SchemaObject<SchemaObject.BuiltinType>;
|
|
31
31
|
graphqlResolveExpression(_parameters: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
|
|
32
32
|
toLoggableExpression({ variables, }: Parameters<AbstractLiteralType["toLoggableExpression"]>[0]): Code;
|
|
33
33
|
valueExpression(literal: Literal): Code;
|
|
@@ -7,7 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
10
|
-
import {
|
|
10
|
+
import { BuiltinCallable } from "./BuiltinCallable.js";
|
|
11
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
11
12
|
import { arrayOf, code } from "./ts-poet-wrapper.js";
|
|
12
13
|
export class LiteralType extends AbstractLiteralType {
|
|
13
14
|
languageIn;
|
|
@@ -29,20 +30,19 @@ export class LiteralType extends AbstractLiteralType {
|
|
|
29
30
|
},
|
|
30
31
|
],
|
|
31
32
|
});
|
|
32
|
-
filterFunction = new
|
|
33
|
+
filterFunction = new BuiltinCallable(this.reusables.snippets.filterLiteral);
|
|
33
34
|
filterType = code `${this.reusables.snippets.LiteralFilter}`;
|
|
34
|
-
fromJsonObjectFunction = new
|
|
35
|
+
fromJsonObjectFunction = new BuiltinCallable(this.reusables.snippets.literalFromJsonObject);
|
|
35
36
|
fromJsonValueFunction = this.fromJsonObjectFunction;
|
|
36
|
-
fromRdfResourceValuesFunction = new
|
|
37
|
+
fromRdfResourceValuesFunction = new BuiltinCallable(this.reusables.snippets.literalFromRdfResourceValues);
|
|
37
38
|
jsTypes = [
|
|
38
39
|
{ instanceof: "Object", typeof: "object" },
|
|
39
40
|
];
|
|
40
41
|
jsonValueType = this.jsonObjectType;
|
|
41
42
|
kind = "Literal";
|
|
42
|
-
|
|
43
|
-
toJsonObjectFunction = new ReferenceCallable(this.reusables.snippets.literalToJsonObject);
|
|
43
|
+
toJsonObjectFunction = new BuiltinCallable(this.reusables.snippets.literalToJsonObject);
|
|
44
44
|
toJsonValueFunction = this.toJsonObjectFunction;
|
|
45
|
-
valueSparqlWherePatternsFunction = new
|
|
45
|
+
valueSparqlWherePatternsFunction = new BuiltinCallable(this.reusables.snippets.literalSparqlWherePatterns);
|
|
46
46
|
constructor({ languageIn, ...superParameters }) {
|
|
47
47
|
super(superParameters);
|
|
48
48
|
this.languageIn = languageIn;
|
|
@@ -60,12 +60,17 @@ export class LiteralType extends AbstractLiteralType {
|
|
|
60
60
|
get graphqlType() {
|
|
61
61
|
throw new Error("not implemented");
|
|
62
62
|
}
|
|
63
|
-
get
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
get schema() {
|
|
64
|
+
return new SchemaObject({
|
|
65
|
+
properties: this.languageIn.length > 0
|
|
66
|
+
? {
|
|
67
|
+
...super.schema.properties,
|
|
68
|
+
languageIn: code `languageIn: ${arrayOf(...this.languageIn)}`,
|
|
69
|
+
}
|
|
70
|
+
: super.schema.properties,
|
|
71
|
+
type: new SchemaObject.BuiltinType(this.reusables.snippets.LiteralSchema),
|
|
72
|
+
variable: super.schema.variable,
|
|
73
|
+
});
|
|
69
74
|
}
|
|
70
75
|
graphqlResolveExpression(_parameters) {
|
|
71
76
|
throw new Error("not implemented");
|
|
@@ -80,4 +85,7 @@ export class LiteralType extends AbstractLiteralType {
|
|
|
80
85
|
__decorate([
|
|
81
86
|
Memoize()
|
|
82
87
|
], LiteralType.prototype, "discriminatedType", null);
|
|
88
|
+
__decorate([
|
|
89
|
+
Memoize()
|
|
90
|
+
], LiteralType.prototype, "schema", null);
|
|
83
91
|
//# sourceMappingURL=LiteralType.js.map
|
|
@@ -10,22 +10,21 @@ import { ObjectType_IdentifierProperty } from "./_ObjectType/ObjectType_Identifi
|
|
|
10
10
|
import type { ObjectType_Property } from "./_ObjectType/ObjectType_Property.js";
|
|
11
11
|
import { ObjectType_RdfTypeProperty } from "./_ObjectType/ObjectType_RdfTypeProperty.js";
|
|
12
12
|
import { ObjectType_ShaclProperty } from "./_ObjectType/ObjectType_ShaclProperty.js";
|
|
13
|
-
import { ObjectType_schemaExpression } from "./_ObjectType/ObjectType_schemaExpression.js";
|
|
14
|
-
import { ObjectType_schemaTypeExpression } from "./_ObjectType/ObjectType_schemaTypeExpression.js";
|
|
15
13
|
import { ObjectType_toJsonObjectFunctionExpression, ObjectType_toJsonObjectFunctionType } from "./_ObjectType/ObjectType_toJsonObjectFunction.js";
|
|
16
14
|
import { ObjectType_toLoggableFunctionExpression, ObjectType_toLoggableFunctionType } from "./_ObjectType/ObjectType_toLoggableFunction.js";
|
|
17
15
|
import { ObjectType_toRdfResourceValuesFunctionExpression, ObjectType_toRdfResourceValuesFunctionType } from "./_ObjectType/ObjectType_toRdfResourceValuesFunction.js";
|
|
18
16
|
import { ObjectType_toStringFunctionExpression, ObjectType_toStringFunctionType } from "./_ObjectType/ObjectType_toStringFunction.js";
|
|
19
17
|
import { ObjectType_valueSparqlConstructTriplesFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlConstructTriplesFunction.js";
|
|
20
18
|
import { ObjectType_valueSparqlWherePatternsFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlWherePatternsFunction.js";
|
|
21
|
-
import {
|
|
19
|
+
import { AbstractUserDefinedType } from "./AbstractUserDefinedType.js";
|
|
22
20
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
23
21
|
import type { Callable } from "./Callable.js";
|
|
24
22
|
import type { IdentifierType } from "./IdentifierType.js";
|
|
25
23
|
import type { IriType } from "./IriType.js";
|
|
24
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
26
25
|
import type { Type } from "./Type.js";
|
|
27
26
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
28
|
-
export declare class ObjectType extends
|
|
27
|
+
export declare class ObjectType extends AbstractUserDefinedType {
|
|
29
28
|
private readonly rdfTypeProperty;
|
|
30
29
|
protected equalsFunctionExpression: typeof ObjectType_equalsFunctionExpression;
|
|
31
30
|
protected equalsFunctionType: typeof ObjectType_equalsFunctionType;
|
|
@@ -38,8 +37,6 @@ export declare class ObjectType extends AbstractStructuredType {
|
|
|
38
37
|
protected fromRdfResourceValuesFunctionType: typeof ObjectType_fromRdfResourceValuesFunctionType;
|
|
39
38
|
protected hashFunctionExpression: typeof ObjectType_hashFunctionExpression;
|
|
40
39
|
protected hashFunctionType: typeof ObjectType_hashFunctionType;
|
|
41
|
-
protected schemaExpression: typeof ObjectType_schemaExpression;
|
|
42
|
-
protected schemaTypeExpression: typeof ObjectType_schemaTypeExpression;
|
|
43
40
|
protected toJsonObjectFunctionExpression: typeof ObjectType_toJsonObjectFunctionExpression;
|
|
44
41
|
protected toJsonObjectFunctionType: typeof ObjectType_toJsonObjectFunctionType;
|
|
45
42
|
protected toLoggableFunctionExpression: typeof ObjectType_toLoggableFunctionExpression;
|
|
@@ -50,9 +47,9 @@ export declare class ObjectType extends AbstractStructuredType {
|
|
|
50
47
|
protected toStringFunctionType: typeof ObjectType_toStringFunctionType;
|
|
51
48
|
protected valueSparqlConstructTriplesFunctionExpression: typeof ObjectType_valueSparqlConstructTriplesFunctionExpression;
|
|
52
49
|
protected valueSparqlWherePatternsFunctionExpression: typeof ObjectType_valueSparqlWherePatternsFunctionExpression;
|
|
53
|
-
readonly discriminatedType: Maybe<
|
|
50
|
+
readonly discriminatedType: Maybe<AbstractUserDefinedType.DiscriminatedType>;
|
|
54
51
|
readonly extern: boolean;
|
|
55
|
-
readonly graphqlArgs:
|
|
52
|
+
readonly graphqlArgs: AbstractUserDefinedType["graphqlArgs"];
|
|
56
53
|
readonly identifierProperty: Maybe<ObjectType.IdentifierProperty>;
|
|
57
54
|
readonly identifierType: BlankNodeType | IdentifierType | IriType;
|
|
58
55
|
readonly jsTypes: readonly [{
|
|
@@ -62,7 +59,7 @@ export declare class ObjectType extends AbstractStructuredType {
|
|
|
62
59
|
readonly kind = "Object";
|
|
63
60
|
readonly recursive: boolean;
|
|
64
61
|
readonly synthetic: boolean;
|
|
65
|
-
readonly validationFunction:
|
|
62
|
+
readonly validationFunction: AbstractUserDefinedType["validationFunction"];
|
|
66
63
|
constructor({ discriminantProperty, extern, identifierProperty, identifierType, lazyProperties, rdfTypeProperty, recursive, synthetic, ...superParameters }: {
|
|
67
64
|
discriminantProperty: Maybe<ObjectType.DiscriminantProperty>;
|
|
68
65
|
comment: Maybe<string>;
|
|
@@ -74,21 +71,22 @@ export declare class ObjectType extends AbstractStructuredType {
|
|
|
74
71
|
rdfTypeProperty: Maybe<ObjectType.RdfTypeProperty>;
|
|
75
72
|
recursive: boolean;
|
|
76
73
|
synthetic: boolean;
|
|
77
|
-
} & ConstructorParameters<typeof
|
|
74
|
+
} & ConstructorParameters<typeof AbstractUserDefinedType>[0]);
|
|
78
75
|
get _fromRdfResourceFunction(): Callable;
|
|
79
76
|
get _toRdfResourceFunction(): Callable;
|
|
80
|
-
get jsonValueType():
|
|
81
|
-
get conversionFunction(): Maybe<
|
|
77
|
+
get jsonValueType(): AbstractUserDefinedType["jsonObjectType"];
|
|
78
|
+
get conversionFunction(): Maybe<AbstractUserDefinedType.ConversionFunction>;
|
|
82
79
|
get createFunction(): Callable;
|
|
83
80
|
get createFunctionParameters(): ObjectType.CreateFunctionParameters;
|
|
84
81
|
get createUnsafeFunction(): Callable;
|
|
85
82
|
get declaration(): Maybe<Code>;
|
|
86
|
-
get jsonObjectType():
|
|
83
|
+
get jsonObjectType(): AbstractUserDefinedType["jsonObjectType"];
|
|
84
|
+
get schema(): SchemaObject<SchemaObject.UserDefinedType>;
|
|
87
85
|
get focusSparqlConstructTriplesFunction(): Callable;
|
|
88
86
|
get focusSparqlWherePatternsFunction(): Callable;
|
|
89
87
|
get fromRdfResourceFunction(): Callable;
|
|
90
88
|
get fromRdfTypeVariable(): Maybe<Code>;
|
|
91
|
-
get graphqlType():
|
|
89
|
+
get graphqlType(): AbstractUserDefinedType.GraphqlType;
|
|
92
90
|
get identifierTypeAlias(): Code;
|
|
93
91
|
get mutable(): boolean;
|
|
94
92
|
get objectSetMethodNames(): ObjectType.ObjectSetMethodNames;
|
|
@@ -97,7 +95,7 @@ export declare class ObjectType extends AbstractStructuredType {
|
|
|
97
95
|
get sparqlConstructQueryFunction(): Callable;
|
|
98
96
|
get sparqlConstructQueryStringFunction(): Callable;
|
|
99
97
|
get toRdfResourceFunction(): Callable;
|
|
100
|
-
get toRdfResourceValueTypes():
|
|
98
|
+
get toRdfResourceValueTypes(): AbstractUserDefinedType["toRdfResourceValueTypes"];
|
|
101
99
|
get toRdfjsResourceType(): Code;
|
|
102
100
|
get toStringRecordFunction(): Callable;
|
|
103
101
|
get typeGuardFunction(): Maybe<Callable>;
|
|
@@ -28,11 +28,10 @@ import { ObjectType_graphqlTypeExpression } from "./_ObjectType/ObjectType_graph
|
|
|
28
28
|
import { ObjectType_hashFunctionExpression, ObjectType_hashFunctionType, } from "./_ObjectType/ObjectType_hashFunction.js";
|
|
29
29
|
import { ObjectType_IdentifierProperty } from "./_ObjectType/ObjectType_IdentifierProperty.js";
|
|
30
30
|
import { ObjectType_identifierTypeDeclarations } from "./_ObjectType/ObjectType_identifierTypeDeclarations.js";
|
|
31
|
+
import { ObjectType_jsonObjectType } from "./_ObjectType/ObjectType_jsonObjectType.js";
|
|
31
32
|
import { ObjectType_objectSetMethodNames } from "./_ObjectType/ObjectType_objectSetMethodNames.js";
|
|
32
33
|
import { ObjectType_RdfTypeProperty } from "./_ObjectType/ObjectType_RdfTypeProperty.js";
|
|
33
34
|
import { ObjectType_ShaclProperty } from "./_ObjectType/ObjectType_ShaclProperty.js";
|
|
34
|
-
import { ObjectType_schemaExpression } from "./_ObjectType/ObjectType_schemaExpression.js";
|
|
35
|
-
import { ObjectType_schemaTypeExpression } from "./_ObjectType/ObjectType_schemaTypeExpression.js";
|
|
36
35
|
import { ObjectType_sparqlConstructQueryFunction } from "./_ObjectType/ObjectType_sparqlConstructQueryFunction.js";
|
|
37
36
|
import { ObjectType_sparqlConstructQueryStringFunction } from "./_ObjectType/ObjectType_sparqlConstructQueryStringFunction.js";
|
|
38
37
|
import { ObjectType_toJsonObjectFunctionExpression, ObjectType_toJsonObjectFunctionType, } from "./_ObjectType/ObjectType_toJsonObjectFunction.js";
|
|
@@ -44,10 +43,11 @@ import { ObjectType_toStringRecordFunction } from "./_ObjectType/ObjectType_toSt
|
|
|
44
43
|
import { ObjectType_typeGuardFunction } from "./_ObjectType/ObjectType_typeGuardFunction.js";
|
|
45
44
|
import { ObjectType_valueSparqlConstructTriplesFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlConstructTriplesFunction.js";
|
|
46
45
|
import { ObjectType_valueSparqlWherePatternsFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlWherePatternsFunction.js";
|
|
47
|
-
import {
|
|
46
|
+
import { AbstractUserDefinedType } from "./AbstractUserDefinedType.js";
|
|
48
47
|
import { DeclaredCallable } from "./DeclaredCallable.js";
|
|
48
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
49
49
|
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
50
|
-
export class ObjectType extends
|
|
50
|
+
export class ObjectType extends AbstractUserDefinedType {
|
|
51
51
|
rdfTypeProperty;
|
|
52
52
|
equalsFunctionExpression = ObjectType_equalsFunctionExpression;
|
|
53
53
|
equalsFunctionType = ObjectType_equalsFunctionType;
|
|
@@ -60,8 +60,6 @@ export class ObjectType extends AbstractStructuredType {
|
|
|
60
60
|
fromRdfResourceValuesFunctionType = ObjectType_fromRdfResourceValuesFunctionType;
|
|
61
61
|
hashFunctionExpression = ObjectType_hashFunctionExpression;
|
|
62
62
|
hashFunctionType = ObjectType_hashFunctionType;
|
|
63
|
-
schemaExpression = ObjectType_schemaExpression;
|
|
64
|
-
schemaTypeExpression = ObjectType_schemaTypeExpression;
|
|
65
63
|
toJsonObjectFunctionExpression = ObjectType_toJsonObjectFunctionExpression;
|
|
66
64
|
toJsonObjectFunctionType = ObjectType_toJsonObjectFunctionType;
|
|
67
65
|
toLoggableFunctionExpression = ObjectType_toLoggableFunctionExpression;
|
|
@@ -125,8 +123,30 @@ export class ObjectType extends AbstractStructuredType {
|
|
|
125
123
|
return !this.extern ? super.declaration : Maybe.empty();
|
|
126
124
|
}
|
|
127
125
|
get jsonObjectType() {
|
|
128
|
-
return
|
|
129
|
-
|
|
126
|
+
return ObjectType_jsonObjectType.call(this);
|
|
127
|
+
}
|
|
128
|
+
get schema() {
|
|
129
|
+
return new SchemaObject({
|
|
130
|
+
properties: {
|
|
131
|
+
...super.schema.properties,
|
|
132
|
+
properties: () => code `properties: { ${joinCode(this.properties.flatMap((property) => property.schema
|
|
133
|
+
.map((propertySchema) => [
|
|
134
|
+
code `${property.name}: ${propertySchema.literalExpression}`,
|
|
135
|
+
])
|
|
136
|
+
.orDefault([])), { on: "," })} }`,
|
|
137
|
+
},
|
|
138
|
+
type: new SchemaObject.UserDefinedType({
|
|
139
|
+
members: {
|
|
140
|
+
...super.schema.type.members,
|
|
141
|
+
properties: () => code `properties: { ${joinCode(this.properties.flatMap((property) => property.schema
|
|
142
|
+
.map((propertySchema) => [
|
|
143
|
+
code `${property.name}: ${propertySchema.type.literalExpression}`,
|
|
144
|
+
])
|
|
145
|
+
.orDefault([])), { on: "," })} }`,
|
|
146
|
+
},
|
|
147
|
+
name: super.schema.type.name,
|
|
148
|
+
}),
|
|
149
|
+
variable: super.schema.variable,
|
|
130
150
|
});
|
|
131
151
|
}
|
|
132
152
|
get focusSparqlConstructTriplesFunction() {
|
|
@@ -144,7 +164,7 @@ export class ObjectType extends AbstractStructuredType {
|
|
|
144
164
|
.orDefaultLazy(() => this.rdfjsTermExpression(rdfTypeProperty.fromRdfType)));
|
|
145
165
|
}
|
|
146
166
|
get graphqlType() {
|
|
147
|
-
return new
|
|
167
|
+
return new AbstractUserDefinedType.GraphqlType(this.name
|
|
148
168
|
.map((name) => code `${name}.GraphQL`)
|
|
149
169
|
.orDefaultLazy(() => ObjectType_graphqlTypeExpression.call(this)), this.reusables);
|
|
150
170
|
}
|
|
@@ -343,6 +363,9 @@ __decorate([
|
|
|
343
363
|
__decorate([
|
|
344
364
|
Memoize()
|
|
345
365
|
], ObjectType.prototype, "jsonObjectType", null);
|
|
366
|
+
__decorate([
|
|
367
|
+
Memoize()
|
|
368
|
+
], ObjectType.prototype, "schema", null);
|
|
346
369
|
__decorate([
|
|
347
370
|
Memoize()
|
|
348
371
|
], ObjectType.prototype, "focusSparqlConstructTriplesFunction", null);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
3
3
|
import type { Callable } from "./Callable.js";
|
|
4
|
+
import { SchemaObject } from "./SchemaObject.js";
|
|
4
5
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
6
|
export declare class OptionType<ItemTypeT extends OptionType.ItemType> extends AbstractContainerType<ItemTypeT> {
|
|
6
7
|
readonly graphqlArgs: AbstractContainerType<ItemTypeT>["graphqlArgs"];
|
|
@@ -21,7 +22,7 @@ export declare class OptionType<ItemTypeT extends OptionType.ItemType> extends A
|
|
|
21
22
|
get graphqlType(): AbstractContainerType.GraphqlType;
|
|
22
23
|
get hashFunction(): Callable;
|
|
23
24
|
get mutable(): boolean;
|
|
24
|
-
get
|
|
25
|
+
get schema(): SchemaObject<SchemaObject.BuiltinType>;
|
|
25
26
|
get toJsonValueFunction(): AbstractContainerType<ItemTypeT>["toJsonValueFunction"];
|
|
26
27
|
get toJsonObjectFunction(): AbstractContainerType<ItemTypeT>["toJsonObjectFunction"];
|
|
27
28
|
get toRdfResourceValueTypes(): AbstractContainerType<ItemTypeT>["toRdfResourceValueTypes"];
|