@radicaltools/mcp 0.2.0 → 0.3.1
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/README.md +41 -23
- package/dist/{chunk-OGN3UW2D.js → chunk-2SZDTOYJ.js} +727 -89
- package/dist/{elkLayout-S62RLGTO.js → elkLayout-VYJDCCIT.js} +1 -1
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +1174 -0
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +1268 -0
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
- package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
- package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +1508 -0
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
- package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
- package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +1203 -0
- package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1647 -0
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
- package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
- package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +1284 -0
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +1386 -0
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1440 -0
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +10321 -3964
- package/package.json +1 -1
- package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
- package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
- package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
- package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
- package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
- package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
- package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
- package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
- package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
- package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
- package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
- package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
- package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
- package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
- package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
- package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
- package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
- package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
- package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
- package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
- package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
- package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
- package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
- package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
- package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
- package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
- package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
- package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
- package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
- package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
- package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
- package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
- package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
- package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
- package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
- package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
- package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
- package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
- package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
- package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
- package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
- package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
- package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
- package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
- package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
- package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
- package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
- package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
- package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
- package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
- package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
- package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
- package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
- package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
- package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
- package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
- package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
- package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
- package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
- package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
- package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
- package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
- package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
- package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
- package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
- package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
- package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
- package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
- package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
- package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
- package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
- package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
- package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
- package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
- package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
- package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
- package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
- package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
- package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
- package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
- package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
- package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
- package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
- package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
- package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
- package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
- package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
- package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
- package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
- package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
- package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
- package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
- package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
- package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
- package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
- package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
- package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
- package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
- package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
- package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
- package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
- package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
- package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
- package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
- package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
- package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
- package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
- package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
- package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
- package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
- package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
- package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
- package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
- package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
- package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
- package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
- package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
|
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
7
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
12
|
};
|
|
@@ -24,10 +27,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
27
|
mod
|
|
25
28
|
));
|
|
26
29
|
|
|
30
|
+
// <define:__RADICAL_BUILD__>
|
|
31
|
+
var define_RADICAL_BUILD_default;
|
|
32
|
+
var init_define_RADICAL_BUILD = __esm({
|
|
33
|
+
"<define:__RADICAL_BUILD__>"() {
|
|
34
|
+
define_RADICAL_BUILD_default = { version: "0.3.1", commit: "a7cec7e", date: "2026-10-31", release: true };
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
27
38
|
// ../../packages/layout/src/elkLayout.ts
|
|
39
|
+
init_define_RADICAL_BUILD();
|
|
28
40
|
import ELK from "elkjs/lib/elk.bundled.js";
|
|
29
41
|
|
|
42
|
+
// ../../packages/common/src/c4.ts
|
|
43
|
+
init_define_RADICAL_BUILD();
|
|
44
|
+
|
|
45
|
+
// ../../packages/common/src/metamodel/index.ts
|
|
46
|
+
init_define_RADICAL_BUILD();
|
|
47
|
+
|
|
48
|
+
// ../../packages/common/src/metamodel/types.ts
|
|
49
|
+
init_define_RADICAL_BUILD();
|
|
50
|
+
|
|
30
51
|
// ../../packages/common/src/metamodel/lookup.ts
|
|
52
|
+
init_define_RADICAL_BUILD();
|
|
31
53
|
function isRelationAllowed(metamodel, fromType, toType) {
|
|
32
54
|
if (!metamodel) return true;
|
|
33
55
|
const rts = Object.values(metamodel.relationTypes);
|
|
@@ -35,11 +57,14 @@ function isRelationAllowed(metamodel, fromType, toType) {
|
|
|
35
57
|
if (rts.some((rt) => rt.allowedPairs.length === 0)) return true;
|
|
36
58
|
return rts.some((rt) => rt.allowedPairs.some((p) => p.from === fromType && p.to === toType));
|
|
37
59
|
}
|
|
38
|
-
function
|
|
39
|
-
if (!metamodel) return
|
|
40
|
-
|
|
41
|
-
(rt) => rt.allowedPairs.length
|
|
60
|
+
function relationTypesFitting(metamodel, fromType, toType) {
|
|
61
|
+
if (!metamodel) return [];
|
|
62
|
+
return Object.values(metamodel.relationTypes).filter(
|
|
63
|
+
(rt) => rt.allowedPairs.length === 0 || rt.allowedPairs.some((p) => p.from === fromType && p.to === toType)
|
|
42
64
|
);
|
|
65
|
+
}
|
|
66
|
+
function inferRelationType(metamodel, fromType, toType) {
|
|
67
|
+
const matches = relationTypesFitting(metamodel, fromType, toType);
|
|
43
68
|
return matches.length === 1 ? matches[0].id : void 0;
|
|
44
69
|
}
|
|
45
70
|
function isParentAllowed(metamodel, childType, parentType) {
|
|
@@ -53,6 +78,20 @@ function isParentAllowed(metamodel, childType, parentType) {
|
|
|
53
78
|
}
|
|
54
79
|
return !!allowed && allowed.includes(parentType);
|
|
55
80
|
}
|
|
81
|
+
function hasAnyPlace(metamodel, type) {
|
|
82
|
+
const def = metamodel?.nodeTypes[type];
|
|
83
|
+
if (!def) return true;
|
|
84
|
+
return (def.allowedParents?.length ?? 0) > 0 || isParentAllowed(metamodel, type, void 0);
|
|
85
|
+
}
|
|
86
|
+
function allowedPlacesText(metamodel, type) {
|
|
87
|
+
const label = (t) => metamodel?.nodeTypes[t]?.label ?? t;
|
|
88
|
+
const places = (metamodel?.nodeTypes[type]?.allowedParents ?? []).map(label);
|
|
89
|
+
if (isParentAllowed(metamodel, type, void 0)) places.push("the canvas root");
|
|
90
|
+
return places.length ? places.join(", ") : `none (${noPlaceText(metamodel, type)})`;
|
|
91
|
+
}
|
|
92
|
+
function noPlaceText(metamodel, type) {
|
|
93
|
+
return `${metamodel?.nodeTypes[type]?.label ?? type} has no place in the metamodel`;
|
|
94
|
+
}
|
|
56
95
|
var GROUP_TYPE = "group";
|
|
57
96
|
function placeOf(node, nodes) {
|
|
58
97
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -78,8 +117,12 @@ function hasPlaceUnder(metamodel, childType, placeType) {
|
|
|
78
117
|
}
|
|
79
118
|
return false;
|
|
80
119
|
}
|
|
120
|
+
function isFinalState(node) {
|
|
121
|
+
return node?.type === "state" && node.kind === "final";
|
|
122
|
+
}
|
|
81
123
|
function isPlacementAllowed(metamodel, childType, parent, nodes) {
|
|
82
124
|
if (!isParentAllowed(metamodel, childType, parent?.type)) return false;
|
|
125
|
+
if (isFinalState(parent)) return false;
|
|
83
126
|
if (!parent || parent.type !== GROUP_TYPE) return true;
|
|
84
127
|
return hasPlaceUnder(metamodel, childType, placeOf(parent, nodes)?.type);
|
|
85
128
|
}
|
|
@@ -100,8 +143,37 @@ function propertyKeyProblem(key, of) {
|
|
|
100
143
|
if (!isReservedPropertyKey(key, of)) return null;
|
|
101
144
|
return `"${key}" is a field every ${of === "node" ? "element" : "relation"} has (${[...RESERVED_PROPERTY_KEYS[of]].join(", ")}): give the property another key.`;
|
|
102
145
|
}
|
|
146
|
+
function chainTypeNames(raw) {
|
|
147
|
+
const nodeTypes = /* @__PURE__ */ new Set();
|
|
148
|
+
const relationTypes = /* @__PURE__ */ new Set();
|
|
149
|
+
const strings = (v) => Array.isArray(v) ? v.filter((t) => typeof t === "string") : [];
|
|
150
|
+
const levels = raw && typeof raw === "object" ? raw.levels : void 0;
|
|
151
|
+
for (const level of Array.isArray(levels) ? levels : []) {
|
|
152
|
+
if (!level || typeof level !== "object") continue;
|
|
153
|
+
const l = level;
|
|
154
|
+
for (const way of Array.isArray(l.ways) ? l.ways : [l]) {
|
|
155
|
+
if (!way || typeof way !== "object") continue;
|
|
156
|
+
const w = way;
|
|
157
|
+
for (const t of strings(w.types)) nodeTypes.add(t);
|
|
158
|
+
if (typeof w.via?.relationType === "string") relationTypes.add(w.via.relationType);
|
|
159
|
+
}
|
|
160
|
+
for (const filter of Array.isArray(l.filters) ? l.filters : []) {
|
|
161
|
+
const f = filter ?? {};
|
|
162
|
+
if (f.kind === "type") for (const t of strings(f.types)) nodeTypes.add(t);
|
|
163
|
+
if (f.kind === "relation" && typeof f.relationType === "string") relationTypes.add(f.relationType);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return { nodeTypes: [...nodeTypes], relationTypes: [...relationTypes] };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ../../packages/common/src/metamodel/validate.ts
|
|
170
|
+
init_define_RADICAL_BUILD();
|
|
171
|
+
|
|
172
|
+
// ../../packages/common/src/metamodel/statechart.ts
|
|
173
|
+
init_define_RADICAL_BUILD();
|
|
103
174
|
|
|
104
175
|
// ../../packages/common/src/metamodel/refs.ts
|
|
176
|
+
init_define_RADICAL_BUILD();
|
|
105
177
|
function refIds(value) {
|
|
106
178
|
if (typeof value === "string") return value ? [value] : [];
|
|
107
179
|
if (Array.isArray(value)) return value.filter((v) => typeof v === "string" && v !== "");
|
|
@@ -165,6 +237,46 @@ function requirementStatePhrase(requirement, nodes, relations) {
|
|
|
165
237
|
const entity = machine ? machineEntity(machine.id, nodes, relations) : void 0;
|
|
166
238
|
return entity ? `the ${entity.label} is ${state.label}` : `in ${state.label}`;
|
|
167
239
|
}
|
|
240
|
+
function transitionRefusal(src, dst, nodes, relations, exceptId) {
|
|
241
|
+
const inLabel = (n) => n.parentId ? nodes[n.parentId]?.label ?? "" : "";
|
|
242
|
+
if (isState(src) && stateKind(src) === "final") return `Final state "${src.label}" cannot have outgoing transitions.`;
|
|
243
|
+
if (isPseudo(dst) && pseudoKind(dst) === "initial") return `A transition cannot point at the initial pseudostate of "${inLabel(dst)}"; target the state itself.`;
|
|
244
|
+
if (isPseudo(src) && pseudoKind(src) === "initial" && Object.values(relations).some((r) => r.id !== exceptId && r.sourceId === src.id && r.relationType === "transition")) {
|
|
245
|
+
return `The initial pseudostate of "${inLabel(src)}" has its one transition, to the default state, already.`;
|
|
246
|
+
}
|
|
247
|
+
const from = machineOf(src, nodes);
|
|
248
|
+
const to = machineOf(dst, nodes);
|
|
249
|
+
if (from && to && from.id !== to.id) return `A transition cannot leave its state machine ("${from.label}" \u2192 "${to.label}").`;
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
function lifecycleRefusal(machine, entity, nodes, relations, exceptId) {
|
|
253
|
+
for (const r of Object.values(relations)) {
|
|
254
|
+
if (r.id === exceptId || r.relationType !== "lifecycle-of") continue;
|
|
255
|
+
if (r.targetId === entity.id && r.sourceId !== machine.id && nodes[r.sourceId]) {
|
|
256
|
+
return `Entity "${entity.label}" has a state machine already ("${nodes[r.sourceId].label}"); model one lifecycle, with parallel regions if parts of it progress at once.`;
|
|
257
|
+
}
|
|
258
|
+
if (r.sourceId === machine.id && r.targetId !== entity.id && nodes[r.targetId]) {
|
|
259
|
+
return `State machine "${machine.label}" is the lifecycle of "${nodes[r.targetId].label}" already.`;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
function initialPseudostateRefusal(parent, nodes, exceptId) {
|
|
265
|
+
if (!parent) return null;
|
|
266
|
+
if (isState(parent) && stateKind(parent) === "parallel") return `Parallel state "${parent.label}" enters all its regions; it takes no initial pseudostate.`;
|
|
267
|
+
const held = Object.values(nodes).some((n) => n.id !== exceptId && n.parentId === parent.id && isPseudo(n) && pseudoKind(n) === "initial");
|
|
268
|
+
if (held) return `"${parent.label}" has an initial pseudostate already; keep one.`;
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
function newPseudostateKind(parent, nodes) {
|
|
272
|
+
return initialPseudostateRefusal(parent, nodes) ? "choice" : "initial";
|
|
273
|
+
}
|
|
274
|
+
function isInitialPseudostate(node) {
|
|
275
|
+
return isPseudo(node) && pseudoKind(node) === "initial";
|
|
276
|
+
}
|
|
277
|
+
function outgoingTransitionCount(id, relations) {
|
|
278
|
+
return Object.values(relations).filter((r) => r.sourceId === id && r.relationType === "transition").length;
|
|
279
|
+
}
|
|
168
280
|
function validateStateMachines(nodes, relations) {
|
|
169
281
|
const nodeList = Object.values(nodes);
|
|
170
282
|
if (!nodeList.some((n) => n.type === "state-machine" || n.type === "state" || n.type === "pseudostate")) return [];
|
|
@@ -302,6 +414,7 @@ function validateStateMachines(nodes, relations) {
|
|
|
302
414
|
}
|
|
303
415
|
|
|
304
416
|
// ../../packages/common/src/metamodel/domainModel.ts
|
|
417
|
+
init_define_RADICAL_BUILD();
|
|
305
418
|
var kindOf = (n) => {
|
|
306
419
|
const kind = n.kind;
|
|
307
420
|
return typeof kind === "string" && kind ? kind : "aggregate-root";
|
|
@@ -341,9 +454,25 @@ function validateDomainModel(nodes, relations) {
|
|
|
341
454
|
}
|
|
342
455
|
|
|
343
456
|
// ../../packages/common/src/metamodel/validate.ts
|
|
457
|
+
var isNoValue = (v) => v == null || v === "" || Array.isArray(v) && v.length === 0;
|
|
344
458
|
function validateModel(nodes, relations, metamodel) {
|
|
345
459
|
const issues = [];
|
|
346
460
|
const nodeList = Object.values(nodes);
|
|
461
|
+
const checkValues = (item, props, at, what) => {
|
|
462
|
+
const key = at.nodeId ?? at.relationId;
|
|
463
|
+
for (const p of props ?? []) {
|
|
464
|
+
const v = item[p.key];
|
|
465
|
+
if (p.required && isNoValue(v) && isNoValue(p.default)) {
|
|
466
|
+
issues.push({ id: `missing-prop:${key}:${p.key}`, severity: "warning", message: `${what} is missing required property "${p.label}".`, ...at });
|
|
467
|
+
}
|
|
468
|
+
if (p.type === "enum" && p.options?.length && !isNoValue(v) && !p.options.includes(String(v))) {
|
|
469
|
+
issues.push({ id: `bad-option:${key}:${p.key}`, severity: "warning", message: `${what}: "${p.label}" is "${String(v)}", which is not one of its options (${p.options.join(", ")}).`, ...at });
|
|
470
|
+
}
|
|
471
|
+
if (p.type === "ref" && !p.multiple && refIds(v).length > 1) {
|
|
472
|
+
issues.push({ id: `many-refs:${key}:${p.key}`, severity: "warning", message: `${what}: "${p.label}" points at ${refIds(v).length} elements, but takes one.`, ...at });
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
};
|
|
347
476
|
for (const n of nodeList) {
|
|
348
477
|
const def = metamodel.nodeTypes[n.type];
|
|
349
478
|
if (!def) {
|
|
@@ -365,12 +494,13 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
365
494
|
message: `Node "${n.label}" references a missing parent.`,
|
|
366
495
|
nodeId: n.id
|
|
367
496
|
});
|
|
368
|
-
} else if (
|
|
497
|
+
} else if (!allowed?.includes(parent.type)) {
|
|
369
498
|
const parentLabel = metamodel.nodeTypes[parent.type]?.label ?? parent.type;
|
|
499
|
+
const none = isParentAllowed(metamodel, n.type, void 0) ? "(none \u2014 must be root)" : "(none)";
|
|
370
500
|
issues.push({
|
|
371
501
|
id: `bad-parent:${n.id}`,
|
|
372
502
|
severity: "error",
|
|
373
|
-
message: `${def.label} "${n.label}" cannot be inside ${parentLabel}. Allowed parents: ${allowed
|
|
503
|
+
message: `${def.label} "${n.label}" cannot be inside ${parentLabel}. Allowed parents: ${allowed?.length ? allowed.join(", ") : none}.`,
|
|
374
504
|
nodeId: n.id
|
|
375
505
|
});
|
|
376
506
|
} else if (parent.type === GROUP_TYPE && !hasPlaceUnder(metamodel, n.type, placeOf(parent, nodes)?.type)) {
|
|
@@ -391,18 +521,7 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
391
521
|
nodeId: n.id
|
|
392
522
|
});
|
|
393
523
|
}
|
|
394
|
-
|
|
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
|
-
}
|
|
524
|
+
checkValues(n, def.properties, { nodeId: n.id }, `${def.label} "${n.label}"`);
|
|
406
525
|
}
|
|
407
526
|
for (const def of Object.values(metamodel.nodeTypes)) {
|
|
408
527
|
const c = def.cardinality;
|
|
@@ -425,6 +544,15 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
425
544
|
});
|
|
426
545
|
}
|
|
427
546
|
}
|
|
547
|
+
for (const def of Object.values(metamodel.nodeTypes)) {
|
|
548
|
+
if (hasAnyPlace(metamodel, def.id)) continue;
|
|
549
|
+
issues.push({
|
|
550
|
+
id: `no-place:${def.id}`,
|
|
551
|
+
severity: "warning",
|
|
552
|
+
message: `${noPlaceText(metamodel, def.id)}: no allowed parent, and not at the root, so nothing can be placed as a ${def.label}.`,
|
|
553
|
+
nodeTypeId: def.id
|
|
554
|
+
});
|
|
555
|
+
}
|
|
428
556
|
for (const def of [...Object.values(metamodel.nodeTypes), ...Object.values(metamodel.relationTypes)]) {
|
|
429
557
|
const seen = /* @__PURE__ */ new Set();
|
|
430
558
|
for (const p of def.properties ?? []) {
|
|
@@ -451,6 +579,19 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
451
579
|
}
|
|
452
580
|
}
|
|
453
581
|
}
|
|
582
|
+
for (const vp of Array.isArray(metamodel.viewpoints) ? metamodel.viewpoints : []) {
|
|
583
|
+
if (!vp || typeof vp !== "object") continue;
|
|
584
|
+
const named = chainTypeNames(vp.pipeline);
|
|
585
|
+
const subject = Array.isArray(vp.subject?.types) ? vp.subject.types : [];
|
|
586
|
+
for (const t of /* @__PURE__ */ new Set([...subject, ...named.nodeTypes])) {
|
|
587
|
+
if (metamodel.nodeTypes[t]) continue;
|
|
588
|
+
issues.push({ id: `viewpoint-unknown-type:${vp.id}:${t}`, severity: "warning", message: `Viewpoint "${vp.label}" names node type "${t}", which the metamodel does not have.` });
|
|
589
|
+
}
|
|
590
|
+
for (const t of named.relationTypes) {
|
|
591
|
+
if (metamodel.relationTypes[t]) continue;
|
|
592
|
+
issues.push({ id: `viewpoint-unknown-rel-type:${vp.id}:${t}`, severity: "warning", message: `Viewpoint "${vp.label}" names relation type "${t}", which the metamodel does not have.` });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
454
595
|
const restrictiveTypes = Object.values(metamodel.relationTypes).filter((rt) => rt.allowedPairs.length > 0);
|
|
455
596
|
const anyAllows = Object.values(metamodel.relationTypes).some((rt) => rt.allowedPairs.length === 0);
|
|
456
597
|
if (restrictiveTypes.length > 0 && !anyAllows) {
|
|
@@ -492,20 +633,24 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
492
633
|
}
|
|
493
634
|
for (const r of Object.values(relations)) {
|
|
494
635
|
const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
636
|
+
if (!def) continue;
|
|
637
|
+
const src = nodes[r.sourceId]?.label ?? r.sourceId;
|
|
638
|
+
const dst = nodes[r.targetId]?.label ?? r.targetId;
|
|
639
|
+
checkValues(r, def.properties, { relationId: r.id }, `Relation "${src}" \u2192 "${dst}" (${def.label})`);
|
|
640
|
+
}
|
|
641
|
+
for (const r of Object.values(relations)) {
|
|
642
|
+
if (r.relationType) continue;
|
|
643
|
+
const src = nodes[r.sourceId];
|
|
644
|
+
const dst = nodes[r.targetId];
|
|
645
|
+
if (!src || !dst) continue;
|
|
646
|
+
const fitting = relationTypesFitting(metamodel, src.type, dst.type);
|
|
647
|
+
if (fitting.length < 2) continue;
|
|
648
|
+
issues.push({
|
|
649
|
+
id: `untyped-rel:${r.id}`,
|
|
650
|
+
severity: "warning",
|
|
651
|
+
message: `Relation "${src.label}" \u2192 "${dst.label}" has no type; give it one of ${fitting.map((rt) => `"${rt.label}"`).join(", ")}.`,
|
|
652
|
+
relationId: r.id
|
|
653
|
+
});
|
|
509
654
|
}
|
|
510
655
|
for (const r of Object.values(relations)) {
|
|
511
656
|
const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
|
|
@@ -556,7 +701,23 @@ function validateModel(nodes, relations, metamodel) {
|
|
|
556
701
|
return issues;
|
|
557
702
|
}
|
|
558
703
|
|
|
704
|
+
// ../../packages/common/src/metamodel/prose.ts
|
|
705
|
+
init_define_RADICAL_BUILD();
|
|
706
|
+
function relationPhrase(def, direction, ends) {
|
|
707
|
+
if (!def) return { text: direction === "out" ? "Relates to" : "Linked from", reads: true };
|
|
708
|
+
const pair = ends ? def.allowedPairs.find((p) => p.from === ends.from && p.to === ends.to) : void 0;
|
|
709
|
+
if (direction === "out") return { text: pair?.forwardLabel?.trim() || def.forwardLabel?.trim() || def.label, reads: true };
|
|
710
|
+
const inverse = pair?.inverseLabel?.trim() || def.inverseLabel?.trim();
|
|
711
|
+
return inverse ? { text: inverse, reads: true } : { text: def.label, reads: false };
|
|
712
|
+
}
|
|
713
|
+
function relationTypeName(metamodel, typeId, lower = false, ends) {
|
|
714
|
+
const def = metamodel?.relationTypes[typeId];
|
|
715
|
+
const text = def ? relationPhrase(def, "out", ends).text : typeId;
|
|
716
|
+
return lower ? text.charAt(0).toLowerCase() + text.slice(1) : text;
|
|
717
|
+
}
|
|
718
|
+
|
|
559
719
|
// ../../packages/common/src/metamodel/ears.ts
|
|
720
|
+
init_define_RADICAL_BUILD();
|
|
560
721
|
function capitalize(s) {
|
|
561
722
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
562
723
|
}
|
|
@@ -613,12 +774,34 @@ function composeEarsSentence(node, subject, statePrecondition) {
|
|
|
613
774
|
return { sentence, complete };
|
|
614
775
|
}
|
|
615
776
|
|
|
777
|
+
// ../../packages/common/src/metamodel/wizard.ts
|
|
778
|
+
init_define_RADICAL_BUILD();
|
|
779
|
+
|
|
780
|
+
// ../../packages/common/src/metamodel/categories.ts
|
|
781
|
+
init_define_RADICAL_BUILD();
|
|
782
|
+
|
|
783
|
+
// ../../packages/common/src/metamodel/layoutHints.ts
|
|
784
|
+
init_define_RADICAL_BUILD();
|
|
785
|
+
|
|
786
|
+
// ../../packages/common/src/metamodel/presets/governance.ts
|
|
787
|
+
init_define_RADICAL_BUILD();
|
|
788
|
+
|
|
789
|
+
// ../../packages/common/src/metamodel/presets/ddd.ts
|
|
790
|
+
init_define_RADICAL_BUILD();
|
|
791
|
+
|
|
792
|
+
// ../../packages/common/src/metamodel/presets/c4.ts
|
|
793
|
+
init_define_RADICAL_BUILD();
|
|
794
|
+
|
|
616
795
|
// ../../packages/common/src/metamodel/presets/viewpoints.ts
|
|
796
|
+
init_define_RADICAL_BUILD();
|
|
617
797
|
var DEPLOYABLE = ["container", "webapp", "database", "queue"];
|
|
618
798
|
var BUILDING_BLOCKS = ["system", "container", "webapp", "component", "database", "queue"];
|
|
619
799
|
function among(types) {
|
|
620
800
|
return { levels: [{ ways: [{ types }] }], edges: "all" };
|
|
621
801
|
}
|
|
802
|
+
function aroundOne(types, around) {
|
|
803
|
+
return { levels: [{ ways: [{ types }] }, { ways: [{ via: { anyRelation: true }, types: around }] }], edges: "all" };
|
|
804
|
+
}
|
|
622
805
|
function c4Viewpoints() {
|
|
623
806
|
return [
|
|
624
807
|
{
|
|
@@ -637,6 +820,15 @@ function c4Viewpoints() {
|
|
|
637
820
|
kind: "static",
|
|
638
821
|
pipeline: among(["person", "system", ...DEPLOYABLE])
|
|
639
822
|
},
|
|
823
|
+
{
|
|
824
|
+
id: "system-containers",
|
|
825
|
+
label: "Containers of a system",
|
|
826
|
+
group: "C4",
|
|
827
|
+
description: "One software system with the containers, web apps, databases and queues inside it, and the people, systems and containers they are related to: a view per system (C4 level 2).",
|
|
828
|
+
kind: "static",
|
|
829
|
+
subject: { types: ["system"] },
|
|
830
|
+
pipeline: aroundOne(["system", ...DEPLOYABLE], ["person", "system", ...DEPLOYABLE])
|
|
831
|
+
},
|
|
640
832
|
{
|
|
641
833
|
id: "components",
|
|
642
834
|
label: "Components",
|
|
@@ -645,6 +837,15 @@ function c4Viewpoints() {
|
|
|
645
837
|
kind: "static",
|
|
646
838
|
pipeline: among(["container", "webapp", "component", "database", "queue"])
|
|
647
839
|
},
|
|
840
|
+
{
|
|
841
|
+
id: "container-components",
|
|
842
|
+
label: "Components of a container",
|
|
843
|
+
group: "C4",
|
|
844
|
+
description: "One container or web app with the components inside it, and the people, systems, containers and components they are related to: a view per container (C4 level 3).",
|
|
845
|
+
kind: "static",
|
|
846
|
+
subject: { types: ["container", "webapp"] },
|
|
847
|
+
pipeline: aroundOne(["container", "webapp", "component"], ["person", "system", ...DEPLOYABLE, "component"])
|
|
848
|
+
},
|
|
648
849
|
{
|
|
649
850
|
id: "container-dependencies",
|
|
650
851
|
label: "Container dependencies",
|
|
@@ -674,6 +875,21 @@ function radicalViewpoints() {
|
|
|
674
875
|
kind: "static",
|
|
675
876
|
pipeline: among(["entity"])
|
|
676
877
|
},
|
|
878
|
+
{
|
|
879
|
+
id: "domain-entities",
|
|
880
|
+
label: "Entities of a domain",
|
|
881
|
+
group: "Domain",
|
|
882
|
+
description: "One domain with its subdomains and entities, and the entities of other domains they reference or are part of: a view per domain.",
|
|
883
|
+
kind: "static",
|
|
884
|
+
subject: { types: ["domain"] },
|
|
885
|
+
pipeline: {
|
|
886
|
+
levels: [
|
|
887
|
+
{ ways: [{ types: ["domain", "entity"] }] },
|
|
888
|
+
{ ways: [{ via: { relationType: "references", direction: "out" }, types: ["entity"] }, { via: { relationType: "part-of", direction: "out" }, types: ["entity"] }] }
|
|
889
|
+
],
|
|
890
|
+
edges: "all"
|
|
891
|
+
}
|
|
892
|
+
},
|
|
677
893
|
{
|
|
678
894
|
id: "domain-realisation",
|
|
679
895
|
label: "Domain realisation",
|
|
@@ -775,14 +991,14 @@ function radicalViewpoints() {
|
|
|
775
991
|
id: "fitness-functions",
|
|
776
992
|
label: "Fitness functions",
|
|
777
993
|
group: "Decisions",
|
|
778
|
-
description: "A table of the fitness functions by
|
|
994
|
+
description: "A table of the fitness functions by characteristic, each with the decisions it checks and the elements it constrains.",
|
|
779
995
|
kind: "table",
|
|
780
996
|
pipeline: {
|
|
781
997
|
levels: [
|
|
782
998
|
{ ways: [{ types: ["fitness-fn"] }] },
|
|
783
999
|
{ ways: [{ via: { relationType: "implements", direction: "out" }, types: ["adr"] }, { via: { relationType: "constrains", direction: "out" } }] }
|
|
784
1000
|
],
|
|
785
|
-
sort: { by: "property", key: "
|
|
1001
|
+
sort: { by: "property", key: "characteristic" }
|
|
786
1002
|
}
|
|
787
1003
|
},
|
|
788
1004
|
{
|
|
@@ -816,6 +1032,21 @@ function radicalViewpoints() {
|
|
|
816
1032
|
{ ways: [{ via: { relationType: "implements", direction: "in" } }, { via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
|
|
817
1033
|
] }
|
|
818
1034
|
},
|
|
1035
|
+
{
|
|
1036
|
+
id: "state-machine",
|
|
1037
|
+
label: "State machine",
|
|
1038
|
+
group: "States",
|
|
1039
|
+
description: "One state machine with its states, pseudostates, events and transitions, and the entity it is the lifecycle of: a view per machine.",
|
|
1040
|
+
kind: "static",
|
|
1041
|
+
subject: { types: ["state-machine"] },
|
|
1042
|
+
pipeline: {
|
|
1043
|
+
levels: [
|
|
1044
|
+
{ ways: [{ types: ["state-machine", "state", "pseudostate", "event"] }] },
|
|
1045
|
+
{ ways: [{ via: { relationType: "lifecycle-of", direction: "out" }, types: ["entity"] }] }
|
|
1046
|
+
],
|
|
1047
|
+
edges: "all"
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
819
1050
|
{
|
|
820
1051
|
id: "event-catalogue",
|
|
821
1052
|
label: "Event catalogue",
|
|
@@ -834,6 +1065,15 @@ function radicalViewpoints() {
|
|
|
834
1065
|
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
1066
|
kind: "warnier",
|
|
836
1067
|
pipeline: { levels: [{ ways: [{ types: ["process", "step"] }] }] }
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
id: "process",
|
|
1071
|
+
label: "Process",
|
|
1072
|
+
group: "Process",
|
|
1073
|
+
description: "One process and its steps as a Warnier\u2013Orr diagram: a view per process.",
|
|
1074
|
+
kind: "warnier",
|
|
1075
|
+
subject: { types: ["process"] },
|
|
1076
|
+
pipeline: { levels: [{ ways: [{ types: ["process", "step"] }] }] }
|
|
837
1077
|
}
|
|
838
1078
|
];
|
|
839
1079
|
}
|
|
@@ -930,6 +1170,11 @@ var VISUALS = {
|
|
|
930
1170
|
collapsedHeight: 220
|
|
931
1171
|
}
|
|
932
1172
|
};
|
|
1173
|
+
var LAYOUT = {
|
|
1174
|
+
person: { role: "actor", side: "top" },
|
|
1175
|
+
database: { role: "store", side: "right" },
|
|
1176
|
+
queue: { role: "broker" }
|
|
1177
|
+
};
|
|
933
1178
|
function builtInC4Metamodel() {
|
|
934
1179
|
const nodeTypes = {};
|
|
935
1180
|
const allowedParentsMap = {
|
|
@@ -963,6 +1208,7 @@ function builtInC4Metamodel() {
|
|
|
963
1208
|
nodeTypes[t] = {
|
|
964
1209
|
id: t,
|
|
965
1210
|
label: v.label,
|
|
1211
|
+
...LAYOUT[t] ? { layout: LAYOUT[t] } : {},
|
|
966
1212
|
description: v.description,
|
|
967
1213
|
color: v.color,
|
|
968
1214
|
fg: v.fg,
|
|
@@ -978,14 +1224,18 @@ function builtInC4Metamodel() {
|
|
|
978
1224
|
properties: props
|
|
979
1225
|
};
|
|
980
1226
|
}
|
|
1227
|
+
const DELIVERS = { forwardLabel: "Delivers to", inverseLabel: "Receives from" };
|
|
981
1228
|
const interactsPairs = [
|
|
982
|
-
// Person interacts with the system surface
|
|
1229
|
+
// Person interacts with the system surface, and with other people (a
|
|
1230
|
+
// customer asks the support staff: Structurizr models it)
|
|
1231
|
+
{ from: "person", to: "person", forwardLabel: "Interacts with", inverseLabel: "Interacts with" },
|
|
983
1232
|
{ from: "person", to: "system" },
|
|
984
1233
|
{ from: "person", to: "container" },
|
|
985
1234
|
{ from: "person", to: "webapp" },
|
|
986
1235
|
{ from: "person", to: "component" },
|
|
987
|
-
// System-level dependencies
|
|
988
|
-
|
|
1236
|
+
// System-level dependencies; to a person a relation delivers (Structurizr's
|
|
1237
|
+
// delivers(): "Sends e-mails to")
|
|
1238
|
+
{ from: "system", to: "person", ...DELIVERS },
|
|
989
1239
|
{ from: "system", to: "system" },
|
|
990
1240
|
{ from: "system", to: "container" },
|
|
991
1241
|
{ from: "system", to: "database" },
|
|
@@ -993,19 +1243,23 @@ function builtInC4Metamodel() {
|
|
|
993
1243
|
{ from: "system", to: "queue" },
|
|
994
1244
|
{ from: "system", to: "component" },
|
|
995
1245
|
// Container-level calls
|
|
996
|
-
{ from: "container", to: "person" },
|
|
1246
|
+
{ from: "container", to: "person", ...DELIVERS },
|
|
997
1247
|
{ from: "container", to: "system" },
|
|
998
1248
|
{ from: "container", to: "container" },
|
|
999
1249
|
{ from: "container", to: "database" },
|
|
1000
1250
|
{ from: "container", to: "webapp" },
|
|
1001
1251
|
{ from: "container", to: "queue" },
|
|
1252
|
+
// …and calls a component of another container (a single-page app calls
|
|
1253
|
+
// the API's controllers, as Structurizr models it)
|
|
1254
|
+
{ from: "container", to: "component" },
|
|
1002
1255
|
// Web / UI container
|
|
1003
|
-
{ from: "webapp", to: "person" },
|
|
1256
|
+
{ from: "webapp", to: "person", ...DELIVERS },
|
|
1004
1257
|
{ from: "webapp", to: "system" },
|
|
1005
1258
|
{ from: "webapp", to: "container" },
|
|
1006
1259
|
{ from: "webapp", to: "database" },
|
|
1007
1260
|
{ from: "webapp", to: "webapp" },
|
|
1008
1261
|
{ from: "webapp", to: "queue" },
|
|
1262
|
+
{ from: "webapp", to: "component" },
|
|
1009
1263
|
// Queues fan out to consumers
|
|
1010
1264
|
{ from: "queue", to: "container" },
|
|
1011
1265
|
{ from: "queue", to: "webapp" },
|
|
@@ -1029,7 +1283,8 @@ function builtInC4Metamodel() {
|
|
|
1029
1283
|
properties: [
|
|
1030
1284
|
{ key: "technology", label: "Technology", type: "text" }
|
|
1031
1285
|
],
|
|
1032
|
-
builtin: true
|
|
1286
|
+
builtin: true,
|
|
1287
|
+
layout: { flow: "forward" }
|
|
1033
1288
|
}
|
|
1034
1289
|
};
|
|
1035
1290
|
return { id: "c4-builtin", name: "C4 (built-in)", nodeTypes, relationTypes, viewpoints: c4Viewpoints() };
|
|
@@ -1056,6 +1311,7 @@ function builtInDddC4Metamodel() {
|
|
|
1056
1311
|
];
|
|
1057
1312
|
const domain = {
|
|
1058
1313
|
id: "domain",
|
|
1314
|
+
layout: { role: "element" },
|
|
1059
1315
|
label: "Domain",
|
|
1060
1316
|
description: "A part of the problem space, in the language of the business rather than of the software.",
|
|
1061
1317
|
color: "#4c1d95",
|
|
@@ -1073,6 +1329,7 @@ function builtInDddC4Metamodel() {
|
|
|
1073
1329
|
};
|
|
1074
1330
|
const entity = {
|
|
1075
1331
|
id: "entity",
|
|
1332
|
+
layout: { role: "element" },
|
|
1076
1333
|
label: "Entity",
|
|
1077
1334
|
description: "A thing the domain keeps track of and that has an identity over time: a reservation, an order, a payment.",
|
|
1078
1335
|
color: "#7e22ce",
|
|
@@ -1099,6 +1356,7 @@ function builtInDddC4Metamodel() {
|
|
|
1099
1356
|
};
|
|
1100
1357
|
const realises = {
|
|
1101
1358
|
id: "realises",
|
|
1359
|
+
layout: { flow: "side" },
|
|
1102
1360
|
label: "Realises",
|
|
1103
1361
|
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
1362
|
inverseLabel: "Realised by",
|
|
@@ -1112,6 +1370,7 @@ function builtInDddC4Metamodel() {
|
|
|
1112
1370
|
};
|
|
1113
1371
|
const partOf = {
|
|
1114
1372
|
id: "part-of",
|
|
1373
|
+
layout: { flow: "reverse", axis: "vertical" },
|
|
1115
1374
|
label: "Part of",
|
|
1116
1375
|
description: "A part of an aggregate points to its root.",
|
|
1117
1376
|
inverseLabel: "Made up of",
|
|
@@ -1122,6 +1381,7 @@ function builtInDddC4Metamodel() {
|
|
|
1122
1381
|
};
|
|
1123
1382
|
const references = {
|
|
1124
1383
|
id: "references",
|
|
1384
|
+
layout: { flow: "side", axis: "horizontal" },
|
|
1125
1385
|
label: "References",
|
|
1126
1386
|
description: "One aggregate refers to another by id.",
|
|
1127
1387
|
inverseLabel: "Referenced by",
|
|
@@ -1144,6 +1404,7 @@ function builtInDddC4Metamodel() {
|
|
|
1144
1404
|
];
|
|
1145
1405
|
const dependsOn = {
|
|
1146
1406
|
id: "depends-on",
|
|
1407
|
+
layout: { flow: "forward" },
|
|
1147
1408
|
label: "Depends on",
|
|
1148
1409
|
description: "The source domain needs the target to do its work.",
|
|
1149
1410
|
inverseLabel: "Depended on by",
|
|
@@ -1155,6 +1416,7 @@ function builtInDddC4Metamodel() {
|
|
|
1155
1416
|
};
|
|
1156
1417
|
const partnership = {
|
|
1157
1418
|
id: "partnership",
|
|
1419
|
+
layout: { flow: "side", axis: "horizontal" },
|
|
1158
1420
|
label: "Partnership",
|
|
1159
1421
|
description: "How the models of two domains meet, with a context-mapping pattern.",
|
|
1160
1422
|
forwardLabel: "Partners with",
|
|
@@ -1203,11 +1465,33 @@ function builtInDddC4Metamodel() {
|
|
|
1203
1465
|
|
|
1204
1466
|
// ../../packages/common/src/metamodel/presets/governance.ts
|
|
1205
1467
|
var RADICAL_METAMODEL_NAME = "Radical";
|
|
1206
|
-
var
|
|
1207
|
-
key: "
|
|
1208
|
-
label: "
|
|
1209
|
-
type: "
|
|
1210
|
-
|
|
1468
|
+
var METRICS_PROPERTIES = [
|
|
1469
|
+
{ key: "metrics", label: "Metrics (one per line: test(file \u203A title) passed, or metric{labels} <= value unit)", type: "textarea" },
|
|
1470
|
+
{ key: "combine", label: "Combine (all, any, at least N)", type: "text" },
|
|
1471
|
+
{ key: "max_age", label: "Max age of a measurement (e.g. 7d)", type: "text" }
|
|
1472
|
+
];
|
|
1473
|
+
var FITNESS_CHARACTERISTICS = [
|
|
1474
|
+
"functional-suitability",
|
|
1475
|
+
"performance-efficiency",
|
|
1476
|
+
"compatibility",
|
|
1477
|
+
"interaction-capability",
|
|
1478
|
+
"reliability",
|
|
1479
|
+
"security",
|
|
1480
|
+
"maintainability",
|
|
1481
|
+
"flexibility",
|
|
1482
|
+
"safety",
|
|
1483
|
+
"other"
|
|
1484
|
+
];
|
|
1485
|
+
var FITNESS_TRIGGERS = ["pull-request", "nightly", "weekly", "release", "deploy"];
|
|
1486
|
+
var FITNESS_CLASSIFICATION_PROPERTIES = [
|
|
1487
|
+
{ key: "characteristic", label: "Characteristic (ISO/IEC 25010)", type: "enum", options: [...FITNESS_CHARACTERISTICS] },
|
|
1488
|
+
{ key: "scope", label: "Scope", type: "enum", options: ["atomic", "holistic"] },
|
|
1489
|
+
{ key: "cadence", label: "Cadence", type: "enum", options: ["triggered", "continual", "temporal"] },
|
|
1490
|
+
{ key: "trigger", label: "Runs on", type: "enum", options: [...FITNESS_TRIGGERS], visibleWhen: { key: "cadence", values: ["triggered"] } },
|
|
1491
|
+
{ key: "every", label: "Every (e.g. 90d)", type: "text", visibleWhen: { key: "cadence", values: ["temporal"] } },
|
|
1492
|
+
{ key: "invocation", label: "Invocation", type: "enum", options: ["automated", "manual"] },
|
|
1493
|
+
{ key: "measure", label: "Measure (one per line: a sensor and its arguments)", type: "textarea", visibleWhen: { key: "invocation", values: ["automated"] } }
|
|
1494
|
+
];
|
|
1211
1495
|
function builtInGovernanceMetamodel() {
|
|
1212
1496
|
const base = builtInDddC4Metamodel();
|
|
1213
1497
|
const adrProps = [
|
|
@@ -1222,10 +1506,14 @@ function builtInGovernanceMetamodel() {
|
|
|
1222
1506
|
{ key: "context", label: "Context", type: "textarea" },
|
|
1223
1507
|
{ key: "decision", label: "Decision", type: "textarea" },
|
|
1224
1508
|
{ key: "consequences", label: "Consequences", type: "textarea" },
|
|
1225
|
-
{ key: "alternatives", label: "Alternatives considered", type: "textarea" }
|
|
1509
|
+
{ key: "alternatives", label: "Alternatives considered", type: "textarea" },
|
|
1510
|
+
// The Hub concern pack the decision settles (its concern id), for the
|
|
1511
|
+
// check's concern-unaddressed rule; set by a pack's import.
|
|
1512
|
+
{ key: "concern", label: "Concern (Hub)", type: "text" }
|
|
1226
1513
|
];
|
|
1227
1514
|
const adr = {
|
|
1228
1515
|
id: "adr",
|
|
1516
|
+
layout: { role: "note", side: "left" },
|
|
1229
1517
|
label: "ADR",
|
|
1230
1518
|
description: "An architecture decision record: the context of a decision, the decision itself, its consequences and the alternatives that were considered.",
|
|
1231
1519
|
color: "#92400e",
|
|
@@ -1293,18 +1581,12 @@ function builtInGovernanceMetamodel() {
|
|
|
1293
1581
|
};
|
|
1294
1582
|
const fitnessFnProps = [
|
|
1295
1583
|
{ key: "description", label: "Description", type: "textarea" },
|
|
1296
|
-
|
|
1297
|
-
|
|
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
|
|
1584
|
+
...FITNESS_CLASSIFICATION_PROPERTIES,
|
|
1585
|
+
...METRICS_PROPERTIES
|
|
1305
1586
|
];
|
|
1306
1587
|
const fitnessFn = {
|
|
1307
1588
|
id: "fitness-fn",
|
|
1589
|
+
layout: { role: "note", side: "left" },
|
|
1308
1590
|
label: "Fitness Function",
|
|
1309
1591
|
description: "An objective, preferably automated check that the architecture still has a property it was designed for.",
|
|
1310
1592
|
color: "#5b21b6",
|
|
@@ -1324,21 +1606,27 @@ function builtInGovernanceMetamodel() {
|
|
|
1324
1606
|
steps: [
|
|
1325
1607
|
{
|
|
1326
1608
|
kind: "fields",
|
|
1327
|
-
title: "Name &
|
|
1328
|
-
fields: ["label", "
|
|
1329
|
-
help: 'Name
|
|
1609
|
+
title: "Name & characteristic",
|
|
1610
|
+
fields: ["label", "characteristic", "scope"],
|
|
1611
|
+
help: 'Name what this function protects, e.g. "Checkout p95 latency", and the ISO/IEC 25010 characteristic it is part of. Atomic checks one part in one context (a unit test, a linter rule); holistic checks how several parts behave together (latency under load).'
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
kind: "fields",
|
|
1615
|
+
title: "When it runs",
|
|
1616
|
+
fields: ["cadence", "trigger", "every", "invocation"],
|
|
1617
|
+
help: "Triggered runs on an event (a pull request, every night, a release); continual runs all the time (monitoring in production); temporal falls due after a time (every 90 days). Manual means a person reviews it and records the result with radical sense review."
|
|
1330
1618
|
},
|
|
1331
1619
|
{
|
|
1332
1620
|
kind: "fields",
|
|
1333
1621
|
title: "What it measures",
|
|
1334
|
-
fields: ["description"],
|
|
1335
|
-
help:
|
|
1622
|
+
fields: ["description", "measure"],
|
|
1623
|
+
help: 'How is the characteristic measured? Measure names a sensor and its arguments, one per line, e.g. "playwright tests/load.spec.ts --label env=staging"; leave it empty for tests the pull-request gate already runs.'
|
|
1336
1624
|
},
|
|
1337
1625
|
{
|
|
1338
1626
|
kind: "fields",
|
|
1339
1627
|
title: "Success criteria",
|
|
1340
|
-
fields: ["
|
|
1341
|
-
help: 'When does it pass?
|
|
1628
|
+
fields: ["metrics"],
|
|
1629
|
+
help: 'When does it pass? One condition per line: a measured value and its threshold, e.g. "checkout.latency.p95{env=prod} <= 300 ms", or a test that has to pass, e.g. "test(tests/architecture.test.ts \u203A no cycles) passed".'
|
|
1342
1630
|
},
|
|
1343
1631
|
{
|
|
1344
1632
|
kind: "relations",
|
|
@@ -1370,6 +1658,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1370
1658
|
];
|
|
1371
1659
|
const need = {
|
|
1372
1660
|
id: "need",
|
|
1661
|
+
layout: { role: "element" },
|
|
1373
1662
|
label: "Need",
|
|
1374
1663
|
description: "Raw input in the stakeholder's own words, kept verbatim: a brief, a user story, a note, a regulation.",
|
|
1375
1664
|
color: "#475569",
|
|
@@ -1438,6 +1727,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1438
1727
|
];
|
|
1439
1728
|
const requirement = {
|
|
1440
1729
|
id: "requirement",
|
|
1730
|
+
layout: { role: "note", side: "left" },
|
|
1441
1731
|
label: "Requirement",
|
|
1442
1732
|
description: "One thing the system shall do, written as an EARS sentence.",
|
|
1443
1733
|
color: "#0e7490",
|
|
@@ -1511,6 +1801,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1511
1801
|
);
|
|
1512
1802
|
const constrains = {
|
|
1513
1803
|
id: "constrains",
|
|
1804
|
+
layout: { flow: "side" },
|
|
1514
1805
|
label: "Constrains",
|
|
1515
1806
|
description: "The decision, check or requirement applies to the target element.",
|
|
1516
1807
|
inverseLabel: "Constrained by",
|
|
@@ -1519,31 +1810,37 @@ function builtInGovernanceMetamodel() {
|
|
|
1519
1810
|
{ key: "description", label: "Note", type: "text" }
|
|
1520
1811
|
],
|
|
1521
1812
|
color: "#dc2626",
|
|
1813
|
+
governance: true,
|
|
1522
1814
|
builtin: true
|
|
1523
1815
|
};
|
|
1524
1816
|
const supersedes = {
|
|
1525
1817
|
id: "supersedes",
|
|
1818
|
+
layout: { flow: "forward" },
|
|
1526
1819
|
label: "Supersedes",
|
|
1527
1820
|
description: "The newer decision replaces the older one.",
|
|
1528
1821
|
inverseLabel: "Superseded by",
|
|
1529
1822
|
allowedPairs: [{ from: "adr", to: "adr" }],
|
|
1530
1823
|
properties: [],
|
|
1531
1824
|
color: "#f59e0b",
|
|
1825
|
+
governance: true,
|
|
1532
1826
|
builtin: true
|
|
1533
1827
|
};
|
|
1534
1828
|
const implements_ = {
|
|
1535
1829
|
id: "implements",
|
|
1830
|
+
layout: { flow: "side" },
|
|
1536
1831
|
label: "Implements",
|
|
1537
1832
|
description: "A fitness function checks that a decision still holds; a C4 element runs a state machine.",
|
|
1538
1833
|
inverseLabel: "Implemented by",
|
|
1539
1834
|
allowedPairs: [{ from: "fitness-fn", to: "adr" }],
|
|
1540
1835
|
properties: [],
|
|
1541
1836
|
color: "#7c3aed",
|
|
1837
|
+
governance: true,
|
|
1542
1838
|
builtin: true
|
|
1543
1839
|
};
|
|
1544
1840
|
const satisfiesTargets = ["person", "system", "domain", "container", "component", "database", "webapp", "queue"];
|
|
1545
1841
|
const satisfies = {
|
|
1546
1842
|
id: "satisfies",
|
|
1843
|
+
layout: { flow: "side" },
|
|
1547
1844
|
label: "Satisfies",
|
|
1548
1845
|
description: "The element is what makes the requirement true.",
|
|
1549
1846
|
inverseLabel: "Satisfied by",
|
|
@@ -1552,10 +1849,12 @@ function builtInGovernanceMetamodel() {
|
|
|
1552
1849
|
{ key: "description", label: "Note", type: "text" }
|
|
1553
1850
|
],
|
|
1554
1851
|
color: "#0891b2",
|
|
1852
|
+
governance: true,
|
|
1555
1853
|
builtin: true
|
|
1556
1854
|
};
|
|
1557
1855
|
const derives = {
|
|
1558
1856
|
id: "derives",
|
|
1857
|
+
layout: { flow: "reverse", axis: "vertical" },
|
|
1559
1858
|
label: "Derives from",
|
|
1560
1859
|
description: "A requirement turns stakeholder input into a shall-statement or refines a broader requirement; a need sits inside a broader need.",
|
|
1561
1860
|
inverseLabel: "Refined into",
|
|
@@ -1566,10 +1865,12 @@ function builtInGovernanceMetamodel() {
|
|
|
1566
1865
|
],
|
|
1567
1866
|
properties: [],
|
|
1568
1867
|
color: "#0d9488",
|
|
1868
|
+
governance: true,
|
|
1569
1869
|
builtin: true
|
|
1570
1870
|
};
|
|
1571
1871
|
const tracesTo = {
|
|
1572
1872
|
id: "traces-to",
|
|
1873
|
+
layout: { flow: "reverse", axis: "vertical" },
|
|
1573
1874
|
label: "Traces to",
|
|
1574
1875
|
description: "The decision the requirement led to, or the check that keeps it.",
|
|
1575
1876
|
inverseLabel: "Traced from",
|
|
@@ -1579,6 +1880,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1579
1880
|
],
|
|
1580
1881
|
properties: [],
|
|
1581
1882
|
color: "#06b6d4",
|
|
1883
|
+
governance: true,
|
|
1582
1884
|
builtin: true
|
|
1583
1885
|
};
|
|
1584
1886
|
const scenarioProps = [
|
|
@@ -1586,10 +1888,11 @@ function builtInGovernanceMetamodel() {
|
|
|
1586
1888
|
{ key: "when", label: "When", type: "textarea" },
|
|
1587
1889
|
{ key: "then", label: "Then", type: "textarea" },
|
|
1588
1890
|
{ key: "gherkin", label: "Extra steps (And/But, raw Gherkin)", type: "textarea" },
|
|
1589
|
-
|
|
1891
|
+
...METRICS_PROPERTIES
|
|
1590
1892
|
];
|
|
1591
1893
|
const scenario = {
|
|
1592
1894
|
id: "scenario",
|
|
1895
|
+
layout: { role: "note", side: "left" },
|
|
1593
1896
|
label: "Scenario",
|
|
1594
1897
|
description: "An acceptance example in Gherkin: given a starting situation, when something happens, then the outcome.",
|
|
1595
1898
|
color: "#166534",
|
|
@@ -1644,12 +1947,14 @@ function builtInGovernanceMetamodel() {
|
|
|
1644
1947
|
const verifiesTargets = ["requirement"];
|
|
1645
1948
|
const verifies = {
|
|
1646
1949
|
id: "verifies",
|
|
1950
|
+
layout: { flow: "reverse", axis: "vertical" },
|
|
1647
1951
|
label: "Verifies",
|
|
1648
1952
|
description: "The scenario is the acceptance test of the requirement or state machine.",
|
|
1649
1953
|
inverseLabel: "Verified by",
|
|
1650
1954
|
allowedPairs: verifiesTargets.map((to) => ({ from: "scenario", to })),
|
|
1651
1955
|
properties: [],
|
|
1652
1956
|
color: "#16a34a",
|
|
1957
|
+
governance: true,
|
|
1653
1958
|
builtin: true
|
|
1654
1959
|
};
|
|
1655
1960
|
const blueprintProps = [
|
|
@@ -1666,6 +1971,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1666
1971
|
];
|
|
1667
1972
|
const blueprint = {
|
|
1668
1973
|
id: "blueprint",
|
|
1974
|
+
layout: { role: "element" },
|
|
1669
1975
|
label: "Blueprint",
|
|
1670
1976
|
description: "A curated reference architecture imported from the Concept Hub.",
|
|
1671
1977
|
color: "#1e3a5f",
|
|
@@ -1689,6 +1995,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1689
1995
|
];
|
|
1690
1996
|
const mockup = {
|
|
1691
1997
|
id: "mockup",
|
|
1998
|
+
layout: { role: "screen" },
|
|
1692
1999
|
label: "Mockup",
|
|
1693
2000
|
description: "One screen of the product, optionally with a low-fi wireframe.",
|
|
1694
2001
|
color: "#be185d",
|
|
@@ -1737,6 +2044,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1737
2044
|
};
|
|
1738
2045
|
const illustrates = {
|
|
1739
2046
|
id: "illustrates",
|
|
2047
|
+
layout: { flow: "side" },
|
|
1740
2048
|
label: "Illustrates",
|
|
1741
2049
|
description: "The screen shows the requirement being met, the step of the scenario, or what the user sees in the state.",
|
|
1742
2050
|
inverseLabel: "Illustrated by",
|
|
@@ -1746,20 +2054,24 @@ function builtInGovernanceMetamodel() {
|
|
|
1746
2054
|
],
|
|
1747
2055
|
properties: [],
|
|
1748
2056
|
color: "#db2777",
|
|
2057
|
+
governance: true,
|
|
1749
2058
|
builtin: true
|
|
1750
2059
|
};
|
|
1751
2060
|
const presentedBy = {
|
|
1752
2061
|
id: "presented-by",
|
|
2062
|
+
layout: { flow: "side" },
|
|
1753
2063
|
label: "Presented by",
|
|
1754
2064
|
description: "The part of the architecture that renders the screen.",
|
|
1755
2065
|
inverseLabel: "Presents",
|
|
1756
2066
|
allowedPairs: ["webapp", "container", "component", "system"].map((to) => ({ from: "mockup", to })),
|
|
1757
2067
|
properties: [],
|
|
1758
2068
|
color: "#be185d",
|
|
2069
|
+
governance: true,
|
|
1759
2070
|
builtin: true
|
|
1760
2071
|
};
|
|
1761
2072
|
const navigatesTo = {
|
|
1762
2073
|
id: "navigates-to",
|
|
2074
|
+
layout: { flow: "forward", axis: "horizontal" },
|
|
1763
2075
|
label: "Navigates to",
|
|
1764
2076
|
description: "One step of a screen flow, with what triggers it.",
|
|
1765
2077
|
inverseLabel: "Reached from",
|
|
@@ -1772,6 +2084,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1772
2084
|
};
|
|
1773
2085
|
const stateMachine = {
|
|
1774
2086
|
id: "state-machine",
|
|
2087
|
+
layout: { role: "element" },
|
|
1775
2088
|
label: "State Machine",
|
|
1776
2089
|
description: "The lifecycle of one entity: the states it can be in and the transitions between them.",
|
|
1777
2090
|
color: "#3730a3",
|
|
@@ -1791,6 +2104,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1791
2104
|
};
|
|
1792
2105
|
const state = {
|
|
1793
2106
|
id: "state",
|
|
2107
|
+
layout: { role: "element", byProperty: { key: "kind", roles: { final: "end" } } },
|
|
1794
2108
|
label: "State",
|
|
1795
2109
|
description: "A situation the entity can be in.",
|
|
1796
2110
|
color: "#4f46e5",
|
|
@@ -1820,6 +2134,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1820
2134
|
};
|
|
1821
2135
|
const pseudostate = {
|
|
1822
2136
|
id: "pseudostate",
|
|
2137
|
+
layout: { role: "element", byProperty: { key: "kind", roles: { initial: "start" } } },
|
|
1823
2138
|
label: "Pseudostate",
|
|
1824
2139
|
description: "A point a state machine passes through but never rests in: where it starts, a choice, a history.",
|
|
1825
2140
|
color: "#1e1b4b",
|
|
@@ -1843,6 +2158,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1843
2158
|
};
|
|
1844
2159
|
const event = {
|
|
1845
2160
|
id: "event",
|
|
2161
|
+
layout: { role: "note", side: "left" },
|
|
1846
2162
|
label: "Event",
|
|
1847
2163
|
description: "Something that happens and can trigger a transition.",
|
|
1848
2164
|
color: "#c2410c",
|
|
@@ -1869,6 +2185,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1869
2185
|
const stateNodeTypes = ["state", "pseudostate"];
|
|
1870
2186
|
const transition = {
|
|
1871
2187
|
id: "transition",
|
|
2188
|
+
layout: { flow: "forward", axis: "vertical" },
|
|
1872
2189
|
label: "Transition",
|
|
1873
2190
|
description: "The machine moves from one state to another: on an event, under a guard, running actions.",
|
|
1874
2191
|
forwardLabel: "Transitions to",
|
|
@@ -1892,6 +2209,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1892
2209
|
};
|
|
1893
2210
|
const lifecycleOf = {
|
|
1894
2211
|
id: "lifecycle-of",
|
|
2212
|
+
layout: { flow: "side" },
|
|
1895
2213
|
label: "Lifecycle of",
|
|
1896
2214
|
description: "The machine is the lifecycle of that entity.",
|
|
1897
2215
|
inverseLabel: "Lifecycle modelled by",
|
|
@@ -1902,6 +2220,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1902
2220
|
};
|
|
1903
2221
|
const emits = {
|
|
1904
2222
|
id: "emits",
|
|
2223
|
+
layout: { flow: "side" },
|
|
1905
2224
|
label: "Emits",
|
|
1906
2225
|
description: "The element raises the event.",
|
|
1907
2226
|
inverseLabel: "Emitted by",
|
|
@@ -1927,6 +2246,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1927
2246
|
};
|
|
1928
2247
|
const process_ = {
|
|
1929
2248
|
id: "process",
|
|
2249
|
+
layout: { role: "element" },
|
|
1930
2250
|
label: "Process",
|
|
1931
2251
|
description: "A procedure: the steps it is made of, what repeats and what is an alternative.",
|
|
1932
2252
|
color: "#0f766e",
|
|
@@ -1949,6 +2269,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1949
2269
|
};
|
|
1950
2270
|
const step = {
|
|
1951
2271
|
id: "step",
|
|
2272
|
+
layout: { role: "element" },
|
|
1952
2273
|
label: "Step",
|
|
1953
2274
|
description: "One part of a process, itself made of steps or not.",
|
|
1954
2275
|
color: "#14b8a6",
|
|
@@ -1978,6 +2299,7 @@ function builtInGovernanceMetamodel() {
|
|
|
1978
2299
|
};
|
|
1979
2300
|
const performedBy = {
|
|
1980
2301
|
id: "performed-by",
|
|
2302
|
+
layout: { flow: "side" },
|
|
1981
2303
|
label: "Performed by",
|
|
1982
2304
|
description: "The person or part of the architecture that does the step.",
|
|
1983
2305
|
inverseLabel: "Performs",
|
|
@@ -2031,6 +2353,34 @@ function builtInGovernanceMetamodel() {
|
|
|
2031
2353
|
};
|
|
2032
2354
|
}
|
|
2033
2355
|
|
|
2356
|
+
// ../../packages/common/src/metamodel/layoutHints.ts
|
|
2357
|
+
var preset = null;
|
|
2358
|
+
var presetHints = () => preset ??= builtInGovernanceMetamodel();
|
|
2359
|
+
function nodeLayoutHint(typeId, mm) {
|
|
2360
|
+
return mm?.nodeTypes[typeId]?.layout ?? presetHints().nodeTypes[typeId]?.layout ?? {};
|
|
2361
|
+
}
|
|
2362
|
+
function layoutRoleOf(node, mm) {
|
|
2363
|
+
const hint = nodeLayoutHint(node.type, mm);
|
|
2364
|
+
if (hint.byProperty) {
|
|
2365
|
+
const value = node[hint.byProperty.key];
|
|
2366
|
+
const byValue = typeof value === "string" ? hint.byProperty.roles[value] : void 0;
|
|
2367
|
+
if (byValue) return byValue;
|
|
2368
|
+
}
|
|
2369
|
+
return hint.role ?? "element";
|
|
2370
|
+
}
|
|
2371
|
+
var FORWARD = { flow: "forward", axis: "free" };
|
|
2372
|
+
function relationLayoutHint(typeId, mm) {
|
|
2373
|
+
if (!typeId) return FORWARD;
|
|
2374
|
+
const hint = mm?.relationTypes[typeId]?.layout ?? presetHints().relationTypes[typeId]?.layout;
|
|
2375
|
+
return hint ? { axis: "free", ...hint } : FORWARD;
|
|
2376
|
+
}
|
|
2377
|
+
var LAYOUT_ROLES = ["element", "actor", "store", "note", "start", "end", "broker", "screen"];
|
|
2378
|
+
var LAYOUT_FLOWS = ["forward", "reverse", "side"];
|
|
2379
|
+
var LAYOUT_AXES = ["free", "vertical", "horizontal"];
|
|
2380
|
+
|
|
2381
|
+
// ../../packages/common/src/metamodel/presets/index.ts
|
|
2382
|
+
init_define_RADICAL_BUILD();
|
|
2383
|
+
|
|
2034
2384
|
// ../../packages/common/src/c4.ts
|
|
2035
2385
|
var CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
2036
2386
|
"system",
|
|
@@ -2047,6 +2397,14 @@ var CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
|
2047
2397
|
function isContainerType(type) {
|
|
2048
2398
|
return !!type && CONTAINER_TYPES.has(type);
|
|
2049
2399
|
}
|
|
2400
|
+
function isBackwardStep(sequence, i) {
|
|
2401
|
+
return sequence?.stepBackward?.[i] === true;
|
|
2402
|
+
}
|
|
2403
|
+
function trimStepBackward(flags) {
|
|
2404
|
+
const out = Array.from(flags ?? [], (flag) => flag === true);
|
|
2405
|
+
while (out.length > 0 && !out[out.length - 1]) out.pop();
|
|
2406
|
+
return out.length ? out : void 0;
|
|
2407
|
+
}
|
|
2050
2408
|
function pinnedNodeIds(constraints) {
|
|
2051
2409
|
return constraints?.find((c) => c.type === "pin")?.nodeIds ?? [];
|
|
2052
2410
|
}
|
|
@@ -2095,6 +2453,9 @@ function constraintLines(constraints) {
|
|
|
2095
2453
|
];
|
|
2096
2454
|
});
|
|
2097
2455
|
}
|
|
2456
|
+
function slideWithoutMilestone(slide) {
|
|
2457
|
+
return { id: slide.id, name: slide.name, snapshotId: null, viewId: slide.viewId ?? null, viewport: { x: 0, y: 0, zoom: 0 } };
|
|
2458
|
+
}
|
|
2098
2459
|
var BUILTIN_NODE_TYPES = builtInGovernanceMetamodel().nodeTypes;
|
|
2099
2460
|
function pluckPerType(fn) {
|
|
2100
2461
|
const out = {};
|
|
@@ -2104,6 +2465,14 @@ function pluckPerType(fn) {
|
|
|
2104
2465
|
return out;
|
|
2105
2466
|
}
|
|
2106
2467
|
var NODE_SIZES = pluckPerType((def) => ({ width: def.width, height: def.height }));
|
|
2468
|
+
function nodeTypeSize(type, metamodel) {
|
|
2469
|
+
const def = metamodel?.nodeTypes[type];
|
|
2470
|
+
const builtIn = NODE_SIZES[type];
|
|
2471
|
+
return {
|
|
2472
|
+
width: def?.width ?? builtIn?.width ?? 160,
|
|
2473
|
+
height: def?.height ?? builtIn?.height ?? 90
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2107
2476
|
var COLLAPSED_HEIGHT = pluckPerType((def) => def.collapsedHeight ?? def.height);
|
|
2108
2477
|
var COLLAPSED_WIDTH = pluckPerType((def) => def.collapsedWidth ?? def.width);
|
|
2109
2478
|
var NODE_COLORS = pluckPerType((def) => def.color);
|
|
@@ -2113,6 +2482,15 @@ var TYPE_ICON_PATHS = pluckPerType((def) => def.iconPath);
|
|
|
2113
2482
|
function normalizeViewFolder(folder) {
|
|
2114
2483
|
return (folder ?? "").split("/").map((part) => part.trim()).filter(Boolean).join("/");
|
|
2115
2484
|
}
|
|
2485
|
+
function viewFolderPaths(views) {
|
|
2486
|
+
const paths = /* @__PURE__ */ new Set();
|
|
2487
|
+
for (const view of views) {
|
|
2488
|
+
const parts = normalizeViewFolder(view.folder).split("/").filter(Boolean);
|
|
2489
|
+
for (let i = 1; i <= parts.length; i++) paths.add(parts.slice(0, i).join("/"));
|
|
2490
|
+
}
|
|
2491
|
+
return [...paths].sort((a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" }));
|
|
2492
|
+
}
|
|
2493
|
+
var CANVAS_MAX_ELEMENTS = 1e3;
|
|
2116
2494
|
var WIKI_DEPTH_MIN = 1;
|
|
2117
2495
|
var WIKI_DEPTH_MAX = 5;
|
|
2118
2496
|
function wikiDepthOf(view) {
|
|
@@ -2120,15 +2498,28 @@ function wikiDepthOf(view) {
|
|
|
2120
2498
|
if (typeof d !== "number" || !Number.isFinite(d)) return WIKI_DEPTH_MIN;
|
|
2121
2499
|
return Math.min(WIKI_DEPTH_MAX, Math.max(WIKI_DEPTH_MIN, Math.floor(d)));
|
|
2122
2500
|
}
|
|
2501
|
+
function holderOf(nodes, a, b) {
|
|
2502
|
+
const holds = (outer, inner) => {
|
|
2503
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2504
|
+
for (let id = inner.parentId; id && !seen.has(id); id = nodes[id]?.parentId) {
|
|
2505
|
+
if (id === outer.id) return true;
|
|
2506
|
+
seen.add(id);
|
|
2507
|
+
}
|
|
2508
|
+
return false;
|
|
2509
|
+
};
|
|
2510
|
+
return holds(a, b) ? a : holds(b, a) ? b : void 0;
|
|
2511
|
+
}
|
|
2123
2512
|
function viewShowsEveryNode(view) {
|
|
2124
2513
|
return view.nodeIds.length === 0 && !view.empty;
|
|
2125
2514
|
}
|
|
2126
|
-
function viewCanvasPositions(view, nodes, positions) {
|
|
2127
|
-
if (view.kind
|
|
2128
|
-
if (
|
|
2515
|
+
function viewCanvasPositions(view, nodes, positions, drawn) {
|
|
2516
|
+
if (view.kind === "explore") return Object.fromEntries(view.nodeIds.filter((id) => id in positions && nodes[id]).map((id) => [id, positions[id]]));
|
|
2517
|
+
if (view.kind && view.kind !== "static") positions = view.positions ?? {};
|
|
2518
|
+
const ids = drawn ?? (viewShowsEveryNode(view) ? void 0 : view.nodeIds);
|
|
2519
|
+
if (!ids) return positions;
|
|
2129
2520
|
const kept = {};
|
|
2130
2521
|
const seen = /* @__PURE__ */ new Set();
|
|
2131
|
-
for (const id of
|
|
2522
|
+
for (const id of ids) {
|
|
2132
2523
|
for (let cur = id; cur && nodes[cur] && !seen.has(cur); cur = nodes[cur].parentId) {
|
|
2133
2524
|
seen.add(cur);
|
|
2134
2525
|
if (cur in positions) kept[cur] = positions[cur];
|
|
@@ -2136,10 +2527,10 @@ function viewCanvasPositions(view, nodes, positions) {
|
|
|
2136
2527
|
}
|
|
2137
2528
|
return kept;
|
|
2138
2529
|
}
|
|
2139
|
-
function withCanvasPositions(views, nodes) {
|
|
2530
|
+
function withCanvasPositions(views, nodes, drawnOf) {
|
|
2140
2531
|
return views.map((view) => {
|
|
2141
|
-
const kept = viewCanvasPositions(view, nodes, view.positions ?? {});
|
|
2142
|
-
return Object.keys(kept).length === Object.keys(view.positions
|
|
2532
|
+
const kept = viewCanvasPositions(view, nodes, view.positions ?? {}, drawnOf?.(view));
|
|
2533
|
+
return view.positions && Object.keys(kept).length === Object.keys(view.positions).length ? view : { ...view, positions: kept };
|
|
2143
2534
|
});
|
|
2144
2535
|
}
|
|
2145
2536
|
function removeFromViewList(view, removed) {
|
|
@@ -2154,6 +2545,7 @@ function addToViewList(view, ids) {
|
|
|
2154
2545
|
}
|
|
2155
2546
|
|
|
2156
2547
|
// ../../packages/layout/src/elkSpacingBase.ts
|
|
2548
|
+
init_define_RADICAL_BUILD();
|
|
2157
2549
|
var ELK_ROOT_SPACING = {
|
|
2158
2550
|
"elk.spacing.nodeNode": "60",
|
|
2159
2551
|
"elk.layered.spacing.nodeNodeBetweenLayers": "80",
|
|
@@ -2170,6 +2562,12 @@ var ELK_CHILD_SPACING = {
|
|
|
2170
2562
|
};
|
|
2171
2563
|
|
|
2172
2564
|
// ../../packages/layout/src/geometry.ts
|
|
2565
|
+
init_define_RADICAL_BUILD();
|
|
2566
|
+
var placing = null;
|
|
2567
|
+
function childrenOf(nodes, parentId) {
|
|
2568
|
+
if (placing?.nodes === nodes) return placing.children.get(parentId ?? void 0) ?? [];
|
|
2569
|
+
return Object.values(nodes).filter((n) => (n.parentId ?? void 0) === (parentId ?? void 0));
|
|
2570
|
+
}
|
|
2173
2571
|
function effectiveWidth(n) {
|
|
2174
2572
|
if (isContainerType(n.type) && n.collapsed) return COLLAPSED_WIDTH[n.type];
|
|
2175
2573
|
return n.width ?? NODE_SIZES[n.type].width;
|
|
@@ -2206,33 +2604,235 @@ function fittedParentSize(parent, children) {
|
|
|
2206
2604
|
maxBottom = Math.max(maxBottom, child.y + child.height);
|
|
2207
2605
|
}
|
|
2208
2606
|
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)
|
|
2607
|
+
width: Math.max(maxRight + pad.side, COLLAPSED_WIDTH[parent.type] ?? NODE_SIZES[parent.type].width),
|
|
2608
|
+
height: Math.max(maxBottom + pad.bottom, COLLAPSED_HEIGHT[parent.type] ?? NODE_SIZES[parent.type].height)
|
|
2211
2609
|
};
|
|
2212
2610
|
}
|
|
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
2611
|
function placeNewNode(nodes, parentId) {
|
|
2229
2612
|
const parent = parentId ? nodes[parentId] : void 0;
|
|
2230
|
-
const siblings =
|
|
2613
|
+
const siblings = childrenOf(nodes, parent?.id);
|
|
2231
2614
|
const right = Math.max(...siblings.map((n) => n.x + effectiveWidth(n)));
|
|
2232
2615
|
if (!parent) return { x: siblings.length ? right + 80 : 0, y: 0 };
|
|
2233
2616
|
const pad = compoundPadding(parent.type);
|
|
2234
2617
|
return { x: siblings.length ? right + 20 : pad.side, y: pad.top };
|
|
2235
2618
|
}
|
|
2619
|
+
function placeBesideSiblings(nodes, parentId, counts = () => true) {
|
|
2620
|
+
const parent = parentId ? nodes[parentId] : void 0;
|
|
2621
|
+
const siblings = childrenOf(nodes, parent?.id).filter((s) => counts(s));
|
|
2622
|
+
if (siblings.length === 0) {
|
|
2623
|
+
const pad = parent ? compoundPadding(parent.type) : { top: 0, side: 0 };
|
|
2624
|
+
return { x: pad.side, y: pad.top };
|
|
2625
|
+
}
|
|
2626
|
+
return {
|
|
2627
|
+
x: Math.max(...siblings.map((s) => s.x + effectiveWidth(s))) + (parent ? 20 : 80),
|
|
2628
|
+
y: Math.min(...siblings.map((s) => s.y))
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
function centredIn(frame, size, pad) {
|
|
2632
|
+
return {
|
|
2633
|
+
x: Math.max(pad.side, Math.round((frame.width - size.width) / 2)),
|
|
2634
|
+
y: pad.top + Math.max(0, Math.round((frame.height - pad.top - pad.bottom - size.height) / 2))
|
|
2635
|
+
};
|
|
2636
|
+
}
|
|
2637
|
+
var GRID_GAP = 60;
|
|
2638
|
+
function gridSlotIn(nodes, parentId, size, counts = () => true, frame) {
|
|
2639
|
+
const parent = nodes[parentId];
|
|
2640
|
+
const pad = compoundPadding(parent?.type ?? "system");
|
|
2641
|
+
const kids = childrenOf(nodes, parentId).filter((c) => counts(c));
|
|
2642
|
+
if (!kids.length) return centredIn(frame ?? { width: parent?.width ?? 0, height: parent?.height ?? 0 }, size, pad);
|
|
2643
|
+
const cellW = Math.max(size.width, ...kids.map(effectiveWidth));
|
|
2644
|
+
const cellH = Math.max(size.height, ...kids.map(effectiveHeight));
|
|
2645
|
+
const taken = kids.map((c) => ({ x: c.x, y: c.y, w: effectiveWidth(c), h: effectiveHeight(c) }));
|
|
2646
|
+
const left = Math.max(pad.side, Math.min(...kids.map((c) => c.x)));
|
|
2647
|
+
const top = Math.max(pad.top, Math.min(...kids.map((c) => c.y)));
|
|
2648
|
+
for (let i = 0; i < 1e4; i++) {
|
|
2649
|
+
const { column, row } = landscapeSlot(i);
|
|
2650
|
+
const box = { x: left + column * (cellW + GRID_GAP), y: top + row * (cellH + GRID_GAP), w: size.width, h: size.height };
|
|
2651
|
+
if (!taken.some((t) => boxesOverlap(box, t))) return { x: box.x, y: box.y };
|
|
2652
|
+
}
|
|
2653
|
+
return placeBesideSiblings(nodes, parentId, counts);
|
|
2654
|
+
}
|
|
2655
|
+
function modelCanvas(nodes, shownIds, frames) {
|
|
2656
|
+
const shown = (n) => (!shownIds || shownIds.has(n.id)) && isVisible(n, nodes);
|
|
2657
|
+
const parents = new Set(Object.values(nodes).filter(shown).map((n) => n.parentId).filter((id) => !!id));
|
|
2658
|
+
const boxOf = (n) => {
|
|
2659
|
+
const size = drawnSize(n, parents.has(n.id));
|
|
2660
|
+
return { x: n.x, y: n.y, w: size.width, h: size.height };
|
|
2661
|
+
};
|
|
2662
|
+
return frames?.size ? { shown, boxOf, frame: (n) => frames.has(n.id) } : { shown, boxOf };
|
|
2663
|
+
}
|
|
2664
|
+
var boxesOverlap = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
2665
|
+
function liesClearInParent(node, nodes, canvas, ignore = () => false) {
|
|
2666
|
+
const box = canvas.boxOf(node);
|
|
2667
|
+
const parent = node.parentId ? nodes[node.parentId] : void 0;
|
|
2668
|
+
if (parent) {
|
|
2669
|
+
const frame = canvas.boxOf(parent);
|
|
2670
|
+
if (box.x < 0 || box.y < 0 || box.x + box.w > frame.w || box.y + box.h > frame.h) return false;
|
|
2671
|
+
}
|
|
2672
|
+
return !childrenOf(nodes, node.parentId).some((s) => s.id !== node.id && canvas.shown(s) && !ignore(s) && drawnBoxesOf(s, nodes, canvas, (c) => c.id !== node.id && !ignore(c)).some((b) => boxesOverlap(box, b)));
|
|
2673
|
+
}
|
|
2674
|
+
function drawnBoxesOf(node, nodes, canvas, keep = () => true) {
|
|
2675
|
+
const box = canvas.boxOf(node);
|
|
2676
|
+
if (!canvas.frame?.(node)) return [box];
|
|
2677
|
+
return childrenOf(nodes, node.id).filter((c) => canvas.shown(c) && keep(c)).flatMap((c) => drawnBoxesOf(c, nodes, canvas, keep).map((b) => ({ ...b, x: b.x + box.x, y: b.y + box.y })));
|
|
2678
|
+
}
|
|
2679
|
+
function settleMovedNodes(nodes, ids, canvas, fit = (parentId) => fitShown(nodes, parentId, canvas), opened) {
|
|
2680
|
+
const touched = [];
|
|
2681
|
+
const settle = (moved, on) => {
|
|
2682
|
+
const waiting = new Set(moved);
|
|
2683
|
+
const alone = [];
|
|
2684
|
+
for (const id of moved) {
|
|
2685
|
+
const node = nodes[id];
|
|
2686
|
+
if (!liesClearInParent(node, nodes, on, (s) => waiting.has(s.id))) {
|
|
2687
|
+
const counts = (s) => s.id !== id && !waiting.has(s.id) && on.shown(s);
|
|
2688
|
+
const box = on.boxOf(node);
|
|
2689
|
+
const at = node.parentId && nodes[node.parentId] ? gridSlotIn(nodes, node.parentId, { width: box.w, height: box.h }, (s) => counts(s), { width: on.boxOf(nodes[node.parentId]).w, height: on.boxOf(nodes[node.parentId]).h }) : freeSpotNear(
|
|
2690
|
+
Object.values(nodes).filter((s) => !s.parentId && counts(s)).flatMap((s) => drawnBoxesOf(s, nodes, on, counts)).map((b) => ({ x: b.x, y: b.y, width: b.w, height: b.h })),
|
|
2691
|
+
{ width: box.w, height: box.h },
|
|
2692
|
+
{ x: box.x + box.w / 2, y: box.y + box.h / 2 }
|
|
2693
|
+
);
|
|
2694
|
+
node.x = at.x;
|
|
2695
|
+
node.y = at.y;
|
|
2696
|
+
touched.push(id);
|
|
2697
|
+
if (node.parentId && !Object.values(nodes).some((s) => s.parentId === node.parentId && counts(s)) && moved.filter((m) => nodes[m]?.parentId === node.parentId).length === 1) alone.push(id);
|
|
2698
|
+
}
|
|
2699
|
+
waiting.delete(id);
|
|
2700
|
+
}
|
|
2701
|
+
const parents = [...new Set(moved.map((id) => nodes[id].parentId).filter((p) => !!p && !!nodes[p]))];
|
|
2702
|
+
for (const parentId of parents) touched.push(...growWithRoom(nodes, parentId, on, fit));
|
|
2703
|
+
for (const id of alone) {
|
|
2704
|
+
const node = nodes[id];
|
|
2705
|
+
const frame = on.boxOf(nodes[node.parentId]);
|
|
2706
|
+
const box = on.boxOf(node);
|
|
2707
|
+
Object.assign(node, centredIn({ width: frame.w, height: frame.h }, { width: box.w, height: box.h }, compoundPadding(nodes[node.parentId].type)));
|
|
2708
|
+
}
|
|
2709
|
+
};
|
|
2710
|
+
settle(ids.filter((id) => nodes[id] && canvas.shown(nodes[id])), canvas);
|
|
2711
|
+
if (opened) settle(ids.filter((id) => nodes[id] && !canvas.shown(nodes[id]) && opened.shown(nodes[id])), opened);
|
|
2712
|
+
return touched;
|
|
2713
|
+
}
|
|
2714
|
+
function growWithRoom(nodes, startId, canvas, fit = (parentId) => fitShown(nodes, parentId, canvas)) {
|
|
2715
|
+
const pushed = [];
|
|
2716
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2717
|
+
for (let cur = nodes[startId]; cur && !seen.has(cur.id); cur = cur.parentId ? nodes[cur.parentId] : void 0) {
|
|
2718
|
+
seen.add(cur.id);
|
|
2719
|
+
const was = canvas.boxOf(cur);
|
|
2720
|
+
fit(cur.id);
|
|
2721
|
+
const now = canvas.boxOf(nodes[cur.id]);
|
|
2722
|
+
if (now.w <= was.w && now.h <= was.h) continue;
|
|
2723
|
+
if (canvas.frame?.(cur)) continue;
|
|
2724
|
+
for (const [id, at] of Object.entries(makeRoomAround(cur.id, nodes, canvas))) {
|
|
2725
|
+
nodes[id].x = at.x;
|
|
2726
|
+
nodes[id].y = at.y;
|
|
2727
|
+
pushed.push(id);
|
|
2728
|
+
}
|
|
2729
|
+
if (cur.parentId) growFrameLeftUp(nodes, cur.parentId, canvas.shown);
|
|
2730
|
+
}
|
|
2731
|
+
return pushed;
|
|
2732
|
+
}
|
|
2733
|
+
var CHILD_TOP_MIN = 50;
|
|
2734
|
+
function growFrameLeftUp(nodes, parentId, shown = () => true) {
|
|
2735
|
+
const parent = nodes[parentId];
|
|
2736
|
+
if (!parent) return;
|
|
2737
|
+
const kids = childrenOf(nodes, parentId).filter((c) => shown(c));
|
|
2738
|
+
if (!kids.length) return;
|
|
2739
|
+
const pad = compoundPadding(parent.type);
|
|
2740
|
+
const minX = Math.min(...kids.map((c) => c.x));
|
|
2741
|
+
const minY = Math.min(...kids.map((c) => c.y));
|
|
2742
|
+
const dx = minX < 0 ? pad.side - minX : 0;
|
|
2743
|
+
const dy = minY < CHILD_TOP_MIN ? pad.top - minY : 0;
|
|
2744
|
+
if (!dx && !dy) return;
|
|
2745
|
+
parent.x -= dx;
|
|
2746
|
+
parent.y -= dy;
|
|
2747
|
+
for (const k of kids) {
|
|
2748
|
+
k.x += dx;
|
|
2749
|
+
k.y += dy;
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
function fitShown(nodes, parentId, canvas) {
|
|
2753
|
+
const parent = nodes[parentId];
|
|
2754
|
+
if (!parent || !isContainerType(parent.type) || parent.collapsed) return;
|
|
2755
|
+
const children = childrenOf(nodes, parentId).filter((c) => canvas.shown(c));
|
|
2756
|
+
if (!children.length) return;
|
|
2757
|
+
const size = fittedParentSize(parent, children.map((c) => ({ x: c.x, y: c.y, width: effectiveWidth(c), height: effectiveHeight(c) })));
|
|
2758
|
+
parent.width = size.width;
|
|
2759
|
+
parent.height = size.height;
|
|
2760
|
+
}
|
|
2761
|
+
var EXPAND_GAP = 20;
|
|
2762
|
+
var HIT_COST = 200;
|
|
2763
|
+
function makeRoomAround(grownId, nodes, canvas) {
|
|
2764
|
+
const grown = nodes[grownId];
|
|
2765
|
+
if (!grown) return {};
|
|
2766
|
+
const { shown, boxOf } = canvas;
|
|
2767
|
+
const siblings = childrenOf(nodes, grown.parentId).filter((n) => shown(n));
|
|
2768
|
+
if (siblings.length < 2) return {};
|
|
2769
|
+
const box = new Map(siblings.map((n) => [n.id, boxOf(n)]));
|
|
2770
|
+
const before = new Map(siblings.map((n) => [n.id, boxOf(n)]));
|
|
2771
|
+
const g = box.get(grownId);
|
|
2772
|
+
const gx = g.x + g.w / 2;
|
|
2773
|
+
const gy = g.y + g.h / 2;
|
|
2774
|
+
const gapTo = (b) => Math.max(g.x - (b.x + b.w), b.x - (g.x + g.w), g.y - (b.y + b.h), b.y - (g.y + g.h), 0);
|
|
2775
|
+
const order = siblings.filter((n) => n.id !== grownId).map((n) => ({ id: n.id, gap: gapTo(box.get(n.id)), centre: Math.hypot(box.get(n.id).x + box.get(n.id).w / 2 - gx, box.get(n.id).y + box.get(n.id).h / 2 - gy) })).sort((a, b) => a.gap - b.gap || a.centre - b.centre || (a.id < b.id ? -1 : 1));
|
|
2776
|
+
const placed = [grownId];
|
|
2777
|
+
const moved = /* @__PURE__ */ new Set([grownId]);
|
|
2778
|
+
const hits = (a, b, gap) => a.x < b.x + b.w + gap && b.x < a.x + a.w + gap && a.y < b.y + b.h + gap && b.y < a.y + a.h + gap;
|
|
2779
|
+
const gapOf = (a, b) => {
|
|
2780
|
+
if (a === grownId || b === grownId) return EXPAND_GAP;
|
|
2781
|
+
const [p, q] = [before.get(a), before.get(b)];
|
|
2782
|
+
return Math.min(EXPAND_GAP, Math.max(0, p.x - (q.x + q.w), q.x - (p.x + p.w), p.y - (q.y + q.h), q.y - (p.y + p.h)));
|
|
2783
|
+
};
|
|
2784
|
+
for (const { id } of order) {
|
|
2785
|
+
const b = box.get(id);
|
|
2786
|
+
const cx = b.x + b.w / 2 - gx;
|
|
2787
|
+
const cy = b.y + b.h / 2 - gy;
|
|
2788
|
+
for (let step = 0; step < placed.length * 4 + 8; step++) {
|
|
2789
|
+
const at = placed.findIndex((pid) => (moved.has(pid) || moved.has(id)) && hits(b, box.get(pid), gapOf(id, pid)));
|
|
2790
|
+
if (at < 0) break;
|
|
2791
|
+
const blocker = box.get(placed[at]);
|
|
2792
|
+
const gap = gapOf(id, placed[at]);
|
|
2793
|
+
const ways = [
|
|
2794
|
+
{ dx: blocker.x + blocker.w + gap - b.x, dy: 0, ok: cx >= 0 },
|
|
2795
|
+
{ dx: blocker.x - gap - (b.x + b.w), dy: 0, ok: cx <= 0 },
|
|
2796
|
+
{ dx: 0, dy: blocker.y + blocker.h + gap - b.y, ok: cy >= 0 },
|
|
2797
|
+
{ dx: 0, dy: blocker.y - gap - (b.y + b.h), ok: cy <= 0 }
|
|
2798
|
+
].filter((w) => w.ok);
|
|
2799
|
+
const cost = (w) => {
|
|
2800
|
+
const to = { x: b.x + w.dx, y: b.y + w.dy, w: b.w, h: b.h };
|
|
2801
|
+
let hit = 0;
|
|
2802
|
+
for (const n of siblings) if (n.id !== id && n.id !== grownId && hits(to, box.get(n.id), 0)) hit++;
|
|
2803
|
+
return Math.abs(w.dx) + Math.abs(w.dy) + HIT_COST * hit;
|
|
2804
|
+
};
|
|
2805
|
+
const way = ways.reduce((best, w) => cost(w) < cost(best) ? w : best);
|
|
2806
|
+
b.x += way.dx;
|
|
2807
|
+
b.y += way.dy;
|
|
2808
|
+
moved.add(id);
|
|
2809
|
+
}
|
|
2810
|
+
placed.push(id);
|
|
2811
|
+
}
|
|
2812
|
+
const result = {};
|
|
2813
|
+
for (const n of siblings) {
|
|
2814
|
+
const b = box.get(n.id);
|
|
2815
|
+
if (n.id !== grownId && (b.x !== n.x || b.y !== n.y)) result[n.id] = { x: b.x, y: b.y };
|
|
2816
|
+
}
|
|
2817
|
+
return result;
|
|
2818
|
+
}
|
|
2819
|
+
function freeSpotNear(taken, size, center, gap = 60) {
|
|
2820
|
+
const fits = (x, y) => taken.every((b) => x + size.width + gap <= b.x || b.x + b.width + gap <= x || y + size.height + gap <= b.y || b.y + b.height + gap <= y);
|
|
2821
|
+
const start = { x: center.x - size.width / 2, y: center.y - size.height / 2 };
|
|
2822
|
+
const step = 80;
|
|
2823
|
+
for (let ring = 0; ring <= 40; ring++) {
|
|
2824
|
+
const spots = [];
|
|
2825
|
+
if (ring === 0) spots.push(start);
|
|
2826
|
+
for (let k = -ring; k <= ring && ring > 0; k++) {
|
|
2827
|
+
spots.push({ x: start.x + k * step, y: start.y - ring * step }, { x: start.x + k * step, y: start.y + ring * step });
|
|
2828
|
+
if (k !== -ring && k !== ring) spots.push({ x: start.x - ring * step, y: start.y + k * step }, { x: start.x + ring * step, y: start.y + k * step });
|
|
2829
|
+
}
|
|
2830
|
+
spots.sort((a, b) => Math.hypot(a.x - start.x, a.y - start.y) - Math.hypot(b.x - start.x, b.y - start.y));
|
|
2831
|
+
for (const s of spots) if (fits(s.x, s.y)) return s;
|
|
2832
|
+
}
|
|
2833
|
+
const right = taken.length ? Math.max(...taken.map((b) => b.x + b.width)) : start.x;
|
|
2834
|
+
return { x: right + gap, y: start.y };
|
|
2835
|
+
}
|
|
2236
2836
|
var BATCH_CELL = { width: 360, height: 280 };
|
|
2237
2837
|
var BATCH_GAP = 120;
|
|
2238
2838
|
function createBatchPlacer(getNodes, visible = () => void 0) {
|
|
@@ -2292,6 +2892,7 @@ function projectToVisibleGraph(nodes, relations) {
|
|
|
2292
2892
|
if (kept) {
|
|
2293
2893
|
if (r.label) projected[kept] = { ...projected[kept], label: projected[kept].label ? `${projected[kept].label}
|
|
2294
2894
|
${r.label}` : r.label };
|
|
2895
|
+
if (projected[kept].technology !== r.technology) projected[kept] = { ...projected[kept], technology: void 0 };
|
|
2295
2896
|
continue;
|
|
2296
2897
|
}
|
|
2297
2898
|
rolledUpLine.set(key, id);
|
|
@@ -2474,6 +3075,7 @@ async function applyElkLayout(inputNodes, inputRelations, opts) {
|
|
|
2474
3075
|
elkNodeMap["root"] = root;
|
|
2475
3076
|
for (const rel of Object.values(c4Relations)) {
|
|
2476
3077
|
if (!c4Nodes[rel.sourceId] || !c4Nodes[rel.targetId]) continue;
|
|
3078
|
+
if (ancestorChain(rel.sourceId, c4Nodes).includes(rel.targetId) || ancestorChain(rel.targetId, c4Nodes).includes(rel.sourceId)) continue;
|
|
2477
3079
|
const lca = lcaContainerId(rel.sourceId, rel.targetId, c4Nodes);
|
|
2478
3080
|
const container = (lca ? elkNodeMap[lca] : root) ?? root;
|
|
2479
3081
|
const edge = { id: rel.id, sources: [rel.sourceId], targets: [rel.targetId] };
|
|
@@ -2543,35 +3145,66 @@ async function applyTreeLayout(c4Nodes, c4Relations) {
|
|
|
2543
3145
|
export {
|
|
2544
3146
|
__commonJS,
|
|
2545
3147
|
__toESM,
|
|
3148
|
+
init_define_RADICAL_BUILD,
|
|
3149
|
+
define_RADICAL_BUILD_default,
|
|
2546
3150
|
isRelationAllowed,
|
|
2547
3151
|
inferRelationType,
|
|
2548
3152
|
isParentAllowed,
|
|
3153
|
+
allowedPlacesText,
|
|
2549
3154
|
GROUP_TYPE,
|
|
2550
3155
|
placeOf,
|
|
2551
3156
|
hasPlaceUnder,
|
|
3157
|
+
isFinalState,
|
|
2552
3158
|
isPlacementAllowed,
|
|
2553
3159
|
canAddMoreOfType,
|
|
2554
3160
|
isReservedPropertyKey,
|
|
2555
3161
|
propertyKeyProblem,
|
|
3162
|
+
chainTypeNames,
|
|
3163
|
+
refIds,
|
|
2556
3164
|
refValue,
|
|
2557
3165
|
refProblem,
|
|
2558
3166
|
transitionLabel,
|
|
2559
3167
|
requirementStatePhrase,
|
|
3168
|
+
transitionRefusal,
|
|
3169
|
+
lifecycleRefusal,
|
|
3170
|
+
initialPseudostateRefusal,
|
|
3171
|
+
newPseudostateKind,
|
|
3172
|
+
isInitialPseudostate,
|
|
3173
|
+
outgoingTransitionCount,
|
|
2560
3174
|
validateModel,
|
|
3175
|
+
relationTypeName,
|
|
2561
3176
|
composeEarsSentence,
|
|
2562
3177
|
builtInC4Metamodel,
|
|
3178
|
+
RADICAL_METAMODEL_NAME,
|
|
3179
|
+
METRICS_PROPERTIES,
|
|
3180
|
+
FITNESS_CHARACTERISTICS,
|
|
3181
|
+
FITNESS_TRIGGERS,
|
|
3182
|
+
FITNESS_CLASSIFICATION_PROPERTIES,
|
|
2563
3183
|
builtInGovernanceMetamodel,
|
|
3184
|
+
layoutRoleOf,
|
|
3185
|
+
relationLayoutHint,
|
|
3186
|
+
LAYOUT_ROLES,
|
|
3187
|
+
LAYOUT_FLOWS,
|
|
3188
|
+
LAYOUT_AXES,
|
|
2564
3189
|
isContainerType,
|
|
3190
|
+
isBackwardStep,
|
|
3191
|
+
trimStepBackward,
|
|
2565
3192
|
pinnedNodeIds,
|
|
2566
3193
|
defaultGridColumns,
|
|
2567
3194
|
landscapeGridColumns,
|
|
2568
3195
|
gridCells,
|
|
2569
3196
|
constraintLines,
|
|
3197
|
+
slideWithoutMilestone,
|
|
2570
3198
|
NODE_SIZES,
|
|
3199
|
+
nodeTypeSize,
|
|
2571
3200
|
COLLAPSED_HEIGHT,
|
|
2572
3201
|
COLLAPSED_WIDTH,
|
|
2573
3202
|
normalizeViewFolder,
|
|
3203
|
+
viewFolderPaths,
|
|
3204
|
+
CANVAS_MAX_ELEMENTS,
|
|
3205
|
+
WIKI_DEPTH_MAX,
|
|
2574
3206
|
wikiDepthOf,
|
|
3207
|
+
holderOf,
|
|
2575
3208
|
viewShowsEveryNode,
|
|
2576
3209
|
viewCanvasPositions,
|
|
2577
3210
|
withCanvasPositions,
|
|
@@ -2583,8 +3216,13 @@ export {
|
|
|
2583
3216
|
isVisible,
|
|
2584
3217
|
compoundPadding,
|
|
2585
3218
|
fittedParentSize,
|
|
2586
|
-
fitAncestors,
|
|
2587
3219
|
placeNewNode,
|
|
3220
|
+
modelCanvas,
|
|
3221
|
+
settleMovedNodes,
|
|
3222
|
+
growWithRoom,
|
|
3223
|
+
growFrameLeftUp,
|
|
3224
|
+
fitShown,
|
|
3225
|
+
makeRoomAround,
|
|
2588
3226
|
createBatchPlacer,
|
|
2589
3227
|
projectToVisibleGraph,
|
|
2590
3228
|
ELK_ROOT_SPACING,
|