@superheld/summae-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/index.cjs +4404 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1251 -0
- package/dist/index.d.ts +1251 -0
- package/dist/index.js +4328 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
|
|
3
|
+
declare class Currency {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
readonly scale: number;
|
|
6
|
+
private constructor();
|
|
7
|
+
static of(code: string): Currency;
|
|
8
|
+
equals(other: Currency): boolean;
|
|
9
|
+
toJSON(): string;
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Betrag = Dezimalwert + Währung, nie Float (Glossar `money`).
|
|
15
|
+
*
|
|
16
|
+
* Determinismus-Regeln (determinismus.md §2):
|
|
17
|
+
* - Rundung: kaufmännisch half-up, von Null weg bei genau .5.
|
|
18
|
+
* - allocate: Largest-Remainder, Gleichstand → erster Teil; Σ Teile = Betrag, immer.
|
|
19
|
+
*
|
|
20
|
+
* Der Betrag liegt intern immer exakt auf der Währungsskala.
|
|
21
|
+
*/
|
|
22
|
+
declare class Money {
|
|
23
|
+
private readonly amount;
|
|
24
|
+
readonly currency: Currency;
|
|
25
|
+
private constructor();
|
|
26
|
+
private static currencyOf;
|
|
27
|
+
/**
|
|
28
|
+
* Exakter Betrag auf Währungsskala. Mehr Nachkommastellen als die Währung
|
|
29
|
+
* erlaubt sind ein Fehler — hier wird nie still gerundet.
|
|
30
|
+
*/
|
|
31
|
+
static of(amount: string, currency: Currency | string): Money;
|
|
32
|
+
/**
|
|
33
|
+
* Ergebnis einer Rechnung auf Währungsskala bringen: half-up
|
|
34
|
+
* (2.225 → 2.23, -2.345 → -2.35). Einziger Weg, auf dem Money rundet.
|
|
35
|
+
*/
|
|
36
|
+
static fromCalculation(value: Big | string, currency: Currency | string): Money;
|
|
37
|
+
static zero(currency: Currency | string): Money;
|
|
38
|
+
add(other: Money): Money;
|
|
39
|
+
subtract(other: Money): Money;
|
|
40
|
+
negate(): Money;
|
|
41
|
+
abs(): Money;
|
|
42
|
+
/** -1, 0 oder 1 */
|
|
43
|
+
compareTo(other: Money): number;
|
|
44
|
+
equals(other: Money): boolean;
|
|
45
|
+
isZero(): boolean;
|
|
46
|
+
isPositive(): boolean;
|
|
47
|
+
isNegative(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Verteilt den Betrag nach Gewichten (determinismus.md §2): Largest-Remainder,
|
|
50
|
+
* Gleichstand → erster Teil. Σ Teile = Betrag, immer.
|
|
51
|
+
*
|
|
52
|
+
* Gewichte: nicht-negative Dezimalwerte (Zahl oder String), Summe > 0.
|
|
53
|
+
* Negative Beträge werden als negiertes Spiegelbild verteilt.
|
|
54
|
+
*/
|
|
55
|
+
allocate(...weights: Array<number | string>): Money[];
|
|
56
|
+
/** Verteilung in n gleiche Teile (Sammelposten-Fünftel, AfA-Monatsraten). */
|
|
57
|
+
allocateEvenly(parts: number): Money[];
|
|
58
|
+
/** Betrag als String-Dezimal mit fester Skala, z. B. "1234.56" (datenformat.md). */
|
|
59
|
+
amountAsString(): string;
|
|
60
|
+
toJSON(): {
|
|
61
|
+
amount: string;
|
|
62
|
+
currency: string;
|
|
63
|
+
};
|
|
64
|
+
toString(): string;
|
|
65
|
+
private static fromMinor;
|
|
66
|
+
/** Dezimalgewichte verlustfrei auf ganzzahlige Gewichte gleicher Skala bringen. */
|
|
67
|
+
private static normalizeWeights;
|
|
68
|
+
private assertSameCurrency;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare function canonicalJson(value: unknown): string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Zeitquelle des Kerns (Determinismus-Hook). Bewusst eigenes Interface,
|
|
75
|
+
* PSR-20-/Temporal-kompatibel im Geist: liefert einen Zeitpunkt.
|
|
76
|
+
*/
|
|
77
|
+
interface Clock {
|
|
78
|
+
now(): Date;
|
|
79
|
+
}
|
|
80
|
+
/** Echte Systemzeit (Produktion). */
|
|
81
|
+
declare class SystemClock implements Clock {
|
|
82
|
+
now(): Date;
|
|
83
|
+
}
|
|
84
|
+
/** Feststehende Zeit für Tests und deterministische Läufe. */
|
|
85
|
+
declare class FixedClock implements Clock {
|
|
86
|
+
private current;
|
|
87
|
+
private constructor();
|
|
88
|
+
static at(iso8601: string): FixedClock;
|
|
89
|
+
now(): Date;
|
|
90
|
+
advanceMilliseconds(milliseconds: number): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare class Uuid {
|
|
94
|
+
readonly value: string;
|
|
95
|
+
private constructor();
|
|
96
|
+
static fromString(value: string): Uuid;
|
|
97
|
+
static v7(clock?: Clock): Uuid;
|
|
98
|
+
equals(other: Uuid): boolean;
|
|
99
|
+
/** Byteweise = zeitliche Ordnung bei v7. */
|
|
100
|
+
compareTo(other: Uuid): number;
|
|
101
|
+
toJSON(): string;
|
|
102
|
+
toString(): string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* ID-Quelle des Kerns — Port, damit Tests und Determinismus-Läufe die Erzeugung
|
|
107
|
+
* kontrollieren können. Produktion: UUIDv7.
|
|
108
|
+
*/
|
|
109
|
+
interface IdGenerator {
|
|
110
|
+
next(): Uuid;
|
|
111
|
+
}
|
|
112
|
+
/** Produktions-Generator: echte UUIDv7 aus Zeit + Zufall. */
|
|
113
|
+
declare class UuidV7IdGenerator implements IdGenerator {
|
|
114
|
+
private readonly clock;
|
|
115
|
+
constructor(clock?: Clock);
|
|
116
|
+
next(): Uuid;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* UUIDv7-förmige IDs aus fester Uhr + Zähler statt Zufall — für Tests und den
|
|
120
|
+
* Doppellauf-Determinismus-Check der Konformitätssuite (Strom-Hashes enthalten
|
|
121
|
+
* IDs; zwei Läufe müssen byte-identisch sein).
|
|
122
|
+
*/
|
|
123
|
+
declare class DeterministicIdGenerator implements IdGenerator {
|
|
124
|
+
private readonly clock;
|
|
125
|
+
private counter;
|
|
126
|
+
constructor(clock: Clock);
|
|
127
|
+
next(): Uuid;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Fachlich ungültiger Wert (Betrag, Gewicht, Code, UUID …). */
|
|
131
|
+
declare class InvalidValue extends Error {
|
|
132
|
+
constructor(message: string);
|
|
133
|
+
}
|
|
134
|
+
/** Verschiedene Währungen lassen sich nicht verrechnen. */
|
|
135
|
+
declare class CurrencyMismatch extends Error {
|
|
136
|
+
constructor(message: string);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare class CalendarDate {
|
|
140
|
+
readonly iso: string;
|
|
141
|
+
private constructor();
|
|
142
|
+
static of(iso: string): CalendarDate;
|
|
143
|
+
compareTo(other: CalendarDate): number;
|
|
144
|
+
equals(other: CalendarDate): boolean;
|
|
145
|
+
isBefore(other: CalendarDate): boolean;
|
|
146
|
+
isAfter(other: CalendarDate): boolean;
|
|
147
|
+
isBetween(start: CalendarDate, end: CalendarDate): boolean;
|
|
148
|
+
year(): number;
|
|
149
|
+
month(): number;
|
|
150
|
+
lastDayOfMonth(): CalendarDate;
|
|
151
|
+
firstDayOfNextMonth(): CalendarDate;
|
|
152
|
+
toJSON(): string;
|
|
153
|
+
toString(): string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Kontonummer als String — führende Nullen signifikant (datenformat.md).
|
|
158
|
+
* Vergleich nach Unicode-Codepoints, keine Locale-Collation: "10" < "9",
|
|
159
|
+
* "0420" < "1200" < "8400" (determinismus.md §3). JS-`<` auf Strings
|
|
160
|
+
* vergleicht UTF-16-Code-Units = Codepoints im BMP.
|
|
161
|
+
*/
|
|
162
|
+
declare class AccountNumber {
|
|
163
|
+
readonly value: string;
|
|
164
|
+
private constructor();
|
|
165
|
+
static of(value: string): AccountNumber;
|
|
166
|
+
compareTo(other: AccountNumber): number;
|
|
167
|
+
equals(other: AccountNumber): boolean;
|
|
168
|
+
toJSON(): string;
|
|
169
|
+
toString(): string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Verweis auf eine Periode: Geschäftsjahr + Periodennummer (datenformat.md
|
|
174
|
+
* `periodRef`). `fiscalYear` = Kalenderjahr des GJ-Endes.
|
|
175
|
+
*/
|
|
176
|
+
declare class PeriodRef {
|
|
177
|
+
readonly fiscalYear: number;
|
|
178
|
+
readonly period: number;
|
|
179
|
+
constructor(fiscalYear: number, period: number);
|
|
180
|
+
/** Chronologisch: erst Jahr, dann Periode. */
|
|
181
|
+
compareTo(other: PeriodRef): number;
|
|
182
|
+
equals(other: PeriodRef): boolean;
|
|
183
|
+
toJSON(): {
|
|
184
|
+
fiscalYear: number;
|
|
185
|
+
period: number;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Zusatzzuordnung einer Buchungsposition: Dimensionstyp + Wert-Code
|
|
191
|
+
* (datenformat.md). Gültigkeitsprüfung gegen Stammdaten passiert an der
|
|
192
|
+
* Operation (E_DIMENSION_INVALID), nicht hier.
|
|
193
|
+
*/
|
|
194
|
+
declare class DimensionValue {
|
|
195
|
+
readonly type: string;
|
|
196
|
+
readonly code: string;
|
|
197
|
+
private constructor();
|
|
198
|
+
static of(type: string, code: string): DimensionValue;
|
|
199
|
+
equals(other: DimensionValue): boolean;
|
|
200
|
+
toJSON(): {
|
|
201
|
+
type: string;
|
|
202
|
+
code: string;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Fachlicher Fehler mit Katalog-Code (fehlerkatalog.md). Vertragsteil: gleicher
|
|
208
|
+
* Verstoß → gleicher Code in allen Implementierungen. `message` ist frei,
|
|
209
|
+
* `details` trägt beteiligte IDs/Werte.
|
|
210
|
+
*/
|
|
211
|
+
declare class DomainError extends Error {
|
|
212
|
+
readonly errorCode: string;
|
|
213
|
+
readonly details: Record<string, unknown>;
|
|
214
|
+
constructor(errorCode: string, message?: string, details?: Record<string, unknown>);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Soll/Haben. */
|
|
218
|
+
type Side = 'debit' | 'credit';
|
|
219
|
+
/**
|
|
220
|
+
* Kontotyp bestimmt die Saldenmechanik (ledger-modell.md): Bestandskonten
|
|
221
|
+
* kumulieren über Jahre, Erfolgskonten je Geschäftsjahr.
|
|
222
|
+
*/
|
|
223
|
+
type AccountType = 'asset' | 'liability' | 'equity' | 'expense' | 'revenue';
|
|
224
|
+
/** Bestandskonto: Saldo trägt implizit vor (kein SBK/EBK). */
|
|
225
|
+
declare function isBalanceCarrying(type: AccountType): boolean;
|
|
226
|
+
declare function isAccountType(value: unknown): value is AccountType;
|
|
227
|
+
type AccountStatus = 'active' | 'locked';
|
|
228
|
+
/** GoBD-Lebenszyklus: erfasst (korrigierbar) → festgeschrieben (nur Storno). */
|
|
229
|
+
type EntryStatus = 'entered' | 'finalized';
|
|
230
|
+
type PeriodStatus = 'open' | 'closed';
|
|
231
|
+
type FiscalYearStatus = 'open' | 'closed';
|
|
232
|
+
type OpenItemKind = 'receivable' | 'payable';
|
|
233
|
+
type OpenItemStatus = 'open' | 'partially_settled' | 'settled';
|
|
234
|
+
/**
|
|
235
|
+
* Ausgleich mit Differenz (api.md G2): Skonto, Forderungsausfall, Kleindifferenz.
|
|
236
|
+
* Die Differenz muss als Buchungszeile(n) sichtbar sein (§ 17 UStG).
|
|
237
|
+
*/
|
|
238
|
+
type SettlementDifferenceKind = 'discount' | 'bad_debt' | 'minor';
|
|
239
|
+
declare function parseSettlementDifferenceKind(value: unknown): SettlementDifferenceKind | null;
|
|
240
|
+
declare function parseOpenItemKind(value: unknown): OpenItemKind | null;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Konto (ledger-modell.md Aggregat 2). Kein Saldo im Aggregat — Salden sind
|
|
244
|
+
* Projektionen des Journals, immer.
|
|
245
|
+
*/
|
|
246
|
+
declare class Account {
|
|
247
|
+
readonly id: Uuid;
|
|
248
|
+
readonly number: AccountNumber;
|
|
249
|
+
readonly name: string;
|
|
250
|
+
readonly type: AccountType;
|
|
251
|
+
readonly subtype: string | null;
|
|
252
|
+
private accountStatus;
|
|
253
|
+
constructor(id: Uuid, number: AccountNumber, name: string, type: AccountType, subtype: string | null, status?: AccountStatus);
|
|
254
|
+
status(): AccountStatus;
|
|
255
|
+
isLocked(): boolean;
|
|
256
|
+
lock(): void;
|
|
257
|
+
toJSON(): Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Buchungsposition — Value Object innerhalb der Buchung (keine eigene Identität;
|
|
262
|
+
* Referenz = Buchungs-ID + Positionsindex).
|
|
263
|
+
*/
|
|
264
|
+
declare class EntryLine {
|
|
265
|
+
readonly accountId: Uuid;
|
|
266
|
+
readonly account: AccountNumber;
|
|
267
|
+
readonly side: Side;
|
|
268
|
+
readonly money: Money;
|
|
269
|
+
readonly dimensions: DimensionValue[];
|
|
270
|
+
readonly taxTag: Record<string, unknown> | null;
|
|
271
|
+
constructor(accountId: Uuid, account: AccountNumber, side: Side, money: Money, dimensions?: DimensionValue[], taxTag?: Record<string, unknown> | null);
|
|
272
|
+
negated(): EntryLine;
|
|
273
|
+
toJSON(): Record<string, unknown>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Buchung — das wichtigste Aggregat (ledger-modell.md). Entsteht vollständig und
|
|
278
|
+
* gültig (Validierung im Ledger-Service); Lebenszyklus entered → finalized,
|
|
279
|
+
* danach nur Storno (neue Buchung mit Rückverweis, Generalumkehr).
|
|
280
|
+
*/
|
|
281
|
+
declare class JournalEntry {
|
|
282
|
+
readonly id: Uuid;
|
|
283
|
+
readonly sequenceNumber: number;
|
|
284
|
+
readonly entryDate: CalendarDate;
|
|
285
|
+
readonly voucherDate: CalendarDate | null;
|
|
286
|
+
readonly recordedAt: string;
|
|
287
|
+
readonly periodRef: PeriodRef;
|
|
288
|
+
readonly voucherId: Uuid;
|
|
289
|
+
readonly reverses: Uuid | null;
|
|
290
|
+
private entryText;
|
|
291
|
+
private entryLines;
|
|
292
|
+
private entryReversedBy;
|
|
293
|
+
private entryStatus;
|
|
294
|
+
constructor(id: Uuid, sequenceNumber: number, entryDate: CalendarDate, voucherDate: CalendarDate | null, recordedAt: string, periodRef: PeriodRef, voucherId: Uuid, text: string, lines: EntryLine[], reverses?: Uuid | null, reversedBy?: Uuid | null, status?: EntryStatus);
|
|
295
|
+
status(): EntryStatus;
|
|
296
|
+
isFinalized(): boolean;
|
|
297
|
+
text(): string;
|
|
298
|
+
lines(): EntryLine[];
|
|
299
|
+
reversedBy(): Uuid | null;
|
|
300
|
+
changeText(text: string): void;
|
|
301
|
+
changeLines(lines: EntryLine[]): void;
|
|
302
|
+
finalize(): void;
|
|
303
|
+
markReversed(reversalId: Uuid): void;
|
|
304
|
+
private assertCorrectable;
|
|
305
|
+
toJSON(): Record<string, unknown>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Beleg (ledger-modell.md Aggregat 4): existiert vor/ohne Buchung, mehrere
|
|
310
|
+
* Buchungen können ihn referenzieren. Metadaten für EÜR/USt (due, recurring,
|
|
311
|
+
* economicYear, serviceDate/servicePeriod, partnerId, kind …).
|
|
312
|
+
*/
|
|
313
|
+
interface VoucherProps {
|
|
314
|
+
readonly id: Uuid;
|
|
315
|
+
readonly voucherNumber: string;
|
|
316
|
+
readonly voucherDate: CalendarDate;
|
|
317
|
+
readonly due?: CalendarDate | null;
|
|
318
|
+
readonly recurring?: boolean;
|
|
319
|
+
readonly economicYear?: number | null;
|
|
320
|
+
readonly supplierTaxationMethod?: string | null;
|
|
321
|
+
readonly serviceDate?: CalendarDate | null;
|
|
322
|
+
readonly servicePeriodFrom?: CalendarDate | null;
|
|
323
|
+
readonly servicePeriodTo?: CalendarDate | null;
|
|
324
|
+
readonly kind?: string | null;
|
|
325
|
+
readonly partnerId?: Uuid | null;
|
|
326
|
+
readonly issuer?: string | null;
|
|
327
|
+
}
|
|
328
|
+
declare class Voucher {
|
|
329
|
+
readonly id: Uuid;
|
|
330
|
+
readonly voucherNumber: string;
|
|
331
|
+
readonly voucherDate: CalendarDate;
|
|
332
|
+
readonly due: CalendarDate | null;
|
|
333
|
+
readonly recurring: boolean;
|
|
334
|
+
readonly economicYear: number | null;
|
|
335
|
+
readonly supplierTaxationMethod: string | null;
|
|
336
|
+
readonly serviceDate: CalendarDate | null;
|
|
337
|
+
readonly servicePeriodFrom: CalendarDate | null;
|
|
338
|
+
readonly servicePeriodTo: CalendarDate | null;
|
|
339
|
+
readonly kind: string | null;
|
|
340
|
+
readonly partnerId: Uuid | null;
|
|
341
|
+
readonly issuer: string | null;
|
|
342
|
+
constructor(props: VoucherProps);
|
|
343
|
+
/** Steuerlich maßgebliches Datum: Leistungsdatum, Fallback Belegdatum. */
|
|
344
|
+
taxDate(): CalendarDate;
|
|
345
|
+
toJSON(): Record<string, unknown>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Periode — Entity innerhalb des FiscalYear-Aggregats (lückenlos,
|
|
350
|
+
* überlappungsfrei; Statuswechsel nur über das Aggregat).
|
|
351
|
+
*/
|
|
352
|
+
declare class Period {
|
|
353
|
+
readonly number: number;
|
|
354
|
+
readonly start: CalendarDate;
|
|
355
|
+
readonly end: CalendarDate;
|
|
356
|
+
private periodStatus;
|
|
357
|
+
constructor(number: number, start: CalendarDate, end: CalendarDate, status?: PeriodStatus);
|
|
358
|
+
status(): PeriodStatus;
|
|
359
|
+
isOpen(): boolean;
|
|
360
|
+
contains(date: CalendarDate): boolean;
|
|
361
|
+
/** Nur über FiscalYear aufrufen (Reihenfolgeprüfung dort). */
|
|
362
|
+
close(): void;
|
|
363
|
+
/** Nur über FiscalYear aufrufen (Jahresstatusprüfung dort). */
|
|
364
|
+
reopen(): void;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
interface PeriodDefinition {
|
|
368
|
+
readonly period: number;
|
|
369
|
+
readonly start: CalendarDate;
|
|
370
|
+
readonly end: CalendarDate;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Geschäftsjahr mit Perioden (ledger-modell.md Aggregat 3). Invarianten:
|
|
374
|
+
* Perioden lückenlos und überlappungsfrei; Schließen nur in Reihenfolge;
|
|
375
|
+
* Wiedereröffnen nur vor Jahresabschluss. `year` = Kalenderjahr des GJ-Endes.
|
|
376
|
+
*/
|
|
377
|
+
declare class FiscalYear {
|
|
378
|
+
readonly id: Uuid;
|
|
379
|
+
readonly year: number;
|
|
380
|
+
readonly start: CalendarDate;
|
|
381
|
+
readonly end: CalendarDate;
|
|
382
|
+
private readonly periodList;
|
|
383
|
+
private fiscalStatus;
|
|
384
|
+
private constructor();
|
|
385
|
+
static create(id: Uuid, year: number, start: CalendarDate, end: CalendarDate, explicitPeriods?: PeriodDefinition[] | null): FiscalYear;
|
|
386
|
+
private static monthlyPeriods;
|
|
387
|
+
status(): FiscalYearStatus;
|
|
388
|
+
isClosed(): boolean;
|
|
389
|
+
periods(): Period[];
|
|
390
|
+
period(number: number): Period;
|
|
391
|
+
contains(date: CalendarDate): boolean;
|
|
392
|
+
periodForDate(date: CalendarDate): Period;
|
|
393
|
+
closePeriod(number: number): Period;
|
|
394
|
+
reopenPeriod(number: number): Period;
|
|
395
|
+
/** Reiner Statuswechsel — keine fachliche Buchungswirkung (api.md v0.3). */
|
|
396
|
+
close(): void;
|
|
397
|
+
private assertNotClosed;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
type AuditChanges = Record<string, {
|
|
401
|
+
from: unknown;
|
|
402
|
+
to: unknown;
|
|
403
|
+
}>;
|
|
404
|
+
/**
|
|
405
|
+
* Audit-Eintrag (datenformat.md v0.3 `auditLog.jsonl`): flacher Vorher/Nachher-
|
|
406
|
+
* Diff nur der geänderten Felder.
|
|
407
|
+
*/
|
|
408
|
+
declare class AuditRecord {
|
|
409
|
+
readonly id: Uuid;
|
|
410
|
+
readonly at: string;
|
|
411
|
+
readonly actor: string;
|
|
412
|
+
readonly objectType: string;
|
|
413
|
+
readonly objectId: Uuid;
|
|
414
|
+
readonly action: string;
|
|
415
|
+
readonly changes: AuditChanges;
|
|
416
|
+
constructor(id: Uuid, at: string, actor: string, objectType: string, objectId: Uuid, action: string, changes?: AuditChanges);
|
|
417
|
+
toJSON(): Record<string, unknown>;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Einzelner Ausgleich eines offenen Postens. `money` ist der ausgeglichene
|
|
422
|
+
* OP-Betrag EINSCHLIESSLICH Differenz (api.md G2).
|
|
423
|
+
*/
|
|
424
|
+
declare class Settlement {
|
|
425
|
+
readonly entryId: Uuid;
|
|
426
|
+
readonly money: Money;
|
|
427
|
+
readonly settledAt: CalendarDate;
|
|
428
|
+
readonly differenceMoney: Money | null;
|
|
429
|
+
readonly differenceKind: SettlementDifferenceKind | null;
|
|
430
|
+
constructor(entryId: Uuid, money: Money, settledAt: CalendarDate, differenceMoney?: Money | null, differenceKind?: SettlementDifferenceKind | null);
|
|
431
|
+
toJSON(): Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Offener Posten (ledger-modell.md Aggregat 5): entsteht aus einer Buchung auf
|
|
436
|
+
* ein AR/AP-Konto, referenziert Ursprungsbuchung + Position. Invariante:
|
|
437
|
+
* Σ Ausgleiche ≤ Betrag; Teilausgleiche erlaubt.
|
|
438
|
+
*/
|
|
439
|
+
declare class OpenItem {
|
|
440
|
+
readonly id: Uuid;
|
|
441
|
+
readonly kind: OpenItemKind;
|
|
442
|
+
readonly originEntryId: Uuid;
|
|
443
|
+
readonly originLineIndex: number;
|
|
444
|
+
readonly money: Money;
|
|
445
|
+
readonly voucherId: Uuid;
|
|
446
|
+
readonly openedAt: CalendarDate;
|
|
447
|
+
readonly partnerId: Uuid | null;
|
|
448
|
+
private readonly settlementList;
|
|
449
|
+
constructor(id: Uuid, kind: OpenItemKind, originEntryId: Uuid, originLineIndex: number, money: Money, voucherId: Uuid, openedAt: CalendarDate, partnerId?: Uuid | null);
|
|
450
|
+
settlements(): Settlement[];
|
|
451
|
+
remaining(): Money;
|
|
452
|
+
/** Restbetrag zum Stichtag (null = heute/alles). */
|
|
453
|
+
remainingAt(asOf: CalendarDate | null): Money;
|
|
454
|
+
status(): OpenItemStatus;
|
|
455
|
+
statusAt(asOf: CalendarDate | null): OpenItemStatus;
|
|
456
|
+
settle(settlement: Settlement): void;
|
|
457
|
+
toJSON(): Record<string, unknown>;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Ergebnis von `post`: die Buchung plus die dabei entstandenen offenen Posten
|
|
462
|
+
* (AR/AP-Automatik — folgt mit dem Open-Items-Slice, daher vorerst leer).
|
|
463
|
+
*/
|
|
464
|
+
declare class PostResult {
|
|
465
|
+
readonly entry: JournalEntry;
|
|
466
|
+
readonly openItemsCreated: unknown[];
|
|
467
|
+
constructor(entry: JournalEntry, openItemsCreated: unknown[]);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface DimensionTypeData {
|
|
471
|
+
readonly code: string;
|
|
472
|
+
}
|
|
473
|
+
interface DimensionValueData {
|
|
474
|
+
readonly typeCode: string;
|
|
475
|
+
readonly code: string;
|
|
476
|
+
}
|
|
477
|
+
interface DimensionRuleData {
|
|
478
|
+
readonly accountRange: {
|
|
479
|
+
from: string;
|
|
480
|
+
to: string;
|
|
481
|
+
};
|
|
482
|
+
readonly requiredDimension: string;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Dimensions-Validierung: Mechanik im Kern, Inhalte als Regelmodul-Daten
|
|
486
|
+
* (ledger-modell.md). Typen/Werte sind Stammdaten; Pflichtdimensionen kommen
|
|
487
|
+
* aus `ruleModules.dimensionRules`.
|
|
488
|
+
*/
|
|
489
|
+
declare class DimensionRegistry {
|
|
490
|
+
private readonly types;
|
|
491
|
+
private readonly values;
|
|
492
|
+
private readonly rules;
|
|
493
|
+
private constructor();
|
|
494
|
+
static empty(): DimensionRegistry;
|
|
495
|
+
static fromData(dimensionTypes: DimensionTypeData[], dimensionValues: DimensionValueData[], dimensionRules: DimensionRuleData[]): DimensionRegistry;
|
|
496
|
+
validateLine(account: AccountNumber, dimensions: DimensionValue[]): void;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/** GWG-Weiche (SF-05): drei Pfade; die Grenzen sind Regelmodul-Daten. */
|
|
500
|
+
type AssetRoute = 'capitalize' | 'immediate_expense' | 'pool';
|
|
501
|
+
declare function parseAssetRoute(value: unknown): AssetRoute | null;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Anlagegut (assets-modell.md): Stammdaten + AfA-Plan + Lebenslauf. Invarianten:
|
|
505
|
+
* Restbuchwert = AHK − Σ Abschreibungen, nie < 0; keine AfA vor Zugang/nach Abgang.
|
|
506
|
+
*/
|
|
507
|
+
declare class Asset {
|
|
508
|
+
readonly id: Uuid;
|
|
509
|
+
readonly name: string;
|
|
510
|
+
readonly assetClass: string;
|
|
511
|
+
readonly assetAccount: AccountNumber;
|
|
512
|
+
readonly acquisitionCost: Money;
|
|
513
|
+
readonly acquiredOn: CalendarDate;
|
|
514
|
+
readonly route: AssetRoute;
|
|
515
|
+
readonly usefulLifeMonths: number | null;
|
|
516
|
+
readonly monthlySchedule: Money[];
|
|
517
|
+
readonly voucherId: Uuid;
|
|
518
|
+
private readonly depreciations;
|
|
519
|
+
private disposed;
|
|
520
|
+
private disposedOn;
|
|
521
|
+
constructor(id: Uuid, name: string, assetClass: string, assetAccount: AccountNumber, acquisitionCost: Money, acquiredOn: CalendarDate, route: AssetRoute, usefulLifeMonths: number | null, monthlySchedule: Money[], voucherId: Uuid);
|
|
522
|
+
isDisposed(): boolean;
|
|
523
|
+
assertActive(): void;
|
|
524
|
+
dispose(disposedOn: CalendarDate): void;
|
|
525
|
+
planMonthDate(planMonth: number): CalendarDate;
|
|
526
|
+
isMonthBooked(planMonth: number): boolean;
|
|
527
|
+
recordDepreciation(planMonth: number, date: CalendarDate, amount: Money, entryId: Uuid): void;
|
|
528
|
+
accumulatedDepreciationAt(asOf: CalendarDate | null): Money;
|
|
529
|
+
bookValueAt(asOf: CalendarDate | null): Money;
|
|
530
|
+
scheduleSummary(): Record<string, string>;
|
|
531
|
+
toJSON(): Record<string, unknown>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Geschäftspartner (datenformat.md v0.4) — bewusst schlank: OP-je-Partner,
|
|
536
|
+
* igL-Nachweis (USt-IdNr.), ZM-Grundlage, DATEV-Stammdaten.
|
|
537
|
+
*/
|
|
538
|
+
declare class Partner {
|
|
539
|
+
readonly id: Uuid;
|
|
540
|
+
private readonly accountNumbers;
|
|
541
|
+
private readonly address;
|
|
542
|
+
private partnerName;
|
|
543
|
+
private partnerKind;
|
|
544
|
+
private partnerVatId;
|
|
545
|
+
private partnerPaymentTermsDays;
|
|
546
|
+
constructor(id: Uuid, name: string, kind: string, vatId: string | null, paymentTermsDays: number | null, accountNumbers?: string[], address?: Record<string, unknown>);
|
|
547
|
+
name(): string;
|
|
548
|
+
vatId(): string | null;
|
|
549
|
+
update(input: Record<string, unknown>): AuditChanges;
|
|
550
|
+
toJSON(): Record<string, unknown>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** Kontonummern je Mandant eindeutig — der Adapter MUSS das zusichern. */
|
|
554
|
+
interface AccountRepository {
|
|
555
|
+
add(account: Account): void;
|
|
556
|
+
save(account: Account): void;
|
|
557
|
+
byNumber(number: AccountNumber): Account | null;
|
|
558
|
+
byId(id: Uuid): Account | null;
|
|
559
|
+
/** sortiert nach Kontonummer (Codepoints) */
|
|
560
|
+
all(): Account[];
|
|
561
|
+
}
|
|
562
|
+
interface FiscalYearRepository {
|
|
563
|
+
add(fiscalYear: FiscalYear): void;
|
|
564
|
+
save(fiscalYear: FiscalYear): void;
|
|
565
|
+
byYear(year: number): FiscalYear | null;
|
|
566
|
+
forDate(date: CalendarDate): FiscalYear | null;
|
|
567
|
+
/** sortiert nach Jahr */
|
|
568
|
+
all(): FiscalYear[];
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Journal: append-only, lückenlose sequenceNumber je Geschäftsjahr. `save`
|
|
572
|
+
* persistiert Statuswechsel; der Eintrag selbst wird nie gelöscht.
|
|
573
|
+
*/
|
|
574
|
+
interface JournalRepository {
|
|
575
|
+
append(entry: JournalEntry): void;
|
|
576
|
+
save(entry: JournalEntry): void;
|
|
577
|
+
byId(id: Uuid): JournalEntry | null;
|
|
578
|
+
nextSequenceNumber(fiscalYear: number): number;
|
|
579
|
+
/** sortiert nach (fiscalYear, sequenceNumber) */
|
|
580
|
+
all(): JournalEntry[];
|
|
581
|
+
/** sortiert nach sequenceNumber */
|
|
582
|
+
forFiscalYear(fiscalYear: number): JournalEntry[];
|
|
583
|
+
}
|
|
584
|
+
interface VoucherRepository {
|
|
585
|
+
add(voucher: Voucher): void;
|
|
586
|
+
byId(id: Uuid): Voucher | null;
|
|
587
|
+
/** sortiert nach ID */
|
|
588
|
+
all(): Voucher[];
|
|
589
|
+
}
|
|
590
|
+
interface OpenItemRepository {
|
|
591
|
+
add(item: OpenItem): void;
|
|
592
|
+
save(item: OpenItem): void;
|
|
593
|
+
byId(id: Uuid): OpenItem | null;
|
|
594
|
+
/** Posten, die aus dieser Buchung entstanden */
|
|
595
|
+
byOriginEntry(entryId: Uuid): OpenItem[];
|
|
596
|
+
/** in Entstehungsreihenfolge */
|
|
597
|
+
all(): OpenItem[];
|
|
598
|
+
}
|
|
599
|
+
/** Audit-Trail ist Formatbestandteil (datenformat.md v0.3): append-only. */
|
|
600
|
+
interface AuditTrail {
|
|
601
|
+
append(record: AuditRecord): void;
|
|
602
|
+
/** in Erfassungsreihenfolge */
|
|
603
|
+
all(): AuditRecord[];
|
|
604
|
+
}
|
|
605
|
+
interface AssetRepository {
|
|
606
|
+
add(asset: Asset): void;
|
|
607
|
+
save(asset: Asset): void;
|
|
608
|
+
byId(id: Uuid): Asset | null;
|
|
609
|
+
/** in Zugangsreihenfolge */
|
|
610
|
+
all(): Asset[];
|
|
611
|
+
}
|
|
612
|
+
interface PartnerRepository {
|
|
613
|
+
add(partner: Partner): void;
|
|
614
|
+
save(partner: Partner): void;
|
|
615
|
+
byId(id: Uuid): Partner | null;
|
|
616
|
+
/** sortiert nach Name, dann ID */
|
|
617
|
+
all(): Partner[];
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Domain Service `post` und Verwandte (ledger-modell.md). Prüfreihenfolge beim
|
|
622
|
+
* Buchen ist Vertragsbestandteil (api.md):
|
|
623
|
+
* 1. Struktur (E_ENTRY_TOO_FEW_LINES, E_ENTRY_INVALID_AMOUNT)
|
|
624
|
+
* 2. Referenzen (E_ENTRY_NO_VOUCHER, E_VOUCHER_UNKNOWN, E_ACCOUNT_UNKNOWN,
|
|
625
|
+
* E_ACCOUNT_LOCKED, E_DIMENSION_INVALID)
|
|
626
|
+
* 3. Bilanzgleichung (E_ENTRY_UNBALANCED)
|
|
627
|
+
* 4. Zeitlicher Kontext (E_PERIOD_UNKNOWN, E_PERIOD_CLOSED)
|
|
628
|
+
* Nur der erste Fehler wird gemeldet.
|
|
629
|
+
*/
|
|
630
|
+
declare class Ledger {
|
|
631
|
+
private readonly baseCurrency;
|
|
632
|
+
private readonly accounts;
|
|
633
|
+
private readonly fiscalYears;
|
|
634
|
+
private readonly vouchers;
|
|
635
|
+
private readonly journal;
|
|
636
|
+
private readonly openItems;
|
|
637
|
+
private readonly audit;
|
|
638
|
+
private readonly dimensions;
|
|
639
|
+
private readonly clock;
|
|
640
|
+
private readonly ids;
|
|
641
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, fiscalYears: FiscalYearRepository, vouchers: VoucherRepository, journal: JournalRepository, openItems: OpenItemRepository, audit: AuditTrail, dimensions: DimensionRegistry, clock: Clock, ids: IdGenerator);
|
|
642
|
+
post(input: Record<string, unknown>): PostResult;
|
|
643
|
+
/**
|
|
644
|
+
* AR/AP-Automatik: Soll auf Forderungskonto → receivable, Haben auf
|
|
645
|
+
* Verbindlichkeitskonto → payable. Stornobuchungen erzeugen keine Posten.
|
|
646
|
+
*/
|
|
647
|
+
private createOpenItems;
|
|
648
|
+
/**
|
|
649
|
+
* Ausgleich: Zuordnung Zahlung → offene(r) Posten, auch teilweise; immer
|
|
650
|
+
* explizit, kein FIFO (determinismus.md §3). Differenzen (Skonto/Ausfall/
|
|
651
|
+
* Kleindifferenz) nach api.md G2. Erst vollständig validieren, dann anwenden.
|
|
652
|
+
*/
|
|
653
|
+
settle(input: Record<string, unknown>): OpenItem[];
|
|
654
|
+
private parseSettlementMoney;
|
|
655
|
+
private parseDifference;
|
|
656
|
+
correct(input: Record<string, unknown>): JournalEntry;
|
|
657
|
+
finalize(input: Record<string, unknown>): number;
|
|
658
|
+
reverse(input: Record<string, unknown>): JournalEntry;
|
|
659
|
+
closePeriod(input: Record<string, unknown>): {
|
|
660
|
+
fiscalYear: number;
|
|
661
|
+
period: number;
|
|
662
|
+
status: string;
|
|
663
|
+
};
|
|
664
|
+
reopenPeriod(input: Record<string, unknown>): {
|
|
665
|
+
fiscalYear: number;
|
|
666
|
+
period: number;
|
|
667
|
+
status: string;
|
|
668
|
+
};
|
|
669
|
+
closeFiscalYear(input: Record<string, unknown>): FiscalYear;
|
|
670
|
+
createFiscalYear(input: Record<string, unknown>): FiscalYear;
|
|
671
|
+
createAccount(input: Record<string, unknown>): Account;
|
|
672
|
+
lockAccount(input: Record<string, unknown>): Account;
|
|
673
|
+
importChartOfAccounts(input: Record<string, unknown>): number;
|
|
674
|
+
private actor;
|
|
675
|
+
private parseLine;
|
|
676
|
+
private requireVoucher;
|
|
677
|
+
private resolveLines;
|
|
678
|
+
private assertBalanced;
|
|
679
|
+
private parseEntryDate;
|
|
680
|
+
private openPeriodFor;
|
|
681
|
+
private requireEntry;
|
|
682
|
+
private requireFiscalYear;
|
|
683
|
+
private periodNumber;
|
|
684
|
+
private buildAccount;
|
|
685
|
+
private recordAudit;
|
|
686
|
+
private now;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
declare class InMemoryAccountRepository implements AccountRepository {
|
|
690
|
+
private readonly byNumberMap;
|
|
691
|
+
private readonly byIdMap;
|
|
692
|
+
add(account: Account): void;
|
|
693
|
+
save(_account: Account): void;
|
|
694
|
+
byNumber(number: AccountNumber): Account | null;
|
|
695
|
+
byId(id: Uuid): Account | null;
|
|
696
|
+
all(): Account[];
|
|
697
|
+
}
|
|
698
|
+
declare class InMemoryFiscalYearRepository implements FiscalYearRepository {
|
|
699
|
+
private readonly byYearMap;
|
|
700
|
+
add(fiscalYear: FiscalYear): void;
|
|
701
|
+
save(_fiscalYear: FiscalYear): void;
|
|
702
|
+
byYear(year: number): FiscalYear | null;
|
|
703
|
+
forDate(date: CalendarDate): FiscalYear | null;
|
|
704
|
+
all(): FiscalYear[];
|
|
705
|
+
}
|
|
706
|
+
declare class InMemoryJournalRepository implements JournalRepository {
|
|
707
|
+
private readonly entries;
|
|
708
|
+
private readonly byIdMap;
|
|
709
|
+
private readonly sequences;
|
|
710
|
+
append(entry: JournalEntry): void;
|
|
711
|
+
save(_entry: JournalEntry): void;
|
|
712
|
+
byId(id: Uuid): JournalEntry | null;
|
|
713
|
+
nextSequenceNumber(fiscalYear: number): number;
|
|
714
|
+
all(): JournalEntry[];
|
|
715
|
+
forFiscalYear(fiscalYear: number): JournalEntry[];
|
|
716
|
+
}
|
|
717
|
+
declare class InMemoryVoucherRepository implements VoucherRepository {
|
|
718
|
+
private readonly byIdMap;
|
|
719
|
+
add(voucher: Voucher): void;
|
|
720
|
+
byId(id: Uuid): Voucher | null;
|
|
721
|
+
all(): Voucher[];
|
|
722
|
+
}
|
|
723
|
+
declare class InMemoryOpenItemRepository implements OpenItemRepository {
|
|
724
|
+
private readonly items;
|
|
725
|
+
private readonly byIdMap;
|
|
726
|
+
add(item: OpenItem): void;
|
|
727
|
+
save(_item: OpenItem): void;
|
|
728
|
+
byId(id: Uuid): OpenItem | null;
|
|
729
|
+
byOriginEntry(entryId: Uuid): OpenItem[];
|
|
730
|
+
all(): OpenItem[];
|
|
731
|
+
}
|
|
732
|
+
declare class InMemoryAuditTrail implements AuditTrail {
|
|
733
|
+
private readonly records;
|
|
734
|
+
append(record: AuditRecord): void;
|
|
735
|
+
all(): AuditRecord[];
|
|
736
|
+
}
|
|
737
|
+
declare class InMemoryPartnerRepository implements PartnerRepository {
|
|
738
|
+
private readonly byIdMap;
|
|
739
|
+
add(partner: Partner): void;
|
|
740
|
+
save(_partner: Partner): void;
|
|
741
|
+
byId(id: Uuid): Partner | null;
|
|
742
|
+
all(): Partner[];
|
|
743
|
+
}
|
|
744
|
+
declare class InMemoryAssetRepository implements AssetRepository {
|
|
745
|
+
private readonly items;
|
|
746
|
+
private readonly byIdMap;
|
|
747
|
+
add(asset: Asset): void;
|
|
748
|
+
save(_asset: Asset): void;
|
|
749
|
+
byId(id: Uuid): Asset | null;
|
|
750
|
+
all(): Asset[];
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Anlagen-Nebenbuch (assets-modell.md): GWG-Weiche beim Zugang, AfA-Lauf
|
|
755
|
+
* idempotent je Lauf-Ziel, Buchungen über den Ledger (sofort festgeschrieben).
|
|
756
|
+
* AfA-Verteilung: Monatswerte = allocate der AHK über die Laufzeit (flach).
|
|
757
|
+
*/
|
|
758
|
+
declare class AssetService {
|
|
759
|
+
private readonly baseCurrency;
|
|
760
|
+
private readonly assets;
|
|
761
|
+
private readonly fiscalYears;
|
|
762
|
+
private readonly vouchers;
|
|
763
|
+
private readonly ledger;
|
|
764
|
+
private readonly ids;
|
|
765
|
+
private ruleModule;
|
|
766
|
+
constructor(baseCurrency: Currency, assets: AssetRepository, fiscalYears: FiscalYearRepository, vouchers: VoucherRepository, ledger: Ledger, ids: IdGenerator);
|
|
767
|
+
setRuleModule(ruleModule: Record<string, unknown>): void;
|
|
768
|
+
acquire(input: Record<string, unknown>): Record<string, unknown>;
|
|
769
|
+
dispose(input: Record<string, unknown>): Record<string, unknown>;
|
|
770
|
+
runDepreciation(input: Record<string, unknown>): Record<string, unknown>;
|
|
771
|
+
requireAsset(assetId: unknown): Asset;
|
|
772
|
+
private yearTarget;
|
|
773
|
+
private monthTarget;
|
|
774
|
+
private monthAmounts;
|
|
775
|
+
private bookingDate;
|
|
776
|
+
private postMachineEntry;
|
|
777
|
+
private depreciationVoucher;
|
|
778
|
+
private resolveRoute;
|
|
779
|
+
private thresholds;
|
|
780
|
+
private usefulLifeMonths;
|
|
781
|
+
private counterAccount;
|
|
782
|
+
private depreciationExpenseAccount;
|
|
783
|
+
private gwgExpenseAccount;
|
|
784
|
+
private assetAccount;
|
|
785
|
+
private parseMoney;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Abrechnungslauf (costing-modell.md Aggregat 1): je Periode + Version eindeutig;
|
|
790
|
+
* Wiederholung erzeugt neue Version. draft → released.
|
|
791
|
+
*/
|
|
792
|
+
declare class CostingRun {
|
|
793
|
+
readonly id: Uuid;
|
|
794
|
+
readonly period: PeriodRef;
|
|
795
|
+
readonly version: number;
|
|
796
|
+
readonly primary: Map<string, Money>;
|
|
797
|
+
readonly afterAllocation: Map<string, Money>;
|
|
798
|
+
readonly grandTotal: Money;
|
|
799
|
+
private runStatus;
|
|
800
|
+
constructor(id: Uuid, period: PeriodRef, version: number, primary: Map<string, Money>, afterAllocation: Map<string, Money>, grandTotal: Money);
|
|
801
|
+
status(): string;
|
|
802
|
+
release(): void;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* KLR-Abrechnung (costing-modell.md): eigener Rechnungskreis — das Fibu-Journal
|
|
807
|
+
* bleibt unberührt. Primärkostenübernahme über costCenter-Dimension, Umlage per
|
|
808
|
+
* Stufenleiter (zyklenfrei, E_COSTING_CYCLE), Verteilung per Money.allocate.
|
|
809
|
+
*/
|
|
810
|
+
declare class CostingService {
|
|
811
|
+
private readonly baseCurrency;
|
|
812
|
+
private readonly accounts;
|
|
813
|
+
private readonly journal;
|
|
814
|
+
private readonly ids;
|
|
815
|
+
private schemeSteps;
|
|
816
|
+
private readonly runs;
|
|
817
|
+
private readonly versions;
|
|
818
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository, ids: IdGenerator);
|
|
819
|
+
setAllocationScheme(input: Record<string, unknown>): Record<string, unknown>;
|
|
820
|
+
run(input: Record<string, unknown>): CostingRun;
|
|
821
|
+
release(input: Record<string, unknown>): CostingRun;
|
|
822
|
+
costAllocationSheet(params: Record<string, unknown>): Record<string, unknown>;
|
|
823
|
+
private serializeTotals;
|
|
824
|
+
private requireRun;
|
|
825
|
+
private assertAcyclic;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/** Partner-Operationen (api.md v0.4): createPartner / updatePartner mit Audit. */
|
|
829
|
+
declare class PartnerService {
|
|
830
|
+
private readonly partners;
|
|
831
|
+
private readonly audit;
|
|
832
|
+
private readonly clock;
|
|
833
|
+
private readonly ids;
|
|
834
|
+
constructor(partners: PartnerRepository, audit: AuditTrail, clock: Clock, ids: IdGenerator);
|
|
835
|
+
create(input: Record<string, unknown>): Partner;
|
|
836
|
+
update(input: Record<string, unknown>): Partner;
|
|
837
|
+
require(partnerId: unknown): Partner;
|
|
838
|
+
private recordAudit;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Regelversion eines Steuerschlüssels mit Gültigkeitszeitraum. Inhalte sind
|
|
843
|
+
* Regelmodul-Daten — Code zitiert kein Gesetz. mechanism `reverse_charge`:
|
|
844
|
+
* USt- und VSt-Position gleichzeitig; `intra_community_supply`: steuerfrei.
|
|
845
|
+
*/
|
|
846
|
+
declare class TaxCodeVersion {
|
|
847
|
+
readonly validFrom: CalendarDate;
|
|
848
|
+
readonly validTo: CalendarDate | null;
|
|
849
|
+
readonly rate: string;
|
|
850
|
+
readonly taxAccount: string;
|
|
851
|
+
readonly reportingKey: string | null;
|
|
852
|
+
readonly mechanism: string;
|
|
853
|
+
readonly inputTaxAccount: string | null;
|
|
854
|
+
readonly inputReportingKey: string | null;
|
|
855
|
+
readonly baseReportingKey: string | null;
|
|
856
|
+
constructor(validFrom: CalendarDate, validTo: CalendarDate | null, rate: string, taxAccount: string, reportingKey: string | null, mechanism?: string, inputTaxAccount?: string | null, inputReportingKey?: string | null, baseReportingKey?: string | null);
|
|
857
|
+
coversDate(date: CalendarDate): boolean;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Steuerschlüssel (tax-modell.md Aggregat 1): gebündelter Steuersachverhalt als
|
|
862
|
+
* Liste von Regelversionen. Versionswahl folgt dem Belegdatum.
|
|
863
|
+
*/
|
|
864
|
+
declare class TaxCode {
|
|
865
|
+
readonly code: string;
|
|
866
|
+
readonly versions: TaxCodeVersion[];
|
|
867
|
+
readonly datevBu: string | null;
|
|
868
|
+
constructor(code: string, versions: TaxCodeVersion[], datevBu?: string | null);
|
|
869
|
+
versionFor(date: CalendarDate): TaxCodeVersion;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/** Geladene, validierte Form der Steuerschlüssel-Regelmodul-Daten. */
|
|
873
|
+
declare class TaxCodeRegistry {
|
|
874
|
+
private readonly codes;
|
|
875
|
+
private constructor();
|
|
876
|
+
static empty(): TaxCodeRegistry;
|
|
877
|
+
static fromData(data: Array<Record<string, unknown>>): TaxCodeRegistry;
|
|
878
|
+
allVersions(): TaxCodeVersion[];
|
|
879
|
+
datevBuFor(code: string): string | null;
|
|
880
|
+
get(code: string): TaxCode;
|
|
881
|
+
versionFor(code: string, date: CalendarDate): TaxCodeVersion;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* ZM-Grundlage (v0.4, SF-21): innergemeinschaftliche Umsätze je USt-IdNr. und
|
|
886
|
+
* Zeitraum — aus Kennzahl-Tags der igL-Schlüssel, Partner über den Beleg.
|
|
887
|
+
*/
|
|
888
|
+
declare class EcSalesListProjection {
|
|
889
|
+
private readonly baseCurrency;
|
|
890
|
+
private readonly journal;
|
|
891
|
+
private readonly vouchers;
|
|
892
|
+
private readonly partners;
|
|
893
|
+
private readonly registry;
|
|
894
|
+
constructor(baseCurrency: Currency, journal: JournalRepository, vouchers: VoucherRepository, partners: PartnerRepository, registry: TaxCodeRegistry);
|
|
895
|
+
compute(params: Record<string, unknown>): {
|
|
896
|
+
rows: Array<Record<string, string>>;
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Summen- und Saldenliste (SuSa) — Spalten verbindlich (api.md v0.4):
|
|
902
|
+
* - openingBalance: kumulierter Saldo VOR dem GJ (0 bei Erfolgskonten)
|
|
903
|
+
* - debitTotal/creditTotal: Verkehrszahlen des Zeitraums (GJ bis Periode)
|
|
904
|
+
* - balance = openingBalance + debitTotal − creditTotal (Soll-Salden positiv)
|
|
905
|
+
* Sortierung: Kontonummer nach Codepoints (determinismus.md §3).
|
|
906
|
+
*/
|
|
907
|
+
declare class TrialBalanceProjection {
|
|
908
|
+
private readonly baseCurrency;
|
|
909
|
+
private readonly accounts;
|
|
910
|
+
private readonly journal;
|
|
911
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository);
|
|
912
|
+
compute(params: Record<string, unknown>): {
|
|
913
|
+
rows: Array<Record<string, string>>;
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* OP-Liste: deterministisch, asOf-fähig (Zeitreise über settledAt). Sortierung:
|
|
919
|
+
* voucherDate, dann sequenceNumber (determinismus.md §3).
|
|
920
|
+
*/
|
|
921
|
+
declare class OpenItemsProjection {
|
|
922
|
+
private readonly openItems;
|
|
923
|
+
private readonly vouchers;
|
|
924
|
+
private readonly journal;
|
|
925
|
+
constructor(openItems: OpenItemRepository, vouchers: VoucherRepository, journal: JournalRepository);
|
|
926
|
+
compute(params: Record<string, unknown>): {
|
|
927
|
+
items: Array<Record<string, unknown>>;
|
|
928
|
+
};
|
|
929
|
+
private voucherDate;
|
|
930
|
+
private sequenceNumber;
|
|
931
|
+
private serializeItem;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Kontoblatt: alle Bewegungen eines Kontos im Geschäftsjahr mit laufendem Saldo.
|
|
936
|
+
* Anfangsbestand = kumulierte Vorjahre für Bestandskonten, null für Erfolgskonten.
|
|
937
|
+
* Ordnung: sequenceNumber (determinismus.md §3).
|
|
938
|
+
*/
|
|
939
|
+
declare class AccountSheetProjection {
|
|
940
|
+
private readonly baseCurrency;
|
|
941
|
+
private readonly accounts;
|
|
942
|
+
private readonly journal;
|
|
943
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository);
|
|
944
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Änderungshistorie als Projektion (F-CORE-014). Reihenfolge =
|
|
949
|
+
* Erfassungsreihenfolge des Audit-Trails.
|
|
950
|
+
*/
|
|
951
|
+
declare class AuditLogProjection {
|
|
952
|
+
private readonly audit;
|
|
953
|
+
constructor(audit: AuditTrail);
|
|
954
|
+
compute(params: Record<string, unknown>): {
|
|
955
|
+
records: Array<Record<string, unknown>>;
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Steuerliches Mandantenprofil (tax-modell.md Aggregat 2): Versteuerungsart,
|
|
961
|
+
* Kleinunternehmer-Status mit Gültigkeitszeitraum (unterjähriger Wechsel,
|
|
962
|
+
* SF-11), Voranmeldungszeitraum.
|
|
963
|
+
*/
|
|
964
|
+
declare class TaxProfile {
|
|
965
|
+
private readonly method;
|
|
966
|
+
private smallBusiness;
|
|
967
|
+
private readonly period;
|
|
968
|
+
private constructor();
|
|
969
|
+
static fromData(data: Record<string, unknown>): TaxProfile;
|
|
970
|
+
static default(): TaxProfile;
|
|
971
|
+
taxationMethod(): string;
|
|
972
|
+
isCashBasis(): boolean;
|
|
973
|
+
vatPeriod(): string;
|
|
974
|
+
smallBusinessAt(date: CalendarDate): boolean;
|
|
975
|
+
setSmallBusiness(validFrom: CalendarDate, value: boolean): void;
|
|
976
|
+
private static sorted;
|
|
977
|
+
toJSON(): Record<string, unknown>;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* USt-VA-Kennzahlen über taxTags (SF-09). Soll: Buchungs-/Leistungsdatum; Ist:
|
|
982
|
+
* folgt OP-Ausgleichen (anteilig half-up, Schlussrest exakt). Bemessungsgrund-
|
|
983
|
+
* lagen je Kennzahl auf volle Euro abgerundet, Steuer centgenau (api.md v0.3).
|
|
984
|
+
*/
|
|
985
|
+
declare class VatReturnProjection {
|
|
986
|
+
private readonly baseCurrency;
|
|
987
|
+
private readonly journal;
|
|
988
|
+
private readonly openItems;
|
|
989
|
+
private readonly vouchers;
|
|
990
|
+
private readonly accounts;
|
|
991
|
+
private readonly registry;
|
|
992
|
+
private readonly profile;
|
|
993
|
+
constructor(baseCurrency: Currency, journal: JournalRepository, openItems: OpenItemRepository, vouchers: VoucherRepository, accounts: AccountRepository, registry: TaxCodeRegistry, profile: TaxProfile);
|
|
994
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
995
|
+
private registryDirections;
|
|
996
|
+
private accountDirection;
|
|
997
|
+
private entryContributions;
|
|
998
|
+
private tagBaseMoney;
|
|
999
|
+
private allocateToSettlements;
|
|
1000
|
+
private proportional;
|
|
1001
|
+
private inQuarter;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
interface MappingLeaf {
|
|
1005
|
+
key: string;
|
|
1006
|
+
label: string;
|
|
1007
|
+
side: string | null;
|
|
1008
|
+
ranges: Array<{
|
|
1009
|
+
from: string;
|
|
1010
|
+
to: string;
|
|
1011
|
+
}>;
|
|
1012
|
+
numbers: string[];
|
|
1013
|
+
includeNonCash: boolean;
|
|
1014
|
+
includesNetIncome: boolean;
|
|
1015
|
+
parents: string[];
|
|
1016
|
+
}
|
|
1017
|
+
/** Trifft ein Blatt eine Kontonummer? (Einzelnummern oder Codepoint-Bereiche.) */
|
|
1018
|
+
declare function leafMatches(leaf: MappingLeaf, accountNumber: string): boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* Gliederungs-Mapping (datenformat.md v0.2): ordnet Konten Positionen zu —
|
|
1021
|
+
* gleiche Struktur für Bilanz, GuV, EÜR-Zeilen und VA-Kennzahlen.
|
|
1022
|
+
*/
|
|
1023
|
+
declare class Mapping {
|
|
1024
|
+
readonly id: string;
|
|
1025
|
+
readonly kind: string;
|
|
1026
|
+
readonly version: string;
|
|
1027
|
+
readonly leaves: MappingLeaf[];
|
|
1028
|
+
constructor(id: string, kind: string, version: string, leaves: MappingLeaf[]);
|
|
1029
|
+
static fromData(data: Record<string, unknown>): Mapping;
|
|
1030
|
+
private static collectLeaves;
|
|
1031
|
+
leafFor(accountNumber: string): MappingLeaf | null;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/** Geladene Mappings eines Mandanten (mutierbar über importMapping). */
|
|
1035
|
+
declare class MappingRegistry {
|
|
1036
|
+
private readonly byIdMap;
|
|
1037
|
+
static empty(): MappingRegistry;
|
|
1038
|
+
static fromRuleModules(raw: unknown[]): MappingRegistry;
|
|
1039
|
+
add(mapping: Mapping): void;
|
|
1040
|
+
byId(id: string): Mapping | null;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* GuV als Projektion über ein Mapping (SF-09). Vorzeichen: Haben − Soll
|
|
1045
|
+
* (Erträge positiv, Aufwand negativ); netIncome = Summe der Positionen.
|
|
1046
|
+
* fromPeriod/throughPeriod grenzen ab (Monats-GuV als BWA-Grundlage).
|
|
1047
|
+
*/
|
|
1048
|
+
declare class IncomeStatementProjection {
|
|
1049
|
+
private readonly baseCurrency;
|
|
1050
|
+
private readonly accounts;
|
|
1051
|
+
private readonly journal;
|
|
1052
|
+
private readonly mappings;
|
|
1053
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository, mappings: MappingRegistry);
|
|
1054
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Bilanz als Projektion (SF-10): kumulativ zum Stichtag. Position mit
|
|
1059
|
+
* includesNetIncome enthält die kumulierten Jahresergebnisse + eigenen Saldo.
|
|
1060
|
+
* Seite (v0.5/F-007): `side` am Wurzelknoten; assets = Soll−Haben,
|
|
1061
|
+
* liabilitiesAndEquity = Haben−Soll. Default: assets.
|
|
1062
|
+
*/
|
|
1063
|
+
declare class BalanceSheetProjection {
|
|
1064
|
+
private readonly baseCurrency;
|
|
1065
|
+
private readonly accounts;
|
|
1066
|
+
private readonly journal;
|
|
1067
|
+
private readonly mappings;
|
|
1068
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository, mappings: MappingRegistry);
|
|
1069
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* EÜR als Projektion über das doppische Journal — Regeln R1–R7
|
|
1074
|
+
* (euer-projektions-beweis.md). Zahlungswirksamkeit über Geldkonten, OP-Link bei
|
|
1075
|
+
* Ausgleich (anteilig), 10-Tage-Regel, USt zahlungswirksam, R7 includeNonCash.
|
|
1076
|
+
* Kalenderjahrgebunden: abweichendes GJ → E_CASHBASIS_DEVIATING_FISCAL_YEAR.
|
|
1077
|
+
*/
|
|
1078
|
+
declare class CashBasisProjection {
|
|
1079
|
+
private readonly baseCurrency;
|
|
1080
|
+
private readonly accounts;
|
|
1081
|
+
private readonly journal;
|
|
1082
|
+
private readonly openItems;
|
|
1083
|
+
private readonly vouchers;
|
|
1084
|
+
private readonly fiscalYears;
|
|
1085
|
+
private readonly mappings;
|
|
1086
|
+
constructor(baseCurrency: Currency, accounts: AccountRepository, journal: JournalRepository, openItems: OpenItemRepository, vouchers: VoucherRepository, fiscalYears: FiscalYearRepository, mappings: MappingRegistry);
|
|
1087
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
1088
|
+
private assertCalendarYearFiscalYears;
|
|
1089
|
+
private bankFlow;
|
|
1090
|
+
private assignYear;
|
|
1091
|
+
private inTenDayWindow;
|
|
1092
|
+
private sourceLines;
|
|
1093
|
+
private proportional;
|
|
1094
|
+
private label;
|
|
1095
|
+
private serializeBucket;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Anlageverzeichnis (Pflicht auch bei EÜR, § 4 Abs. 3 S. 5 EStG). Sortierung:
|
|
1100
|
+
* Zugangsdatum, dann ID (deterministisch).
|
|
1101
|
+
*/
|
|
1102
|
+
declare class AssetRegisterProjection {
|
|
1103
|
+
private readonly assets;
|
|
1104
|
+
constructor(assets: AssetRepository);
|
|
1105
|
+
compute(params: Record<string, unknown>): {
|
|
1106
|
+
assets: Array<Record<string, unknown>>;
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* GoBD-Z3-Export (SF-14): Manifest mit SHA-256-Strom-Hashes über RFC-8785-
|
|
1112
|
+
* kanonisierte Zeilen, Feldkatalog, Journal vollständig in sequenceNumber-
|
|
1113
|
+
* Reihenfolge. auditLog ist immer Teil des Exports (v0.5/F-005).
|
|
1114
|
+
*/
|
|
1115
|
+
declare class JournalExportProjection {
|
|
1116
|
+
private readonly tenantId;
|
|
1117
|
+
private readonly tenantName;
|
|
1118
|
+
private readonly baseCurrency;
|
|
1119
|
+
private readonly journal;
|
|
1120
|
+
private readonly accounts;
|
|
1121
|
+
private readonly vouchers;
|
|
1122
|
+
private readonly partners;
|
|
1123
|
+
private readonly audit;
|
|
1124
|
+
private readonly clock;
|
|
1125
|
+
constructor(tenantId: Uuid, tenantName: string, baseCurrency: Currency, journal: JournalRepository, accounts: AccountRepository, vouchers: VoucherRepository, partners: PartnerRepository, audit: AuditTrail, clock: Clock);
|
|
1126
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
1127
|
+
private static formatEntry;
|
|
1128
|
+
private fieldCatalog;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* DATEV-Export (F-IO-005): Buchungsstapel, Kontenbeschriftungen, Partner-
|
|
1133
|
+
* Stammdaten. Steuerzeilen werden DATEV-seitig aus dem BU-Schlüssel erzeugt und
|
|
1134
|
+
* deshalb in die Basiszeile gefaltet; zusammengesetzte Buchungen in Teilzeilen.
|
|
1135
|
+
*/
|
|
1136
|
+
declare class DatevExportProjection {
|
|
1137
|
+
private readonly journal;
|
|
1138
|
+
private readonly accounts;
|
|
1139
|
+
private readonly vouchers;
|
|
1140
|
+
private readonly partners;
|
|
1141
|
+
private readonly registry;
|
|
1142
|
+
constructor(journal: JournalRepository, accounts: AccountRepository, vouchers: VoucherRepository, partners: PartnerRepository, registry: TaxCodeRegistry);
|
|
1143
|
+
compute(params: Record<string, unknown>): Record<string, unknown>;
|
|
1144
|
+
private entryRows;
|
|
1145
|
+
private splitEntry;
|
|
1146
|
+
private accountRows;
|
|
1147
|
+
private partnerRows;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Mapping-Import (api.md): Überlappung → E_MAPPING_OVERLAP; Lücken sind kein
|
|
1152
|
+
* Fehler, sondern gapWarnings[] mit Auffangposition `_unassigned`. Geprüft gegen
|
|
1153
|
+
* die real existierenden Konten je Mapping-Art.
|
|
1154
|
+
*/
|
|
1155
|
+
declare class MappingImporter {
|
|
1156
|
+
private readonly accounts;
|
|
1157
|
+
private readonly registry;
|
|
1158
|
+
constructor(accounts: AccountRepository, registry: MappingRegistry);
|
|
1159
|
+
import(input: Record<string, unknown>): Record<string, unknown>;
|
|
1160
|
+
private relevantAccounts;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Steuerexpansion (tax-modell.md): side-effect-free. Determinismus (§2):
|
|
1165
|
+
* USt pro Beleg je Steuersatz — Netto-Summe je Schlüssel, Steuer berechnen,
|
|
1166
|
+
* EINMAL half-up runden. Versionswahl nach Leistungs-/Belegdatum.
|
|
1167
|
+
* Kleinunternehmer (§ 19): keine Steuerpositionen, Brutto = Netto.
|
|
1168
|
+
*/
|
|
1169
|
+
declare class TaxService {
|
|
1170
|
+
private readonly baseCurrency;
|
|
1171
|
+
private readonly registry;
|
|
1172
|
+
private readonly profileValue;
|
|
1173
|
+
private readonly journal;
|
|
1174
|
+
constructor(baseCurrency: Currency, registry: TaxCodeRegistry, profileValue: TaxProfile, journal: JournalRepository);
|
|
1175
|
+
profile(): TaxProfile;
|
|
1176
|
+
registryHandle(): TaxCodeRegistry;
|
|
1177
|
+
expand(input: Record<string, unknown>): Record<string, unknown>;
|
|
1178
|
+
setProfile(input: Record<string, unknown>): TaxProfile;
|
|
1179
|
+
private tag;
|
|
1180
|
+
private parseDate;
|
|
1181
|
+
private parseMoney;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Mandant: buchführende Einheit, oberste Datengrenze (Glossar `tenant`). Bündelt
|
|
1186
|
+
* Ports + Services einer Instanz. Wächst mit den Slices (Tax/Partner/Asset/
|
|
1187
|
+
* Costing folgen); der Adapter ersetzt nur die Ports.
|
|
1188
|
+
*/
|
|
1189
|
+
declare class Tenant {
|
|
1190
|
+
readonly id: Uuid;
|
|
1191
|
+
readonly name: string;
|
|
1192
|
+
readonly baseCurrency: Currency;
|
|
1193
|
+
readonly accounts: AccountRepository;
|
|
1194
|
+
readonly fiscalYears: FiscalYearRepository;
|
|
1195
|
+
readonly vouchers: VoucherRepository;
|
|
1196
|
+
readonly journal: JournalRepository;
|
|
1197
|
+
readonly openItems: OpenItemRepository;
|
|
1198
|
+
readonly assets: AssetRepository;
|
|
1199
|
+
readonly partners: PartnerRepository;
|
|
1200
|
+
readonly audit: AuditTrail;
|
|
1201
|
+
readonly ledger: Ledger;
|
|
1202
|
+
readonly tax: TaxService;
|
|
1203
|
+
readonly assetService: AssetService;
|
|
1204
|
+
readonly costing: CostingService;
|
|
1205
|
+
readonly partnerService: PartnerService;
|
|
1206
|
+
readonly mappings: MappingRegistry;
|
|
1207
|
+
readonly clock: Clock;
|
|
1208
|
+
readonly ids: IdGenerator;
|
|
1209
|
+
constructor(id: Uuid, name: string, baseCurrency: Currency, accounts: AccountRepository, fiscalYears: FiscalYearRepository, vouchers: VoucherRepository, journal: JournalRepository, openItems: OpenItemRepository, assets: AssetRepository, partners: PartnerRepository, audit: AuditTrail, ledger: Ledger, tax: TaxService, assetService: AssetService, costing: CostingService, partnerService: PartnerService, mappings: MappingRegistry, clock: Clock, ids: IdGenerator);
|
|
1210
|
+
static inMemory(name: string, baseCurrency: Currency, clock?: Clock, ids?: IdGenerator, dimensions?: DimensionRegistry, taxCodes?: TaxCodeRegistry, taxProfile?: TaxProfile, mappings?: MappingRegistry): Tenant;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Generischer Einstieg in alle Operationen und Projektionen eines Mandanten —
|
|
1215
|
+
* die Schnittstelle für CLI und Konformitäts-Runner. Namen exakt nach api.md.
|
|
1216
|
+
* Wächst mit den Slices; Unimplementiertes meldet E_NOT_IMPLEMENTED.
|
|
1217
|
+
*/
|
|
1218
|
+
declare class TenantOperations {
|
|
1219
|
+
private readonly tenant;
|
|
1220
|
+
constructor(tenant: Tenant);
|
|
1221
|
+
execute(op: string, input: Record<string, unknown>): Record<string, unknown>;
|
|
1222
|
+
project(name: string, params: Record<string, unknown>): Record<string, unknown>;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Anwendungsschicht-Komposition `postVoucher` (api.md, Teil der Spec): SF-02/03
|
|
1227
|
+
* in einem Aufruf — Beleg anlegen, expandTax, post, OP-Anlage.
|
|
1228
|
+
*/
|
|
1229
|
+
declare class PostVoucherService {
|
|
1230
|
+
private readonly tenant;
|
|
1231
|
+
constructor(tenant: Tenant);
|
|
1232
|
+
post(input: Record<string, unknown>): Record<string, unknown>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* `createTenant` (SF-01): Mandant per Profil anlegen — sofort buchbar. Profile
|
|
1237
|
+
* sind versionierte Regelmodul-Daten; der Mandant pinnt die Version.
|
|
1238
|
+
*/
|
|
1239
|
+
declare class TenantFactory {
|
|
1240
|
+
private readonly ruleModules;
|
|
1241
|
+
private readonly clock;
|
|
1242
|
+
private readonly ids;
|
|
1243
|
+
constructor(ruleModules: Record<string, unknown>, clock: Clock, ids: IdGenerator);
|
|
1244
|
+
create(input: Record<string, unknown>): {
|
|
1245
|
+
tenant: Tenant;
|
|
1246
|
+
result: Record<string, unknown>;
|
|
1247
|
+
};
|
|
1248
|
+
private findById;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
export { Account, AccountNumber, type AccountRepository, AccountSheetProjection, type AccountStatus, type AccountType, Asset, AssetRegisterProjection, type AssetRepository, type AssetRoute, AssetService, type AuditChanges, AuditLogProjection, AuditRecord, type AuditTrail, BalanceSheetProjection, CalendarDate, CashBasisProjection, type Clock, CostingRun, CostingService, Currency, CurrencyMismatch, DatevExportProjection, DeterministicIdGenerator, DimensionRegistry, type DimensionRuleData, type DimensionTypeData, DimensionValue, type DimensionValueData, DomainError, EcSalesListProjection, EntryLine, type EntryStatus, FiscalYear, type FiscalYearRepository, type FiscalYearStatus, FixedClock, type IdGenerator, InMemoryAccountRepository, InMemoryAssetRepository, InMemoryAuditTrail, InMemoryFiscalYearRepository, InMemoryJournalRepository, InMemoryOpenItemRepository, InMemoryPartnerRepository, InMemoryVoucherRepository, IncomeStatementProjection, InvalidValue, JournalEntry, JournalExportProjection, type JournalRepository, Ledger, Mapping, MappingImporter, type MappingLeaf, MappingRegistry, Money, OpenItem, type OpenItemKind, type OpenItemRepository, type OpenItemStatus, OpenItemsProjection, Partner, type PartnerRepository, PartnerService, Period, type PeriodDefinition, PeriodRef, type PeriodStatus, PostResult, PostVoucherService, Settlement, type SettlementDifferenceKind, type Side, SystemClock, TaxCode, TaxCodeRegistry, TaxCodeVersion, TaxProfile, TaxService, Tenant, TenantFactory, TenantOperations, TrialBalanceProjection, Uuid, UuidV7IdGenerator, VatReturnProjection, Voucher, type VoucherProps, type VoucherRepository, canonicalJson, isAccountType, isBalanceCarrying, leafMatches, parseAssetRoute, parseOpenItemKind, parseSettlementDifferenceKind };
|