@classytic/ledger 0.1.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +161 -64
  2. package/dist/{account.repository-Crf5DGO4.mjs → account.repository-BpkSd6q3.mjs} +190 -41
  3. package/dist/{categories-BNJBd4ze.mjs → categories-CclX7Q94.mjs} +0 -2
  4. package/dist/constants/index.d.mts +1 -1
  5. package/dist/constants/index.mjs +4 -5
  6. package/dist/{core-Cx0baosR.d.mts → core-8Xfnpn6g.d.mts} +1 -2
  7. package/dist/country/index.d.mts +2 -105
  8. package/dist/country/index.mjs +0 -2
  9. package/dist/{currencies-Bkn3FNkC.d.mts → currencies-4WAbFRlw.d.mts} +2 -3
  10. package/dist/{currencies-BBk3NwXn.mjs → currencies-W8kQAkm0.mjs} +0 -2
  11. package/dist/{idempotency.plugin-C6r8RI8d.mjs → date-lock.plugin-eYAJ9h_u.mjs} +50 -13
  12. package/dist/{engine-Cd73EOT6.d.mts → engine-Cn-9yerQ.d.mts} +38 -8
  13. package/dist/{errors-CeqRahE-.mjs → errors-B7yC-Jfw.mjs} +0 -2
  14. package/dist/exports/index.d.mts +2 -2
  15. package/dist/exports/index.mjs +2 -3
  16. package/dist/{universal-CMfrZ2hG.mjs → exports-I5Xkq-9_.mjs} +0 -7
  17. package/dist/{fiscal-close-DuXDgVvb.mjs → fiscal-close-B6LhQ10f.mjs} +742 -32
  18. package/dist/fiscal-period.schema-BMnlI9H5.d.mts +103 -0
  19. package/dist/{idempotency.plugin-BESs9YPD.d.mts → idempotency.plugin-B_CNsInz.d.mts} +19 -17
  20. package/dist/{universal-x33ZJODp.d.mts → index-BPukb3L8.d.mts} +1 -2
  21. package/dist/index-CxZqRaOU.d.mts +119 -0
  22. package/dist/index.d.mts +251 -29
  23. package/dist/index.mjs +124 -27
  24. package/dist/{journals-CI3Wb4EF.mjs → journals-oH-FK3g8.mjs} +0 -2
  25. package/dist/{logger-Cv6VVc4r.d.mts → logger-CbHWZl7v.d.mts} +1 -2
  26. package/dist/money.d.mts +1 -2
  27. package/dist/money.mjs +3 -3
  28. package/dist/plugins/index.d.mts +38 -2
  29. package/dist/plugins/index.mjs +57 -3
  30. package/dist/reconciliation.repository-CW4-8q90.d.mts +135 -0
  31. package/dist/{fiscal-period.schema-CbALaaKl.mjs → reconciliation.schema-BuetvZTd.mjs} +218 -30
  32. package/dist/reports/index.d.mts +2 -2
  33. package/dist/reports/index.mjs +2 -3
  34. package/dist/repositories/index.d.mts +2 -2
  35. package/dist/repositories/index.mjs +2 -3
  36. package/dist/revaluation-D9x0NE8w.d.mts +530 -0
  37. package/dist/schemas/index.d.mts +71 -2
  38. package/dist/schemas/index.mjs +2 -3
  39. package/dist/tenant-guard-Fm6AID_6.mjs +13 -0
  40. package/docs/reports.md +1 -1
  41. package/package.json +3 -3
  42. package/dist/account.repository-1C2sZvB2.d.mts +0 -29
  43. package/dist/account.repository-1C2sZvB2.d.mts.map +0 -1
  44. package/dist/account.repository-Crf5DGO4.mjs.map +0 -1
  45. package/dist/categories-BNJBd4ze.mjs.map +0 -1
  46. package/dist/core-Cx0baosR.d.mts.map +0 -1
  47. package/dist/country/index.d.mts.map +0 -1
  48. package/dist/country/index.mjs.map +0 -1
  49. package/dist/currencies-BBk3NwXn.mjs.map +0 -1
  50. package/dist/currencies-Bkn3FNkC.d.mts.map +0 -1
  51. package/dist/engine-Cd73EOT6.d.mts.map +0 -1
  52. package/dist/errors-CeqRahE-.mjs.map +0 -1
  53. package/dist/fiscal-close-CzUzpnMg.d.mts +0 -270
  54. package/dist/fiscal-close-CzUzpnMg.d.mts.map +0 -1
  55. package/dist/fiscal-close-DuXDgVvb.mjs.map +0 -1
  56. package/dist/fiscal-period.schema-CbALaaKl.mjs.map +0 -1
  57. package/dist/fiscal-period.schema-DI2scngu.d.mts +0 -38
  58. package/dist/fiscal-period.schema-DI2scngu.d.mts.map +0 -1
  59. package/dist/idempotency.plugin-BESs9YPD.d.mts.map +0 -1
  60. package/dist/idempotency.plugin-C6r8RI8d.mjs.map +0 -1
  61. package/dist/index.d.mts.map +0 -1
  62. package/dist/index.mjs.map +0 -1
  63. package/dist/journals-CI3Wb4EF.mjs.map +0 -1
  64. package/dist/logger-Cv6VVc4r.d.mts.map +0 -1
  65. package/dist/money.d.mts.map +0 -1
  66. package/dist/money.mjs.map +0 -1
  67. package/dist/session-Dh0s6zG4.mjs +0 -87
  68. package/dist/session-Dh0s6zG4.mjs.map +0 -1
  69. package/dist/universal-CMfrZ2hG.mjs.map +0 -1
  70. package/dist/universal-x33ZJODp.d.mts.map +0 -1
@@ -1,105 +1,2 @@
1
- import { t as AccountType } from "../core-Cx0baosR.mjs";
2
-
3
- //#region src/country/index.d.ts
4
- interface TaxCode {
5
- readonly code: string;
6
- readonly name: string;
7
- readonly taxType: string;
8
- readonly rate: number;
9
- readonly direction: 'collected' | 'recoverable' | 'paid';
10
- readonly province?: string;
11
- readonly reportLines?: readonly number[];
12
- readonly description: string;
13
- readonly active: boolean;
14
- }
15
- interface TaxCodesByRegion {
16
- readonly [region: string]: readonly string[];
17
- }
18
- interface TaxReportLine {
19
- readonly line: number | string;
20
- readonly name: string;
21
- readonly description: string;
22
- readonly type: 'input' | 'calculated' | 'manual';
23
- readonly calculate?: (data: Record<string | number, number>) => number;
24
- readonly section: string;
25
- }
26
- interface TaxReportTemplate {
27
- readonly name: string;
28
- readonly lines: Readonly<Record<string | number, TaxReportLine>>;
29
- calculate(inputData: Record<string | number, number>, manualData?: Record<string | number, number>): Record<string | number, number>;
30
- summarize(calculated: Record<string | number, number>): Record<string, unknown>;
31
- }
32
- interface CountryPack {
33
- /** ISO 3166-1 alpha-2 code (e.g., 'CA', 'US', 'GB') */
34
- readonly code: string;
35
- /** Country name */
36
- readonly name: string;
37
- /** Default currency code */
38
- readonly defaultCurrency: string;
39
- /**
40
- * Full chart of accounts template — flat array of account type definitions.
41
- * Includes both regular accounts and virtual tax sub-accounts.
42
- */
43
- readonly accountTypes: readonly AccountType[];
44
- /** Tax codes indexed by code string */
45
- readonly taxCodes: Readonly<Record<string, TaxCode>>;
46
- /** Tax codes grouped by region/province/state */
47
- readonly taxCodesByRegion: TaxCodesByRegion;
48
- /** Available regions (provinces/states) */
49
- readonly regions: readonly string[];
50
- /** Tax report template (e.g., CRA GST/HST return) */
51
- readonly taxReport?: TaxReportTemplate;
52
- /** Account code for prior retained earnings (e.g. '3660' CA, '3200' US) */
53
- readonly retainedEarningsCode?: string;
54
- /** Account code for current year net income (e.g. '3680' CA, '3210' US) */
55
- readonly currentYearEarningsCode?: string;
56
- /** Group label code used to identify Cost of Sales in the income statement */
57
- readonly cogsGroupCode?: string;
58
- /** Override default English report section names */
59
- readonly reportLabels?: {
60
- readonly assets?: string;
61
- readonly liabilities?: string;
62
- readonly equity?: string;
63
- readonly revenue?: string;
64
- readonly expenses?: string;
65
- };
66
- /** Get all account types that can be posted to (not groups, not totals) */
67
- getPostingAccountTypes(): readonly AccountType[];
68
- /** Get account type by code */
69
- getAccountType(code: string): AccountType | undefined;
70
- /** Validate an account type code exists */
71
- isValidAccountType(code: string): boolean;
72
- /** Check if an account type can receive postings */
73
- isPostingAccount(code: string): boolean;
74
- /** Get tax codes for a specific region */
75
- getTaxCodesForRegion(region: string): TaxCode[];
76
- /** Flatten hierarchical accounts (if needed) */
77
- flattenAccountTypes(): readonly AccountType[];
78
- }
79
- interface CountryPackInput {
80
- code: string;
81
- name: string;
82
- defaultCurrency: string;
83
- accountTypes: readonly AccountType[];
84
- taxCodes: Readonly<Record<string, TaxCode>>;
85
- taxCodesByRegion: TaxCodesByRegion;
86
- regions: readonly string[];
87
- taxReport?: TaxReportTemplate;
88
- retainedEarningsCode?: string;
89
- currentYearEarningsCode?: string;
90
- cogsGroupCode?: string;
91
- reportLabels?: {
92
- readonly assets?: string;
93
- readonly liabilities?: string;
94
- readonly equity?: string;
95
- readonly revenue?: string;
96
- readonly expenses?: string;
97
- };
98
- }
99
- /**
100
- * Factory to create a CountryPack with auto-generated helper methods.
101
- */
102
- declare function defineCountryPack(input: CountryPackInput): CountryPack;
103
- //#endregion
104
- export { CountryPack, CountryPackInput, TaxCode, TaxCodesByRegion, TaxReportLine, TaxReportTemplate, defineCountryPack };
105
- //# sourceMappingURL=index.d.mts.map
1
+ import { a as TaxReportLine, i as TaxCodesByRegion, n as CountryPackInput, o as TaxReportTemplate, r as TaxCode, s as defineCountryPack, t as CountryPack } from "../index-CxZqRaOU.mjs";
2
+ export { CountryPack, CountryPackInput, TaxCode, TaxCodesByRegion, TaxReportLine, TaxReportTemplate, defineCountryPack };
@@ -21,7 +21,5 @@ function defineCountryPack(input) {
21
21
  flattenAccountTypes: () => input.accountTypes
22
22
  };
23
23
  }
24
-
25
24
  //#endregion
26
25
  export { defineCountryPack };
27
- //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import { d as JournalType, f as MainType, h as StatementType, i as CategoryKey, o as Currency, r as Category } from "./core-Cx0baosR.mjs";
1
+ import { d as JournalType, f as MainType, h as StatementType, i as CategoryKey, o as Currency, r as Category } from "./core-8Xfnpn6g.mjs";
2
2
 
3
3
  //#region src/constants/categories.d.ts
4
4
  /** All valid categories */
@@ -34,5 +34,4 @@ declare function getCurrency(code: string): Currency | null;
34
34
  declare function isValidCurrency(code: string): boolean;
35
35
  declare function getMinorUnit(code: string): number;
36
36
  //#endregion
37
- export { getNormalBalance as _, JOURNAL_CODES as a, isValidCategory as b, getJournalTypeCodes as c, CATEGORY_KEYS as d, categoryKey as f, getCategoryStatementType as g, getCategoryMainType as h, isValidCurrency as i, isValidJournalType as l, extractStatementType as m, getCurrency as n, JOURNAL_TYPES as o, extractMainType as p, getMinorUnit as r, getJournalType as s, CURRENCIES as t, CATEGORIES as u, isBalanceSheet as v, isIncomeStatement as y };
38
- //# sourceMappingURL=currencies-Bkn3FNkC.d.mts.map
37
+ export { getNormalBalance as _, JOURNAL_CODES as a, isValidCategory as b, getJournalTypeCodes as c, CATEGORY_KEYS as d, categoryKey as f, getCategoryStatementType as g, getCategoryMainType as h, isValidCurrency as i, isValidJournalType as l, extractStatementType as m, getCurrency as n, JOURNAL_TYPES as o, extractMainType as p, getMinorUnit as r, getJournalType as s, CURRENCIES as t, CATEGORIES as u, isBalanceSheet as v, isIncomeStatement as y };
@@ -76,7 +76,5 @@ function isValidCurrency(code) {
76
76
  function getMinorUnit(code) {
77
77
  return CURRENCIES[code]?.minorUnit ?? 2;
78
78
  }
79
-
80
79
  //#endregion
81
80
  export { isValidCurrency as i, getCurrency as n, getMinorUnit as r, CURRENCIES as t };
82
- //# sourceMappingURL=currencies-BBk3NwXn.mjs.map
@@ -1,5 +1,4 @@
1
- import { n as Errors } from "./errors-CeqRahE-.mjs";
2
-
1
+ import { n as Errors } from "./errors-B7yC-Jfw.mjs";
3
2
  //#region src/plugins/double-entry.plugin.ts
4
3
  function doubleEntryPlugin(options = {}) {
5
4
  const { onlyOnPost = true, JournalEntryModel, AccountModel, orgField } = options;
@@ -81,12 +80,11 @@ function doubleEntryPlugin(options = {}) {
81
80
  ...existing
82
81
  }, context);
83
82
  };
84
- repo.on("before:create", (payload) => validate(payload));
85
- repo.on("before:update", (payload) => validateUpdate(payload));
83
+ repo.on("before:create", validate);
84
+ repo.on("before:update", validateUpdate);
86
85
  }
87
86
  };
88
87
  }
89
-
90
88
  //#endregion
91
89
  //#region src/plugins/fiscal-lock.plugin.ts
92
90
  function fiscalLockPlugin(options) {
@@ -134,12 +132,11 @@ function fiscalLockPlugin(options) {
134
132
  throw Errors.fiscal(`Cannot post entry dated ${entryDate.toISOString().split("T")[0]}: fiscal period "${period.name}" is closed.`);
135
133
  }
136
134
  };
137
- repo.on("before:create", (payload) => checkPeriod(payload, false));
138
- repo.on("before:update", (payload) => checkPeriod(payload, true));
135
+ repo.on("before:create", (ctx) => checkPeriod(ctx, false));
136
+ repo.on("before:update", (ctx) => checkPeriod(ctx, true));
139
137
  }
140
138
  };
141
139
  }
142
-
143
140
  //#endregion
144
141
  //#region src/plugins/idempotency.plugin.ts
145
142
  function idempotencyPlugin(options) {
@@ -147,8 +144,7 @@ function idempotencyPlugin(options) {
147
144
  return {
148
145
  name: "accounting:idempotency",
149
146
  apply(repo) {
150
- repo.on("before:create", async (raw) => {
151
- const context = raw;
147
+ repo.on("before:create", async (context) => {
152
148
  const data = context.data;
153
149
  if (!data?.idempotencyKey) return;
154
150
  const query = { idempotencyKey: data.idempotencyKey };
@@ -159,7 +155,48 @@ function idempotencyPlugin(options) {
159
155
  }
160
156
  };
161
157
  }
162
-
163
158
  //#endregion
164
- export { fiscalLockPlugin as n, doubleEntryPlugin as r, idempotencyPlugin as t };
165
- //# sourceMappingURL=idempotency.plugin-C6r8RI8d.mjs.map
159
+ //#region src/plugins/date-lock.plugin.ts
160
+ function dateLockPlugin(options) {
161
+ const { getLockDate, JournalEntryModel, orgField } = options;
162
+ return {
163
+ name: "accounting:date-lock",
164
+ apply(repo) {
165
+ const checkLock = async (context, isUpdate) => {
166
+ const data = context.data;
167
+ if (!data) return;
168
+ if (data.state !== "posted") return;
169
+ const session = context.session ?? null;
170
+ let entryDate;
171
+ let persistedDoc = null;
172
+ if (data.date) entryDate = new Date(data.date);
173
+ else if (!isUpdate) entryDate = /* @__PURE__ */ new Date();
174
+ else {
175
+ if (!context.id) throw new Error("dateLockPlugin: update context is missing \"id\". Cannot validate date lock without document ID.");
176
+ const selectFields = orgField ? `date ${orgField}` : "date";
177
+ persistedDoc = await JournalEntryModel.findById(context.id).select(selectFields).session(session).lean();
178
+ if (persistedDoc?.date) entryDate = new Date(persistedDoc.date);
179
+ }
180
+ if (!entryDate) return;
181
+ let orgValue;
182
+ if (orgField) {
183
+ orgValue = data[orgField] ?? context[orgField];
184
+ if (!orgValue && isUpdate) {
185
+ if (persistedDoc) orgValue = persistedDoc[orgField];
186
+ else if (context.id) {
187
+ const persisted = await JournalEntryModel.findById(context.id).select(orgField).session(session).lean();
188
+ if (persisted) orgValue = persisted[orgField];
189
+ }
190
+ }
191
+ }
192
+ const lockDate = await getLockDate(orgValue, session ?? void 0);
193
+ if (!lockDate) return;
194
+ if (entryDate < lockDate) throw Errors.fiscal(`Cannot post entry dated ${entryDate.toISOString().split("T")[0]}: date is before lock date ${lockDate.toISOString().split("T")[0]}.`);
195
+ };
196
+ repo.on("before:create", (ctx) => checkLock(ctx, false));
197
+ repo.on("before:update", (ctx) => checkLock(ctx, true));
198
+ }
199
+ };
200
+ }
201
+ //#endregion
202
+ export { doubleEntryPlugin as i, idempotencyPlugin as n, fiscalLockPlugin as r, dateLockPlugin as t };
@@ -1,5 +1,5 @@
1
- import { CountryPack } from "./country/index.mjs";
2
- import { t as Logger } from "./logger-Cv6VVc4r.mjs";
1
+ import { t as CountryPack } from "./index-CxZqRaOU.mjs";
2
+ import { t as Logger } from "./logger-CbHWZl7v.mjs";
3
3
 
4
4
  //#region src/types/engine.d.ts
5
5
  /** Multi-tenant configuration */
@@ -44,19 +44,50 @@ interface StrictnessConfig {
44
44
  /** If true, entries must have approvedBy/approvedAt set before posting */
45
45
  requireApproval?: boolean;
46
46
  }
47
+ /**
48
+ * Multi-currency configuration.
49
+ * When enabled, adds currency and exchange rate fields to journal items
50
+ * and a currency field to accounts. Allows recording transactions in
51
+ * foreign currencies while maintaining a base (functional) currency.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const engine = createAccountingEngine({
56
+ * country: canadaPack,
57
+ * currency: 'CAD', // base/functional currency
58
+ * multiCurrency: {
59
+ * enabled: true,
60
+ * currencies: ['USD', 'GBP', 'BDT'], // allowed foreign currencies
61
+ * },
62
+ * });
63
+ * ```
64
+ */
65
+ interface MultiCurrencyConfig {
66
+ /** Enable multi-currency fields on schemas */
67
+ enabled: boolean;
68
+ /** Allowed foreign currency codes. If omitted, any ISO 4217 code is accepted. */
69
+ currencies?: readonly string[];
70
+ }
47
71
  /** Main engine configuration */
48
72
  interface AccountingEngineConfig {
49
73
  /** Country pack providing account types, tax codes, and templates */
50
74
  country: CountryPack;
51
- /** Default ISO 4217 currency code (e.g., 'CAD', 'USD') */
75
+ /** Default ISO 4217 currency code — the functional/base currency (e.g., 'CAD', 'BDT') */
52
76
  currency: string;
53
77
  /** Multi-tenant configuration. Omit for single-tenant apps. */
54
78
  multiTenant?: MultiTenantConfig;
79
+ /** Multi-currency support. Omit for single-currency apps. */
80
+ multiCurrency?: MultiCurrencyConfig;
55
81
  /** Fiscal year start month (1-12, default: 1 = January) */
56
82
  fiscalYearStartMonth?: number;
57
- /** Display code for prior retained earnings on balance sheet (default: '3660') */
58
- retainedEarningsCode?: string;
59
- /** Display code for current year net income on balance sheet (default: '3680') */
83
+ /**
84
+ * The retained earnings account code (e.g. '3600' CA, '3310' BD).
85
+ * Overrides the country pack value. See CountryPack.retainedEarningsAccountCode.
86
+ */
87
+ retainedEarningsAccountCode?: string;
88
+ /** Display code for the "Previous Years Retained Earnings" line. Overrides country pack. */
89
+ retainedEarningsDisplayCode?: string;
90
+ /** Display code for current year net income line. Overrides country pack. */
60
91
  currentYearEarningsCode?: string;
61
92
  /** Logger instance. Defaults to console-based logger. */
62
93
  logger?: Logger;
@@ -68,5 +99,4 @@ interface AccountingEngineConfig {
68
99
  strictness?: StrictnessConfig;
69
100
  }
70
101
  //#endregion
71
- export { SchemaOptions as a, MultiTenantConfig as i, AuditConfig as n, StrictnessConfig as o, JournalSchemaOptions as r, AccountingEngineConfig as t };
72
- //# sourceMappingURL=engine-Cd73EOT6.d.mts.map
102
+ export { MultiTenantConfig as a, MultiCurrencyConfig as i, AuditConfig as n, SchemaOptions as o, JournalSchemaOptions as r, StrictnessConfig as s, AccountingEngineConfig as t };
@@ -22,7 +22,5 @@ const Errors = {
22
22
  immutable: (msg) => new AccountingError(msg, 403, "IMMUTABLE_ENTRY"),
23
23
  fiscal: (msg) => new AccountingError(msg, 400, "FISCAL_ERROR")
24
24
  };
25
-
26
25
  //#endregion
27
26
  export { Errors as n, AccountingError as t };
28
- //# sourceMappingURL=errors-CeqRahE-.mjs.map
@@ -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 flattenJournalEntry, l as buildCsv, m as ExportFieldMap, n as quickbooksFieldMap, o as extractAllRows, p as ExportField, r as flattenJournalEntries, s as extractRow, t as universalFieldMap, u as escapeCell, v as PopulatedJournalItem } from "../universal-x33ZJODp.mjs";
2
- export { type CsvOptions, type ExportField, type ExportFieldMap, type FlatJournalRow, type PopulatedAccount, type PopulatedJournalEntry, type PopulatedJournalItem, buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
1
+ import { _ as PopulatedJournalEntry, a as exportToCsv, c as getHeaders, d as serializeCsv, f as CsvOptions, g as PopulatedAccount, h as FlatJournalRow, i as flattenJournalEntry, l as buildCsv, m as ExportFieldMap, n as quickbooksFieldMap, o as extractAllRows, p as ExportField, r as flattenJournalEntries, s as extractRow, t as universalFieldMap, u as escapeCell, v as PopulatedJournalItem } from "../index-BPukb3L8.mjs";
2
+ export { CsvOptions, ExportField, ExportFieldMap, FlatJournalRow, PopulatedAccount, PopulatedJournalEntry, PopulatedJournalItem, buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
@@ -1,3 +1,2 @@
1
- import { a as exportToCsv, c as getHeaders, d as serializeCsv, i as flattenJournalEntry, l as buildCsv, n as quickbooksFieldMap, o as extractAllRows, r as flattenJournalEntries, s as extractRow, t as universalFieldMap, u as escapeCell } from "../universal-CMfrZ2hG.mjs";
2
-
3
- export { buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
1
+ import { a as exportToCsv, c as getHeaders, d as serializeCsv, i as flattenJournalEntry, l as buildCsv, n as quickbooksFieldMap, o as extractAllRows, r as flattenJournalEntries, s as extractRow, t as universalFieldMap, u as escapeCell } from "../exports-I5Xkq-9_.mjs";
2
+ export { buildCsv, escapeCell, exportToCsv, extractAllRows, extractRow, flattenJournalEntries, flattenJournalEntry, getHeaders, quickbooksFieldMap, serializeCsv, universalFieldMap };
@@ -1,5 +1,4 @@
1
1
  import { Money } from "./money.mjs";
2
-
3
2
  //#region src/exports/csv-serializer.ts
4
3
  const NEEDS_QUOTING = /[",\r\n]/;
5
4
  /** Escape a single CSV cell value per RFC 4180. */
@@ -17,7 +16,6 @@ function buildCsv(headers, dataRows, options = {}) {
17
16
  const { includeHeaders = true } = options;
18
17
  return serializeCsv(includeHeaders ? [headers, ...dataRows] : [...dataRows], options);
19
18
  }
20
-
21
19
  //#endregion
22
20
  //#region src/exports/field-map.ts
23
21
  /** Extract headers from a field map. */
@@ -36,7 +34,6 @@ function extractAllRows(fieldMap, rows) {
36
34
  function exportToCsv(fieldMap, rows, options) {
37
35
  return buildCsv(getHeaders(fieldMap), extractAllRows(fieldMap, rows), options);
38
36
  }
39
-
40
37
  //#endregion
41
38
  //#region src/exports/flatten-journal.ts
42
39
  function toDate(value) {
@@ -110,7 +107,6 @@ function flattenJournalEntries(entries) {
110
107
  for (const entry of entries) rows.push(...flattenJournalEntry(entry));
111
108
  return rows;
112
109
  }
113
-
114
110
  //#endregion
115
111
  //#region src/exports/field-maps/quickbooks.ts
116
112
  function formatQbDate(date) {
@@ -163,7 +159,6 @@ const quickbooksFieldMap = {
163
159
  }
164
160
  ]
165
161
  };
166
-
167
162
  //#endregion
168
163
  //#region src/exports/field-maps/universal.ts
169
164
  function formatIsoDate(date) {
@@ -251,7 +246,5 @@ const universalFieldMap = {
251
246
  }
252
247
  ]
253
248
  };
254
-
255
249
  //#endregion
256
250
  export { exportToCsv as a, getHeaders as c, serializeCsv as d, flattenJournalEntry as i, buildCsv as l, quickbooksFieldMap as n, extractAllRows as o, flattenJournalEntries as r, extractRow as s, universalFieldMap as t, escapeCell as u };
257
- //# sourceMappingURL=universal-CMfrZ2hG.mjs.map