@loadmap/cli 0.12.0 → 0.14.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/bin.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as USAGE, o as check, a as fmt, s as github, n as main, r as parseRecord, i as record } from "./src-
|
|
1
|
+
export { t as USAGE, o as check, a as fmt, s as github, n as main, r as parseRecord, i as record } from "./src-CCTyfor7.js";
|
|
@@ -1276,6 +1276,8 @@ function defineView(model, def) {
|
|
|
1276
1276
|
const nodes = def.nodes;
|
|
1277
1277
|
for (const e of def.edges) for (const end of [e.from, e.to]) if (!(end in nodes)) throw new Error(`loadmap: edge to unknown node "${end}"`);
|
|
1278
1278
|
for (const [f, fv] of Object.entries(def.flows)) if (!(fv.from in nodes)) throw new Error(`loadmap: flow "${f}" starts at unknown node "${fv.from}"`);
|
|
1279
|
+
const tiers = def.tiers ?? {};
|
|
1280
|
+
for (const [id, n] of Object.entries(nodes)) if (n.tier != null && !Object.hasOwn(tiers, n.tier)) throw new Error(`loadmap: node "${id}" stands in unknown tier "${n.tier}"`);
|
|
1279
1281
|
const shows = (n, s) => Array.isArray(n.stage) ? n.stage.includes(s) : n.stage === s;
|
|
1280
1282
|
for (const s of model.stageIds) if (!Object.values(nodes).some((n) => shows(n, s))) throw new Error(`loadmap: no node shows stage "${s}"`);
|
|
1281
1283
|
return {
|
|
@@ -1502,6 +1504,11 @@ const SUB = {
|
|
|
1502
1504
|
scope: "ctx",
|
|
1503
1505
|
doc: "The second line of the box."
|
|
1504
1506
|
};
|
|
1507
|
+
const TIER = {
|
|
1508
|
+
value: "tier",
|
|
1509
|
+
scope: "const",
|
|
1510
|
+
doc: "The tier the box stands in; without one, that of the boxes that feed it."
|
|
1511
|
+
};
|
|
1505
1512
|
const OVERLOAD_WHEN = {
|
|
1506
1513
|
value: "boolean",
|
|
1507
1514
|
scope: "ctx",
|
|
@@ -1543,7 +1550,7 @@ const SCHEMA = {
|
|
|
1543
1550
|
value: "enum",
|
|
1544
1551
|
scope: "const",
|
|
1545
1552
|
values: ["right", "down"],
|
|
1546
|
-
doc: "Which way the diagram runs. Narrow screens always run down."
|
|
1553
|
+
doc: "Which way the diagram runs. Default right, or down when its widest layer has more boxes than its longest chain. Narrow screens always run down."
|
|
1547
1554
|
},
|
|
1548
1555
|
speed: {
|
|
1549
1556
|
value: "number",
|
|
@@ -1595,6 +1602,7 @@ const SCHEMA = {
|
|
|
1595
1602
|
"node",
|
|
1596
1603
|
"cluster",
|
|
1597
1604
|
"pool",
|
|
1605
|
+
"tier",
|
|
1598
1606
|
"thresholds"
|
|
1599
1607
|
],
|
|
1600
1608
|
edges: "edges"
|
|
@@ -2037,6 +2045,20 @@ const SCHEMA = {
|
|
|
2037
2045
|
props: COMPONENT_PROPS,
|
|
2038
2046
|
children: []
|
|
2039
2047
|
},
|
|
2048
|
+
tier: {
|
|
2049
|
+
doc: "A band across the flow (edge, app, data) drawn behind its boxes. Tiers run in the order they are declared.",
|
|
2050
|
+
example: "tier data \"Data\"",
|
|
2051
|
+
args: [{
|
|
2052
|
+
name: "id",
|
|
2053
|
+
kind: "id"
|
|
2054
|
+
}, {
|
|
2055
|
+
name: "label",
|
|
2056
|
+
kind: "text",
|
|
2057
|
+
optional: true
|
|
2058
|
+
}],
|
|
2059
|
+
props: {},
|
|
2060
|
+
children: []
|
|
2061
|
+
},
|
|
2040
2062
|
node: {
|
|
2041
2063
|
doc: "A box. It may run a stage (pass, store, sink, fanout) and own a component (demand and capacity lines).",
|
|
2042
2064
|
example: "node gateway \"API gateway\" { pass; demand: flows.orders; capacity: estimated(20000, \"req/s\") }",
|
|
@@ -2049,6 +2071,7 @@ const SCHEMA = {
|
|
|
2049
2071
|
values: ["box", "cylinder"],
|
|
2050
2072
|
doc: "box (the default) or cylinder."
|
|
2051
2073
|
},
|
|
2074
|
+
tier: TIER,
|
|
2052
2075
|
...COMPONENT_PROPS
|
|
2053
2076
|
},
|
|
2054
2077
|
children: [
|
|
@@ -2079,6 +2102,7 @@ const SCHEMA = {
|
|
|
2079
2102
|
scope: "i",
|
|
2080
2103
|
doc: "Each member's label, from its index i: `broker ${i}`."
|
|
2081
2104
|
},
|
|
2105
|
+
tier: TIER,
|
|
2082
2106
|
...COMPONENT_PROPS
|
|
2083
2107
|
},
|
|
2084
2108
|
children: ["queue", "component"]
|
|
@@ -2094,6 +2118,7 @@ const SCHEMA = {
|
|
|
2094
2118
|
scope: "i",
|
|
2095
2119
|
doc: "Each pod's label, from its index i: `pod ${i}`."
|
|
2096
2120
|
},
|
|
2121
|
+
tier: TIER,
|
|
2097
2122
|
...COMPONENT_PROPS
|
|
2098
2123
|
},
|
|
2099
2124
|
children: ["workers", "component"]
|
|
@@ -3787,10 +3812,30 @@ var Compiler = class {
|
|
|
3787
3812
|
}
|
|
3788
3813
|
const searchMax = this.constProp(root, "searchMax");
|
|
3789
3814
|
if (searchMax != null) model.searchMax = searchMax;
|
|
3815
|
+
const tiers = {};
|
|
3816
|
+
const tierNames = /* @__PURE__ */ new Map();
|
|
3817
|
+
for (const b of byKind("tier")) {
|
|
3818
|
+
if (!b.args.id) continue;
|
|
3819
|
+
this.declare("tier", b.args.id.name, b.args.id, b, tierNames);
|
|
3820
|
+
tiers[b.args.id.name] = { label: this.text(b.args.label) ?? b.args.id.name };
|
|
3821
|
+
}
|
|
3790
3822
|
const nodes = {};
|
|
3791
|
-
for (const box of boxes)
|
|
3823
|
+
for (const box of boxes) {
|
|
3824
|
+
nodes[box.id] = this.node(box);
|
|
3825
|
+
const tier = this.named(box.block, "tier", [...tierNames.keys()], "tier");
|
|
3826
|
+
if (tier) nodes[box.id].tier = tier;
|
|
3827
|
+
}
|
|
3792
3828
|
const edges = [];
|
|
3793
3829
|
for (const e of root.edges) edges.push(...this.edges(e, boxById));
|
|
3830
|
+
const tierOf = (id) => {
|
|
3831
|
+
const t = nodes[id]?.tier;
|
|
3832
|
+
return t == null ? void 0 : Object.keys(tiers).indexOf(t);
|
|
3833
|
+
};
|
|
3834
|
+
for (const e of root.edges) e.chain.forEach((to, i) => {
|
|
3835
|
+
const from = e.chain[i - 1];
|
|
3836
|
+
const [a, b] = from ? [tierOf(from.name), tierOf(to.name)] : [];
|
|
3837
|
+
if (from && a != null && b != null && a > b) this.report.warning(to, `${from.name} -> ${to.name} runs back from the tier "${nodes[from.name].tier}" to "${nodes[to.name].tier}"`);
|
|
3838
|
+
});
|
|
3794
3839
|
if (!flows.length) this.report.error({
|
|
3795
3840
|
from: 0,
|
|
3796
3841
|
to: 0
|
|
@@ -3812,11 +3857,13 @@ var Compiler = class {
|
|
|
3812
3857
|
if (typeof v === "string") options.assumptions.push(v);
|
|
3813
3858
|
}
|
|
3814
3859
|
if (this.report.failed) return void 0;
|
|
3815
|
-
|
|
3860
|
+
const view = {
|
|
3816
3861
|
nodes,
|
|
3817
3862
|
edges,
|
|
3818
|
-
flows: flowViews
|
|
3819
|
-
|
|
3863
|
+
flows: flowViews,
|
|
3864
|
+
...Object.keys(tiers).length ? { tiers } : {}
|
|
3865
|
+
};
|
|
3866
|
+
return this.build(model, view, options, byKind("preset"), byKind("scenario"));
|
|
3820
3867
|
}
|
|
3821
3868
|
/** Hands the parts to core and layout, then runs the model once per preset and scenario so formula errors show now. */
|
|
3822
3869
|
build(modelDef, viewDef, options, presets, scenarios) {
|