@likec4/core 0.32.0 → 0.33.0
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/colors.d.ts +76 -9
- package/dist/colors.js +116 -93
- package/dist/colors.mjs +112 -0
- package/dist/compute-view/EdgeBuilder.d.ts +0 -1
- package/dist/compute-view/EdgeBuilder.js +37 -34
- package/dist/compute-view/EdgeBuilder.mjs +31 -0
- package/dist/compute-view/compute-ctx.d.ts +0 -1
- package/dist/compute-view/compute-ctx.js +33 -24
- package/dist/compute-view/compute-ctx.mjs +42 -0
- package/dist/compute-view/compute-element-view.d.ts +2 -3
- package/dist/compute-view/compute-element-view.js +137 -525
- package/dist/compute-view/compute-element-view.mjs +145 -0
- package/dist/compute-view/compute-predicates.d.ts +16 -0
- package/dist/compute-view/compute-predicates.js +358 -0
- package/dist/compute-view/compute-predicates.mjs +324 -0
- package/dist/compute-view/compute.d.ts +8 -9
- package/dist/compute-view/compute.js +49 -39
- package/dist/compute-view/compute.mjs +39 -0
- package/dist/compute-view/index.d.ts +1 -1
- package/dist/compute-view/index.js +24 -2
- package/dist/compute-view/index.mjs +1 -0
- package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -1
- package/dist/compute-view/utils/anyPossibleRelations.js +17 -12
- package/dist/compute-view/utils/anyPossibleRelations.mjs +12 -0
- package/dist/compute-view/utils/applyViewRuleStyles.d.ts +3 -0
- package/dist/compute-view/utils/applyViewRuleStyles.js +59 -0
- package/dist/compute-view/utils/applyViewRuleStyles.mjs +50 -0
- package/dist/compute-view/utils/sortNodes.d.ts +0 -1
- package/dist/compute-view/utils/sortNodes.js +47 -42
- package/dist/compute-view/utils/sortNodes.mjs +40 -0
- package/dist/errors/_base.d.ts +0 -1
- package/dist/errors/_base.js +14 -11
- package/dist/errors/_base.mjs +4 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +60 -5
- package/dist/errors/index.mjs +5 -0
- package/dist/errors/invariant.d.ts +0 -2
- package/dist/errors/invariant.js +16 -21
- package/dist/errors/invariant.mjs +8 -0
- package/dist/errors/model-index.d.ts +0 -1
- package/dist/errors/model-index.js +16 -14
- package/dist/errors/model-index.mjs +8 -0
- package/dist/errors/non-nullable.d.ts +2 -0
- package/dist/errors/non-nullable.js +16 -0
- package/dist/errors/non-nullable.mjs +8 -0
- package/dist/errors/nonexhaustive.d.ts +0 -1
- package/dist/errors/nonexhaustive.js +13 -6
- package/dist/errors/nonexhaustive.mjs +5 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +71 -7
- package/dist/index.mjs +6 -0
- package/dist/model-index/ModelIndex.d.ts +0 -1
- package/dist/model-index/ModelIndex.js +125 -122
- package/dist/model-index/ModelIndex.mjs +128 -0
- package/dist/model-index/index.d.ts +0 -1
- package/dist/model-index/index.js +13 -2
- package/dist/model-index/index.mjs +1 -0
- package/dist/types/_common.d.ts +0 -1
- package/dist/types/_common.js +1 -2
- package/dist/types/_common.mjs +0 -0
- package/dist/types/computed-view.d.ts +7 -6
- package/dist/types/computed-view.js +1 -2
- package/dist/types/computed-view.mjs +0 -0
- package/dist/types/diagram.d.ts +5 -2
- package/dist/types/diagram.js +1 -2
- package/dist/types/diagram.mjs +0 -0
- package/dist/types/element.d.ts +3 -7
- package/dist/types/element.js +13 -5
- package/dist/types/element.mjs +5 -0
- package/dist/types/expression.d.ts +0 -1
- package/dist/types/expression.js +45 -31
- package/dist/types/expression.mjs +30 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +48 -4
- package/dist/types/index.mjs +3 -0
- package/dist/types/model.d.ts +0 -1
- package/dist/types/model.js +1 -2
- package/dist/types/model.mjs +0 -0
- package/dist/types/opaque.d.ts +0 -1
- package/dist/types/opaque.js +1 -2
- package/dist/types/opaque.mjs +0 -0
- package/dist/types/relation.d.ts +0 -1
- package/dist/types/relation.js +1 -2
- package/dist/types/relation.mjs +0 -0
- package/dist/types/theme.d.ts +22 -0
- package/dist/types/theme.js +1 -0
- package/dist/types/theme.mjs +0 -0
- package/dist/types/view.d.ts +2 -2
- package/dist/types/view.js +15 -8
- package/dist/types/view.mjs +9 -0
- package/dist/utils/compute-node-levels.d.ts +0 -1
- package/dist/utils/compute-node-levels.js +45 -29
- package/dist/utils/compute-node-levels.mjs +31 -0
- package/dist/utils/fqn.d.ts +0 -1
- package/dist/utils/fqn.js +71 -71
- package/dist/utils/fqn.mjs +66 -0
- package/dist/utils/guards.d.ts +0 -1
- package/dist/utils/guards.js +19 -12
- package/dist/utils/guards.mjs +13 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +49 -5
- package/dist/utils/index.mjs +4 -0
- package/dist/utils/relations.d.ts +0 -1
- package/dist/utils/relations.js +56 -49
- package/dist/utils/relations.mjs +42 -0
- package/package.json +20 -55
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { anyPass, filter, clone, isNil } from "rambdax";
|
|
2
|
+
import { isDefined } from "remeda";
|
|
3
|
+
import * as Expr from "../../types/expression.mjs";
|
|
4
|
+
import { nonexhaustive } from "../../errors/index.mjs";
|
|
5
|
+
export function applyViewRuleStyles(rules, _nodes) {
|
|
6
|
+
if (rules.length === 0) {
|
|
7
|
+
return _nodes;
|
|
8
|
+
}
|
|
9
|
+
const nodes = clone(_nodes);
|
|
10
|
+
for (const rule of rules) {
|
|
11
|
+
const predicates = [];
|
|
12
|
+
if (!rule.style.color && !rule.style.shape) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
for (const target of rule.targets) {
|
|
16
|
+
if (Expr.isWildcard(target)) {
|
|
17
|
+
predicates.push(() => true);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
if (Expr.isElementKindExpr(target)) {
|
|
21
|
+
predicates.push(
|
|
22
|
+
target.isEqual ? (n) => n.kind === target.elementKind : (n) => n.kind !== target.elementKind
|
|
23
|
+
);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (Expr.isElementTagExpr(target)) {
|
|
27
|
+
predicates.push(
|
|
28
|
+
target.isEqual ? ({ tags }) => !!tags && tags.includes(target.elementTag) : ({ tags }) => isNil(tags) || !tags.includes(target.elementTag)
|
|
29
|
+
);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (Expr.isElementRef(target)) {
|
|
33
|
+
const { element, isDescedants } = target;
|
|
34
|
+
predicates.push(
|
|
35
|
+
isDescedants ? (n) => n.id.startsWith(element + ".") : (n) => n.id === element
|
|
36
|
+
);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
nonexhaustive(target);
|
|
40
|
+
}
|
|
41
|
+
filter(anyPass(predicates), nodes).forEach((n) => {
|
|
42
|
+
n.shape = rule.style.shape ?? n.shape;
|
|
43
|
+
n.color = rule.style.color ?? n.color;
|
|
44
|
+
if (isDefined.strict(rule.style.icon)) {
|
|
45
|
+
n.icon = rule.style.icon;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return nodes;
|
|
50
|
+
}
|
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sortNodes = sortNodes;
|
|
7
|
+
var _utils = require("../../utils");
|
|
8
|
+
var _graphlib = _interopRequireDefault(require("@dagrejs/graphlib"));
|
|
9
|
+
var _errors = require("../../errors");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const {
|
|
12
|
+
Graph,
|
|
13
|
+
alg
|
|
14
|
+
} = _graphlib.default;
|
|
15
|
+
function sortNodes(_nodes, edges) {
|
|
16
|
+
const g = new Graph({
|
|
17
|
+
compound: true,
|
|
18
|
+
directed: true,
|
|
19
|
+
multigraph: false
|
|
20
|
+
});
|
|
21
|
+
for (const nd of _nodes.values()) {
|
|
22
|
+
g.setNode(nd.id);
|
|
23
|
+
if (nd.parent) {
|
|
24
|
+
g.setEdge(nd.parent, nd.id);
|
|
17
25
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// console.log(`remove ${source.id} -> ${target.id}`)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (target.parent && target.parent !== edge.parent) {
|
|
31
|
-
target = _nodes.get(target.parent);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
target = undefined;
|
|
35
|
-
}
|
|
26
|
+
}
|
|
27
|
+
for (const edge of edges) {
|
|
28
|
+
const source = _nodes.get(edge.source);
|
|
29
|
+
let target = _nodes.get(edge.target);
|
|
30
|
+
while (source && target) {
|
|
31
|
+
if (!(0, _utils.isSameHierarchy)(source, target) && !g.hasEdge(source.id, target.id)) {
|
|
32
|
+
g.setEdge(source.id, target.id);
|
|
33
|
+
if (!alg.isAcyclic(g)) {
|
|
34
|
+
g.removeEdge(source.id, target.id);
|
|
36
35
|
}
|
|
36
|
+
}
|
|
37
|
+
if (target.parent && target.parent !== edge.parent) {
|
|
38
|
+
target = _nodes.get(target.parent);
|
|
39
|
+
} else {
|
|
40
|
+
target = void 0;
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}
|
|
44
|
+
const sorted = alg.topsort(g);
|
|
45
|
+
const nodes = sorted.map(id => (0, _errors.nonNullable)(_nodes.get(id)));
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
node.children = nodes.flatMap(n => n.parent === node.id ? n.id : []);
|
|
48
|
+
}
|
|
49
|
+
return nodes;
|
|
50
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isSameHierarchy } from "../../utils/index.mjs";
|
|
2
|
+
import pkg from "@dagrejs/graphlib";
|
|
3
|
+
import { nonNullable } from "../../errors/index.mjs";
|
|
4
|
+
const { Graph, alg } = pkg;
|
|
5
|
+
export function sortNodes(_nodes, edges) {
|
|
6
|
+
const g = new Graph({
|
|
7
|
+
compound: true,
|
|
8
|
+
directed: true,
|
|
9
|
+
multigraph: false
|
|
10
|
+
});
|
|
11
|
+
for (const nd of _nodes.values()) {
|
|
12
|
+
g.setNode(nd.id);
|
|
13
|
+
if (nd.parent) {
|
|
14
|
+
g.setEdge(nd.parent, nd.id);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (const edge of edges) {
|
|
18
|
+
const source = _nodes.get(edge.source);
|
|
19
|
+
let target = _nodes.get(edge.target);
|
|
20
|
+
while (source && target) {
|
|
21
|
+
if (!isSameHierarchy(source, target) && !g.hasEdge(source.id, target.id)) {
|
|
22
|
+
g.setEdge(source.id, target.id);
|
|
23
|
+
if (!alg.isAcyclic(g)) {
|
|
24
|
+
g.removeEdge(source.id, target.id);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (target.parent && target.parent !== edge.parent) {
|
|
28
|
+
target = _nodes.get(target.parent);
|
|
29
|
+
} else {
|
|
30
|
+
target = void 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const sorted = alg.topsort(g);
|
|
35
|
+
const nodes = sorted.map((id) => nonNullable(_nodes.get(id)));
|
|
36
|
+
for (const node of nodes) {
|
|
37
|
+
node.children = nodes.flatMap((n) => n.parent === node.id ? n.id : []);
|
|
38
|
+
}
|
|
39
|
+
return nodes;
|
|
40
|
+
}
|
package/dist/errors/_base.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export declare const BaseError: import("modern-errors").ErrorSubclassCore<[], {}
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const UnknownError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
9
9
|
export declare const RelationRefError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
10
|
-
//# sourceMappingURL=_base.d.ts.map
|
package/dist/errors/_base.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnknownError = exports.RelationRefError = exports.BaseError = void 0;
|
|
7
|
+
var _modernErrors = _interopRequireDefault(require("modern-errors"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const BaseError = _modernErrors.default.subclass("BaseError");
|
|
10
|
+
exports.BaseError = BaseError;
|
|
11
|
+
const UnknownError = BaseError.subclass("UnknownError");
|
|
12
|
+
exports.UnknownError = UnknownError;
|
|
13
|
+
const RelationRefError = BaseError.subclass("RelationRefError");
|
|
14
|
+
exports.RelationRefError = RelationRefError;
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _base = require("./_base");
|
|
7
|
+
Object.keys(_base).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _base[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _base[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _invariant = require("./invariant");
|
|
18
|
+
Object.keys(_invariant).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _invariant[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _invariant[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _nonNullable = require("./non-nullable");
|
|
29
|
+
Object.keys(_nonNullable).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _nonNullable[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _nonNullable[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _nonexhaustive = require("./nonexhaustive");
|
|
40
|
+
Object.keys(_nonexhaustive).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _nonexhaustive[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _nonexhaustive[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _modelIndex = require("./model-index");
|
|
51
|
+
Object.keys(_modelIndex).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _modelIndex[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _modelIndex[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export declare const InvariantError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
2
2
|
export declare function invariant(condition: any, message?: string): asserts condition;
|
|
3
|
-
export declare function nonNullable<T>(value: T): NonNullable<T>;
|
|
4
|
-
//# sourceMappingURL=invariant.d.ts.map
|
package/dist/errors/invariant.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function nonNullable(value) {
|
|
18
|
-
invariant(value != null, 'Expected value to exist');
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=invariant.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InvariantError = void 0;
|
|
7
|
+
exports.invariant = invariant;
|
|
8
|
+
var _base = require("./_base");
|
|
9
|
+
const InvariantError = _base.BaseError.subclass("InvariantError");
|
|
10
|
+
exports.InvariantError = InvariantError;
|
|
11
|
+
function invariant(condition, message) {
|
|
12
|
+
if (condition) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
throw new InvariantError(message ?? "Invariant failed");
|
|
16
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InvalidModelError = void 0;
|
|
7
|
+
exports.ensureModel = ensureModel;
|
|
8
|
+
var _base = require("./_base");
|
|
9
|
+
const InvalidModelError = _base.BaseError.subclass("InvalidModelError");
|
|
10
|
+
exports.InvalidModelError = InvalidModelError;
|
|
11
|
+
function ensureModel(condition, message) {
|
|
12
|
+
if (condition) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
throw new InvalidModelError(message ?? "ModelIndex Invariant failed");
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseError } from "./_base.mjs";
|
|
2
|
+
export const InvalidModelError = BaseError.subclass("InvalidModelError");
|
|
3
|
+
export function ensureModel(condition, message) {
|
|
4
|
+
if (condition) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
throw new InvalidModelError(message ?? "ModelIndex Invariant failed");
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnexpectedNullableError = void 0;
|
|
7
|
+
exports.nonNullable = nonNullable;
|
|
8
|
+
var _base = require("./_base");
|
|
9
|
+
const UnexpectedNullableError = _base.BaseError.subclass("UnexpectedNullableError");
|
|
10
|
+
exports.UnexpectedNullableError = UnexpectedNullableError;
|
|
11
|
+
function nonNullable(value) {
|
|
12
|
+
if (value == null) {
|
|
13
|
+
throw new UnexpectedNullableError("Expected value to not be null or undefined");
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseError } from "./_base.mjs";
|
|
2
|
+
export const UnexpectedNullableError = BaseError.subclass("UnexpectedNullableError");
|
|
3
|
+
export function nonNullable(value) {
|
|
4
|
+
if (value == null) {
|
|
5
|
+
throw new UnexpectedNullableError("Expected value to not be null or undefined");
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NonExhaustiveError = void 0;
|
|
7
|
+
exports.nonexhaustive = nonexhaustive;
|
|
8
|
+
var _base = require("./_base");
|
|
9
|
+
const NonExhaustiveError = _base.BaseError.subclass("NonExhaustiveError");
|
|
10
|
+
exports.NonExhaustiveError = NonExhaustiveError;
|
|
11
|
+
function nonexhaustive(arg) {
|
|
12
|
+
throw new NonExhaustiveError(`NonExhaustive value: ${JSON.stringify(arg)}`);
|
|
13
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export type * from './types';
|
|
2
1
|
export * from './types';
|
|
3
|
-
export * from './compute-view';
|
|
4
2
|
export * from './utils';
|
|
5
3
|
export * from './model-index';
|
|
4
|
+
export * from './compute-view';
|
|
6
5
|
export * from './colors';
|
|
7
6
|
export * from './errors';
|
|
8
|
-
|
|
7
|
+
export type * from './types';
|
|
8
|
+
export type * from './model-index';
|
|
9
|
+
export type * from './compute-view';
|
|
10
|
+
export type * from './errors';
|
|
11
|
+
export type * from './colors';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _types = require("./types");
|
|
7
|
+
Object.keys(_types).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _types[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
Object.keys(_utils).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _utils[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _modelIndex = require("./model-index");
|
|
29
|
+
Object.keys(_modelIndex).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _modelIndex[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _modelIndex[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _computeView = require("./compute-view");
|
|
40
|
+
Object.keys(_computeView).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _computeView[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _computeView[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _colors = require("./colors");
|
|
51
|
+
Object.keys(_colors).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _colors[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _colors[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _errors = require("./errors");
|
|
62
|
+
Object.keys(_errors).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _errors[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _errors[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
package/dist/index.mjs
ADDED