@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
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { invariant } from "ts-invariant";
|
|
8
|
-
import { Memoize } from "typescript-memoize";
|
|
9
|
-
import { AbstractType } from "./AbstractType.js";
|
|
10
|
-
import { DeclaredCallable } from "./DeclaredCallable.js";
|
|
11
|
-
import { InlineCallable } from "./InlineCallable.js";
|
|
12
|
-
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
13
|
-
/**
|
|
14
|
-
* Abstract base class for AbstractCompoundType and StructType.
|
|
15
|
-
*/
|
|
16
|
-
export class AbstractStructuredType extends AbstractType {
|
|
17
|
-
get equalsFunction() {
|
|
18
|
-
return this._function({
|
|
19
|
-
type: () => this.equalsFunctionType(),
|
|
20
|
-
unannotatedExpression: () => this.equalsFunctionExpression(),
|
|
21
|
-
unqualifiedName: "equals",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
get filterFunction() {
|
|
25
|
-
return this._function({
|
|
26
|
-
type: () => this.filterFunctionType(),
|
|
27
|
-
unannotatedExpression: () => this.filterFunctionExpression(),
|
|
28
|
-
unqualifiedName: "filter",
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
get filterType() {
|
|
32
|
-
return this.name
|
|
33
|
-
.map((name) => code `${name}.Filter`)
|
|
34
|
-
.orDefaultLazy(() => this.filterTypeExpression());
|
|
35
|
-
}
|
|
36
|
-
get fromJsonValueFunction() {
|
|
37
|
-
return this.fromJsonObjectFunction;
|
|
38
|
-
}
|
|
39
|
-
get fromJsonObjectFunction() {
|
|
40
|
-
return this._function({
|
|
41
|
-
type: () => this.fromJsonObjectFunctionType(),
|
|
42
|
-
unannotatedExpression: () => this.fromJsonObjectFunctionExpression(),
|
|
43
|
-
unqualifiedName: "fromJson",
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
get fromRdfResourceValuesFunction() {
|
|
47
|
-
return this._function({
|
|
48
|
-
type: () => this.fromRdfResourceValuesFunctionType(),
|
|
49
|
-
unannotatedExpression: () => this.fromRdfResourceValuesFunctionExpression(),
|
|
50
|
-
unqualifiedName: "fromRdfResourceValues",
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
get hashFunction() {
|
|
54
|
-
return this._function({
|
|
55
|
-
type: () => this.hashFunctionType(),
|
|
56
|
-
unannotatedExpression: () => this.hashFunctionExpression(),
|
|
57
|
-
unqualifiedName: "hash",
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
get schemaType() {
|
|
61
|
-
return this.name
|
|
62
|
-
.map((name) => code `${name}.Schema`)
|
|
63
|
-
.orDefaultLazy(() => this.schemaTypeExpression());
|
|
64
|
-
}
|
|
65
|
-
get toJsonValueFunction() {
|
|
66
|
-
return this.toJsonObjectFunction;
|
|
67
|
-
}
|
|
68
|
-
get toJsonObjectFunction() {
|
|
69
|
-
return this._function({
|
|
70
|
-
type: () => this.toJsonObjectFunctionType(),
|
|
71
|
-
unannotatedExpression: () => this.toJsonObjectFunctionExpression(),
|
|
72
|
-
unqualifiedName: "toJson",
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
get toLoggableFunction() {
|
|
76
|
-
return this._function({
|
|
77
|
-
type: () => this.toLoggableFunctionType(),
|
|
78
|
-
unannotatedExpression: () => this.toLoggableFunctionExpression(),
|
|
79
|
-
unqualifiedName: "toLoggable",
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
get toRdfResourceValuesFunction() {
|
|
83
|
-
return this._function({
|
|
84
|
-
type: () => this.toRdfResourceValuesFunctionType(),
|
|
85
|
-
unannotatedExpression: () => this.toRdfResourceValuesFunctionExpression(),
|
|
86
|
-
unqualifiedName: "toRdfResourceValues",
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
get toStringFunction() {
|
|
90
|
-
return this._function({
|
|
91
|
-
type: () => this.toStringFunctionType(),
|
|
92
|
-
unannotatedExpression: () => this.toStringFunctionExpression(),
|
|
93
|
-
unqualifiedName: `${this.configuration.syntheticNamePrefix}toString`,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
get valueSparqlConstructTriplesFunction() {
|
|
97
|
-
return this._function({
|
|
98
|
-
type: () => this.valueSparqlConstructTriplesType(),
|
|
99
|
-
unannotatedExpression: () => this.valueSparqlConstructTriplesFunctionExpression(),
|
|
100
|
-
unqualifiedName: "valueSparqlConstructTriples",
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
get valueSparqlWherePatternsFunction() {
|
|
104
|
-
return this._function({
|
|
105
|
-
type: () => this.valueSparqlWherePatternsFunctionType(),
|
|
106
|
-
unannotatedExpression: () => this.valueSparqlWherePatternsFunctionExpression(),
|
|
107
|
-
unqualifiedName: "valueSparqlWherePatterns",
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
get toRdfResourceValueTypesExpression() {
|
|
111
|
-
return joinCode([...this.toRdfResourceValueTypes].map((toRdfResourceValueType) => {
|
|
112
|
-
switch (toRdfResourceValueType) {
|
|
113
|
-
case "BlankNode":
|
|
114
|
-
return code `${this.reusables.imports.BlankNode}`;
|
|
115
|
-
case "Literal":
|
|
116
|
-
return code `${this.reusables.imports.Literal}`;
|
|
117
|
-
case "NamedNode":
|
|
118
|
-
return code `${this.reusables.imports.NamedNode}`;
|
|
119
|
-
default:
|
|
120
|
-
toRdfResourceValueType;
|
|
121
|
-
throw new Error();
|
|
122
|
-
}
|
|
123
|
-
}), { on: " | " });
|
|
124
|
-
}
|
|
125
|
-
graphqlResolveExpression({ variables, }) {
|
|
126
|
-
return variables.value;
|
|
127
|
-
}
|
|
128
|
-
toLoggableExpression({ variables, }) {
|
|
129
|
-
return code `${this.toLoggableFunction.unannotatedUsage}(${variables.value})`;
|
|
130
|
-
}
|
|
131
|
-
toRdfResourceValuesExpression({ variables, }) {
|
|
132
|
-
const { value: valueVariable, ...otherVariables } = variables;
|
|
133
|
-
return code `${this.toRdfResourceValuesFunction.unannotatedUsage}(${valueVariable}, ${otherVariables})`;
|
|
134
|
-
}
|
|
135
|
-
toStringExpression({ variables, }) {
|
|
136
|
-
return code `${this.toStringFunction.unannotatedUsage}(${variables.value})`;
|
|
137
|
-
}
|
|
138
|
-
_function({ type, unannotatedExpression, unqualifiedName, }) {
|
|
139
|
-
return this.name
|
|
140
|
-
.map((name) => new DeclaredCallable({
|
|
141
|
-
qualifiedName: [name, unqualifiedName],
|
|
142
|
-
type,
|
|
143
|
-
unannotatedExpression,
|
|
144
|
-
}))
|
|
145
|
-
.orDefault(new InlineCallable(unannotatedExpression, { type }));
|
|
146
|
-
}
|
|
147
|
-
equalsFunctionType() {
|
|
148
|
-
return code `${this.reusables.snippets.EqualsFunction}<${this.expression}>`;
|
|
149
|
-
}
|
|
150
|
-
filterFunctionType() {
|
|
151
|
-
return code `${this.reusables.snippets.FilterFunction}<${this.filterType}, ${this.expression}>`;
|
|
152
|
-
}
|
|
153
|
-
fromJsonObjectFunctionType() {
|
|
154
|
-
return code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.expression}, undefined>`;
|
|
155
|
-
}
|
|
156
|
-
fromRdfResourceValuesFunctionType() {
|
|
157
|
-
return code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>`;
|
|
158
|
-
}
|
|
159
|
-
hashFunctionType() {
|
|
160
|
-
return code `${this.reusables.snippets.HashFunction}<${this.expression}>`;
|
|
161
|
-
}
|
|
162
|
-
staticModuleDeclarations(name) {
|
|
163
|
-
const staticModuleDeclarations = {
|
|
164
|
-
...super.staticModuleDeclarations(name),
|
|
165
|
-
};
|
|
166
|
-
function addFunctionDeclaration(function_) {
|
|
167
|
-
invariant(function_ instanceof DeclaredCallable);
|
|
168
|
-
staticModuleDeclarations[function_.unqualifiedName] =
|
|
169
|
-
code `export ${function_.declaration}`;
|
|
170
|
-
}
|
|
171
|
-
if (this.configuration.features.has("Object.equals")) {
|
|
172
|
-
addFunctionDeclaration(this.equalsFunction);
|
|
173
|
-
}
|
|
174
|
-
if (this.configuration.features.has("Object.filter")) {
|
|
175
|
-
staticModuleDeclarations["Filter"] =
|
|
176
|
-
code `export type Filter = ${this.filterTypeExpression()};`;
|
|
177
|
-
addFunctionDeclaration(this.filterFunction);
|
|
178
|
-
}
|
|
179
|
-
if (this.configuration.features.has("Object.hash")) {
|
|
180
|
-
// Hash functions take a generic parameter and const declaration like this can't have type parameters.
|
|
181
|
-
addFunctionDeclaration(this.hashFunction);
|
|
182
|
-
}
|
|
183
|
-
if (this.configuration.features.has("Object.JSON.type")) {
|
|
184
|
-
this.jsonObjectType.declaration.ifJust((jsonTypeDeclaration) => {
|
|
185
|
-
staticModuleDeclarations["JSON"] = jsonTypeDeclaration;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
if (this.configuration.features.has("Object.fromJson")) {
|
|
189
|
-
addFunctionDeclaration(this.fromJsonObjectFunction);
|
|
190
|
-
}
|
|
191
|
-
if (this.configuration.features.has("Object.fromRdf")) {
|
|
192
|
-
addFunctionDeclaration(this.fromRdfResourceValuesFunction);
|
|
193
|
-
}
|
|
194
|
-
if (this.configuration.features.has("Object.SPARQL")) {
|
|
195
|
-
addFunctionDeclaration(this.valueSparqlConstructTriplesFunction);
|
|
196
|
-
addFunctionDeclaration(this.valueSparqlWherePatternsFunction);
|
|
197
|
-
}
|
|
198
|
-
if (this.configuration.features.has("Object.toJson")) {
|
|
199
|
-
addFunctionDeclaration(this.toJsonObjectFunction);
|
|
200
|
-
}
|
|
201
|
-
if (this.configuration.features.has("Object.toLoggable")) {
|
|
202
|
-
addFunctionDeclaration(this.toLoggableFunction);
|
|
203
|
-
}
|
|
204
|
-
if (this.configuration.features.has("Object.toRdf")) {
|
|
205
|
-
addFunctionDeclaration(this.toRdfResourceValuesFunction);
|
|
206
|
-
}
|
|
207
|
-
if (this.configuration.features.has("Object.toString")) {
|
|
208
|
-
addFunctionDeclaration(this.toStringFunction);
|
|
209
|
-
}
|
|
210
|
-
return staticModuleDeclarations;
|
|
211
|
-
}
|
|
212
|
-
toJsonObjectFunctionType() {
|
|
213
|
-
return code `${this.reusables.snippets.ToJsonObjectFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
|
|
214
|
-
}
|
|
215
|
-
toLoggableFunctionType() {
|
|
216
|
-
return code `${this.reusables.snippets.ToLoggableFunction}<${this.expression}>`;
|
|
217
|
-
}
|
|
218
|
-
toRdfResourceValuesFunctionType() {
|
|
219
|
-
return code `${this.reusables.snippets.ToRdfResourceValuesFunction}<${this.expression}, ${this.toRdfResourceValueTypesExpression}>`;
|
|
220
|
-
}
|
|
221
|
-
toStringFunctionType() {
|
|
222
|
-
return code `${this.reusables.snippets.ToStringFunction}<${this.expression}>`;
|
|
223
|
-
}
|
|
224
|
-
valueSparqlConstructTriplesType() {
|
|
225
|
-
return code `${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>`;
|
|
226
|
-
}
|
|
227
|
-
valueSparqlWherePatternsFunctionType() {
|
|
228
|
-
return code `${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>`;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
__decorate([
|
|
232
|
-
Memoize()
|
|
233
|
-
], AbstractStructuredType.prototype, "equalsFunction", null);
|
|
234
|
-
__decorate([
|
|
235
|
-
Memoize()
|
|
236
|
-
], AbstractStructuredType.prototype, "filterFunction", null);
|
|
237
|
-
__decorate([
|
|
238
|
-
Memoize()
|
|
239
|
-
], AbstractStructuredType.prototype, "filterType", null);
|
|
240
|
-
__decorate([
|
|
241
|
-
Memoize()
|
|
242
|
-
], AbstractStructuredType.prototype, "fromJsonObjectFunction", null);
|
|
243
|
-
__decorate([
|
|
244
|
-
Memoize()
|
|
245
|
-
], AbstractStructuredType.prototype, "fromRdfResourceValuesFunction", null);
|
|
246
|
-
__decorate([
|
|
247
|
-
Memoize()
|
|
248
|
-
], AbstractStructuredType.prototype, "hashFunction", null);
|
|
249
|
-
__decorate([
|
|
250
|
-
Memoize()
|
|
251
|
-
], AbstractStructuredType.prototype, "schemaType", null);
|
|
252
|
-
__decorate([
|
|
253
|
-
Memoize()
|
|
254
|
-
], AbstractStructuredType.prototype, "toJsonObjectFunction", null);
|
|
255
|
-
__decorate([
|
|
256
|
-
Memoize()
|
|
257
|
-
], AbstractStructuredType.prototype, "toLoggableFunction", null);
|
|
258
|
-
__decorate([
|
|
259
|
-
Memoize()
|
|
260
|
-
], AbstractStructuredType.prototype, "toRdfResourceValuesFunction", null);
|
|
261
|
-
__decorate([
|
|
262
|
-
Memoize()
|
|
263
|
-
], AbstractStructuredType.prototype, "toStringFunction", null);
|
|
264
|
-
__decorate([
|
|
265
|
-
Memoize()
|
|
266
|
-
], AbstractStructuredType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
267
|
-
__decorate([
|
|
268
|
-
Memoize()
|
|
269
|
-
], AbstractStructuredType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
270
|
-
__decorate([
|
|
271
|
-
Memoize()
|
|
272
|
-
], AbstractStructuredType.prototype, "toRdfResourceValueTypesExpression", null);
|
|
273
|
-
//# sourceMappingURL=AbstractStructuredType.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AbstractCallable } from "./AbstractCallable.js";
|
|
2
|
-
import type { Snippet } from "./Snippet.js";
|
|
3
|
-
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
/**
|
|
5
|
-
* A callable that's a reference to a snippet, an import, or a global function.
|
|
6
|
-
*
|
|
7
|
-
* Callers assume the referent carries its own type annotations, so there's no distinction between annotated and unannotated usage.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ReferenceCallable extends AbstractCallable {
|
|
10
|
-
readonly annotatedUsage: Code;
|
|
11
|
-
readonly unannotatedUsage: Code;
|
|
12
|
-
constructor(reference: Code | Snippet);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=ReferenceCallable.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AbstractCallable } from "./AbstractCallable.js";
|
|
2
|
-
import { code } from "./ts-poet-wrapper.js";
|
|
3
|
-
/**
|
|
4
|
-
* A callable that's a reference to a snippet, an import, or a global function.
|
|
5
|
-
*
|
|
6
|
-
* Callers assume the referent carries its own type annotations, so there's no distinction between annotated and unannotated usage.
|
|
7
|
-
*/
|
|
8
|
-
export class ReferenceCallable extends AbstractCallable {
|
|
9
|
-
annotatedUsage;
|
|
10
|
-
unannotatedUsage;
|
|
11
|
-
constructor(reference) {
|
|
12
|
-
super();
|
|
13
|
-
this.annotatedUsage = this.unannotatedUsage = code `${reference}`;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ReferenceCallable.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
-
import type { Type } from "../Type.js";
|
|
3
|
-
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function AbstractDiscriminatedUnionType_schemaTypeExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
-
//# sourceMappingURL=AbstractDiscriminatedUnionType_schemaTypeExpression.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function AbstractDiscriminatedUnionType_schemaTypeExpression() {
|
|
3
|
-
return code `${{
|
|
4
|
-
kind: this.kind,
|
|
5
|
-
members: code `{ ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}: ${{
|
|
6
|
-
discriminantValues: code `readonly (number | string)[]`,
|
|
7
|
-
type: type.schemaType,
|
|
8
|
-
}}`), { on: ";" })} }`,
|
|
9
|
-
}}`;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=AbstractDiscriminatedUnionType_schemaTypeExpression.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { invariant } from "ts-invariant";
|
|
2
|
-
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function ObjectType_schemaExpression() {
|
|
4
|
-
const schema = {};
|
|
5
|
-
const properties = {};
|
|
6
|
-
for (const property of this.properties) {
|
|
7
|
-
property.schema.ifJust((propertySchema) => {
|
|
8
|
-
properties[property.name] = propertySchema;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
invariant(Object.keys(properties).length > 0);
|
|
12
|
-
schema["properties"] = properties;
|
|
13
|
-
return code `${schema} as const`;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=ObjectType_schemaExpression.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { invariant } from "ts-invariant";
|
|
2
|
-
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function ObjectType_schemaTypeExpression() {
|
|
4
|
-
const schemaType = {};
|
|
5
|
-
const properties = {};
|
|
6
|
-
for (const property of this.properties) {
|
|
7
|
-
property.schemaType.ifJust((propertySchemaType) => {
|
|
8
|
-
properties[property.name] = propertySchemaType;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
invariant(Object.keys(properties).length > 0);
|
|
12
|
-
schemaType["properties"] = properties;
|
|
13
|
-
return code `${schemaType}`;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=ObjectType_schemaTypeExpression.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_FromJsonObjectFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromJsonObjectFunction`, code `\
|
|
3
|
-
export type ${syntheticNamePrefix}FromJsonObjectFunction<JsonObjectT extends object, ValueT, ValueSchemaT> =
|
|
4
|
-
[ValueSchemaT] extends [undefined]
|
|
5
|
-
? (
|
|
6
|
-
jsonObject: JsonObjectT,
|
|
7
|
-
options?: {
|
|
8
|
-
context?: unknown;
|
|
9
|
-
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
|
-
schema?: unknown;
|
|
11
|
-
},
|
|
12
|
-
) => ${imports.Either}<Error, ValueT>
|
|
13
|
-
: (
|
|
14
|
-
jsonObject: JsonObjectT,
|
|
15
|
-
options: {
|
|
16
|
-
context?: unknown;
|
|
17
|
-
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
18
|
-
schema: ValueSchemaT;
|
|
19
|
-
},
|
|
20
|
-
) => ${imports.Either}<Error, ValueT>;`);
|
|
21
|
-
//# sourceMappingURL=snippets_FromJsonObjectFunction.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_FromJsonValueFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromJsonValueFunction`, code `\
|
|
3
|
-
export type ${syntheticNamePrefix}FromJsonValueFunction<JsonValueT, ValueT, ValueSchemaT> =
|
|
4
|
-
[ValueSchemaT] extends [undefined]
|
|
5
|
-
? (
|
|
6
|
-
jsonValue: JsonValueT,
|
|
7
|
-
options?: {
|
|
8
|
-
context?: unknown;
|
|
9
|
-
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
|
-
schema?: unknown;
|
|
11
|
-
},
|
|
12
|
-
) => ${imports.Either}<Error, ValueT>
|
|
13
|
-
: (
|
|
14
|
-
jsonValue: JsonValueT,
|
|
15
|
-
options: {
|
|
16
|
-
context?: unknown;
|
|
17
|
-
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
18
|
-
schema: ValueSchemaT;
|
|
19
|
-
},
|
|
20
|
-
) => ${imports.Either}<Error, ValueT>;`);
|
|
21
|
-
//# sourceMappingURL=snippets_FromJsonValueFunction.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_ToJsonObjectFunction = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ToJsonObjectFunction`, code `export type ${syntheticNamePrefix}ToJsonObjectFunction<T, JsonObjectT extends object> = (value: T) => JsonObjectT;`);
|
|
3
|
-
//# sourceMappingURL=snippets_ToJsonObjectFunction.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_ToJsonValueFunction = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ToJsonValueFunction`, code `export type ${syntheticNamePrefix}ToJsonValueFunction<T, JsonValueT> = (value: T) => JsonValueT;`);
|
|
3
|
-
//# sourceMappingURL=snippets_ToJsonValueFunction.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_convertToInIri = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToInIri`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}convertToInIri<IriT extends string>(value: IriT | ${imports.NamedNode}<IriT>, _defaultNamespace?: ${snippets.NamespaceBuilder}): ${imports.Either}<Error, ${imports.NamedNode}<IriT>> {
|
|
4
|
-
switch (typeof value) {
|
|
5
|
-
case "object":
|
|
6
|
-
return ${imports.Either}.of(value);
|
|
7
|
-
case "string":
|
|
8
|
-
return ${imports.Either}.of(${imports.dataFactory}.namedNode<IriT>(value));
|
|
9
|
-
}
|
|
10
|
-
}`);
|
|
11
|
-
//# sourceMappingURL=snippets_convertToInIri.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_convertToInIriIdentifierProperty = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToInIriIdentifierProperty`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}convertToInIriIdentifierProperty<InIriT extends string>(identifier: (() => ${imports.NamedNode}<InIriT>) | ${imports.NamedNode}<InIriT> | InIriT, _defaultNamespace?: ${snippets.NamespaceBuilder}): ${imports.Either}<Error, (() => ${imports.NamedNode}<InIriT>)> {
|
|
4
|
-
switch (typeof identifier) {
|
|
5
|
-
case "function":
|
|
6
|
-
return ${imports.Either}.of(identifier);
|
|
7
|
-
case "object": {
|
|
8
|
-
const captureIdentifier = identifier;
|
|
9
|
-
return ${imports.Either}.of(() => captureIdentifier);
|
|
10
|
-
}
|
|
11
|
-
case "string": {
|
|
12
|
-
const captureIdentifier = ${imports.dataFactory}.namedNode<InIriT>(identifier);
|
|
13
|
-
return ${imports.Either}.of(() => captureIdentifier);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}`);
|
|
17
|
-
//# sourceMappingURL=snippets_convertToInIriIdentifierProperty.js.map
|