@shaclmate/compiler 4.0.10 → 4.0.11
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.
|
@@ -137,7 +137,10 @@ export function transformPropertyShapeToAstObjectTypeProperty({ objectType, prop
|
|
|
137
137
|
case "ObjectType":
|
|
138
138
|
return Either.of(astResolveType);
|
|
139
139
|
case "UnionType":
|
|
140
|
-
if (
|
|
140
|
+
if (
|
|
141
|
+
// This check relies on .members being populated, which may not happen in cycles
|
|
142
|
+
astResolveType.members.length > 0 &&
|
|
143
|
+
!astResolveType.isObjectUnionType()) {
|
|
141
144
|
return Left(new Error(`${propertyShape} resolve cannot refer to a ${astResolveType.kind} with non-ObjectType members`));
|
|
142
145
|
}
|
|
143
146
|
return Either.of(astResolveType);
|
|
@@ -4,7 +4,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { invariant } from "ts-invariant";
|
|
8
7
|
import { Memoize } from "typescript-memoize";
|
|
9
8
|
import { AbstractType } from "./AbstractType.js";
|
|
10
9
|
/**
|
|
@@ -29,7 +28,6 @@ export class AbstractCompoundType extends AbstractType {
|
|
|
29
28
|
this.#tsFeatures = tsFeatures;
|
|
30
29
|
}
|
|
31
30
|
get members() {
|
|
32
|
-
invariant(this.#members.length > 0);
|
|
33
31
|
return this.#members;
|
|
34
32
|
}
|
|
35
33
|
get recursive() {
|
|
@@ -5,9 +5,10 @@ import { AbstractCompoundType } from "./AbstractCompoundType.js";
|
|
|
5
5
|
export class IntersectionType extends AbstractCompoundType {
|
|
6
6
|
kind = "IntersectionType";
|
|
7
7
|
isObjectIntersectionType() {
|
|
8
|
-
return this.members.
|
|
9
|
-
(member.type.kind === "
|
|
10
|
-
member.type.
|
|
8
|
+
return (this.members.length > 0 &&
|
|
9
|
+
this.members.every((member) => member.type.kind === "ObjectType" ||
|
|
10
|
+
(member.type.kind === "IntersectionType" &&
|
|
11
|
+
member.type.isObjectIntersectionType())));
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
(function (IntersectionType) {
|
package/dist/ast/UnionType.js
CHANGED
|
@@ -5,8 +5,9 @@ import { AbstractCompoundType } from "./AbstractCompoundType.js";
|
|
|
5
5
|
export class UnionType extends AbstractCompoundType {
|
|
6
6
|
kind = "UnionType";
|
|
7
7
|
isObjectUnionType() {
|
|
8
|
-
return this.members.
|
|
9
|
-
(member.type.kind === "
|
|
8
|
+
return (this.members.length > 0 &&
|
|
9
|
+
this.members.every((member) => member.type.kind === "ObjectType" ||
|
|
10
|
+
(member.type.kind === "UnionType" && member.type.isObjectUnionType())));
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
(function (UnionType) {
|
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.11",
|
|
4
4
|
"@rdfjs/data-model": "~2.1.1",
|
|
5
5
|
"@rdfjs/dataset": "~2.0.2",
|
|
6
6
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
},
|
|
79
79
|
"type": "module",
|
|
80
80
|
"types": "./dist/index.d.ts",
|
|
81
|
-
"version": "4.0.
|
|
81
|
+
"version": "4.0.11"
|
|
82
82
|
}
|