@classytic/ledger 0.10.3 → 0.11.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 (31) hide show
  1. package/dist/bridges/index.d.mts +1 -1
  2. package/dist/constants/index.d.mts +1 -1
  3. package/dist/constants/index.mjs +2 -2
  4. package/dist/{core-DwjkrRkJ.d.mts → core-B7uVjqGS.d.mts} +25 -0
  5. package/dist/country/index.d.mts +1 -1
  6. package/dist/events/index.d.mts +1 -1
  7. package/dist/exports/index.d.mts +1 -1
  8. package/dist/exports/index.mjs +1 -1
  9. package/dist/{fx-realization.plugin-Dzqzi3u0.mjs → fx-realization.plugin-DY3pPxIi.mjs} +70 -1
  10. package/dist/{index-ClLwzNRF.d.mts → index-BFPFihTF.d.mts} +8 -0
  11. package/dist/{index-08IpHhrU.d.mts → index-Dd7HknPP.d.mts} +1 -1
  12. package/dist/index.d.mts +115 -19
  13. package/dist/index.mjs +340 -156
  14. package/dist/{journals-DUpWwFt1.d.mts → journals-CTrAuzdk.d.mts} +1 -1
  15. package/dist/{partner-ledger-BIkmQsAc.mjs → partner-ledger-B0eym6Ss.mjs} +868 -212
  16. package/dist/plugins/index.d.mts +1 -1
  17. package/dist/plugins/index.mjs +1 -1
  18. package/dist/reports/index.d.mts +1 -1
  19. package/dist/reports/index.mjs +1 -1
  20. package/dist/{trial-balance-DCG5lOoC.d.mts → trial-balance-UXV2PN6x.d.mts} +215 -75
  21. package/package.json +8 -20
  22. package/dist/opening-balance-1cixYh6Y.mjs +0 -60
  23. package/dist/sync/index.d.mts +0 -324
  24. package/dist/sync/index.mjs +0 -530
  25. package/dist/sync-JvchM3FO.d.mts +0 -152
  26. /package/dist/{categories-FJlrvzcl.mjs → categories-CclX7Q94.mjs} +0 -0
  27. /package/dist/{currencies-Jo5oaM_4.mjs → currencies-OuPHPyS2.mjs} +0 -0
  28. /package/dist/{exports-C30yRapf.mjs → exports-B3whucXe.mjs} +0 -0
  29. /package/dist/{index-Bl0gP9lD.d.mts → index-DygMrab0.d.mts} +0 -0
  30. /package/dist/{index-J-XIbXH-.d.mts → index-pRW5cZhF.d.mts} +0 -0
  31. /package/dist/{outbox-store-BcCiHMPw.d.mts → outbox-store-CPLeocPg.d.mts} +0 -0
@@ -1,2 +1,2 @@
1
- import { a as EntryReversedNotification, c as PeriodLockedNotification, i as SourceRef, l as ReconciliationMismatchNotification, n as SourceBridge, o as NotificationBridge, r as SourceBridgeContext, s as NotificationBridgeContext, t as LedgerBridges, u as ExchangeRateBridge } from "../index-Bl0gP9lD.mjs";
1
+ import { a as EntryReversedNotification, c as PeriodLockedNotification, i as SourceRef, l as ReconciliationMismatchNotification, n as SourceBridge, o as NotificationBridge, r as SourceBridgeContext, s as NotificationBridgeContext, t as LedgerBridges, u as ExchangeRateBridge } from "../index-DygMrab0.mjs";
2
2
  export { EntryReversedNotification, ExchangeRateBridge, LedgerBridges, NotificationBridge, NotificationBridgeContext, PeriodLockedNotification, ReconciliationMismatchNotification, SourceBridge, SourceBridgeContext, SourceRef };
@@ -1,2 +1,2 @@
1
- import { S as isValidCategory, _ as getCategoryMainType, a as getJournalTypeCodes, b as isBalanceSheet, c as CURRENCIES, d as isValidCurrency, f as CATEGORIES, g as extractStatementType, h as extractMainType, i as getJournalType, l as getCurrency, m as categoryKey, n as JOURNAL_TYPES, o as isValidJournalType, p as CATEGORY_KEYS, r as getCustomJournalTypes, s as registerJournalType, t as JOURNAL_CODES, u as getMinorUnit, v as getCategoryStatementType, x as isIncomeStatement, y as getNormalBalance } from "../journals-DUpWwFt1.mjs";
1
+ import { S as isValidCategory, _ as getCategoryMainType, a as getJournalTypeCodes, b as isBalanceSheet, c as CURRENCIES, d as isValidCurrency, f as CATEGORIES, g as extractStatementType, h as extractMainType, i as getJournalType, l as getCurrency, m as categoryKey, n as JOURNAL_TYPES, o as isValidJournalType, p as CATEGORY_KEYS, r as getCustomJournalTypes, s as registerJournalType, t as JOURNAL_CODES, u as getMinorUnit, v as getCategoryStatementType, x as isIncomeStatement, y as getNormalBalance } from "../journals-CTrAuzdk.mjs";
2
2
  export { CATEGORIES, CATEGORY_KEYS, CURRENCIES, JOURNAL_CODES, JOURNAL_TYPES, categoryKey, extractMainType, extractStatementType, getCategoryMainType, getCategoryStatementType, getCurrency, getCustomJournalTypes, getJournalType, getJournalTypeCodes, getMinorUnit, getNormalBalance, isBalanceSheet, isIncomeStatement, isValidCategory, isValidCurrency, isValidJournalType, registerJournalType };
@@ -1,3 +1,3 @@
1
- import { a as JOURNAL_CODES, c as getCustomJournalTypes, d as isValidJournalType, f as registerJournalType, i as isValidCurrency, l as getJournalType, n as getCurrency, o as JOURNAL_TYPES, r as getMinorUnit, t as CURRENCIES, u as getJournalTypeCodes } from "../currencies-Jo5oaM_4.mjs";
2
- import { a as extractStatementType, c as getNormalBalance, d as isValidCategory, i as extractMainType, l as isBalanceSheet, n as CATEGORY_KEYS, o as getCategoryMainType, r as categoryKey, s as getCategoryStatementType, t as CATEGORIES, u as isIncomeStatement } from "../categories-FJlrvzcl.mjs";
1
+ import { a as JOURNAL_CODES, c as getCustomJournalTypes, d as isValidJournalType, f as registerJournalType, i as isValidCurrency, l as getJournalType, n as getCurrency, o as JOURNAL_TYPES, r as getMinorUnit, t as CURRENCIES, u as getJournalTypeCodes } from "../currencies-OuPHPyS2.mjs";
2
+ import { a as extractStatementType, c as getNormalBalance, d as isValidCategory, i as extractMainType, l as isBalanceSheet, n as CATEGORY_KEYS, o as getCategoryMainType, r as categoryKey, s as getCategoryStatementType, t as CATEGORIES, u as isIncomeStatement } from "../categories-CclX7Q94.mjs";
3
3
  export { CATEGORIES, CATEGORY_KEYS, CURRENCIES, JOURNAL_CODES, JOURNAL_TYPES, categoryKey, extractMainType, extractStatementType, getCategoryMainType, getCategoryStatementType, getCurrency, getCustomJournalTypes, getJournalType, getJournalTypeCodes, getMinorUnit, getNormalBalance, isBalanceSheet, isIncomeStatement, isValidCategory, isValidCurrency, isValidJournalType, registerJournalType };
@@ -26,6 +26,19 @@ interface Category {
26
26
  type NormalBalance = 'debit' | 'credit';
27
27
  /** Cash flow classification */
28
28
  type CashFlowCategory = 'Operating' | 'Investing' | 'Financing';
29
+ /**
30
+ * Non-cash adjustment tag — flags an Income-Statement account whose
31
+ * movement should be added back to Net Income in the Operating section
32
+ * of the Cash Flow Statement (Indirect Method, IAS 7 / ASC 230).
33
+ *
34
+ * Without this tag, an Income/Expense account is fully subsumed in Net
35
+ * Income; the CFS does not list it separately.
36
+ *
37
+ * Adopted from Odoo Enterprise's CF-IM tag taxonomy (PR #35522). Generic
38
+ * — country packs add new tags by string. The CFS algorithm groups all
39
+ * accounts sharing a tag onto a single labelled adjustment line.
40
+ */
41
+ type NonCashAdjustmentTag = 'depreciation' | 'amortization' | 'impairment' | 'gain_on_disposal' | 'loss_on_disposal' | 'unrealized_fx' | 'stock_based_compensation' | (string & {});
29
42
  /** Roll-up operation for total accounts */
30
43
  interface TotalAccountOp {
31
44
  readonly account: string;
@@ -55,6 +68,18 @@ interface AccountType {
55
68
  readonly isGroup?: boolean;
56
69
  readonly totalAccountTypes?: readonly TotalAccountOp[];
57
70
  readonly cashFlowCategory?: CashFlowCategory | null;
71
+ /**
72
+ * Non-cash adjustment tag for Cash Flow Statement (Indirect Method).
73
+ * Set ONLY on Income-Statement accounts whose movement should be added
74
+ * back to Net Income in the Operating section. Tagging a Balance-Sheet
75
+ * account with this is a country-pack bug — the algorithm ignores it
76
+ * there because B/S movements already feed the working-capital path.
77
+ *
78
+ * Common values: 'depreciation', 'amortization', 'impairment',
79
+ * 'gain_on_disposal' (negative), 'loss_on_disposal' (positive). See
80
+ * NonCashAdjustmentTag type for the canonical set.
81
+ */
82
+ readonly nonCashAdjustmentTag?: NonCashAdjustmentTag | null;
58
83
  readonly taxMetadata?: TaxMetadata;
59
84
  readonly deprecated?: boolean;
60
85
  readonly replacedBy?: string;
@@ -1,2 +1,2 @@
1
- import { i as defineCountryPack, n as CountryPackInput, r as JournalTemplate, t as CountryPack } from "../index-08IpHhrU.mjs";
1
+ import { i as defineCountryPack, n as CountryPackInput, r as JournalTemplate, t as CountryPack } from "../index-Dd7HknPP.mjs";
2
2
  export { CountryPack, CountryPackInput, JournalTemplate, defineCountryPack };
@@ -1,3 +1,3 @@
1
- import { $ as ReconciliationUnmatchedPayload, A as LedgerEventDefinition, B as InProcessLedgerBusOptions, C as EntryPostedPayloadSchema, D as EntryUnpostedPayloadSchema, E as EntryUnposted, F as ReconciliationUnmatched, G as EntryArchivedPayload, H as createEvent, I as ReconciliationUnmatchedPayloadSchema, J as EntryPostedPayload, K as EntryCreatedPayload, L as ledgerEventDefinitions, M as LedgerEventSchema, N as ReconciliationMatched, O as JournalSeeded, P as ReconciliationMatchedPayloadSchema, Q as ReconciliationMatchedPayload, R as EventLogger, S as EntryPosted, T as EntryReversedPayloadSchema, U as AccountBulkCreatedPayload, V as EventContext, W as AccountSeededPayload, X as EntryUnpostedPayload, Y as EntryReversedPayload, Z as JournalSeededPayload, _ as EntryArchivedPayloadSchema, a as OutboxFailOptions, b as EntryDuplicated, c as OutboxFailurePolicy, d as OutboxWriteOptions, et as LEDGER_EVENTS, f as AccountBulkCreated, g as EntryArchived, h as AccountSeededPayloadSchema, i as OutboxErrorInfo, j as LedgerEventPayloadOf, k as JournalSeededPayloadSchema, l as OutboxOwnershipError, m as AccountSeeded, n as OutboxAcknowledgeOptions, o as OutboxFailureContext, p as AccountBulkCreatedPayloadSchema, q as EntryDuplicatedPayload, r as OutboxClaimOptions, s as OutboxFailureDecision, t as InvalidOutboxEventError, tt as LedgerEventName, u as OutboxStore, v as EntryCreated, w as EntryReversed, x as EntryDuplicatedPayloadSchema, y as EntryCreatedPayloadSchema, z as InProcessLedgerBus } from "../outbox-store-BcCiHMPw.mjs";
1
+ import { $ as ReconciliationUnmatchedPayload, A as LedgerEventDefinition, B as InProcessLedgerBusOptions, C as EntryPostedPayloadSchema, D as EntryUnpostedPayloadSchema, E as EntryUnposted, F as ReconciliationUnmatched, G as EntryArchivedPayload, H as createEvent, I as ReconciliationUnmatchedPayloadSchema, J as EntryPostedPayload, K as EntryCreatedPayload, L as ledgerEventDefinitions, M as LedgerEventSchema, N as ReconciliationMatched, O as JournalSeeded, P as ReconciliationMatchedPayloadSchema, Q as ReconciliationMatchedPayload, R as EventLogger, S as EntryPosted, T as EntryReversedPayloadSchema, U as AccountBulkCreatedPayload, V as EventContext, W as AccountSeededPayload, X as EntryUnpostedPayload, Y as EntryReversedPayload, Z as JournalSeededPayload, _ as EntryArchivedPayloadSchema, a as OutboxFailOptions, b as EntryDuplicated, c as OutboxFailurePolicy, d as OutboxWriteOptions, et as LEDGER_EVENTS, f as AccountBulkCreated, g as EntryArchived, h as AccountSeededPayloadSchema, i as OutboxErrorInfo, j as LedgerEventPayloadOf, k as JournalSeededPayloadSchema, l as OutboxOwnershipError, m as AccountSeeded, n as OutboxAcknowledgeOptions, o as OutboxFailureContext, p as AccountBulkCreatedPayloadSchema, q as EntryDuplicatedPayload, r as OutboxClaimOptions, s as OutboxFailureDecision, t as InvalidOutboxEventError, tt as LedgerEventName, u as OutboxStore, v as EntryCreated, w as EntryReversed, x as EntryDuplicatedPayloadSchema, y as EntryCreatedPayloadSchema, z as InProcessLedgerBus } from "../outbox-store-CPLeocPg.mjs";
2
2
  import { DomainEvent, EventHandler, EventTransport, PublishManyResult } from "@classytic/primitives/events";
3
3
  export { AccountBulkCreated, type AccountBulkCreatedPayload, type AccountBulkCreatedPayloadSchema, AccountSeeded, type AccountSeededPayload, type AccountSeededPayloadSchema, type DomainEvent, EntryArchived, type EntryArchivedPayload, type EntryArchivedPayloadSchema, EntryCreated, type EntryCreatedPayload, type EntryCreatedPayloadSchema, EntryDuplicated, type EntryDuplicatedPayload, type EntryDuplicatedPayloadSchema, EntryPosted, type EntryPostedPayload, type EntryPostedPayloadSchema, EntryReversed, type EntryReversedPayload, type EntryReversedPayloadSchema, EntryUnposted, type EntryUnpostedPayload, type EntryUnpostedPayloadSchema, type EventContext, type EventHandler, type EventLogger, type EventTransport, InProcessLedgerBus, type InProcessLedgerBusOptions, InvalidOutboxEventError, JournalSeeded, type JournalSeededPayload, type JournalSeededPayloadSchema, LEDGER_EVENTS, type LedgerEventDefinition, type LedgerEventName, type LedgerEventPayloadOf, type LedgerEventSchema, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxWriteOptions, type PublishManyResult, ReconciliationMatched, type ReconciliationMatchedPayload, type ReconciliationMatchedPayloadSchema, ReconciliationUnmatched, type ReconciliationUnmatchedPayload, type ReconciliationUnmatchedPayloadSchema, createEvent, ledgerEventDefinitions };
@@ -1,2 +1,2 @@
1
- import { _ as PopulatedJournalEntry, a as exportToCsv, c as getHeaders, d as serializeCsv, f as CsvOptions, g as PopulatedAccount, h as FlatJournalRow, i as quickbooksFieldMap, l as buildCsv, m as ExportFieldMap, n as flattenJournalEntry, o as extractAllRows, p as ExportField, r as universalFieldMap, s as extractRow, t as flattenJournalEntries, u as escapeCell, v as PopulatedJournalItem } from "../index-J-XIbXH-.mjs";
1
+ import { _ as PopulatedJournalEntry, a as exportToCsv, c as getHeaders, d as serializeCsv, f as CsvOptions, g as PopulatedAccount, h as FlatJournalRow, i as quickbooksFieldMap, l as buildCsv, m as ExportFieldMap, n as flattenJournalEntry, o as extractAllRows, p as ExportField, r as universalFieldMap, s as extractRow, t as flattenJournalEntries, u as escapeCell, v as PopulatedJournalItem } from "../index-pRW5cZhF.mjs";
2
2
  export { CsvOptions, ExportField, ExportFieldMap, FlatJournalRow, PopulatedAccount, PopulatedJournalEntry, PopulatedJournalItem, buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
@@ -1,2 +1,2 @@
1
- import { a as exportToCsv, c as getHeaders, d as serializeCsv, i as quickbooksFieldMap, l as buildCsv, n as flattenJournalEntry, o as extractAllRows, r as universalFieldMap, s as extractRow, t as flattenJournalEntries, u as escapeCell } from "../exports-C30yRapf.mjs";
1
+ import { a as exportToCsv, c as getHeaders, d as serializeCsv, i as quickbooksFieldMap, l as buildCsv, n as flattenJournalEntry, o as extractAllRows, r as universalFieldMap, s as extractRow, t as flattenJournalEntries, u as escapeCell } from "../exports-B3whucXe.mjs";
2
2
  export { buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
@@ -1,4 +1,41 @@
1
1
  import { a as IdempotencyConflictError, i as Errors, t as AccountingError } from "./errors-vXd932rB.mjs";
2
+ //#region src/plugins/claim-context.ts
3
+ /**
4
+ * Synthesize a flat data view from a claim context, matching the shape
5
+ * that `before:update` listeners expect (`{ state, ...patchFields }`).
6
+ *
7
+ * - Pulls `$set` from the operator-form patch and treats those as flat
8
+ * fields.
9
+ * - Adds the target state from `transition.to` so update-shaped checks
10
+ * like `data.state === 'posted'` work unchanged.
11
+ * - For state-noop transitions (`from === to`), `transition.to` is the
12
+ * current state — same value gets written, callers see it as a "stamp"
13
+ * on a posted entry.
14
+ */
15
+ function flattenClaimData(ctx) {
16
+ const flat = { ...ctx.data?.$set ?? {} };
17
+ const stateField = ctx.transition?.field ?? "state";
18
+ const target = ctx.transition?.to;
19
+ if (target !== void 0 && flat[stateField] === void 0) flat[stateField] = target;
20
+ return flat;
21
+ }
22
+ /**
23
+ * Detect the `reverseMark` claim shape — the state-noop CAS used to stamp
24
+ * `reversed: true` on the original entry during `reverse()`.
25
+ *
26
+ * Lock plugins exempt this transition (the original entry's date can sit
27
+ * inside a closed period; the new counter-entry on the reversal date is
28
+ * subject to lock checks independently).
29
+ */
30
+ function isReverseMarkClaim(ctx) {
31
+ const t = ctx.transition;
32
+ if (!t) return false;
33
+ if (t.from !== "posted" || t.to !== "posted") return false;
34
+ const reversedGuard = (t.where ?? {}).reversed;
35
+ if (!reversedGuard || reversedGuard.$ne !== true) return false;
36
+ return (ctx.data?.$set ?? {}).reversed === true;
37
+ }
38
+ //#endregion
2
39
  //#region src/plugins/double-entry.plugin.ts
3
40
  function doubleEntryPlugin(options = {}) {
4
41
  const { onlyOnPost = true, JournalEntryModel, AccountModel, orgField } = options;
@@ -147,9 +184,31 @@ function doubleEntryPlugin(options = {}) {
147
184
  }
148
185
  }
149
186
  };
187
+ const validateClaim = async (rawCtx) => {
188
+ const ctx = rawCtx;
189
+ if (isReverseMarkClaim(ctx)) return;
190
+ if (ctx.transition?.to !== "posted") return;
191
+ const flatData = flattenClaimData(ctx);
192
+ if (!JournalEntryModel) throw new Error("doubleEntryPlugin: JournalEntryModel is required to validate claim transitions to \"posted\". Pass JournalEntryModel in plugin options.");
193
+ if (!ctx.id) throw new Error("doubleEntryPlugin: claim context is missing \"id\". Cannot validate transition to \"posted\" without document ID.");
194
+ const persisted = await JournalEntryModel.findById(ctx.id).select("journalItems").session(ctx.session ?? null).lean();
195
+ if (!persisted) return;
196
+ const persistedItems = persisted.journalItems;
197
+ if (!persistedItems || persistedItems.length < 2) throw Errors.validation(`Cannot post entry: at least 2 journal items required, got ${persistedItems?.length ?? 0}.`);
198
+ validateItems(persistedItems, flatData);
199
+ if (ctx.data?.$set) {
200
+ ctx.data.$set.totalDebit = flatData.totalDebit;
201
+ ctx.data.$set.totalCredit = flatData.totalCredit;
202
+ }
203
+ if (AccountModel) await validateAccounts(persistedItems, {
204
+ ...flatData,
205
+ ...persisted
206
+ }, ctx);
207
+ };
150
208
  repo.on("before:create", validate);
151
209
  repo.on("before:createMany", validateMany);
152
210
  repo.on("before:update", validateUpdate);
211
+ repo.on("before:claim", validateClaim);
153
212
  }
154
213
  };
155
214
  }
@@ -257,9 +316,19 @@ function createLockPlugin(options) {
257
316
  }, false);
258
317
  }
259
318
  };
319
+ const runClaim = async (rawCtx) => {
320
+ const ctx = rawCtx;
321
+ if (isReverseMarkClaim(ctx)) return;
322
+ if (ctx.transition?.to !== "posted") return;
323
+ await run({
324
+ ...ctx,
325
+ data: flattenClaimData(ctx)
326
+ }, true);
327
+ };
260
328
  repo.on("before:create", (ctx) => run(ctx, false));
261
329
  repo.on("before:createMany", runMany);
262
330
  repo.on("before:update", (ctx) => run(ctx, true));
331
+ repo.on("before:claim", runClaim);
263
332
  }
264
333
  };
265
334
  }
@@ -463,4 +532,4 @@ function fxRealizationPlugin(options) {
463
532
  };
464
533
  }
465
534
  //#endregion
466
- export { watermarkResolver as a, idempotencyPlugin as c, fiscalLockPlugin as i, doubleEntryPlugin as l, creditLimitPlugin as n, periodResolver as o, dailyLockPlugin as r, createLockPlugin as s, fxRealizationPlugin as t };
535
+ export { watermarkResolver as a, idempotencyPlugin as c, fiscalLockPlugin as i, doubleEntryPlugin as l, creditLimitPlugin as n, periodResolver as o, dailyLockPlugin as r, createLockPlugin as s, fxRealizationPlugin as t, isReverseMarkClaim as u };
@@ -11,6 +11,14 @@ interface PostOptions {
11
11
  interface ReverseOptions extends PostOptions {
12
12
  /** Date for the reversal entry (defaults to now) */
13
13
  reversalDate?: Date;
14
+ /**
15
+ * Post the reversal immediately after creating it. Defaults to `false` —
16
+ * matches ERPNext (`make_reverse_journal_entry` returns Draft) and Odoo
17
+ * (`_reverse_moves` creates Draft unless `cancel=True`). Pass `true` for
18
+ * Odoo's `cancel=True` semantic — cancellation reversals that should
19
+ * skip the review step.
20
+ */
21
+ autoPost?: boolean;
14
22
  }
15
23
  interface SeedOptions {
16
24
  session?: ClientSession | null;
@@ -1,4 +1,4 @@
1
- import { t as AccountType } from "./core-DwjkrRkJ.mjs";
1
+ import { t as AccountType } from "./core-B7uVjqGS.mjs";
2
2
 
3
3
  //#region src/country/index.d.ts
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
- import { a as EntryReversedNotification, c as PeriodLockedNotification, i as SourceRef, l as ReconciliationMismatchNotification, n as SourceBridge, o as NotificationBridge, r as SourceBridgeContext, s as NotificationBridgeContext, t as LedgerBridges, u as ExchangeRateBridge } from "./index-Bl0gP9lD.mjs";
2
- import { _ as TaxMetadata, a as Cents, c as DateRange, d as JournalType, f as MainType, g as TaxDetail, h as StatementType, i as CategoryKey, l as EntryState, m as ObjectId, n as CashFlowCategory, o as Currency, p as NormalBalance, s as DateOption, t as AccountType, u as JournalItem, v as TotalAccountOp } from "./core-DwjkrRkJ.mjs";
3
- import { S as isValidCategory, a as getJournalTypeCodes, b as isBalanceSheet, c as CURRENCIES, d as isValidCurrency, f as CATEGORIES, i as getJournalType, l as getCurrency, n as JOURNAL_TYPES, o as isValidJournalType, p as CATEGORY_KEYS, r as getCustomJournalTypes, s as registerJournalType, t as JOURNAL_CODES, u as getMinorUnit, x as isIncomeStatement, y as getNormalBalance } from "./journals-DUpWwFt1.mjs";
4
- import { i as defineCountryPack, n as CountryPackInput, r as JournalTemplate, t as CountryPack } from "./index-08IpHhrU.mjs";
5
- import { $ as ReconciliationUnmatchedPayload, A as LedgerEventDefinition, B as InProcessLedgerBusOptions, E as EntryUnposted, F as ReconciliationUnmatched, G as EntryArchivedPayload, H as createEvent, J as EntryPostedPayload, K as EntryCreatedPayload, L as ledgerEventDefinitions, M as LedgerEventSchema, N as ReconciliationMatched, O as JournalSeeded, Q as ReconciliationMatchedPayload, R as EventLogger, S as EntryPosted, U as AccountBulkCreatedPayload, V as EventContext, W as AccountSeededPayload, X as EntryUnpostedPayload, Y as EntryReversedPayload, Z as JournalSeededPayload, a as OutboxFailOptions, b as EntryDuplicated, c as OutboxFailurePolicy, d as OutboxWriteOptions, et as LEDGER_EVENTS, f as AccountBulkCreated, g as EntryArchived, i as OutboxErrorInfo, j as LedgerEventPayloadOf, l as OutboxOwnershipError, m as AccountSeeded, n as OutboxAcknowledgeOptions, o as OutboxFailureContext, q as EntryDuplicatedPayload, r as OutboxClaimOptions, s as OutboxFailureDecision, t as InvalidOutboxEventError, tt as LedgerEventName, u as OutboxStore, v as EntryCreated, w as EntryReversed, z as InProcessLedgerBus } from "./outbox-store-BcCiHMPw.mjs";
6
- import { _ as PopulatedJournalEntry, a as exportToCsv, h as FlatJournalRow, i as quickbooksFieldMap, m as ExportFieldMap, p as ExportField, r as universalFieldMap, t as flattenJournalEntries } from "./index-J-XIbXH-.mjs";
1
+ import { a as EntryReversedNotification, c as PeriodLockedNotification, i as SourceRef, l as ReconciliationMismatchNotification, n as SourceBridge, o as NotificationBridge, r as SourceBridgeContext, s as NotificationBridgeContext, t as LedgerBridges, u as ExchangeRateBridge } from "./index-DygMrab0.mjs";
2
+ import { _ as TaxMetadata, a as Cents, c as DateRange, d as JournalType, f as MainType, g as TaxDetail, h as StatementType, i as CategoryKey, l as EntryState, m as ObjectId, n as CashFlowCategory, o as Currency, p as NormalBalance, s as DateOption, t as AccountType, u as JournalItem, v as TotalAccountOp } from "./core-B7uVjqGS.mjs";
3
+ import { S as isValidCategory, a as getJournalTypeCodes, b as isBalanceSheet, c as CURRENCIES, d as isValidCurrency, f as CATEGORIES, i as getJournalType, l as getCurrency, n as JOURNAL_TYPES, o as isValidJournalType, p as CATEGORY_KEYS, r as getCustomJournalTypes, s as registerJournalType, t as JOURNAL_CODES, u as getMinorUnit, x as isIncomeStatement, y as getNormalBalance } from "./journals-CTrAuzdk.mjs";
4
+ import { i as defineCountryPack, n as CountryPackInput, r as JournalTemplate, t as CountryPack } from "./index-Dd7HknPP.mjs";
5
+ import { $ as ReconciliationUnmatchedPayload, A as LedgerEventDefinition, B as InProcessLedgerBusOptions, E as EntryUnposted, F as ReconciliationUnmatched, G as EntryArchivedPayload, H as createEvent, J as EntryPostedPayload, K as EntryCreatedPayload, L as ledgerEventDefinitions, M as LedgerEventSchema, N as ReconciliationMatched, O as JournalSeeded, Q as ReconciliationMatchedPayload, R as EventLogger, S as EntryPosted, U as AccountBulkCreatedPayload, V as EventContext, W as AccountSeededPayload, X as EntryUnpostedPayload, Y as EntryReversedPayload, Z as JournalSeededPayload, a as OutboxFailOptions, b as EntryDuplicated, c as OutboxFailurePolicy, d as OutboxWriteOptions, et as LEDGER_EVENTS, f as AccountBulkCreated, g as EntryArchived, i as OutboxErrorInfo, j as LedgerEventPayloadOf, l as OutboxOwnershipError, m as AccountSeeded, n as OutboxAcknowledgeOptions, o as OutboxFailureContext, q as EntryDuplicatedPayload, r as OutboxClaimOptions, s as OutboxFailureDecision, t as InvalidOutboxEventError, tt as LedgerEventName, u as OutboxStore, v as EntryCreated, w as EntryReversed, z as InProcessLedgerBus } from "./outbox-store-CPLeocPg.mjs";
6
+ import { _ as PopulatedJournalEntry, a as exportToCsv, h as FlatJournalRow, i as quickbooksFieldMap, m as ExportFieldMap, p as ExportField, r as universalFieldMap, t as flattenJournalEntries } from "./index-pRW5cZhF.mjs";
7
7
  import { Money, abs, add, allocate, equals, format, formatPlain, fromDecimal, isNegative, isPositive, isValid, isZero, max, min, multiply, negate, parseCents, percentage, round, splitTaxExclusive, splitTaxInclusive, subtract, toDecimal } from "./money.mjs";
8
- import { $ as AgedBalanceParams, A as generateDimensionBreakdown, B as BalanceSheetReport, D as DimensionBreakdownParams, E as DimensionBreakdownOptions, F as BudgetVsActualReport, G as IncomeStatementReport, H as CashFlowSection, I as BudgetVsActualRow, J as ReportCategory, K as LedgerEntry, L as generateBudgetVsActual, M as generateCashFlow, N as BudgetVsActualOptions, O as DimensionBreakdownReport, P as BudgetVsActualParams, Q as AgedBalanceOptions, T as reopenFiscalPeriod, U as GeneralLedgerAccount, V as CashFlowReport, W as GeneralLedgerReport, X as TrialBalanceReport, Y as ReportGroup, Z as TrialBalanceRow, a as RevaluationReport, at as Logger, b as generateGeneralLedger, c as RevaluationRate, d as computeRevaluation, et as AgedBalanceReport, f as PartnerLedgerLine, g as generatePartnerLedger, h as PartnerLedgerReport, i as RevaluationParams, it as generateAgedBalance, k as DimensionBreakdownRow, l as RevaluationResult, lt as DaybookParams, m as PartnerLedgerParams, n as generateTrialBalance, nt as AgedBucketConfig, o as generateRevaluation, ot as defaultLogger, p as PartnerLedgerOptions, q as ReportAccount, r as RevaluationOptions, rt as DEFAULT_BUCKETS, s as AccountForeignBalance, tt as AgedBalanceRow, u as buildRevaluationEntry, ut as DaybookReport, v as generateIncomeStatement, w as closeFiscalPeriod, z as generateBalanceSheet } from "./trial-balance-DCG5lOoC.mjs";
9
- import { A as OpenItem, C as AccountRepository, D as JournalItemRef, E as JournalEntryRepository, F as SeedOptions, I as SeedResult, M as ReconciliationRepository, N as ReverseOptions, O as JournalRepository, P as ReverseResult, S as creditLimitPlugin, T as BulkCreateResult, _ as FxRealizationPluginOptions, a as dailyLockPlugin, b as doubleEntryPlugin, c as periodResolver, d as LockAccountSelector, f as LockHit, g as idempotencyPlugin, i as FiscalLockPluginOptions, j as PostOptions, k as MatchInput, l as createLockPlugin, m as LockResolverContext, n as watermarkResolver, o as fiscalLockPlugin, p as LockResolver, r as DailyLockPluginOptions, s as PeriodResolverOptions, t as WatermarkResolverOptions, u as CreateLockPluginOptions, v as fxRealizationPlugin, w as BulkCreateInput, x as CreditLimitPluginOptions } from "./index-ClLwzNRF.mjs";
8
+ import { $ as GeneralLedgerAccount, A as generateDimensionBreakdown, B as AgedBalanceOptions, D as DimensionBreakdownParams, E as DimensionBreakdownOptions, F as BudgetVsActualReport, G as DEFAULT_BUCKETS, H as AgedBalanceReport, I as BudgetVsActualRow, J as BalanceSheetReport, K as generateAgedBalance, L as generateBudgetVsActual, M as generateCashFlow, N as BudgetVsActualOptions, O as DimensionBreakdownReport, P as BudgetVsActualParams, Q as ComparativeMode, T as reopenFiscalPeriod, U as AgedBalanceRow, V as AgedBalanceParams, W as AgedBucketConfig, X as CashFlowReport, Y as BalanceSheetSection, Z as CashFlowSection, a as RevaluationReport, at as PeriodColumn, b as generateGeneralLedger, c as RevaluationRate, ct as ReportGroup, d as computeRevaluation, dt as TrialBalanceColumnRow, et as GeneralLedgerReport, f as PartnerLedgerLine, ft as TrialBalanceReport, g as generatePartnerLedger, h as PartnerLedgerReport, ht as defaultLogger, i as RevaluationParams, it as LedgerEntry, k as DimensionBreakdownRow, l as RevaluationResult, lt as ReportLine, m as PartnerLedgerParams, mt as Logger, n as generateTrialBalance, nt as IncomeStatementReport, o as generateRevaluation, ot as ReportAccount, p as PartnerLedgerOptions, pt as TrialBalanceRow, q as BalanceSheetLineSource, r as RevaluationOptions, rt as IncomeStatementSection, s as AccountForeignBalance, st as ReportCategory, tt as IncomeStatementLineSource, u as buildRevaluationEntry, ut as ReportSection, v as generateIncomeStatement, vt as DaybookParams, w as closeFiscalPeriod, yt as DaybookReport, z as generateBalanceSheet } from "./trial-balance-UXV2PN6x.mjs";
9
+ import { A as OpenItem, C as AccountRepository, D as JournalItemRef, E as JournalEntryRepository, F as SeedOptions, I as SeedResult, M as ReconciliationRepository, N as ReverseOptions, O as JournalRepository, P as ReverseResult, S as creditLimitPlugin, T as BulkCreateResult, _ as FxRealizationPluginOptions, a as dailyLockPlugin, b as doubleEntryPlugin, c as periodResolver, d as LockAccountSelector, f as LockHit, g as idempotencyPlugin, i as FiscalLockPluginOptions, j as PostOptions, k as MatchInput, l as createLockPlugin, m as LockResolverContext, n as watermarkResolver, o as fiscalLockPlugin, p as LockResolver, r as DailyLockPluginOptions, s as PeriodResolverOptions, t as WatermarkResolverOptions, u as CreateLockPluginOptions, v as fxRealizationPlugin, w as BulkCreateInput, x as CreditLimitPluginOptions } from "./index-BFPFihTF.mjs";
10
10
  import { DomainEvent, EventHandler, EventTransport, EventTransport as EventTransport$1, PublishManyResult } from "@classytic/primitives/events";
11
11
  import { PaginationConfig, PluginFunction, PluginType, QueryParser, QueryParserOptions, Repository } from "@classytic/mongokit";
12
- import { ClientSession, Connection, Model } from "mongoose";
13
- import { TenantConfig } from "@classytic/primitives/tenant";
12
+ import mongoose, { ClientSession, Connection, Model } from "mongoose";
13
+ import { TenantConfig } from "@classytic/repo-core/tenant";
14
14
 
15
15
  //#region src/plugins/immutable-guard.plugin.d.ts
16
16
  interface ImmutableGuardOptions {
@@ -147,7 +147,7 @@ interface LedgerPaginationConfig {
147
147
  /**
148
148
  * Multi-tenant configuration.
149
149
  *
150
- * Extends `@classytic/primitives/tenant` `TenantConfig` — field names match
150
+ * Extends `@classytic/repo-core/tenant` `TenantConfig` — field names match
151
151
  * across primitives, mongokit's `MultiTenantOptions`, and ledger so hosts
152
152
  * don't learn three shapes for the same idea. Ledger tightens the
153
153
  * primitives' optional `tenantField` and `ref` into required (ledger has
@@ -332,13 +332,6 @@ interface AccountingEngineConfig {
332
332
  audit?: AuditConfig | undefined;
333
333
  /** Enable built-in idempotency key field on journal entries */
334
334
  idempotency?: boolean | undefined;
335
- /**
336
- * TTL in seconds for idempotency records — stale replay keys auto-expire
337
- * via a partial TTL index so they don't collide with legitimate reuse
338
- * after the window closes. Default: 86400 (24h). Matches Stripe / Saleor
339
- * convention. Only applies when `idempotency: true`.
340
- */
341
- idempotencyTtlSeconds?: number | undefined;
342
335
  /**
343
336
  * Automatically call `Model.syncIndexes()` on every managed model right
344
337
  * after the engine boots. Ensures new partial/TTL indexes (0.9.0+) are
@@ -881,6 +874,109 @@ declare class AccountingEngine {
881
874
  }
882
875
  declare function createAccountingEngine(config: AccountingEngineConfig): AccountingEngine;
883
876
  //#endregion
877
+ //#region src/types/journal-input.d.ts
878
+ /**
879
+ * Minimal JournalEntry creation payload. Matches the `journalEntries.create()`
880
+ * input. Host import code populates this from external formats; ledger's
881
+ * own builders (e.g. `buildOpeningBalanceEntry`) also produce this shape.
882
+ */
883
+ interface JournalEntryInput {
884
+ journalType?: string;
885
+ journal?: unknown;
886
+ referenceNumber?: string;
887
+ label?: string;
888
+ date: Date;
889
+ journalItems: JournalItemInput[];
890
+ /** Extra fields injected into the entry doc (dimension fields, tags, etc.). */
891
+ extra?: Record<string, unknown>;
892
+ }
893
+ interface JournalItemInput {
894
+ account: unknown;
895
+ debit: Cents;
896
+ credit: Cents;
897
+ label?: string;
898
+ currency?: string;
899
+ exchangeRate?: number;
900
+ originalDebit?: Cents;
901
+ originalCredit?: Cents;
902
+ matchingNumber?: string;
903
+ maturityDate?: Date;
904
+ }
905
+ //#endregion
906
+ //#region src/builders/opening-balance.d.ts
907
+ interface OpeningBalanceInput {
908
+ /** Cutover date — typically the start of fiscal year.
909
+ * The opening balance entry is dated on this day. */
910
+ cutoverDate: Date;
911
+ /**
912
+ * Account balances in integer cents (minor units), signed:
913
+ * - Positive = normal debit balance (assets, expenses)
914
+ * - Negative = normal credit balance (liabilities, equity, revenue)
915
+ *
916
+ * Callers should include balance sheet accounts only (assets, liabilities,
917
+ * equity). P&L cumulative effect belongs in retained earnings (the equity
918
+ * contra account) — this matches the Odoo and Beancount convention.
919
+ *
920
+ * The `accountCode` is opaque at this layer — it can be a GIFI code, a
921
+ * custom account number, or an ObjectId string. The consumer resolves it.
922
+ */
923
+ balances: ReadonlyArray<{
924
+ accountCode: string; /** Signed balance in integer cents. */
925
+ balance: number;
926
+ }>;
927
+ /**
928
+ * The equity account that absorbs the difference. Typically:
929
+ * - CA: '3600' (Retained Earnings)
930
+ * - BD: '3310' (Retained Earnings)
931
+ * - Generic: 'Opening Balance Equity'
932
+ *
933
+ * This follows Odoo's pattern (unaffected earnings) rather than ERPNext's
934
+ * temporary account, because the retained earnings approach is
935
+ * audit-clean and doesn't require a zeroing-out step.
936
+ */
937
+ equityAccountCode: string;
938
+ /** Optional label. Defaults to 'Opening Balance — Cutover YYYY-MM-DD'. */
939
+ label?: string;
940
+ }
941
+ interface OpeningBalanceResult {
942
+ /** The journal entry input, ready for `journalEntries.create()`. */
943
+ entry: JournalEntryInput;
944
+ /** The net residual posted to the equity account.
945
+ * Should be zero for a balanced trial balance.
946
+ * Non-zero means the TB was unbalanced — the equity account absorbs it. */
947
+ residual: number;
948
+ /** Number of account lines (excluding the equity contra line). */
949
+ lineCount: number;
950
+ }
951
+ declare function buildOpeningBalanceEntry(input: OpeningBalanceInput): OpeningBalanceResult;
952
+ //#endregion
953
+ //#region src/schemas/journal-entry.schema.d.ts
954
+ /**
955
+ * Recommended opt-in indexes for the line-level provenance fields
956
+ * (`journalItems.sourceRef.*` + `journalItems.linkedRefs.*`).
957
+ *
958
+ * Schema fields ship in the core schema unconditionally. Index creation
959
+ * costs writes on every JE insert, so the package ships them as opt-in:
960
+ * spread this into `schemaOptions.journalEntry.extraIndexes` to enable
961
+ * fast `/by-source` lookups against the line-level slots.
962
+ *
963
+ * Both indexes are sparse + partial — only lines that actually carry a
964
+ * sourceModel are indexed. Hosts that never write line-level provenance
965
+ * pay zero index storage / no insert overhead.
966
+ *
967
+ * @example
968
+ * import { createAccountingEngine, LINE_SOURCE_INDEXES } from '@classytic/ledger';
969
+ * createAccountingEngine({
970
+ * schemaOptions: {
971
+ * journalEntry: { extraIndexes: [...LINE_SOURCE_INDEXES] },
972
+ * },
973
+ * });
974
+ */
975
+ declare const LINE_SOURCE_INDEXES: ReadonlyArray<{
976
+ fields: Record<string, 1 | -1>;
977
+ options: Record<string, unknown>;
978
+ }>;
979
+ //#endregion
884
980
  //#region src/repositories/reconciliation.repository.d.ts
885
981
  interface MatchHookItem {
886
982
  entry: unknown;
@@ -1102,4 +1198,4 @@ interface PostingResult {
1102
1198
  idempotencyKeys?: string[];
1103
1199
  }
1104
1200
  //#endregion
1105
- export { AccountBulkCreated, type AccountBulkCreatedPayload, type AccountCode, type AccountForeignBalance, type AccountRepository, AccountSeeded, type AccountSeededPayload, type AccountSummary, type AccountType, AccountingEngine, type AccountingEngineConfig, AccountingError, type ActorContext, type AgedBalanceOptions, type AgedBalanceParams, type AgedBalanceReport, type AgedBalanceRow, type AgedBucketConfig, type AuditConfig, type BalanceSheetReport, type BudgetVsActualOptions, type BudgetVsActualParams, type BudgetVsActualReport, type BudgetVsActualRow, type BulkCreateInput, type BulkCreateResult, CATEGORIES, CATEGORY_KEYS, CURRENCIES, type CashFlowCategory, type CashFlowReport, type CashFlowSection, type CategoryKey, type Cents, ConcurrencyError, type CountryPack, type CountryPackInput, type CreateLockPluginOptions, type CreditLimitPluginOptions, type Currency, DEFAULT_BUCKETS, type DailyLockPluginOptions, type DateOption, type DateRange, type DimensionBreakdownOptions, type DimensionBreakdownParams, type DimensionBreakdownReport, type DimensionBreakdownRow, type DimensionDefinition, type DomainEvent, DuplicateReferenceError, EntryArchived, type EntryArchivedPayload, EntryCreated, type EntryCreatedPayload, EntryDuplicated, type EntryDuplicatedPayload, EntryPosted, type EntryPostedPayload, EntryReversed, type EntryReversedNotification, type EntryReversedPayload, type EntryState, EntryUnposted, type EntryUnpostedPayload, Errors, type EventContext, type EventHandler, type EventLogger, type EventTransport, type ExchangeRateBridge, type ExportField, type ExportFieldMap, type FieldError, type FiscalLockPluginOptions, type FiscalPeriodSummary, type FlatJournalRow, type FxRealizationPluginOptions, type GeneralLedgerAccount, type GeneralLedgerReport, IdempotencyConflictError, type ImmutableGuardOptions, ImmutableViolationError, InProcessLedgerBus, type InProcessLedgerBusOptions, type IncomeStatementReport, type IntrospectAPI, InvalidOutboxEventError, JOURNAL_CODES, JOURNAL_TYPES, type JournalEntryRepository, type JournalItem, type JournalItemRef, type JournalRepository, type JournalSchemaOptions, JournalSeeded, type JournalSeededPayload, type JournalTemplate, type JournalType, LEDGER_EVENTS, type LedgerBridges, type LedgerEntry, type LedgerEventDefinition, type LedgerEventName, type LedgerEventPayloadOf, type LedgerEventSchema, type LedgerModels, type LedgerPaginationConfig, type LedgerRepositories, type LedgerRepositoryPlugins, type LockAccountSelector, type LockHit, type LockResolver, type LockResolverContext, type Logger, type MainType, type MatchHookContext, type MatchHookItem, type MatchInput, type ModelNames, Money, type MultiCurrencyConfig, type MultiTenantConfig, type NormalBalance, type NotificationBridge, type NotificationBridgeContext, type OpenItem, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxWriteOptions, type PartnerLedgerLine, type PartnerLedgerOptions, type PartnerLedgerParams, type PartnerLedgerReport, type PeriodLockedNotification, type PeriodResolverOptions, type PopulatedJournalEntry, type PostOptions, type PostingContract, type PostingResult, type PublishManyResult, ReconciliationMatched, type ReconciliationMatchedPayload, type ReconciliationMismatchNotification, type ReconciliationRepository, ReconciliationUnmatched, type ReconciliationUnmatchedPayload, type RecordAPI, type RecordAdjustmentInput, type RecordAdjustmentLine, type RecordExpenseInput, type RecordOptions, type RecordPaymentInput, type RecordSaleInput, type RecordTransferInput, type ReportAccount, type ReportCategory, type ReportDescriptor, type ReportGroup, type ResolvedModelNames, type RevaluationOptions, type RevaluationParams, type RevaluationRate, type RevaluationReport, type RevaluationResult, type ReverseOptions, type ReverseResult, type SchemaOptions, type SeedOptions, type SeedResult, type Cents$1 as SemanticCents, type SessionResult, type SourceBridge, type SourceBridgeContext, type SourceRef, type StatementType, type StrictnessConfig, type SubledgerJournalItem, type SubledgerPostingInput, type TaxDetail, type TaxMetadata, type TotalAccountOp, type TrialBalanceReport, type TrialBalanceRow, type UnmatchHookContext, type WatermarkResolverOptions, acquireSession, add, allocate, buildAccountTypeMap, buildDimensionFields, buildDimensionIndexes, buildItemFilters, buildRevaluationEntry, calculateTotal, classifyDuplicateKey, closeFiscalPeriod, computeEndingBalance, computeRevaluation, createAccountingEngine, createEvent, createLockPlugin, createModels, createRepositories, creditLimitPlugin, dailyLockPlugin, defaultLogger, defineCountryPack, doubleEntryPlugin, exportToCsv, finalizeSession, fiscalLockPlugin, flattenJournalEntries, format, formatPlain, fromDecimal, fxRealizationPlugin, generateAgedBalance, generateBalanceSheet, generateBudgetVsActual, generateCashFlow, generateDimensionBreakdown, generateGeneralLedger, generateIncomeStatement, generatePartnerLedger, generateRevaluation, generateTrialBalance, getCurrency, getCustomJournalTypes, getDateRange, getFiscalYearStart, getJournalType, getJournalTypeCodes, getMinorUnit, getNormalBalance, idempotencyPlugin, immutableGuardPlugin, isBalanceSheet, isIncomeStatement, isValidCategory, isValidCurrency, isValidJournalType, isVirtualTaxAccount, ledgerEventDefinitions, multiply, parseCents, percentage, periodResolver, quickbooksFieldMap, registerJournalType, reopenFiscalPeriod, resolveModelNames, splitTaxExclusive, splitTaxInclusive, subtract, toDecimal, universalFieldMap, watermarkResolver };
1201
+ export { AccountBulkCreated, type AccountBulkCreatedPayload, type AccountCode, type AccountForeignBalance, type AccountRepository, AccountSeeded, type AccountSeededPayload, type AccountSummary, type AccountType, AccountingEngine, type AccountingEngineConfig, AccountingError, type ActorContext, type AgedBalanceOptions, type AgedBalanceParams, type AgedBalanceReport, type AgedBalanceRow, type AgedBucketConfig, type AuditConfig, type BalanceSheetLineSource, type BalanceSheetReport, type BalanceSheetSection, type BudgetVsActualOptions, type BudgetVsActualParams, type BudgetVsActualReport, type BudgetVsActualRow, type BulkCreateInput, type BulkCreateResult, CATEGORIES, CATEGORY_KEYS, CURRENCIES, type CashFlowCategory, type CashFlowReport, type CashFlowSection, type CategoryKey, type Cents, type ComparativeMode, ConcurrencyError, type CountryPack, type CountryPackInput, type CreateLockPluginOptions, type CreditLimitPluginOptions, type Currency, DEFAULT_BUCKETS, type DailyLockPluginOptions, type DateOption, type DateRange, type DimensionBreakdownOptions, type DimensionBreakdownParams, type DimensionBreakdownReport, type DimensionBreakdownRow, type DimensionDefinition, type DomainEvent, DuplicateReferenceError, EntryArchived, type EntryArchivedPayload, EntryCreated, type EntryCreatedPayload, EntryDuplicated, type EntryDuplicatedPayload, EntryPosted, type EntryPostedPayload, EntryReversed, type EntryReversedNotification, type EntryReversedPayload, type EntryState, EntryUnposted, type EntryUnpostedPayload, Errors, type EventContext, type EventHandler, type EventLogger, type EventTransport, type ExchangeRateBridge, type ExportField, type ExportFieldMap, type FieldError, type FiscalLockPluginOptions, type FiscalPeriodSummary, type FlatJournalRow, type FxRealizationPluginOptions, type GeneralLedgerAccount, type GeneralLedgerReport, IdempotencyConflictError, type ImmutableGuardOptions, ImmutableViolationError, InProcessLedgerBus, type InProcessLedgerBusOptions, type IncomeStatementLineSource, type IncomeStatementReport, type IncomeStatementSection, type IntrospectAPI, InvalidOutboxEventError, JOURNAL_CODES, JOURNAL_TYPES, type JournalEntryInput, type JournalEntryRepository, type JournalItem, type JournalItemInput, type JournalItemRef, type JournalRepository, type JournalSchemaOptions, JournalSeeded, type JournalSeededPayload, type JournalTemplate, type JournalType, LEDGER_EVENTS, LINE_SOURCE_INDEXES, type LedgerBridges, type LedgerEntry, type LedgerEventDefinition, type LedgerEventName, type LedgerEventPayloadOf, type LedgerEventSchema, type LedgerModels, type LedgerPaginationConfig, type LedgerRepositories, type LedgerRepositoryPlugins, type LockAccountSelector, type LockHit, type LockResolver, type LockResolverContext, type Logger, type MainType, type MatchHookContext, type MatchHookItem, type MatchInput, type ModelNames, Money, type MultiCurrencyConfig, type MultiTenantConfig, type NormalBalance, type NotificationBridge, type NotificationBridgeContext, type OpenItem, type OpeningBalanceInput, type OpeningBalanceResult, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxWriteOptions, type PartnerLedgerLine, type PartnerLedgerOptions, type PartnerLedgerParams, type PartnerLedgerReport, type PeriodColumn, type PeriodLockedNotification, type PeriodResolverOptions, type PopulatedJournalEntry, type PostOptions, type PostingContract, type PostingResult, type PublishManyResult, ReconciliationMatched, type ReconciliationMatchedPayload, type ReconciliationMismatchNotification, type ReconciliationRepository, ReconciliationUnmatched, type ReconciliationUnmatchedPayload, type RecordAPI, type RecordAdjustmentInput, type RecordAdjustmentLine, type RecordExpenseInput, type RecordOptions, type RecordPaymentInput, type RecordSaleInput, type RecordTransferInput, type ReportAccount, type ReportCategory, type ReportDescriptor, type ReportGroup, type ReportLine, type ReportSection, type ResolvedModelNames, type RevaluationOptions, type RevaluationParams, type RevaluationRate, type RevaluationReport, type RevaluationResult, type ReverseOptions, type ReverseResult, type SchemaOptions, type SeedOptions, type SeedResult, type Cents$1 as SemanticCents, type SessionResult, type SourceBridge, type SourceBridgeContext, type SourceRef, type StatementType, type StrictnessConfig, type SubledgerJournalItem, type SubledgerPostingInput, type TaxDetail, type TaxMetadata, type TotalAccountOp, type TrialBalanceColumnRow, type TrialBalanceReport, type TrialBalanceRow, type UnmatchHookContext, type WatermarkResolverOptions, acquireSession, add, allocate, buildAccountTypeMap, buildDimensionFields, buildDimensionIndexes, buildItemFilters, buildOpeningBalanceEntry, buildRevaluationEntry, calculateTotal, classifyDuplicateKey, closeFiscalPeriod, computeEndingBalance, computeRevaluation, createAccountingEngine, createEvent, createLockPlugin, createModels, createRepositories, creditLimitPlugin, dailyLockPlugin, defaultLogger, defineCountryPack, doubleEntryPlugin, exportToCsv, finalizeSession, fiscalLockPlugin, flattenJournalEntries, format, formatPlain, fromDecimal, fxRealizationPlugin, generateAgedBalance, generateBalanceSheet, generateBudgetVsActual, generateCashFlow, generateDimensionBreakdown, generateGeneralLedger, generateIncomeStatement, generatePartnerLedger, generateRevaluation, generateTrialBalance, getCurrency, getCustomJournalTypes, getDateRange, getFiscalYearStart, getJournalType, getJournalTypeCodes, getMinorUnit, getNormalBalance, idempotencyPlugin, immutableGuardPlugin, isBalanceSheet, isIncomeStatement, isValidCategory, isValidCurrency, isValidJournalType, isVirtualTaxAccount, ledgerEventDefinitions, multiply, parseCents, percentage, periodResolver, quickbooksFieldMap, registerJournalType, reopenFiscalPeriod, resolveModelNames, splitTaxExclusive, splitTaxInclusive, subtract, toDecimal, universalFieldMap, watermarkResolver };