@shaclmate/compiler 4.0.34 → 4.0.36
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 +14 -13
- package/dist/generators/ts/AbstractContainerType.d.ts +2 -0
- package/dist/generators/ts/AbstractContainerType.js +20 -0
- package/dist/generators/ts/AbstractDateType.d.ts +1 -1
- package/dist/generators/ts/AbstractDateType.js +3 -3
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -0
- package/dist/generators/ts/AbstractLazyObjectType.js +1 -0
- package/dist/generators/ts/AbstractLiteralType.d.ts +1 -1
- package/dist/generators/ts/AbstractLiteralType.js +2 -2
- package/dist/generators/ts/AbstractNamedUnionType.js +33 -20
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -8
- package/dist/generators/ts/AbstractNumericType.js +2 -16
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
- package/dist/generators/ts/AbstractPrimitiveType.js +2 -1
- package/dist/generators/ts/AbstractTermType.d.ts +2 -1
- package/dist/generators/ts/AbstractTermType.js +3 -2
- package/dist/generators/ts/AbstractType.d.ts +19 -8
- package/dist/generators/ts/AbstractUnionType.d.ts +3 -2
- package/dist/generators/ts/AbstractUnionType.js +14 -13
- package/dist/generators/ts/BigDecimalType.d.ts +3 -2
- package/dist/generators/ts/BigDecimalType.js +5 -12
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +3 -2
- package/dist/generators/ts/BlankNodeType.js +6 -5
- package/dist/generators/ts/BooleanType.d.ts +1 -2
- package/dist/generators/ts/BooleanType.js +2 -16
- package/dist/generators/ts/DateTimeType.d.ts +0 -1
- package/dist/generators/ts/DateTimeType.js +0 -9
- package/dist/generators/ts/DateType.d.ts +0 -1
- package/dist/generators/ts/DateType.js +0 -9
- package/dist/generators/ts/DefaultValueType.d.ts +2 -1
- package/dist/generators/ts/DefaultValueType.js +5 -4
- package/dist/generators/ts/IdentifierType.d.ts +3 -2
- package/dist/generators/ts/IdentifierType.js +6 -5
- package/dist/generators/ts/IriType.d.ts +3 -11
- package/dist/generators/ts/IriType.js +6 -5
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +3 -3
- package/dist/generators/ts/LazyObjectSetType.d.ts +2 -1
- package/dist/generators/ts/LazyObjectSetType.js +3 -3
- package/dist/generators/ts/LazyObjectType.d.ts +2 -1
- package/dist/generators/ts/LazyObjectType.js +3 -3
- package/dist/generators/ts/LiteralType.d.ts +2 -1
- package/dist/generators/ts/LiteralType.js +4 -3
- package/dist/generators/ts/NamedObjectType.d.ts +2 -1
- package/dist/generators/ts/NamedObjectType.js +9 -16
- package/dist/generators/ts/NamedObjectUnionType.js +14 -5
- package/dist/generators/ts/OptionType.d.ts +4 -3
- package/dist/generators/ts/OptionType.js +20 -17
- package/dist/generators/ts/Snippets.d.ts +7 -11
- package/dist/generators/ts/Snippets.js +46 -74
- package/dist/generators/ts/StringType.d.ts +1 -2
- package/dist/generators/ts/StringType.js +2 -16
- package/dist/generators/ts/TermType.d.ts +2 -1
- package/dist/generators/ts/TermType.js +6 -16
- package/dist/generators/ts/TsFeature.d.ts +1 -1
- package/dist/generators/ts/TsFeature.js +25 -7
- package/dist/generators/ts/TsGenerator.d.ts +1 -1
- package/dist/generators/ts/TsGenerator.js +66 -8
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +30 -9
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +6 -6
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +3 -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/ShaclProperty.js +26 -4
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +3 -0
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ConversionFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +12 -6
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_ValidationFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToArray.js +8 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +2 -2
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +2 -2
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +2 -2
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +3 -3
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +4 -4
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identityConversionFunction.js +6 -0
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_identityValidationFunction.js +6 -0
- package/dist/generators/ts/_snippets/snippets_validateArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_validateArray.js +13 -0
- package/dist/generators/ts/_snippets/snippets_validateMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_validateMaybe.js +7 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +1 -1
- package/dist/generators/ts/objectSetDeclarations.js +7 -10
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +0 -6
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +0 -6
- package/dist/input/generated.d.ts +8 -8
- package/dist/input/generated.js +188 -191
- package/package.json +2 -2
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToDate.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +0 -14
- package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToObject.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +0 -14
- package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToString.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToTerm.js +0 -6
- package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_convertToUnion.js +0 -6
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +0 -12
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +0 -21
|
@@ -43,6 +43,7 @@ import { AbstractType } from "./AbstractType.js";
|
|
|
43
43
|
import { code, def, joinCode } from "./ts-poet-wrapper.js";
|
|
44
44
|
export class NamedObjectType extends AbstractType {
|
|
45
45
|
toRdfTypes;
|
|
46
|
+
conversionFunction = Maybe.empty();
|
|
46
47
|
extern;
|
|
47
48
|
fromRdfType;
|
|
48
49
|
graphqlArgs = Maybe.empty();
|
|
@@ -52,6 +53,7 @@ export class NamedObjectType extends AbstractType {
|
|
|
52
53
|
recursive;
|
|
53
54
|
synthetic;
|
|
54
55
|
typeofs = ["object"];
|
|
56
|
+
validationFunction = Maybe.empty();
|
|
55
57
|
constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }) {
|
|
56
58
|
super(superParameters);
|
|
57
59
|
this.extern = extern;
|
|
@@ -78,22 +80,13 @@ export class NamedObjectType extends AbstractType {
|
|
|
78
80
|
get childObjectTypes() {
|
|
79
81
|
return this.lazyChildObjectTypes();
|
|
80
82
|
}
|
|
81
|
-
get conversionFunction() {
|
|
82
|
-
return {
|
|
83
|
-
code: code `${this.reusables.snippets.convertToObject}`,
|
|
84
|
-
sourceTypes: [
|
|
85
|
-
{
|
|
86
|
-
name: this.name,
|
|
87
|
-
typeof: "object",
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
83
|
get declaration() {
|
|
93
84
|
const declarations = [];
|
|
94
85
|
if (!this.extern) {
|
|
95
86
|
const staticModuleDeclarations = [];
|
|
96
|
-
|
|
87
|
+
if (this.configuration.features.has("Object.type")) {
|
|
88
|
+
declarations.push(NamedObjectType_interfaceDeclaration.call(this));
|
|
89
|
+
}
|
|
97
90
|
staticModuleDeclarations.push(...NamedObjectType_createFunctionDeclaration.call(this).toList(), ...NamedObjectType_equalsFunctionDeclaration.call(this).toList(), ...NamedObjectType_hashFunctionDeclarations.call(this));
|
|
98
91
|
const jsonModuleDeclarations = [
|
|
99
92
|
...NamedObjectType_jsonParseFunctionDeclaration.call(this).toList(),
|
|
@@ -104,7 +97,7 @@ export class NamedObjectType extends AbstractType {
|
|
|
104
97
|
? [
|
|
105
98
|
code `export namespace Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
|
|
106
99
|
]
|
|
107
|
-
: []), NamedObjectType_filterFunctionDeclaration.call(this), NamedObjectType_filterTypeDeclaration.call(this), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfTypeVariableStatement.call(this).toList(), NamedObjectType_isTypeFunctionDeclaration.call(this), NamedObjectType_schemaVariableStatement.call(this), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
|
|
100
|
+
: []), ...NamedObjectType_filterFunctionDeclaration.call(this).toList(), ...NamedObjectType_filterTypeDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfTypeVariableStatement.call(this).toList(), ...NamedObjectType_isTypeFunctionDeclaration.call(this).toList(), ...NamedObjectType_schemaVariableStatement.call(this).toList(), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
|
|
108
101
|
configuration: this.configuration,
|
|
109
102
|
filterType: this.filterType,
|
|
110
103
|
name: this.name,
|
|
@@ -122,6 +115,9 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
|
|
|
122
115
|
}`);
|
|
123
116
|
}
|
|
124
117
|
}
|
|
118
|
+
if (declarations.length === 0) {
|
|
119
|
+
return Maybe.empty();
|
|
120
|
+
}
|
|
125
121
|
return Maybe.of(joinCode(declarations, { on: "\n\n" }));
|
|
126
122
|
}
|
|
127
123
|
get descendantFromRdfTypeVariables() {
|
|
@@ -261,9 +257,6 @@ __decorate([
|
|
|
261
257
|
__decorate([
|
|
262
258
|
Memoize()
|
|
263
259
|
], NamedObjectType.prototype, "childObjectTypes", null);
|
|
264
|
-
__decorate([
|
|
265
|
-
Memoize()
|
|
266
|
-
], NamedObjectType.prototype, "conversionFunction", null);
|
|
267
260
|
__decorate([
|
|
268
261
|
Memoize()
|
|
269
262
|
], NamedObjectType.prototype, "descendantFromRdfTypeVariables", null);
|
|
@@ -73,7 +73,7 @@ export class NamedObjectUnionType extends AbstractNamedUnionType {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
get focusSparqlConstructTriplesFunctionDeclaration() {
|
|
76
|
-
if (!this.configuration.features.has("
|
|
76
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
77
77
|
return {};
|
|
78
78
|
}
|
|
79
79
|
return singleEntryRecord(`focusSparqlConstructTriples`, code `\
|
|
@@ -82,7 +82,7 @@ export function focusSparqlConstructTriples({ filter, focusIdentifier, variableP
|
|
|
82
82
|
}`);
|
|
83
83
|
}
|
|
84
84
|
get focusSparqlWherePatternsFunctionDeclaration() {
|
|
85
|
-
if (!this.configuration.features.has("
|
|
85
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
86
86
|
return {};
|
|
87
87
|
}
|
|
88
88
|
return singleEntryRecord(`focusSparqlWherePatterns`, code `\
|
|
@@ -110,7 +110,7 @@ if (focusIdentifier.termType === "Variable") {
|
|
|
110
110
|
}`);
|
|
111
111
|
}
|
|
112
112
|
get fromRdfResourceFunctionDeclaration() {
|
|
113
|
-
if (!this.configuration.features.has("
|
|
113
|
+
if (!this.configuration.features.has("Object.fromRdf")) {
|
|
114
114
|
return {};
|
|
115
115
|
}
|
|
116
116
|
return singleEntryRecord(`fromRdfResource`, code `\
|
|
@@ -123,7 +123,7 @@ export const fromRdfResource: ${this.reusables.snippets.FromRdfResourceFunction}
|
|
|
123
123
|
}, null)};`);
|
|
124
124
|
}
|
|
125
125
|
get graphqlTypeVariableStatement() {
|
|
126
|
-
if (!this.configuration.features.has("
|
|
126
|
+
if (!this.configuration.features.has("GraphQL")) {
|
|
127
127
|
return {};
|
|
128
128
|
}
|
|
129
129
|
if (this.synthetic) {
|
|
@@ -138,6 +138,9 @@ export const GraphQL = new ${this.reusables.imports.GraphQLUnionType}(${{
|
|
|
138
138
|
}});`);
|
|
139
139
|
}
|
|
140
140
|
get identifierTypeDeclarations() {
|
|
141
|
+
if (!this.configuration.features.has("Object.type")) {
|
|
142
|
+
return {};
|
|
143
|
+
}
|
|
141
144
|
return singleEntryRecord(`Identifier`, code `\
|
|
142
145
|
export type Identifier = ${this.#identifierType.name};
|
|
143
146
|
export namespace Identifier {
|
|
@@ -146,6 +149,9 @@ export namespace Identifier {
|
|
|
146
149
|
}`);
|
|
147
150
|
}
|
|
148
151
|
get isTypeFunctionDeclaration() {
|
|
152
|
+
if (!this.configuration.features.has("Object.type")) {
|
|
153
|
+
return {};
|
|
154
|
+
}
|
|
149
155
|
if (this._name === `${this.configuration.syntheticNamePrefix}Object`) {
|
|
150
156
|
return {};
|
|
151
157
|
}
|
|
@@ -155,6 +161,9 @@ export namespace Identifier {
|
|
|
155
161
|
}`);
|
|
156
162
|
}
|
|
157
163
|
get schemaVariableStatement() {
|
|
164
|
+
if (!this.configuration.features.has("Object.schema")) {
|
|
165
|
+
return {};
|
|
166
|
+
}
|
|
158
167
|
const commonPropertiesByName = {};
|
|
159
168
|
this.members.forEach((member, memberI) => {
|
|
160
169
|
for (const memberTypeProperty of member.type.properties.concat(member.type.ancestorObjectTypes.flatMap((ancestorObjectType) => ancestorObjectType.properties))) {
|
|
@@ -192,7 +201,7 @@ ${{
|
|
|
192
201
|
}} as const;`);
|
|
193
202
|
}
|
|
194
203
|
get toRdfResourceFunctionDeclaration() {
|
|
195
|
-
if (!this.configuration.features.has("
|
|
204
|
+
if (!this.configuration.features.has("Object.toRdf")) {
|
|
196
205
|
return {};
|
|
197
206
|
}
|
|
198
207
|
return singleEntryRecord(`toRdfResource`, code `\
|
|
@@ -6,15 +6,16 @@ export declare class OptionType<ItemTypeT extends OptionType.ItemType> extends A
|
|
|
6
6
|
readonly graphqlArgs: AbstractContainerType<ItemTypeT>["graphqlArgs"];
|
|
7
7
|
readonly kind = "OptionType";
|
|
8
8
|
readonly typeofs: "object"[];
|
|
9
|
-
get conversionFunction(): AbstractContainerType.ConversionFunction
|
|
9
|
+
get conversionFunction(): Maybe<AbstractContainerType.ConversionFunction>;
|
|
10
10
|
get equalsFunction(): Code;
|
|
11
11
|
get filterFunction(): Code;
|
|
12
|
-
get hashFunction(): Code;
|
|
13
12
|
get filterType(): Code;
|
|
14
13
|
get graphqlType(): AbstractContainerType.GraphqlType;
|
|
14
|
+
get hashFunction(): Code;
|
|
15
15
|
get mutable(): boolean;
|
|
16
16
|
get name(): Code;
|
|
17
17
|
get schemaType(): Code;
|
|
18
|
+
get validationFunction(): Maybe<Code>;
|
|
18
19
|
get valueSparqlConstructTriplesFunction(): Code;
|
|
19
20
|
get valueSparqlWherePatternsFunction(): Code;
|
|
20
21
|
protected get schemaObject(): {
|
|
@@ -24,9 +25,9 @@ export declare class OptionType<ItemTypeT extends OptionType.ItemType> extends A
|
|
|
24
25
|
fromJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromJsonExpression"]>[0]): Code;
|
|
25
26
|
fromRdfResourceValuesExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
26
27
|
graphqlResolveExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["graphqlResolveExpression"]>[0]): Code;
|
|
28
|
+
jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
|
|
27
29
|
jsonType(parameters?: Parameters<AbstractContainerType<ItemTypeT>["jsonType"]>[0]): AbstractContainerType.JsonType;
|
|
28
30
|
jsonUiSchemaElement(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
29
|
-
jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
|
|
30
31
|
toJsonExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toJsonExpression"]>[0]): Code;
|
|
31
32
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
32
33
|
toStringExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["toStringExpression"]>[0]): Code;
|
|
@@ -16,8 +16,8 @@ export class OptionType extends AbstractContainerType {
|
|
|
16
16
|
kind = "OptionType";
|
|
17
17
|
typeofs = ["object"];
|
|
18
18
|
get conversionFunction() {
|
|
19
|
-
const itemConversionFunction = this.itemType.conversionFunction;
|
|
20
|
-
return {
|
|
19
|
+
const itemConversionFunction = this.itemType.conversionFunction.orDefault(this.itemConversionFunctionDefault);
|
|
20
|
+
return Maybe.of({
|
|
21
21
|
code: code `${this.reusables.snippets.convertToMaybe}(${itemConversionFunction.code})`,
|
|
22
22
|
sourceTypes: itemConversionFunction.sourceTypes.concat({
|
|
23
23
|
name: this.name,
|
|
@@ -26,7 +26,7 @@ export class OptionType extends AbstractContainerType {
|
|
|
26
26
|
name: code `undefined`,
|
|
27
27
|
typeof: "undefined",
|
|
28
28
|
}),
|
|
29
|
-
};
|
|
29
|
+
});
|
|
30
30
|
}
|
|
31
31
|
get equalsFunction() {
|
|
32
32
|
return code `((left, right) => ${this.reusables.snippets.maybeEquals}(left, right, ${this.itemType.equalsFunction}))`;
|
|
@@ -34,9 +34,6 @@ export class OptionType extends AbstractContainerType {
|
|
|
34
34
|
get filterFunction() {
|
|
35
35
|
return code `${this.reusables.snippets.filterMaybe}<${this.itemType.name}, ${this.itemType.filterType}>(${this.itemType.filterFunction})`;
|
|
36
36
|
}
|
|
37
|
-
get hashFunction() {
|
|
38
|
-
return code `${this.reusables.snippets.hashMaybe}(${this.itemType.hashFunction})`;
|
|
39
|
-
}
|
|
40
37
|
get filterType() {
|
|
41
38
|
return code `${this.reusables.snippets.MaybeFilter}<${this.itemType.filterType}>`;
|
|
42
39
|
}
|
|
@@ -46,6 +43,9 @@ export class OptionType extends AbstractContainerType {
|
|
|
46
43
|
nullable: true,
|
|
47
44
|
});
|
|
48
45
|
}
|
|
46
|
+
get hashFunction() {
|
|
47
|
+
return code `${this.reusables.snippets.hashMaybe}(${this.itemType.hashFunction})`;
|
|
48
|
+
}
|
|
49
49
|
get mutable() {
|
|
50
50
|
return this.itemType.mutable;
|
|
51
51
|
}
|
|
@@ -55,6 +55,9 @@ export class OptionType extends AbstractContainerType {
|
|
|
55
55
|
get schemaType() {
|
|
56
56
|
return code `${this.reusables.snippets.MaybeSchema}<${this.itemType.schemaType}>`;
|
|
57
57
|
}
|
|
58
|
+
get validationFunction() {
|
|
59
|
+
return Maybe.of(code `${this.reusables.snippets.validateMaybe}(${this.itemType.validationFunction.orDefault(this.itemValidationFunctionDefault)})`);
|
|
60
|
+
}
|
|
58
61
|
get valueSparqlConstructTriplesFunction() {
|
|
59
62
|
return code `${this.reusables.snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
|
|
60
63
|
}
|
|
@@ -69,13 +72,10 @@ export class OptionType extends AbstractContainerType {
|
|
|
69
72
|
}
|
|
70
73
|
fromJsonExpression({ variables, }) {
|
|
71
74
|
const expression = code `${this.reusables.imports.Maybe}.fromNullable(${variables.value})`;
|
|
72
|
-
const valueVariable = code `item`;
|
|
73
75
|
const itemFromJsonExpression = this.itemType.fromJsonExpression({
|
|
74
|
-
variables: { value:
|
|
76
|
+
variables: { value: code `item` },
|
|
75
77
|
});
|
|
76
|
-
return
|
|
77
|
-
? expression
|
|
78
|
-
: code `${expression}.map(item => (${itemFromJsonExpression}))`;
|
|
78
|
+
return code `${expression}.map(item => (${itemFromJsonExpression}).map(${this.reusables.imports.Maybe}.of)).orDefault(${this.reusables.imports.Either}.of(${this.reusables.imports.Maybe}.empty()))`;
|
|
79
79
|
}
|
|
80
80
|
fromRdfResourceValuesExpression(parameters) {
|
|
81
81
|
const { variables } = parameters;
|
|
@@ -84,6 +84,9 @@ export class OptionType extends AbstractContainerType {
|
|
|
84
84
|
graphqlResolveExpression(parameters) {
|
|
85
85
|
return code `${this.itemType.graphqlResolveExpression(parameters)}.extractNullable()`;
|
|
86
86
|
}
|
|
87
|
+
jsonSchema(parameters) {
|
|
88
|
+
return code `${this.itemType.jsonSchema(parameters)}.optional()`;
|
|
89
|
+
}
|
|
87
90
|
jsonType(parameters) {
|
|
88
91
|
const itemTypeJsonType = this.itemType.jsonType(parameters);
|
|
89
92
|
invariant(!itemTypeJsonType.optional);
|
|
@@ -94,9 +97,6 @@ export class OptionType extends AbstractContainerType {
|
|
|
94
97
|
jsonUiSchemaElement(parameters) {
|
|
95
98
|
return this.itemType.jsonUiSchemaElement(parameters);
|
|
96
99
|
}
|
|
97
|
-
jsonSchema(parameters) {
|
|
98
|
-
return code `${this.itemType.jsonSchema(parameters)}.optional()`;
|
|
99
|
-
}
|
|
100
100
|
toJsonExpression({ variables, }) {
|
|
101
101
|
return code `${variables.value}.map(item => (${this.itemType.toJsonExpression({ variables: { value: code `item` } })})).extract()`;
|
|
102
102
|
}
|
|
@@ -123,21 +123,24 @@ __decorate([
|
|
|
123
123
|
__decorate([
|
|
124
124
|
Memoize()
|
|
125
125
|
], OptionType.prototype, "filterFunction", null);
|
|
126
|
-
__decorate([
|
|
127
|
-
Memoize()
|
|
128
|
-
], OptionType.prototype, "hashFunction", null);
|
|
129
126
|
__decorate([
|
|
130
127
|
Memoize()
|
|
131
128
|
], OptionType.prototype, "filterType", null);
|
|
132
129
|
__decorate([
|
|
133
130
|
Memoize()
|
|
134
131
|
], OptionType.prototype, "graphqlType", null);
|
|
132
|
+
__decorate([
|
|
133
|
+
Memoize()
|
|
134
|
+
], OptionType.prototype, "hashFunction", null);
|
|
135
135
|
__decorate([
|
|
136
136
|
Memoize()
|
|
137
137
|
], OptionType.prototype, "name", null);
|
|
138
138
|
__decorate([
|
|
139
139
|
Memoize()
|
|
140
140
|
], OptionType.prototype, "schemaType", null);
|
|
141
|
+
__decorate([
|
|
142
|
+
Memoize()
|
|
143
|
+
], OptionType.prototype, "validationFunction", null);
|
|
141
144
|
__decorate([
|
|
142
145
|
Memoize()
|
|
143
146
|
], OptionType.prototype, "valueSparqlConstructTriplesFunction", null);
|
|
@@ -18,6 +18,7 @@ export declare class Snippets {
|
|
|
18
18
|
get BooleanSchema(): Snippet;
|
|
19
19
|
get CollectionFilter(): Snippet;
|
|
20
20
|
get CollectionSchema(): Snippet;
|
|
21
|
+
get ConversionFunction(): Snippet;
|
|
21
22
|
get DateFilter(): Snippet;
|
|
22
23
|
get DateSchema(): Snippet;
|
|
23
24
|
get DefaultValueSchema(): Snippet;
|
|
@@ -55,6 +56,7 @@ export declare class Snippets {
|
|
|
55
56
|
get ToRdfResourceFunction(): Snippet;
|
|
56
57
|
get ToRdfResourceValuesFunction(): Snippet;
|
|
57
58
|
get UnwrapR(): Snippet;
|
|
59
|
+
get ValidationFunction(): Snippet;
|
|
58
60
|
get ValueSparqlConstructTriplesFunction(): Snippet;
|
|
59
61
|
get ValueSparqlWherePatternsFunction(): Snippet;
|
|
60
62
|
get _FromRdfResourceFunction(): Snippet;
|
|
@@ -67,12 +69,9 @@ export declare class Snippets {
|
|
|
67
69
|
get booleanEquals(): Snippet;
|
|
68
70
|
get booleanSparqlWherePatterns(): Snippet;
|
|
69
71
|
get compactRecord(): Snippet;
|
|
70
|
-
get
|
|
72
|
+
get convertToArray(): Snippet;
|
|
71
73
|
get convertToBlankNode(): Snippet;
|
|
72
74
|
get convertToBlankNodeIdentifierProperty(): Snippet;
|
|
73
|
-
get convertToBoolean(): Snippet;
|
|
74
|
-
get convertToDate(): Snippet;
|
|
75
|
-
get convertToDateTime(): Snippet;
|
|
76
75
|
get convertToIdentifier(): Snippet;
|
|
77
76
|
get convertToIdentifierProperty(): Snippet;
|
|
78
77
|
get convertToIri(): Snippet;
|
|
@@ -82,13 +81,6 @@ export declare class Snippets {
|
|
|
82
81
|
get convertToLazyObjectSet(): Snippet;
|
|
83
82
|
get convertToLiteral(): Snippet;
|
|
84
83
|
get convertToMaybe(): Snippet;
|
|
85
|
-
get convertToMutableArray(): Snippet;
|
|
86
|
-
get convertToNumeric(): Snippet;
|
|
87
|
-
get convertToObject(): Snippet;
|
|
88
|
-
get convertToReadonlyArray(): Snippet;
|
|
89
|
-
get convertToString(): Snippet;
|
|
90
|
-
get convertToTerm(): Snippet;
|
|
91
|
-
get convertToUnion(): Snippet;
|
|
92
84
|
get convertWithDefaultValue(): Snippet;
|
|
93
85
|
get dateEquals(): Snippet;
|
|
94
86
|
get dateSparqlWherePatterns(): Snippet;
|
|
@@ -119,6 +111,8 @@ export declare class Snippets {
|
|
|
119
111
|
get hashString(): Snippet;
|
|
120
112
|
get hashTerm(): Snippet;
|
|
121
113
|
get identifierSparqlWherePatterns(): Snippet;
|
|
114
|
+
get identityConversionFunction(): Snippet;
|
|
115
|
+
get identityValidationFunction(): Snippet;
|
|
122
116
|
get ifUsed(): Code[];
|
|
123
117
|
get iriSparqlWherePatterns(): Snippet;
|
|
124
118
|
get liftSparqlPatterns(): Snippet;
|
|
@@ -151,6 +145,8 @@ export declare class Snippets {
|
|
|
151
145
|
get termSchemaSparqlPatterns(): Snippet;
|
|
152
146
|
get termSparqlWherePatterns(): Snippet;
|
|
153
147
|
get toIsoDateString(): Snippet;
|
|
148
|
+
get validateArray(): Snippet;
|
|
149
|
+
get validateMaybe(): Snippet;
|
|
154
150
|
get wrap_FromRdfResourceFunction(): Snippet;
|
|
155
151
|
get wrap_ToRdfResourceFunction(): Snippet;
|
|
156
152
|
protected get snippets(): Snippets;
|
|
@@ -21,13 +21,11 @@ import { snippets_booleanEquals } from "./_snippets/snippets_booleanEquals.js";
|
|
|
21
21
|
import { snippets_booleanSparqlWherePatterns } from "./_snippets/snippets_booleanSparqlWherePatterns.js";
|
|
22
22
|
import { snippets_CollectionFilter } from "./_snippets/snippets_CollectionFilter.js";
|
|
23
23
|
import { snippets_CollectionSchema } from "./_snippets/snippets_CollectionSchema.js";
|
|
24
|
+
import { snippets_ConversionFunction } from "./_snippets/snippets_ConversionFunction.js";
|
|
24
25
|
import { snippets_compactRecord } from "./_snippets/snippets_compactRecord.js";
|
|
25
|
-
import {
|
|
26
|
+
import { snippets_convertToArray } from "./_snippets/snippets_convertToArray.js";
|
|
26
27
|
import { snippets_convertToBlankNode } from "./_snippets/snippets_convertToBlankNode.js";
|
|
27
28
|
import { snippets_convertToBlankNodeIdentifierProperty } from "./_snippets/snippets_convertToBlankNodeIdentifierProperty.js";
|
|
28
|
-
import { snippets_convertToBoolean } from "./_snippets/snippets_convertToBoolean.js";
|
|
29
|
-
import { snippets_convertToDate } from "./_snippets/snippets_convertToDate.js";
|
|
30
|
-
import { snippets_convertToDateTime } from "./_snippets/snippets_convertToDateTime.js";
|
|
31
29
|
import { snippets_convertToIdentifier } from "./_snippets/snippets_convertToIdentifier.js";
|
|
32
30
|
import { snippets_convertToIdentifierProperty } from "./_snippets/snippets_convertToIdentifierProperty.js";
|
|
33
31
|
import { snippets_convertToIri } from "./_snippets/snippets_convertToIri.js";
|
|
@@ -37,13 +35,6 @@ import { snippets_convertToLazyObjectOption } from "./_snippets/snippets_convert
|
|
|
37
35
|
import { snippets_convertToLazyObjectSet } from "./_snippets/snippets_convertToLazyObjectSet.js";
|
|
38
36
|
import { snippets_convertToLiteral } from "./_snippets/snippets_convertToLiteral.js";
|
|
39
37
|
import { snippets_convertToMaybe } from "./_snippets/snippets_convertToMaybe.js";
|
|
40
|
-
import { snippets_convertToMutableArray } from "./_snippets/snippets_convertToMutableArray.js";
|
|
41
|
-
import { snippets_convertToNumeric } from "./_snippets/snippets_convertToNumeric.js";
|
|
42
|
-
import { snippets_convertToObject } from "./_snippets/snippets_convertToObject.js";
|
|
43
|
-
import { snippets_convertToReadonlyArray } from "./_snippets/snippets_convertToReadonlyArray.js";
|
|
44
|
-
import { snippets_convertToString } from "./_snippets/snippets_convertToString.js";
|
|
45
|
-
import { snippets_convertToTerm } from "./_snippets/snippets_convertToTerm.js";
|
|
46
|
-
import { snippets_convertToUnion } from "./_snippets/snippets_convertToUnion.js";
|
|
47
38
|
import { snippets_convertWithDefaultValue } from "./_snippets/snippets_convertWithDefaultValue.js";
|
|
48
39
|
import { snippets_DateFilter } from "./_snippets/snippets_DateFilter.js";
|
|
49
40
|
import { snippets_DateSchema } from "./_snippets/snippets_DateSchema.js";
|
|
@@ -89,6 +80,8 @@ import { snippets_IdentifierSet } from "./_snippets/snippets_IdentifierSet.js";
|
|
|
89
80
|
import { snippets_IriFilter } from "./_snippets/snippets_IriFilter.js";
|
|
90
81
|
import { snippets_IriSchema } from "./_snippets/snippets_IriSchema.js";
|
|
91
82
|
import { snippets_identifierSparqlWherePatterns } from "./_snippets/snippets_identifierSparqlWherePatterns.js";
|
|
83
|
+
import { snippets_identityConversionFunction } from "./_snippets/snippets_identityConversionFunction.js";
|
|
84
|
+
import { snippets_identityValidationFunction } from "./_snippets/snippets_identityValidationFunction.js";
|
|
92
85
|
import { snippets_iriSparqlWherePatterns } from "./_snippets/snippets_iriSparqlWherePatterns.js";
|
|
93
86
|
import { snippets_LazyObject } from "./_snippets/snippets_LazyObject.js";
|
|
94
87
|
import { snippets_LazyObjectOption } from "./_snippets/snippets_LazyObjectOption.js";
|
|
@@ -142,8 +135,11 @@ import { snippets_termSchemaSparqlPatterns } from "./_snippets/snippets_termSche
|
|
|
142
135
|
import { snippets_termSparqlWherePatterns } from "./_snippets/snippets_termSparqlWherePatterns.js";
|
|
143
136
|
import { snippets_toIsoDateString } from "./_snippets/snippets_toIsoDateString.js";
|
|
144
137
|
import { snippets_UnwrapR } from "./_snippets/snippets_UnwrapR.js";
|
|
138
|
+
import { snippets_ValidationFunction } from "./_snippets/snippets_ValidationFunction.js";
|
|
145
139
|
import { snippets_ValueSparqlConstructTriplesFunction } from "./_snippets/snippets_ValueSparqlConstructTriplesFunction.js";
|
|
146
140
|
import { snippets_ValueSparqlWherePatternsFunction } from "./_snippets/snippets_ValueSparqlWherePatternsFunction.js";
|
|
141
|
+
import { snippets_validateArray } from "./_snippets/snippets_validateArray.js";
|
|
142
|
+
import { snippets_validateMaybe } from "./_snippets/snippets_validateMaybe.js";
|
|
147
143
|
import { snippets_wrap_FromRdfResourceFunction } from "./_snippets/snippets_wrap_FromRdfResourceFunction.js";
|
|
148
144
|
import { snippets_wrap_ToRdfResourceFunction } from "./_snippets/snippets_wrap_ToRdfResourceFunction.js";
|
|
149
145
|
import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
|
|
@@ -175,6 +171,9 @@ export class Snippets {
|
|
|
175
171
|
get CollectionSchema() {
|
|
176
172
|
return this.snippet(snippets_CollectionSchema);
|
|
177
173
|
}
|
|
174
|
+
get ConversionFunction() {
|
|
175
|
+
return this.snippet(snippets_ConversionFunction);
|
|
176
|
+
}
|
|
178
177
|
get DateFilter() {
|
|
179
178
|
return this.snippet(snippets_DateFilter);
|
|
180
179
|
}
|
|
@@ -286,6 +285,9 @@ export class Snippets {
|
|
|
286
285
|
get UnwrapR() {
|
|
287
286
|
return this.snippet(snippets_UnwrapR);
|
|
288
287
|
}
|
|
288
|
+
get ValidationFunction() {
|
|
289
|
+
return this.snippet(snippets_ValidationFunction);
|
|
290
|
+
}
|
|
289
291
|
get ValueSparqlConstructTriplesFunction() {
|
|
290
292
|
return this.snippet(snippets_ValueSparqlConstructTriplesFunction);
|
|
291
293
|
}
|
|
@@ -322,8 +324,8 @@ export class Snippets {
|
|
|
322
324
|
get compactRecord() {
|
|
323
325
|
return this.snippet(snippets_compactRecord);
|
|
324
326
|
}
|
|
325
|
-
get
|
|
326
|
-
return this.snippet(
|
|
327
|
+
get convertToArray() {
|
|
328
|
+
return this.snippet(snippets_convertToArray);
|
|
327
329
|
}
|
|
328
330
|
get convertToBlankNode() {
|
|
329
331
|
return this.snippet(snippets_convertToBlankNode);
|
|
@@ -331,15 +333,6 @@ export class Snippets {
|
|
|
331
333
|
get convertToBlankNodeIdentifierProperty() {
|
|
332
334
|
return this.snippet(snippets_convertToBlankNodeIdentifierProperty);
|
|
333
335
|
}
|
|
334
|
-
get convertToBoolean() {
|
|
335
|
-
return this.snippet(snippets_convertToBoolean);
|
|
336
|
-
}
|
|
337
|
-
get convertToDate() {
|
|
338
|
-
return this.snippet(snippets_convertToDate);
|
|
339
|
-
}
|
|
340
|
-
get convertToDateTime() {
|
|
341
|
-
return this.snippet(snippets_convertToDateTime);
|
|
342
|
-
}
|
|
343
336
|
get convertToIdentifier() {
|
|
344
337
|
return this.snippet(snippets_convertToIdentifier);
|
|
345
338
|
}
|
|
@@ -367,27 +360,6 @@ export class Snippets {
|
|
|
367
360
|
get convertToMaybe() {
|
|
368
361
|
return this.snippet(snippets_convertToMaybe);
|
|
369
362
|
}
|
|
370
|
-
get convertToMutableArray() {
|
|
371
|
-
return this.snippet(snippets_convertToMutableArray);
|
|
372
|
-
}
|
|
373
|
-
get convertToNumeric() {
|
|
374
|
-
return this.snippet(snippets_convertToNumeric);
|
|
375
|
-
}
|
|
376
|
-
get convertToObject() {
|
|
377
|
-
return this.snippet(snippets_convertToObject);
|
|
378
|
-
}
|
|
379
|
-
get convertToReadonlyArray() {
|
|
380
|
-
return this.snippet(snippets_convertToReadonlyArray);
|
|
381
|
-
}
|
|
382
|
-
get convertToString() {
|
|
383
|
-
return this.snippet(snippets_convertToString);
|
|
384
|
-
}
|
|
385
|
-
get convertToTerm() {
|
|
386
|
-
return this.snippet(snippets_convertToTerm);
|
|
387
|
-
}
|
|
388
|
-
get convertToUnion() {
|
|
389
|
-
return this.snippet(snippets_convertToUnion);
|
|
390
|
-
}
|
|
391
363
|
get convertWithDefaultValue() {
|
|
392
364
|
return this.snippet(snippets_convertWithDefaultValue);
|
|
393
365
|
}
|
|
@@ -478,6 +450,12 @@ export class Snippets {
|
|
|
478
450
|
get identifierSparqlWherePatterns() {
|
|
479
451
|
return this.snippet(snippets_identifierSparqlWherePatterns);
|
|
480
452
|
}
|
|
453
|
+
get identityConversionFunction() {
|
|
454
|
+
return this.snippet(snippets_identityConversionFunction);
|
|
455
|
+
}
|
|
456
|
+
get identityValidationFunction() {
|
|
457
|
+
return this.snippet(snippets_identityValidationFunction);
|
|
458
|
+
}
|
|
481
459
|
get ifUsed() {
|
|
482
460
|
return Object.entries(Object.getOwnPropertyDescriptors(Object.getPrototypeOf(this)))
|
|
483
461
|
.flatMap(([key, descriptor]) => {
|
|
@@ -590,6 +568,12 @@ export class Snippets {
|
|
|
590
568
|
get toIsoDateString() {
|
|
591
569
|
return this.snippet(snippets_toIsoDateString);
|
|
592
570
|
}
|
|
571
|
+
get validateArray() {
|
|
572
|
+
return this.snippet(snippets_validateArray);
|
|
573
|
+
}
|
|
574
|
+
get validateMaybe() {
|
|
575
|
+
return this.snippet(snippets_validateMaybe);
|
|
576
|
+
}
|
|
593
577
|
get wrap_FromRdfResourceFunction() {
|
|
594
578
|
return this.snippet(snippets_wrap_FromRdfResourceFunction);
|
|
595
579
|
}
|
|
@@ -632,6 +616,9 @@ __decorate([
|
|
|
632
616
|
__decorate([
|
|
633
617
|
Memoize()
|
|
634
618
|
], Snippets.prototype, "CollectionSchema", null);
|
|
619
|
+
__decorate([
|
|
620
|
+
Memoize()
|
|
621
|
+
], Snippets.prototype, "ConversionFunction", null);
|
|
635
622
|
__decorate([
|
|
636
623
|
Memoize()
|
|
637
624
|
], Snippets.prototype, "DateFilter", null);
|
|
@@ -743,6 +730,9 @@ __decorate([
|
|
|
743
730
|
__decorate([
|
|
744
731
|
Memoize()
|
|
745
732
|
], Snippets.prototype, "UnwrapR", null);
|
|
733
|
+
__decorate([
|
|
734
|
+
Memoize()
|
|
735
|
+
], Snippets.prototype, "ValidationFunction", null);
|
|
746
736
|
__decorate([
|
|
747
737
|
Memoize()
|
|
748
738
|
], Snippets.prototype, "ValueSparqlConstructTriplesFunction", null);
|
|
@@ -781,22 +771,13 @@ __decorate([
|
|
|
781
771
|
], Snippets.prototype, "compactRecord", null);
|
|
782
772
|
__decorate([
|
|
783
773
|
Memoize()
|
|
784
|
-
], Snippets.prototype, "
|
|
774
|
+
], Snippets.prototype, "convertToArray", null);
|
|
785
775
|
__decorate([
|
|
786
776
|
Memoize()
|
|
787
777
|
], Snippets.prototype, "convertToBlankNode", null);
|
|
788
778
|
__decorate([
|
|
789
779
|
Memoize()
|
|
790
780
|
], Snippets.prototype, "convertToBlankNodeIdentifierProperty", null);
|
|
791
|
-
__decorate([
|
|
792
|
-
Memoize()
|
|
793
|
-
], Snippets.prototype, "convertToBoolean", null);
|
|
794
|
-
__decorate([
|
|
795
|
-
Memoize()
|
|
796
|
-
], Snippets.prototype, "convertToDate", null);
|
|
797
|
-
__decorate([
|
|
798
|
-
Memoize()
|
|
799
|
-
], Snippets.prototype, "convertToDateTime", null);
|
|
800
781
|
__decorate([
|
|
801
782
|
Memoize()
|
|
802
783
|
], Snippets.prototype, "convertToIdentifier", null);
|
|
@@ -824,27 +805,6 @@ __decorate([
|
|
|
824
805
|
__decorate([
|
|
825
806
|
Memoize()
|
|
826
807
|
], Snippets.prototype, "convertToMaybe", null);
|
|
827
|
-
__decorate([
|
|
828
|
-
Memoize()
|
|
829
|
-
], Snippets.prototype, "convertToMutableArray", null);
|
|
830
|
-
__decorate([
|
|
831
|
-
Memoize()
|
|
832
|
-
], Snippets.prototype, "convertToNumeric", null);
|
|
833
|
-
__decorate([
|
|
834
|
-
Memoize()
|
|
835
|
-
], Snippets.prototype, "convertToObject", null);
|
|
836
|
-
__decorate([
|
|
837
|
-
Memoize()
|
|
838
|
-
], Snippets.prototype, "convertToReadonlyArray", null);
|
|
839
|
-
__decorate([
|
|
840
|
-
Memoize()
|
|
841
|
-
], Snippets.prototype, "convertToString", null);
|
|
842
|
-
__decorate([
|
|
843
|
-
Memoize()
|
|
844
|
-
], Snippets.prototype, "convertToTerm", null);
|
|
845
|
-
__decorate([
|
|
846
|
-
Memoize()
|
|
847
|
-
], Snippets.prototype, "convertToUnion", null);
|
|
848
808
|
__decorate([
|
|
849
809
|
Memoize()
|
|
850
810
|
], Snippets.prototype, "convertWithDefaultValue", null);
|
|
@@ -935,6 +895,12 @@ __decorate([
|
|
|
935
895
|
__decorate([
|
|
936
896
|
Memoize()
|
|
937
897
|
], Snippets.prototype, "identifierSparqlWherePatterns", null);
|
|
898
|
+
__decorate([
|
|
899
|
+
Memoize()
|
|
900
|
+
], Snippets.prototype, "identityConversionFunction", null);
|
|
901
|
+
__decorate([
|
|
902
|
+
Memoize()
|
|
903
|
+
], Snippets.prototype, "identityValidationFunction", null);
|
|
938
904
|
__decorate([
|
|
939
905
|
Memoize()
|
|
940
906
|
], Snippets.prototype, "iriSparqlWherePatterns", null);
|
|
@@ -1028,6 +994,12 @@ __decorate([
|
|
|
1028
994
|
__decorate([
|
|
1029
995
|
Memoize()
|
|
1030
996
|
], Snippets.prototype, "toIsoDateString", null);
|
|
997
|
+
__decorate([
|
|
998
|
+
Memoize()
|
|
999
|
+
], Snippets.prototype, "validateArray", null);
|
|
1000
|
+
__decorate([
|
|
1001
|
+
Memoize()
|
|
1002
|
+
], Snippets.prototype, "validateMaybe", null);
|
|
1031
1003
|
__decorate([
|
|
1032
1004
|
Memoize()
|
|
1033
1005
|
], Snippets.prototype, "wrap_FromRdfResourceFunction", null);
|
|
@@ -10,11 +10,10 @@ export declare class StringType extends AbstractPrimitiveType<string> {
|
|
|
10
10
|
readonly schemaType: Code;
|
|
11
11
|
readonly typeofs: "string"[];
|
|
12
12
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
13
|
-
get conversionFunction(): AbstractPrimitiveType.ConversionFunction;
|
|
14
13
|
get name(): string;
|
|
15
14
|
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<string>["jsonSchema"]>[0]): Code;
|
|
16
15
|
literalExpression(literal: Literal | string): Code;
|
|
17
16
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
18
|
-
protected
|
|
17
|
+
protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<string>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<string>["fromRdfResourceValuesExpressionChain"]>;
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=StringType.d.ts.map
|
|
@@ -17,17 +17,6 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
17
17
|
schemaType = code `${this.reusables.snippets.StringSchema}`;
|
|
18
18
|
typeofs = ["string"];
|
|
19
19
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.stringSparqlWherePatterns}`;
|
|
20
|
-
get conversionFunction() {
|
|
21
|
-
return {
|
|
22
|
-
code: code `${this.reusables.snippets.convertToString}<${this.name}>`,
|
|
23
|
-
sourceTypes: [
|
|
24
|
-
{
|
|
25
|
-
name: this.name,
|
|
26
|
-
typeof: "string",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
20
|
get name() {
|
|
32
21
|
if (this.primitiveIn.length > 0) {
|
|
33
22
|
return `${this.primitiveIn.map((value) => `"${value}"`).join(" | ")}`;
|
|
@@ -50,16 +39,13 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
50
39
|
toRdfResourceValuesExpression({ variables, }) {
|
|
51
40
|
return code `[${this.reusables.snippets.literalFactory}.string(${variables.value}${!this.datatype.equals(xsd.string) ? `, ${this.rdfjsTermExpression(this.datatype)}` : ""})]`;
|
|
52
41
|
}
|
|
53
|
-
|
|
42
|
+
fromRdfResourceValuesExpressionChain({ variables, }) {
|
|
54
43
|
return {
|
|
55
|
-
...super.
|
|
44
|
+
...super.fromRdfResourceValuesExpressionChain({ variables }),
|
|
56
45
|
valueTo: code `chain(values => values.chainMap(value => value.toString(${this.primitiveIn.length > 0 ? `${JSON.stringify(this.primitiveIn)} as const` : ""})))`,
|
|
57
46
|
};
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
|
-
__decorate([
|
|
61
|
-
Memoize()
|
|
62
|
-
], StringType.prototype, "conversionFunction", null);
|
|
63
49
|
__decorate([
|
|
64
50
|
Memoize()
|
|
65
51
|
], StringType.prototype, "name", null);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { NodeKind } from "@shaclmate/shacl-ast";
|
|
3
|
+
import { Maybe } from "purify-ts";
|
|
3
4
|
import { AbstractTermType } from "./AbstractTermType.js";
|
|
4
5
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
6
|
export declare class TermType<ConstantTermT extends Literal | NamedNode = Literal | NamedNode, RuntimeTermT extends BlankNode | Literal | NamedNode = BlankNode | Literal | NamedNode> extends AbstractTermType {
|
|
7
|
+
readonly conversionFunction: Maybe<AbstractTermType.ConversionFunction>;
|
|
6
8
|
readonly filterFunction: Code;
|
|
7
9
|
readonly filterType: Code;
|
|
8
10
|
readonly kind = "TermType";
|
|
@@ -12,7 +14,6 @@ export declare class TermType<ConstantTermT extends Literal | NamedNode = Litera
|
|
|
12
14
|
constructor({ nodeKinds, ...superParameters }: ConstructorParameters<typeof AbstractTermType<ConstantTermT, RuntimeTermT>>[0] & {
|
|
13
15
|
nodeKinds: ReadonlySet<NodeKind>;
|
|
14
16
|
});
|
|
15
|
-
get conversionFunction(): AbstractTermType.ConversionFunction;
|
|
16
17
|
get graphqlType(): AbstractTermType.GraphqlType;
|
|
17
18
|
get name(): Code;
|
|
18
19
|
fromJsonExpression({ variables, }: Parameters<AbstractTermType["fromJsonExpression"]>[0]): Code;
|