@auditcore/ui-core 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1326 -0
  3. package/dist/account/camera.d.ts +8 -0
  4. package/dist/account/controller.d.ts +30 -0
  5. package/dist/account/index.d.ts +7 -0
  6. package/dist/account/messages.d.ts +2 -0
  7. package/dist/account/port.d.ts +10 -0
  8. package/dist/account/presentation.d.ts +9 -0
  9. package/dist/account/types.d.ts +42 -0
  10. package/dist/account/view.d.ts +12 -0
  11. package/dist/attributes/controller.d.ts +26 -0
  12. package/dist/attributes/index.d.ts +5 -0
  13. package/dist/attributes/messages.d.ts +3 -0
  14. package/dist/attributes/port.d.ts +4 -0
  15. package/dist/attributes/types.d.ts +60 -0
  16. package/dist/attributes/view.d.ts +49 -0
  17. package/dist/base/icons.d.ts +38 -0
  18. package/dist/base/index.d.ts +3 -0
  19. package/dist/base/types.d.ts +3 -0
  20. package/dist/batchchecks/controller.d.ts +60 -0
  21. package/dist/batchchecks/index.d.ts +7 -0
  22. package/dist/batchchecks/messages.d.ts +3 -0
  23. package/dist/batchchecks/model.d.ts +38 -0
  24. package/dist/batchchecks/port.d.ts +6 -0
  25. package/dist/batchchecks/rest-port.d.ts +4 -0
  26. package/dist/batchchecks/types.d.ts +121 -0
  27. package/dist/batchchecks/view.d.ts +58 -0
  28. package/dist/benford/chart.d.ts +49 -0
  29. package/dist/benford/controller.d.ts +48 -0
  30. package/dist/benford/index.d.ts +7 -0
  31. package/dist/benford/messages.d.ts +3 -0
  32. package/dist/benford/model.d.ts +32 -0
  33. package/dist/benford/rest-port.d.ts +4 -0
  34. package/dist/benford/types.d.ts +144 -0
  35. package/dist/benford/view.d.ts +45 -0
  36. package/dist/dataprotection/dsfa.d.ts +55 -0
  37. package/dist/dataprotection/dsfaView.d.ts +45 -0
  38. package/dist/dataprotection/exporters.d.ts +33 -0
  39. package/dist/dataprotection/index.d.ts +10 -0
  40. package/dist/dataprotection/messages.d.ts +5 -0
  41. package/dist/dataprotection/registerView.d.ts +47 -0
  42. package/dist/dataprotection/requests.d.ts +16 -0
  43. package/dist/dataprotection/rest-port.d.ts +4 -0
  44. package/dist/dataprotection/types.d.ts +291 -0
  45. package/dist/dataprotection/vvt.d.ts +69 -0
  46. package/dist/dbkanban/controller.d.ts +54 -0
  47. package/dist/dbkanban/index.d.ts +3 -0
  48. package/dist/dbkanban/messages.d.ts +5 -0
  49. package/dist/dbkanban/view.d.ts +39 -0
  50. package/dist/documents/controller.d.ts +63 -0
  51. package/dist/documents/form.d.ts +52 -0
  52. package/dist/documents/importing.d.ts +12 -0
  53. package/dist/documents/index.d.ts +6 -0
  54. package/dist/documents/list.d.ts +21 -0
  55. package/dist/documents/messages.d.ts +8 -0
  56. package/dist/documents/view.d.ts +36 -0
  57. package/dist/download.d.ts +14 -0
  58. package/dist/extraction/controller.d.ts +34 -0
  59. package/dist/extraction/index.d.ts +5 -0
  60. package/dist/extraction/messages.d.ts +3 -0
  61. package/dist/extraction/rest-port.d.ts +4 -0
  62. package/dist/extraction/types.d.ts +115 -0
  63. package/dist/extraction/view.d.ts +35 -0
  64. package/dist/extrapolation/controller-subsample.d.ts +20 -0
  65. package/dist/extrapolation/controller.d.ts +72 -0
  66. package/dist/extrapolation/index.d.ts +9 -0
  67. package/dist/extrapolation/messages.d.ts +3 -0
  68. package/dist/extrapolation/model-design.d.ts +28 -0
  69. package/dist/extrapolation/model-subsample.d.ts +40 -0
  70. package/dist/extrapolation/model.d.ts +92 -0
  71. package/dist/extrapolation/rest-port.d.ts +4 -0
  72. package/dist/extrapolation/types.d.ts +255 -0
  73. package/dist/extrapolation/view-details.d.ts +46 -0
  74. package/dist/extrapolation/view.d.ts +50 -0
  75. package/dist/focus.d.ts +10 -0
  76. package/dist/geo/controller.d.ts +87 -0
  77. package/dist/geo/index.d.ts +6 -0
  78. package/dist/geo/mapView.d.ts +30 -0
  79. package/dist/geo/messages.d.ts +3 -0
  80. package/dist/geo/model.d.ts +43 -0
  81. package/dist/geo/rest-port.d.ts +12 -0
  82. package/dist/geo/types.d.ts +195 -0
  83. package/dist/i18n.d.ts +29 -0
  84. package/dist/identifiers/controller.d.ts +63 -0
  85. package/dist/identifiers/index.d.ts +5 -0
  86. package/dist/identifiers/messages.d.ts +3 -0
  87. package/dist/identifiers/model.d.ts +87 -0
  88. package/dist/identifiers/rest-port.d.ts +4 -0
  89. package/dist/identifiers/types.d.ts +101 -0
  90. package/dist/index.d.ts +33 -0
  91. package/dist/index.js +10676 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/kanban/index.d.ts +2 -0
  94. package/dist/kanban/messages.d.ts +6 -0
  95. package/dist/messages.d.ts +2 -0
  96. package/dist/reporting/controller.d.ts +46 -0
  97. package/dist/reporting/index.d.ts +5 -0
  98. package/dist/reporting/messages.d.ts +3 -0
  99. package/dist/reporting/rest-port.d.ts +4 -0
  100. package/dist/reporting/types.d.ts +72 -0
  101. package/dist/reporting/view.d.ts +12 -0
  102. package/dist/reporttemplates/controller.d.ts +46 -0
  103. package/dist/reporttemplates/index.d.ts +5 -0
  104. package/dist/reporttemplates/messages.d.ts +3 -0
  105. package/dist/reporttemplates/port.d.ts +4 -0
  106. package/dist/reporttemplates/types.d.ts +92 -0
  107. package/dist/reporttemplates/view.d.ts +27 -0
  108. package/dist/risk/controller.d.ts +54 -0
  109. package/dist/risk/format.d.ts +13 -0
  110. package/dist/risk/index.d.ts +7 -0
  111. package/dist/risk/labels.d.ts +9 -0
  112. package/dist/risk/messages.d.ts +3 -0
  113. package/dist/risk/port.d.ts +41 -0
  114. package/dist/risk/state.d.ts +61 -0
  115. package/dist/risk/types.d.ts +107 -0
  116. package/dist/runner/aktionen.d.ts +16 -0
  117. package/dist/runner/controller.d.ts +72 -0
  118. package/dist/runner/eingabe.d.ts +5 -0
  119. package/dist/runner/index.d.ts +9 -0
  120. package/dist/runner/messages.d.ts +3 -0
  121. package/dist/runner/port.d.ts +20 -0
  122. package/dist/runner/profil.d.ts +39 -0
  123. package/dist/runner/types.d.ts +109 -0
  124. package/dist/runner/view-listen.d.ts +32 -0
  125. package/dist/runner/view.d.ts +95 -0
  126. package/dist/samplesize/controller.d.ts +33 -0
  127. package/dist/samplesize/index.d.ts +7 -0
  128. package/dist/samplesize/messages.d.ts +3 -0
  129. package/dist/samplesize/model.d.ts +40 -0
  130. package/dist/samplesize/port.d.ts +9 -0
  131. package/dist/samplesize/types.d.ts +92 -0
  132. package/dist/samplesize/view.d.ts +39 -0
  133. package/dist/sampling/controller.d.ts +62 -0
  134. package/dist/sampling/index.d.ts +6 -0
  135. package/dist/sampling/messages.d.ts +3 -0
  136. package/dist/sampling/model.d.ts +63 -0
  137. package/dist/sampling/rest-port.d.ts +4 -0
  138. package/dist/sampling/types.d.ts +136 -0
  139. package/dist/sampling/view.d.ts +45 -0
  140. package/dist/screening/controller.d.ts +52 -0
  141. package/dist/screening/index.d.ts +8 -0
  142. package/dist/screening/messages.d.ts +7 -0
  143. package/dist/screening/rest-port.d.ts +4 -0
  144. package/dist/screening/runForm.d.ts +22 -0
  145. package/dist/screening/types.d.ts +295 -0
  146. package/dist/screening/view.d.ts +84 -0
  147. package/dist/store.d.ts +30 -0
  148. package/dist/synopsis/controller.d.ts +68 -0
  149. package/dist/synopsis/exporters.d.ts +16 -0
  150. package/dist/synopsis/index.d.ts +8 -0
  151. package/dist/synopsis/messages.d.ts +3 -0
  152. package/dist/synopsis/navigation.d.ts +5 -0
  153. package/dist/synopsis/port.d.ts +38 -0
  154. package/dist/synopsis/types.d.ts +121 -0
  155. package/dist/synopsis/viewModel.d.ts +74 -0
  156. package/dist/synopsis/wordDiff.d.ts +31 -0
  157. package/dist/table/index.d.ts +6 -0
  158. package/dist/tabular/index.d.ts +2 -0
  159. package/dist/tabular/messages.d.ts +3 -0
  160. package/dist/tabular/tableImport.d.ts +40 -0
  161. package/package.json +55 -0
  162. package/styles/account.css +37 -0
  163. package/styles/attributes.css +18 -0
  164. package/styles/base.css +116 -0
  165. package/styles/batchchecks.css +26 -0
  166. package/styles/benford.css +39 -0
  167. package/styles/dataprotection.css +68 -0
  168. package/styles/dbkanban.css +38 -0
  169. package/styles/documents.css +51 -0
  170. package/styles/extraction.css +25 -0
  171. package/styles/extrapolation.css +34 -0
  172. package/styles/geo.css +54 -0
  173. package/styles/identifiers.css +38 -0
  174. package/styles/index.css +24 -0
  175. package/styles/kanban.css +115 -0
  176. package/styles/reporting.css +22 -0
  177. package/styles/reporttemplates.css +21 -0
  178. package/styles/risk.css +92 -0
  179. package/styles/runner.css +54 -0
  180. package/styles/samplesize.css +27 -0
  181. package/styles/sampling.css +31 -0
  182. package/styles/screening.css +86 -0
  183. package/styles/synopsis.css +83 -0
  184. package/styles/table.css +17 -0
  185. package/styles/tabular.css +11 -0
  186. package/styles/tokens.css +121 -0
@@ -0,0 +1,295 @@
1
+ export declare const CONTRACT = "auditcore_registry_sources.screening_review/1";
2
+ export type ScreeningKind = 'sanctions' | 'pep';
3
+ export type Outcome = 'confirmed' | 'dismissed' | 'deferred';
4
+ export type ReviewStatus = 'open' | 'pending_second_review' | Outcome;
5
+ export type SubjectStatus = 'HITS' | 'NO_HITS' | 'INCOMPLETE' | 'NOT_SEARCHED';
6
+ export type FreshnessStatus = 'current' | 'stale' | 'unknown' | 'not_judged';
7
+ export interface ActorView {
8
+ id: string;
9
+ display_name: string;
10
+ }
11
+ export interface SubjectInput {
12
+ subject_id: string;
13
+ name: string;
14
+ birth_date: string | null;
15
+ country: string | null;
16
+ schema: string | null;
17
+ reference: string | null;
18
+ }
19
+ export interface EntryView {
20
+ entry_id: string;
21
+ schema: string;
22
+ name: string;
23
+ aliases: string[];
24
+ aliases_total: number;
25
+ birth_date: string;
26
+ countries: string;
27
+ addresses: string;
28
+ identifiers: string;
29
+ sanctions: string;
30
+ program_ids: string;
31
+ first_seen: string;
32
+ last_seen: string;
33
+ dataset: string;
34
+ }
35
+ export interface BreakdownStep {
36
+ step: 'normalization' | 'base' | 'adjustment' | 'clamp' | 'result';
37
+ label: string;
38
+ value?: string;
39
+ detail?: string;
40
+ points?: number;
41
+ kind?: string;
42
+ }
43
+ export interface ScoreClass {
44
+ class: string;
45
+ label: string;
46
+ from: number;
47
+ }
48
+ export interface Breakdown {
49
+ method: string;
50
+ scale: {
51
+ min: number;
52
+ max: number;
53
+ };
54
+ steps: BreakdownStep[];
55
+ min_score: number;
56
+ classes: ScoreClass[];
57
+ class: string;
58
+ class_label: string;
59
+ consistent: boolean;
60
+ }
61
+ export interface DecisionView {
62
+ outcome: Outcome;
63
+ reason: string;
64
+ four_eyes: boolean;
65
+ four_eyes_source: 'policy' | 'requested' | null;
66
+ actor: ActorView;
67
+ at: string;
68
+ sequence: number;
69
+ }
70
+ export interface SecondReviewView {
71
+ approve: boolean;
72
+ reason: string;
73
+ actor: ActorView;
74
+ at: string;
75
+ sequence: number;
76
+ }
77
+ export interface ReviewView {
78
+ status: ReviewStatus;
79
+ status_label: string;
80
+ sequence: number;
81
+ decision: DecisionView | null;
82
+ second_review: SecondReviewView | null;
83
+ events: number;
84
+ }
85
+ export interface HitView {
86
+ hit_id: string;
87
+ subject_id: string;
88
+ list_key: string;
89
+ list_name: string;
90
+ source_key: string | null;
91
+ entry: EntryView;
92
+ matched_name: string;
93
+ matched_field: 'name' | 'alias';
94
+ raw_score: number;
95
+ score: number;
96
+ confidence: string;
97
+ dob_conflict: boolean;
98
+ country_conflict: boolean;
99
+ below_min_score: boolean;
100
+ indicators: string[];
101
+ breakdown: Breakdown;
102
+ review: ReviewView;
103
+ }
104
+ export interface FindingView {
105
+ list_key: string;
106
+ list_name: string;
107
+ source_key: string | null;
108
+ searched: boolean;
109
+ entry_count: number;
110
+ as_of: string | null;
111
+ retrieved_at: string | null;
112
+ hit_count: number;
113
+ note: string | null;
114
+ }
115
+ export interface SubjectView {
116
+ subject_id: string;
117
+ input: SubjectInput;
118
+ status: SubjectStatus;
119
+ normalized_query: string;
120
+ min_score: number;
121
+ findings: FindingView[];
122
+ hits: HitView[];
123
+ hits_before_filter: number;
124
+ total_hits: number;
125
+ truncated: boolean;
126
+ notice: string;
127
+ limitations: string[];
128
+ }
129
+ export interface FreshnessView {
130
+ status: FreshnessStatus;
131
+ label: string;
132
+ age_days: number | null;
133
+ stale_after_days: number | null;
134
+ }
135
+ export interface ListInfo {
136
+ key: string;
137
+ source_key: string | null;
138
+ name: string;
139
+ issuer: string;
140
+ url: string;
141
+ format: string;
142
+ provider: string;
143
+ licence_claimed_in_source: string | null;
144
+ data_licence: {
145
+ status?: string;
146
+ note?: string;
147
+ };
148
+ }
149
+ export interface SourceView {
150
+ list: ListInfo;
151
+ kind: ScreeningKind;
152
+ entry_count: number;
153
+ as_of: string | null;
154
+ retrieved_at: string | null;
155
+ content_sha256: string | null;
156
+ note: string | null;
157
+ searchable: boolean;
158
+ freshness: FreshnessView;
159
+ }
160
+ export interface ProfileView {
161
+ id: string;
162
+ version: string;
163
+ fingerprint: string;
164
+ status: string;
165
+ kind: ScreeningKind;
166
+ legal_status: string;
167
+ default_min_score: number;
168
+ scale: {
169
+ min: number;
170
+ max: number;
171
+ };
172
+ recommended: boolean;
173
+ }
174
+ export interface SettingsView {
175
+ contract: string;
176
+ profiles: ProfileView[];
177
+ four_eyes_outcomes: Outcome[];
178
+ stale_after_days: number | null;
179
+ }
180
+ export interface SourcesView {
181
+ contract: string;
182
+ checked_at: string;
183
+ sources: SourceView[];
184
+ }
185
+ export interface RunSummary {
186
+ run_id: string;
187
+ created_at: string;
188
+ created_by: ActorView;
189
+ kind: ScreeningKind;
190
+ case_reference: string | null;
191
+ profile: {
192
+ id: string;
193
+ version: string;
194
+ fingerprint: string;
195
+ status: string;
196
+ };
197
+ subject_count: number;
198
+ subjects_with_hits: number;
199
+ subjects_incomplete: number;
200
+ hit_count: number;
201
+ review_counts: Record<ReviewStatus, number>;
202
+ review_complete: boolean;
203
+ last_sequence: number;
204
+ }
205
+ export interface RunRequestRecord {
206
+ kind: ScreeningKind;
207
+ profile: RunSummary['profile'];
208
+ lists: string[];
209
+ min_score: number | null;
210
+ limit: number;
211
+ case_reference: string | null;
212
+ subjects: SubjectInput[];
213
+ }
214
+ export interface RunView extends RunSummary {
215
+ contract: string;
216
+ request: RunRequestRecord;
217
+ sources: SourceView[];
218
+ subjects: SubjectView[];
219
+ }
220
+ export interface LogEntry {
221
+ run_id: string;
222
+ sequence: number;
223
+ type: 'run_created' | 'decision_recorded' | 'second_review_recorded';
224
+ type_label: string;
225
+ at: string;
226
+ actor: ActorView;
227
+ hit_id: string | null;
228
+ hit?: {
229
+ subject_name: string;
230
+ entry_name: string;
231
+ list_name: string;
232
+ } | null;
233
+ data: Record<string, unknown>;
234
+ outcome_label?: string;
235
+ }
236
+ export interface LogView {
237
+ contract: string;
238
+ run_id: string;
239
+ events: LogEntry[];
240
+ }
241
+ export interface SubjectRequest {
242
+ name: string;
243
+ birth_date?: string;
244
+ country?: string;
245
+ schema?: string;
246
+ reference?: string;
247
+ }
248
+ export interface RunRequest {
249
+ kind: ScreeningKind;
250
+ profile: {
251
+ id: string;
252
+ version: string;
253
+ };
254
+ subjects: SubjectRequest[];
255
+ lists?: string[];
256
+ min_score?: number;
257
+ limit?: number;
258
+ case_reference?: string;
259
+ }
260
+ export interface DecisionRequest {
261
+ outcome: Outcome;
262
+ reason: string;
263
+ four_eyes: boolean;
264
+ expected_sequence?: number;
265
+ }
266
+ export interface SecondReviewRequest {
267
+ approve: boolean;
268
+ reason: string;
269
+ expected_sequence?: number;
270
+ }
271
+ export interface ApiErrorBody {
272
+ error: {
273
+ code: string;
274
+ message: string;
275
+ details: Record<string, unknown>;
276
+ };
277
+ }
278
+ export type RunQuery = Partial<Record<'status' | 'list' | 'subject' | 'confidence' | 'min_score', string>>;
279
+ /**
280
+ * Port der Screening-Trefferprüfung. Die Komponente ruft nie selbst `fetch`
281
+ * auf; `createScreeningRestPort` ist die mitgelieferte REST-Umsetzung.
282
+ */
283
+ export interface ScreeningPort {
284
+ settings: () => Promise<SettingsView>;
285
+ sources: () => Promise<SourcesView>;
286
+ runs: () => Promise<{
287
+ contract: string;
288
+ runs: RunSummary[];
289
+ }>;
290
+ createRun: (request: RunRequest) => Promise<RunView>;
291
+ run: (runId: string, query?: RunQuery) => Promise<RunView>;
292
+ log: (runId: string) => Promise<LogView>;
293
+ decide: (runId: string, hitId: string, decision: DecisionRequest) => Promise<HitView>;
294
+ secondReview: (runId: string, hitId: string, review: SecondReviewRequest) => Promise<HitView>;
295
+ }
@@ -0,0 +1,84 @@
1
+ import { Locale, MessageParams } from '../i18n';
2
+ import { ScreeningKey, ScreeningTranslate } from './messages';
3
+ import { Breakdown, FreshnessStatus, HitView, Outcome, ReviewStatus, ReviewView, RunView, SettingsView, SubjectRequest, SubjectView } from './types';
4
+ export interface HitFilter {
5
+ statuses: ReviewStatus[];
6
+ lists: string[];
7
+ subjects: string[];
8
+ confidences: string[];
9
+ minScore: number | null;
10
+ text: string;
11
+ }
12
+ export declare function emptyFilter(): HitFilter;
13
+ export declare function acceptsHit(hit: HitView, filter: HitFilter): boolean;
14
+ /** Subjects with only the hits passing the filter; subjects themselves stay visible. */
15
+ export declare function filterSubjects(subjects: SubjectView[], filter: HitFilter): SubjectView[];
16
+ export interface FilterOptions {
17
+ lists: {
18
+ key: string;
19
+ name: string;
20
+ }[];
21
+ subjects: {
22
+ id: string;
23
+ name: string;
24
+ }[];
25
+ confidences: string[];
26
+ }
27
+ export declare function filterOptions(run: RunView): FilterOptions;
28
+ export declare function formatScore(value: number, scale: {
29
+ max: number;
30
+ }, locale?: Locale): string;
31
+ export declare function formatPoints(value: number, scale: {
32
+ max: number;
33
+ }, locale?: Locale): string;
34
+ export declare function scorePercent(value: number, scale: {
35
+ min: number;
36
+ max: number;
37
+ }): number;
38
+ export type Tone = 'plus' | 'minus' | 'neutral' | 'result';
39
+ export interface BreakdownRow {
40
+ label: string;
41
+ value: string;
42
+ points: string;
43
+ tone: Tone;
44
+ }
45
+ export declare function breakdownRows(breakdown: Breakdown, locale?: Locale): BreakdownRow[];
46
+ export declare function formatDate(value: string | null | undefined): string;
47
+ export declare function freshnessTone(status: FreshnessStatus): 'ok' | 'warn' | 'muted';
48
+ export declare function formatAge(days: number | null, t: ScreeningTranslate): string;
49
+ export type MatchState = 'match' | 'conflict' | 'not_compared' | 'info';
50
+ export interface ComparisonRow {
51
+ label: string;
52
+ input: string;
53
+ entry: string;
54
+ state: MatchState;
55
+ }
56
+ export declare function comparisonRows(subject: SubjectView, hit: HitView, t: ScreeningTranslate): ComparisonRow[];
57
+ export declare function indicatorLabels(hit: HitView, t: ScreeningTranslate): string[];
58
+ export declare function requiresFourEyes(outcome: Outcome, settings: SettingsView | null): boolean;
59
+ export declare const canDecide: (review: ReviewView) => boolean;
60
+ export declare const awaitsSecondReview: (review: ReviewView) => boolean;
61
+ export interface DecisionForm {
62
+ outcome: Outcome | null;
63
+ reason: string;
64
+ fourEyes: boolean;
65
+ }
66
+ /** Meldung als Katalogschlüssel mit Platzhaltern; die Komponente übersetzt sie. */
67
+ export interface ViewMessage {
68
+ key: ScreeningKey;
69
+ params?: MessageParams;
70
+ }
71
+ export declare function validateDecision(form: DecisionForm): ViewMessage[];
72
+ /** The next hit still needing work after ``currentId`` (open, deferred or pending). */
73
+ export declare function nextOpenHit(subjects: SubjectView[], currentId: string | null): string | null;
74
+ export declare function findHit(run: RunView | null, hitId: string | null): {
75
+ subject: SubjectView;
76
+ hit: HitView;
77
+ } | null;
78
+ /** One subject per line: ``Name; Geburtsdatum; Land; Bezug`` (only the name is required). */
79
+ export declare function parseSubjects(text: string): {
80
+ subjects: SubjectRequest[];
81
+ errors: ViewMessage[];
82
+ };
83
+ /** Replace one hit (after a decision) without reloading the whole run. */
84
+ export declare function replaceHit(run: RunView, updated: HitView): RunView;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Kleinster gemeinsamer Zustandsspeicher der Controller. Jeder Stand ist ein
3
+ * neues, unveränderliches Objekt; React liest ihn über
4
+ * `useSyncExternalStore`, Vue spiegelt ihn in ein `shallowRef`.
5
+ */
6
+ export interface Store<S extends object> {
7
+ get: () => S;
8
+ /** Teilstand übernehmen; Beobachter werden nur bei einer Änderung benachrichtigt. */
9
+ set: (patch: Partial<S> | ((state: S) => Partial<S>)) => void;
10
+ subscribe: (listener: () => void) => () => void;
11
+ }
12
+ export declare function createStore<S extends object>(initial: S): Store<S>;
13
+ /** Beschäftigt-Status, Fehler und Erfolgsmeldung einer Portanfrage (gemeinsam für alle Controller). */
14
+ export interface RequestState<E> {
15
+ busy: string | null;
16
+ error: E | null;
17
+ /** Letzte Erfolgsmeldung (für `aria-live`). */
18
+ notice: string;
19
+ }
20
+ export declare const IDLE: RequestState<never>;
21
+ /**
22
+ * Führt eine Portanfrage aus: setzt `busy`, fängt Fehler (über `toError`) und
23
+ * meldet sie an `onError`. Ohne Port geschieht nichts (`null`).
24
+ */
25
+ export declare function createRunner<P, E, S extends RequestState<E>>(store: Store<S>, port: () => P | null, toError: (error: unknown) => E, onError?: (error: E) => void): <T>(kind: string, task: (active: P) => Promise<T>) => Promise<T | null>;
26
+ /** Verzögerter Aufruf, der bei jeder neuen Eingabe neu startet (Vorschau, Vollständigkeitsprüfung). */
27
+ export declare function createDelay(ms: () => number): {
28
+ schedule(task: () => void): void;
29
+ cancel(): void;
30
+ };
@@ -0,0 +1,68 @@
1
+ import { SynopsisPort } from './port';
2
+ import { ClientExportFormat, Comparison, ComparisonResult, CompareRow, ExportPayload, RowUpdate } from './types';
3
+ import { RowView, SynopsisTranslate, SynopsisView } from './viewModel';
4
+ /** Eingaben der Komponente (Props). */
5
+ export interface SynopsisInputs {
6
+ comparison?: Comparison | null;
7
+ result?: ComparisonResult | null;
8
+ comparisonId?: string;
9
+ port?: SynopsisPort | null;
10
+ title?: string;
11
+ oldLabel?: string;
12
+ newLabel?: string;
13
+ }
14
+ export interface SynopsisFilterState {
15
+ statuses: string[];
16
+ query: string;
17
+ onlySelected: boolean;
18
+ /** `null`: Vorgabe aus `metadata.highlight_words`. */
19
+ highlight: boolean | null;
20
+ }
21
+ export interface SynopsisData {
22
+ loaded: Comparison | null;
23
+ loading: boolean;
24
+ error: string;
25
+ overrides: ReadonlyMap<string, Partial<CompareRow>>;
26
+ filter: SynopsisFilterState;
27
+ activeId: string | null;
28
+ }
29
+ export interface ServerExportLink {
30
+ label: string;
31
+ href: string;
32
+ }
33
+ /** Alles, was die Oberfläche aus Stand und Eingaben anzeigt (reine Funktion). */
34
+ export interface SynopsisSelection {
35
+ currentId: string | undefined;
36
+ result: ComparisonResult | null;
37
+ view: SynopsisView | null;
38
+ rows: RowView[];
39
+ selectedText: string;
40
+ highlight: boolean;
41
+ activeId: string | null;
42
+ position: string;
43
+ canPrev: boolean;
44
+ canNext: boolean;
45
+ serverExports: ServerExportLink[];
46
+ }
47
+ /** Kennung des angezeigten Vergleichs (für Speichern und Server-Exporte). */
48
+ export declare function synopsisId(state: SynopsisData, inputs: SynopsisInputs): string | undefined;
49
+ /** Ergebnisobjekt vor lokalen Änderungen: Prop `result`, sonst gespeicherter oder geladener Vergleich. */
50
+ export declare function synopsisBase(state: SynopsisData, inputs: SynopsisInputs): ComparisonResult | null;
51
+ export declare function selectSynopsis(state: SynopsisData, inputs: SynopsisInputs, t: SynopsisTranslate): SynopsisSelection;
52
+ /** Export der sichtbaren Zeilen (HTML, Markdown, Druckansicht). */
53
+ export declare function buildSynopsisExport(selection: SynopsisSelection, format: ClientExportFormat, t: SynopsisTranslate, lang: string): ExportPayload | null;
54
+ export declare function createSynopsisController(t: () => SynopsisTranslate): {
55
+ store: import('..').Store<SynopsisData>;
56
+ reload: (inputs: SynopsisInputs) => Promise<void>;
57
+ updateRow: (inputs: SynopsisInputs, id: string, patch: Omit<RowUpdate, "row_id">) => Promise<RowUpdate>;
58
+ toggleStatus: (status: string, enabled: boolean) => void;
59
+ go: (selection: SynopsisSelection, direction: 1 | -1) => string | null;
60
+ setAllChanges: () => void;
61
+ setQuery: (query: string) => void;
62
+ setOnlySelected: (onlySelected: boolean) => void;
63
+ setHighlight: (highlight: boolean) => void;
64
+ activate: (id: string | null) => void;
65
+ /** Neues Ergebnisobjekt: lokale Zeilenänderungen verwerfen. */
66
+ resetOverrides: () => void;
67
+ };
68
+ export type SynopsisController = ReturnType<typeof createSynopsisController>;
@@ -0,0 +1,16 @@
1
+ import { SynopsisTranslate, RowView, SynopsisView } from './viewModel';
2
+ export interface ExportInput {
3
+ view: SynopsisView;
4
+ rows: readonly RowView[];
5
+ t: SynopsisTranslate;
6
+ /** Zeitpunkt der Ausgabe (Standard: jetzt), für reproduzierbare Tests injizierbar. */
7
+ generatedAt?: string;
8
+ lang?: string;
9
+ }
10
+ export declare function escapeHtml(text: string): string;
11
+ export declare function escapeMarkdown(text: string): string;
12
+ export declare function exportFilename(title: string, extension: string): string;
13
+ /** Eigenständiges HTML-Dokument mit Druck-CSS (keine externen Ressourcen). */
14
+ export declare function toHtml(input: ExportInput): string;
15
+ /** Markdown: gestrichene Wörter als ~~…~~, neue als **…**. */
16
+ export declare function toMarkdown(input: ExportInput): string;
@@ -0,0 +1,8 @@
1
+ export { synopsisMessages, type SynopsisMessageKey } from './messages';
2
+ export * from './types';
3
+ export * from './wordDiff';
4
+ export * from './viewModel';
5
+ export * from './exporters';
6
+ export * from './port';
7
+ export * from './controller';
8
+ export { navigationDirection, focusRow } from './navigation';
@@ -0,0 +1,3 @@
1
+ /** Sichtbare Texte der Synopse; Begriffe wie im audit_designer und in ecohesion. */
2
+ export declare const synopsisMessages: import('..').Catalogs<"loading" | "search" | "title" | "empty" | "statusChanged" | "statusRemoved" | "statusAdded" | "statusMoved" | "statusUnchanged" | "oldLabel" | "newLabel" | "reasonLabel" | "location" | "emptyOld" | "emptyNew" | "fieldAnswer" | "fieldComment" | "fieldNote" | "counts" | "modeChecklist" | "modeText" | "detected" | "files" | "hashes" | "workAid" | "commands" | "openCommands" | "consolidated" | "consolidatedEntry" | "repealed" | "inserted" | "toolbar" | "layout" | "layoutSideBySide" | "layoutInline" | "filterLegend" | "filterAll" | "onlySelected" | "highlight" | "prevChange" | "nextChange" | "position" | "positionNone" | "keyboardHint" | "noMatches" | "exportLabel" | "exportHtml" | "exportMarkdown" | "exportPrint" | "serverDocx" | "serverPdf" | "serverJson" | "include" | "reasonPlaceholder" | "flowagent" | "flowagentVerified" | "flowagentCheck" | "srRemoved" | "srAdded" | "srEnd" | "selectedCount" | "loadError" | "saveError" | "generated">;
3
+ export type SynopsisMessageKey = keyof typeof synopsisMessages.de;
@@ -0,0 +1,5 @@
1
+ /** Tastatur- und Fokussteuerung der Synopse (framework-frei). */
2
+ /** Richtung für N/J (nächste) bzw. P/K (vorige Änderung); in Eingabefeldern und mit Modifikatoren `null`. */
3
+ export declare function navigationDirection(event: Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'target'>): 1 | -1 | null;
4
+ /** Zeile fokussieren und sichtbar machen; Zeilen tragen `data-row-id` und `tabindex="-1"`. */
5
+ export declare function focusRow(root: HTMLElement | null, id: string): void;
@@ -0,0 +1,38 @@
1
+ import { RestOptions } from '@auditcore/common';
2
+ import { Comparison, ComparisonProfile, ComparisonResult, ComparisonSummary, RowUpdate, ServerExportFormat } from './types';
3
+ export interface SynopsisPort {
4
+ /** Vergleich laden (`GET /comparisons/{id}`). */
5
+ load(id: string): Promise<Comparison>;
6
+ /** Auswahl/Grund speichern (`PATCH /comparisons/{id}/rows`); liefert den neuen Stand. */
7
+ updateRows?(id: string, rows: readonly RowUpdate[]): Promise<Comparison>;
8
+ /** Adresse einer Server-Ausgabe (DOCX, PDF, JSON, Markdown) für einen Download-Link. */
9
+ exportUrl?(id: string, format: ServerExportFormat): string;
10
+ }
11
+ /** Optionen wie bei `src/rest`: `baseUrl` (z. B. `/api/synopsis`), injizierbares `fetch`, Kopfzeilen. */
12
+ export type RestClientOptions = RestOptions;
13
+ export interface CompareFields {
14
+ title?: string;
15
+ comparison_type?: 'standard' | 'article_law';
16
+ mode?: 'auto' | 'checklist' | 'text';
17
+ threshold?: number;
18
+ include_answers?: boolean;
19
+ include_notes?: boolean;
20
+ include_editorial?: boolean;
21
+ highlight_words?: boolean;
22
+ output_sections?: readonly string[];
23
+ profile?: string;
24
+ }
25
+ /** Anfrage von `POST /comparisons/import`: ein fertiges Ergebnis aus der Auftragssteuerung ablegen. */
26
+ export interface ImportRequest {
27
+ title?: string;
28
+ result: ComparisonResult;
29
+ }
30
+ export interface SynopsisRestClient extends Required<SynopsisPort> {
31
+ profiles(): Promise<ComparisonProfile[]>;
32
+ list(): Promise<ComparisonSummary[]>;
33
+ create(oldFile: Blob, oldName: string, newFile: Blob, newName: string, fields?: CompareFields): Promise<Comparison>;
34
+ /** `POST /comparisons/import`. */
35
+ importResult(request: ImportRequest): Promise<Comparison>;
36
+ remove(id: string): Promise<void>;
37
+ }
38
+ export declare function createSynopsisRestClient(options: RestClientOptions): SynopsisRestClient;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * JSON-Formen des REST-Vertrags (docs/ui/synopsis-rest.md). Sie entsprechen
3
+ * `ComparisonResult.to_dict()` aus `auditcore_documents`; die Oberfläche kennt
4
+ * keine zweite Datenform.
5
+ */
6
+ export type RowStatus = 'changed' | 'removed' | 'added' | 'moved' | 'unchanged';
7
+ export declare const ROW_STATUSES: readonly RowStatus[];
8
+ /** Vorgabe des Filters „Alle Änderungen“: alles außer unverändert. */
9
+ export declare const CHANGE_STATUSES: readonly RowStatus[];
10
+ export type DiffField = 'text' | 'answer' | 'comment' | 'note';
11
+ export interface CompareRow {
12
+ row_id: string;
13
+ status: RowStatus | string;
14
+ location: string;
15
+ old_text: string;
16
+ new_text: string;
17
+ old_answer?: string;
18
+ new_answer?: string;
19
+ old_comment?: string;
20
+ new_comment?: string;
21
+ old_note?: string;
22
+ new_note?: string;
23
+ reason?: string;
24
+ /** `''`, `flowagent` (KI-Vorschlag) oder `article_law` (Änderungsbefehl). */
25
+ reason_source?: string;
26
+ reason_verified?: boolean | null;
27
+ reason_warning?: string;
28
+ selected?: boolean;
29
+ /** Wortdifferenz im Format von `difflib.ndiff` je Feld. */
30
+ diff?: Partial<Record<DiffField, readonly string[]>>;
31
+ }
32
+ export interface ConsolidatedParagraph {
33
+ section: string;
34
+ paragraph: number;
35
+ text: string;
36
+ repealed: boolean;
37
+ inserted: boolean;
38
+ }
39
+ export interface ComparisonMetadata {
40
+ comparison_type?: 'standard' | 'article_law' | string;
41
+ detected_mode?: string;
42
+ highlight_words?: boolean;
43
+ output_sections?: readonly string[];
44
+ pdf_notice?: string;
45
+ profile?: {
46
+ id: string;
47
+ version: string;
48
+ fingerprint: string;
49
+ };
50
+ old_label?: string;
51
+ new_label?: string;
52
+ reason_label?: string;
53
+ recognised_commands?: number;
54
+ open_commands?: readonly string[];
55
+ open_command_count?: number;
56
+ consolidated_text?: readonly ConsolidatedParagraph[];
57
+ work_aid_notice?: string;
58
+ [key: string]: unknown;
59
+ }
60
+ export interface ComparisonResult {
61
+ version: string;
62
+ mode: 'checklist' | 'text' | string;
63
+ old_filename: string;
64
+ new_filename: string;
65
+ old_sha256: string;
66
+ new_sha256: string;
67
+ old_count: number;
68
+ new_count: number;
69
+ matched_count: number;
70
+ changed_count: number;
71
+ removed_count: number;
72
+ added_count: number;
73
+ moved_count?: number;
74
+ rows: readonly CompareRow[];
75
+ created_at: string;
76
+ metadata?: ComparisonMetadata;
77
+ }
78
+ /** Ein gespeicherter Vergleich (`GET /comparisons/{id}`). */
79
+ export interface Comparison {
80
+ id: string;
81
+ title: string;
82
+ created_at: string;
83
+ result: ComparisonResult;
84
+ }
85
+ export interface ComparisonSummary {
86
+ id: string;
87
+ title: string;
88
+ created_at: string;
89
+ old_filename: string;
90
+ new_filename: string;
91
+ comparison_type: string;
92
+ counts: {
93
+ changed: number;
94
+ removed: number;
95
+ added: number;
96
+ moved: number;
97
+ };
98
+ }
99
+ export interface ComparisonProfile {
100
+ id: string;
101
+ version: string;
102
+ fingerprint: string;
103
+ status: string;
104
+ default: boolean;
105
+ }
106
+ /** Änderung einer Zeile (`PATCH /comparisons/{id}/rows`). */
107
+ export interface RowUpdate {
108
+ row_id: string;
109
+ selected?: boolean;
110
+ reason?: string;
111
+ }
112
+ export type SynopsisLayout = 'side-by-side' | 'inline';
113
+ export type ClientExportFormat = 'html' | 'markdown' | 'print';
114
+ export type ServerExportFormat = 'json' | 'markdown' | 'docx' | 'pdf';
115
+ /** Ergebnis eines Exports in der Oberfläche (Ereignis `export`). */
116
+ export interface ExportPayload {
117
+ format: ClientExportFormat;
118
+ filename: string;
119
+ mimeType: string;
120
+ content: string;
121
+ }