@shaclmate/compiler 4.0.39 → 4.0.40
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 +1 -1
- package/dist/generators/ts/AbstractCollectionType.js +10 -10
- package/dist/generators/ts/AbstractContainerType.d.ts +4 -5
- package/dist/generators/ts/AbstractContainerType.js +4 -5
- package/dist/generators/ts/AbstractDateType.d.ts +3 -3
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -8
- package/dist/generators/ts/AbstractLazyObjectType.js +19 -19
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
- package/dist/generators/ts/AbstractNumericType.js +3 -3
- package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
- package/dist/generators/ts/AbstractObjectSetType.js +2 -2
- package/dist/generators/ts/AbstractPrimitiveType.js +2 -2
- package/dist/generators/ts/AbstractTermType.js +2 -2
- package/dist/generators/ts/AbstractType.d.ts +15 -10
- package/dist/generators/ts/AbstractType.js +6 -1
- package/dist/generators/ts/BigDecimalType.d.ts +1 -1
- package/dist/generators/ts/BigDecimalType.js +2 -2
- package/dist/generators/ts/BigIntType.js +2 -2
- package/dist/generators/ts/BlankNodeType.d.ts +3 -3
- package/dist/generators/ts/BlankNodeType.js +11 -11
- package/dist/generators/ts/BooleanType.d.ts +2 -2
- package/dist/generators/ts/BooleanType.js +10 -5
- package/dist/generators/ts/DefaultValueType.d.ts +1 -1
- package/dist/generators/ts/DefaultValueType.js +8 -9
- package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
- package/dist/generators/ts/GraphqlSchema.js +4 -4
- package/dist/generators/ts/IdentifierType.d.ts +3 -3
- package/dist/generators/ts/IdentifierType.js +13 -13
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +17 -17
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
- package/dist/generators/ts/LazyObjectOptionType.js +6 -6
- package/dist/generators/ts/LazyObjectSetType.js +5 -5
- package/dist/generators/ts/LazyObjectType.js +4 -4
- package/dist/generators/ts/ListType.d.ts +4 -5
- package/dist/generators/ts/ListType.js +3 -4
- package/dist/generators/ts/LiteralType.d.ts +1 -1
- package/dist/generators/ts/LiteralType.js +5 -5
- package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +23 -24
- package/dist/generators/ts/ObjectType.js +350 -0
- package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
- package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +50 -58
- package/dist/generators/ts/OptionType.d.ts +1 -1
- package/dist/generators/ts/OptionType.js +10 -10
- package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
- package/dist/generators/ts/SparqlObjectSetType.js +2 -2
- package/dist/generators/ts/StringType.d.ts +2 -2
- package/dist/generators/ts/StringType.js +10 -5
- package/dist/generators/ts/TermType.d.ts +2 -2
- package/dist/generators/ts/TermType.js +12 -12
- package/dist/generators/ts/TsGenerator.js +12 -9
- package/dist/generators/ts/Type.d.ts +4 -5
- package/dist/generators/ts/TypeFactory.d.ts +7 -8
- package/dist/generators/ts/TypeFactory.js +61 -62
- package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +33 -5
- package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +262 -58
- package/dist/generators/ts/ZodGenerator.js +7 -9
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +6 -6
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +1 -1
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +8 -8
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +1 -5
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +15 -10
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +14 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +6 -6
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +7 -7
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
- package/dist/input/generated.d.ts +2 -2
- package/dist/input/generated.js +2 -2
- package/package.json +4 -4
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
- package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
- package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
- package/dist/generators/ts/AnonymousUnionType.js +0 -59
- package/dist/generators/ts/NamedObjectType.js +0 -342
- package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
- package/dist/generators/ts/NamedUnionType.d.ts +0 -11
- package/dist/generators/ts/NamedUnionType.js +0 -13
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonParseFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.parse")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -11,4 +11,4 @@ export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Js
|
|
|
11
11
|
return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
|
|
12
12
|
}`);
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.schema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -28,4 +28,4 @@ export function schema() {
|
|
|
28
28
|
return ${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${this.reusables.imports.z}.ZodType<Json>;
|
|
29
29
|
}`);
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonTypeAliasDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonTypeAliasDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.type")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
@@ -13,4 +13,4 @@ export function NamedObjectType_jsonTypeAliasDeclaration() {
|
|
|
13
13
|
}
|
|
14
14
|
return Maybe.of(code `export type Json = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_jsonUiSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.JSON.uiSchema")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const variables = { scopePrefix: code `scopePrefix` };
|
|
8
8
|
const elements = this.parentObjectTypes
|
|
9
|
-
.map((parentObjectType) => code `${parentObjectType.
|
|
9
|
+
.map((parentObjectType) => code `${parentObjectType.alias.unsafeCoerce()}.Json.uiSchema({ scopePrefix })`)
|
|
10
10
|
.concat(this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
11
11
|
return Maybe.of(code `\
|
|
12
12
|
export function uiSchema(parameters?: { scopePrefix?: string }): any {
|
|
13
13
|
const scopePrefix = parameters?.scopePrefix ?? "#";
|
|
14
|
-
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.
|
|
14
|
+
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.alias.unsafeCoerce())}", type: "Group" };
|
|
15
15
|
}`);
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function ObjectType_objectSetMethodNames(this: {
|
|
3
|
+
readonly alias: string;
|
|
3
4
|
readonly configuration: TsGenerator.Configuration;
|
|
4
|
-
readonly name: string;
|
|
5
5
|
}): {
|
|
6
6
|
object: string;
|
|
7
7
|
objectCount: string;
|
|
8
8
|
objectIdentifiers: string;
|
|
9
9
|
objects: string;
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { camelCase, trainCase } from "change-case";
|
|
2
2
|
import plur from "plur";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_objectSetMethodNames() {
|
|
4
4
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
5
|
-
const prefixSingular = camelCase(this.
|
|
5
|
+
const prefixSingular = camelCase(this.alias, {
|
|
6
6
|
prefixCharacters: syntheticNamePrefix,
|
|
7
7
|
});
|
|
8
|
-
const thisNameParts = trainCase(this.
|
|
8
|
+
const thisNameParts = trainCase(this.alias, {
|
|
9
9
|
prefixCharacters: syntheticNamePrefix,
|
|
10
10
|
}).split("-");
|
|
11
11
|
let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
|
|
@@ -20,4 +20,4 @@ export function NamedObjectType_objectSetMethodNames() {
|
|
|
20
20
|
objects: prefixPlural,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=ObjectType_objectSetMethodNames.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_schemaVariableStatement(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_schemaVariableStatement() {
|
|
4
|
+
if (!this.configuration.features.has("Object.schema")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export const schema = { properties: { ${joinCode(this.parentObjectTypes
|
|
9
|
+
.map((parentObjectType) => code `...${parentObjectType.alias.unsafeCoerce()}.schema.properties`)
|
|
10
|
+
.concat(this.properties.flatMap((property) => property.schema
|
|
11
|
+
.toList()
|
|
12
|
+
.map((propertySchema) => code `${property.name}: ${propertySchema}`))), { on: ", " })} } } as const;`);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ObjectType_schemaVariableStatement.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { camelCase } from "change-case";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_sparqlConstructQueryFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
8
|
return Maybe.of(code `\
|
|
9
9
|
export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages, prefixes, subject, ...queryParameters }: { filter?: ${this.filterType}; ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; preferredLanguages?: readonly string[]; subject: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable} } & Omit<${this.reusables.imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type">): ${this.reusables.imports.sparqljs}.ConstructQuery {
|
|
10
|
-
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.
|
|
10
|
+
const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.alias)}";
|
|
11
11
|
|
|
12
12
|
return {
|
|
13
13
|
...queryParameters,
|
|
14
14
|
prefixes: prefixes ?? {},
|
|
15
15
|
queryType: "CONSTRUCT",
|
|
16
16
|
template: (queryParameters.template ?? []).concat(
|
|
17
|
-
${this.
|
|
17
|
+
${this.alias}.focusSparqlConstructTriples({
|
|
18
18
|
filter,
|
|
19
19
|
focusIdentifier: subject,
|
|
20
20
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -24,7 +24,7 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
24
24
|
type: "query",
|
|
25
25
|
where: (queryParameters.where ?? []).concat(
|
|
26
26
|
${this.reusables.snippets.normalizeSparqlWherePatterns}(
|
|
27
|
-
${this.
|
|
27
|
+
${this.alias}.focusSparqlWherePatterns({
|
|
28
28
|
filter,
|
|
29
29
|
focusIdentifier: subject,
|
|
30
30
|
ignoreRdfType: !!ignoreRdfType,
|
|
@@ -36,4 +36,4 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
|
|
|
36
36
|
};
|
|
37
37
|
}`);
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.js.map
|
|
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import type { Reusables } from "../Reusables.js";
|
|
3
3
|
import type { TsGenerator } from "../TsGenerator.js";
|
|
4
4
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function ObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
6
|
+
readonly alias: string;
|
|
6
7
|
readonly configuration: TsGenerator.Configuration;
|
|
7
8
|
readonly filterType: Code;
|
|
8
|
-
readonly name: string;
|
|
9
9
|
readonly reusables: Reusables;
|
|
10
10
|
}): Maybe<Code>;
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export function ObjectType_sparqlConstructQueryStringFunctionDeclaration() {
|
|
4
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
|
+
return Maybe.empty();
|
|
6
|
+
}
|
|
7
|
+
return Maybe.of(code `\
|
|
8
|
+
export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.alias}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
|
|
9
|
+
return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.alias}.sparqlConstructQuery(parameters));
|
|
10
|
+
}`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_toJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_toJsonFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.toJson")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const jsonObjectMembers = [];
|
|
8
8
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
9
|
-
jsonObjectMembers.push(code `...${parentObjectType.
|
|
9
|
+
jsonObjectMembers.push(code `...${parentObjectType.alias.unsafeCoerce()}.toJson(${this.thisVariable})`);
|
|
10
10
|
}
|
|
11
11
|
if (this.properties.length > 0) {
|
|
12
12
|
jsonObjectMembers.push(...this.properties.flatMap((property) => property
|
|
@@ -34,8 +34,8 @@ export function NamedObjectType_toJsonFunctionDeclaration() {
|
|
|
34
34
|
// break;
|
|
35
35
|
// }
|
|
36
36
|
return Maybe.of(code `\
|
|
37
|
-
export function toJson(${this.thisVariable}: ${this.
|
|
37
|
+
export function toJson(${this.thisVariable}: ${this.expression}): ${returnType} {
|
|
38
38
|
return JSON.parse(JSON.stringify({ ${joinCode(jsonObjectMembers, { on: "," })} } satisfies ${this.jsonType().name}));
|
|
39
39
|
}`);
|
|
40
40
|
}
|
|
41
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_toRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { rdf } from "@tpluscode/rdf-ns-builders";
|
|
2
2
|
import { Maybe } from "purify-ts";
|
|
3
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function ObjectType_toRdfResourceFunctionDeclaration() {
|
|
5
5
|
if (!this.configuration.features.has("Object.toRdf")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
|
-
const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.
|
|
8
|
+
const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.alias.unsafeCoerce()}._toRdfResource({ ...parameters, ignoreRdfType: true });`);
|
|
9
9
|
if (this.toRdfTypes.length > 0) {
|
|
10
10
|
statements.push(code `if (!${variables.ignoreRdfType}) { ${joinCode(this.toRdfTypes.map((toRdfType) => code `${variables.resource}.add(${this.rdfjsTermExpression(rdf.type)}, ${this.reusables.imports.dataFactory}.namedNode("${toRdfType.value}"), ${variables.graph});`), { on: " " })} }`);
|
|
11
11
|
}
|
|
@@ -23,7 +23,7 @@ export function NamedObjectType_toRdfResourceFunctionDeclaration() {
|
|
|
23
23
|
}
|
|
24
24
|
statements.push(code `return ${variables.resource};`);
|
|
25
25
|
return Maybe.of(code `\
|
|
26
|
-
export const _toRdfResource: ${this.reusables.snippets._ToRdfResourceFunction}<${this.identifierTypeAlias}, ${this.
|
|
26
|
+
export const _toRdfResource: ${this.reusables.snippets._ToRdfResourceFunction}<${this.identifierTypeAlias}, ${this.expression}> = (parameters) => {
|
|
27
27
|
${joinCode(statements)}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -36,4 +36,4 @@ const variables = {
|
|
|
36
36
|
resource: code `parameters.resource`,
|
|
37
37
|
resourceSet: code `parameters.resourceSet`,
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function ObjectType_toStringFunctionDeclarations(this: ObjectType): readonly Code[];
|
|
4
|
+
//# sourceMappingURL=ObjectType_toStringFunctionDeclarations.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function ObjectType_toStringFunctionDeclarations() {
|
|
3
3
|
if (!this.configuration.features.has("Object.toString")) {
|
|
4
4
|
return [];
|
|
5
5
|
}
|
|
6
6
|
let propertiesToStringInitializers = [];
|
|
7
7
|
if (this.parentObjectTypes.length > 0) {
|
|
8
8
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
9
|
-
propertiesToStringInitializers.push(code `...${parentObjectType.
|
|
9
|
+
propertiesToStringInitializers.push(code `...${parentObjectType.alias.unsafeCoerce()}._propertiesToStrings(${this.thisVariable})`);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
propertiesToStringInitializers = propertiesToStringInitializers.concat(this.properties.flatMap((property) => property
|
|
@@ -19,18 +19,18 @@ export function NamedObjectType_toStringFunctionDeclarations() {
|
|
|
19
19
|
})
|
|
20
20
|
.toList()));
|
|
21
21
|
const propertiesToStringsReturnExpression = code `${this.reusables.snippets.compactRecord}({${joinCode(propertiesToStringInitializers, { on: "," })}})`;
|
|
22
|
-
const toStringReturnExpression = (propertiesToStrings) => code `\`${this.
|
|
22
|
+
const toStringReturnExpression = (propertiesToStrings) => code `\`${this.alias.unsafeCoerce()}(\${JSON.stringify(${propertiesToStrings})})\``;
|
|
23
23
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
24
24
|
return [
|
|
25
25
|
// Use overloads to allow the function to be attached to an instance or used freestanding
|
|
26
26
|
code `\
|
|
27
|
-
export function _propertiesToStrings(${this.thisVariable}: ${this.
|
|
27
|
+
export function _propertiesToStrings(${this.thisVariable}: ${this.expression}): Record<string, string> {
|
|
28
28
|
return ${propertiesToStringsReturnExpression};
|
|
29
29
|
}`,
|
|
30
30
|
code `\
|
|
31
|
-
export function ${syntheticNamePrefix}toString(${this.thisVariable}: ${this.
|
|
31
|
+
export function ${syntheticNamePrefix}toString(${this.thisVariable}: ${this.expression}): string {
|
|
32
32
|
return ${toStringReturnExpression(code `_propertiesToStrings(${this.thisVariable})`)};
|
|
33
33
|
}`,
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=ObjectType_toStringFunctionDeclarations.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_valueSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
8
8
|
export const valueSparqlConstructTriples: ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, valueVariable, variablePrefix }) =>
|
|
9
|
-
${this.
|
|
9
|
+
${this.alias.unsafeCoerce()}.focusSparqlConstructTriples({ filter, focusIdentifier: valueVariable, ignoreRdfType, variablePrefix });`);
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js.map
|
package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { ObjectType } from "../ObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function ObjectType_valueSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function ObjectType_valueSparqlWherePatternsFunctionDeclaration() {
|
|
4
4
|
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
8
8
|
export const valueSparqlWherePatterns: ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, preferredLanguages, propertyPatterns, valueVariable, variablePrefix }) =>
|
|
9
9
|
(propertyPatterns as readonly ${this.reusables.snippets.SparqlPattern}[]).concat(
|
|
10
|
-
${this.
|
|
10
|
+
${this.alias.unsafeCoerce()}.focusSparqlWherePatterns({ filter, focusIdentifier: valueVariable, ignoreRdfType, preferredLanguages, variablePrefix })
|
|
11
11
|
);`);
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.js.map
|
|
@@ -31,7 +31,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
31
31
|
get constructorParameter() {
|
|
32
32
|
const conversionFunction = this.type.conversionFunction.extract();
|
|
33
33
|
if (!conversionFunction) {
|
|
34
|
-
return Maybe.of(code `readonly ${this.name}: ${this.type.
|
|
34
|
+
return Maybe.of(code `readonly ${this.name}: ${this.type.expression};`);
|
|
35
35
|
}
|
|
36
36
|
let hasQuestionToken = false;
|
|
37
37
|
const typeNames = [];
|
|
@@ -40,7 +40,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
40
40
|
hasQuestionToken = true;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
typeNames.push(code `${type.
|
|
43
|
+
typeNames.push(code `${type.expression}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
|
|
@@ -55,7 +55,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
55
55
|
.alt(this.description)
|
|
56
56
|
.alt(this.label)
|
|
57
57
|
.map(tsComment)
|
|
58
|
-
.orDefault("")}${joinCode(lhs, { on: " " })}: ${this.type.
|
|
58
|
+
.orDefault("")}${joinCode(lhs, { on: " " })}: ${this.type.expression};`;
|
|
59
59
|
}
|
|
60
60
|
get filterProperty() {
|
|
61
61
|
return Maybe.of({
|
|
@@ -118,13 +118,13 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
118
118
|
const validationFunction = this.type.validationFunction.extract();
|
|
119
119
|
let rhs;
|
|
120
120
|
if (conversionFunction && validationFunction) {
|
|
121
|
-
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.
|
|
121
|
+
rhs = code `${conversionFunction}(${parameterVariable}).chain(value => ${validationFunction}(${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.type, value))`;
|
|
122
122
|
}
|
|
123
123
|
else if (conversionFunction) {
|
|
124
124
|
rhs = code `${conversionFunction}(${parameterVariable})`;
|
|
125
125
|
}
|
|
126
126
|
else if (validationFunction) {
|
|
127
|
-
rhs = code `${validationFunction}(${this.
|
|
127
|
+
rhs = code `${validationFunction}(${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.type, ${parameterVariable})`;
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
130
|
rhs = code `${this.reusables.imports.Either}.of(${parameterVariable})`;
|
|
@@ -148,7 +148,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
148
148
|
variables: {
|
|
149
149
|
...variables,
|
|
150
150
|
ignoreRdfType: true,
|
|
151
|
-
propertyPath: code `${this.
|
|
151
|
+
propertyPath: code `${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.path`,
|
|
152
152
|
resourceValues: code `resourceValues`,
|
|
153
153
|
},
|
|
154
154
|
})})`,
|
|
@@ -209,7 +209,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
209
209
|
default:
|
|
210
210
|
return [];
|
|
211
211
|
}
|
|
212
|
-
const propertyPath = code `${this.
|
|
212
|
+
const propertyPath = code `${this.objectType.alias.unsafeCoerce()}.schema.properties.${this.name}.path`;
|
|
213
213
|
return [
|
|
214
214
|
code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfResourceValuesExpression({
|
|
215
215
|
variables: { ...variables, propertyPath },
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { codeEquals } from "../codeEquals.js";
|
|
1
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
2
3
|
export function identifierTypeDeclarations() {
|
|
3
4
|
if (!this.configuration.features.has("Object.type")) {
|
|
4
5
|
return [];
|
|
5
6
|
}
|
|
6
|
-
const ancestorObjectTypeWithSameIdentifierType = this.ancestorObjectTypes.find((ancestorObjectType) => ancestorObjectType.identifierType.
|
|
7
|
+
const ancestorObjectTypeWithSameIdentifierType = this.ancestorObjectTypes.find((ancestorObjectType) => ancestorObjectType.identifierType.kind === this.identifierType.kind &&
|
|
8
|
+
codeEquals(ancestorObjectType.identifierType.expression, this.identifierType.expression));
|
|
7
9
|
if (ancestorObjectTypeWithSameIdentifierType) {
|
|
8
10
|
// This object type's identifier type has the same identifier type as an ancestor object type,
|
|
9
11
|
// so just reuse the latter.
|
|
@@ -14,7 +16,7 @@ export function identifierTypeDeclarations() {
|
|
|
14
16
|
}
|
|
15
17
|
// Bespoke identifier type and associated functions
|
|
16
18
|
return [
|
|
17
|
-
code `export type Identifier = ${this.identifierType.
|
|
19
|
+
code `export type Identifier = ${this.identifierType.expression};`,
|
|
18
20
|
code `\
|
|
19
21
|
export namespace Identifier {
|
|
20
22
|
export const parse = ${this.identifierType.parseFunction};
|
|
@@ -1297,7 +1297,7 @@ export declare namespace Shape {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
function isShape(object: $Object): object is Shape;
|
|
1299
1299
|
const schema: {
|
|
1300
|
-
readonly kind: "
|
|
1300
|
+
readonly kind: "ObjectUnion";
|
|
1301
1301
|
readonly members: {
|
|
1302
1302
|
readonly NodeShape: {
|
|
1303
1303
|
readonly discriminantValues: readonly ["NodeShape"];
|
|
@@ -2406,7 +2406,7 @@ export declare namespace $Object {
|
|
|
2406
2406
|
const stringify: typeof NTriplesTerm.stringify;
|
|
2407
2407
|
}
|
|
2408
2408
|
const schema: {
|
|
2409
|
-
readonly kind: "
|
|
2409
|
+
readonly kind: "ObjectUnion";
|
|
2410
2410
|
readonly members: {
|
|
2411
2411
|
readonly NodeShape: {
|
|
2412
2412
|
readonly discriminantValues: readonly ["NodeShape"];
|
package/dist/input/generated.js
CHANGED
|
@@ -2995,7 +2995,7 @@ export var Shape;
|
|
|
2995
2995
|
}
|
|
2996
2996
|
Shape.isShape = isShape;
|
|
2997
2997
|
Shape.schema = {
|
|
2998
|
-
kind: "
|
|
2998
|
+
kind: "ObjectUnion",
|
|
2999
2999
|
members: {
|
|
3000
3000
|
NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
|
|
3001
3001
|
PropertyShape: {
|
|
@@ -3336,7 +3336,7 @@ export var $Object;
|
|
|
3336
3336
|
Identifier.stringify = NTriplesTerm.stringify;
|
|
3337
3337
|
})(Identifier = $Object.Identifier || ($Object.Identifier = {}));
|
|
3338
3338
|
$Object.schema = {
|
|
3339
|
-
kind: "
|
|
3339
|
+
kind: "ObjectUnion",
|
|
3340
3340
|
members: {
|
|
3341
3341
|
NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
|
|
3342
3342
|
Ontology: { discriminantValues: ["Ontology"], type: Ontology.schema },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "4.0.
|
|
3
|
+
"@shaclmate/shacl-ast": "4.0.40",
|
|
4
4
|
"@rdfjs/dataset": "~2.0.2",
|
|
5
5
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
6
6
|
"@rdfjs/term-map": "~2.0.2",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dist/generators/*.js",
|
|
42
42
|
"dist/generators/ts/*.d.ts",
|
|
43
43
|
"dist/generators/ts/*.js",
|
|
44
|
-
"dist/generators/ts/
|
|
45
|
-
"dist/generators/ts/
|
|
44
|
+
"dist/generators/ts/_ObjectType/*.d.ts",
|
|
45
|
+
"dist/generators/ts/_ObjectType/*.js",
|
|
46
46
|
"dist/generators/ts/_snippets/*.d.ts",
|
|
47
47
|
"dist/generators/ts/_snippets/*.js",
|
|
48
48
|
"dist/input/*.d.ts",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
},
|
|
69
69
|
"type": "module",
|
|
70
70
|
"types": "./dist/index.d.ts",
|
|
71
|
-
"version": "4.0.
|
|
71
|
+
"version": "4.0.40"
|
|
72
72
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Maybe } from "purify-ts";
|
|
2
|
-
import { AbstractType } from "./AbstractType.js";
|
|
3
|
-
import { AbstractUnionType } from "./AbstractUnionType.js";
|
|
4
|
-
import type { Type } from "./Type.js";
|
|
5
|
-
import { type Code } from "./ts-poet-wrapper.js";
|
|
6
|
-
export declare abstract class AbstractNamedUnionType<MemberTypeT extends Type> extends AbstractUnionType<MemberTypeT> {
|
|
7
|
-
protected readonly _name: string;
|
|
8
|
-
constructor({ name, ...superParameters }: {
|
|
9
|
-
name: string;
|
|
10
|
-
} & ConstructorParameters<typeof AbstractUnionType<MemberTypeT>>[0]);
|
|
11
|
-
get declaration(): Maybe<Code>;
|
|
12
|
-
get equalsFunction(): Code;
|
|
13
|
-
get filterFunction(): Code;
|
|
14
|
-
get filterType(): Code;
|
|
15
|
-
get hashFunction(): Code;
|
|
16
|
-
get jsonSchemaFunctionDeclaration(): Code;
|
|
17
|
-
get jsonTypeAliasDeclaration(): Code;
|
|
18
|
-
get name(): string;
|
|
19
|
-
get valueSparqlConstructTriplesFunction(): Code;
|
|
20
|
-
get valueSparqlWherePatternsFunction(): Code;
|
|
21
|
-
protected get staticModuleDeclarations(): Record<string, Code>;
|
|
22
|
-
fromJsonExpression({ variables, }: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
|
|
23
|
-
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
24
|
-
jsonSchema({ context, }: Parameters<AbstractType["jsonSchema"]>[0]): Code;
|
|
25
|
-
jsonType(): AbstractType.JsonType;
|
|
26
|
-
toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
|
|
27
|
-
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
28
|
-
toStringExpression({ variables, }: Parameters<AbstractType["toStringExpression"]>[0]): Code;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=AbstractNamedUnionType.d.ts.map
|