@facet-tools/ui 0.0.0-stage → 0.1.0-rc.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/LICENSE +202 -0
- package/NOTICE +6 -0
- package/README.md +24 -2
- package/THIRD_PARTY.md +673 -0
- package/dist/NOTICE +6 -0
- package/dist/THIRD_PARTY.md +15 -0
- package/dist/atlas-BsWEDCxa.d.cts +4861 -0
- package/dist/atlas-BsWEDCxa.d.ts +4861 -0
- package/dist/chunk-7FW4IMVY.cjs +2013 -0
- package/dist/chunk-7FW4IMVY.cjs.map +1 -0
- package/dist/chunk-7SLSRYM3.cjs +6324 -0
- package/dist/chunk-7SLSRYM3.cjs.map +1 -0
- package/dist/chunk-A4BERWE6.js +19973 -0
- package/dist/chunk-A4BERWE6.js.map +1 -0
- package/dist/chunk-EZP2CCQY.js +6209 -0
- package/dist/chunk-EZP2CCQY.js.map +1 -0
- package/dist/chunk-FR6DIALV.js +511 -0
- package/dist/chunk-FR6DIALV.js.map +1 -0
- package/dist/chunk-GDFKDECN.cjs +1788 -0
- package/dist/chunk-GDFKDECN.cjs.map +1 -0
- package/dist/chunk-K2OVG2BC.cjs +20035 -0
- package/dist/chunk-K2OVG2BC.cjs.map +1 -0
- package/dist/chunk-LOI5RY3Y.js +1754 -0
- package/dist/chunk-LOI5RY3Y.js.map +1 -0
- package/dist/chunk-SWCO2XQL.js +1968 -0
- package/dist/chunk-SWCO2XQL.js.map +1 -0
- package/dist/chunk-WAG2ZZJH.cjs +514 -0
- package/dist/chunk-WAG2ZZJH.cjs.map +1 -0
- package/dist/classic.cjs +467 -0
- package/dist/classic.cjs.map +1 -0
- package/dist/classic.css +635 -0
- package/dist/classic.d.cts +4 -0
- package/dist/classic.d.ts +4 -0
- package/dist/classic.js +6 -0
- package/dist/classic.js.map +1 -0
- package/dist/companion-BUs0yNdX.d.cts +110 -0
- package/dist/companion-DOQ435G6.d.ts +110 -0
- package/dist/core/fixtures.cjs +268 -0
- package/dist/core/fixtures.cjs.map +1 -0
- package/dist/core/fixtures.d.cts +11 -0
- package/dist/core/fixtures.d.ts +11 -0
- package/dist/core/fixtures.js +261 -0
- package/dist/core/fixtures.js.map +1 -0
- package/dist/core.cjs +310 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +268 -0
- package/dist/core.d.ts +268 -0
- package/dist/core.js +5 -0
- package/dist/core.js.map +1 -0
- package/dist/elements.cjs +616 -0
- package/dist/elements.cjs.map +1 -0
- package/dist/elements.d.cts +20 -0
- package/dist/elements.d.ts +20 -0
- package/dist/elements.js +612 -0
- package/dist/elements.js.map +1 -0
- package/dist/facet/atlas.cjs +25 -0
- package/dist/facet/atlas.cjs.map +1 -0
- package/dist/facet/atlas.d.cts +2 -0
- package/dist/facet/atlas.d.ts +2 -0
- package/dist/facet/atlas.js +4 -0
- package/dist/facet/atlas.js.map +1 -0
- package/dist/facet-ui.standalone.js +104 -0
- package/dist/facet.cjs +253 -0
- package/dist/facet.cjs.map +1 -0
- package/dist/facet.css +10649 -0
- package/dist/facet.d.cts +91 -0
- package/dist/facet.d.ts +91 -0
- package/dist/facet.js +4 -0
- package/dist/facet.js.map +1 -0
- package/dist/index.cjs +467 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1584 -0
- package/dist/index.d.ts +1584 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/licenses/react-dom@19.2.8/LICENSE +21 -0
- package/dist/licenses/react@19.2.8/LICENSE +21 -0
- package/dist/licenses/scheduler@0.27.0/LICENSE +21 -0
- package/dist/tokens.css +635 -0
- package/dist/types-DkZBrIXE.d.cts +527 -0
- package/dist/types-DkZBrIXE.d.ts +527 -0
- package/package.json +169 -4
|
@@ -0,0 +1,1788 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkWAG2ZZJH_cjs = require('./chunk-WAG2ZZJH.cjs');
|
|
4
|
+
|
|
5
|
+
// src/i18n/legacy/remaining.ts
|
|
6
|
+
var remainingText = {
|
|
7
|
+
text1: "Bearbeiten",
|
|
8
|
+
text2: "Erste steps",
|
|
9
|
+
text3: "Id kopiert",
|
|
10
|
+
text4: "Anlegen",
|
|
11
|
+
text5: "Leeren",
|
|
12
|
+
text6: "Speichern",
|
|
13
|
+
text7: "aktiv",
|
|
14
|
+
text8: /aktiv/,
|
|
15
|
+
text9: "Suchen",
|
|
16
|
+
text10: "Leeren?",
|
|
17
|
+
text11: "Kopiert",
|
|
18
|
+
text12: "Geschwister zeigen",
|
|
19
|
+
text13: "Zweck",
|
|
20
|
+
text14: "Testabdeckung",
|
|
21
|
+
text15: "Betrieb",
|
|
22
|
+
text16: "Wissen",
|
|
23
|
+
text17: "Herkunft",
|
|
24
|
+
text18: "Modul",
|
|
25
|
+
text19: "Eigenschaft",
|
|
26
|
+
text20: "Kernfunktion",
|
|
27
|
+
text21: "Regelwerk",
|
|
28
|
+
text22: "Datenobjekt",
|
|
29
|
+
text23: "geplant",
|
|
30
|
+
text24: "Entwurf",
|
|
31
|
+
text25: "Was muss man wissen?",
|
|
32
|
+
text26: "Saldo aktualisiert sich sofort.",
|
|
33
|
+
text27: "Was geht schief?",
|
|
34
|
+
text28: 'Unerwarteter Text nach dem Zitatende: "',
|
|
35
|
+
text29: "anker",
|
|
36
|
+
text30: "betrieb",
|
|
37
|
+
text31: "1 Frage",
|
|
38
|
+
text32: "Welche Tests fehlen bei ",
|
|
39
|
+
text33: "Welche Funktionen unterliegen keinem Regelwerk?",
|
|
40
|
+
text34: " von ",
|
|
41
|
+
text35: "Im Code liegen ",
|
|
42
|
+
text36: "Wo fehlen Ende-zu-Ende-Tests?",
|
|
43
|
+
text37: "Nach Dringlichkeit sortiert stehen ",
|
|
44
|
+
text38: "FRISTEN",
|
|
45
|
+
text39: " Einstiege verweisen aus ",
|
|
46
|
+
text40: " Kernfunktionen in den Code.\n",
|
|
47
|
+
text41: "\nUmgekehrt zeigen ",
|
|
48
|
+
text42: " Stufe tief.\n",
|
|
49
|
+
text43: " Stufen tief.\n",
|
|
50
|
+
text44: "Ins Leere zeigen: ",
|
|
51
|
+
text45: "OFFENE VERWEISE",
|
|
52
|
+
text46: "/hilfe was geht hier",
|
|
53
|
+
text47: " Stufen tief. ",
|
|
54
|
+
text48: " Verweise zeigen ins Leere, ",
|
|
55
|
+
text49: " geplant. ",
|
|
56
|
+
text50: " Bereichen. ",
|
|
57
|
+
text51: "Belege",
|
|
58
|
+
text52: "ZUSAGE",
|
|
59
|
+
text53: "Unlesbare Antwort",
|
|
60
|
+
text54: "Erste Zeile\nzweite Zeile\n\nzweiter Absatz",
|
|
61
|
+
text55: "Erste Zeile zweite Zeile",
|
|
62
|
+
text56: "> erste\n> zweite",
|
|
63
|
+
text57: "erste zweite",
|
|
64
|
+
text58: "BETRIEB",
|
|
65
|
+
text59: /Stufen tief/,
|
|
66
|
+
text60: /zeigen ins Leere/,
|
|
67
|
+
text61: "nach 200 ms",
|
|
68
|
+
text62: "MODUL",
|
|
69
|
+
text63: "EIGENSCHAFT",
|
|
70
|
+
text64: "WISSEN",
|
|
71
|
+
text65: "wert",
|
|
72
|
+
text66: " alle-bereit-startet-countdown,",
|
|
73
|
+
text67: "alle-bereit-startet-countdown",
|
|
74
|
+
text68: "answer: erster Satz.",
|
|
75
|
+
text69: " zweiter Satz.",
|
|
76
|
+
text70: "erster Satz.\nzweiter Satz.",
|
|
77
|
+
text71: " geht hier weiter'",
|
|
78
|
+
text72: "summary: 'erster Satz.",
|
|
79
|
+
text73: " zweiter Satz.'",
|
|
80
|
+
text74: 'summary: "erste Zeile',
|
|
81
|
+
text75: "erste Zeile zweite Zeile",
|
|
82
|
+
text76: " geht weiter'",
|
|
83
|
+
text77: "summary: 'nie geschlossen",
|
|
84
|
+
text78: 's: "erste',
|
|
85
|
+
text79: "erste zweite # dritte vierte",
|
|
86
|
+
text80: "summary: 'erste Zeile",
|
|
87
|
+
text81: "erste Zeile zweite (label #example).",
|
|
88
|
+
text82: "s: 'erste",
|
|
89
|
+
text83: "Antwort",
|
|
90
|
+
text84: "Rohquelle",
|
|
91
|
+
text85: /Betrieb/,
|
|
92
|
+
text86: "Erste Entscheidung anlegen",
|
|
93
|
+
text87: "| Datei | Zweck |",
|
|
94
|
+
text88: "Entwurf vorschlagen",
|
|
95
|
+
text89: "Minikarte",
|
|
96
|
+
text90: "Zeigen",
|
|
97
|
+
text91: "Gliederung",
|
|
98
|
+
text92: "Was willst du wissen?",
|
|
99
|
+
text93: "Sitzungen suchen",
|
|
100
|
+
text94: "Quellen dieser Sitzung",
|
|
101
|
+
text95: " zeigen",
|
|
102
|
+
text96: /^aktiv$/,
|
|
103
|
+
text97: /^geplant$/,
|
|
104
|
+
text98: "lc-aktiv",
|
|
105
|
+
text99: "Diagramme in dieser Datei",
|
|
106
|
+
text100: "Record anlegen",
|
|
107
|
+
text101: "Release-Kandidat freigeben",
|
|
108
|
+
text102: "Plugin installieren",
|
|
109
|
+
text103: "Drift melden",
|
|
110
|
+
text104: "Atlas starten",
|
|
111
|
+
text105: "Sidecar aufrufen",
|
|
112
|
+
text106: "Kategorien",
|
|
113
|
+
text107: "ADRs lesen, Status vorschlagen, neue Entscheidungen anlegen.",
|
|
114
|
+
text108: "Jira-Abgleich",
|
|
115
|
+
text109: "In diesem Browser gespeichert \xB7 2,0 KB",
|
|
116
|
+
text110: "Chat-Sitzungen leeren (2 Sitzungen)",
|
|
117
|
+
text111: "Als Entwurf",
|
|
118
|
+
text112: "Entscheidung speichern",
|
|
119
|
+
text113: "Modul \xB7 creates_task",
|
|
120
|
+
text114: "Ganze Stadt zeigen",
|
|
121
|
+
text115: /^In \d+ Bereichen\./,
|
|
122
|
+
text116: /Ersten Record anlegen/,
|
|
123
|
+
text117: /Record anlegen/,
|
|
124
|
+
text118: /Suchen/,
|
|
125
|
+
text119: "aktiv \xB7 seit 197 Tagen",
|
|
126
|
+
text120: " wissen?",
|
|
127
|
+
text121: "Block anlegen",
|
|
128
|
+
text122: "Erster Record",
|
|
129
|
+
text123: "Erste Regel anlegen",
|
|
130
|
+
text124: "Regel anlegen",
|
|
131
|
+
text125: /25 auf dieser Seite/,
|
|
132
|
+
text126: "Was muss man vorher wissen?",
|
|
133
|
+
text127: ", Antwort zeigen",
|
|
134
|
+
text128: "aktiv \xB7 6",
|
|
135
|
+
text129: "geplant \xB7 4",
|
|
136
|
+
text130: "aktiv 11 \xB7 geplant 4",
|
|
137
|
+
text131: "suchen \u2026",
|
|
138
|
+
text132: /^Betrieb/,
|
|
139
|
+
text133: "Lebenszyklus: geplant",
|
|
140
|
+
text134: "Lebenszyklus: aktiv",
|
|
141
|
+
text135: /geplant/,
|
|
142
|
+
text136: /lists\/permissions: \d+ aktiv/,
|
|
143
|
+
text137: /^aktiv: /,
|
|
144
|
+
text138: /Wissen/,
|
|
145
|
+
text139: "Antwort vorschlagen",
|
|
146
|
+
text140: "Nachfolger suchen",
|
|
147
|
+
text141: "In Records suchen",
|
|
148
|
+
text142: "zeigen",
|
|
149
|
+
text143: "freigeben",
|
|
150
|
+
text144: "melden",
|
|
151
|
+
text145: "Bereichen",
|
|
152
|
+
text146: "7 Records in 3 Bereichen.",
|
|
153
|
+
text147: "Antwort.",
|
|
154
|
+
text148: "Fristen",
|
|
155
|
+
text149: "antwort",
|
|
156
|
+
text150: "28 aktiv \xB7 14 geplant",
|
|
157
|
+
text151: "leeren",
|
|
158
|
+
text152: "task-added \xB7 Modul: 2 Tests",
|
|
159
|
+
text153: "sieht: 8 Records \xB7 src \xB7 21 581 Zeilen\nRolle BETRIEB",
|
|
160
|
+
text154: "Antwort Nummer ",
|
|
161
|
+
text155: "Diese Software hat 10 CoreFunctions in 6 Areas.",
|
|
162
|
+
text156: "\xB7 Diese Software hat 10 CoreFunctions",
|
|
163
|
+
text157: "Verweise",
|
|
164
|
+
text158: "Verweise zeigen",
|
|
165
|
+
text159: "lifecycle: active # aktiv",
|
|
166
|
+
text160: "# aktiv",
|
|
167
|
+
text161: "anlegen"
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/i18n/legacy/core/yaml.ts
|
|
171
|
+
var localized = {
|
|
172
|
+
text1: "Nicht geschlossene Flow-Sequenz",
|
|
173
|
+
text2: "Nicht geschlossene Flow-Map",
|
|
174
|
+
text3: "Flow-Map-Eintrag ohne Doppelpunkt",
|
|
175
|
+
text4: "Tabulatoren sind als Einr\xFCckung nicht zul\xE4ssig",
|
|
176
|
+
text5: "Nicht geschlossene Flow-Collection",
|
|
177
|
+
text6: "Nicht geschlossene Zeichenkette",
|
|
178
|
+
text7: 'Unerwartete Einr\xFCckung bei "'
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// src/core/yaml.ts
|
|
182
|
+
var YamlError = class extends Error {
|
|
183
|
+
line;
|
|
184
|
+
constructor(message, line) {
|
|
185
|
+
super(line != null ? `${message}${chunkWAG2ZZJH_cjs.labelText.text385}${line + 1})` : message);
|
|
186
|
+
this.name = "YamlError";
|
|
187
|
+
this.line = line;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
function stripComment(s) {
|
|
191
|
+
let quote = null;
|
|
192
|
+
for (let i = 0; i < s.length; i++) {
|
|
193
|
+
const c = s[i];
|
|
194
|
+
if (quote) {
|
|
195
|
+
if (c === quote && s[i - 1] !== "\\") quote = null;
|
|
196
|
+
} else if (c === '"' || c === "'") {
|
|
197
|
+
quote = c;
|
|
198
|
+
} else if (c === "#" && (i === 0 || /\s/.test(s[i - 1]))) {
|
|
199
|
+
return s.slice(0, i);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return s;
|
|
203
|
+
}
|
|
204
|
+
function splitFlow(body, line) {
|
|
205
|
+
const out = [];
|
|
206
|
+
let depth = 0;
|
|
207
|
+
let quote = null;
|
|
208
|
+
let cur = "";
|
|
209
|
+
for (const c of body) {
|
|
210
|
+
if (quote) {
|
|
211
|
+
cur += c;
|
|
212
|
+
if (c === quote) quote = null;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (c === '"' || c === "'") {
|
|
216
|
+
quote = c;
|
|
217
|
+
cur += c;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (c === "[" || c === "{") depth++;
|
|
221
|
+
if (c === "]" || c === "}") depth--;
|
|
222
|
+
if (c === "," && depth === 0) {
|
|
223
|
+
out.push(cur);
|
|
224
|
+
cur = "";
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
cur += c;
|
|
228
|
+
}
|
|
229
|
+
if (cur.trim() !== "") out.push(cur);
|
|
230
|
+
if (depth !== 0) throw new YamlError("Unausgeglichene Flow-Collection", line);
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
function flowDepth(s) {
|
|
234
|
+
let depth = 0;
|
|
235
|
+
let quote = null;
|
|
236
|
+
for (let i = 0; i < s.length; i++) {
|
|
237
|
+
const c = s[i];
|
|
238
|
+
if (quote) {
|
|
239
|
+
if (c === quote && s[i - 1] !== "\\") quote = null;
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (c === '"' || c === "'") quote = c;
|
|
243
|
+
else if (c === "[" || c === "{") depth++;
|
|
244
|
+
else if (c === "]" || c === "}") depth--;
|
|
245
|
+
}
|
|
246
|
+
return depth;
|
|
247
|
+
}
|
|
248
|
+
function opensFlow(s) {
|
|
249
|
+
return s[0] === "[" || s[0] === "{";
|
|
250
|
+
}
|
|
251
|
+
function findQuoteEnd(s, quote, start) {
|
|
252
|
+
for (let i = start; i < s.length; i++) {
|
|
253
|
+
const c = s[i];
|
|
254
|
+
if (quote === "'") {
|
|
255
|
+
if (c === "'") {
|
|
256
|
+
if (s[i + 1] === "'") {
|
|
257
|
+
i++;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
return i;
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
if (c === "\\") {
|
|
264
|
+
i++;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (c === '"') return i;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return -1;
|
|
271
|
+
}
|
|
272
|
+
function trailingBackslashCount(s) {
|
|
273
|
+
let n = 0;
|
|
274
|
+
for (let i = s.length - 1; i >= 0 && s[i] === "\\"; i--) n++;
|
|
275
|
+
return n;
|
|
276
|
+
}
|
|
277
|
+
function flow(s, line) {
|
|
278
|
+
const t = s.trim();
|
|
279
|
+
if (t[0] === "[") {
|
|
280
|
+
if (!t.endsWith("]")) throw new YamlError(localized.text1, line);
|
|
281
|
+
return splitFlow(t.slice(1, -1), line).map((v) => scalar(v, line));
|
|
282
|
+
}
|
|
283
|
+
if (!t.endsWith("}")) throw new YamlError(localized.text2, line);
|
|
284
|
+
const obj = {};
|
|
285
|
+
splitFlow(t.slice(1, -1), line).forEach((pair) => {
|
|
286
|
+
const idx = pair.indexOf(":");
|
|
287
|
+
if (idx < 0) throw new YamlError(localized.text3, line);
|
|
288
|
+
obj[String(scalar(pair.slice(0, idx), line))] = scalar(pair.slice(idx + 1), line);
|
|
289
|
+
});
|
|
290
|
+
return obj;
|
|
291
|
+
}
|
|
292
|
+
function unescapeDouble(body) {
|
|
293
|
+
let out = "";
|
|
294
|
+
for (let i = 0; i < body.length; i++) {
|
|
295
|
+
const c = body[i];
|
|
296
|
+
if (c !== "\\") {
|
|
297
|
+
out += c;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
const next = body[i + 1];
|
|
301
|
+
if (next === "n") out += "\n";
|
|
302
|
+
else if (next === '"') out += '"';
|
|
303
|
+
else if (next === "\\") out += "\\";
|
|
304
|
+
else if (next === " ") out += " ";
|
|
305
|
+
else {
|
|
306
|
+
out += c;
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
i++;
|
|
310
|
+
}
|
|
311
|
+
return out;
|
|
312
|
+
}
|
|
313
|
+
function scalar(raw, line) {
|
|
314
|
+
const s = String(raw).trim();
|
|
315
|
+
if (s === "" || s === "~" || s === "null" || s === "Null" || s === "NULL") return null;
|
|
316
|
+
if (s === "true" || s === "True" || s === "TRUE") return true;
|
|
317
|
+
if (s === "false" || s === "False" || s === "FALSE") return false;
|
|
318
|
+
if (/^-?\d+$/.test(s)) return parseInt(s, 10);
|
|
319
|
+
if (/^-?\d*\.\d+$/.test(s)) return parseFloat(s);
|
|
320
|
+
if (s[0] === '"' && s.endsWith('"') || s[0] === "'" && s.endsWith("'")) {
|
|
321
|
+
const body = s.slice(1, -1);
|
|
322
|
+
return s[0] === '"' ? unescapeDouble(body) : body.replace(/''/g, "'");
|
|
323
|
+
}
|
|
324
|
+
if (s[0] === "[" || s[0] === "{") return flow(s, line);
|
|
325
|
+
return s;
|
|
326
|
+
}
|
|
327
|
+
function keyLine(s) {
|
|
328
|
+
let quote = null;
|
|
329
|
+
for (let i = 0; i < s.length; i++) {
|
|
330
|
+
const c = s[i];
|
|
331
|
+
if (quote) {
|
|
332
|
+
if (c === quote) quote = null;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (c === '"' || c === "'") {
|
|
336
|
+
quote = c;
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (c === ":" && (i + 1 === s.length || /\s/.test(s[i + 1]))) {
|
|
340
|
+
return [String(scalar(s.slice(0, i))), s.slice(i + 1).trim()];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
function parseYaml(text) {
|
|
346
|
+
if (typeof text !== "string") throw new YamlError("YAML-Text erwartet");
|
|
347
|
+
const rows = [];
|
|
348
|
+
text.replace(/\r\n?/g, "\n").split("\n").forEach((raw, n) => {
|
|
349
|
+
if (/^\s*(---|\.\.\.)\s*$/.test(raw)) return;
|
|
350
|
+
const leading = /^[ \t]*/.exec(raw)?.[0] ?? "";
|
|
351
|
+
const body = stripComment(raw).replace(/\s+$/, "");
|
|
352
|
+
if (!body.trim()) return;
|
|
353
|
+
if (leading.includes(" ")) {
|
|
354
|
+
throw new YamlError(localized.text4, n);
|
|
355
|
+
}
|
|
356
|
+
const indent = leading.length;
|
|
357
|
+
rows.push({ indent, text: body.trim(), raw: raw.trim(), n });
|
|
358
|
+
});
|
|
359
|
+
let i = 0;
|
|
360
|
+
function blockScalar(header, indent) {
|
|
361
|
+
const fold = header[0] === ">";
|
|
362
|
+
const chomp = header.includes("-") ? "strip" : header.includes("+") ? "keep" : "clip";
|
|
363
|
+
const lines = [];
|
|
364
|
+
let base = null;
|
|
365
|
+
while (i < rows.length && rows[i].indent > indent) {
|
|
366
|
+
if (base == null) base = rows[i].indent;
|
|
367
|
+
lines.push(" ".repeat(Math.max(0, rows[i].indent - base)) + rows[i].text);
|
|
368
|
+
i++;
|
|
369
|
+
}
|
|
370
|
+
if (!lines.length) return "";
|
|
371
|
+
let out = fold ? lines.reduce(
|
|
372
|
+
(acc, l, idx) => idx === 0 ? l : l.startsWith(" ") || acc.endsWith("\n") ? `${acc}
|
|
373
|
+
${l}` : `${acc} ${l}`,
|
|
374
|
+
""
|
|
375
|
+
) : lines.join("\n");
|
|
376
|
+
if (chomp === "strip") out = out.replace(/\n+$/, "");
|
|
377
|
+
else if (chomp === "clip") out = `${out.replace(/\n+$/, "")}
|
|
378
|
+
`;
|
|
379
|
+
else out += "\n";
|
|
380
|
+
return out;
|
|
381
|
+
}
|
|
382
|
+
function readFlow(head, line) {
|
|
383
|
+
let text2 = head;
|
|
384
|
+
while (flowDepth(text2) > 0) {
|
|
385
|
+
if (i >= rows.length) {
|
|
386
|
+
throw new YamlError(localized.text5, line);
|
|
387
|
+
}
|
|
388
|
+
text2 += " " + rows[i].text;
|
|
389
|
+
i++;
|
|
390
|
+
}
|
|
391
|
+
return flow(text2, line);
|
|
392
|
+
}
|
|
393
|
+
function multilineScalar(rest, quote, indent, line) {
|
|
394
|
+
const segments = [];
|
|
395
|
+
let forceJoin = false;
|
|
396
|
+
function pushSegment(raw, sep) {
|
|
397
|
+
let text2 = raw;
|
|
398
|
+
const effectiveSep = forceJoin ? "none" : sep;
|
|
399
|
+
forceJoin = false;
|
|
400
|
+
if (quote === '"' && trailingBackslashCount(text2) % 2 === 1) {
|
|
401
|
+
text2 = text2.slice(0, -1);
|
|
402
|
+
forceJoin = true;
|
|
403
|
+
}
|
|
404
|
+
segments.push({ text: text2, sep: effectiveSep });
|
|
405
|
+
}
|
|
406
|
+
pushSegment(rest.slice(1), "none");
|
|
407
|
+
let prevN = line;
|
|
408
|
+
let closed = false;
|
|
409
|
+
while (!closed) {
|
|
410
|
+
if (i >= rows.length || rows[i].indent <= indent) {
|
|
411
|
+
throw new YamlError(localized.text6, line);
|
|
412
|
+
}
|
|
413
|
+
const row = rows[i];
|
|
414
|
+
const sep = row.n - prevN > 1 ? "newline" : "space";
|
|
415
|
+
const endIdx = findQuoteEnd(row.raw, quote, 0);
|
|
416
|
+
if (endIdx === -1) {
|
|
417
|
+
pushSegment(row.raw, sep);
|
|
418
|
+
prevN = row.n;
|
|
419
|
+
i++;
|
|
420
|
+
} else {
|
|
421
|
+
const remainder = stripComment(row.raw.slice(endIdx + 1)).trim();
|
|
422
|
+
if (remainder !== "") {
|
|
423
|
+
throw new YamlError(`${remainingText.text28}${remainder}"`, row.n);
|
|
424
|
+
}
|
|
425
|
+
pushSegment(row.raw.slice(0, endIdx), sep);
|
|
426
|
+
i++;
|
|
427
|
+
closed = true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const folded = segments.reduce((acc, seg, idx) => {
|
|
431
|
+
if (idx === 0) return seg.text;
|
|
432
|
+
if (seg.sep === "none") return `${acc}${seg.text}`;
|
|
433
|
+
return seg.sep === "newline" ? `${acc}
|
|
434
|
+
${seg.text}` : `${acc} ${seg.text}`;
|
|
435
|
+
}, "");
|
|
436
|
+
return quote === "'" ? folded.replace(/''/g, "'") : unescapeDouble(folded);
|
|
437
|
+
}
|
|
438
|
+
function multilinePlain(rest, indent, line) {
|
|
439
|
+
const segments = [{ text: rest, gap: false }];
|
|
440
|
+
let prevN = line;
|
|
441
|
+
while (i < rows.length && rows[i].indent > indent) {
|
|
442
|
+
const row = rows[i];
|
|
443
|
+
segments.push({ text: row.text, gap: row.n - prevN > 1 });
|
|
444
|
+
prevN = row.n;
|
|
445
|
+
i++;
|
|
446
|
+
}
|
|
447
|
+
return segments.reduce(
|
|
448
|
+
(acc, seg, idx) => idx === 0 ? seg.text : seg.gap ? `${acc}
|
|
449
|
+
${seg.text}` : `${acc} ${seg.text}`,
|
|
450
|
+
""
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
function value(rest, indent, line) {
|
|
454
|
+
if (rest === "") {
|
|
455
|
+
const next = rows[i];
|
|
456
|
+
if (next && next.indent > indent && opensFlow(next.text)) {
|
|
457
|
+
const at = next.n;
|
|
458
|
+
i++;
|
|
459
|
+
return readFlow(next.text, at);
|
|
460
|
+
}
|
|
461
|
+
if (next && next.indent === indent && (next.text.startsWith("- ") || next.text === "-")) {
|
|
462
|
+
return parseBlock(indent);
|
|
463
|
+
}
|
|
464
|
+
return i < rows.length && rows[i].indent > indent ? parseBlock(rows[i].indent) : null;
|
|
465
|
+
}
|
|
466
|
+
if (/^[|>][-+]?\d*$/.test(rest)) return blockScalar(rest, indent);
|
|
467
|
+
if (opensFlow(rest) && flowDepth(rest) > 0) return readFlow(rest, line);
|
|
468
|
+
if (rest[0] === '"' || rest[0] === "'") {
|
|
469
|
+
if (findQuoteEnd(rest, rest[0], 1) === -1)
|
|
470
|
+
return multilineScalar(rest, rest[0], indent, line);
|
|
471
|
+
return scalar(rest, line);
|
|
472
|
+
}
|
|
473
|
+
if (i < rows.length && rows[i].indent > indent) {
|
|
474
|
+
return scalar(multilinePlain(rest, indent, line), line);
|
|
475
|
+
}
|
|
476
|
+
return scalar(rest, line);
|
|
477
|
+
}
|
|
478
|
+
function parseBlock(indent) {
|
|
479
|
+
const first = rows[i];
|
|
480
|
+
if (!first) return null;
|
|
481
|
+
if (first.text.startsWith("- ") || first.text === "-") {
|
|
482
|
+
const arr = [];
|
|
483
|
+
while (i < rows.length && rows[i].indent === indent && (rows[i].text.startsWith("- ") || rows[i].text === "-")) {
|
|
484
|
+
const row = rows[i];
|
|
485
|
+
const inner = row.text === "-" ? "" : row.text.slice(2).trim();
|
|
486
|
+
i++;
|
|
487
|
+
if (inner === "") {
|
|
488
|
+
arr.push(i < rows.length && rows[i].indent > indent ? parseBlock(rows[i].indent) : null);
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
const kv = opensFlow(inner) ? null : keyLine(inner);
|
|
492
|
+
if (opensFlow(inner)) {
|
|
493
|
+
arr.push(flowDepth(inner) > 0 ? readFlow(inner, row.n) : flow(inner, row.n));
|
|
494
|
+
} else if (kv) {
|
|
495
|
+
const map = {};
|
|
496
|
+
const afterDash = row.text.slice(1);
|
|
497
|
+
const childIndent = row.indent + 1 + (afterDash.length - afterDash.trimStart().length);
|
|
498
|
+
map[kv[0]] = value(kv[1], childIndent, row.n);
|
|
499
|
+
while (i < rows.length && rows[i].indent >= childIndent && !rows[i].text.startsWith("- ")) {
|
|
500
|
+
const kv2 = keyLine(rows[i].text);
|
|
501
|
+
if (!kv2) {
|
|
502
|
+
throw new YamlError(`"key: value" erwartet, gefunden "${rows[i].text}"`, rows[i].n);
|
|
503
|
+
}
|
|
504
|
+
const own = rows[i].indent;
|
|
505
|
+
const at = rows[i].n;
|
|
506
|
+
i++;
|
|
507
|
+
map[kv2[0]] = value(kv2[1], own, at);
|
|
508
|
+
}
|
|
509
|
+
arr.push(map);
|
|
510
|
+
} else {
|
|
511
|
+
if (/^[|>][-+]?\d*$/.test(inner)) {
|
|
512
|
+
arr.push(blockScalar(inner, row.indent));
|
|
513
|
+
} else if ((inner[0] === '"' || inner[0] === "'") && findQuoteEnd(inner, inner[0], 1) === -1) {
|
|
514
|
+
arr.push(multilineScalar(inner, inner[0], row.indent, row.n));
|
|
515
|
+
} else if (inner[0] !== '"' && inner[0] !== "'" && i < rows.length && rows[i].indent > row.indent) {
|
|
516
|
+
arr.push(scalar(multilinePlain(inner, row.indent, row.n), row.n));
|
|
517
|
+
} else {
|
|
518
|
+
arr.push(scalar(inner, row.n));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return arr;
|
|
523
|
+
}
|
|
524
|
+
const obj = {};
|
|
525
|
+
while (i < rows.length && rows[i].indent === indent) {
|
|
526
|
+
const row = rows[i];
|
|
527
|
+
if (row.text.startsWith("- ")) break;
|
|
528
|
+
const kv = keyLine(row.text);
|
|
529
|
+
if (!kv) throw new YamlError(`"key: value" erwartet, gefunden "${row.text}"`, row.n);
|
|
530
|
+
i++;
|
|
531
|
+
obj[kv[0]] = value(kv[1], indent, row.n);
|
|
532
|
+
}
|
|
533
|
+
return obj;
|
|
534
|
+
}
|
|
535
|
+
if (!rows.length) return null;
|
|
536
|
+
const doc = parseBlock(rows[0].indent);
|
|
537
|
+
if (i < rows.length) {
|
|
538
|
+
throw new YamlError(`${localized.text7}${rows[i].text}"`, rows[i].n);
|
|
539
|
+
}
|
|
540
|
+
return doc;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// src/i18n/legacy/core/gherkin.ts
|
|
544
|
+
var localized2 = {
|
|
545
|
+
text1: "UND",
|
|
546
|
+
text2: "ABER",
|
|
547
|
+
tokenPattern: /("[^"]*"|'[^']*'|<[^>]+>|\b\d+(?:[.,]\d+)?\s*(?:%|px|ms|s|min|h|d|Tage?|Monate?|Sekunden?|Minuten?|Stunden?|Zeichen)?\b|\b[a-z_]+(?:_[a-z]+)+\b|\btrue\b|\bfalse\b|\bnull\b)/g
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// src/core/gherkin.ts
|
|
551
|
+
var GHERKIN_LABEL = {
|
|
552
|
+
GIVEN: "AUSGANGSLAGE",
|
|
553
|
+
WHEN: "AKTION",
|
|
554
|
+
THEN: chunkWAG2ZZJH_cjs.labelText.text331,
|
|
555
|
+
AND: localized2.text1,
|
|
556
|
+
BUT: localized2.text2
|
|
557
|
+
};
|
|
558
|
+
var KEYWORD_RE = /^(Given|When|Then|And|But|\*)\s+(.*)$/i;
|
|
559
|
+
function parseGherkin(statement) {
|
|
560
|
+
const steps = [];
|
|
561
|
+
let lastKind = "";
|
|
562
|
+
String(statement ?? "").split("\n").map((l) => l.trim()).filter(Boolean).forEach((line) => {
|
|
563
|
+
const m = line.match(KEYWORD_RE);
|
|
564
|
+
if (m) {
|
|
565
|
+
const kw = m[1] === "*" ? "AND" : m[1].toUpperCase();
|
|
566
|
+
if (kw !== "AND" && kw !== "BUT") lastKind = kw;
|
|
567
|
+
steps.push({
|
|
568
|
+
keyword: kw,
|
|
569
|
+
parent: kw === "AND" || kw === "BUT" ? lastKind || kw : kw,
|
|
570
|
+
text: m[2]
|
|
571
|
+
});
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (steps.length) {
|
|
575
|
+
steps[steps.length - 1].text += ` ${line}`;
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
steps.push({ keyword: "", parent: "", text: line });
|
|
579
|
+
});
|
|
580
|
+
return steps;
|
|
581
|
+
}
|
|
582
|
+
var TOKEN_RE = localized2.tokenPattern;
|
|
583
|
+
function oneLine(text) {
|
|
584
|
+
return String(text ?? "").replace(/\s+/g, " ").trim();
|
|
585
|
+
}
|
|
586
|
+
function tokenizeGherkin(text) {
|
|
587
|
+
const src = oneLine(text ?? "");
|
|
588
|
+
const out = [];
|
|
589
|
+
let last = 0;
|
|
590
|
+
let match;
|
|
591
|
+
TOKEN_RE.lastIndex = 0;
|
|
592
|
+
while (match = TOKEN_RE.exec(src)) {
|
|
593
|
+
if (match.index > last) {
|
|
594
|
+
out.push({ kind: "prose", text: src.slice(last, match.index) });
|
|
595
|
+
}
|
|
596
|
+
const token = match[0];
|
|
597
|
+
let kind = "number";
|
|
598
|
+
if (/^["']/.test(token)) kind = "quoted";
|
|
599
|
+
else if (/^</.test(token)) kind = "placeholder";
|
|
600
|
+
else if (/^(true|false|null)$/.test(token)) kind = "literal";
|
|
601
|
+
else if (/^[a-z_]+(_[a-z]+)+$/.test(token)) kind = "identifier";
|
|
602
|
+
out.push({ kind, text: token });
|
|
603
|
+
last = match.index + token.length;
|
|
604
|
+
}
|
|
605
|
+
if (last < src.length) out.push({ kind: "prose", text: src.slice(last) });
|
|
606
|
+
return out;
|
|
607
|
+
}
|
|
608
|
+
function scenarioPreview(steps) {
|
|
609
|
+
if (!steps.length) return null;
|
|
610
|
+
const then = steps.find((s) => s.keyword === "THEN" || s.parent === "THEN");
|
|
611
|
+
if (then) return { label: GHERKIN_LABEL.THEN, text: oneLine(then.text) };
|
|
612
|
+
const last = steps[steps.length - 1];
|
|
613
|
+
return { label: remainingText.text52, text: oneLine(last.text) };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// src/i18n/legacy/core/taxonomy.ts
|
|
617
|
+
var localized3 = {
|
|
618
|
+
text1: "Nicht deklariert",
|
|
619
|
+
text2: "IDs, deren Domain oder Capability die Taxonomie nicht deklariert. 'facet lint' meldet jede davon als Fehler."
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// src/core/taxonomy.ts
|
|
623
|
+
var CLASSIFICATIONS = ["core", "supporting", "generic"];
|
|
624
|
+
function asRecord(value) {
|
|
625
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
626
|
+
}
|
|
627
|
+
function asText(value) {
|
|
628
|
+
return typeof value === "string" ? value.trim() : "";
|
|
629
|
+
}
|
|
630
|
+
function asClassification(value) {
|
|
631
|
+
const text = asText(value);
|
|
632
|
+
return CLASSIFICATIONS.includes(text) ? text : null;
|
|
633
|
+
}
|
|
634
|
+
function parseTaxonomy(text) {
|
|
635
|
+
if (!text || !text.trim()) return null;
|
|
636
|
+
let doc;
|
|
637
|
+
try {
|
|
638
|
+
doc = asRecord(parseYaml(text));
|
|
639
|
+
} catch (error) {
|
|
640
|
+
if (!(error instanceof YamlError)) throw error;
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
const domainsDoc = asRecord(doc.domains);
|
|
644
|
+
const names = Object.keys(domainsDoc);
|
|
645
|
+
if (names.length === 0) return null;
|
|
646
|
+
const domains = names.sort().map((name) => {
|
|
647
|
+
const d = asRecord(domainsDoc[name]);
|
|
648
|
+
const classification = asClassification(d.classification);
|
|
649
|
+
const capsDoc = asRecord(d.capabilities);
|
|
650
|
+
const capabilities = Object.keys(capsDoc).sort().map((capName) => {
|
|
651
|
+
const c = asRecord(capsDoc[capName]);
|
|
652
|
+
const own = asClassification(c.classification);
|
|
653
|
+
return {
|
|
654
|
+
name: capName,
|
|
655
|
+
title: asText(c.title) || capName,
|
|
656
|
+
purpose: asText(c.purpose),
|
|
657
|
+
classification: own ?? classification,
|
|
658
|
+
inherited: own === null && classification !== null
|
|
659
|
+
};
|
|
660
|
+
});
|
|
661
|
+
return {
|
|
662
|
+
name,
|
|
663
|
+
title: asText(d.title) || name,
|
|
664
|
+
purpose: asText(d.purpose),
|
|
665
|
+
classification,
|
|
666
|
+
ownerTeam: asText(asRecord(d.owner).team),
|
|
667
|
+
capabilities
|
|
668
|
+
};
|
|
669
|
+
});
|
|
670
|
+
return { schemaVersion: asText(doc.schema_version), domains };
|
|
671
|
+
}
|
|
672
|
+
function taxonomyTree(taxonomy, ids) {
|
|
673
|
+
if (!taxonomy) return [];
|
|
674
|
+
const byNode = {};
|
|
675
|
+
ids.forEach((id) => {
|
|
676
|
+
const seg = id.split("/");
|
|
677
|
+
if (seg.length !== 3) return;
|
|
678
|
+
const key = `${seg[0]}/${seg[1]}`;
|
|
679
|
+
(byNode[key] ||= []).push(id);
|
|
680
|
+
});
|
|
681
|
+
const branches = taxonomy.domains.map((domain) => {
|
|
682
|
+
const nodes = domain.capabilities.map((cap) => {
|
|
683
|
+
const key = `${domain.name}/${cap.name}`;
|
|
684
|
+
const own = (byNode[key] ?? []).sort();
|
|
685
|
+
delete byNode[key];
|
|
686
|
+
return {
|
|
687
|
+
domain: domain.name,
|
|
688
|
+
capability: cap.name,
|
|
689
|
+
title: cap.title,
|
|
690
|
+
purpose: cap.purpose,
|
|
691
|
+
classification: cap.classification,
|
|
692
|
+
ids: own,
|
|
693
|
+
empty: own.length === 0,
|
|
694
|
+
undeclared: false
|
|
695
|
+
};
|
|
696
|
+
});
|
|
697
|
+
return { domain, nodes, ids: nodes.flatMap((n) => n.ids) };
|
|
698
|
+
});
|
|
699
|
+
const leftovers = Object.keys(byNode).sort();
|
|
700
|
+
if (leftovers.length > 0) {
|
|
701
|
+
const nodes = leftovers.map((key) => {
|
|
702
|
+
const [domain, capability] = key.split("/");
|
|
703
|
+
return {
|
|
704
|
+
domain,
|
|
705
|
+
capability,
|
|
706
|
+
title: capability,
|
|
707
|
+
purpose: "",
|
|
708
|
+
classification: null,
|
|
709
|
+
ids: byNode[key].sort(),
|
|
710
|
+
empty: false,
|
|
711
|
+
undeclared: true
|
|
712
|
+
};
|
|
713
|
+
});
|
|
714
|
+
branches.push({
|
|
715
|
+
domain: {
|
|
716
|
+
name: "",
|
|
717
|
+
title: localized3.text1,
|
|
718
|
+
purpose: localized3.text2,
|
|
719
|
+
classification: null,
|
|
720
|
+
ownerTeam: "",
|
|
721
|
+
capabilities: []
|
|
722
|
+
},
|
|
723
|
+
nodes,
|
|
724
|
+
ids: nodes.flatMap((n) => n.ids)
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
return branches;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// src/core/model-values.ts
|
|
731
|
+
function asRecord2(value) {
|
|
732
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
733
|
+
}
|
|
734
|
+
function asArray(value) {
|
|
735
|
+
return Array.isArray(value) ? value : [];
|
|
736
|
+
}
|
|
737
|
+
function asString(value) {
|
|
738
|
+
return value == null ? "" : String(value);
|
|
739
|
+
}
|
|
740
|
+
function humanize(segment) {
|
|
741
|
+
const s = String(segment ?? "").replace(/[-_]/g, " ").trim();
|
|
742
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// src/core/model-record.ts
|
|
746
|
+
function shapeDeviation(value) {
|
|
747
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
748
|
+
const doc = value;
|
|
749
|
+
return {
|
|
750
|
+
reason: asString(doc.reason),
|
|
751
|
+
confirmedBy: asString(doc.confirmed_by),
|
|
752
|
+
trackedAs: asString(doc.tracked_as)
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
function shapeAudience(value) {
|
|
756
|
+
return value === "product" || value === "engineering" ? value : null;
|
|
757
|
+
}
|
|
758
|
+
function anyAnchorProves(scan) {
|
|
759
|
+
return Object.values(scan?.anchors ?? {}).some(
|
|
760
|
+
(list) => list.some((a) => Array.isArray(a.proves) && a.proves.length > 0)
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
function recordKindOf(id) {
|
|
764
|
+
if (id.startsWith("policy/")) return "policy";
|
|
765
|
+
if (id.startsWith("assumption/")) return "assumption";
|
|
766
|
+
if (id.startsWith("data/")) return "entity";
|
|
767
|
+
return "feature";
|
|
768
|
+
}
|
|
769
|
+
function shapeDefects(value) {
|
|
770
|
+
const empty = { present: false, fixes: [], total: 0, byFile: [], lastFix: "" };
|
|
771
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) return empty;
|
|
772
|
+
const block = asRecord2(value);
|
|
773
|
+
const fixes = asArray(block.fixes).map((f) => ({
|
|
774
|
+
commit: asString(f.commit),
|
|
775
|
+
date: asString(f.date),
|
|
776
|
+
files: asArray(f.files).map(String),
|
|
777
|
+
subject: asString(f.subject),
|
|
778
|
+
issue: asString(f.issue),
|
|
779
|
+
recordedBy: asString(f.recorded_by)
|
|
780
|
+
})).filter((f) => f.commit !== "");
|
|
781
|
+
fixes.sort(
|
|
782
|
+
(a, b) => a.date === b.date ? a.commit.localeCompare(b.commit) : b.date.localeCompare(a.date)
|
|
783
|
+
);
|
|
784
|
+
const counts = {};
|
|
785
|
+
fixes.forEach((f) => f.files.forEach((p) => counts[p] = (counts[p] || 0) + 1));
|
|
786
|
+
const byFile = Object.keys(counts).map((path) => ({ path, count: counts[path] })).sort((a, b) => a.count === b.count ? a.path.localeCompare(b.path) : b.count - a.count);
|
|
787
|
+
return {
|
|
788
|
+
present: true,
|
|
789
|
+
fixes,
|
|
790
|
+
total: fixes.length,
|
|
791
|
+
byFile,
|
|
792
|
+
lastFix: fixes.length > 0 ? fixes[0].date : ""
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
function shapeRecord(raw, scan) {
|
|
796
|
+
const doc = raw.doc ?? {};
|
|
797
|
+
const id = asString(doc.id) || raw.path;
|
|
798
|
+
const kind = recordKindOf(id);
|
|
799
|
+
const seg = id.split("/");
|
|
800
|
+
const verification = asRecord2(doc.verification);
|
|
801
|
+
const tests = [];
|
|
802
|
+
Object.keys(verification).forEach((key) => {
|
|
803
|
+
const m = key.match(/^(.+)_tests$/);
|
|
804
|
+
if (!m || !Array.isArray(verification[key])) return;
|
|
805
|
+
asArray(verification[key]).forEach((t) => {
|
|
806
|
+
tests.push({
|
|
807
|
+
kind: m[1],
|
|
808
|
+
id: asString(t.id),
|
|
809
|
+
proves: asArray(t.proves).map(String)
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
const provenBy = {};
|
|
814
|
+
tests.forEach(
|
|
815
|
+
(t) => t.proves.forEach((s) => {
|
|
816
|
+
(provenBy[s] = provenBy[s] || []).push(t);
|
|
817
|
+
})
|
|
818
|
+
);
|
|
819
|
+
const anchors = scan?.anchors?.[id] ?? [];
|
|
820
|
+
const anchorsAdopted = anyAnchorProves(scan);
|
|
821
|
+
const implementedByOf = {};
|
|
822
|
+
anchors.forEach((a) => {
|
|
823
|
+
(a.proves ?? []).forEach((sid) => {
|
|
824
|
+
(implementedByOf[sid] = implementedByOf[sid] || []).push(a);
|
|
825
|
+
});
|
|
826
|
+
});
|
|
827
|
+
const contract = asRecord2(doc.contract);
|
|
828
|
+
const scenarios = asArray(contract.scenarios).map((s) => {
|
|
829
|
+
const sid = asString(s.id);
|
|
830
|
+
const backingDoc = asRecord2(s.backing);
|
|
831
|
+
return {
|
|
832
|
+
id: sid,
|
|
833
|
+
steps: parseGherkin(asString(s.statement)),
|
|
834
|
+
pre: s.pre_state ?? null,
|
|
835
|
+
post: s.post_state ?? null,
|
|
836
|
+
proven: (provenBy[sid] || []).length > 0,
|
|
837
|
+
tests: provenBy[sid] || [],
|
|
838
|
+
backing: {
|
|
839
|
+
state: asString(backingDoc.state) === "unbacked" ? "unbacked" : "backed",
|
|
840
|
+
reason: asString(backingDoc.reason),
|
|
841
|
+
unblockedBy: asString(backingDoc.unblocked_by)
|
|
842
|
+
},
|
|
843
|
+
deviation: shapeDeviation(s.deviation),
|
|
844
|
+
audience: shapeAudience(s.audience),
|
|
845
|
+
implementedBy: implementedByOf[sid] || [],
|
|
846
|
+
anchorsAdopted
|
|
847
|
+
};
|
|
848
|
+
});
|
|
849
|
+
const defects = shapeDefects(doc.defects);
|
|
850
|
+
const obs = asRecord2(doc.observation);
|
|
851
|
+
const knowledgeDoc = asRecord2(doc.knowledge);
|
|
852
|
+
const lineage = asRecord2(doc.lineage);
|
|
853
|
+
const canonical = asRecord2(doc.canonical_schema);
|
|
854
|
+
const intent = asRecord2(doc.intent);
|
|
855
|
+
const owner = asRecord2(lineage.owner);
|
|
856
|
+
const variantsDoc = asRecord2(doc.variants);
|
|
857
|
+
const variantKeys = Object.keys(variantsDoc);
|
|
858
|
+
const variants = variantKeys.length ? Object.fromEntries(
|
|
859
|
+
variantKeys.map((key) => {
|
|
860
|
+
const v = asRecord2(variantsDoc[key]);
|
|
861
|
+
return [
|
|
862
|
+
key,
|
|
863
|
+
{
|
|
864
|
+
lifecycle: asString(v.lifecycle),
|
|
865
|
+
notes: v.notes == null ? void 0 : asString(v.notes)
|
|
866
|
+
}
|
|
867
|
+
];
|
|
868
|
+
})
|
|
869
|
+
) : null;
|
|
870
|
+
const activeAnywhere = variants ? Object.values(variants).some((v) => v.lifecycle === "active") : asString(doc.lifecycle) === "active";
|
|
871
|
+
const flags = asArray(doc.flags).map((f) => ({
|
|
872
|
+
key: asString(f.key),
|
|
873
|
+
system: f.system == null ? void 0 : asString(f.system),
|
|
874
|
+
default: typeof f.default === "boolean" ? f.default : void 0,
|
|
875
|
+
variants: asArray(f.variants).map(String),
|
|
876
|
+
rollout: f.rollout == null ? void 0 : asString(f.rollout),
|
|
877
|
+
retireBy: f.retire_by == null ? void 0 : asString(f.retire_by)
|
|
878
|
+
}));
|
|
879
|
+
const dashboards = asArray(obs.dashboards).map((d) => ({ url: asString(d.url) })).filter((d) => d.url);
|
|
880
|
+
const observabilityDoc = asRecord2(doc.observability);
|
|
881
|
+
const metricsEmitted = asArray(
|
|
882
|
+
observabilityDoc.metrics_emitted
|
|
883
|
+
).map((m) => ({
|
|
884
|
+
name: asString(m.name),
|
|
885
|
+
kind: asString(m.kind),
|
|
886
|
+
labels: asArray(m.labels).map(String),
|
|
887
|
+
description: m.description == null ? void 0 : asString(m.description)
|
|
888
|
+
}));
|
|
889
|
+
const tracesEmitted = asArray(
|
|
890
|
+
observabilityDoc.traces_emitted
|
|
891
|
+
).map((t) => ({
|
|
892
|
+
spanName: asString(t.span_name),
|
|
893
|
+
parentSpan: t.parent_span == null ? void 0 : asString(t.parent_span),
|
|
894
|
+
attributes: asArray(t.attributes).map(String)
|
|
895
|
+
}));
|
|
896
|
+
const logEvents = asArray(observabilityDoc.log_events).map(
|
|
897
|
+
(l) => ({
|
|
898
|
+
event: asString(l.event),
|
|
899
|
+
level: asString(l.level),
|
|
900
|
+
attributes: asArray(l.attributes).map(String)
|
|
901
|
+
})
|
|
902
|
+
);
|
|
903
|
+
const knowledge = Object.keys(knowledgeDoc).map((k) => {
|
|
904
|
+
const slot = asRecord2(knowledgeDoc[k]);
|
|
905
|
+
return {
|
|
906
|
+
key: k,
|
|
907
|
+
question: slot.question == null ? void 0 : String(slot.question),
|
|
908
|
+
answer: slot.answer == null ? void 0 : String(slot.answer),
|
|
909
|
+
derive: slot.derive_from == null ? void 0 : asArray(slot.derive_from).map(String)
|
|
910
|
+
};
|
|
911
|
+
});
|
|
912
|
+
const fields = asArray(canonical.fields);
|
|
913
|
+
return {
|
|
914
|
+
path: raw.path,
|
|
915
|
+
raw: raw.raw,
|
|
916
|
+
doc,
|
|
917
|
+
id,
|
|
918
|
+
kind,
|
|
919
|
+
seg,
|
|
920
|
+
domain: seg[0],
|
|
921
|
+
capability: seg[1] ?? "",
|
|
922
|
+
label: humanize(seg[seg.length - 1]),
|
|
923
|
+
lifecycle: asString(doc.lifecycle) || "\u2014",
|
|
924
|
+
variants,
|
|
925
|
+
activeAnywhere,
|
|
926
|
+
schemaVersion: asString(doc.schema_version) || "\u2014",
|
|
927
|
+
summary: (asString(intent.summary) || asString(doc.statement)).trim(),
|
|
928
|
+
adrs: asArray(intent.decision_records).map(String),
|
|
929
|
+
scenarios,
|
|
930
|
+
tests,
|
|
931
|
+
provenBy,
|
|
932
|
+
proven: scenarios.filter((s) => s.proven).length,
|
|
933
|
+
total: scenarios.length,
|
|
934
|
+
slos: asArray(obs.slos),
|
|
935
|
+
alerts: asArray(obs.alerts),
|
|
936
|
+
checks: asArray(obs.continuous_checks),
|
|
937
|
+
dashboards,
|
|
938
|
+
flags,
|
|
939
|
+
metricsEmitted,
|
|
940
|
+
tracesEmitted,
|
|
941
|
+
logEvents,
|
|
942
|
+
knowledge,
|
|
943
|
+
team: asString(owner.team),
|
|
944
|
+
individual: asString(owner.individual),
|
|
945
|
+
createdAt: asString(lineage.created_at) || asString(doc.created_at),
|
|
946
|
+
supersededBy: lineage.superseded_by ? String(lineage.superseded_by) : null,
|
|
947
|
+
dependsOn: asArray(lineage.depends_on).map(String),
|
|
948
|
+
dependedOnBy: asArray(lineage.depended_on_by).map(String),
|
|
949
|
+
relatedPolicies: asArray(lineage.related_policies).map(String),
|
|
950
|
+
relatedAssumptions: asArray(lineage.related_assumptions).map(String),
|
|
951
|
+
relatedEntities: asArray(lineage.related_data_entities).map(String),
|
|
952
|
+
changeRef: asString(lineage.change_history_ref),
|
|
953
|
+
clauses: asArray(contract.clauses),
|
|
954
|
+
scope: doc.scope ? asRecord2(doc.scope) : null,
|
|
955
|
+
complianceChecks: asArray(verification.compliance_checks),
|
|
956
|
+
artifacts: asArray(verification.audit_artifacts).map(String),
|
|
957
|
+
fields,
|
|
958
|
+
schemaNo: canonical.version,
|
|
959
|
+
retention: doc.retention ?? null,
|
|
960
|
+
readBy: asArray(doc.read_by).map(String),
|
|
961
|
+
mutatedBy: asArray(doc.mutated_by).map(String),
|
|
962
|
+
evidence: asArray(doc.evidence),
|
|
963
|
+
referencedBy: asArray(doc.referenced_by).map(String),
|
|
964
|
+
criticality: asString(doc.criticality),
|
|
965
|
+
risk: asString(doc.risk_if_false).trim(),
|
|
966
|
+
anchors,
|
|
967
|
+
defects,
|
|
968
|
+
present: {
|
|
969
|
+
intent: Boolean(doc.intent),
|
|
970
|
+
contract: Boolean(doc.contract) || Boolean(doc.statement) || fields.length > 0,
|
|
971
|
+
verification: Boolean(doc.verification) || asArray(doc.evidence).length > 0,
|
|
972
|
+
observation: Boolean(doc.observation),
|
|
973
|
+
knowledge: Boolean(doc.knowledge),
|
|
974
|
+
lineage: Boolean(doc.lineage),
|
|
975
|
+
anchors: anchors.length > 0
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// src/i18n/legacy/core/model.ts
|
|
981
|
+
var localized4 = {
|
|
982
|
+
text1: /MUSS|MÜSSEN|MUST/
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
// src/core/model.ts
|
|
986
|
+
var MONTH_MS = 2592e6;
|
|
987
|
+
function pct(part, total) {
|
|
988
|
+
return total ? Math.round(part / total * 100) : 0;
|
|
989
|
+
}
|
|
990
|
+
function formatNumber(n) {
|
|
991
|
+
return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
992
|
+
}
|
|
993
|
+
var RENDERED_PATHS = [
|
|
994
|
+
"id",
|
|
995
|
+
"schema_version",
|
|
996
|
+
"lifecycle",
|
|
997
|
+
"statement",
|
|
998
|
+
"criticality",
|
|
999
|
+
"last_reviewed_at",
|
|
1000
|
+
"risk_if_false",
|
|
1001
|
+
"intent.summary",
|
|
1002
|
+
"intent.decision_records[]",
|
|
1003
|
+
"intent.regulatory_basis[]",
|
|
1004
|
+
"contract.scenarios[].id",
|
|
1005
|
+
"contract.scenarios[].statement",
|
|
1006
|
+
"contract.scenarios[].pre_state.",
|
|
1007
|
+
"contract.scenarios[].post_state.",
|
|
1008
|
+
"contract.scenarios[].backing.state",
|
|
1009
|
+
"contract.scenarios[].backing.reason",
|
|
1010
|
+
"contract.scenarios[].backing.unblocked_by",
|
|
1011
|
+
"contract.scenarios[].deviation.reason",
|
|
1012
|
+
"contract.scenarios[].deviation.confirmed_by",
|
|
1013
|
+
"contract.scenarios[].deviation.tracked_as",
|
|
1014
|
+
"contract.scenarios[].audience",
|
|
1015
|
+
"contract.clauses[].id",
|
|
1016
|
+
"contract.clauses[].requirement",
|
|
1017
|
+
"canonical_schema.version",
|
|
1018
|
+
"canonical_schema.fields[].name",
|
|
1019
|
+
"canonical_schema.fields[].type",
|
|
1020
|
+
"canonical_schema.fields[].constraints",
|
|
1021
|
+
"canonical_schema.fields[].references",
|
|
1022
|
+
"canonical_schema.fields[].sensitivity",
|
|
1023
|
+
"retention.duration",
|
|
1024
|
+
"retention.policy",
|
|
1025
|
+
"read_by[]",
|
|
1026
|
+
"mutated_by[]",
|
|
1027
|
+
"referenced_by[]",
|
|
1028
|
+
"evidence[].date",
|
|
1029
|
+
"evidence[].kind",
|
|
1030
|
+
"evidence[].note",
|
|
1031
|
+
"verification.*_tests[].id",
|
|
1032
|
+
"verification.*_tests[].proves[]",
|
|
1033
|
+
"verification.compliance_checks[].id",
|
|
1034
|
+
"verification.compliance_checks[].last_established",
|
|
1035
|
+
"verification.compliance_checks[].frequency",
|
|
1036
|
+
"verification.compliance_checks[].next_due",
|
|
1037
|
+
"verification.audit_artifacts[]",
|
|
1038
|
+
"observation.slos[].name",
|
|
1039
|
+
"observation.slos[].target",
|
|
1040
|
+
"observation.slos[].window",
|
|
1041
|
+
"observation.slos[].query",
|
|
1042
|
+
"observation.slos[].query_source",
|
|
1043
|
+
"observation.alerts[].name",
|
|
1044
|
+
"observation.alerts[].condition",
|
|
1045
|
+
"observation.alerts[].severity",
|
|
1046
|
+
"observation.alerts[].runbook",
|
|
1047
|
+
"observation.continuous_checks[].id",
|
|
1048
|
+
"observation.continuous_checks[].frequency",
|
|
1049
|
+
"knowledge.*.question",
|
|
1050
|
+
"knowledge.*.answer",
|
|
1051
|
+
"knowledge.*.derive_from[]",
|
|
1052
|
+
"scope.domains[]",
|
|
1053
|
+
"scope.features[]",
|
|
1054
|
+
"lineage.owner.team",
|
|
1055
|
+
"lineage.owner.individual",
|
|
1056
|
+
"lineage.created_at",
|
|
1057
|
+
"lineage.superseded_by",
|
|
1058
|
+
"lineage.depends_on[]",
|
|
1059
|
+
"lineage.depended_on_by[]",
|
|
1060
|
+
"lineage.related_policies[]",
|
|
1061
|
+
"lineage.related_assumptions[]",
|
|
1062
|
+
"lineage.related_data_entities[]",
|
|
1063
|
+
"lineage.change_history_ref",
|
|
1064
|
+
"variants.*.lifecycle",
|
|
1065
|
+
"variants.*.notes",
|
|
1066
|
+
"flags[].key",
|
|
1067
|
+
"flags[].system",
|
|
1068
|
+
"flags[].rollout",
|
|
1069
|
+
"observation.dashboards[].url",
|
|
1070
|
+
"observability.metrics_emitted[].name",
|
|
1071
|
+
"observability.traces_emitted[].span_name",
|
|
1072
|
+
"observability.log_events[].event"
|
|
1073
|
+
];
|
|
1074
|
+
function isRenderedPath(path) {
|
|
1075
|
+
if (RENDERED_PATHS.includes(path)) return true;
|
|
1076
|
+
return RENDERED_PATHS.some((r) => r.endsWith(".") && path.startsWith(r));
|
|
1077
|
+
}
|
|
1078
|
+
function collectPaths(node, prefix, out) {
|
|
1079
|
+
if (node == null) return;
|
|
1080
|
+
if (Array.isArray(node)) {
|
|
1081
|
+
node.forEach((x) => collectPaths(x, `${prefix}[]`, out));
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
if (typeof node !== "object") {
|
|
1085
|
+
out[prefix] = (out[prefix] || 0) + 1;
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
Object.keys(node).forEach((k) => {
|
|
1089
|
+
let seg = k;
|
|
1090
|
+
if (prefix === "knowledge") seg = "*";
|
|
1091
|
+
else if (prefix === "variants") seg = "*";
|
|
1092
|
+
else if (prefix === "verification" && /_tests$/.test(k)) seg = "*_tests";
|
|
1093
|
+
collectPaths(node[k], prefix ? `${prefix}.${seg}` : seg, out);
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
var SEVERITY_RANK = { critical: 0, warning: 1, info: 2 };
|
|
1097
|
+
function pairKey(a, b) {
|
|
1098
|
+
return a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
1099
|
+
}
|
|
1100
|
+
function normalizeVocab(value) {
|
|
1101
|
+
return value.trim().toLowerCase();
|
|
1102
|
+
}
|
|
1103
|
+
function isNearDuplicate(a, b) {
|
|
1104
|
+
if (!a || !b || a === b) return false;
|
|
1105
|
+
return a.startsWith(b) || b.startsWith(a);
|
|
1106
|
+
}
|
|
1107
|
+
function buildVocabulary(entries) {
|
|
1108
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
1109
|
+
entries.forEach(({ value, recordId }) => {
|
|
1110
|
+
const bucket = byValue.get(value) ?? { count: 0, recordIds: /* @__PURE__ */ new Set() };
|
|
1111
|
+
bucket.count += 1;
|
|
1112
|
+
bucket.recordIds.add(recordId);
|
|
1113
|
+
byValue.set(value, bucket);
|
|
1114
|
+
});
|
|
1115
|
+
const values = Array.from(byValue.entries()).map(([value, bucket]) => ({
|
|
1116
|
+
value,
|
|
1117
|
+
count: bucket.count,
|
|
1118
|
+
recordIds: Array.from(bucket.recordIds).sort()
|
|
1119
|
+
})).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
|
|
1120
|
+
const parent = /* @__PURE__ */ new Map();
|
|
1121
|
+
values.forEach((v) => parent.set(v.value, v.value));
|
|
1122
|
+
const find = (x) => {
|
|
1123
|
+
let root = x;
|
|
1124
|
+
while (parent.get(root) !== root) root = parent.get(root);
|
|
1125
|
+
return root;
|
|
1126
|
+
};
|
|
1127
|
+
const union = (a, b) => {
|
|
1128
|
+
const ra = find(a);
|
|
1129
|
+
const rb = find(b);
|
|
1130
|
+
if (ra !== rb) parent.set(ra, rb);
|
|
1131
|
+
};
|
|
1132
|
+
for (let i = 0; i < values.length; i += 1) {
|
|
1133
|
+
for (let j = i + 1; j < values.length; j += 1) {
|
|
1134
|
+
if (isNearDuplicate(normalizeVocab(values[i].value), normalizeVocab(values[j].value))) {
|
|
1135
|
+
union(values[i].value, values[j].value);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
1140
|
+
values.forEach((v) => {
|
|
1141
|
+
const root = find(v.value);
|
|
1142
|
+
const bucket = grouped.get(root) ?? [];
|
|
1143
|
+
bucket.push(v);
|
|
1144
|
+
grouped.set(root, bucket);
|
|
1145
|
+
});
|
|
1146
|
+
return Array.from(grouped.values()).map((groupValues) => {
|
|
1147
|
+
const sorted = [...groupValues].sort(
|
|
1148
|
+
(a, b) => b.count - a.count || a.value.localeCompare(b.value)
|
|
1149
|
+
);
|
|
1150
|
+
const recordIds = Array.from(new Set(sorted.flatMap((v) => v.recordIds))).sort();
|
|
1151
|
+
return {
|
|
1152
|
+
key: normalizeVocab(sorted[0].value),
|
|
1153
|
+
values: sorted,
|
|
1154
|
+
count: sorted.reduce((sum, v) => sum + v.count, 0),
|
|
1155
|
+
recordIds,
|
|
1156
|
+
merged: sorted.length > 1
|
|
1157
|
+
};
|
|
1158
|
+
}).sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
|
|
1159
|
+
}
|
|
1160
|
+
var ENUM_PREFIX = /^(enum|values|csv|variant)\s*:\s*(.*)$/i;
|
|
1161
|
+
function parseEnumConstraint(text) {
|
|
1162
|
+
const trimmed = String(text ?? "").trim();
|
|
1163
|
+
if (!trimmed) return null;
|
|
1164
|
+
const match = trimmed.match(ENUM_PREFIX);
|
|
1165
|
+
if (!match) return null;
|
|
1166
|
+
let body = match[2].trim();
|
|
1167
|
+
if (body.startsWith("[") && body.endsWith("]")) {
|
|
1168
|
+
body = body.slice(1, -1).trim();
|
|
1169
|
+
}
|
|
1170
|
+
if (!body) return null;
|
|
1171
|
+
const separator = body.includes("|") ? "|" : ",";
|
|
1172
|
+
const values = body.split(separator).map(
|
|
1173
|
+
(v) => v.trim().replace(/^["']|["']$/g, "").trim()
|
|
1174
|
+
).filter(Boolean);
|
|
1175
|
+
return values.length ? values : null;
|
|
1176
|
+
}
|
|
1177
|
+
function collectEnumConstraints(entities) {
|
|
1178
|
+
const out = [];
|
|
1179
|
+
entities.forEach((entity) => {
|
|
1180
|
+
entity.fields.forEach((field) => {
|
|
1181
|
+
const name = field.name == null ? "" : String(field.name);
|
|
1182
|
+
if (!name) return;
|
|
1183
|
+
const raw = field.constraints;
|
|
1184
|
+
const texts = Array.isArray(raw) ? raw.map((v) => String(v)) : raw == null || raw === "" ? [] : [String(raw)];
|
|
1185
|
+
for (const text of texts) {
|
|
1186
|
+
const values = parseEnumConstraint(text);
|
|
1187
|
+
if (values) {
|
|
1188
|
+
out.push({ entity: entity.id, field: name, values });
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
});
|
|
1194
|
+
return out;
|
|
1195
|
+
}
|
|
1196
|
+
function enumValueSetKey(values) {
|
|
1197
|
+
return Array.from(new Set(values)).sort().join("|");
|
|
1198
|
+
}
|
|
1199
|
+
function buildEnumRegister(entities) {
|
|
1200
|
+
const raw = collectEnumConstraints(entities);
|
|
1201
|
+
const byField = /* @__PURE__ */ new Map();
|
|
1202
|
+
raw.forEach(({ entity, field, values }) => {
|
|
1203
|
+
const setsForField = byField.get(field) ?? /* @__PURE__ */ new Map();
|
|
1204
|
+
byField.set(field, setsForField);
|
|
1205
|
+
const setKey = `${field}::${enumValueSetKey(values)}`;
|
|
1206
|
+
const existing = setsForField.get(setKey);
|
|
1207
|
+
if (existing) {
|
|
1208
|
+
if (!existing.entities.includes(entity)) existing.entities.push(entity);
|
|
1209
|
+
} else {
|
|
1210
|
+
setsForField.set(setKey, { key: setKey, values, entities: [entity] });
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
const entries = Array.from(byField.entries()).map(([field, sets]) => {
|
|
1214
|
+
const valueSets = Array.from(sets.values());
|
|
1215
|
+
return { field, valueSets, divergent: valueSets.length > 1 };
|
|
1216
|
+
}).sort((a, b) => a.field.localeCompare(b.field));
|
|
1217
|
+
return {
|
|
1218
|
+
entries,
|
|
1219
|
+
fieldCount: entries.length,
|
|
1220
|
+
divergentFieldCount: entries.filter((entry) => entry.divergent).length
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
function buildModel(rc, paths, raws, scan = {}, corpusErrors = [], taxonomy = null, calibration = null, glossary = null) {
|
|
1224
|
+
const recs = raws.map((r) => shapeRecord(r, scan));
|
|
1225
|
+
const byId = {};
|
|
1226
|
+
recs.forEach((r) => byId[r.id] = r);
|
|
1227
|
+
const features = recs.filter((r) => r.kind === "feature");
|
|
1228
|
+
const policies = recs.filter((r) => r.kind === "policy");
|
|
1229
|
+
const assumptions = recs.filter((r) => r.kind === "assumption");
|
|
1230
|
+
const entities = recs.filter((r) => r.kind === "entity");
|
|
1231
|
+
const domains = [];
|
|
1232
|
+
const dmap = {};
|
|
1233
|
+
features.forEach((f) => {
|
|
1234
|
+
if (!dmap[f.domain]) {
|
|
1235
|
+
dmap[f.domain] = { name: f.domain, items: [] };
|
|
1236
|
+
domains.push(dmap[f.domain]);
|
|
1237
|
+
}
|
|
1238
|
+
dmap[f.domain].items.push(f);
|
|
1239
|
+
});
|
|
1240
|
+
let scnTotal = 0;
|
|
1241
|
+
let scnProven = 0;
|
|
1242
|
+
const allScn = [];
|
|
1243
|
+
for (const f of features) {
|
|
1244
|
+
for (const s of f.scenarios) {
|
|
1245
|
+
scnTotal++;
|
|
1246
|
+
if (s.proven) scnProven++;
|
|
1247
|
+
allScn.push({ ...s, rec: f });
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
const testKinds = {};
|
|
1251
|
+
features.forEach(
|
|
1252
|
+
(f) => f.tests.forEach((t) => testKinds[t.kind] = (testKinds[t.kind] || 0) + 1)
|
|
1253
|
+
);
|
|
1254
|
+
const domainCov = domains.map((d) => {
|
|
1255
|
+
const total = d.items.reduce((n, f) => n + f.total, 0);
|
|
1256
|
+
const proven = d.items.reduce((n, f) => n + f.proven, 0);
|
|
1257
|
+
return {
|
|
1258
|
+
name: d.name,
|
|
1259
|
+
total,
|
|
1260
|
+
proven,
|
|
1261
|
+
pct: total ? Math.round(proven / total * 100) : null,
|
|
1262
|
+
tests: d.items.reduce((n, f) => n + f.tests.length, 0)
|
|
1263
|
+
};
|
|
1264
|
+
});
|
|
1265
|
+
const usage = {};
|
|
1266
|
+
raws.forEach((r) => collectPaths(r.doc, "", usage));
|
|
1267
|
+
const fieldPaths = Object.keys(usage).sort().map((p) => ({ path: p, n: usage[p], rendered: isRenderedPath(p) }));
|
|
1268
|
+
const notRendered = fieldPaths.filter((p) => !p.rendered);
|
|
1269
|
+
const slos = recs.flatMap((r) => r.slos.map((s) => ({ ...s, rec: r })));
|
|
1270
|
+
const alerts = recs.flatMap((r) => r.alerts.map((a) => ({ ...a, rec: r })));
|
|
1271
|
+
const checks = recs.flatMap((r) => r.checks.map((c) => ({ ...c, rec: r })));
|
|
1272
|
+
alerts.sort((a, b) => {
|
|
1273
|
+
const ra = SEVERITY_RANK[String(a.severity)] ?? 3;
|
|
1274
|
+
const rb = SEVERITY_RANK[String(b.severity)] ?? 3;
|
|
1275
|
+
return ra - rb;
|
|
1276
|
+
});
|
|
1277
|
+
const edges = [];
|
|
1278
|
+
const seen = {};
|
|
1279
|
+
const ghosts = {};
|
|
1280
|
+
const addEdge = (from, to) => {
|
|
1281
|
+
if (!from || !to || from === to) return;
|
|
1282
|
+
const k = `${from}>${to}`;
|
|
1283
|
+
if (seen[k]) return;
|
|
1284
|
+
seen[k] = true;
|
|
1285
|
+
if (!byId[from]) ghosts[from] = true;
|
|
1286
|
+
if (!byId[to]) ghosts[to] = true;
|
|
1287
|
+
edges.push({ from, to });
|
|
1288
|
+
};
|
|
1289
|
+
recs.forEach((r) => {
|
|
1290
|
+
r.dependsOn.forEach((d) => addEdge(d, r.id));
|
|
1291
|
+
r.dependedOnBy.forEach((d) => addEdge(r.id, d));
|
|
1292
|
+
});
|
|
1293
|
+
const declaredPairs = /* @__PURE__ */ new Set();
|
|
1294
|
+
edges.forEach((edge) => declaredPairs.add(pairKey(edge.from, edge.to)));
|
|
1295
|
+
const undeclaredMentions = [];
|
|
1296
|
+
const knownIds = recs.map((r) => r.id);
|
|
1297
|
+
recs.forEach((record) => {
|
|
1298
|
+
const text = [
|
|
1299
|
+
record.summary,
|
|
1300
|
+
...record.scenarios.flatMap((s) => s.steps.map((step) => step.text))
|
|
1301
|
+
].join("\n").trim();
|
|
1302
|
+
if (!text) return;
|
|
1303
|
+
knownIds.forEach((otherId) => {
|
|
1304
|
+
if (otherId === record.id) return;
|
|
1305
|
+
if (!text.includes(otherId)) return;
|
|
1306
|
+
if (declaredPairs.has(pairKey(record.id, otherId))) return;
|
|
1307
|
+
undeclaredMentions.push({ from: record.id, to: otherId });
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
const ids = recs.map((r) => r.id).concat(Object.keys(ghosts));
|
|
1311
|
+
const depth = {};
|
|
1312
|
+
const deg = {};
|
|
1313
|
+
const outgoing = {};
|
|
1314
|
+
ids.forEach((i) => {
|
|
1315
|
+
depth[i] = 0;
|
|
1316
|
+
deg[i] = { up: 0, down: 0 };
|
|
1317
|
+
outgoing[i] = [];
|
|
1318
|
+
});
|
|
1319
|
+
edges.forEach((e) => {
|
|
1320
|
+
deg[e.to].up++;
|
|
1321
|
+
deg[e.from].down++;
|
|
1322
|
+
outgoing[e.from].push(e.to);
|
|
1323
|
+
});
|
|
1324
|
+
const remaining = {};
|
|
1325
|
+
ids.forEach((i) => remaining[i] = deg[i].up);
|
|
1326
|
+
const queue = ids.filter((i) => remaining[i] === 0);
|
|
1327
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
1328
|
+
for (let cursor = 0; cursor < queue.length; cursor += 1) {
|
|
1329
|
+
const id = queue[cursor];
|
|
1330
|
+
resolved.add(id);
|
|
1331
|
+
outgoing[id].forEach((next) => {
|
|
1332
|
+
if (depth[next] < depth[id] + 1) depth[next] = depth[id] + 1;
|
|
1333
|
+
remaining[next] -= 1;
|
|
1334
|
+
if (remaining[next] === 0) queue.push(next);
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
const cyclic = ids.filter((i) => !resolved.has(i));
|
|
1338
|
+
if (cyclic.length) {
|
|
1339
|
+
const resolvedMax = ids.reduce((mx, i) => resolved.has(i) ? Math.max(mx, depth[i]) : mx, -1);
|
|
1340
|
+
cyclic.forEach((i) => depth[i] = resolvedMax + 1);
|
|
1341
|
+
}
|
|
1342
|
+
const maxDepth = ids.reduce((mx, i) => Math.max(mx, depth[i]), 0);
|
|
1343
|
+
const today = new Date(scan.scannedAt ?? Date.now());
|
|
1344
|
+
let overdue = 0;
|
|
1345
|
+
const overdueList = [];
|
|
1346
|
+
policies.forEach(
|
|
1347
|
+
(p) => p.complianceChecks.forEach((c) => {
|
|
1348
|
+
c.overdue = c.next_due ? new Date(String(c.next_due)) < today : false;
|
|
1349
|
+
if (c.overdue) {
|
|
1350
|
+
overdue++;
|
|
1351
|
+
overdueList.push({ rec: p, check: c });
|
|
1352
|
+
}
|
|
1353
|
+
})
|
|
1354
|
+
);
|
|
1355
|
+
let stale = 0;
|
|
1356
|
+
assumptions.forEach((a) => {
|
|
1357
|
+
const reviewed = a.doc.last_reviewed_at ? new Date(String(a.doc.last_reviewed_at)) : null;
|
|
1358
|
+
a.ageMonths = reviewed ? Math.round((today.getTime() - reviewed.getTime()) / MONTH_MS) : null;
|
|
1359
|
+
a.stale = a.ageMonths != null && a.ageMonths > 12;
|
|
1360
|
+
if (a.stale) stale++;
|
|
1361
|
+
});
|
|
1362
|
+
let pii = 0;
|
|
1363
|
+
let enc = 0;
|
|
1364
|
+
entities.forEach(
|
|
1365
|
+
(e) => e.fields.forEach((f) => {
|
|
1366
|
+
if (f.sensitivity === "pii") pii++;
|
|
1367
|
+
if (f.sensitivity === "encrypted") enc++;
|
|
1368
|
+
})
|
|
1369
|
+
);
|
|
1370
|
+
let clauseCount = 0;
|
|
1371
|
+
let mustCount = 0;
|
|
1372
|
+
policies.forEach(
|
|
1373
|
+
(p) => p.clauses.forEach((c) => {
|
|
1374
|
+
clauseCount++;
|
|
1375
|
+
if (localized4.text1.test(String(c.requirement))) mustCount++;
|
|
1376
|
+
})
|
|
1377
|
+
);
|
|
1378
|
+
const basis = {};
|
|
1379
|
+
policies.forEach((p) => {
|
|
1380
|
+
const intent = asRecord2(p.doc.intent);
|
|
1381
|
+
asArray(intent.regulatory_basis).forEach((b) => {
|
|
1382
|
+
basis[String(b).split(/\s+(Art|§)|\s+\d/)[0].trim()] = true;
|
|
1383
|
+
});
|
|
1384
|
+
});
|
|
1385
|
+
const lifecycles = {};
|
|
1386
|
+
const teams = {};
|
|
1387
|
+
const versions = {};
|
|
1388
|
+
const created = [];
|
|
1389
|
+
recs.forEach((r) => {
|
|
1390
|
+
lifecycles[r.lifecycle] = (lifecycles[r.lifecycle] || 0) + 1;
|
|
1391
|
+
if (r.team) {
|
|
1392
|
+
teams[r.team] = teams[r.team] || { items: [], contact: r.individual };
|
|
1393
|
+
teams[r.team].items.push(r);
|
|
1394
|
+
}
|
|
1395
|
+
versions[r.schemaVersion] = (versions[r.schemaVersion] || 0) + 1;
|
|
1396
|
+
if (r.createdAt) created.push({ date: r.createdAt, id: r.id });
|
|
1397
|
+
});
|
|
1398
|
+
created.sort((a, b) => a.date < b.date ? 1 : -1);
|
|
1399
|
+
const noRunbook = alerts.filter((a) => !a.runbook).length;
|
|
1400
|
+
const sources = {};
|
|
1401
|
+
slos.forEach((s) => {
|
|
1402
|
+
if (s.query_source) sources[String(s.query_source)] = true;
|
|
1403
|
+
});
|
|
1404
|
+
const alertSeverities = buildVocabulary(
|
|
1405
|
+
alerts.map((a) => ({ value: asString(a.severity), recordId: a.rec.id }))
|
|
1406
|
+
);
|
|
1407
|
+
const sloSourceEntries = slos.map((s) => ({
|
|
1408
|
+
value: asString(s.query_source),
|
|
1409
|
+
recordId: s.rec.id
|
|
1410
|
+
}));
|
|
1411
|
+
const sloMissingEntries = sloSourceEntries.filter((e) => e.value === "");
|
|
1412
|
+
const sloSourceCoverage = {
|
|
1413
|
+
present: buildVocabulary(sloSourceEntries.filter((e) => e.value !== "")),
|
|
1414
|
+
missing: {
|
|
1415
|
+
count: sloMissingEntries.length,
|
|
1416
|
+
recordIds: Array.from(new Set(sloMissingEntries.map((e) => e.recordId))).sort()
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
const retentionSpellings = buildVocabulary(
|
|
1420
|
+
entities.map((e) => ({ value: asString(asRecord2(e.retention).duration), recordId: e.id })).filter((entry) => entry.value !== "")
|
|
1421
|
+
);
|
|
1422
|
+
const anchorMap = scan.anchors ?? {};
|
|
1423
|
+
const anchorPairs = Object.keys(anchorMap).flatMap(
|
|
1424
|
+
(id) => anchorMap[id].map((a) => ({ ...a, id }))
|
|
1425
|
+
);
|
|
1426
|
+
const driftIds = {};
|
|
1427
|
+
(scan.drift ?? []).forEach((d) => driftIds[d.id] = [...driftIds[d.id] ?? [], d]);
|
|
1428
|
+
const unanchored = features.filter((f) => f.activeAnywhere && !(anchorMap[f.id] ?? []).length);
|
|
1429
|
+
const noIntent = recs.filter((r) => !r.summary);
|
|
1430
|
+
const knowSlots = features.reduce((n, f) => n + f.knowledge.length, 0);
|
|
1431
|
+
const knowAnswered = features.reduce((n, f) => n + f.knowledge.filter((s) => s.answer).length, 0);
|
|
1432
|
+
const decisionTargetEntries = /* @__PURE__ */ new Map();
|
|
1433
|
+
features.forEach((f) => {
|
|
1434
|
+
f.adrs.forEach((target) => {
|
|
1435
|
+
const entry = decisionTargetEntries.get(target) ?? { count: 0, recordIds: [] };
|
|
1436
|
+
entry.count += 1;
|
|
1437
|
+
entry.recordIds.push(f.id);
|
|
1438
|
+
decisionTargetEntries.set(target, entry);
|
|
1439
|
+
});
|
|
1440
|
+
});
|
|
1441
|
+
const decisionTargets = Array.from(decisionTargetEntries.entries()).map(([target, entry]) => ({ target, count: entry.count, recordIds: entry.recordIds })).sort((a, b) => b.count - a.count || a.target.localeCompare(b.target));
|
|
1442
|
+
const noKnowledge = features.filter((f) => f.activeAnywhere && !f.present.knowledge);
|
|
1443
|
+
const noOwner = recs.filter((r) => !r.team);
|
|
1444
|
+
const superseded = recs.filter((r) => r.supersededBy);
|
|
1445
|
+
const complete = features.filter(
|
|
1446
|
+
(f) => f.total > 0 && f.proven === f.total && (anchorMap[f.id] ?? []).length > 0 && f.activeAnywhere
|
|
1447
|
+
);
|
|
1448
|
+
const noObs = features.filter((f) => f.activeAnywhere && !f.slos.length && !f.alerts.length);
|
|
1449
|
+
const uncovered = features.filter((f) => !policies.some((p) => coverage(p, f)));
|
|
1450
|
+
const defectRecords = recs.filter((r) => r.defects.present);
|
|
1451
|
+
const defectTotal = defectRecords.reduce((n, r) => n + r.defects.total, 0);
|
|
1452
|
+
const defectsUnproven = defectRecords.filter((r) => r.defects.total > 0 && r.proven === 0);
|
|
1453
|
+
const errorCodeRegister = buildErrorCodeRegister(recs);
|
|
1454
|
+
const enumRegister = buildEnumRegister(entities);
|
|
1455
|
+
return {
|
|
1456
|
+
glossary,
|
|
1457
|
+
taxonomy,
|
|
1458
|
+
taxonomyTree: taxonomyTree(
|
|
1459
|
+
taxonomy,
|
|
1460
|
+
features.map((f) => f.id)
|
|
1461
|
+
),
|
|
1462
|
+
calibration,
|
|
1463
|
+
rc,
|
|
1464
|
+
paths,
|
|
1465
|
+
recs,
|
|
1466
|
+
byId,
|
|
1467
|
+
features,
|
|
1468
|
+
policies,
|
|
1469
|
+
assumptions,
|
|
1470
|
+
entities,
|
|
1471
|
+
domains,
|
|
1472
|
+
scnTotal,
|
|
1473
|
+
scnProven,
|
|
1474
|
+
allScn,
|
|
1475
|
+
testKinds,
|
|
1476
|
+
domainCov,
|
|
1477
|
+
fieldPaths,
|
|
1478
|
+
notRendered,
|
|
1479
|
+
slos,
|
|
1480
|
+
alerts,
|
|
1481
|
+
checks,
|
|
1482
|
+
noRunbook,
|
|
1483
|
+
sources: Object.keys(sources),
|
|
1484
|
+
edges,
|
|
1485
|
+
undeclaredMentions,
|
|
1486
|
+
ghosts: Object.keys(ghosts),
|
|
1487
|
+
depth,
|
|
1488
|
+
deg,
|
|
1489
|
+
maxDepth,
|
|
1490
|
+
cyclic,
|
|
1491
|
+
overdue,
|
|
1492
|
+
overdueList,
|
|
1493
|
+
stale,
|
|
1494
|
+
pii,
|
|
1495
|
+
enc,
|
|
1496
|
+
clauseCount,
|
|
1497
|
+
mustCount,
|
|
1498
|
+
basis: Object.keys(basis),
|
|
1499
|
+
lifecycles,
|
|
1500
|
+
teams,
|
|
1501
|
+
versions,
|
|
1502
|
+
created,
|
|
1503
|
+
scan,
|
|
1504
|
+
anchorMap,
|
|
1505
|
+
anchorPairs,
|
|
1506
|
+
driftIds,
|
|
1507
|
+
unanchored,
|
|
1508
|
+
noIntent,
|
|
1509
|
+
knowSlots,
|
|
1510
|
+
knowAnswered,
|
|
1511
|
+
noKnowledge,
|
|
1512
|
+
noOwner,
|
|
1513
|
+
superseded,
|
|
1514
|
+
complete,
|
|
1515
|
+
noObs,
|
|
1516
|
+
uncovered,
|
|
1517
|
+
defectTotal,
|
|
1518
|
+
defectRecords,
|
|
1519
|
+
defectsUnproven,
|
|
1520
|
+
decisionTargets,
|
|
1521
|
+
errorCodeRegister,
|
|
1522
|
+
alertSeverities,
|
|
1523
|
+
sloSourceCoverage,
|
|
1524
|
+
retentionSpellings,
|
|
1525
|
+
enumRegister,
|
|
1526
|
+
corpusErrors
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
var DEFAULT_ERROR_CODE_PATTERN = /E\d{4}/g;
|
|
1530
|
+
function errorCodeBand(code) {
|
|
1531
|
+
const m = code.match(/^(\D*)(\d)(\d*)$/);
|
|
1532
|
+
if (!m) return code;
|
|
1533
|
+
const [, prefix, digit, rest] = m;
|
|
1534
|
+
return `${prefix}${digit}${"x".repeat(rest.length)}`;
|
|
1535
|
+
}
|
|
1536
|
+
function errorCodeTextFields(record) {
|
|
1537
|
+
const fields = [];
|
|
1538
|
+
if (record.summary) fields.push(record.summary);
|
|
1539
|
+
record.scenarios.forEach((scenario) => {
|
|
1540
|
+
const text = scenario.steps.map((step) => step.text).join(" ").trim();
|
|
1541
|
+
if (text) fields.push(text);
|
|
1542
|
+
});
|
|
1543
|
+
record.knowledge.forEach((slot) => {
|
|
1544
|
+
if (slot.key === "common_pitfalls" && slot.answer) fields.push(slot.answer);
|
|
1545
|
+
});
|
|
1546
|
+
return fields;
|
|
1547
|
+
}
|
|
1548
|
+
function extractErrorCodes(recs, pattern = DEFAULT_ERROR_CODE_PATTERN) {
|
|
1549
|
+
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
1550
|
+
const re = new RegExp(pattern.source, flags);
|
|
1551
|
+
const byCode = /* @__PURE__ */ new Map();
|
|
1552
|
+
recs.forEach((record) => {
|
|
1553
|
+
errorCodeTextFields(record).forEach((text) => {
|
|
1554
|
+
re.lastIndex = 0;
|
|
1555
|
+
let match;
|
|
1556
|
+
while (match = re.exec(text)) {
|
|
1557
|
+
const code = match[0];
|
|
1558
|
+
if (!byCode.has(code)) byCode.set(code, /* @__PURE__ */ new Map());
|
|
1559
|
+
const perRecord = byCode.get(code);
|
|
1560
|
+
if (!perRecord.has(record.id)) perRecord.set(record.id, text.trim());
|
|
1561
|
+
if (match.index === re.lastIndex) re.lastIndex += 1;
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
});
|
|
1565
|
+
return [...byCode.entries()].map(([code, perRecord]) => {
|
|
1566
|
+
const records = [...perRecord.entries()].map(([id, statement]) => ({ id, statement })).sort((a, b) => a.id.localeCompare(b.id));
|
|
1567
|
+
return { code, band: errorCodeBand(code), records };
|
|
1568
|
+
}).sort(
|
|
1569
|
+
(a, b) => a.band === b.band ? a.code.localeCompare(b.code) : a.band.localeCompare(b.band)
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
function nextFreeInBand(codes) {
|
|
1573
|
+
if (!codes.length) return null;
|
|
1574
|
+
const sample = codes[0].match(/^(\D*)(\d+)$/);
|
|
1575
|
+
if (!sample) return null;
|
|
1576
|
+
const [, prefix, digits] = sample;
|
|
1577
|
+
const width = digits.length;
|
|
1578
|
+
const restWidth = width - 1;
|
|
1579
|
+
const base = Number(digits[0]) * 10 ** restWidth;
|
|
1580
|
+
const max = base + 10 ** restWidth - 1;
|
|
1581
|
+
const used = new Set(codes.map((code) => Number(code.slice(prefix.length))));
|
|
1582
|
+
for (let n = base; n <= max; n += 1) {
|
|
1583
|
+
if (!used.has(n)) return `${prefix}${String(n).padStart(width, "0")}`;
|
|
1584
|
+
}
|
|
1585
|
+
return null;
|
|
1586
|
+
}
|
|
1587
|
+
function buildErrorCodeRegister(recs, pattern = DEFAULT_ERROR_CODE_PATTERN) {
|
|
1588
|
+
const entries = extractErrorCodes(recs, pattern);
|
|
1589
|
+
const byBand = /* @__PURE__ */ new Map();
|
|
1590
|
+
entries.forEach((entry) => {
|
|
1591
|
+
const list = byBand.get(entry.band) ?? [];
|
|
1592
|
+
list.push(entry);
|
|
1593
|
+
byBand.set(entry.band, list);
|
|
1594
|
+
});
|
|
1595
|
+
const bands = [...byBand.entries()].map(([band, codes]) => ({
|
|
1596
|
+
band,
|
|
1597
|
+
codes,
|
|
1598
|
+
nextFree: nextFreeInBand(codes.map((entry) => entry.code))
|
|
1599
|
+
})).sort((a, b) => a.band.localeCompare(b.band));
|
|
1600
|
+
return {
|
|
1601
|
+
pattern: pattern.source,
|
|
1602
|
+
entries,
|
|
1603
|
+
bands,
|
|
1604
|
+
collisions: entries.filter((entry) => entry.records.length > 1).map((entry) => entry.code)
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
function coverage(policy, feature) {
|
|
1608
|
+
const scope = asRecord2(policy.scope);
|
|
1609
|
+
if (asArray(scope.features).map(String).includes(feature.id)) return "direct";
|
|
1610
|
+
if (feature.relatedPolicies.includes(policy.id)) return "direct";
|
|
1611
|
+
if (asArray(scope.domains).map(String).includes(feature.domain)) return "area";
|
|
1612
|
+
return null;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
// src/core/glossary.ts
|
|
1616
|
+
function asRecord3(value) {
|
|
1617
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1618
|
+
}
|
|
1619
|
+
function asText2(value) {
|
|
1620
|
+
return typeof value === "string" ? value.trim() : "";
|
|
1621
|
+
}
|
|
1622
|
+
function asRenderings(value) {
|
|
1623
|
+
const doc = asRecord3(value);
|
|
1624
|
+
const out = {};
|
|
1625
|
+
Object.keys(doc).forEach((locale) => {
|
|
1626
|
+
const rendering = asText2(doc[locale]);
|
|
1627
|
+
if (rendering) out[locale] = rendering;
|
|
1628
|
+
});
|
|
1629
|
+
return out;
|
|
1630
|
+
}
|
|
1631
|
+
function parseGlossary(text) {
|
|
1632
|
+
if (!text || !text.trim()) return null;
|
|
1633
|
+
let doc;
|
|
1634
|
+
try {
|
|
1635
|
+
doc = asRecord3(parseYaml(text));
|
|
1636
|
+
} catch (error) {
|
|
1637
|
+
if (!(error instanceof YamlError)) throw error;
|
|
1638
|
+
return null;
|
|
1639
|
+
}
|
|
1640
|
+
const raw = Array.isArray(doc.terms) ? doc.terms : [];
|
|
1641
|
+
const terms = [];
|
|
1642
|
+
raw.forEach((entry) => {
|
|
1643
|
+
const item = asRecord3(entry);
|
|
1644
|
+
const term = asText2(item.term);
|
|
1645
|
+
const definition = asText2(item.definition);
|
|
1646
|
+
if (!term || !definition) return;
|
|
1647
|
+
terms.push({ term, definition, renderings: asRenderings(item.renderings) });
|
|
1648
|
+
});
|
|
1649
|
+
return terms.length > 0 ? { schemaVersion: asText2(doc.schema_version), terms } : null;
|
|
1650
|
+
}
|
|
1651
|
+
function byLengthDescending(terms) {
|
|
1652
|
+
return [...terms].sort(
|
|
1653
|
+
(a, b) => a.length !== b.length ? b.length - a.length : a.localeCompare(b)
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1656
|
+
function glossaryTermList(glossary) {
|
|
1657
|
+
if (!glossary) return [];
|
|
1658
|
+
return byLengthDescending(glossary.terms.map((entry) => entry.term));
|
|
1659
|
+
}
|
|
1660
|
+
function lookupTerm(glossary, term) {
|
|
1661
|
+
if (!glossary) return null;
|
|
1662
|
+
return glossary.terms.find((entry) => entry.term === term) ?? null;
|
|
1663
|
+
}
|
|
1664
|
+
var WORD_CHAR = /[\p{L}\p{N}_]/u;
|
|
1665
|
+
function isWordChar(text, index) {
|
|
1666
|
+
if (index < 0 || index >= text.length) return false;
|
|
1667
|
+
return WORD_CHAR.test(text[index]);
|
|
1668
|
+
}
|
|
1669
|
+
function linkTerms(text, terms) {
|
|
1670
|
+
if (!text) return [];
|
|
1671
|
+
if (terms.length === 0) return [{ kind: "text", text }];
|
|
1672
|
+
const candidates = byLengthDescending(terms);
|
|
1673
|
+
const out = [];
|
|
1674
|
+
let plain = "";
|
|
1675
|
+
let i = 0;
|
|
1676
|
+
const flush = () => {
|
|
1677
|
+
if (plain) {
|
|
1678
|
+
out.push({ kind: "text", text: plain });
|
|
1679
|
+
plain = "";
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
while (i < text.length) {
|
|
1683
|
+
if (!isWordChar(text, i) || isWordChar(text, i - 1)) {
|
|
1684
|
+
plain += text[i];
|
|
1685
|
+
i++;
|
|
1686
|
+
continue;
|
|
1687
|
+
}
|
|
1688
|
+
const hit = candidates.find(
|
|
1689
|
+
(term) => text.startsWith(term, i) && !isWordChar(text, i + term.length)
|
|
1690
|
+
);
|
|
1691
|
+
if (!hit) {
|
|
1692
|
+
plain += text[i];
|
|
1693
|
+
i++;
|
|
1694
|
+
continue;
|
|
1695
|
+
}
|
|
1696
|
+
flush();
|
|
1697
|
+
out.push({ kind: "term", text: hit, term: hit });
|
|
1698
|
+
i += hit.length;
|
|
1699
|
+
}
|
|
1700
|
+
flush();
|
|
1701
|
+
return out;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
// src/i18n/legacy/core/corpus.ts
|
|
1705
|
+
var localized5 = {
|
|
1706
|
+
text1: "Datei fehlt im Korpus"
|
|
1707
|
+
};
|
|
1708
|
+
|
|
1709
|
+
// src/core/corpus.ts
|
|
1710
|
+
function normaliseCalibration(value) {
|
|
1711
|
+
if (!value) return null;
|
|
1712
|
+
return {
|
|
1713
|
+
...value,
|
|
1714
|
+
metrics: Array.isArray(value.metrics) ? value.metrics : [],
|
|
1715
|
+
readings: Array.isArray(value.readings) ? value.readings : []
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
function asRecord4(value) {
|
|
1719
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1720
|
+
}
|
|
1721
|
+
function loadCorpus(source) {
|
|
1722
|
+
const rc = asRecord4(parseYaml(source.facetrc));
|
|
1723
|
+
const indexDoc = asRecord4(parseYaml(source.index));
|
|
1724
|
+
const paths = Array.isArray(indexDoc.records) ? indexDoc.records.map(String) : [];
|
|
1725
|
+
const raws = [];
|
|
1726
|
+
const corpusErrors = [];
|
|
1727
|
+
paths.forEach((path) => {
|
|
1728
|
+
const raw = source.records[path];
|
|
1729
|
+
if (!raw) {
|
|
1730
|
+
corpusErrors.push({ path, message: localized5.text1 });
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
try {
|
|
1734
|
+
raws.push({ path, raw, doc: asRecord4(parseYaml(raw)) });
|
|
1735
|
+
} catch (error) {
|
|
1736
|
+
if (!(error instanceof YamlError)) throw error;
|
|
1737
|
+
const line = error.line;
|
|
1738
|
+
const message = error.message.replace(chunkWAG2ZZJH_cjs.labelText.text356, "");
|
|
1739
|
+
corpusErrors.push({ path, message, line });
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
return buildModel(
|
|
1743
|
+
rc,
|
|
1744
|
+
paths,
|
|
1745
|
+
raws,
|
|
1746
|
+
source.scan ?? {},
|
|
1747
|
+
corpusErrors,
|
|
1748
|
+
parseTaxonomy(source.taxonomy),
|
|
1749
|
+
normaliseCalibration(source.calibration),
|
|
1750
|
+
parseGlossary(source.glossary)
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
exports.DEFAULT_ERROR_CODE_PATTERN = DEFAULT_ERROR_CODE_PATTERN;
|
|
1755
|
+
exports.GHERKIN_LABEL = GHERKIN_LABEL;
|
|
1756
|
+
exports.RENDERED_PATHS = RENDERED_PATHS;
|
|
1757
|
+
exports.YamlError = YamlError;
|
|
1758
|
+
exports.anyAnchorProves = anyAnchorProves;
|
|
1759
|
+
exports.buildEnumRegister = buildEnumRegister;
|
|
1760
|
+
exports.buildErrorCodeRegister = buildErrorCodeRegister;
|
|
1761
|
+
exports.buildModel = buildModel;
|
|
1762
|
+
exports.collectEnumConstraints = collectEnumConstraints;
|
|
1763
|
+
exports.collectPaths = collectPaths;
|
|
1764
|
+
exports.coverage = coverage;
|
|
1765
|
+
exports.errorCodeBand = errorCodeBand;
|
|
1766
|
+
exports.extractErrorCodes = extractErrorCodes;
|
|
1767
|
+
exports.formatNumber = formatNumber;
|
|
1768
|
+
exports.glossaryTermList = glossaryTermList;
|
|
1769
|
+
exports.humanize = humanize;
|
|
1770
|
+
exports.isRenderedPath = isRenderedPath;
|
|
1771
|
+
exports.linkTerms = linkTerms;
|
|
1772
|
+
exports.loadCorpus = loadCorpus;
|
|
1773
|
+
exports.lookupTerm = lookupTerm;
|
|
1774
|
+
exports.parseEnumConstraint = parseEnumConstraint;
|
|
1775
|
+
exports.parseGherkin = parseGherkin;
|
|
1776
|
+
exports.parseGlossary = parseGlossary;
|
|
1777
|
+
exports.parseTaxonomy = parseTaxonomy;
|
|
1778
|
+
exports.parseYaml = parseYaml;
|
|
1779
|
+
exports.pct = pct;
|
|
1780
|
+
exports.recordKindOf = recordKindOf;
|
|
1781
|
+
exports.remainingText = remainingText;
|
|
1782
|
+
exports.scenarioPreview = scenarioPreview;
|
|
1783
|
+
exports.shapeDefects = shapeDefects;
|
|
1784
|
+
exports.shapeRecord = shapeRecord;
|
|
1785
|
+
exports.taxonomyTree = taxonomyTree;
|
|
1786
|
+
exports.tokenizeGherkin = tokenizeGherkin;
|
|
1787
|
+
//# sourceMappingURL=chunk-GDFKDECN.cjs.map
|
|
1788
|
+
//# sourceMappingURL=chunk-GDFKDECN.cjs.map
|