@shaclmate/compiler 4.0.93 → 4.0.94
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.
|
@@ -1,22 +1,57 @@
|
|
|
1
|
-
import { code, literalOf } from "../ts-poet-wrapper.js";
|
|
1
|
+
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
2
|
export function AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression() {
|
|
3
|
+
// Two passes:
|
|
4
|
+
// 1. Apportion input values to different union members. For each value, let each member try to map the value until one succeeds (Right). If none succeed, return Left.
|
|
5
|
+
// 2. Pass all of a member's successfully-mapped input values back into the member's mapper so it can potentially reorder them (by e.g., preferred language)
|
|
3
6
|
return code `\
|
|
4
|
-
(((
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
(((inputValues, options) => {
|
|
8
|
+
const memberInputValues: ${this.reusables.imports.Resource}.Values[] = Array.from({ length: ${this.members.length} }).map(() => ${this.reusables.imports.Resource}.Values.empty({
|
|
9
|
+
focusResource: inputValues.focusResource,
|
|
10
|
+
propertyPath: inputValues.propertyPath
|
|
11
|
+
}));
|
|
12
|
+
for (const inputValue of inputValues) {
|
|
13
|
+
const inputValueAsValues = inputValue.toValues();
|
|
14
|
+
let memberOutputValuesEither: ${this.reusables.imports.Either}<Error, unknown> | undefined;
|
|
15
|
+
for (let memberI = 0; memberI < ${this.members.length}; memberI++) {
|
|
16
|
+
${joinCode(this.members.map((member, memberI) => code `\
|
|
17
|
+
if (memberI === ${memberI}) {
|
|
18
|
+
memberOutputValuesEither = ${member.type.fromRdfResourceValuesFunction}(inputValueAsValues, { ...options, ignoreRdfType: false, schema: options.schema.members[${literalOf(member.primaryDiscriminantValue)}].type })
|
|
19
|
+
if (memberOutputValuesEither.isRight()) {
|
|
20
|
+
memberInputValues[memberI] = memberInputValues[memberI].concat(inputValue);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}`), { on: " else " })}
|
|
24
|
+
}
|
|
25
|
+
if (memberOutputValuesEither!.isLeft()) {
|
|
26
|
+
return memberOutputValuesEither;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let collectedOutputValues: ${this.reusables.imports.Resource}.Values<${this.expression}> = ${this.reusables.imports.Resource}.Values.empty({
|
|
31
|
+
focusResource: inputValues.focusResource,
|
|
32
|
+
propertyPath: inputValues.propertyPath
|
|
33
|
+
});
|
|
34
|
+
for (let memberI = 0; memberI < ${this.members.length}; memberI++) {
|
|
35
|
+
if (memberInputValues[memberI].length === 0) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
switch (memberI) {
|
|
39
|
+
${joinCode(this.members.map((member, memberI) => {
|
|
40
|
+
let memberFromRdfResourceValuesExpression = code `${member.type.fromRdfResourceValuesFunction}(memberInputValues[memberI], { ...options, ignoreRdfType: false, schema: options.schema.members[${literalOf(member.primaryDiscriminantValue)}].type })`;
|
|
9
41
|
if (this.discriminant.kind === "Extrinsic" ||
|
|
10
42
|
(this.discriminant.kind === "Hybrid" &&
|
|
11
43
|
this.discriminant.memberValues[memberI].kind === "Extrinsic")) {
|
|
12
|
-
|
|
44
|
+
memberFromRdfResourceValuesExpression = code `${memberFromRdfResourceValuesExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: ${literalOf(member.primaryDiscriminantValue)} as const, value }) as (${this.expression})))`;
|
|
13
45
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
return code `\
|
|
47
|
+
case ${memberI}:
|
|
48
|
+
collectedOutputValues = collectedOutputValues.concat(...(${memberFromRdfResourceValuesExpression}).unsafeCoerce());
|
|
49
|
+
break;
|
|
50
|
+
`;
|
|
51
|
+
}), { on: "\n" })}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return ${this.reusables.imports.Right}(collectedOutputValues);
|
|
55
|
+
}) satisfies ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>)`;
|
|
21
56
|
}
|
|
22
57
|
//# sourceMappingURL=AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.js.map
|
|
@@ -26,7 +26,7 @@ export type $FromRdfResourceValuesFunction<ValueT, ValueSchemaT> = (resourceValu
|
|
|
26
26
|
/**
|
|
27
27
|
* NamespaceBuilder type excerpted from @rdfjs/namespace (MIT license) in lieu of a type import.
|
|
28
28
|
*/
|
|
29
|
-
type $NamespaceBuilder<TermNames extends string = any> = Record<TermNames, NamedNode> & ((property?: TemplateStringsArray | TermNames) => NamedNode);
|
|
29
|
+
export type $NamespaceBuilder<TermNames extends string = any> = Record<TermNames, NamedNode> & ((property?: TemplateStringsArray | TermNames) => NamedNode);
|
|
30
30
|
export type $PropertyPath = RdfxResourcePropertyPath;
|
|
31
31
|
export declare namespace $PropertyPath {
|
|
32
32
|
const fromRdfResource: $FromRdfResourceFunction<$PropertyPath>;
|
|
@@ -115,11 +115,11 @@ export declare namespace NodeShape {
|
|
|
115
115
|
readonly languageIn?: readonly string[] | Maybe<readonly string[]>;
|
|
116
116
|
readonly maxExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
117
117
|
readonly maxInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
118
|
-
readonly maxLength?: bigint | Maybe<bigint>;
|
|
118
|
+
readonly maxLength?: bigint | number | string | Maybe<bigint>;
|
|
119
119
|
readonly message?: string | Maybe<string>;
|
|
120
120
|
readonly minExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
121
121
|
readonly minInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
122
|
-
readonly minLength?: bigint | Maybe<bigint>;
|
|
122
|
+
readonly minLength?: bigint | number | string | Maybe<bigint>;
|
|
123
123
|
readonly mutable?: boolean | Maybe<boolean>;
|
|
124
124
|
readonly node?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
125
125
|
readonly nodeKind?: ("http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal") | NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal"> | Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
|
|
@@ -162,11 +162,11 @@ export declare namespace NodeShape {
|
|
|
162
162
|
readonly languageIn?: readonly string[] | Maybe<readonly string[]>;
|
|
163
163
|
readonly maxExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
164
164
|
readonly maxInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
165
|
-
readonly maxLength?: bigint | Maybe<bigint>;
|
|
165
|
+
readonly maxLength?: bigint | number | string | Maybe<bigint>;
|
|
166
166
|
readonly message?: string | Maybe<string>;
|
|
167
167
|
readonly minExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
168
168
|
readonly minInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
169
|
-
readonly minLength?: bigint | Maybe<bigint>;
|
|
169
|
+
readonly minLength?: bigint | number | string | Maybe<bigint>;
|
|
170
170
|
readonly mutable?: boolean | Maybe<boolean>;
|
|
171
171
|
readonly node?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
172
172
|
readonly nodeKind?: ("http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal") | NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal"> | Maybe<NamedNode<"http://www.w3.org/ns/shacl#BlankNode" | "http://www.w3.org/ns/shacl#BlankNodeOrIRI" | "http://www.w3.org/ns/shacl#BlankNodeOrLiteral" | "http://www.w3.org/ns/shacl#IRI" | "http://www.w3.org/ns/shacl#IRIOrLiteral" | "http://www.w3.org/ns/shacl#Literal">>;
|
|
@@ -901,15 +901,15 @@ export declare namespace PropertyShape {
|
|
|
901
901
|
readonly languageIn?: readonly string[] | Maybe<readonly string[]>;
|
|
902
902
|
readonly lessThan?: (keyof $DefaultNamespaceT & string) | NamedNode | readonly ((keyof $DefaultNamespaceT & string) | NamedNode)[];
|
|
903
903
|
readonly lessThanOrEquals?: (keyof $DefaultNamespaceT & string) | NamedNode | readonly ((keyof $DefaultNamespaceT & string) | NamedNode)[];
|
|
904
|
-
readonly maxCount?: bigint | Maybe<bigint>;
|
|
904
|
+
readonly maxCount?: bigint | number | string | Maybe<bigint>;
|
|
905
905
|
readonly maxExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
906
906
|
readonly maxInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
907
|
-
readonly maxLength?: bigint | Maybe<bigint>;
|
|
907
|
+
readonly maxLength?: bigint | number | string | Maybe<bigint>;
|
|
908
908
|
readonly message?: string | Maybe<string>;
|
|
909
|
-
readonly minCount?: bigint | Maybe<bigint>;
|
|
909
|
+
readonly minCount?: bigint | number | string | Maybe<bigint>;
|
|
910
910
|
readonly minExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
911
911
|
readonly minInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
912
|
-
readonly minLength?: bigint | Maybe<bigint>;
|
|
912
|
+
readonly minLength?: bigint | number | string | Maybe<bigint>;
|
|
913
913
|
readonly mutable?: boolean | Maybe<boolean>;
|
|
914
914
|
readonly name?: string | Maybe<string>;
|
|
915
915
|
readonly node?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
@@ -919,8 +919,8 @@ export declare namespace PropertyShape {
|
|
|
919
919
|
readonly order?: number | Maybe<number>;
|
|
920
920
|
readonly path: $PropertyPath;
|
|
921
921
|
readonly pattern?: string | Maybe<string>;
|
|
922
|
-
readonly qualifiedMaxCount?: bigint | Maybe<bigint>;
|
|
923
|
-
readonly qualifiedMinCount?: bigint | Maybe<bigint>;
|
|
922
|
+
readonly qualifiedMaxCount?: bigint | number | string | Maybe<bigint>;
|
|
923
|
+
readonly qualifiedMinCount?: bigint | number | string | Maybe<bigint>;
|
|
924
924
|
readonly qualifiedValueShape?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
925
925
|
readonly qualifiedValueShapesDisjoint?: boolean | Maybe<boolean>;
|
|
926
926
|
readonly resolve?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
@@ -956,15 +956,15 @@ export declare namespace PropertyShape {
|
|
|
956
956
|
readonly languageIn?: readonly string[] | Maybe<readonly string[]>;
|
|
957
957
|
readonly lessThan?: (keyof $DefaultNamespaceT & string) | NamedNode | readonly ((keyof $DefaultNamespaceT & string) | NamedNode)[];
|
|
958
958
|
readonly lessThanOrEquals?: (keyof $DefaultNamespaceT & string) | NamedNode | readonly ((keyof $DefaultNamespaceT & string) | NamedNode)[];
|
|
959
|
-
readonly maxCount?: bigint | Maybe<bigint>;
|
|
959
|
+
readonly maxCount?: bigint | number | string | Maybe<bigint>;
|
|
960
960
|
readonly maxExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
961
961
|
readonly maxInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
962
|
-
readonly maxLength?: bigint | Maybe<bigint>;
|
|
962
|
+
readonly maxLength?: bigint | number | string | Maybe<bigint>;
|
|
963
963
|
readonly message?: string | Maybe<string>;
|
|
964
|
-
readonly minCount?: bigint | Maybe<bigint>;
|
|
964
|
+
readonly minCount?: bigint | number | string | Maybe<bigint>;
|
|
965
965
|
readonly minExclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
966
966
|
readonly minInclusive?: bigint | boolean | number | string | Date | Literal | Maybe<Literal>;
|
|
967
|
-
readonly minLength?: bigint | Maybe<bigint>;
|
|
967
|
+
readonly minLength?: bigint | number | string | Maybe<bigint>;
|
|
968
968
|
readonly mutable?: boolean | Maybe<boolean>;
|
|
969
969
|
readonly name?: string | Maybe<string>;
|
|
970
970
|
readonly node?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
@@ -974,8 +974,8 @@ export declare namespace PropertyShape {
|
|
|
974
974
|
readonly order?: number | Maybe<number>;
|
|
975
975
|
readonly path: $PropertyPath;
|
|
976
976
|
readonly pattern?: string | Maybe<string>;
|
|
977
|
-
readonly qualifiedMaxCount?: bigint | Maybe<bigint>;
|
|
978
|
-
readonly qualifiedMinCount?: bigint | Maybe<bigint>;
|
|
977
|
+
readonly qualifiedMaxCount?: bigint | number | string | Maybe<bigint>;
|
|
978
|
+
readonly qualifiedMinCount?: bigint | number | string | Maybe<bigint>;
|
|
979
979
|
readonly qualifiedValueShape?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
980
980
|
readonly qualifiedValueShapesDisjoint?: boolean | Maybe<boolean>;
|
|
981
981
|
readonly resolve?: BlankNode | NamedNode | (keyof $DefaultNamespaceT & string) | Maybe<BlankNode | NamedNode>;
|
|
@@ -24,6 +24,7 @@ function $compactRecord(record) {
|
|
|
24
24
|
return definedProperties;
|
|
25
25
|
}, {});
|
|
26
26
|
}
|
|
27
|
+
const $convertToBigInt = (value) => Either.encase(() => BigInt(value));
|
|
27
28
|
function $convertToIdentifier(value, defaultNamespace) {
|
|
28
29
|
switch (typeof value) {
|
|
29
30
|
case "object":
|
|
@@ -734,11 +735,11 @@ export var NodeShape;
|
|
|
734
735
|
languageIn: $convertToMaybe($convertToList($identityConversionFunction))(parameters?.languageIn, parameters?.$defaultNamespace).chain((value) => $validateMaybe($validateArray($identityValidationFunction))(NodeShape.schema.properties.languageIn.type, value)),
|
|
735
736
|
maxExclusive: $convertToMaybe($convertToLiteral)(parameters?.maxExclusive, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxExclusive.type, value)),
|
|
736
737
|
maxInclusive: $convertToMaybe($convertToLiteral)(parameters?.maxInclusive, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxInclusive.type, value)),
|
|
737
|
-
maxLength: $convertToMaybe($
|
|
738
|
+
maxLength: $convertToMaybe($convertToBigInt)(parameters?.maxLength, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxLength.type, value)),
|
|
738
739
|
message: $convertToMaybe($identityConversionFunction)(parameters?.message, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.message.type, value)),
|
|
739
740
|
minExclusive: $convertToMaybe($convertToLiteral)(parameters?.minExclusive, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minExclusive.type, value)),
|
|
740
741
|
minInclusive: $convertToMaybe($convertToLiteral)(parameters?.minInclusive, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minInclusive.type, value)),
|
|
741
|
-
minLength: $convertToMaybe($
|
|
742
|
+
minLength: $convertToMaybe($convertToBigInt)(parameters?.minLength, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minLength.type, value)),
|
|
742
743
|
mutable: $convertToMaybe($identityConversionFunction)(parameters?.mutable, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.mutable.type, value)),
|
|
743
744
|
node: $convertToMaybe($convertToIdentifier)(parameters?.node, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.node.type, value)),
|
|
744
745
|
nodeKind: $convertToMaybe(($convertToInIri))(parameters?.nodeKind, parameters?.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.nodeKind.type, value)),
|
|
@@ -1712,15 +1713,15 @@ export var PropertyShape;
|
|
|
1712
1713
|
languageIn: $convertToMaybe($convertToList($identityConversionFunction))(parameters.languageIn, parameters.$defaultNamespace).chain((value) => $validateMaybe($validateArray($identityValidationFunction))(NodeShape.schema.properties.languageIn.type, value)),
|
|
1713
1714
|
lessThan: $convertToScalarSet($convertToIri)(parameters.lessThan, parameters.$defaultNamespace).chain((value) => $validateArray($identityValidationFunction)(PropertyShape.schema.properties.lessThan.type, value)),
|
|
1714
1715
|
lessThanOrEquals: $convertToScalarSet($convertToIri)(parameters.lessThanOrEquals, parameters.$defaultNamespace).chain((value) => $validateArray($identityValidationFunction)(PropertyShape.schema.properties.lessThanOrEquals.type, value)),
|
|
1715
|
-
maxCount: $convertToMaybe($
|
|
1716
|
+
maxCount: $convertToMaybe($convertToBigInt)(parameters.maxCount, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type, value)),
|
|
1716
1717
|
maxExclusive: $convertToMaybe($convertToLiteral)(parameters.maxExclusive, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxExclusive.type, value)),
|
|
1717
1718
|
maxInclusive: $convertToMaybe($convertToLiteral)(parameters.maxInclusive, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxInclusive.type, value)),
|
|
1718
|
-
maxLength: $convertToMaybe($
|
|
1719
|
+
maxLength: $convertToMaybe($convertToBigInt)(parameters.maxLength, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.maxLength.type, value)),
|
|
1719
1720
|
message: $convertToMaybe($identityConversionFunction)(parameters.message, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.message.type, value)),
|
|
1720
|
-
minCount: $convertToMaybe($
|
|
1721
|
+
minCount: $convertToMaybe($convertToBigInt)(parameters.minCount, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type, value)),
|
|
1721
1722
|
minExclusive: $convertToMaybe($convertToLiteral)(parameters.minExclusive, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minExclusive.type, value)),
|
|
1722
1723
|
minInclusive: $convertToMaybe($convertToLiteral)(parameters.minInclusive, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minInclusive.type, value)),
|
|
1723
|
-
minLength: $convertToMaybe($
|
|
1724
|
+
minLength: $convertToMaybe($convertToBigInt)(parameters.minLength, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.minLength.type, value)),
|
|
1724
1725
|
mutable: $convertToMaybe($identityConversionFunction)(parameters.mutable, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.mutable.type, value)),
|
|
1725
1726
|
name: $convertToMaybe($identityConversionFunction)(parameters.name, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.name.type, value)),
|
|
1726
1727
|
node: $convertToMaybe($convertToIdentifier)(parameters.node, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.node.type, value)),
|
|
@@ -1730,8 +1731,8 @@ export var PropertyShape;
|
|
|
1730
1731
|
order: $convertToMaybe($identityConversionFunction)(parameters.order, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.order.type, value)),
|
|
1731
1732
|
path: Either.of(parameters.path),
|
|
1732
1733
|
pattern: $convertToMaybe($identityConversionFunction)(parameters.pattern, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.pattern.type, value)),
|
|
1733
|
-
qualifiedMaxCount: $convertToMaybe($
|
|
1734
|
-
qualifiedMinCount: $convertToMaybe($
|
|
1734
|
+
qualifiedMaxCount: $convertToMaybe($convertToBigInt)(parameters.qualifiedMaxCount, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedMaxCount.type, value)),
|
|
1735
|
+
qualifiedMinCount: $convertToMaybe($convertToBigInt)(parameters.qualifiedMinCount, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedMinCount.type, value)),
|
|
1735
1736
|
qualifiedValueShape: $convertToMaybe($convertToIdentifier)(parameters.qualifiedValueShape, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedValueShape.type, value)),
|
|
1736
1737
|
qualifiedValueShapesDisjoint: $convertToMaybe($identityConversionFunction)(parameters.qualifiedValueShapesDisjoint, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.qualifiedValueShapesDisjoint.type, value)),
|
|
1737
1738
|
resolve: $convertToMaybe($convertToIdentifier)(parameters.resolve, parameters.$defaultNamespace).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.resolve.type, value)),
|
|
@@ -2521,20 +2522,71 @@ export var Shape;
|
|
|
2521
2522
|
...options,
|
|
2522
2523
|
ignoreRdfType: false,
|
|
2523
2524
|
}));
|
|
2524
|
-
Shape.fromRdfResourceValues = ((
|
|
2525
|
-
const
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2525
|
+
Shape.fromRdfResourceValues = ((inputValues, options) => {
|
|
2526
|
+
const memberInputValues = Array.from({ length: 2 }).map(() => Resource.Values.empty({
|
|
2527
|
+
focusResource: inputValues.focusResource,
|
|
2528
|
+
propertyPath: inputValues.propertyPath,
|
|
2529
|
+
}));
|
|
2530
|
+
for (const inputValue of inputValues) {
|
|
2531
|
+
const inputValueAsValues = inputValue.toValues();
|
|
2532
|
+
let memberOutputValuesEither;
|
|
2533
|
+
for (let memberI = 0; memberI < 2; memberI++) {
|
|
2534
|
+
if (memberI === 0) {
|
|
2535
|
+
memberOutputValuesEither = NodeShape.fromRdfResourceValues(inputValueAsValues, {
|
|
2536
|
+
...options,
|
|
2537
|
+
ignoreRdfType: false,
|
|
2538
|
+
schema: options.schema.members["NodeShape"].type,
|
|
2539
|
+
});
|
|
2540
|
+
if (memberOutputValuesEither.isRight()) {
|
|
2541
|
+
memberInputValues[memberI] =
|
|
2542
|
+
memberInputValues[memberI].concat(inputValue);
|
|
2543
|
+
break;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
else if (memberI === 1) {
|
|
2547
|
+
memberOutputValuesEither = PropertyShape.fromRdfResourceValues(inputValueAsValues, {
|
|
2548
|
+
...options,
|
|
2549
|
+
ignoreRdfType: false,
|
|
2550
|
+
schema: options.schema.members["PropertyShape"].type,
|
|
2551
|
+
});
|
|
2552
|
+
if (memberOutputValuesEither.isRight()) {
|
|
2553
|
+
memberInputValues[memberI] =
|
|
2554
|
+
memberInputValues[memberI].concat(inputValue);
|
|
2555
|
+
break;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
if (memberOutputValuesEither.isLeft()) {
|
|
2560
|
+
return memberOutputValuesEither;
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
let collectedOutputValues = Resource.Values.empty({
|
|
2564
|
+
focusResource: inputValues.focusResource,
|
|
2565
|
+
propertyPath: inputValues.propertyPath,
|
|
2566
|
+
});
|
|
2567
|
+
for (let memberI = 0; memberI < 2; memberI++) {
|
|
2568
|
+
if (memberInputValues[memberI].length === 0) {
|
|
2569
|
+
continue;
|
|
2570
|
+
}
|
|
2571
|
+
switch (memberI) {
|
|
2572
|
+
case 0:
|
|
2573
|
+
collectedOutputValues = collectedOutputValues.concat(...NodeShape.fromRdfResourceValues(memberInputValues[memberI], {
|
|
2574
|
+
...options,
|
|
2575
|
+
ignoreRdfType: false,
|
|
2576
|
+
schema: options.schema.members["NodeShape"].type,
|
|
2577
|
+
}).unsafeCoerce());
|
|
2578
|
+
break;
|
|
2579
|
+
case 1:
|
|
2580
|
+
collectedOutputValues = collectedOutputValues.concat(...PropertyShape.fromRdfResourceValues(memberInputValues[memberI], {
|
|
2581
|
+
...options,
|
|
2582
|
+
ignoreRdfType: false,
|
|
2583
|
+
schema: options.schema.members["PropertyShape"].type,
|
|
2584
|
+
}).unsafeCoerce());
|
|
2585
|
+
break;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
return Right(collectedOutputValues);
|
|
2589
|
+
});
|
|
2538
2590
|
let Identifier;
|
|
2539
2591
|
(function (Identifier) {
|
|
2540
2592
|
Identifier.parse = $parseIdentifier;
|
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.94",
|
|
4
4
|
"@rdfjs/types": "~2.0.1",
|
|
5
5
|
"@rdfx/collection": "0.0.57",
|
|
6
6
|
"@rdfx/data-factory": "0.0.57",
|
|
@@ -739,5 +739,5 @@
|
|
|
739
739
|
},
|
|
740
740
|
"type": "module",
|
|
741
741
|
"types": "./dist/index.d.ts",
|
|
742
|
-
"version": "4.0.
|
|
742
|
+
"version": "4.0.94"
|
|
743
743
|
}
|