@radicaltools/mcp 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +148 -2
- package/dist/chunk-OGN3UW2D.js +2594 -0
- package/dist/elkLayout-S62RLGTO.js +8 -0
- package/dist/hub-catalogue/adr/adr-api-versioning.radical +53 -0
- package/dist/hub-catalogue/adr/adr-auth-strategy.radical +53 -0
- package/dist/hub-catalogue/adr/adr-caching-strategy.radical +59 -0
- package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +40 -0
- package/dist/hub-catalogue/adr/adr-data-store.radical +47 -0
- package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +53 -0
- package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +53 -0
- package/dist/hub-catalogue/adr/adr-integration-style.radical +50 -0
- package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +38 -0
- package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +40 -0
- package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +39 -0
- package/dist/hub-catalogue/adr/adr-multi-region.radical +60 -0
- package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +41 -0
- package/dist/hub-catalogue/adr/adr-observability.radical +59 -0
- package/dist/hub-catalogue/adr/adr-realtime-transport.radical +38 -0
- package/dist/hub-catalogue/adr/adr-tech-stack.radical +45 -0
- package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +40 -0
- package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +1641 -0
- package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +1428 -0
- package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +1989 -0
- package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +1701 -0
- package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +1792 -0
- package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +1421 -0
- package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +1713 -0
- package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +34 -0
- package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +52 -0
- package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +36 -0
- package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +67 -0
- package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +62 -0
- package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +53 -0
- package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +64 -0
- package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +51 -0
- package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +43 -0
- package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +37 -0
- package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +46 -0
- package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +52 -0
- package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +53 -0
- package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +59 -0
- package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +34 -0
- package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +34 -0
- package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +59 -0
- package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +44 -0
- package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +43 -0
- package/dist/hub-catalogue/fitness-function/ff-mttr.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +66 -0
- package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +35 -0
- package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +66 -0
- package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +66 -0
- package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +45 -0
- package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +43 -0
- package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +57 -0
- package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +88 -0
- package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +168 -0
- package/dist/hub-catalogue/pattern/pattern-bff.radical +179 -0
- package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +114 -0
- package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +219 -0
- package/dist/hub-catalogue/pattern/pattern-cqrs.radical +195 -0
- package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +200 -0
- package/dist/hub-catalogue/pattern/pattern-event-driven.radical +210 -0
- package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +211 -0
- package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +196 -0
- package/dist/hub-catalogue/pattern/pattern-microservices.radical +262 -0
- package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +213 -0
- package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +114 -0
- package/dist/hub-catalogue/pattern/pattern-saga.radical +208 -0
- package/dist/hub-catalogue/pattern/pattern-sidecar.radical +123 -0
- package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +227 -0
- package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +209 -0
- package/dist/hub-catalogue/requirement/req-accessibility.radical +48 -0
- package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +51 -0
- package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +45 -0
- package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +46 -0
- package/dist/hub-catalogue/requirement/req-alerting.radical +52 -0
- package/dist/hub-catalogue/requirement/req-api-response-time.radical +51 -0
- package/dist/hub-catalogue/requirement/req-api-standard.radical +45 -0
- package/dist/hub-catalogue/requirement/req-audit-logging.radical +43 -0
- package/dist/hub-catalogue/requirement/req-auth-response-time.radical +45 -0
- package/dist/hub-catalogue/requirement/req-auth.radical +43 -0
- package/dist/hub-catalogue/requirement/req-autoscaling.radical +62 -0
- package/dist/hub-catalogue/requirement/req-availability.radical +50 -0
- package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +46 -0
- package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +50 -0
- package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +64 -0
- package/dist/hub-catalogue/requirement/req-centralised-logging.radical +45 -0
- package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +43 -0
- package/dist/hub-catalogue/requirement/req-code-complexity.radical +43 -0
- package/dist/hub-catalogue/requirement/req-config-propagation.radical +45 -0
- package/dist/hub-catalogue/requirement/req-data-integrity.radical +35 -0
- package/dist/hub-catalogue/requirement/req-data-retention.radical +44 -0
- package/dist/hub-catalogue/requirement/req-db-query-response.radical +44 -0
- package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +59 -0
- package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +45 -0
- package/dist/hub-catalogue/requirement/req-encryption.radical +49 -0
- package/dist/hub-catalogue/requirement/req-error-rate.radical +45 -0
- package/dist/hub-catalogue/requirement/req-error-recovery.radical +34 -0
- package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +37 -0
- package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +55 -0
- package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +69 -0
- package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +44 -0
- package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +39 -0
- package/dist/hub-catalogue/requirement/req-health-checks.radical +43 -0
- package/dist/hub-catalogue/requirement/req-iac.radical +36 -0
- package/dist/hub-catalogue/requirement/req-idempotency.radical +47 -0
- package/dist/hub-catalogue/requirement/req-input-validation.radical +37 -0
- package/dist/hub-catalogue/requirement/req-least-privilege.radical +47 -0
- package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +38 -0
- package/dist/hub-catalogue/requirement/req-mfa.radical +36 -0
- package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +42 -0
- package/dist/hub-catalogue/requirement/req-onboarding-time.radical +42 -0
- package/dist/hub-catalogue/requirement/req-page-load-time.radical +59 -0
- package/dist/hub-catalogue/requirement/req-payout-latency.radical +46 -0
- package/dist/hub-catalogue/requirement/req-presence-latency.radical +46 -0
- package/dist/hub-catalogue/requirement/req-rate-limiting.radical +45 -0
- package/dist/hub-catalogue/requirement/req-report-generation.radical +44 -0
- package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +64 -0
- package/dist/hub-catalogue/requirement/req-resource-headroom.radical +53 -0
- package/dist/hub-catalogue/requirement/req-resource-isolation.radical +37 -0
- package/dist/hub-catalogue/requirement/req-search-response-time.radical +44 -0
- package/dist/hub-catalogue/requirement/req-secrets-management.radical +45 -0
- package/dist/hub-catalogue/requirement/req-task-success-rate.radical +42 -0
- package/dist/hub-catalogue/requirement/req-test-coverage.radical +42 -0
- package/dist/hub-catalogue/requirement/req-throughput.radical +55 -0
- package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +52 -0
- package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +39 -0
- package/dist/index.js +19422 -0
- package/package.json +48 -4
|
@@ -0,0 +1,2594 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// ../../packages/layout/src/elkLayout.ts
|
|
28
|
+
import ELK from "elkjs/lib/elk.bundled.js";
|
|
29
|
+
|
|
30
|
+
// ../../packages/common/src/metamodel/lookup.ts
|
|
31
|
+
function isRelationAllowed(metamodel, fromType, toType) {
|
|
32
|
+
if (!metamodel) return true;
|
|
33
|
+
const rts = Object.values(metamodel.relationTypes);
|
|
34
|
+
if (rts.length === 0) return true;
|
|
35
|
+
if (rts.some((rt) => rt.allowedPairs.length === 0)) return true;
|
|
36
|
+
return rts.some((rt) => rt.allowedPairs.some((p) => p.from === fromType && p.to === toType));
|
|
37
|
+
}
|
|
38
|
+
function inferRelationType(metamodel, fromType, toType) {
|
|
39
|
+
if (!metamodel) return void 0;
|
|
40
|
+
const matches = Object.values(metamodel.relationTypes).filter(
|
|
41
|
+
(rt) => rt.allowedPairs.length > 0 && rt.allowedPairs.some((p) => p.from === fromType && p.to === toType)
|
|
42
|
+
);
|
|
43
|
+
return matches.length === 1 ? matches[0].id : void 0;
|
|
44
|
+
}
|
|
45
|
+
function isParentAllowed(metamodel, childType, parentType) {
|
|
46
|
+
if (!metamodel) return true;
|
|
47
|
+
const def = metamodel.nodeTypes[childType];
|
|
48
|
+
if (!def) return true;
|
|
49
|
+
const allowed = def.allowedParents;
|
|
50
|
+
if (parentType == null) {
|
|
51
|
+
if (def.allowedAtRoot !== void 0) return def.allowedAtRoot;
|
|
52
|
+
return !allowed || allowed.length === 0;
|
|
53
|
+
}
|
|
54
|
+
return !!allowed && allowed.includes(parentType);
|
|
55
|
+
}
|
|
56
|
+
var GROUP_TYPE = "group";
|
|
57
|
+
function placeOf(node, nodes) {
|
|
58
|
+
const seen = /* @__PURE__ */ new Set();
|
|
59
|
+
let cur = node;
|
|
60
|
+
while (cur && cur.type === GROUP_TYPE && !seen.has(cur)) {
|
|
61
|
+
seen.add(cur);
|
|
62
|
+
cur = cur.parentId ? nodes[cur.parentId] : void 0;
|
|
63
|
+
}
|
|
64
|
+
return cur && cur.type !== GROUP_TYPE ? cur : void 0;
|
|
65
|
+
}
|
|
66
|
+
function hasPlaceUnder(metamodel, childType, placeType) {
|
|
67
|
+
if (!metamodel || !metamodel.nodeTypes[childType]) return true;
|
|
68
|
+
if (placeType == null) return isParentAllowed(metamodel, childType, void 0);
|
|
69
|
+
const seen = /* @__PURE__ */ new Set();
|
|
70
|
+
const queue = [childType];
|
|
71
|
+
while (queue.length > 0) {
|
|
72
|
+
for (const parent of metamodel.nodeTypes[queue.pop()]?.allowedParents ?? []) {
|
|
73
|
+
if (parent === placeType) return true;
|
|
74
|
+
if (parent === GROUP_TYPE || seen.has(parent)) continue;
|
|
75
|
+
seen.add(parent);
|
|
76
|
+
queue.push(parent);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
function isPlacementAllowed(metamodel, childType, parent, nodes) {
|
|
82
|
+
if (!isParentAllowed(metamodel, childType, parent?.type)) return false;
|
|
83
|
+
if (!parent || parent.type !== GROUP_TYPE) return true;
|
|
84
|
+
return hasPlaceUnder(metamodel, childType, placeOf(parent, nodes)?.type);
|
|
85
|
+
}
|
|
86
|
+
function canAddMoreOfType(metamodel, typeId, currentCount) {
|
|
87
|
+
if (!metamodel) return true;
|
|
88
|
+
const def = metamodel.nodeTypes[typeId];
|
|
89
|
+
if (!def?.cardinality?.max) return true;
|
|
90
|
+
return currentCount < def.cardinality.max;
|
|
91
|
+
}
|
|
92
|
+
var RESERVED_PROPERTY_KEYS = {
|
|
93
|
+
node: /* @__PURE__ */ new Set(["id", "type", "parentId", "x", "y", "width", "height", "collapsed"]),
|
|
94
|
+
relation: /* @__PURE__ */ new Set(["id", "sourceId", "targetId", "relationType"])
|
|
95
|
+
};
|
|
96
|
+
function isReservedPropertyKey(key, of) {
|
|
97
|
+
return RESERVED_PROPERTY_KEYS[of].has(key);
|
|
98
|
+
}
|
|
99
|
+
function propertyKeyProblem(key, of) {
|
|
100
|
+
if (!isReservedPropertyKey(key, of)) return null;
|
|
101
|
+
return `"${key}" is a field every ${of === "node" ? "element" : "relation"} has (${[...RESERVED_PROPERTY_KEYS[of]].join(", ")}): give the property another key.`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ../../packages/common/src/metamodel/refs.ts
|
|
105
|
+
function refIds(value) {
|
|
106
|
+
if (typeof value === "string") return value ? [value] : [];
|
|
107
|
+
if (Array.isArray(value)) return value.filter((v) => typeof v === "string" && v !== "");
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
function refLabels(value, nodes) {
|
|
111
|
+
return refIds(value).map((id) => nodes[id]?.label ?? id);
|
|
112
|
+
}
|
|
113
|
+
function refValue(def, ids) {
|
|
114
|
+
return def.multiple ? ids : ids[0] ?? "";
|
|
115
|
+
}
|
|
116
|
+
function refProblem(def, id, nodes) {
|
|
117
|
+
const node = nodes[id];
|
|
118
|
+
if (!node) return `no node has id "${id}"`;
|
|
119
|
+
if (def.refType && node.type !== def.refType) return `"${node.label}" is of type ${node.type}, not ${def.refType}`;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ../../packages/common/src/metamodel/statechart.ts
|
|
124
|
+
var prop = (item, key) => {
|
|
125
|
+
const value = item[key];
|
|
126
|
+
return typeof value === "string" ? value.trim() : "";
|
|
127
|
+
};
|
|
128
|
+
var stateKind = (n) => prop(n, "kind") || "normal";
|
|
129
|
+
var pseudoKind = (n) => prop(n, "kind") || "initial";
|
|
130
|
+
var isState = (n) => n?.type === "state";
|
|
131
|
+
var isPseudo = (n) => n?.type === "pseudostate";
|
|
132
|
+
function transitionLabel(r, nodes) {
|
|
133
|
+
const props = r;
|
|
134
|
+
const event = refLabels(props.event, nodes).join(", ");
|
|
135
|
+
const guard = prop(r, "guard");
|
|
136
|
+
const actions = prop(r, "actions");
|
|
137
|
+
const raises = refLabels(props.raises, nodes).map((label) => `^${label}`).join(" ");
|
|
138
|
+
return [event, guard && `[${guard}]`, actions && `/ ${actions}`, raises].filter(Boolean).join(" ");
|
|
139
|
+
}
|
|
140
|
+
var entityCache = /* @__PURE__ */ new WeakMap();
|
|
141
|
+
function machineEntity(machineId, nodes, relations) {
|
|
142
|
+
let map = entityCache.get(relations);
|
|
143
|
+
if (!map) {
|
|
144
|
+
map = /* @__PURE__ */ new Map();
|
|
145
|
+
for (const r of Object.values(relations)) {
|
|
146
|
+
if (r.relationType === "lifecycle-of" && !map.has(r.sourceId)) map.set(r.sourceId, r.targetId);
|
|
147
|
+
}
|
|
148
|
+
entityCache.set(relations, map);
|
|
149
|
+
}
|
|
150
|
+
const id = map.get(machineId);
|
|
151
|
+
return id ? nodes[id] : void 0;
|
|
152
|
+
}
|
|
153
|
+
function machineOf(node, nodes) {
|
|
154
|
+
let cur = node;
|
|
155
|
+
for (let depth = 0; cur && depth < 64; depth++) {
|
|
156
|
+
if (cur.type === "state-machine") return cur;
|
|
157
|
+
cur = cur.parentId ? nodes[cur.parentId] : void 0;
|
|
158
|
+
}
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
function requirementStatePhrase(requirement, nodes, relations) {
|
|
162
|
+
const state = nodes[refIds(requirement.precondition_state)[0] ?? ""];
|
|
163
|
+
if (!state) return "";
|
|
164
|
+
const machine = machineOf(state, nodes);
|
|
165
|
+
const entity = machine ? machineEntity(machine.id, nodes, relations) : void 0;
|
|
166
|
+
return entity ? `the ${entity.label} is ${state.label}` : `in ${state.label}`;
|
|
167
|
+
}
|
|
168
|
+
function validateStateMachines(nodes, relations) {
|
|
169
|
+
const nodeList = Object.values(nodes);
|
|
170
|
+
if (!nodeList.some((n) => n.type === "state-machine" || n.type === "state" || n.type === "pseudostate")) return [];
|
|
171
|
+
const issues = [];
|
|
172
|
+
const warn = (id, message, at) => {
|
|
173
|
+
issues.push({ id, severity: "warning", message, ...at });
|
|
174
|
+
};
|
|
175
|
+
const children = /* @__PURE__ */ new Map();
|
|
176
|
+
for (const n of nodeList) {
|
|
177
|
+
if (!n.parentId) continue;
|
|
178
|
+
const list = children.get(n.parentId);
|
|
179
|
+
if (list) list.push(n);
|
|
180
|
+
else children.set(n.parentId, [n]);
|
|
181
|
+
}
|
|
182
|
+
const childStates = (id) => (children.get(id) ?? []).filter(isState);
|
|
183
|
+
const initialsOf = (id) => (children.get(id) ?? []).filter((c) => isPseudo(c) && pseudoKind(c) === "initial");
|
|
184
|
+
const transitions = Object.values(relations).filter((r) => r.relationType === "transition" && nodes[r.sourceId] && nodes[r.targetId]);
|
|
185
|
+
const outgoing = /* @__PURE__ */ new Map();
|
|
186
|
+
const incoming = /* @__PURE__ */ new Set();
|
|
187
|
+
for (const t of transitions) {
|
|
188
|
+
const list = outgoing.get(t.sourceId);
|
|
189
|
+
if (list) list.push(t);
|
|
190
|
+
else outgoing.set(t.sourceId, [t]);
|
|
191
|
+
incoming.add(t.targetId);
|
|
192
|
+
}
|
|
193
|
+
const regions = nodeList.filter((n) => n.type === "state-machine" || isState(n) && stateKind(n) === "normal");
|
|
194
|
+
for (const owner of regions) {
|
|
195
|
+
if (childStates(owner.id).length === 0) continue;
|
|
196
|
+
const initials = initialsOf(owner.id);
|
|
197
|
+
const what = owner.type === "state-machine" ? "State machine" : "Compound state";
|
|
198
|
+
if (initials.length === 0) {
|
|
199
|
+
warn(`sm-no-initial:${owner.id}`, `${what} "${owner.label}" has child states but no initial pseudostate to enter them.`, { nodeId: owner.id });
|
|
200
|
+
} else if (initials.length > 1) {
|
|
201
|
+
warn(`sm-many-initials:${owner.id}`, `${what} "${owner.label}" has ${initials.length} initial pseudostates; keep one.`, { nodeId: owner.id });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
for (const n of nodeList) {
|
|
205
|
+
if (isPseudo(n) && pseudoKind(n) === "initial") {
|
|
206
|
+
const out = outgoing.get(n.id) ?? [];
|
|
207
|
+
if (out.length !== 1) {
|
|
208
|
+
warn(`sm-initial-out:${n.id}`, `Initial pseudostate in "${n.parentId ? nodes[n.parentId]?.label : ""}" needs exactly one transition, to the default state (it has ${out.length}).`, { nodeId: n.id });
|
|
209
|
+
}
|
|
210
|
+
if (incoming.has(n.id)) {
|
|
211
|
+
warn(`sm-initial-in:${n.id}`, `A transition points at the initial pseudostate in "${n.parentId ? nodes[n.parentId]?.label : ""}"; target the state itself.`, { nodeId: n.id });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (!isState(n)) continue;
|
|
215
|
+
const kind = stateKind(n);
|
|
216
|
+
if (kind === "parallel") {
|
|
217
|
+
if (childStates(n.id).length < 2) {
|
|
218
|
+
warn(`sm-parallel-regions:${n.id}`, `Parallel state "${n.label}" needs at least two child states (regions) active at once.`, { nodeId: n.id });
|
|
219
|
+
}
|
|
220
|
+
if (initialsOf(n.id).length > 0) {
|
|
221
|
+
warn(`sm-parallel-initial:${n.id}`, `Parallel state "${n.label}" enters all its regions; it takes no initial pseudostate.`, { nodeId: n.id });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (kind === "final") {
|
|
225
|
+
if ((children.get(n.id) ?? []).length > 0) {
|
|
226
|
+
warn(`sm-final-children:${n.id}`, `Final state "${n.label}" cannot contain other states.`, { nodeId: n.id });
|
|
227
|
+
}
|
|
228
|
+
if ((outgoing.get(n.id) ?? []).length > 0) {
|
|
229
|
+
warn(`sm-final-out:${n.id}`, `Final state "${n.label}" cannot have outgoing transitions.`, { nodeId: n.id });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
for (const t of transitions) {
|
|
234
|
+
const src = nodes[t.sourceId];
|
|
235
|
+
const dst = nodes[t.targetId];
|
|
236
|
+
if (machineOf(src, nodes)?.id !== machineOf(dst, nodes)?.id) {
|
|
237
|
+
warn(`sm-cross-machine:${t.id}`, `Transition "${src.label}" \u2192 "${dst.label}" leaves its state machine.`, { relationId: t.id });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
for (const [sourceId, out] of outgoing) {
|
|
241
|
+
const byEvent = /* @__PURE__ */ new Map();
|
|
242
|
+
for (const t of out) {
|
|
243
|
+
if (prop(t, "guard")) continue;
|
|
244
|
+
const key = refIds(t.event)[0] ?? "";
|
|
245
|
+
const list = byEvent.get(key);
|
|
246
|
+
if (list) list.push(t);
|
|
247
|
+
else byEvent.set(key, [t]);
|
|
248
|
+
}
|
|
249
|
+
for (const [event, list] of byEvent) {
|
|
250
|
+
if (list.length < 2) continue;
|
|
251
|
+
const on = event ? `on "${nodes[event]?.label ?? event}"` : "without an event";
|
|
252
|
+
warn(`sm-nondeterministic:${sourceId}:${event}`, `"${nodes[sourceId].label}" has ${list.length} unguarded transitions ${on}; only one can fire.`, { nodeId: sourceId });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const machinesOfEntity = /* @__PURE__ */ new Map();
|
|
256
|
+
for (const machine of nodeList.filter((n) => n.type === "state-machine")) {
|
|
257
|
+
const entity = machineEntity(machine.id, nodes, relations);
|
|
258
|
+
if (!entity) {
|
|
259
|
+
warn(`sm-no-entity:${machine.id}`, `State machine "${machine.label}" is the lifecycle of no entity; link it to one with "lifecycle-of".`, { nodeId: machine.id });
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
machinesOfEntity.set(entity.id, [...machinesOfEntity.get(entity.id) ?? [], machine]);
|
|
263
|
+
}
|
|
264
|
+
for (const [entityId, machines] of machinesOfEntity) {
|
|
265
|
+
if (machines.length < 2) continue;
|
|
266
|
+
warn(`sm-many-machines:${entityId}`, `Entity "${nodes[entityId].label}" has ${machines.length} state machines (${machines.map((m) => m.label).join(", ")}); model one lifecycle, with parallel regions if parts of it progress at once.`, { nodeId: entityId });
|
|
267
|
+
}
|
|
268
|
+
for (const machine of nodeList.filter((n) => n.type === "state-machine")) {
|
|
269
|
+
if (initialsOf(machine.id).length === 0) continue;
|
|
270
|
+
const reached = /* @__PURE__ */ new Set();
|
|
271
|
+
const queue = [machine.id];
|
|
272
|
+
const visit = (id) => {
|
|
273
|
+
if (!reached.has(id)) {
|
|
274
|
+
reached.add(id);
|
|
275
|
+
queue.push(id);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
while (queue.length > 0) {
|
|
279
|
+
const id = queue.shift();
|
|
280
|
+
const n = nodes[id];
|
|
281
|
+
if (!n) continue;
|
|
282
|
+
if (n.parentId && n.parentId !== machine.id && nodes[n.parentId]) visit(n.parentId);
|
|
283
|
+
if (n.type === "state-machine" || isState(n) && stateKind(n) === "normal") {
|
|
284
|
+
for (const init of initialsOf(id)) visit(init.id);
|
|
285
|
+
} else if (isState(n) && stateKind(n) === "parallel") {
|
|
286
|
+
for (const region of childStates(id)) visit(region.id);
|
|
287
|
+
}
|
|
288
|
+
for (const t of outgoing.get(id) ?? []) visit(t.targetId);
|
|
289
|
+
}
|
|
290
|
+
const unreached = (id) => {
|
|
291
|
+
for (const child of children.get(id) ?? []) {
|
|
292
|
+
if (isState(child) && !reached.has(child.id)) {
|
|
293
|
+
warn(`sm-unreachable:${child.id}`, `State "${child.label}" cannot be reached from the initial state of "${machine.label}".`, { nodeId: child.id });
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
unreached(child.id);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
unreached(machine.id);
|
|
300
|
+
}
|
|
301
|
+
return issues;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// ../../packages/common/src/metamodel/domainModel.ts
|
|
305
|
+
var kindOf = (n) => {
|
|
306
|
+
const kind = n.kind;
|
|
307
|
+
return typeof kind === "string" && kind ? kind : "aggregate-root";
|
|
308
|
+
};
|
|
309
|
+
function validateDomainModel(nodes, relations) {
|
|
310
|
+
const entities = Object.values(nodes).filter((n) => n.type === "entity");
|
|
311
|
+
if (entities.length === 0) return [];
|
|
312
|
+
const issues = [];
|
|
313
|
+
const warn = (id, message, at) => {
|
|
314
|
+
issues.push({ id, severity: "warning", message, ...at });
|
|
315
|
+
};
|
|
316
|
+
const rootsOf = /* @__PURE__ */ new Map();
|
|
317
|
+
for (const r of Object.values(relations)) {
|
|
318
|
+
if (r.relationType !== "part-of") continue;
|
|
319
|
+
const part = nodes[r.sourceId];
|
|
320
|
+
const root = nodes[r.targetId];
|
|
321
|
+
if (part?.type !== "entity" || root?.type !== "entity") continue;
|
|
322
|
+
if (kindOf(part) === "aggregate-root") {
|
|
323
|
+
warn(`ddd-root-part-of:${r.id}`, `Aggregate root "${part.label}" is part of "${root.label}"; aggregates refer to each other with "references" instead.`, { relationId: r.id });
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (kindOf(root) !== "aggregate-root") {
|
|
327
|
+
warn(`ddd-part-of-entity:${r.id}`, `"${part.label}" is part of "${root.label}", which is not an aggregate root.`, { relationId: r.id });
|
|
328
|
+
}
|
|
329
|
+
rootsOf.set(part.id, [...rootsOf.get(part.id) ?? [], root.label]);
|
|
330
|
+
}
|
|
331
|
+
for (const entity of entities) {
|
|
332
|
+
if (kindOf(entity) !== "entity") continue;
|
|
333
|
+
const roots = rootsOf.get(entity.id) ?? [];
|
|
334
|
+
if (roots.length === 0) {
|
|
335
|
+
warn(`ddd-loose-entity:${entity.id}`, `Entity "${entity.label}" is not an aggregate root and part of no aggregate; link it to its root with "part-of", or make it a root.`, { nodeId: entity.id });
|
|
336
|
+
} else if (roots.length > 1) {
|
|
337
|
+
warn(`ddd-many-roots:${entity.id}`, `Entity "${entity.label}" is part of ${roots.length} aggregates (${roots.join(", ")}); it belongs to one.`, { nodeId: entity.id });
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return issues;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// ../../packages/common/src/metamodel/validate.ts
|
|
344
|
+
function validateModel(nodes, relations, metamodel) {
|
|
345
|
+
const issues = [];
|
|
346
|
+
const nodeList = Object.values(nodes);
|
|
347
|
+
for (const n of nodeList) {
|
|
348
|
+
const def = metamodel.nodeTypes[n.type];
|
|
349
|
+
if (!def) {
|
|
350
|
+
issues.push({
|
|
351
|
+
id: `unknown-type:${n.id}`,
|
|
352
|
+
severity: "error",
|
|
353
|
+
message: `Node "${n.label}" has unknown type "${n.type}".`,
|
|
354
|
+
nodeId: n.id
|
|
355
|
+
});
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
const allowed = def.allowedParents;
|
|
359
|
+
if (n.parentId) {
|
|
360
|
+
const parent = nodes[n.parentId];
|
|
361
|
+
if (!parent) {
|
|
362
|
+
issues.push({
|
|
363
|
+
id: `parent-missing:${n.id}`,
|
|
364
|
+
severity: "error",
|
|
365
|
+
message: `Node "${n.label}" references a missing parent.`,
|
|
366
|
+
nodeId: n.id
|
|
367
|
+
});
|
|
368
|
+
} else if (allowed && !allowed.includes(parent.type)) {
|
|
369
|
+
const parentLabel = metamodel.nodeTypes[parent.type]?.label ?? parent.type;
|
|
370
|
+
issues.push({
|
|
371
|
+
id: `bad-parent:${n.id}`,
|
|
372
|
+
severity: "error",
|
|
373
|
+
message: `${def.label} "${n.label}" cannot be inside ${parentLabel}. Allowed parents: ${allowed.length ? allowed.join(", ") : "(none \u2014 must be root)"}.`,
|
|
374
|
+
nodeId: n.id
|
|
375
|
+
});
|
|
376
|
+
} else if (parent.type === GROUP_TYPE && !hasPlaceUnder(metamodel, n.type, placeOf(parent, nodes)?.type)) {
|
|
377
|
+
const place = placeOf(parent, nodes);
|
|
378
|
+
const where = place ? `inside ${metamodel.nodeTypes[place.type]?.label ?? place.type} "${place.label}"` : "at the top of the model";
|
|
379
|
+
issues.push({
|
|
380
|
+
id: `bad-place:${n.id}`,
|
|
381
|
+
severity: "warning",
|
|
382
|
+
message: `${def.label} "${n.label}" is in group "${parent.label}", which is ${where}, where a ${def.label} has no place.`,
|
|
383
|
+
nodeId: n.id
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
} else if (def.allowedAtRoot === false || def.allowedAtRoot === void 0 && allowed && allowed.length > 0) {
|
|
387
|
+
issues.push({
|
|
388
|
+
id: `needs-parent:${n.id}`,
|
|
389
|
+
severity: "error",
|
|
390
|
+
message: `${def.label} "${n.label}" must be inside ${allowed && allowed.length ? allowed.join(" or ") : "a parent"}.`,
|
|
391
|
+
nodeId: n.id
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
for (const p of def.properties ?? []) {
|
|
395
|
+
if (!p.required) continue;
|
|
396
|
+
const v = n[p.key];
|
|
397
|
+
if (v == null || v === "") {
|
|
398
|
+
issues.push({
|
|
399
|
+
id: `missing-prop:${n.id}:${p.key}`,
|
|
400
|
+
severity: "warning",
|
|
401
|
+
message: `${def.label} "${n.label}" is missing required property "${p.label}".`,
|
|
402
|
+
nodeId: n.id
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
for (const def of Object.values(metamodel.nodeTypes)) {
|
|
408
|
+
const c = def.cardinality;
|
|
409
|
+
if (!c) continue;
|
|
410
|
+
const count = nodeList.filter((n) => n.type === def.id).length;
|
|
411
|
+
if (c.min != null && count < c.min) {
|
|
412
|
+
issues.push({
|
|
413
|
+
id: `cardinality-min:${def.id}`,
|
|
414
|
+
severity: "warning",
|
|
415
|
+
message: `Model has ${count} ${def.label} (minimum ${c.min}).`,
|
|
416
|
+
nodeTypeId: def.id
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
if (c.max != null && count > c.max) {
|
|
420
|
+
issues.push({
|
|
421
|
+
id: `cardinality-max:${def.id}`,
|
|
422
|
+
severity: "warning",
|
|
423
|
+
message: `Model has ${count} ${def.label} (maximum ${c.max}).`,
|
|
424
|
+
nodeTypeId: def.id
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
for (const def of [...Object.values(metamodel.nodeTypes), ...Object.values(metamodel.relationTypes)]) {
|
|
429
|
+
const seen = /* @__PURE__ */ new Set();
|
|
430
|
+
for (const p of def.properties ?? []) {
|
|
431
|
+
if (seen.has(p.key)) {
|
|
432
|
+
const isNode = !!metamodel.nodeTypes[def.id] && metamodel.nodeTypes[def.id] === def;
|
|
433
|
+
issues.push({ id: `dup-prop:${def.id}:${p.key}`, severity: "error", message: `${isNode ? def.label : `Relation type "${def.label}"`}: two properties have the key "${p.key}"; give one another key.`, ...isNode ? { nodeTypeId: def.id } : {} });
|
|
434
|
+
}
|
|
435
|
+
seen.add(p.key);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
for (const def of Object.values(metamodel.nodeTypes)) {
|
|
439
|
+
for (const p of def.properties ?? []) {
|
|
440
|
+
const problem = propertyKeyProblem(p.key, "node");
|
|
441
|
+
if (problem) {
|
|
442
|
+
issues.push({ id: `reserved-prop:${def.id}:${p.key}`, severity: "error", message: `${def.label}: property key ${problem}`, nodeTypeId: def.id });
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
for (const def of Object.values(metamodel.relationTypes)) {
|
|
447
|
+
for (const p of def.properties ?? []) {
|
|
448
|
+
const problem = propertyKeyProblem(p.key, "relation");
|
|
449
|
+
if (problem) {
|
|
450
|
+
issues.push({ id: `reserved-rel-prop:${def.id}:${p.key}`, severity: "error", message: `Relation type "${def.label}": property key ${problem}` });
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const restrictiveTypes = Object.values(metamodel.relationTypes).filter((rt) => rt.allowedPairs.length > 0);
|
|
455
|
+
const anyAllows = Object.values(metamodel.relationTypes).some((rt) => rt.allowedPairs.length === 0);
|
|
456
|
+
if (restrictiveTypes.length > 0 && !anyAllows) {
|
|
457
|
+
for (const r of Object.values(relations)) {
|
|
458
|
+
const src = nodes[r.sourceId];
|
|
459
|
+
const dst = nodes[r.targetId];
|
|
460
|
+
if (!src || !dst) continue;
|
|
461
|
+
const ok = restrictiveTypes.some(
|
|
462
|
+
(rt) => rt.allowedPairs.some((p) => p.from === src.type && p.to === dst.type)
|
|
463
|
+
);
|
|
464
|
+
if (!ok) {
|
|
465
|
+
issues.push({
|
|
466
|
+
id: `bad-rel:${r.id}`,
|
|
467
|
+
severity: "warning",
|
|
468
|
+
message: `Relation "${src.label}" \u2192 "${dst.label}" (${src.type}\u2192${dst.type}) is not allowed by metamodel.`,
|
|
469
|
+
relationId: r.id
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
for (const r of Object.values(relations)) {
|
|
475
|
+
const missing = [r.sourceId, r.targetId].filter((id) => !nodes[id]);
|
|
476
|
+
if (missing.length) {
|
|
477
|
+
issues.push({
|
|
478
|
+
id: `rel-end-missing:${r.id}`,
|
|
479
|
+
severity: "error",
|
|
480
|
+
message: `Relation "${r.label ?? r.id}" ${missing.length === 2 ? "has no element at either end" : `points at "${missing[0]}", which is no element of the model`}.`,
|
|
481
|
+
relationId: r.id
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
if (r.relationType && !metamodel.relationTypes[r.relationType]) {
|
|
485
|
+
issues.push({
|
|
486
|
+
id: `unknown-rel-type:${r.id}`,
|
|
487
|
+
severity: "error",
|
|
488
|
+
message: `Relation "${r.label ?? r.id}" has unknown type "${r.relationType}".`,
|
|
489
|
+
relationId: r.id
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
for (const r of Object.values(relations)) {
|
|
494
|
+
const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
|
|
495
|
+
for (const p of def?.properties ?? []) {
|
|
496
|
+
if (!p.required) continue;
|
|
497
|
+
const v = r[p.key];
|
|
498
|
+
if (v == null || v === "" || Array.isArray(v) && v.length === 0) {
|
|
499
|
+
const src = nodes[r.sourceId]?.label ?? r.sourceId;
|
|
500
|
+
const dst = nodes[r.targetId]?.label ?? r.targetId;
|
|
501
|
+
issues.push({
|
|
502
|
+
id: `missing-prop:${r.id}:${p.key}`,
|
|
503
|
+
severity: "warning",
|
|
504
|
+
message: `Relation "${src}" \u2192 "${dst}" (${def.label}) is missing required property "${p.label}".`,
|
|
505
|
+
relationId: r.id
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
for (const r of Object.values(relations)) {
|
|
511
|
+
const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
|
|
512
|
+
const src = nodes[r.sourceId];
|
|
513
|
+
const dst = nodes[r.targetId];
|
|
514
|
+
if (!def || !src || !dst || def.allowedPairs.length === 0) continue;
|
|
515
|
+
if (def.allowedPairs.some((p) => p.from === src.type && p.to === dst.type)) continue;
|
|
516
|
+
issues.push({
|
|
517
|
+
id: `bad-rel-type:${r.id}`,
|
|
518
|
+
severity: "warning",
|
|
519
|
+
message: `Relation "${src.label}" \u2192 "${dst.label}" is "${def.label}", which does not connect ${src.type}\u2192${dst.type}.`,
|
|
520
|
+
relationId: r.id
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
const checkRefs = (item, props, at, what) => {
|
|
524
|
+
for (const p of props ?? []) {
|
|
525
|
+
if (p.type !== "ref") continue;
|
|
526
|
+
for (const id of refIds(item[p.key])) {
|
|
527
|
+
const problem = refProblem(p, id, nodes);
|
|
528
|
+
if (problem) {
|
|
529
|
+
issues.push({
|
|
530
|
+
id: `bad-ref:${at.nodeId ?? at.relationId}:${p.key}:${id}`,
|
|
531
|
+
severity: "warning",
|
|
532
|
+
message: `${what}: "${p.label}" points at nothing valid (${problem}).`,
|
|
533
|
+
...at
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
for (const n of nodeList) {
|
|
540
|
+
const def = metamodel.nodeTypes[n.type];
|
|
541
|
+
if (def) checkRefs(n, def.properties, { nodeId: n.id }, `${def.label} "${n.label}"`);
|
|
542
|
+
}
|
|
543
|
+
for (const r of Object.values(relations)) {
|
|
544
|
+
const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
|
|
545
|
+
if (!def) continue;
|
|
546
|
+
const src = nodes[r.sourceId]?.label ?? r.sourceId;
|
|
547
|
+
const dst = nodes[r.targetId]?.label ?? r.targetId;
|
|
548
|
+
checkRefs(r, def.properties, { relationId: r.id }, `${def.label} "${src}" \u2192 "${dst}"`);
|
|
549
|
+
}
|
|
550
|
+
if (metamodel.nodeTypes.entity && metamodel.relationTypes["part-of"]) {
|
|
551
|
+
issues.push(...validateDomainModel(nodes, relations));
|
|
552
|
+
}
|
|
553
|
+
if (metamodel.nodeTypes.state && metamodel.relationTypes.transition) {
|
|
554
|
+
issues.push(...validateStateMachines(nodes, relations));
|
|
555
|
+
}
|
|
556
|
+
return issues;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// ../../packages/common/src/metamodel/ears.ts
|
|
560
|
+
function capitalize(s) {
|
|
561
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
562
|
+
}
|
|
563
|
+
function earsActionIsClause(action) {
|
|
564
|
+
return /\S\s+shall\s+\S/i.test(action);
|
|
565
|
+
}
|
|
566
|
+
function composeEarsSentence(node, subject, statePrecondition) {
|
|
567
|
+
const earsType = String(node.ears_type ?? "ubiquitous");
|
|
568
|
+
const subj = (subject || "the system").trim();
|
|
569
|
+
const action = String(node.action ?? "").trim();
|
|
570
|
+
const trigger = String(node.trigger ?? "").trim();
|
|
571
|
+
const precondition = (statePrecondition ?? "").trim() || String(node.precondition ?? "").trim();
|
|
572
|
+
const unwanted = String(node.unwanted_condition ?? "").trim();
|
|
573
|
+
const feature = String(node.feature ?? "").trim();
|
|
574
|
+
const actionPart = action.replace(/\.+$/, "") || "\u2039action\u203A";
|
|
575
|
+
const ownClause = earsActionIsClause(actionPart);
|
|
576
|
+
const shallClause = ownClause ? actionPart.replace(/^(The|A|An)\b/, (w) => w.toLowerCase()) : `${subj} shall ${actionPart}`;
|
|
577
|
+
let sentence;
|
|
578
|
+
let complete = !!action;
|
|
579
|
+
switch (earsType) {
|
|
580
|
+
case "event-driven":
|
|
581
|
+
sentence = `When ${trigger || "\u2039trigger\u203A"}, ${shallClause}.`;
|
|
582
|
+
complete = complete && !!trigger;
|
|
583
|
+
break;
|
|
584
|
+
case "state-driven":
|
|
585
|
+
sentence = `While ${precondition || "\u2039precondition\u203A"}, ${shallClause}.`;
|
|
586
|
+
complete = complete && !!precondition;
|
|
587
|
+
break;
|
|
588
|
+
case "unwanted-behaviour":
|
|
589
|
+
sentence = `If ${unwanted || "\u2039condition\u203A"}, then ${shallClause}.`;
|
|
590
|
+
complete = complete && !!unwanted;
|
|
591
|
+
break;
|
|
592
|
+
case "optional":
|
|
593
|
+
sentence = `Where ${feature || "\u2039feature\u203A"}, ${shallClause}.`;
|
|
594
|
+
complete = complete && !!feature;
|
|
595
|
+
break;
|
|
596
|
+
case "complex": {
|
|
597
|
+
const parts = [];
|
|
598
|
+
if (precondition) parts.push(`While ${precondition}`);
|
|
599
|
+
if (trigger) parts.push(`when ${trigger}`);
|
|
600
|
+
if (unwanted) parts.push(`if ${unwanted}`);
|
|
601
|
+
if (feature) parts.push(`where ${feature}`);
|
|
602
|
+
const hasCondition = parts.length > 0;
|
|
603
|
+
if (!hasCondition) parts.push("\u2039conditions\u203A");
|
|
604
|
+
else parts[0] = capitalize(parts[0]);
|
|
605
|
+
sentence = `${parts.join(", ")}, ${shallClause}.`;
|
|
606
|
+
complete = complete && hasCondition;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
default:
|
|
610
|
+
sentence = ownClause ? `${capitalize(actionPart)}.` : `${capitalize(subj)} shall ${actionPart}.`;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
return { sentence, complete };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// ../../packages/common/src/metamodel/presets/viewpoints.ts
|
|
617
|
+
var DEPLOYABLE = ["container", "webapp", "database", "queue"];
|
|
618
|
+
var BUILDING_BLOCKS = ["system", "container", "webapp", "component", "database", "queue"];
|
|
619
|
+
function among(types) {
|
|
620
|
+
return { levels: [{ ways: [{ types }] }], edges: "all" };
|
|
621
|
+
}
|
|
622
|
+
function c4Viewpoints() {
|
|
623
|
+
return [
|
|
624
|
+
{
|
|
625
|
+
id: "system-context",
|
|
626
|
+
label: "System context",
|
|
627
|
+
group: "C4",
|
|
628
|
+
description: "The people and software systems, and how they use each other (C4 level 1).",
|
|
629
|
+
kind: "static",
|
|
630
|
+
pipeline: among(["person", "system"])
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
id: "containers",
|
|
634
|
+
label: "Containers",
|
|
635
|
+
group: "C4",
|
|
636
|
+
description: "The software systems with the containers, web apps, databases and queues inside them, the people who use them, and every relation between them (C4 level 2).",
|
|
637
|
+
kind: "static",
|
|
638
|
+
pipeline: among(["person", "system", ...DEPLOYABLE])
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
id: "components",
|
|
642
|
+
label: "Components",
|
|
643
|
+
group: "C4",
|
|
644
|
+
description: "The containers and web apps with the components inside them, the databases and queues they use, and every relation between them (C4 level 3).",
|
|
645
|
+
kind: "static",
|
|
646
|
+
pipeline: among(["container", "webapp", "component", "database", "queue"])
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
id: "container-dependencies",
|
|
650
|
+
label: "Container dependencies",
|
|
651
|
+
group: "C4",
|
|
652
|
+
description: "A matrix of the containers, web apps, databases and queues: who uses whom, and where the cycles are.",
|
|
653
|
+
kind: "matrix",
|
|
654
|
+
pipeline: among(DEPLOYABLE)
|
|
655
|
+
}
|
|
656
|
+
];
|
|
657
|
+
}
|
|
658
|
+
function radicalViewpoints() {
|
|
659
|
+
return [
|
|
660
|
+
...c4Viewpoints(),
|
|
661
|
+
{
|
|
662
|
+
id: "domain-map",
|
|
663
|
+
label: "Domain map",
|
|
664
|
+
group: "Domain",
|
|
665
|
+
description: "The domains and subdomains, and how they depend on and partner with each other.",
|
|
666
|
+
kind: "static",
|
|
667
|
+
pipeline: among(["domain"])
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
id: "domain-model",
|
|
671
|
+
label: "Domain model",
|
|
672
|
+
group: "Domain",
|
|
673
|
+
description: "The entities and aggregates, what they are part of and what they reference.",
|
|
674
|
+
kind: "static",
|
|
675
|
+
pipeline: among(["entity"])
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
id: "domain-realisation",
|
|
679
|
+
label: "Domain realisation",
|
|
680
|
+
group: "Domain",
|
|
681
|
+
description: "A table of domains, their entities, and the systems, containers and components that realise each.",
|
|
682
|
+
kind: "table",
|
|
683
|
+
pipeline: { levels: [
|
|
684
|
+
{ ways: [{ types: ["domain"] }] },
|
|
685
|
+
{ ways: [{ via: { contains: true }, types: ["entity"] }, { via: { relationType: "realises", direction: "in" } }] },
|
|
686
|
+
{ ways: [{ via: { relationType: "realises", direction: "in" } }] }
|
|
687
|
+
] }
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
id: "traceability",
|
|
691
|
+
label: "Traceability",
|
|
692
|
+
group: "Requirements",
|
|
693
|
+
description: "A table of needs, the requirements refined from each, and the scenarios that verify those.",
|
|
694
|
+
kind: "table",
|
|
695
|
+
pipeline: { levels: [
|
|
696
|
+
{ ways: [{ types: ["need"] }] },
|
|
697
|
+
{ ways: [{ via: { relationType: "derives", direction: "in" }, types: ["requirement"] }] },
|
|
698
|
+
{ ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
|
|
699
|
+
] }
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
id: "requirement-coverage",
|
|
703
|
+
label: "Requirement coverage",
|
|
704
|
+
group: "Requirements",
|
|
705
|
+
description: "A table of requirements, the elements that satisfy each and the scenarios that verify it.",
|
|
706
|
+
kind: "table",
|
|
707
|
+
pipeline: { levels: [
|
|
708
|
+
{ ways: [{ types: ["requirement"] }] },
|
|
709
|
+
{ ways: [{ via: { relationType: "satisfies", direction: "in" } }, { via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
|
|
710
|
+
] }
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
id: "requirement-gaps",
|
|
714
|
+
label: "Requirement gaps",
|
|
715
|
+
group: "Requirements",
|
|
716
|
+
description: "The requirements no scenario verifies or nothing satisfies yet.",
|
|
717
|
+
kind: "table",
|
|
718
|
+
pipeline: { levels: [
|
|
719
|
+
{ ways: [{ types: ["requirement"] }], filters: [
|
|
720
|
+
{ kind: "relation", relationType: "verifies", direction: "in", has: false },
|
|
721
|
+
{ kind: "relation", relationType: "satisfies", direction: "in", has: false, join: "or" }
|
|
722
|
+
] }
|
|
723
|
+
] }
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
id: "responsibilities",
|
|
727
|
+
label: "Responsibilities",
|
|
728
|
+
group: "Requirements",
|
|
729
|
+
description: "A table of the systems, containers and components that satisfy requirements, each with its requirements and the scenarios that verify them.",
|
|
730
|
+
kind: "table",
|
|
731
|
+
pipeline: { levels: [
|
|
732
|
+
{ ways: [{ types: BUILDING_BLOCKS }], filters: [{ kind: "relation", relationType: "satisfies", direction: "out", has: true }] },
|
|
733
|
+
{ ways: [{ via: { relationType: "satisfies", direction: "out" }, types: ["requirement"] }] },
|
|
734
|
+
{ ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
|
|
735
|
+
] }
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: "specification",
|
|
739
|
+
label: "Specification",
|
|
740
|
+
group: "Requirements",
|
|
741
|
+
description: "A document of the needs, the requirements refined from each, and the scenarios and screens for each requirement.",
|
|
742
|
+
kind: "wiki",
|
|
743
|
+
pipeline: { levels: [
|
|
744
|
+
{ ways: [{ types: ["need"] }] },
|
|
745
|
+
{ ways: [{ via: { relationType: "derives", direction: "in" }, types: ["requirement"] }] },
|
|
746
|
+
{ ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }, { via: { relationType: "illustrates", direction: "in" }, types: ["mockup"] }] }
|
|
747
|
+
] }
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
id: "decisions",
|
|
751
|
+
label: "Decisions",
|
|
752
|
+
group: "Decisions",
|
|
753
|
+
description: "A table of ADRs, the fitness functions that check each and the elements it constrains.",
|
|
754
|
+
kind: "table",
|
|
755
|
+
pipeline: { levels: [
|
|
756
|
+
{ ways: [{ types: ["adr"] }] },
|
|
757
|
+
{ ways: [{ via: { relationType: "implements", direction: "in" }, types: ["fitness-fn"] }, { via: { relationType: "constrains", direction: "out" } }] }
|
|
758
|
+
] }
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
id: "decision-log",
|
|
762
|
+
label: "Decision log",
|
|
763
|
+
group: "Decisions",
|
|
764
|
+
description: "A document of the ADRs, the newest first, each with the decisions it supersedes.",
|
|
765
|
+
kind: "wiki",
|
|
766
|
+
pipeline: {
|
|
767
|
+
levels: [
|
|
768
|
+
{ ways: [{ types: ["adr"] }] },
|
|
769
|
+
{ ways: [{ via: { relationType: "supersedes", direction: "out" }, types: ["adr"] }] }
|
|
770
|
+
],
|
|
771
|
+
sort: { by: "property", key: "date", desc: true }
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
id: "fitness-functions",
|
|
776
|
+
label: "Fitness functions",
|
|
777
|
+
group: "Decisions",
|
|
778
|
+
description: "A table of the fitness functions by category, each with the decisions it checks and the elements it constrains.",
|
|
779
|
+
kind: "table",
|
|
780
|
+
pipeline: {
|
|
781
|
+
levels: [
|
|
782
|
+
{ ways: [{ types: ["fitness-fn"] }] },
|
|
783
|
+
{ ways: [{ via: { relationType: "implements", direction: "out" }, types: ["adr"] }, { via: { relationType: "constrains", direction: "out" } }] }
|
|
784
|
+
],
|
|
785
|
+
sort: { by: "property", key: "category" }
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
id: "screen-flow",
|
|
790
|
+
label: "Screen flow",
|
|
791
|
+
group: "UX",
|
|
792
|
+
description: "The screens and how users navigate from one to the next.",
|
|
793
|
+
kind: "static",
|
|
794
|
+
pipeline: among(["mockup"])
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
id: "screens",
|
|
798
|
+
label: "Screens",
|
|
799
|
+
group: "UX",
|
|
800
|
+
description: "A table of the screens, each with the requirements and scenarios it illustrates and the elements that present it.",
|
|
801
|
+
kind: "table",
|
|
802
|
+
pipeline: { levels: [
|
|
803
|
+
{ ways: [{ types: ["mockup"] }] },
|
|
804
|
+
{ ways: [{ via: { relationType: "illustrates", direction: "out" } }, { via: { relationType: "presented-by", direction: "out" } }] }
|
|
805
|
+
] }
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
id: "entity-lifecycles",
|
|
809
|
+
label: "Entity lifecycles",
|
|
810
|
+
group: "States",
|
|
811
|
+
description: "A table of the entities with a lifecycle, the state machine of each, and what implements and verifies it.",
|
|
812
|
+
kind: "table",
|
|
813
|
+
pipeline: { levels: [
|
|
814
|
+
{ ways: [{ types: ["entity"] }], filters: [{ kind: "relation", relationType: "lifecycle-of", direction: "in", has: true }] },
|
|
815
|
+
{ ways: [{ via: { relationType: "lifecycle-of", direction: "in" }, types: ["state-machine"] }] },
|
|
816
|
+
{ ways: [{ via: { relationType: "implements", direction: "in" } }, { via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
|
|
817
|
+
] }
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
id: "event-catalogue",
|
|
821
|
+
label: "Event catalogue",
|
|
822
|
+
group: "States",
|
|
823
|
+
description: "A table of the events, each with what emits it.",
|
|
824
|
+
kind: "table",
|
|
825
|
+
pipeline: { levels: [
|
|
826
|
+
{ ways: [{ types: ["event"] }] },
|
|
827
|
+
{ ways: [{ via: { relationType: "emits", direction: "in" } }] }
|
|
828
|
+
] }
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
id: "process-warnier",
|
|
832
|
+
label: "Process (Warnier)",
|
|
833
|
+
group: "Process",
|
|
834
|
+
description: "The processes and their steps as Warnier\u2013Orr diagrams: what each is made of, what repeats, what is an alternative and what runs at once.",
|
|
835
|
+
kind: "warnier",
|
|
836
|
+
pipeline: { levels: [{ ways: [{ types: ["process", "step"] }] }] }
|
|
837
|
+
}
|
|
838
|
+
];
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// ../../packages/common/src/metamodel/presets/c4.ts
|
|
842
|
+
var VISUALS = {
|
|
843
|
+
person: {
|
|
844
|
+
label: "Person",
|
|
845
|
+
color: "#08427b",
|
|
846
|
+
fg: "#fff",
|
|
847
|
+
description: "Someone who uses or runs the system: a customer, an operator, another team.",
|
|
848
|
+
iconPath: "M8 2a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5ZM3 12.5C3 10.01 5.24 8 8 8s5 2.01 5 4.5V14H3v-1.5Z",
|
|
849
|
+
width: 150,
|
|
850
|
+
height: 170,
|
|
851
|
+
collapsedWidth: 150,
|
|
852
|
+
collapsedHeight: 170
|
|
853
|
+
},
|
|
854
|
+
system: {
|
|
855
|
+
label: "Software System",
|
|
856
|
+
color: "#1168bd",
|
|
857
|
+
fg: "#fff",
|
|
858
|
+
description: "Something that delivers value to its users and is owned by one team: yours, or one you depend on.",
|
|
859
|
+
iconPath: "M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5v-9ZM4 5h8v1H4V5Zm0 2.5h8v1H4v-1Zm0 2.5h5v1H4V10Z",
|
|
860
|
+
width: 360,
|
|
861
|
+
height: 260,
|
|
862
|
+
collapsedWidth: 280,
|
|
863
|
+
collapsedHeight: 180
|
|
864
|
+
},
|
|
865
|
+
container: {
|
|
866
|
+
label: "Container",
|
|
867
|
+
color: "#438dd5",
|
|
868
|
+
fg: "#fff",
|
|
869
|
+
description: "Something that runs or stores data and is deployed on its own: a service, a worker, a mobile app, a serverless function.",
|
|
870
|
+
iconPath: "M1 4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1H1V4Zm0 2.5h14V12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V6.5ZM3 3a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm2 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
|
|
871
|
+
width: 300,
|
|
872
|
+
height: 200,
|
|
873
|
+
collapsedWidth: 240,
|
|
874
|
+
collapsedHeight: 160
|
|
875
|
+
},
|
|
876
|
+
component: {
|
|
877
|
+
label: "Component",
|
|
878
|
+
color: "#85bbf0",
|
|
879
|
+
fg: "#000",
|
|
880
|
+
description: "A part of a container behind a clear interface: a controller, a domain service, an adapter.",
|
|
881
|
+
iconPath: "M5 1v2H3a1 1 0 0 0-1 1v2h2v2H2v2h2v2H2v2a1 1 0 0 0 1 1h2v2h2v-2h2v2h2v-2h2a1 1 0 0 0 1-1v-2h-2v-2h2V8h-2V6h2V4a1 1 0 0 0-1-1h-2V1H9v2H7V1H5Z",
|
|
882
|
+
width: 200,
|
|
883
|
+
height: 120,
|
|
884
|
+
collapsedWidth: 200,
|
|
885
|
+
collapsedHeight: 120
|
|
886
|
+
},
|
|
887
|
+
database: {
|
|
888
|
+
label: "Database",
|
|
889
|
+
color: "#438dd5",
|
|
890
|
+
fg: "#fff",
|
|
891
|
+
description: "A container that stores data. It never starts an interaction.",
|
|
892
|
+
iconPath: "M8 1C4.7 1 2 2.3 2 4v8c0 1.7 2.7 3 6 3s6-1.3 6-3V4c0-1.7-2.7-3-6-3ZM2 4c0 1.7 2.7 3 6 3s6-1.3 6-3",
|
|
893
|
+
width: 190,
|
|
894
|
+
height: 130,
|
|
895
|
+
collapsedWidth: 190,
|
|
896
|
+
collapsedHeight: 130
|
|
897
|
+
},
|
|
898
|
+
webapp: {
|
|
899
|
+
label: "Web App",
|
|
900
|
+
color: "#438dd5",
|
|
901
|
+
fg: "#fff",
|
|
902
|
+
description: "A container that is a browser front end.",
|
|
903
|
+
iconPath: "M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3Zm1 2.5V13h10V5.5H3ZM4 3.5a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm1.5 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm1.5 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
|
|
904
|
+
width: 210,
|
|
905
|
+
height: 140,
|
|
906
|
+
collapsedWidth: 210,
|
|
907
|
+
collapsedHeight: 140
|
|
908
|
+
},
|
|
909
|
+
queue: {
|
|
910
|
+
label: "Queue",
|
|
911
|
+
color: "#438dd5",
|
|
912
|
+
fg: "#fff",
|
|
913
|
+
description: "A container that carries messages between other containers.",
|
|
914
|
+
iconPath: "M4 3a3 2 0 1 0 0 4h8a3 2 0 1 0 0-4H4Zm-2 5.5a3 2 0 0 0 4 0v-1a3 2 0 0 1-4 0v1Zm10 0a3 2 0 0 0 4 0v-1a3 2 0 0 1-4 0v1Z",
|
|
915
|
+
width: 220,
|
|
916
|
+
height: 95,
|
|
917
|
+
collapsedWidth: 220,
|
|
918
|
+
collapsedHeight: 95
|
|
919
|
+
},
|
|
920
|
+
group: {
|
|
921
|
+
label: "Group",
|
|
922
|
+
color: "#64748b",
|
|
923
|
+
fg: "#fff",
|
|
924
|
+
description: "A labelled boundary with no meaning of its own: a team, a layer, a deployment zone.",
|
|
925
|
+
// Folder icon.
|
|
926
|
+
iconPath: "M2 3.5C2 2.67 2.67 2 3.5 2H7l1.5 2h4c.83 0 1.5.67 1.5 1.5v7c0 .83-.67 1.5-1.5 1.5h-9C2.67 14 2 13.33 2 12.5v-9Z",
|
|
927
|
+
width: 520,
|
|
928
|
+
height: 360,
|
|
929
|
+
collapsedWidth: 360,
|
|
930
|
+
collapsedHeight: 220
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
function builtInC4Metamodel() {
|
|
934
|
+
const nodeTypes = {};
|
|
935
|
+
const allowedParentsMap = {
|
|
936
|
+
person: ["group"],
|
|
937
|
+
system: ["system", "group"],
|
|
938
|
+
container: ["system", "group"],
|
|
939
|
+
component: ["container", "webapp", "group"],
|
|
940
|
+
database: ["system", "group"],
|
|
941
|
+
webapp: ["system", "group"],
|
|
942
|
+
queue: ["system", "group"],
|
|
943
|
+
group: ["group", "system"]
|
|
944
|
+
};
|
|
945
|
+
const techTypes = /* @__PURE__ */ new Set(["container", "component", "database", "webapp", "queue"]);
|
|
946
|
+
const types = [
|
|
947
|
+
"person",
|
|
948
|
+
"system",
|
|
949
|
+
"container",
|
|
950
|
+
"component",
|
|
951
|
+
"database",
|
|
952
|
+
"webapp",
|
|
953
|
+
"queue",
|
|
954
|
+
"group"
|
|
955
|
+
];
|
|
956
|
+
for (const t of types) {
|
|
957
|
+
const props = [
|
|
958
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
959
|
+
];
|
|
960
|
+
if (techTypes.has(t)) props.push({ key: "technology", label: "Technology", type: "text" });
|
|
961
|
+
if (t !== "group") props.push({ key: "external", label: "External", type: "boolean" });
|
|
962
|
+
const v = VISUALS[t];
|
|
963
|
+
nodeTypes[t] = {
|
|
964
|
+
id: t,
|
|
965
|
+
label: v.label,
|
|
966
|
+
description: v.description,
|
|
967
|
+
color: v.color,
|
|
968
|
+
fg: v.fg,
|
|
969
|
+
iconPath: v.iconPath,
|
|
970
|
+
width: v.width,
|
|
971
|
+
height: v.height,
|
|
972
|
+
collapsedWidth: v.collapsedWidth,
|
|
973
|
+
collapsedHeight: v.collapsedHeight,
|
|
974
|
+
allowedParents: allowedParentsMap[t],
|
|
975
|
+
// person, system, and group are top-level concepts and may live at the root.
|
|
976
|
+
allowedAtRoot: t === "person" || t === "system" || t === "group",
|
|
977
|
+
builtin: true,
|
|
978
|
+
properties: props
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
const interactsPairs = [
|
|
982
|
+
// Person interacts with the system surface
|
|
983
|
+
{ from: "person", to: "system" },
|
|
984
|
+
{ from: "person", to: "container" },
|
|
985
|
+
{ from: "person", to: "webapp" },
|
|
986
|
+
{ from: "person", to: "component" },
|
|
987
|
+
// System-level dependencies
|
|
988
|
+
{ from: "system", to: "person" },
|
|
989
|
+
{ from: "system", to: "system" },
|
|
990
|
+
{ from: "system", to: "container" },
|
|
991
|
+
{ from: "system", to: "database" },
|
|
992
|
+
{ from: "system", to: "webapp" },
|
|
993
|
+
{ from: "system", to: "queue" },
|
|
994
|
+
{ from: "system", to: "component" },
|
|
995
|
+
// Container-level calls
|
|
996
|
+
{ from: "container", to: "person" },
|
|
997
|
+
{ from: "container", to: "system" },
|
|
998
|
+
{ from: "container", to: "container" },
|
|
999
|
+
{ from: "container", to: "database" },
|
|
1000
|
+
{ from: "container", to: "webapp" },
|
|
1001
|
+
{ from: "container", to: "queue" },
|
|
1002
|
+
// Web / UI container
|
|
1003
|
+
{ from: "webapp", to: "person" },
|
|
1004
|
+
{ from: "webapp", to: "system" },
|
|
1005
|
+
{ from: "webapp", to: "container" },
|
|
1006
|
+
{ from: "webapp", to: "database" },
|
|
1007
|
+
{ from: "webapp", to: "webapp" },
|
|
1008
|
+
{ from: "webapp", to: "queue" },
|
|
1009
|
+
// Queues fan out to consumers
|
|
1010
|
+
{ from: "queue", to: "container" },
|
|
1011
|
+
{ from: "queue", to: "webapp" },
|
|
1012
|
+
{ from: "queue", to: "component" },
|
|
1013
|
+
// Component-level calls
|
|
1014
|
+
{ from: "component", to: "component" },
|
|
1015
|
+
{ from: "component", to: "container" },
|
|
1016
|
+
{ from: "component", to: "webapp" },
|
|
1017
|
+
{ from: "component", to: "database" },
|
|
1018
|
+
{ from: "component", to: "queue" },
|
|
1019
|
+
{ from: "component", to: "system" }
|
|
1020
|
+
];
|
|
1021
|
+
const relationTypes = {
|
|
1022
|
+
interacts: {
|
|
1023
|
+
id: "interacts",
|
|
1024
|
+
label: "Interacts",
|
|
1025
|
+
description: "Any meaningful interaction: the source calls, uses, sends to or delivers to the target. The label says what happens, the technology how.",
|
|
1026
|
+
forwardLabel: "Uses",
|
|
1027
|
+
inverseLabel: "Used by",
|
|
1028
|
+
allowedPairs: interactsPairs,
|
|
1029
|
+
properties: [
|
|
1030
|
+
{ key: "technology", label: "Technology", type: "text" }
|
|
1031
|
+
],
|
|
1032
|
+
builtin: true
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
return { id: "c4-builtin", name: "C4 (built-in)", nodeTypes, relationTypes, viewpoints: c4Viewpoints() };
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// ../../packages/common/src/metamodel/presets/ddd.ts
|
|
1039
|
+
function builtInDddC4Metamodel() {
|
|
1040
|
+
const base = builtInC4Metamodel();
|
|
1041
|
+
const patchedSystem = {
|
|
1042
|
+
...base.nodeTypes.system,
|
|
1043
|
+
allowedParents: ["system", "domain", "group"],
|
|
1044
|
+
allowedAtRoot: true
|
|
1045
|
+
};
|
|
1046
|
+
const domainProps = [
|
|
1047
|
+
{ key: "description", label: "Description", type: "textarea" },
|
|
1048
|
+
{ key: "vision", label: "Vision", type: "textarea" },
|
|
1049
|
+
{
|
|
1050
|
+
key: "kind",
|
|
1051
|
+
label: "Kind",
|
|
1052
|
+
type: "enum",
|
|
1053
|
+
options: ["core", "supporting", "generic"],
|
|
1054
|
+
default: "core"
|
|
1055
|
+
}
|
|
1056
|
+
];
|
|
1057
|
+
const domain = {
|
|
1058
|
+
id: "domain",
|
|
1059
|
+
label: "Domain",
|
|
1060
|
+
description: "A part of the problem space, in the language of the business rather than of the software.",
|
|
1061
|
+
color: "#4c1d95",
|
|
1062
|
+
fg: "#fff",
|
|
1063
|
+
iconPath: "M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5v-9Zm1.5 1A.5.5 0 0 0 3 5v6a.5.5 0 0 0 .5.5h9A.5.5 0 0 0 13 11V5a.5.5 0 0 0-.5-.5h-9ZM5 7h2v2H5V7Zm4 0h2v2H9V7Z",
|
|
1064
|
+
width: 520,
|
|
1065
|
+
height: 360,
|
|
1066
|
+
collapsedWidth: 360,
|
|
1067
|
+
collapsedHeight: 220,
|
|
1068
|
+
// A domain may be nested inside another domain or a group.
|
|
1069
|
+
allowedParents: ["domain", "group"],
|
|
1070
|
+
allowedAtRoot: true,
|
|
1071
|
+
builtin: true,
|
|
1072
|
+
properties: domainProps
|
|
1073
|
+
};
|
|
1074
|
+
const entity = {
|
|
1075
|
+
id: "entity",
|
|
1076
|
+
label: "Entity",
|
|
1077
|
+
description: "A thing the domain keeps track of and that has an identity over time: a reservation, an order, a payment.",
|
|
1078
|
+
color: "#7e22ce",
|
|
1079
|
+
fg: "#fff",
|
|
1080
|
+
// A record card with a key
|
|
1081
|
+
iconPath: "M3 2.5A1.5 1.5 0 0 1 4.5 1h7A1.5 1.5 0 0 1 13 2.5v11a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 13.5v-11ZM4.5 2a.5.5 0 0 0-.5.5V5h8V2.5a.5.5 0 0 0-.5-.5h-7ZM12 6H4v1.5h8V6Zm0 2.5H4V10h8V8.5Zm0 2.5H4v2.5c0 .28.22.5.5.5h7a.5.5 0 0 0 .5-.5V11Z",
|
|
1082
|
+
width: 170,
|
|
1083
|
+
height: 56,
|
|
1084
|
+
allowedParents: ["domain", "group"],
|
|
1085
|
+
allowedAtRoot: true,
|
|
1086
|
+
builtin: true,
|
|
1087
|
+
// The parts of an aggregate list under its root in Table and Wiki views.
|
|
1088
|
+
hierarchyRelation: "part-of",
|
|
1089
|
+
properties: [
|
|
1090
|
+
{
|
|
1091
|
+
key: "kind",
|
|
1092
|
+
label: "Kind",
|
|
1093
|
+
type: "enum",
|
|
1094
|
+
options: ["aggregate-root", "entity"],
|
|
1095
|
+
default: "aggregate-root"
|
|
1096
|
+
},
|
|
1097
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1098
|
+
]
|
|
1099
|
+
};
|
|
1100
|
+
const realises = {
|
|
1101
|
+
id: "realises",
|
|
1102
|
+
label: "Realises",
|
|
1103
|
+
description: "The software behind a domain or an entity: the bounded context that implements the domain, or the element that owns the entity's data.",
|
|
1104
|
+
inverseLabel: "Realised by",
|
|
1105
|
+
allowedPairs: [
|
|
1106
|
+
{ from: "system", to: "domain" },
|
|
1107
|
+
{ from: "container", to: "domain" },
|
|
1108
|
+
...["system", "container", "component", "webapp"].map((from) => ({ from, to: "entity" }))
|
|
1109
|
+
],
|
|
1110
|
+
properties: [],
|
|
1111
|
+
builtin: true
|
|
1112
|
+
};
|
|
1113
|
+
const partOf = {
|
|
1114
|
+
id: "part-of",
|
|
1115
|
+
label: "Part of",
|
|
1116
|
+
description: "A part of an aggregate points to its root.",
|
|
1117
|
+
inverseLabel: "Made up of",
|
|
1118
|
+
allowedPairs: [{ from: "entity", to: "entity" }],
|
|
1119
|
+
properties: [],
|
|
1120
|
+
color: "#7e22ce",
|
|
1121
|
+
builtin: true
|
|
1122
|
+
};
|
|
1123
|
+
const references = {
|
|
1124
|
+
id: "references",
|
|
1125
|
+
label: "References",
|
|
1126
|
+
description: "One aggregate refers to another by id.",
|
|
1127
|
+
inverseLabel: "Referenced by",
|
|
1128
|
+
allowedPairs: [{ from: "entity", to: "entity" }],
|
|
1129
|
+
properties: [
|
|
1130
|
+
{
|
|
1131
|
+
key: "cardinality",
|
|
1132
|
+
label: "Cardinality",
|
|
1133
|
+
type: "enum",
|
|
1134
|
+
options: ["one", "many"],
|
|
1135
|
+
default: "one"
|
|
1136
|
+
},
|
|
1137
|
+
{ key: "description", label: "Description", type: "text" }
|
|
1138
|
+
],
|
|
1139
|
+
color: "#a855f7",
|
|
1140
|
+
builtin: true
|
|
1141
|
+
};
|
|
1142
|
+
const ddPairs = [
|
|
1143
|
+
{ from: "domain", to: "domain" }
|
|
1144
|
+
];
|
|
1145
|
+
const dependsOn = {
|
|
1146
|
+
id: "depends-on",
|
|
1147
|
+
label: "Depends on",
|
|
1148
|
+
description: "The source domain needs the target to do its work.",
|
|
1149
|
+
inverseLabel: "Depended on by",
|
|
1150
|
+
allowedPairs: ddPairs,
|
|
1151
|
+
properties: [
|
|
1152
|
+
{ key: "description", label: "Description", type: "text" }
|
|
1153
|
+
],
|
|
1154
|
+
builtin: true
|
|
1155
|
+
};
|
|
1156
|
+
const partnership = {
|
|
1157
|
+
id: "partnership",
|
|
1158
|
+
label: "Partnership",
|
|
1159
|
+
description: "How the models of two domains meet, with a context-mapping pattern.",
|
|
1160
|
+
forwardLabel: "Partners with",
|
|
1161
|
+
inverseLabel: "Partners with",
|
|
1162
|
+
allowedPairs: ddPairs,
|
|
1163
|
+
properties: [
|
|
1164
|
+
{
|
|
1165
|
+
key: "pattern",
|
|
1166
|
+
label: "Pattern",
|
|
1167
|
+
type: "enum",
|
|
1168
|
+
options: [
|
|
1169
|
+
"partnership",
|
|
1170
|
+
"shared-kernel",
|
|
1171
|
+
"customer-supplier",
|
|
1172
|
+
"conformist",
|
|
1173
|
+
"anti-corruption-layer",
|
|
1174
|
+
"open-host-service",
|
|
1175
|
+
"published-language",
|
|
1176
|
+
"separate-ways"
|
|
1177
|
+
],
|
|
1178
|
+
default: "partnership"
|
|
1179
|
+
},
|
|
1180
|
+
{ key: "description", label: "Description", type: "text" }
|
|
1181
|
+
],
|
|
1182
|
+
builtin: true
|
|
1183
|
+
};
|
|
1184
|
+
return {
|
|
1185
|
+
id: "c4-ddd-builtin",
|
|
1186
|
+
name: "C4 + DDD Domains",
|
|
1187
|
+
nodeTypes: {
|
|
1188
|
+
...base.nodeTypes,
|
|
1189
|
+
system: patchedSystem,
|
|
1190
|
+
domain,
|
|
1191
|
+
entity
|
|
1192
|
+
},
|
|
1193
|
+
relationTypes: {
|
|
1194
|
+
...base.relationTypes,
|
|
1195
|
+
realises,
|
|
1196
|
+
"part-of": partOf,
|
|
1197
|
+
references,
|
|
1198
|
+
"depends-on": dependsOn,
|
|
1199
|
+
partnership
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// ../../packages/common/src/metamodel/presets/governance.ts
|
|
1205
|
+
var RADICAL_METAMODEL_NAME = "Radical";
|
|
1206
|
+
var TESTS_PROPERTY = {
|
|
1207
|
+
key: "tests",
|
|
1208
|
+
label: "Tests (one per line: file \u203A title)",
|
|
1209
|
+
type: "textarea"
|
|
1210
|
+
};
|
|
1211
|
+
function builtInGovernanceMetamodel() {
|
|
1212
|
+
const base = builtInDddC4Metamodel();
|
|
1213
|
+
const adrProps = [
|
|
1214
|
+
{
|
|
1215
|
+
key: "status",
|
|
1216
|
+
label: "Status",
|
|
1217
|
+
type: "enum",
|
|
1218
|
+
options: ["proposed", "accepted", "deprecated", "superseded"],
|
|
1219
|
+
default: "proposed"
|
|
1220
|
+
},
|
|
1221
|
+
{ key: "date", label: "Date", type: "text" },
|
|
1222
|
+
{ key: "context", label: "Context", type: "textarea" },
|
|
1223
|
+
{ key: "decision", label: "Decision", type: "textarea" },
|
|
1224
|
+
{ key: "consequences", label: "Consequences", type: "textarea" },
|
|
1225
|
+
{ key: "alternatives", label: "Alternatives considered", type: "textarea" }
|
|
1226
|
+
];
|
|
1227
|
+
const adr = {
|
|
1228
|
+
id: "adr",
|
|
1229
|
+
label: "ADR",
|
|
1230
|
+
description: "An architecture decision record: the context of a decision, the decision itself, its consequences and the alternatives that were considered.",
|
|
1231
|
+
color: "#92400e",
|
|
1232
|
+
fg: "#fff",
|
|
1233
|
+
// ADR: document with text lines
|
|
1234
|
+
iconPath: "M4.5 1C3.67 1 3 1.67 3 2.5v11c0 .83.67 1.5 1.5 1.5h7c.83 0 1.5-.67 1.5-1.5V6L9 1H4.5ZM9 2l3 3.5H9V2ZM5 8h6v1H5V8Zm0 2.5h6v1H5v-1Zm0 2.5h3.5v1H5V13Z",
|
|
1235
|
+
width: 180,
|
|
1236
|
+
height: 52,
|
|
1237
|
+
collapsedWidth: 160,
|
|
1238
|
+
collapsedHeight: 52,
|
|
1239
|
+
allowedParents: ["system", "domain", "group"],
|
|
1240
|
+
allowedAtRoot: true,
|
|
1241
|
+
builtin: true,
|
|
1242
|
+
properties: adrProps,
|
|
1243
|
+
wizard: {
|
|
1244
|
+
trigger: "create",
|
|
1245
|
+
prefill: { status: "proposed", date: "{{today}}" },
|
|
1246
|
+
steps: [
|
|
1247
|
+
{
|
|
1248
|
+
kind: "fields",
|
|
1249
|
+
title: "Title & status",
|
|
1250
|
+
fields: ["label", "status", "date"],
|
|
1251
|
+
help: 'Name the decision in a few words, e.g. "Use PostgreSQL for order storage".'
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
kind: "fields",
|
|
1255
|
+
title: "Context",
|
|
1256
|
+
fields: ["context"],
|
|
1257
|
+
help: "What forces are at play \u2014 the problem, constraints and drivers that make a decision necessary now?"
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
kind: "fields",
|
|
1261
|
+
title: "Decision",
|
|
1262
|
+
fields: ["decision"],
|
|
1263
|
+
help: 'What did you decide? State it actively: "We will \u2026".'
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
kind: "fields",
|
|
1267
|
+
title: "Alternatives",
|
|
1268
|
+
fields: ["alternatives"],
|
|
1269
|
+
help: "Which other options did you consider, and why were they rejected?"
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
kind: "fields",
|
|
1273
|
+
title: "Consequences",
|
|
1274
|
+
fields: ["consequences"],
|
|
1275
|
+
help: "What becomes easier or harder? Include the downsides and the risks you accept."
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
kind: "relations",
|
|
1279
|
+
title: "Affected elements",
|
|
1280
|
+
relationType: "constrains",
|
|
1281
|
+
direction: "out",
|
|
1282
|
+
help: "Which parts of the architecture must follow this decision?"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
kind: "relations",
|
|
1286
|
+
title: "Supersedes",
|
|
1287
|
+
relationType: "supersedes",
|
|
1288
|
+
direction: "out",
|
|
1289
|
+
help: "Does this decision replace an earlier one? Leave empty if not."
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
const fitnessFnProps = [
|
|
1295
|
+
{ key: "description", label: "Description", type: "textarea" },
|
|
1296
|
+
{
|
|
1297
|
+
key: "category",
|
|
1298
|
+
label: "Category",
|
|
1299
|
+
type: "enum",
|
|
1300
|
+
options: ["structural", "operational", "process", "holistic"],
|
|
1301
|
+
default: "structural"
|
|
1302
|
+
},
|
|
1303
|
+
{ key: "threshold", label: "Threshold / Success criteria", type: "text" },
|
|
1304
|
+
TESTS_PROPERTY
|
|
1305
|
+
];
|
|
1306
|
+
const fitnessFn = {
|
|
1307
|
+
id: "fitness-fn",
|
|
1308
|
+
label: "Fitness Function",
|
|
1309
|
+
description: "An objective, preferably automated check that the architecture still has a property it was designed for.",
|
|
1310
|
+
color: "#5b21b6",
|
|
1311
|
+
fg: "#fff",
|
|
1312
|
+
// Concentric circles (target / gauge)
|
|
1313
|
+
iconPath: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 1.5a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9ZM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Zm0 1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z",
|
|
1314
|
+
width: 180,
|
|
1315
|
+
height: 52,
|
|
1316
|
+
collapsedWidth: 160,
|
|
1317
|
+
collapsedHeight: 52,
|
|
1318
|
+
allowedParents: ["system", "domain", "group"],
|
|
1319
|
+
allowedAtRoot: true,
|
|
1320
|
+
builtin: true,
|
|
1321
|
+
properties: fitnessFnProps,
|
|
1322
|
+
wizard: {
|
|
1323
|
+
trigger: "create",
|
|
1324
|
+
steps: [
|
|
1325
|
+
{
|
|
1326
|
+
kind: "fields",
|
|
1327
|
+
title: "Name & category",
|
|
1328
|
+
fields: ["label", "category"],
|
|
1329
|
+
help: 'Name the architectural characteristic this function protects, e.g. "Checkout p95 latency".'
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
kind: "fields",
|
|
1333
|
+
title: "What it measures",
|
|
1334
|
+
fields: ["description"],
|
|
1335
|
+
help: "How is the characteristic measured \u2014 a test, a metric, a static check?"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
kind: "fields",
|
|
1339
|
+
title: "Success criteria",
|
|
1340
|
+
fields: ["threshold"],
|
|
1341
|
+
help: 'When does it pass? Give a concrete threshold, e.g. "p95 < 300 ms".'
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
kind: "relations",
|
|
1345
|
+
title: "Verified decisions",
|
|
1346
|
+
relationType: "implements",
|
|
1347
|
+
direction: "out",
|
|
1348
|
+
help: "Which ADRs does this fitness function verify?"
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
kind: "relations",
|
|
1352
|
+
title: "Guarded elements",
|
|
1353
|
+
relationType: "constrains",
|
|
1354
|
+
direction: "out",
|
|
1355
|
+
help: "Which elements does it check?"
|
|
1356
|
+
}
|
|
1357
|
+
]
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
const needProps = [
|
|
1361
|
+
{ key: "description", label: "Text", type: "textarea" },
|
|
1362
|
+
{
|
|
1363
|
+
key: "kind",
|
|
1364
|
+
label: "Kind",
|
|
1365
|
+
type: "enum",
|
|
1366
|
+
options: ["brief", "user-story", "stakeholder-note", "meeting-notes", "regulation", "other"],
|
|
1367
|
+
default: "brief"
|
|
1368
|
+
},
|
|
1369
|
+
{ key: "source", label: "Source (who / where from)", type: "text" }
|
|
1370
|
+
];
|
|
1371
|
+
const need = {
|
|
1372
|
+
id: "need",
|
|
1373
|
+
label: "Need",
|
|
1374
|
+
description: "Raw input in the stakeholder's own words, kept verbatim: a brief, a user story, a note, a regulation.",
|
|
1375
|
+
color: "#475569",
|
|
1376
|
+
fg: "#fff",
|
|
1377
|
+
// Speech bubble with text lines
|
|
1378
|
+
iconPath: "M3 2a1.5 1.5 0 0 0-1.5 1.5v7A1.5 1.5 0 0 0 3 12h1.5v2.5L8 12h5a1.5 1.5 0 0 0 1.5-1.5v-7A1.5 1.5 0 0 0 13 2H3Zm1.5 3h7v1h-7V5Zm0 2.5h5v1h-5v-1Z",
|
|
1379
|
+
width: 200,
|
|
1380
|
+
height: 80,
|
|
1381
|
+
collapsedWidth: 180,
|
|
1382
|
+
collapsedHeight: 80,
|
|
1383
|
+
allowedParents: ["system", "domain", "group"],
|
|
1384
|
+
allowedAtRoot: true,
|
|
1385
|
+
builtin: true,
|
|
1386
|
+
// A need's wiki page and table tab list what derives from it — sub-needs
|
|
1387
|
+
// and requirements — as its children; "add child" creates either.
|
|
1388
|
+
hierarchyRelation: "derives",
|
|
1389
|
+
properties: needProps,
|
|
1390
|
+
wizard: {
|
|
1391
|
+
trigger: "create",
|
|
1392
|
+
steps: [
|
|
1393
|
+
{
|
|
1394
|
+
kind: "fields",
|
|
1395
|
+
title: "Name & kind",
|
|
1396
|
+
fields: ["label", "kind"],
|
|
1397
|
+
help: 'A short name, e.g. "Checkout brief from Sales". Pick what kind of input it is.'
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
kind: "fields",
|
|
1401
|
+
title: "Text",
|
|
1402
|
+
fields: ["description"],
|
|
1403
|
+
help: "Paste the input as-is \u2014 a brief, user story, notes or raw requirements. No format needed; Radical Forge or you can turn it into EARS requirements later."
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
kind: "fields",
|
|
1407
|
+
title: "Source",
|
|
1408
|
+
fields: ["source"],
|
|
1409
|
+
help: "Who it came from or where it lives (a person, meeting, ticket or link)."
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
kind: "relations",
|
|
1413
|
+
title: "Part of",
|
|
1414
|
+
relationType: "derives",
|
|
1415
|
+
direction: "out",
|
|
1416
|
+
help: "Is this part of a broader need, e.g. one stakeholder's notes within a discovery? Leave empty if not."
|
|
1417
|
+
}
|
|
1418
|
+
]
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
const requirementProps = [
|
|
1422
|
+
{
|
|
1423
|
+
key: "ears_type",
|
|
1424
|
+
label: "EARS type",
|
|
1425
|
+
type: "enum",
|
|
1426
|
+
options: ["ubiquitous", "event-driven", "state-driven", "unwanted-behaviour", "optional", "complex"],
|
|
1427
|
+
default: "ubiquitous"
|
|
1428
|
+
},
|
|
1429
|
+
{ key: "trigger", label: "When (trigger)", type: "text", visibleWhen: { key: "ears_type", values: ["event-driven", "complex"] } },
|
|
1430
|
+
{ key: "precondition", label: "While (precondition)", type: "text", visibleWhen: { key: "ears_type", values: ["state-driven", "complex"] } },
|
|
1431
|
+
// The state the precondition is, when it is one of a state machine's:
|
|
1432
|
+
// "While the Reservation is Confirmed". Takes the place of the text.
|
|
1433
|
+
{ key: "precondition_state", label: "While in state", type: "ref", refType: "state", visibleWhen: { key: "ears_type", values: ["state-driven", "complex"] } },
|
|
1434
|
+
{ key: "unwanted_condition", label: "If (unwanted condition)", type: "text", visibleWhen: { key: "ears_type", values: ["unwanted-behaviour", "complex"] } },
|
|
1435
|
+
{ key: "feature", label: "Where (feature)", type: "text", visibleWhen: { key: "ears_type", values: ["optional", "complex"] } },
|
|
1436
|
+
{ key: "action", label: "The system shall (action)", type: "textarea" },
|
|
1437
|
+
{ key: "rationale", label: "Rationale", type: "textarea" }
|
|
1438
|
+
];
|
|
1439
|
+
const requirement = {
|
|
1440
|
+
id: "requirement",
|
|
1441
|
+
label: "Requirement",
|
|
1442
|
+
description: "One thing the system shall do, written as an EARS sentence.",
|
|
1443
|
+
color: "#0e7490",
|
|
1444
|
+
fg: "#fff",
|
|
1445
|
+
// Checklist / clipboard with checkmark
|
|
1446
|
+
iconPath: "M5 1a1 1 0 0 0-1 1H3a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1h-1a1 1 0 0 0-1-1H5Zm0 1h6v1H5V2ZM4 5.5h1.5v1.5H4V5.5Zm3 .25h5v1H7v-1ZM4 9h1.5v1.5H4V9Zm3 .25h5v1H7v-1Z",
|
|
1447
|
+
width: 200,
|
|
1448
|
+
height: 80,
|
|
1449
|
+
collapsedWidth: 180,
|
|
1450
|
+
collapsedHeight: 80,
|
|
1451
|
+
allowedParents: ["system", "domain", "group"],
|
|
1452
|
+
allowedAtRoot: true,
|
|
1453
|
+
builtin: true,
|
|
1454
|
+
hierarchyRelation: "derives",
|
|
1455
|
+
properties: requirementProps,
|
|
1456
|
+
wizard: {
|
|
1457
|
+
trigger: "create",
|
|
1458
|
+
steps: [
|
|
1459
|
+
{
|
|
1460
|
+
kind: "fields",
|
|
1461
|
+
title: "Name",
|
|
1462
|
+
fields: ["label"],
|
|
1463
|
+
help: 'A short name for the requirement, e.g. "Lock account after failed logins".'
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
kind: "custom",
|
|
1467
|
+
title: "Sentence",
|
|
1468
|
+
component: "ears-quick-entry",
|
|
1469
|
+
help: "Type the requirement as one sentence and press Enter \u2014 the EARS fields are filled for you. Or skip and fill them in the next step."
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
kind: "fields",
|
|
1473
|
+
title: "EARS fields",
|
|
1474
|
+
fields: ["ears_type", "trigger", "precondition", "precondition_state", "unwanted_condition", "feature", "action"],
|
|
1475
|
+
help: "Pick the EARS pattern; only the clauses it uses are shown."
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
kind: "fields",
|
|
1479
|
+
title: "Rationale",
|
|
1480
|
+
fields: ["rationale"],
|
|
1481
|
+
help: "Why is this requirement needed? Who asked for it?"
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
kind: "relations",
|
|
1485
|
+
title: "Satisfied by",
|
|
1486
|
+
relationType: "satisfies",
|
|
1487
|
+
direction: "in",
|
|
1488
|
+
help: "Which elements must satisfy this requirement?"
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
kind: "relations",
|
|
1492
|
+
title: "Derives from",
|
|
1493
|
+
relationType: "derives",
|
|
1494
|
+
direction: "out",
|
|
1495
|
+
help: "Is this a refinement of a broader requirement, or derived from a need?"
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
kind: "relations",
|
|
1499
|
+
title: "Traces to",
|
|
1500
|
+
relationType: "traces-to",
|
|
1501
|
+
direction: "out",
|
|
1502
|
+
help: "Which decisions or fitness functions follow from it?"
|
|
1503
|
+
}
|
|
1504
|
+
]
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
const constraintSources = ["adr", "fitness-fn", "requirement"];
|
|
1508
|
+
const constraintTargets = ["person", "system", "domain", "container", "component", "database", "webapp", "queue"];
|
|
1509
|
+
const constrainsPairs = constraintSources.flatMap(
|
|
1510
|
+
(from) => constraintTargets.map((to) => ({ from, to }))
|
|
1511
|
+
);
|
|
1512
|
+
const constrains = {
|
|
1513
|
+
id: "constrains",
|
|
1514
|
+
label: "Constrains",
|
|
1515
|
+
description: "The decision, check or requirement applies to the target element.",
|
|
1516
|
+
inverseLabel: "Constrained by",
|
|
1517
|
+
allowedPairs: constrainsPairs,
|
|
1518
|
+
properties: [
|
|
1519
|
+
{ key: "description", label: "Note", type: "text" }
|
|
1520
|
+
],
|
|
1521
|
+
color: "#dc2626",
|
|
1522
|
+
builtin: true
|
|
1523
|
+
};
|
|
1524
|
+
const supersedes = {
|
|
1525
|
+
id: "supersedes",
|
|
1526
|
+
label: "Supersedes",
|
|
1527
|
+
description: "The newer decision replaces the older one.",
|
|
1528
|
+
inverseLabel: "Superseded by",
|
|
1529
|
+
allowedPairs: [{ from: "adr", to: "adr" }],
|
|
1530
|
+
properties: [],
|
|
1531
|
+
color: "#f59e0b",
|
|
1532
|
+
builtin: true
|
|
1533
|
+
};
|
|
1534
|
+
const implements_ = {
|
|
1535
|
+
id: "implements",
|
|
1536
|
+
label: "Implements",
|
|
1537
|
+
description: "A fitness function checks that a decision still holds; a C4 element runs a state machine.",
|
|
1538
|
+
inverseLabel: "Implemented by",
|
|
1539
|
+
allowedPairs: [{ from: "fitness-fn", to: "adr" }],
|
|
1540
|
+
properties: [],
|
|
1541
|
+
color: "#7c3aed",
|
|
1542
|
+
builtin: true
|
|
1543
|
+
};
|
|
1544
|
+
const satisfiesTargets = ["person", "system", "domain", "container", "component", "database", "webapp", "queue"];
|
|
1545
|
+
const satisfies = {
|
|
1546
|
+
id: "satisfies",
|
|
1547
|
+
label: "Satisfies",
|
|
1548
|
+
description: "The element is what makes the requirement true.",
|
|
1549
|
+
inverseLabel: "Satisfied by",
|
|
1550
|
+
allowedPairs: satisfiesTargets.map((to) => ({ from: to, to: "requirement" })),
|
|
1551
|
+
properties: [
|
|
1552
|
+
{ key: "description", label: "Note", type: "text" }
|
|
1553
|
+
],
|
|
1554
|
+
color: "#0891b2",
|
|
1555
|
+
builtin: true
|
|
1556
|
+
};
|
|
1557
|
+
const derives = {
|
|
1558
|
+
id: "derives",
|
|
1559
|
+
label: "Derives from",
|
|
1560
|
+
description: "A requirement turns stakeholder input into a shall-statement or refines a broader requirement; a need sits inside a broader need.",
|
|
1561
|
+
inverseLabel: "Refined into",
|
|
1562
|
+
allowedPairs: [
|
|
1563
|
+
{ from: "requirement", to: "requirement" },
|
|
1564
|
+
{ from: "requirement", to: "need" },
|
|
1565
|
+
{ from: "need", to: "need" }
|
|
1566
|
+
],
|
|
1567
|
+
properties: [],
|
|
1568
|
+
color: "#0d9488",
|
|
1569
|
+
builtin: true
|
|
1570
|
+
};
|
|
1571
|
+
const tracesTo = {
|
|
1572
|
+
id: "traces-to",
|
|
1573
|
+
label: "Traces to",
|
|
1574
|
+
description: "The decision the requirement led to, or the check that keeps it.",
|
|
1575
|
+
inverseLabel: "Traced from",
|
|
1576
|
+
allowedPairs: [
|
|
1577
|
+
{ from: "requirement", to: "adr" },
|
|
1578
|
+
{ from: "requirement", to: "fitness-fn" }
|
|
1579
|
+
],
|
|
1580
|
+
properties: [],
|
|
1581
|
+
color: "#06b6d4",
|
|
1582
|
+
builtin: true
|
|
1583
|
+
};
|
|
1584
|
+
const scenarioProps = [
|
|
1585
|
+
{ key: "given", label: "Given", type: "textarea" },
|
|
1586
|
+
{ key: "when", label: "When", type: "textarea" },
|
|
1587
|
+
{ key: "then", label: "Then", type: "textarea" },
|
|
1588
|
+
{ key: "gherkin", label: "Extra steps (And/But, raw Gherkin)", type: "textarea" },
|
|
1589
|
+
TESTS_PROPERTY
|
|
1590
|
+
];
|
|
1591
|
+
const scenario = {
|
|
1592
|
+
id: "scenario",
|
|
1593
|
+
label: "Scenario",
|
|
1594
|
+
description: "An acceptance example in Gherkin: given a starting situation, when something happens, then the outcome.",
|
|
1595
|
+
color: "#166534",
|
|
1596
|
+
fg: "#fff",
|
|
1597
|
+
// Play/run triangle in a rounded frame
|
|
1598
|
+
iconPath: "M3 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H3Zm3.5 2.5 5 3.5-5 3.5v-7Z",
|
|
1599
|
+
width: 200,
|
|
1600
|
+
height: 80,
|
|
1601
|
+
collapsedWidth: 180,
|
|
1602
|
+
collapsedHeight: 80,
|
|
1603
|
+
allowedParents: ["system", "domain", "group"],
|
|
1604
|
+
allowedAtRoot: true,
|
|
1605
|
+
builtin: true,
|
|
1606
|
+
properties: scenarioProps,
|
|
1607
|
+
wizard: {
|
|
1608
|
+
trigger: "create",
|
|
1609
|
+
steps: [
|
|
1610
|
+
{
|
|
1611
|
+
kind: "fields",
|
|
1612
|
+
title: "Name",
|
|
1613
|
+
fields: ["label"],
|
|
1614
|
+
help: 'Name the behaviour, e.g. "Card payment declined".'
|
|
1615
|
+
},
|
|
1616
|
+
{
|
|
1617
|
+
kind: "fields",
|
|
1618
|
+
title: "Given",
|
|
1619
|
+
fields: ["given"],
|
|
1620
|
+
help: "The starting state: who is involved and what is already true."
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
kind: "fields",
|
|
1624
|
+
title: "When",
|
|
1625
|
+
fields: ["when"],
|
|
1626
|
+
help: "The single action or event under test."
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
kind: "fields",
|
|
1630
|
+
title: "Then",
|
|
1631
|
+
fields: ["then", "gherkin"],
|
|
1632
|
+
help: "The observable outcome. Add And/But steps below if needed."
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
kind: "relations",
|
|
1636
|
+
title: "Verified requirements",
|
|
1637
|
+
relationType: "verifies",
|
|
1638
|
+
direction: "out",
|
|
1639
|
+
help: "Which requirements does this scenario verify?"
|
|
1640
|
+
}
|
|
1641
|
+
]
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
const verifiesTargets = ["requirement"];
|
|
1645
|
+
const verifies = {
|
|
1646
|
+
id: "verifies",
|
|
1647
|
+
label: "Verifies",
|
|
1648
|
+
description: "The scenario is the acceptance test of the requirement or state machine.",
|
|
1649
|
+
inverseLabel: "Verified by",
|
|
1650
|
+
allowedPairs: verifiesTargets.map((to) => ({ from: "scenario", to })),
|
|
1651
|
+
properties: [],
|
|
1652
|
+
color: "#16a34a",
|
|
1653
|
+
builtin: true
|
|
1654
|
+
};
|
|
1655
|
+
const blueprintProps = [
|
|
1656
|
+
{ key: "description", label: "Description", type: "textarea" },
|
|
1657
|
+
{
|
|
1658
|
+
key: "status",
|
|
1659
|
+
label: "Status",
|
|
1660
|
+
type: "enum",
|
|
1661
|
+
options: ["draft", "reviewed", "approved", "deprecated"],
|
|
1662
|
+
default: "draft"
|
|
1663
|
+
},
|
|
1664
|
+
{ key: "domain", label: "Domain / Context", type: "text" },
|
|
1665
|
+
{ key: "rationale", label: "Rationale", type: "textarea" }
|
|
1666
|
+
];
|
|
1667
|
+
const blueprint = {
|
|
1668
|
+
id: "blueprint",
|
|
1669
|
+
label: "Blueprint",
|
|
1670
|
+
description: "A curated reference architecture imported from the Concept Hub.",
|
|
1671
|
+
color: "#1e3a5f",
|
|
1672
|
+
fg: "#fff",
|
|
1673
|
+
// Blueprint grid / technical drawing
|
|
1674
|
+
iconPath: "M2 2h12v12H2V2Zm1 1v2h2V3H3Zm3 0v2h2V3H6Zm3 0v2h2V3H9Zm3 0v2h1V3h-1ZM3 6v2h2V6H3Zm3 0v2h2V6H6Zm3 0v2h2V6H9Zm3 0v2h1V6h-1ZM3 9v2h2V9H3Zm3 0v2h2V9H6Zm3 0v2h2V9H9Zm3 0v2h1V9h-1ZM3 12v1h2v-1H3Zm3 0v1h2v-1H6Zm3 0v1h2v-1H9Zm3 0v1h1v-1h-1Z",
|
|
1675
|
+
width: 520,
|
|
1676
|
+
height: 360,
|
|
1677
|
+
collapsedWidth: 360,
|
|
1678
|
+
collapsedHeight: 220,
|
|
1679
|
+
allowedParents: ["domain", "group"],
|
|
1680
|
+
allowedAtRoot: true,
|
|
1681
|
+
builtin: true,
|
|
1682
|
+
hubOnly: true,
|
|
1683
|
+
properties: blueprintProps
|
|
1684
|
+
};
|
|
1685
|
+
const mockupProps = [
|
|
1686
|
+
{ key: "description", label: "Description", type: "textarea" },
|
|
1687
|
+
{ key: "screen", label: "Screen / route", type: "text" },
|
|
1688
|
+
{ key: "link", label: "Design link", type: "text" }
|
|
1689
|
+
];
|
|
1690
|
+
const mockup = {
|
|
1691
|
+
id: "mockup",
|
|
1692
|
+
label: "Mockup",
|
|
1693
|
+
description: "One screen of the product, optionally with a low-fi wireframe.",
|
|
1694
|
+
color: "#be185d",
|
|
1695
|
+
fg: "#fff",
|
|
1696
|
+
// Browser window with a header bar and content blocks
|
|
1697
|
+
iconPath: "M2 2.5A1.5 1.5 0 0 1 3.5 1h9A1.5 1.5 0 0 1 14 2.5v11a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5v-11ZM3 5v8.5c0 .28.22.5.5.5h9a.5.5 0 0 0 .5-.5V5H3Zm1 1.5h8v2H4v-2Zm0 3h3.5V13H4V9.5Zm4.5 0H12v1H8.5v-1Zm0 2H12v1H8.5v-1Z",
|
|
1698
|
+
width: 220,
|
|
1699
|
+
height: 190,
|
|
1700
|
+
collapsedWidth: 220,
|
|
1701
|
+
collapsedHeight: 190,
|
|
1702
|
+
allowedParents: ["system", "domain", "group"],
|
|
1703
|
+
allowedAtRoot: true,
|
|
1704
|
+
builtin: true,
|
|
1705
|
+
properties: mockupProps,
|
|
1706
|
+
wizard: {
|
|
1707
|
+
trigger: "create",
|
|
1708
|
+
steps: [
|
|
1709
|
+
{
|
|
1710
|
+
kind: "fields",
|
|
1711
|
+
title: "Screen",
|
|
1712
|
+
fields: ["label", "screen", "description"],
|
|
1713
|
+
help: "Which screen is this, and what does the user do on it?"
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
kind: "fields",
|
|
1717
|
+
title: "Design link",
|
|
1718
|
+
fields: ["link"],
|
|
1719
|
+
help: "A Figma / Penpot link, if the design exists. You can generate a wireframe from the properties panel later."
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
kind: "relations",
|
|
1723
|
+
title: "Illustrates",
|
|
1724
|
+
relationType: "illustrates",
|
|
1725
|
+
direction: "out",
|
|
1726
|
+
help: "Which requirements or scenarios does this screen show?"
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
kind: "relations",
|
|
1730
|
+
title: "Presented by",
|
|
1731
|
+
relationType: "presented-by",
|
|
1732
|
+
direction: "out",
|
|
1733
|
+
help: "Which part of the system renders it?"
|
|
1734
|
+
}
|
|
1735
|
+
]
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
const illustrates = {
|
|
1739
|
+
id: "illustrates",
|
|
1740
|
+
label: "Illustrates",
|
|
1741
|
+
description: "The screen shows the requirement being met, the step of the scenario, or what the user sees in the state.",
|
|
1742
|
+
inverseLabel: "Illustrated by",
|
|
1743
|
+
allowedPairs: [
|
|
1744
|
+
{ from: "mockup", to: "requirement" },
|
|
1745
|
+
{ from: "mockup", to: "scenario" }
|
|
1746
|
+
],
|
|
1747
|
+
properties: [],
|
|
1748
|
+
color: "#db2777",
|
|
1749
|
+
builtin: true
|
|
1750
|
+
};
|
|
1751
|
+
const presentedBy = {
|
|
1752
|
+
id: "presented-by",
|
|
1753
|
+
label: "Presented by",
|
|
1754
|
+
description: "The part of the architecture that renders the screen.",
|
|
1755
|
+
inverseLabel: "Presents",
|
|
1756
|
+
allowedPairs: ["webapp", "container", "component", "system"].map((to) => ({ from: "mockup", to })),
|
|
1757
|
+
properties: [],
|
|
1758
|
+
color: "#be185d",
|
|
1759
|
+
builtin: true
|
|
1760
|
+
};
|
|
1761
|
+
const navigatesTo = {
|
|
1762
|
+
id: "navigates-to",
|
|
1763
|
+
label: "Navigates to",
|
|
1764
|
+
description: "One step of a screen flow, with what triggers it.",
|
|
1765
|
+
inverseLabel: "Reached from",
|
|
1766
|
+
allowedPairs: [{ from: "mockup", to: "mockup" }],
|
|
1767
|
+
properties: [
|
|
1768
|
+
{ key: "description", label: "Trigger", type: "text" }
|
|
1769
|
+
],
|
|
1770
|
+
color: "#f472b6",
|
|
1771
|
+
builtin: true
|
|
1772
|
+
};
|
|
1773
|
+
const stateMachine = {
|
|
1774
|
+
id: "state-machine",
|
|
1775
|
+
label: "State Machine",
|
|
1776
|
+
description: "The lifecycle of one entity: the states it can be in and the transitions between them.",
|
|
1777
|
+
color: "#3730a3",
|
|
1778
|
+
fg: "#fff",
|
|
1779
|
+
// Two states joined by a transition
|
|
1780
|
+
iconPath: "M1 3.5A1.5 1.5 0 0 1 2.5 2h3A1.5 1.5 0 0 1 7 3.5v2A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-2Zm8 7A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v2a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 12.5v-2ZM3.5 8h1v3h2.8v-1l2 1.5-2 1.5v-1H3.5V8Z",
|
|
1781
|
+
width: 560,
|
|
1782
|
+
height: 380,
|
|
1783
|
+
collapsedWidth: 200,
|
|
1784
|
+
collapsedHeight: 64,
|
|
1785
|
+
allowedParents: ["system", "domain", "group"],
|
|
1786
|
+
allowedAtRoot: true,
|
|
1787
|
+
builtin: true,
|
|
1788
|
+
properties: [
|
|
1789
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1790
|
+
]
|
|
1791
|
+
};
|
|
1792
|
+
const state = {
|
|
1793
|
+
id: "state",
|
|
1794
|
+
label: "State",
|
|
1795
|
+
description: "A situation the entity can be in.",
|
|
1796
|
+
color: "#4f46e5",
|
|
1797
|
+
fg: "#fff",
|
|
1798
|
+
// Rounded rectangle
|
|
1799
|
+
iconPath: "M3.5 3h9A2.5 2.5 0 0 1 15 5.5v5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 1 10.5v-5A2.5 2.5 0 0 1 3.5 3Zm0 1.5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1h-9Z",
|
|
1800
|
+
width: 320,
|
|
1801
|
+
height: 220,
|
|
1802
|
+
collapsedWidth: 170,
|
|
1803
|
+
collapsedHeight: 72,
|
|
1804
|
+
allowedParents: ["state-machine", "state"],
|
|
1805
|
+
allowedAtRoot: false,
|
|
1806
|
+
builtin: true,
|
|
1807
|
+
properties: [
|
|
1808
|
+
{
|
|
1809
|
+
key: "kind",
|
|
1810
|
+
label: "Kind",
|
|
1811
|
+
type: "enum",
|
|
1812
|
+
options: ["normal", "parallel", "final"],
|
|
1813
|
+
default: "normal"
|
|
1814
|
+
},
|
|
1815
|
+
{ key: "entry", label: "Entry actions", type: "text", visibleWhen: { key: "kind", values: ["normal", "parallel"] } },
|
|
1816
|
+
{ key: "exit", label: "Exit actions", type: "text", visibleWhen: { key: "kind", values: ["normal", "parallel"] } },
|
|
1817
|
+
{ key: "do", label: "Do (ongoing activity)", type: "text", visibleWhen: { key: "kind", values: ["normal"] } },
|
|
1818
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1819
|
+
]
|
|
1820
|
+
};
|
|
1821
|
+
const pseudostate = {
|
|
1822
|
+
id: "pseudostate",
|
|
1823
|
+
label: "Pseudostate",
|
|
1824
|
+
description: "A point a state machine passes through but never rests in: where it starts, a choice, a history.",
|
|
1825
|
+
color: "#1e1b4b",
|
|
1826
|
+
fg: "#fff",
|
|
1827
|
+
// Filled dot (initial)
|
|
1828
|
+
iconPath: "M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z",
|
|
1829
|
+
width: 36,
|
|
1830
|
+
height: 36,
|
|
1831
|
+
allowedParents: ["state-machine", "state"],
|
|
1832
|
+
allowedAtRoot: false,
|
|
1833
|
+
builtin: true,
|
|
1834
|
+
properties: [
|
|
1835
|
+
{
|
|
1836
|
+
key: "kind",
|
|
1837
|
+
label: "Kind",
|
|
1838
|
+
type: "enum",
|
|
1839
|
+
options: ["initial", "shallow-history", "deep-history", "choice"],
|
|
1840
|
+
default: "initial"
|
|
1841
|
+
}
|
|
1842
|
+
]
|
|
1843
|
+
};
|
|
1844
|
+
const event = {
|
|
1845
|
+
id: "event",
|
|
1846
|
+
label: "Event",
|
|
1847
|
+
description: "Something that happens and can trigger a transition.",
|
|
1848
|
+
color: "#c2410c",
|
|
1849
|
+
fg: "#fff",
|
|
1850
|
+
// Lightning bolt
|
|
1851
|
+
iconPath: "M9.5 1 3 9h4l-1 6 6.5-8h-4l1-6Z",
|
|
1852
|
+
width: 170,
|
|
1853
|
+
height: 52,
|
|
1854
|
+
allowedParents: ["state-machine", "system", "domain", "group"],
|
|
1855
|
+
allowedAtRoot: true,
|
|
1856
|
+
builtin: true,
|
|
1857
|
+
properties: [
|
|
1858
|
+
{
|
|
1859
|
+
key: "source",
|
|
1860
|
+
label: "Source",
|
|
1861
|
+
type: "enum",
|
|
1862
|
+
options: ["external", "internal", "timer"],
|
|
1863
|
+
default: "external"
|
|
1864
|
+
},
|
|
1865
|
+
{ key: "payload", label: "Payload", type: "text" },
|
|
1866
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1867
|
+
]
|
|
1868
|
+
};
|
|
1869
|
+
const stateNodeTypes = ["state", "pseudostate"];
|
|
1870
|
+
const transition = {
|
|
1871
|
+
id: "transition",
|
|
1872
|
+
label: "Transition",
|
|
1873
|
+
description: "The machine moves from one state to another: on an event, under a guard, running actions.",
|
|
1874
|
+
forwardLabel: "Transitions to",
|
|
1875
|
+
inverseLabel: "Entered from",
|
|
1876
|
+
allowedPairs: stateNodeTypes.flatMap((from) => stateNodeTypes.map((to) => ({ from, to }))),
|
|
1877
|
+
properties: [
|
|
1878
|
+
{ key: "event", label: "Event (trigger; none = completion)", type: "ref", refType: "event" },
|
|
1879
|
+
{ key: "guard", label: "Guard [condition]", type: "text" },
|
|
1880
|
+
{ key: "actions", label: "Actions (/ effect)", type: "text" },
|
|
1881
|
+
{ key: "raises", label: "Raises (events it publishes)", type: "ref", refType: "event", multiple: true },
|
|
1882
|
+
{
|
|
1883
|
+
key: "kind",
|
|
1884
|
+
label: "Kind",
|
|
1885
|
+
type: "enum",
|
|
1886
|
+
options: ["external", "internal"],
|
|
1887
|
+
default: "external"
|
|
1888
|
+
}
|
|
1889
|
+
],
|
|
1890
|
+
color: "#6366f1",
|
|
1891
|
+
builtin: true
|
|
1892
|
+
};
|
|
1893
|
+
const lifecycleOf = {
|
|
1894
|
+
id: "lifecycle-of",
|
|
1895
|
+
label: "Lifecycle of",
|
|
1896
|
+
description: "The machine is the lifecycle of that entity.",
|
|
1897
|
+
inverseLabel: "Lifecycle modelled by",
|
|
1898
|
+
allowedPairs: [{ from: "state-machine", to: "entity" }],
|
|
1899
|
+
properties: [],
|
|
1900
|
+
color: "#3730a3",
|
|
1901
|
+
builtin: true
|
|
1902
|
+
};
|
|
1903
|
+
const emits = {
|
|
1904
|
+
id: "emits",
|
|
1905
|
+
label: "Emits",
|
|
1906
|
+
description: "The element raises the event.",
|
|
1907
|
+
inverseLabel: "Emitted by",
|
|
1908
|
+
allowedPairs: ["person", "system", "container", "component", "webapp", "queue", "state-machine", "state"].map((from) => ({ from, to: "event" })),
|
|
1909
|
+
properties: [
|
|
1910
|
+
{
|
|
1911
|
+
key: "on",
|
|
1912
|
+
label: "On (for a state: entry, exit or do)",
|
|
1913
|
+
type: "enum",
|
|
1914
|
+
options: ["entry", "exit", "do"],
|
|
1915
|
+
default: "entry"
|
|
1916
|
+
}
|
|
1917
|
+
],
|
|
1918
|
+
color: "#ea580c",
|
|
1919
|
+
builtin: true
|
|
1920
|
+
};
|
|
1921
|
+
const childrenProperty = {
|
|
1922
|
+
key: "children",
|
|
1923
|
+
label: "Children run",
|
|
1924
|
+
type: "enum",
|
|
1925
|
+
options: ["sequence", "choice", "concurrent"],
|
|
1926
|
+
default: "sequence"
|
|
1927
|
+
};
|
|
1928
|
+
const process_ = {
|
|
1929
|
+
id: "process",
|
|
1930
|
+
label: "Process",
|
|
1931
|
+
description: "A procedure: the steps it is made of, what repeats and what is an alternative.",
|
|
1932
|
+
color: "#0f766e",
|
|
1933
|
+
fg: "#fff",
|
|
1934
|
+
// A brace with three lines
|
|
1935
|
+
iconPath: "M5 2c-1.1 0-2 .9-2 2v2.2c0 .5-.3.8-.8.8H1.5v2h.7c.5 0 .8.3.8.8V12c0 1.1.9 2 2 2h.5v-1.5H5c-.3 0-.5-.2-.5-.5V9.5c0-.9-.4-1.6-1-2 .6-.4 1-1.1 1-2V4c0-.3.2-.5.5-.5h.5V2H5Zm3 1.5h7V5H8V3.5Zm0 3.75h7v1.5H8v-1.5ZM8 11h7v1.5H8V11Z",
|
|
1936
|
+
width: 260,
|
|
1937
|
+
height: 160,
|
|
1938
|
+
collapsedWidth: 200,
|
|
1939
|
+
collapsedHeight: 64,
|
|
1940
|
+
allowedParents: ["system", "domain", "group"],
|
|
1941
|
+
allowedAtRoot: true,
|
|
1942
|
+
builtin: true,
|
|
1943
|
+
properties: [
|
|
1944
|
+
// Its place among the processes beside it, as a step's among steps.
|
|
1945
|
+
{ key: "order", label: "Order", type: "number" },
|
|
1946
|
+
childrenProperty,
|
|
1947
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1948
|
+
]
|
|
1949
|
+
};
|
|
1950
|
+
const step = {
|
|
1951
|
+
id: "step",
|
|
1952
|
+
label: "Step",
|
|
1953
|
+
description: "One part of a process, itself made of steps or not.",
|
|
1954
|
+
color: "#14b8a6",
|
|
1955
|
+
fg: "#042f2e",
|
|
1956
|
+
// An arrow into a box
|
|
1957
|
+
iconPath: "M2 4.5A1.5 1.5 0 0 1 3.5 3h9A1.5 1.5 0 0 1 14 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11.5v-7Zm1.5 0v7h9v-7h-9Zm1 2.75h3.8V5.5L11 8l-2.7 2.5V8.75H4.5v-1.5Z",
|
|
1958
|
+
width: 220,
|
|
1959
|
+
height: 80,
|
|
1960
|
+
collapsedWidth: 180,
|
|
1961
|
+
collapsedHeight: 64,
|
|
1962
|
+
allowedParents: ["process", "step"],
|
|
1963
|
+
allowedAtRoot: false,
|
|
1964
|
+
builtin: true,
|
|
1965
|
+
properties: [
|
|
1966
|
+
{ key: "order", label: "Order", type: "number" },
|
|
1967
|
+
{
|
|
1968
|
+
key: "repeat",
|
|
1969
|
+
label: "Repeat",
|
|
1970
|
+
type: "enum",
|
|
1971
|
+
options: ["1", "0..1", "1..n", "0..n"],
|
|
1972
|
+
default: "1"
|
|
1973
|
+
},
|
|
1974
|
+
{ key: "condition", label: "Condition (for each\u2026, while\u2026, if\u2026)", type: "text" },
|
|
1975
|
+
childrenProperty,
|
|
1976
|
+
{ key: "description", label: "Description", type: "textarea" }
|
|
1977
|
+
]
|
|
1978
|
+
};
|
|
1979
|
+
const performedBy = {
|
|
1980
|
+
id: "performed-by",
|
|
1981
|
+
label: "Performed by",
|
|
1982
|
+
description: "The person or part of the architecture that does the step.",
|
|
1983
|
+
inverseLabel: "Performs",
|
|
1984
|
+
allowedPairs: ["person", "system", "container", "component", "webapp"].map((to) => ({ from: "step", to })),
|
|
1985
|
+
properties: [],
|
|
1986
|
+
color: "#0d9488",
|
|
1987
|
+
builtin: true
|
|
1988
|
+
};
|
|
1989
|
+
implements_.allowedPairs.push(...["system", "container", "component", "webapp"].map((from) => ({ from, to: "state-machine" })));
|
|
1990
|
+
satisfies.allowedPairs.push({ from: "state-machine", to: "requirement" }, { from: "entity", to: "requirement" });
|
|
1991
|
+
verifies.allowedPairs.push({ from: "scenario", to: "state-machine" }, { from: "scenario", to: "process" });
|
|
1992
|
+
satisfies.allowedPairs.push({ from: "process", to: "requirement" });
|
|
1993
|
+
illustrates.allowedPairs.push({ from: "mockup", to: "state" });
|
|
1994
|
+
return {
|
|
1995
|
+
id: "c4-ddd-governance-builtin",
|
|
1996
|
+
name: RADICAL_METAMODEL_NAME,
|
|
1997
|
+
nodeTypes: {
|
|
1998
|
+
...base.nodeTypes,
|
|
1999
|
+
adr,
|
|
2000
|
+
"fitness-fn": fitnessFn,
|
|
2001
|
+
need,
|
|
2002
|
+
requirement,
|
|
2003
|
+
scenario,
|
|
2004
|
+
blueprint,
|
|
2005
|
+
mockup,
|
|
2006
|
+
"state-machine": stateMachine,
|
|
2007
|
+
state,
|
|
2008
|
+
pseudostate,
|
|
2009
|
+
event,
|
|
2010
|
+
process: process_,
|
|
2011
|
+
step
|
|
2012
|
+
},
|
|
2013
|
+
relationTypes: {
|
|
2014
|
+
...base.relationTypes,
|
|
2015
|
+
constrains,
|
|
2016
|
+
supersedes,
|
|
2017
|
+
implements: implements_,
|
|
2018
|
+
satisfies,
|
|
2019
|
+
derives,
|
|
2020
|
+
"traces-to": tracesTo,
|
|
2021
|
+
verifies,
|
|
2022
|
+
illustrates,
|
|
2023
|
+
"presented-by": presentedBy,
|
|
2024
|
+
"navigates-to": navigatesTo,
|
|
2025
|
+
transition,
|
|
2026
|
+
"lifecycle-of": lifecycleOf,
|
|
2027
|
+
emits,
|
|
2028
|
+
"performed-by": performedBy
|
|
2029
|
+
},
|
|
2030
|
+
viewpoints: radicalViewpoints()
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
// ../../packages/common/src/c4.ts
|
|
2035
|
+
var CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
2036
|
+
"system",
|
|
2037
|
+
"container",
|
|
2038
|
+
"webapp",
|
|
2039
|
+
"domain",
|
|
2040
|
+
"group",
|
|
2041
|
+
"blueprint",
|
|
2042
|
+
"state-machine",
|
|
2043
|
+
"state",
|
|
2044
|
+
"process",
|
|
2045
|
+
"step"
|
|
2046
|
+
]);
|
|
2047
|
+
function isContainerType(type) {
|
|
2048
|
+
return !!type && CONTAINER_TYPES.has(type);
|
|
2049
|
+
}
|
|
2050
|
+
function pinnedNodeIds(constraints) {
|
|
2051
|
+
return constraints?.find((c) => c.type === "pin")?.nodeIds ?? [];
|
|
2052
|
+
}
|
|
2053
|
+
function defaultGridColumns(count) {
|
|
2054
|
+
return Math.max(1, Math.ceil(Math.sqrt(count)));
|
|
2055
|
+
}
|
|
2056
|
+
var LANDSCAPE_WIDTH = 2;
|
|
2057
|
+
function landscapeSlot(index) {
|
|
2058
|
+
if (index <= 0) return { column: 0, row: 0 };
|
|
2059
|
+
let columns = 1;
|
|
2060
|
+
let rows = 1;
|
|
2061
|
+
let filled = 1;
|
|
2062
|
+
for (; ; ) {
|
|
2063
|
+
if (columns < LANDSCAPE_WIDTH * rows) {
|
|
2064
|
+
if (index < filled + rows) return { column: columns, row: index - filled };
|
|
2065
|
+
filled += rows;
|
|
2066
|
+
columns++;
|
|
2067
|
+
} else {
|
|
2068
|
+
if (index < filled + columns) return { column: index - filled, row: rows };
|
|
2069
|
+
filled += columns;
|
|
2070
|
+
rows++;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
function landscapeGridColumns(count) {
|
|
2075
|
+
let columns = 1;
|
|
2076
|
+
for (let i = 0; i < count; i++) columns = Math.max(columns, landscapeSlot(i).column + 1);
|
|
2077
|
+
return columns;
|
|
2078
|
+
}
|
|
2079
|
+
function gridCells(c) {
|
|
2080
|
+
const cols = Math.max(1, Math.min(Math.floor(c.columns), c.nodeIds.length));
|
|
2081
|
+
const rows = [];
|
|
2082
|
+
for (let i = 0; i < c.nodeIds.length; i += cols) rows.push(c.nodeIds.slice(i, i + cols));
|
|
2083
|
+
const columns = [];
|
|
2084
|
+
for (let k = 0; k < cols; k++) columns.push(c.nodeIds.filter((_, i) => i % cols === k));
|
|
2085
|
+
return { rows, columns };
|
|
2086
|
+
}
|
|
2087
|
+
function constraintLines(constraints) {
|
|
2088
|
+
return constraints.flatMap((c) => {
|
|
2089
|
+
if (c.type === "align") return [c];
|
|
2090
|
+
if (c.type === "pin") return [];
|
|
2091
|
+
const { rows, columns } = gridCells(c);
|
|
2092
|
+
return [
|
|
2093
|
+
...rows.map((ids, r) => ({ id: `${c.id}:row${r}`, type: "align", axis: "horizontal", nodeIds: ids, ordered: true })),
|
|
2094
|
+
...columns.map((ids, k) => ({ id: `${c.id}:col${k}`, type: "align", axis: "vertical", nodeIds: ids, ordered: true }))
|
|
2095
|
+
];
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
var BUILTIN_NODE_TYPES = builtInGovernanceMetamodel().nodeTypes;
|
|
2099
|
+
function pluckPerType(fn) {
|
|
2100
|
+
const out = {};
|
|
2101
|
+
for (const [id, def] of Object.entries(BUILTIN_NODE_TYPES)) {
|
|
2102
|
+
out[id] = fn(def);
|
|
2103
|
+
}
|
|
2104
|
+
return out;
|
|
2105
|
+
}
|
|
2106
|
+
var NODE_SIZES = pluckPerType((def) => ({ width: def.width, height: def.height }));
|
|
2107
|
+
var COLLAPSED_HEIGHT = pluckPerType((def) => def.collapsedHeight ?? def.height);
|
|
2108
|
+
var COLLAPSED_WIDTH = pluckPerType((def) => def.collapsedWidth ?? def.width);
|
|
2109
|
+
var NODE_COLORS = pluckPerType((def) => def.color);
|
|
2110
|
+
var NODE_FG = pluckPerType((def) => def.fg);
|
|
2111
|
+
var TYPE_LABELS = pluckPerType((def) => def.label);
|
|
2112
|
+
var TYPE_ICON_PATHS = pluckPerType((def) => def.iconPath);
|
|
2113
|
+
function normalizeViewFolder(folder) {
|
|
2114
|
+
return (folder ?? "").split("/").map((part) => part.trim()).filter(Boolean).join("/");
|
|
2115
|
+
}
|
|
2116
|
+
var WIKI_DEPTH_MIN = 1;
|
|
2117
|
+
var WIKI_DEPTH_MAX = 5;
|
|
2118
|
+
function wikiDepthOf(view) {
|
|
2119
|
+
const d = view?.wikiDepth;
|
|
2120
|
+
if (typeof d !== "number" || !Number.isFinite(d)) return WIKI_DEPTH_MIN;
|
|
2121
|
+
return Math.min(WIKI_DEPTH_MAX, Math.max(WIKI_DEPTH_MIN, Math.floor(d)));
|
|
2122
|
+
}
|
|
2123
|
+
function viewShowsEveryNode(view) {
|
|
2124
|
+
return view.nodeIds.length === 0 && !view.empty;
|
|
2125
|
+
}
|
|
2126
|
+
function viewCanvasPositions(view, nodes, positions) {
|
|
2127
|
+
if (view.kind && view.kind !== "static") return {};
|
|
2128
|
+
if (viewShowsEveryNode(view)) return positions;
|
|
2129
|
+
const kept = {};
|
|
2130
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2131
|
+
for (const id of view.nodeIds) {
|
|
2132
|
+
for (let cur = id; cur && nodes[cur] && !seen.has(cur); cur = nodes[cur].parentId) {
|
|
2133
|
+
seen.add(cur);
|
|
2134
|
+
if (cur in positions) kept[cur] = positions[cur];
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
return kept;
|
|
2138
|
+
}
|
|
2139
|
+
function withCanvasPositions(views, nodes) {
|
|
2140
|
+
return views.map((view) => {
|
|
2141
|
+
const kept = viewCanvasPositions(view, nodes, view.positions ?? {});
|
|
2142
|
+
return Object.keys(kept).length === Object.keys(view.positions ?? {}).length ? view : { ...view, positions: kept };
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
function removeFromViewList(view, removed) {
|
|
2146
|
+
if (view.nodeIds.length === 0) return;
|
|
2147
|
+
view.nodeIds = view.nodeIds.filter((nid) => !removed.has(nid));
|
|
2148
|
+
if (view.nodeIds.length === 0) view.empty = true;
|
|
2149
|
+
}
|
|
2150
|
+
function addToViewList(view, ids) {
|
|
2151
|
+
if (viewShowsEveryNode(view)) return;
|
|
2152
|
+
for (const id of ids) if (!view.nodeIds.includes(id)) view.nodeIds.push(id);
|
|
2153
|
+
if (view.nodeIds.length > 0) delete view.empty;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
// ../../packages/layout/src/elkSpacingBase.ts
|
|
2157
|
+
var ELK_ROOT_SPACING = {
|
|
2158
|
+
"elk.spacing.nodeNode": "60",
|
|
2159
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "80",
|
|
2160
|
+
"elk.spacing.edgeNode": "20",
|
|
2161
|
+
"elk.spacing.edgeEdge": "10",
|
|
2162
|
+
"elk.spacing.componentComponent": "80"
|
|
2163
|
+
};
|
|
2164
|
+
var ELK_CHILD_SPACING = {
|
|
2165
|
+
"elk.spacing.nodeNode": "30",
|
|
2166
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "50",
|
|
2167
|
+
"elk.spacing.edgeNode": "12",
|
|
2168
|
+
"elk.spacing.edgeEdge": "8",
|
|
2169
|
+
"elk.spacing.componentComponent": "40"
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// ../../packages/layout/src/geometry.ts
|
|
2173
|
+
function effectiveWidth(n) {
|
|
2174
|
+
if (isContainerType(n.type) && n.collapsed) return COLLAPSED_WIDTH[n.type];
|
|
2175
|
+
return n.width ?? NODE_SIZES[n.type].width;
|
|
2176
|
+
}
|
|
2177
|
+
function effectiveHeight(n) {
|
|
2178
|
+
if (isContainerType(n.type) && n.collapsed) return COLLAPSED_HEIGHT[n.type];
|
|
2179
|
+
return n.height ?? NODE_SIZES[n.type].height;
|
|
2180
|
+
}
|
|
2181
|
+
var FIXED_SIZE_TYPES = /* @__PURE__ */ new Set(["adr", "fitness-fn", "need", "requirement", "scenario", "mockup", "pseudostate", "event", "entity"]);
|
|
2182
|
+
function drawnSize(n, hasChildren) {
|
|
2183
|
+
if (FIXED_SIZE_TYPES.has(n.type)) return NODE_SIZES[n.type];
|
|
2184
|
+
if (isContainerType(n.type) && (n.collapsed || !hasChildren)) {
|
|
2185
|
+
return { width: COLLAPSED_WIDTH[n.type], height: COLLAPSED_HEIGHT[n.type] };
|
|
2186
|
+
}
|
|
2187
|
+
return { width: n.width, height: n.height };
|
|
2188
|
+
}
|
|
2189
|
+
function isVisible(node, allNodes) {
|
|
2190
|
+
if (!node.parentId) return true;
|
|
2191
|
+
const parent = allNodes[node.parentId];
|
|
2192
|
+
if (!parent) return true;
|
|
2193
|
+
if (parent.collapsed) return false;
|
|
2194
|
+
return isVisible(parent, allNodes);
|
|
2195
|
+
}
|
|
2196
|
+
function compoundPadding(type) {
|
|
2197
|
+
const margin = type === "container" || type === "webapp" ? 20 : 30;
|
|
2198
|
+
return { top: 120, side: margin, bottom: margin };
|
|
2199
|
+
}
|
|
2200
|
+
function fittedParentSize(parent, children) {
|
|
2201
|
+
const pad = compoundPadding(parent.type);
|
|
2202
|
+
let maxRight = 0;
|
|
2203
|
+
let maxBottom = 0;
|
|
2204
|
+
for (const child of children) {
|
|
2205
|
+
maxRight = Math.max(maxRight, child.x + child.width);
|
|
2206
|
+
maxBottom = Math.max(maxBottom, child.y + child.height);
|
|
2207
|
+
}
|
|
2208
|
+
return {
|
|
2209
|
+
width: Math.max(maxRight + pad.side, NODE_SIZES[parent.type].width),
|
|
2210
|
+
height: Math.max(maxBottom + pad.bottom, NODE_SIZES[parent.type].height)
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
function fitAncestors(nodes, startId) {
|
|
2214
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2215
|
+
let cur = startId ? nodes[startId] : void 0;
|
|
2216
|
+
while (cur && !seen.has(cur.id)) {
|
|
2217
|
+
seen.add(cur.id);
|
|
2218
|
+
const parentId = cur.id;
|
|
2219
|
+
const children = Object.values(nodes).filter((n) => n.parentId === parentId);
|
|
2220
|
+
if (isContainerType(cur.type) && !cur.collapsed && children.length > 0) {
|
|
2221
|
+
const size = fittedParentSize(cur, children.map((c) => ({ x: c.x, y: c.y, width: effectiveWidth(c), height: effectiveHeight(c) })));
|
|
2222
|
+
cur.width = size.width;
|
|
2223
|
+
cur.height = size.height;
|
|
2224
|
+
}
|
|
2225
|
+
cur = cur.parentId ? nodes[cur.parentId] : void 0;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
function placeNewNode(nodes, parentId) {
|
|
2229
|
+
const parent = parentId ? nodes[parentId] : void 0;
|
|
2230
|
+
const siblings = Object.values(nodes).filter((n) => (n.parentId ?? void 0) === (parent?.id ?? void 0));
|
|
2231
|
+
const right = Math.max(...siblings.map((n) => n.x + effectiveWidth(n)));
|
|
2232
|
+
if (!parent) return { x: siblings.length ? right + 80 : 0, y: 0 };
|
|
2233
|
+
const pad = compoundPadding(parent.type);
|
|
2234
|
+
return { x: siblings.length ? right + 20 : pad.side, y: pad.top };
|
|
2235
|
+
}
|
|
2236
|
+
var BATCH_CELL = { width: 360, height: 280 };
|
|
2237
|
+
var BATCH_GAP = 120;
|
|
2238
|
+
function createBatchPlacer(getNodes, visible = () => void 0) {
|
|
2239
|
+
const batches = /* @__PURE__ */ new Map();
|
|
2240
|
+
return (parentId) => {
|
|
2241
|
+
const key = parentId ?? "";
|
|
2242
|
+
let batch = batches.get(key);
|
|
2243
|
+
if (!batch) {
|
|
2244
|
+
const nodes = getNodes();
|
|
2245
|
+
const parent = parentId ? nodes[parentId] : void 0;
|
|
2246
|
+
const shown = visible();
|
|
2247
|
+
const siblings = Object.values(nodes).filter((n) => (n.parentId ?? void 0) === (parent?.id ?? void 0) && (!shown || shown.has(n.id)));
|
|
2248
|
+
const pad = parent ? compoundPadding(parent.type) : { top: 0, side: 0 };
|
|
2249
|
+
batch = siblings.length ? { x: Math.max(...siblings.map((n) => n.x + effectiveWidth(n))) + (parent ? pad.side : BATCH_GAP), y: Math.min(...siblings.map((n) => n.y)), placed: 0 } : { x: pad.side, y: pad.top, placed: 0 };
|
|
2250
|
+
batches.set(key, batch);
|
|
2251
|
+
}
|
|
2252
|
+
const { column, row } = landscapeSlot(batch.placed++);
|
|
2253
|
+
return { x: batch.x + column * BATCH_CELL.width, y: batch.y + row * BATCH_CELL.height };
|
|
2254
|
+
};
|
|
2255
|
+
}
|
|
2256
|
+
function projectToVisibleGraph(nodes, relations) {
|
|
2257
|
+
const visible = {};
|
|
2258
|
+
for (const id of Object.keys(nodes).sort()) {
|
|
2259
|
+
const n = nodes[id];
|
|
2260
|
+
if (!isVisible(n, nodes)) continue;
|
|
2261
|
+
if (isContainerType(n.type) && n.collapsed) {
|
|
2262
|
+
const w = COLLAPSED_WIDTH[n.type];
|
|
2263
|
+
const h = COLLAPSED_HEIGHT[n.type];
|
|
2264
|
+
visible[n.id] = n.width === w && n.height === h ? n : { ...n, width: w, height: h };
|
|
2265
|
+
} else {
|
|
2266
|
+
visible[n.id] = n;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
const visibleAncestor = (id) => {
|
|
2270
|
+
let cur = nodes[id];
|
|
2271
|
+
while (cur && !visible[cur.id]) cur = cur.parentId ? nodes[cur.parentId] : void 0;
|
|
2272
|
+
return cur?.id;
|
|
2273
|
+
};
|
|
2274
|
+
const isAncestor = (a, b) => {
|
|
2275
|
+
for (let cur = nodes[b]?.parentId; cur; cur = nodes[cur]?.parentId) if (cur === a) return true;
|
|
2276
|
+
return false;
|
|
2277
|
+
};
|
|
2278
|
+
const projected = {};
|
|
2279
|
+
const rolledUpLine = /* @__PURE__ */ new Map();
|
|
2280
|
+
for (const id of Object.keys(relations).sort()) {
|
|
2281
|
+
const r = relations[id];
|
|
2282
|
+
const s = visibleAncestor(r.sourceId);
|
|
2283
|
+
const t = visibleAncestor(r.targetId);
|
|
2284
|
+
if (!s || !t || s === t) continue;
|
|
2285
|
+
if (s === r.sourceId && t === r.targetId) {
|
|
2286
|
+
projected[id] = r;
|
|
2287
|
+
continue;
|
|
2288
|
+
}
|
|
2289
|
+
if (isAncestor(s, t) || isAncestor(t, s)) continue;
|
|
2290
|
+
const key = `${s}\0${t}`;
|
|
2291
|
+
const kept = rolledUpLine.get(key);
|
|
2292
|
+
if (kept) {
|
|
2293
|
+
if (r.label) projected[kept] = { ...projected[kept], label: projected[kept].label ? `${projected[kept].label}
|
|
2294
|
+
${r.label}` : r.label };
|
|
2295
|
+
continue;
|
|
2296
|
+
}
|
|
2297
|
+
rolledUpLine.set(key, id);
|
|
2298
|
+
projected[id] = { ...r, sourceId: s, targetId: t };
|
|
2299
|
+
}
|
|
2300
|
+
return { nodes: visible, relations: projected };
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
// ../../packages/layout/src/elkLayout.ts
|
|
2304
|
+
var elk = new ELK();
|
|
2305
|
+
var LAYERED_OPTIONS = {
|
|
2306
|
+
"elk.algorithm": "layered",
|
|
2307
|
+
"elk.direction": "DOWN",
|
|
2308
|
+
// SEPARATE_CHILDREN (default): each compound node is laid out independently.
|
|
2309
|
+
// Cross-boundary crossing minimisation is handled by our geometric post-process
|
|
2310
|
+
// (minimizeCrossings in crossingOpt.ts) — safer than INCLUDE_CHILDREN which
|
|
2311
|
+
// crashes ELK's internal scanline constraint calculator with compound graphs.
|
|
2312
|
+
// ── Connected-component placement ────────────────────────────────────────
|
|
2313
|
+
"elk.separateConnectedComponents": "true",
|
|
2314
|
+
// ── Crossing minimisation ─────────────────────────────────────────────────
|
|
2315
|
+
"elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
|
|
2316
|
+
"elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
|
|
2317
|
+
"elk.layered.thoroughness": "50",
|
|
2318
|
+
"elk.layered.considerModelOrder.strategy": "NONE",
|
|
2319
|
+
// ── Node placement ────────────────────────────────────────────────────────
|
|
2320
|
+
"elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
|
|
2321
|
+
// ── Spacing ───────────────────────────────────────────────────────────────
|
|
2322
|
+
...ELK_ROOT_SPACING,
|
|
2323
|
+
// ── Post-layout ──────────────────────────────────────────────────────────
|
|
2324
|
+
"elk.layered.unnecessaryBendpoints": "true",
|
|
2325
|
+
"elk.layered.compaction.postCompaction.strategy": "EDGE_LENGTH",
|
|
2326
|
+
"elk.padding": "[top=120, right=30, bottom=30, left=30]"
|
|
2327
|
+
};
|
|
2328
|
+
var CHILD_OPTIONS = {
|
|
2329
|
+
"elk.algorithm": "layered",
|
|
2330
|
+
"elk.direction": "RIGHT",
|
|
2331
|
+
"elk.separateConnectedComponents": "true",
|
|
2332
|
+
"elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
|
|
2333
|
+
"elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
|
|
2334
|
+
"elk.layered.thoroughness": "50",
|
|
2335
|
+
"elk.layered.considerModelOrder.strategy": "NONE",
|
|
2336
|
+
"elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
|
|
2337
|
+
...ELK_CHILD_SPACING,
|
|
2338
|
+
"elk.layered.unnecessaryBendpoints": "true",
|
|
2339
|
+
"elk.layered.compaction.postCompaction.strategy": "EDGE_LENGTH",
|
|
2340
|
+
"elk.padding": "[top=110, right=20, bottom=20, left=20]"
|
|
2341
|
+
};
|
|
2342
|
+
function ancestorChain(nodeId, nodes) {
|
|
2343
|
+
const chain = [nodeId];
|
|
2344
|
+
let cur = nodes[nodeId];
|
|
2345
|
+
while (cur?.parentId) {
|
|
2346
|
+
chain.push(cur.parentId);
|
|
2347
|
+
cur = nodes[cur.parentId];
|
|
2348
|
+
}
|
|
2349
|
+
return chain;
|
|
2350
|
+
}
|
|
2351
|
+
function lcaContainerId(srcId, tgtId, nodes) {
|
|
2352
|
+
if (srcId === tgtId) return nodes[srcId]?.parentId;
|
|
2353
|
+
const srcSet = new Set(ancestorChain(srcId, nodes));
|
|
2354
|
+
for (const id of ancestorChain(tgtId, nodes)) {
|
|
2355
|
+
if (srcSet.has(id) && id !== srcId && id !== tgtId) return id;
|
|
2356
|
+
}
|
|
2357
|
+
return void 0;
|
|
2358
|
+
}
|
|
2359
|
+
function buildElkNode(n, allNodes, elkNodeMap) {
|
|
2360
|
+
const isCollapsed = n.collapsed && isContainerType(n.type);
|
|
2361
|
+
const width = isCollapsed ? COLLAPSED_WIDTH[n.type] : n.width;
|
|
2362
|
+
const height = isCollapsed ? COLLAPSED_HEIGHT[n.type] : n.height;
|
|
2363
|
+
const childC4 = isCollapsed ? [] : Object.values(allNodes).filter((c) => c.parentId === n.id);
|
|
2364
|
+
const children = childC4.map((c) => buildElkNode(c, allNodes, elkNodeMap));
|
|
2365
|
+
const elkNode = {
|
|
2366
|
+
id: n.id,
|
|
2367
|
+
width,
|
|
2368
|
+
height,
|
|
2369
|
+
layoutOptions: children.length > 0 ? CHILD_OPTIONS : void 0,
|
|
2370
|
+
children,
|
|
2371
|
+
edges: []
|
|
2372
|
+
};
|
|
2373
|
+
elkNodeMap[n.id] = elkNode;
|
|
2374
|
+
return elkNode;
|
|
2375
|
+
}
|
|
2376
|
+
function parseElkResult(node, result) {
|
|
2377
|
+
if (node.id !== "root" && node.x != null && node.y != null) {
|
|
2378
|
+
result[node.id] = { x: node.x, y: node.y, width: node.width, height: node.height };
|
|
2379
|
+
}
|
|
2380
|
+
for (const child of node.children ?? []) {
|
|
2381
|
+
parseElkResult(child, result);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
var PACKED_ASPECT = 1.6;
|
|
2385
|
+
var PACK_MIN_CHILDREN = 8;
|
|
2386
|
+
var PACK_MAX_LINKS_PER_CHILD = 1;
|
|
2387
|
+
var PACKED_OPTIONS = {
|
|
2388
|
+
// Box layout, rows filled in the given order (rectpacking moved elements
|
|
2389
|
+
// between rows to fill them, which split the linked ones apart).
|
|
2390
|
+
"elk.algorithm": "box",
|
|
2391
|
+
"elk.box.packingMode": "SIMPLE",
|
|
2392
|
+
// One block in this order: split into connected components, ELK placed
|
|
2393
|
+
// the components and the lone elements apart, each sorted its own way.
|
|
2394
|
+
"elk.separateConnectedComponents": "false",
|
|
2395
|
+
"elk.spacing.nodeNode": "40",
|
|
2396
|
+
"elk.padding": "[top=110, right=20, bottom=20, left=20]"
|
|
2397
|
+
};
|
|
2398
|
+
function childLinks(group, nodes, relations) {
|
|
2399
|
+
const childIds = new Set((group.children ?? []).map((c) => c.id));
|
|
2400
|
+
const childOf = (id) => {
|
|
2401
|
+
for (let cur = id; cur && nodes[cur]; cur = nodes[cur].parentId) if (childIds.has(cur)) return cur;
|
|
2402
|
+
return void 0;
|
|
2403
|
+
};
|
|
2404
|
+
const links = /* @__PURE__ */ new Map();
|
|
2405
|
+
for (const r of Object.values(relations)) {
|
|
2406
|
+
const a = childOf(r.sourceId);
|
|
2407
|
+
const b = childOf(r.targetId);
|
|
2408
|
+
if (!a || !b || a === b) continue;
|
|
2409
|
+
links.set(a, [...links.get(a) ?? [], b]);
|
|
2410
|
+
links.set(b, [...links.get(b) ?? [], a]);
|
|
2411
|
+
}
|
|
2412
|
+
return links;
|
|
2413
|
+
}
|
|
2414
|
+
function linkedOrder(children, links, nodes) {
|
|
2415
|
+
const name = (id) => (nodes[id]?.label ?? "").toLowerCase();
|
|
2416
|
+
const byName = (a, b) => name(a).localeCompare(name(b)) || (a < b ? -1 : a > b ? 1 : 0);
|
|
2417
|
+
children = [...children].sort((a, b) => byName(a.id, b.id));
|
|
2418
|
+
for (const list of links.values()) list.sort(byName);
|
|
2419
|
+
const byId = new Map(children.map((c) => [c.id, c]));
|
|
2420
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2421
|
+
const order = [];
|
|
2422
|
+
for (const start of children) {
|
|
2423
|
+
if (seen.has(start.id)) continue;
|
|
2424
|
+
const queue = [start.id];
|
|
2425
|
+
seen.add(start.id);
|
|
2426
|
+
while (queue.length) {
|
|
2427
|
+
const id = queue.shift();
|
|
2428
|
+
order.push(byId.get(id));
|
|
2429
|
+
for (const next of links.get(id) ?? []) if (!seen.has(next)) {
|
|
2430
|
+
seen.add(next);
|
|
2431
|
+
queue.push(next);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
return order;
|
|
2436
|
+
}
|
|
2437
|
+
async function applyElkLayout(inputNodes, inputRelations, opts) {
|
|
2438
|
+
const { nodes: c4Nodes, relations: c4Relations } = projectToVisibleGraph(inputNodes, inputRelations);
|
|
2439
|
+
const elkNodeMap = {};
|
|
2440
|
+
const childOpts = opts?.childOptions ?? CHILD_OPTIONS;
|
|
2441
|
+
const buildWith = (n) => {
|
|
2442
|
+
const built = buildElkNode(n, c4Nodes, elkNodeMap);
|
|
2443
|
+
const apply = (node) => {
|
|
2444
|
+
if (node.children && node.children.length > 0) {
|
|
2445
|
+
node.layoutOptions = childOpts;
|
|
2446
|
+
if (opts?.packSparseGroups && node.children.length >= PACK_MIN_CHILDREN) {
|
|
2447
|
+
const links = childLinks(node, c4Nodes, c4Relations);
|
|
2448
|
+
let count = 0;
|
|
2449
|
+
for (const list of links.values()) count += list.length;
|
|
2450
|
+
if (count / 2 <= node.children.length * PACK_MAX_LINKS_PER_CHILD) {
|
|
2451
|
+
const w = node.children.reduce((sum, c) => sum + (c.width ?? 0), 0);
|
|
2452
|
+
const h = node.children.reduce((sum, c) => sum + (c.height ?? 0), 0);
|
|
2453
|
+
node.layoutOptions = { ...PACKED_OPTIONS, "elk.aspectRatio": String(PACKED_ASPECT * (h > 0 ? w / h : 1)) };
|
|
2454
|
+
node.children = linkedOrder(node.children, links, c4Nodes);
|
|
2455
|
+
const count2 = node.children.length;
|
|
2456
|
+
node.children.forEach((c, i) => {
|
|
2457
|
+
c.layoutOptions = { ...c.layoutOptions, "elk.priority": String(count2 - i) };
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
for (const c of node.children) apply(c);
|
|
2462
|
+
}
|
|
2463
|
+
};
|
|
2464
|
+
apply(built);
|
|
2465
|
+
return built;
|
|
2466
|
+
};
|
|
2467
|
+
const rootChildren = Object.values(c4Nodes).filter((n) => !n.parentId).map(buildWith);
|
|
2468
|
+
const root = {
|
|
2469
|
+
id: "root",
|
|
2470
|
+
layoutOptions: opts?.rootOptions ?? LAYERED_OPTIONS,
|
|
2471
|
+
children: rootChildren,
|
|
2472
|
+
edges: []
|
|
2473
|
+
};
|
|
2474
|
+
elkNodeMap["root"] = root;
|
|
2475
|
+
for (const rel of Object.values(c4Relations)) {
|
|
2476
|
+
if (!c4Nodes[rel.sourceId] || !c4Nodes[rel.targetId]) continue;
|
|
2477
|
+
const lca = lcaContainerId(rel.sourceId, rel.targetId, c4Nodes);
|
|
2478
|
+
const container = (lca ? elkNodeMap[lca] : root) ?? root;
|
|
2479
|
+
const edge = { id: rel.id, sources: [rel.sourceId], targets: [rel.targetId] };
|
|
2480
|
+
if (!container.edges) container.edges = [];
|
|
2481
|
+
container.edges.push(edge);
|
|
2482
|
+
}
|
|
2483
|
+
try {
|
|
2484
|
+
const result = await elk.layout(root);
|
|
2485
|
+
const positions = {};
|
|
2486
|
+
parseElkResult(result, positions);
|
|
2487
|
+
return positions;
|
|
2488
|
+
} catch (err) {
|
|
2489
|
+
console.error("[ELK] Layout error:", err);
|
|
2490
|
+
return {};
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
var TREE_ROOT_OPTIONS = {
|
|
2494
|
+
"elk.algorithm": "layered",
|
|
2495
|
+
"elk.direction": "DOWN",
|
|
2496
|
+
"elk.separateConnectedComponents": "true",
|
|
2497
|
+
"elk.spacing.componentComponent": "60",
|
|
2498
|
+
"elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
|
|
2499
|
+
"elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
|
|
2500
|
+
"elk.layered.thoroughness": "50",
|
|
2501
|
+
// Honour input order so siblings stay close to their declared grouping —
|
|
2502
|
+
// the dominant cue users associate with "tree" layouts.
|
|
2503
|
+
"elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
|
|
2504
|
+
"elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
|
|
2505
|
+
"elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
|
|
2506
|
+
"elk.spacing.nodeNode": "50",
|
|
2507
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "70",
|
|
2508
|
+
"elk.spacing.edgeNode": "20",
|
|
2509
|
+
"elk.spacing.edgeEdge": "10",
|
|
2510
|
+
"elk.layered.compaction.postCompaction.strategy": "LEFT",
|
|
2511
|
+
"elk.layered.unnecessaryBendpoints": "true",
|
|
2512
|
+
"elk.padding": "[top=120, right=30, bottom=30, left=30]"
|
|
2513
|
+
};
|
|
2514
|
+
var TREE_CHILD_OPTIONS = {
|
|
2515
|
+
// Children of every compound container also flow top-down — this is what
|
|
2516
|
+
// produces the visible "nested tree" look (vs. the default ELK config
|
|
2517
|
+
// where compound children flow left-to-right).
|
|
2518
|
+
"elk.algorithm": "layered",
|
|
2519
|
+
"elk.direction": "DOWN",
|
|
2520
|
+
"elk.separateConnectedComponents": "true",
|
|
2521
|
+
"elk.spacing.componentComponent": "30",
|
|
2522
|
+
"elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
|
|
2523
|
+
"elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
|
|
2524
|
+
"elk.layered.thoroughness": "50",
|
|
2525
|
+
"elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
|
|
2526
|
+
"elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
|
|
2527
|
+
"elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
|
|
2528
|
+
"elk.spacing.nodeNode": "28",
|
|
2529
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "40",
|
|
2530
|
+
"elk.spacing.edgeNode": "12",
|
|
2531
|
+
"elk.spacing.edgeEdge": "8",
|
|
2532
|
+
"elk.layered.compaction.postCompaction.strategy": "LEFT",
|
|
2533
|
+
"elk.layered.unnecessaryBendpoints": "true",
|
|
2534
|
+
"elk.padding": "[top=110, right=20, bottom=20, left=20]"
|
|
2535
|
+
};
|
|
2536
|
+
async function applyTreeLayout(c4Nodes, c4Relations) {
|
|
2537
|
+
return applyElkLayout(c4Nodes, c4Relations, {
|
|
2538
|
+
rootOptions: TREE_ROOT_OPTIONS,
|
|
2539
|
+
childOptions: TREE_CHILD_OPTIONS
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
export {
|
|
2544
|
+
__commonJS,
|
|
2545
|
+
__toESM,
|
|
2546
|
+
isRelationAllowed,
|
|
2547
|
+
inferRelationType,
|
|
2548
|
+
isParentAllowed,
|
|
2549
|
+
GROUP_TYPE,
|
|
2550
|
+
placeOf,
|
|
2551
|
+
hasPlaceUnder,
|
|
2552
|
+
isPlacementAllowed,
|
|
2553
|
+
canAddMoreOfType,
|
|
2554
|
+
isReservedPropertyKey,
|
|
2555
|
+
propertyKeyProblem,
|
|
2556
|
+
refValue,
|
|
2557
|
+
refProblem,
|
|
2558
|
+
transitionLabel,
|
|
2559
|
+
requirementStatePhrase,
|
|
2560
|
+
validateModel,
|
|
2561
|
+
composeEarsSentence,
|
|
2562
|
+
builtInC4Metamodel,
|
|
2563
|
+
builtInGovernanceMetamodel,
|
|
2564
|
+
isContainerType,
|
|
2565
|
+
pinnedNodeIds,
|
|
2566
|
+
defaultGridColumns,
|
|
2567
|
+
landscapeGridColumns,
|
|
2568
|
+
gridCells,
|
|
2569
|
+
constraintLines,
|
|
2570
|
+
NODE_SIZES,
|
|
2571
|
+
COLLAPSED_HEIGHT,
|
|
2572
|
+
COLLAPSED_WIDTH,
|
|
2573
|
+
normalizeViewFolder,
|
|
2574
|
+
wikiDepthOf,
|
|
2575
|
+
viewShowsEveryNode,
|
|
2576
|
+
viewCanvasPositions,
|
|
2577
|
+
withCanvasPositions,
|
|
2578
|
+
removeFromViewList,
|
|
2579
|
+
addToViewList,
|
|
2580
|
+
effectiveWidth,
|
|
2581
|
+
effectiveHeight,
|
|
2582
|
+
drawnSize,
|
|
2583
|
+
isVisible,
|
|
2584
|
+
compoundPadding,
|
|
2585
|
+
fittedParentSize,
|
|
2586
|
+
fitAncestors,
|
|
2587
|
+
placeNewNode,
|
|
2588
|
+
createBatchPlacer,
|
|
2589
|
+
projectToVisibleGraph,
|
|
2590
|
+
ELK_ROOT_SPACING,
|
|
2591
|
+
ELK_CHILD_SPACING,
|
|
2592
|
+
applyElkLayout,
|
|
2593
|
+
applyTreeLayout
|
|
2594
|
+
};
|