@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
|
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Maybe } from "purify-ts";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
|
+
import { SchemaObject } from "../SchemaObject.js";
|
|
9
10
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
10
11
|
import { tsComment } from "../tsComment.js";
|
|
11
12
|
import { ObjectType_AbstractProperty } from "./ObjectType_AbstractProperty.js";
|
|
@@ -106,33 +107,50 @@ export class ObjectType_ShaclProperty extends ObjectType_AbstractProperty {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
get schema() {
|
|
109
|
-
|
|
110
|
+
return Maybe.of(this._schema);
|
|
111
|
+
}
|
|
112
|
+
get _schema() {
|
|
113
|
+
// if (
|
|
114
|
+
// this.objectType.name.extract() === "DirectRecursiveStruct" ||
|
|
115
|
+
// this.objectType.name.extract() === "IndirectRecursiveStruct"
|
|
116
|
+
// ) {
|
|
117
|
+
// console.log("test");
|
|
118
|
+
// }
|
|
119
|
+
const properties = {
|
|
120
|
+
kind: code `kind: ${literalOf(this.kind)}`,
|
|
121
|
+
};
|
|
122
|
+
const typeMembers = {
|
|
123
|
+
kind: code `readonly kind: ${literalOf(this.kind)}`,
|
|
124
|
+
};
|
|
110
125
|
if (this.configuration.features.has("Object.fromRdf") ||
|
|
111
126
|
this.configuration.features.has("Object.toRdf")) {
|
|
112
|
-
|
|
127
|
+
properties["path"] = code `path: ${this.propertyPathToCode(this.path)}`;
|
|
128
|
+
typeMembers["path"] =
|
|
129
|
+
code `readonly path: ${this.reusables.snippets.PropertyPath}`;
|
|
113
130
|
}
|
|
114
131
|
// Use a getter if the type is recursive or the type is an object type, which may have forward references in the file
|
|
115
132
|
if (this.recursive || this.type.referencesNamedType) {
|
|
116
|
-
|
|
133
|
+
properties["type"] = () => code `get type() { return ${this.type.schema.expression}; }`;
|
|
134
|
+
typeMembers["type"] = () => code `readonly type: ${this.type.schema.type.expression}`;
|
|
117
135
|
}
|
|
118
136
|
else {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
get schemaType() {
|
|
124
|
-
const initializers = [code `readonly kind: ${literalOf(this.kind)}`];
|
|
125
|
-
if (this.configuration.features.has("Object.fromRdf") ||
|
|
126
|
-
this.configuration.features.has("Object.toRdf")) {
|
|
127
|
-
initializers.push(code `readonly path: ${this.reusables.snippets.PropertyPath}`);
|
|
137
|
+
properties["type"] = code `type: ${this.type.schema.expression}`;
|
|
138
|
+
typeMembers["type"] =
|
|
139
|
+
code `readonly type: ${this.type.schema.type.expression}`;
|
|
128
140
|
}
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
return new SchemaObject({
|
|
142
|
+
properties,
|
|
143
|
+
type: new SchemaObject.UserDefinedType({
|
|
144
|
+
members: typeMembers,
|
|
145
|
+
name: Maybe.empty(),
|
|
146
|
+
}),
|
|
147
|
+
variable: this.schemaVariable,
|
|
148
|
+
});
|
|
131
149
|
}
|
|
132
150
|
get typeSchemaVariable() {
|
|
133
|
-
return this.
|
|
134
|
-
.map((
|
|
135
|
-
.orDefaultLazy(() => this.type.schema);
|
|
151
|
+
return this.schemaVariable
|
|
152
|
+
.map((schemaVariable) => code `${schemaVariable}.type`)
|
|
153
|
+
.orDefaultLazy(() => this.type.schema.expression);
|
|
136
154
|
}
|
|
137
155
|
createInitializer({ variables, }) {
|
|
138
156
|
const parameterVariable = code `${variables.parameters}.${this.name}`;
|
|
@@ -169,11 +187,11 @@ export class ObjectType_ShaclProperty extends ObjectType_AbstractProperty {
|
|
|
169
187
|
}
|
|
170
188
|
fromRdfResourceValuesInitializer({ variables, }) {
|
|
171
189
|
return Maybe.of(code `${this.name}:
|
|
172
|
-
${this.reusables.snippets.shaclPropertyFromRdf}<${this.type.expression}, ${this.type.
|
|
190
|
+
${this.reusables.snippets.shaclPropertyFromRdf}<${this.type.expression}, ${this.type.schema.type.expression}>({
|
|
173
191
|
...${variables.options},
|
|
174
192
|
focusResource: ${variables.focusResource},
|
|
175
193
|
ignoreRdfType: true,
|
|
176
|
-
propertySchema: ${this.
|
|
194
|
+
propertySchema: ${this._schema.expression},
|
|
177
195
|
typeFromRdfResourceValues: ${this.type.fromRdfResourceValuesFunction.unannotatedUsage}
|
|
178
196
|
})`);
|
|
179
197
|
}
|
|
@@ -190,7 +208,7 @@ export class ObjectType_ShaclProperty extends ObjectType_AbstractProperty {
|
|
|
190
208
|
focusIdentifier: variables.focusIdentifier,
|
|
191
209
|
ignoreRdfType: true,
|
|
192
210
|
propertyName: this.name,
|
|
193
|
-
propertySchema: this.
|
|
211
|
+
propertySchema: this._schema.expression,
|
|
194
212
|
typeSparqlConstructTriples: this.type.valueSparqlConstructTriplesFunction.unannotatedUsage,
|
|
195
213
|
variablePrefix: variables.variablePrefix,
|
|
196
214
|
}})`);
|
|
@@ -205,7 +223,7 @@ export class ObjectType_ShaclProperty extends ObjectType_AbstractProperty {
|
|
|
205
223
|
ignoreRdfType: true,
|
|
206
224
|
preferredLanguages: variables.preferredLanguages,
|
|
207
225
|
propertyName: this.name,
|
|
208
|
-
propertySchema: this.
|
|
226
|
+
propertySchema: this._schema.expression,
|
|
209
227
|
typeSparqlWherePatterns: this.type.valueSparqlWherePatternsFunction.unannotatedUsage,
|
|
210
228
|
variablePrefix: variables.variablePrefix,
|
|
211
229
|
}})`,
|
|
@@ -231,7 +249,7 @@ export class ObjectType_ShaclProperty extends ObjectType_AbstractProperty {
|
|
|
231
249
|
return [];
|
|
232
250
|
}
|
|
233
251
|
const propertyPath = this.objectType.name
|
|
234
|
-
.map(() => code `${this.
|
|
252
|
+
.map(() => code `${this._schema.expression}.path`)
|
|
235
253
|
.orDefault(this.propertyPathToCode(this.path));
|
|
236
254
|
const { object: objectVariable, ...otherVariables } = variables;
|
|
237
255
|
return [
|
|
@@ -281,6 +299,12 @@ __decorate([
|
|
|
281
299
|
__decorate([
|
|
282
300
|
Memoize()
|
|
283
301
|
], ObjectType_ShaclProperty.prototype, "jsonObjectMember", null);
|
|
302
|
+
__decorate([
|
|
303
|
+
Memoize()
|
|
304
|
+
], ObjectType_ShaclProperty.prototype, "schema", null);
|
|
305
|
+
__decorate([
|
|
306
|
+
Memoize()
|
|
307
|
+
], ObjectType_ShaclProperty.prototype, "_schema", null);
|
|
284
308
|
__decorate([
|
|
285
309
|
Memoize()
|
|
286
310
|
], ObjectType_ShaclProperty.prototype, "typeSchemaVariable", null);
|
|
@@ -10,10 +10,15 @@ export function ObjectType_fromJsonObjectFunctionExpression() {
|
|
|
10
10
|
};
|
|
11
11
|
const propertyInitializers = this.properties.flatMap((property) => property.fromJsonObjectInitializer({ variables }).toList());
|
|
12
12
|
invariant(propertyInitializers.length > 0);
|
|
13
|
+
let optionsParameter = optionsVariable;
|
|
14
|
+
this.name.ifNothing(() => {
|
|
15
|
+
optionsParameter = code `${optionsParameter}: Parameters<${ObjectType_fromJsonObjectFunctionType.call(this)}>[1]`;
|
|
16
|
+
});
|
|
17
|
+
optionsParameter = code `${optionsParameter} = {}`;
|
|
13
18
|
return code `\
|
|
14
|
-
(${variables.jsonObject}, ${
|
|
19
|
+
(${variables.jsonObject}, ${optionsParameter}) => ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(${this.createFunction.annotatedUsage})`;
|
|
15
20
|
}
|
|
16
21
|
export function ObjectType_fromJsonObjectFunctionType() {
|
|
17
|
-
return code `${this.reusables.snippets.
|
|
22
|
+
return code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, undefined>`;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=ObjectType_fromJsonObjectFunction.js.map
|
|
@@ -3,6 +3,6 @@ export function ObjectType_fromRdfResourceValuesFunctionExpression() {
|
|
|
3
3
|
return code `(values, options) => values.chainMap(value => value.toResource().chain(resource => ${this.fromRdfResourceFunction.annotatedUsage}(resource, options)))`;
|
|
4
4
|
}
|
|
5
5
|
export function ObjectType_fromRdfResourceValuesFunctionType() {
|
|
6
|
-
return code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, ${this.
|
|
6
|
+
return code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, ${this.schema.type.expression}>`;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=ObjectType_fromRdfResourceValuesFunction.js.map
|
|
@@ -11,6 +11,6 @@ export function ObjectType_toJsonObjectFunctionExpression() {
|
|
|
11
11
|
.toList()), { on: "," })} }))`;
|
|
12
12
|
}
|
|
13
13
|
export function ObjectType_toJsonObjectFunctionType() {
|
|
14
|
-
return code `${this.reusables.snippets.
|
|
14
|
+
return code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=ObjectType_toJsonObjectFunction.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { code, conditionalOutput, joinCode, } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_FromJsonFunction = ({ configuration, imports, snippets, syntheticNamePrefix, }) => {
|
|
3
|
+
const options = [code `context?: unknown;`];
|
|
4
|
+
options.push(code `defaultNamespace?: ${snippets.NamespaceBuilder};`);
|
|
5
|
+
if (configuration.features.has("ObjectSet")) {
|
|
6
|
+
options.push(code `objectSet?: ${syntheticNamePrefix}ObjectSet;`);
|
|
7
|
+
}
|
|
8
|
+
options.push(code `prefixMap?: ${imports.PrefixMap};`);
|
|
9
|
+
const joinedOptions = joinCode(options.map((option) => code ` ${option}`), { on: "\n" });
|
|
10
|
+
return conditionalOutput(`${syntheticNamePrefix}FromJsonFunction`, code `\
|
|
11
|
+
export type ${syntheticNamePrefix}FromJsonFunction<JsonValueT, ValueT, ValueSchemaT> =
|
|
12
|
+
[ValueSchemaT] extends [undefined]
|
|
13
|
+
? (
|
|
14
|
+
jsonValue: JsonValueT,
|
|
15
|
+
options?: {
|
|
16
|
+
${joinedOptions}
|
|
17
|
+
schema?: unknown;
|
|
18
|
+
},
|
|
19
|
+
) => ${imports.Either}<Error, ValueT>
|
|
20
|
+
: (
|
|
21
|
+
jsonValue: JsonValueT,
|
|
22
|
+
options: {
|
|
23
|
+
${joinedOptions}
|
|
24
|
+
schema: ValueSchemaT;
|
|
25
|
+
},
|
|
26
|
+
) => ${imports.Either}<Error, ValueT>;`);
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=snippets_FromJsonFunction.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_ToJsonFunction = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ToJsonFunction`, code `export type ${syntheticNamePrefix}ToJsonFunction<T, JsonT> = (value: T) => JsonT;`);
|
|
3
|
+
//# sourceMappingURL=snippets_ToJsonFunction.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_arrayFromJsonArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}arrayFromJsonArray`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}arrayFromJsonArray<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}arrayFromJsonArray<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.FromJsonFunction}<ItemJsonValueT, ItemT, ItemSchemaT>): ${snippets.FromJsonFunction}<ItemJsonValueT[] | undefined, ItemT[], ${snippets.CollectionSchema}<ItemSchemaT>> {
|
|
4
4
|
return (jsonArray, options) => {
|
|
5
5
|
if (jsonArray === undefined) {
|
|
6
6
|
return ${imports.Either}.of([]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_arrayToJsonArray = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}arrayToJsonArray`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}arrayToJsonArray<ItemT, ItemJsonValueT>(itemToJsonValue: ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}arrayToJsonArray<ItemT, ItemJsonValueT>(itemToJsonValue: ${snippets.ToJsonFunction}<ItemT, ItemJsonValueT>): ${snippets.ToJsonFunction}<readonly ItemT[], ItemJsonValueT[]> {
|
|
4
4
|
return (array) => array.map(itemToJsonValue);
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_arrayToJsonArray.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigDecimalFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalFromJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}bigDecimalFromJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}bigDecimalFromJsonObject: ${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
|
|
4
4
|
(jsonObject, options) => ${snippets.literalFromJsonObject}(jsonObject, options).chain(${imports.LiteralDecoder}.decodeBigDecimalLiteral);`);
|
|
5
5
|
//# sourceMappingURL=snippets_bigDecimalFromJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigDecimalFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalFromJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}bigDecimalFromJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}bigDecimalFromJsonString: ${snippets.FromJsonFunction}<string, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
|
|
4
4
|
(jsonValue) => ${imports.Either}.encase(() => new ${imports.BigDecimal}(jsonValue));`);
|
|
5
5
|
//# sourceMappingURL=snippets_bigDecimalFromJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigDecimalToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalToJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}bigDecimalToJsonObject(datatype: ${imports.NamedNode}): ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}bigDecimalToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonFunction}<${imports.BigDecimal}, ${snippets.TypedLiteralJsonObject}> {
|
|
4
4
|
return (value) => ${snippets.typedLiteralToJsonObject}(${snippets.literalFactory}.bigdecimal(value, datatype));
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_bigDecimalToJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigDecimalToJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}bigDecimalToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}bigDecimalToJsonString: ${snippets.ToJsonFunction}<${imports.BigDecimal}, string> =
|
|
4
4
|
(bigDecimal) => bigDecimal.toFixed();`);
|
|
5
5
|
//# sourceMappingURL=snippets_bigDecimalToJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigIntFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntFromJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}bigIntFromJsonObject<BigIntT extends bigint>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}bigIntFromJsonObject<BigIntT extends bigint>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
|
|
4
4
|
const { schema } = options;
|
|
5
5
|
return ${snippets.literalFromJsonObject}(jsonObject)
|
|
6
6
|
.chain(${imports.LiteralDecoder}.decodeBigIntLiteral)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigIntFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntFromJsonString`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}bigIntFromJsonString<JsonValueT extends string, BigIntT extends bigint>(jsonValue: JsonValueT, options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}bigIntFromJsonString<JsonValueT extends string, BigIntT extends bigint>(jsonValue: JsonValueT, options: Parameters<${snippets.FromJsonFunction}<string, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
|
|
4
4
|
const { schema } = options;
|
|
5
5
|
return ${imports.Either}.encase(() => BigInt(jsonValue) as BigIntT)
|
|
6
6
|
.chain(value => ${snippets.constrainPrimitive}<BigIntT, bigint>(value, schema.in)) as ${imports.Either}<Error, BigIntT>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigIntToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntToJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}bigIntToJsonObject(datatype: ${imports.NamedNode}): ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}bigIntToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonFunction}<bigint, ${snippets.TypedLiteralJsonObject}> {
|
|
4
4
|
return (value) => ${snippets.typedLiteralToJsonObject}(${snippets.literalFactory}.bigint(value, datatype));
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_bigIntToJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_bigIntToJsonString = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}bigIntToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}bigIntToJsonString: ${snippets.ToJsonFunction}<bigint, string> =
|
|
4
4
|
(bigInt) => bigInt.toString();`);
|
|
5
5
|
//# sourceMappingURL=snippets_bigIntToJsonString.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_blankNodeFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeFromJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}blankNodeFromJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}blankNodeFromJsonObject: ${snippets.FromJsonFunction}<${snippets.IdentifierJsonObject}, ${imports.BlankNode}, undefined> =
|
|
4
4
|
(jsonObject) => ${snippets.blankNodeFromJsonString}(jsonObject["@id"]);`);
|
|
5
5
|
//# sourceMappingURL=snippets_blankNodeFromJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_blankNodeFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeFromJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}blankNodeFromJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}blankNodeFromJsonString: ${snippets.FromJsonFunction}<string, ${imports.BlankNode}, undefined> =
|
|
4
4
|
(jsonValue) => ${imports.Right}(${imports.dataFactory}.blankNode(jsonValue.substring(2)));`);
|
|
5
5
|
//# sourceMappingURL=snippets_blankNodeFromJsonString.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_blankNodeToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeToJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}blankNodeToJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}blankNodeToJsonObject: ${snippets.ToJsonFunction}<${imports.BlankNode}, ${snippets.IdentifierJsonObject}> =
|
|
4
4
|
(blankNode) => ({ "@id": ${snippets.blankNodeToJsonString}(blankNode) });`);
|
|
5
5
|
//# sourceMappingURL=snippets_blankNodeToJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_blankNodeToJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}blankNodeToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}blankNodeToJsonString: ${snippets.ToJsonFunction}<${imports.BlankNode}, string> =
|
|
4
4
|
(blankNode) => \`_:\${blankNode.value}\`;`);
|
|
5
5
|
//# sourceMappingURL=snippets_blankNodeToJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_booleanFromJsonBoolean = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanFromJsonBoolean`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}booleanFromJsonBoolean<BooleanT extends boolean>(jsonBoolean: BooleanT, _options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}booleanFromJsonBoolean<BooleanT extends boolean>(jsonBoolean: BooleanT, _options: Parameters<${snippets.FromJsonFunction}<BooleanT, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
|
|
4
4
|
return ${imports.Either}.of(jsonBoolean);
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_booleanFromJsonBoolean.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_booleanFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanFromJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}booleanFromJsonObject<BooleanT extends boolean>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}booleanFromJsonObject<BooleanT extends boolean>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
|
|
4
4
|
const { schema } = options;
|
|
5
5
|
return ${snippets.literalFromJsonObject}(jsonObject)
|
|
6
6
|
.chain(${imports.LiteralDecoder}.decodeBooleanLiteral)
|
|
@@ -5,7 +5,7 @@ function ${syntheticNamePrefix}convertToIdentifier<DefaultNamespaceT extends ${s
|
|
|
5
5
|
case "object":
|
|
6
6
|
return ${imports.Either}.of(value);
|
|
7
7
|
case "string":
|
|
8
|
-
return ${
|
|
8
|
+
return ${snippets.iriFromString}(value, { defaultNamespace });
|
|
9
9
|
case "undefined":
|
|
10
10
|
return ${imports.Either}.of(${imports.dataFactory}.blankNode());
|
|
11
11
|
}
|
|
@@ -8,10 +8,8 @@ function ${syntheticNamePrefix}convertToIdentifierProperty<DefaultNamespaceT ext
|
|
|
8
8
|
const captureIdentifier = identifier;
|
|
9
9
|
return ${imports.Either}.of(() => captureIdentifier);
|
|
10
10
|
}
|
|
11
|
-
case "string":
|
|
12
|
-
|
|
13
|
-
return ${imports.Either}.of(() => captureIdentifier);
|
|
14
|
-
}
|
|
11
|
+
case "string":
|
|
12
|
+
return ${snippets.iriFromString}(identifier, { defaultNamespace }).map(iri => (() => iri));
|
|
15
13
|
case "undefined": {
|
|
16
14
|
const captureIdentifier = ${imports.dataFactory}.blankNode();
|
|
17
15
|
return ${imports.Either}.of(() => captureIdentifier);
|
|
@@ -5,7 +5,7 @@ function ${syntheticNamePrefix}convertToIri<DefaultNamespaceT extends ${snippets
|
|
|
5
5
|
case "object":
|
|
6
6
|
return ${imports.Either}.of(value);
|
|
7
7
|
case "string":
|
|
8
|
-
return ${
|
|
8
|
+
return ${snippets.iriFromString}(value, { defaultNamespace });
|
|
9
9
|
}
|
|
10
10
|
}`);
|
|
11
11
|
//# sourceMappingURL=snippets_convertToIri.js.map
|
|
@@ -9,8 +9,7 @@ function ${syntheticNamePrefix}convertToIriIdentifierProperty<DefaultNamespaceT
|
|
|
9
9
|
return ${imports.Either}.of(() => captureIdentifier);
|
|
10
10
|
}
|
|
11
11
|
case "string": {
|
|
12
|
-
|
|
13
|
-
return ${imports.Either}.of(() => captureIdentifier);
|
|
12
|
+
return ${snippets.iriFromString}(identifier, { defaultNamespace }).map(iri => (() => iri));
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
}`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_convertToIriLiteral = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIriLiteral`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}convertToIriLiteral<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_convertToIriLiteral.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_convertToIriLiteralIdentifierProperty = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIriLiteralIdentifierProperty`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}convertToIriLiteralIdentifierProperty<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_convertToIriLiteralIdentifierProperty.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateFromJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}dateFromJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}dateFromJsonObject: ${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, Date, undefined> =
|
|
4
4
|
(jsonObject) => ${snippets.literalFromJsonObject}(jsonObject).chain(${imports.LiteralDecoder}.decodeDateLiteral);`);
|
|
5
5
|
//# sourceMappingURL=snippets_dateFromJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateFromJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}dateFromJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}dateFromJsonString: ${snippets.FromJsonFunction}<string, Date, ${snippets.DateSchema}> =
|
|
4
4
|
(jsonValue) => ${imports.Either}.encase(() => new Date(jsonValue));`);
|
|
5
5
|
//# sourceMappingURL=snippets_dateFromJsonString.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateTimeFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateTimeFromJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}dateTimeFromJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}dateTimeFromJsonObject: ${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, Date, undefined> =
|
|
4
4
|
(jsonObject) => ${snippets.literalFromJsonObject}(jsonObject).chain(${imports.LiteralDecoder}.decodeDateTimeLiteral);`);
|
|
5
5
|
//# sourceMappingURL=snippets_dateTimeFromJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateTimeToJsonString = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateTimeToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}dateTimeToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}dateTimeToJsonString: ${snippets.ToJsonFunction}<Date, string> =
|
|
4
4
|
(date) => date.toISOString();`);
|
|
5
5
|
//# sourceMappingURL=snippets_dateTimeToJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateToJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}dateToJsonObject(datatype: ${imports.NamedNode}): ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}dateToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonFunction}<Date, ${snippets.TypedLiteralJsonObject}> {
|
|
4
4
|
return (value) => ${snippets.typedLiteralToJsonObject}(${snippets.literalFactory}.date(value, datatype));
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_dateToJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_dateToJsonString = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}dateToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}dateToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}dateToJsonString: ${snippets.ToJsonFunction}<Date, string> =
|
|
4
4
|
(date) => ${snippets.toIsoDateString}(date);`);
|
|
5
5
|
//# sourceMappingURL=snippets_dateToJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_defaultValueFromJsonObject = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}defaultValueFromJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}defaultValueFromJsonObject<ItemJsonObjectT extends object, ItemT, ItemSchemaT>(itemFromJsonObject: ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}defaultValueFromJsonObject<ItemJsonObjectT extends object, ItemT, ItemSchemaT>(itemFromJsonObject: ${snippets.FromJsonFunction}<ItemJsonObjectT, ItemT, ItemSchemaT>): ${snippets.FromJsonFunction}<ItemJsonObjectT, ItemT, ${snippets.DefaultValueSchema}<ItemSchemaT>> {
|
|
4
4
|
return (jsonObject, options) => {
|
|
5
5
|
const { schema, ...otherOptions } = options;
|
|
6
6
|
return itemFromJsonObject(jsonObject, { schema: schema.itemType, ...otherOptions });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_defaultValueFromJsonValue = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}defaultValueFromJsonValue`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}defaultValueFromJsonValue<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}defaultValueFromJsonValue<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.FromJsonFunction}<ItemJsonValueT, ItemT, ItemSchemaT>): ${snippets.FromJsonFunction}<ItemJsonValueT, ItemT, ${snippets.DefaultValueSchema}<ItemSchemaT>> {
|
|
4
4
|
return (jsonValue, options) => {
|
|
5
5
|
const { schema, ...otherOptions } = options;
|
|
6
6
|
return itemFromJsonValue(jsonValue, { schema: schema.itemType, ...otherOptions });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_floatFromJsonNumber = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}floatFromJsonNumber`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}floatFromJsonNumber<FloatT extends number>(jsonNumber: FloatT, _options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}floatFromJsonNumber<FloatT extends number>(jsonNumber: FloatT, _options: Parameters<${snippets.FromJsonFunction}<FloatT, FloatT, ${snippets.NumericSchema}<FloatT>>>[1]): ${imports.Either}<Error, FloatT> {
|
|
4
4
|
return ${imports.Either}.of(jsonNumber);
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_floatFromJsonNumber.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_floatFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}floatFromJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}floatFromJsonObject<FloatT extends number>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}floatFromJsonObject<FloatT extends number>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, FloatT, ${snippets.NumericSchema}<FloatT>>>[1]): ${imports.Either}<Error, FloatT> {
|
|
4
4
|
const { schema } = options;
|
|
5
5
|
return ${snippets.literalFromJsonObject}(jsonObject)
|
|
6
6
|
.chain(${imports.LiteralDecoder}.decodeFloatLiteral)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_identifierFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}identifierFromJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}identifierFromJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}identifierFromJsonObject: ${snippets.FromJsonFunction}<${snippets.IdentifierJsonObject}, ${imports.BlankNode} | ${imports.NamedNode}, ${snippets.IdentifierSchema}> =
|
|
4
4
|
(jsonObject, options) => ${snippets.identifierFromJsonString}(jsonObject["@id"], options);`);
|
|
5
5
|
//# sourceMappingURL=snippets_identifierFromJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_identifierFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}identifierFromJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}identifierFromJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}identifierFromJsonString: ${snippets.FromJsonFunction}<string, ${imports.BlankNode} | ${imports.NamedNode}, ${snippets.IdentifierSchema}> =
|
|
4
4
|
(jsonString, options) => jsonString.startsWith("_:") ? ${snippets.blankNodeFromJsonString}(jsonString, options) as ${imports.Either}<Error, ${imports.BlankNode} | ${imports.NamedNode}> : ${snippets.iriFromJsonString}(jsonString, options) as ${imports.Either}<Error, ${imports.BlankNode} | ${imports.NamedNode}>;`);
|
|
5
5
|
//# sourceMappingURL=snippets_identifierFromJsonString.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_identifierToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}identifierToJsonObject`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}identifierToJsonObject: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}identifierToJsonObject: ${snippets.ToJsonFunction}<${imports.BlankNode} | ${imports.NamedNode}, ${snippets.IdentifierJsonObject}> =
|
|
4
4
|
(identifier) => identifier.termType === "BlankNode" ? ${snippets.blankNodeToJsonObject}(identifier) : ${snippets.iriToJsonObject}(identifier);`);
|
|
5
5
|
//# sourceMappingURL=snippets_identifierToJsonObject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_identifierToJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}identifierToJsonString`, code `\
|
|
3
|
-
const ${syntheticNamePrefix}identifierToJsonString: ${snippets.
|
|
3
|
+
const ${syntheticNamePrefix}identifierToJsonString: ${snippets.ToJsonFunction}<${imports.BlankNode} | ${imports.NamedNode}, string> =
|
|
4
4
|
(identifier) => identifier.termType === "BlankNode" ? ${snippets.blankNodeToJsonString}(identifier) : ${snippets.iriToJsonString}(identifier);`);
|
|
5
5
|
//# sourceMappingURL=snippets_identifierToJsonString.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_intFromJsonNumber = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}intFromJsonNumber`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}intFromJsonNumber<IntT extends number>(jsonNumber: IntT, _options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}intFromJsonNumber<IntT extends number>(jsonNumber: IntT, _options: Parameters<${snippets.FromJsonFunction}<IntT, IntT, ${snippets.NumericSchema}<IntT>>>[1]): ${imports.Either}<Error, IntT> {
|
|
4
4
|
return ${imports.Either}.of(jsonNumber);
|
|
5
5
|
}`);
|
|
6
6
|
//# sourceMappingURL=snippets_intFromJsonNumber.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
2
|
export const snippets_intFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}intFromJsonObject`, code `\
|
|
3
|
-
function ${syntheticNamePrefix}intFromJsonObject<IntT extends number>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.
|
|
3
|
+
function ${syntheticNamePrefix}intFromJsonObject<IntT extends number>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, IntT, ${snippets.NumericSchema}<IntT>>>[1]): ${imports.Either}<Error, IntT> {
|
|
4
4
|
const { schema } = options;
|
|
5
5
|
return ${snippets.literalFromJsonObject}(jsonObject)
|
|
6
6
|
.chain(${imports.LiteralDecoder}.decodeIntLiteral)
|