@mulmoclaude/accounting-plugin 0.3.3 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/accountNormalize.d.ts +1 -1
- package/dist/server/accountNormalize.d.ts.map +1 -1
- package/dist/server/context.d.ts +3 -10
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/defaultAccounts.d.ts +1 -1
- package/dist/server/defaultAccounts.d.ts.map +1 -1
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/io.d.ts +2 -1
- package/dist/server/io.d.ts.map +1 -1
- package/dist/server/journal.d.ts +1 -1
- package/dist/server/journal.d.ts.map +1 -1
- package/dist/server/openingBalances.d.ts +1 -1
- package/dist/server/openingBalances.d.ts.map +1 -1
- package/dist/server/report.d.ts +6 -64
- package/dist/server/report.d.ts.map +1 -1
- package/dist/server/service.d.ts +1 -1
- package/dist/server/service.d.ts.map +1 -1
- package/dist/server/snapshotCache.d.ts +2 -1
- package/dist/server/snapshotCache.d.ts.map +1 -1
- package/dist/server/timeSeries.d.ts +1 -1
- package/dist/server/timeSeries.d.ts.map +1 -1
- package/dist/server/types.d.ts +1 -123
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server.cjs +22 -73
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +14 -65
- package/dist/server.js.map +1 -1
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/types.d.ts +188 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared-CcU3_qAa.cjs +749 -0
- package/dist/shared-CcU3_qAa.cjs.map +1 -0
- package/dist/shared-MOpJ1kUa.js +516 -0
- package/dist/shared-MOpJ1kUa.js.map +1 -0
- package/dist/shared.cjs +40 -519
- package/dist/shared.js +2 -483
- package/dist/vue/api.d.ts +2 -121
- package/dist/vue/api.d.ts.map +1 -1
- package/dist/vue/lang/index.d.ts +204 -215
- package/dist/vue/lang/index.d.ts.map +1 -1
- package/dist/vue.cjs +1651 -1678
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js +1652 -1679
- package/dist/vue.js.map +1 -1
- package/package.json +11 -6
- package/dist/server/atomic.d.ts +0 -15
- package/dist/server/atomic.d.ts.map +0 -1
- package/dist/shared.cjs.map +0 -1
- package/dist/shared.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountNormalize.d.ts","sourceRoot":"","sources":["../../src/server/accountNormalize.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"accountNormalize.d.ts","sourceRoot":"","sources":["../../src/server/accountNormalize.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAMlF"}
|
package/dist/server/context.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
import type { StructuredLogger } from "@mulmoclaude/common";
|
|
1
2
|
/** Minimal pub/sub shape — structurally compatible with the host's
|
|
2
3
|
* `IPubSub`. The eventPublisher holds its own instance (set via
|
|
3
4
|
* `initAccountingEventPublisher`); this type is the contract. */
|
|
4
5
|
export interface IPubSub {
|
|
5
6
|
publish: (channel: string, payload: unknown) => void;
|
|
6
7
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
* `Record<string, unknown>` (not `object`) so the host's `Logger`
|
|
10
|
-
* is structurally assignable when injected. */
|
|
11
|
-
export interface AccountingLogger {
|
|
12
|
-
error: (namespace: string, message: string, data?: Record<string, unknown>) => void;
|
|
13
|
-
warn: (namespace: string, message: string, data?: Record<string, unknown>) => void;
|
|
14
|
-
info: (namespace: string, message: string, data?: Record<string, unknown>) => void;
|
|
15
|
-
debug: (namespace: string, message: string, data?: Record<string, unknown>) => void;
|
|
16
|
-
}
|
|
8
|
+
/** Alias of the shared `StructuredLogger` — the host `Logger` stays directly assignable when injected. */
|
|
9
|
+
export type AccountingLogger = StructuredLogger;
|
|
17
10
|
export interface AccountingServerDeps {
|
|
18
11
|
/** Absolute path to the workspace root (where `data/` lives). Used as
|
|
19
12
|
* the default when a service/io call doesn't pass an explicit root. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/server/context.ts"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/server/context.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;kEAEkE;AAClE,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACtD;AAED,0GAA0G;AAC1G,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC;4EACwE;IACxE,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAID,uEAAuE;AACvE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAE7E;AAED;;yEAEyE;AACzE,wBAAgB,oBAAoB,IAAI,MAAM,CAK7C;AASD;8EAC8E;AAC9E,eAAO,MAAM,GAAG,EAAE,gBAKjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultAccounts.d.ts","sourceRoot":"","sources":["../../src/server/defaultAccounts.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"defaultAccounts.d.ts","sourceRoot":"","sources":["../../src/server/defaultAccounts.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,eAAO,MAAM,gBAAgB,EAAE,SAAS,OAAO,EAsE9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/server/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/server/http.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI/D,wBAAgB,YAAY,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,GAAG,QAAQ,EAC1D,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAC/C,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAkB7D"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { configureAccountingServer } from "./context.js";
|
|
|
3
3
|
export type { AccountingServerDeps, AccountingLogger, IPubSub } from "./context.js";
|
|
4
4
|
export { initAccountingEventPublisher } from "./eventPublisher.js";
|
|
5
5
|
export { listBooks } from "./service.js";
|
|
6
|
-
export type { BookSummary } from "
|
|
6
|
+
export type { BookSummary } from "../shared/types.js";
|
|
7
7
|
export { isValidCalendarDate } from "./journal.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAKnE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAKnE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/server/io.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AccountingConfig,
|
|
1
|
+
import type { AccountingConfig, MonthSnapshot } from "./types.js";
|
|
2
|
+
import type { Account, JournalEntry } from "../shared/types.js";
|
|
2
3
|
export declare function isSafeBookId(bookId: string): boolean;
|
|
3
4
|
export declare function bookRoot(bookId: string, workspaceRoot?: string): string;
|
|
4
5
|
export declare function readConfig(workspaceRoot?: string): Promise<AccountingConfig | null>;
|
package/dist/server/io.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/server/io.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,gBAAgB,EAA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,CAAC,CAIzF;AAED;qDACqD;AACrD,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF"}
|
package/dist/server/journal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Account, JournalEntry, JournalLine } from "
|
|
1
|
+
import type { Account, JournalEntry, JournalLine } from "../shared/types.js";
|
|
2
2
|
/** Defensive cap on `JournalLine.taxRegistrationId`. Real-world IDs
|
|
3
3
|
* are short (JP T-numbers are 14 chars, EU VAT IDs ≤ 14, GSTIN is
|
|
4
4
|
* 15, ABN is 11). 32 covers every documented format with comfortable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/server/journal.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/server/journal.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAS7E;;;;;wDAKwD;AACxD,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAYD;;;;;;yDAMyD;AACzD,wBAAgB,eAAe,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAK9D;AAED;;;;;yDAKyD;AACzD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKzD;AAED;sEACsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CAOhE;AA4CD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,GAAG,gBAAgB,CAgBpI;AAED;;;;qBAIqB;AACrB,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,YAAY,CAWf;AAcD;;;6DAG6D;AAC7D,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIjF;AAED;;;;;;0BAM0B;AAC1B,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAoCnJ;AAED;;;;2CAI2C;AAC3C,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAMzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openingBalances.d.ts","sourceRoot":"","sources":["../../src/server/openingBalances.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"openingBalances.d.ts","sourceRoot":"","sources":["../../src/server/openingBalances.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAM7E,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,sBAAsB,EAAE,CAAC;CAClC;AAED;;;wCAGwC;AACxC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,GAAG,IAAI,CASvF;AAED,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,eAAe,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAwCD;;;;;;cAMc;AACd,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,uBAAuB,CAgBtF"}
|
package/dist/server/report.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { Account, AccountBalance,
|
|
1
|
+
import type { Account, AccountBalance, BalanceSheet, JournalEntry, Ledger, ProfitLoss } from "../shared/types.js";
|
|
2
|
+
/** Collapse an accountCode → netDebit map into the sorted
|
|
3
|
+
* `AccountBalance[]` wire shape. Shared by `aggregateBalances` and
|
|
4
|
+
* the snapshot cache's `mergeBalances` so the two produce identical,
|
|
5
|
+
* deterministically ordered output. */
|
|
6
|
+
export declare function sortedBalancesFromMap(balanceByCode: ReadonlyMap<string, number>): AccountBalance[];
|
|
2
7
|
/** Returns net (debit − credit) per account across the supplied
|
|
3
8
|
* entries. Voids work by having an original + reverse pair that
|
|
4
9
|
* cancel mathematically — both are included in aggregation (their
|
|
@@ -10,23 +15,6 @@ import type { Account, AccountBalance, AccountType, JournalEntry } from "./types
|
|
|
10
15
|
* original's amount with the wrong sign. Letting the math cancel
|
|
11
16
|
* naturally is simpler and impossible to get wrong. */
|
|
12
17
|
export declare function aggregateBalances(entries: readonly JournalEntry[]): AccountBalance[];
|
|
13
|
-
export interface BalanceSheetSection {
|
|
14
|
-
type: AccountType;
|
|
15
|
-
rows: {
|
|
16
|
-
accountCode: string;
|
|
17
|
-
accountName: string;
|
|
18
|
-
balance: number;
|
|
19
|
-
}[];
|
|
20
|
-
total: number;
|
|
21
|
-
}
|
|
22
|
-
export interface BalanceSheet {
|
|
23
|
-
asOf: string;
|
|
24
|
-
sections: BalanceSheetSection[];
|
|
25
|
-
/** Σ assets − Σ (liabilities + equity). Should be 0 (the
|
|
26
|
-
* accounting equation); a non-zero here indicates either a
|
|
27
|
-
* rounding artefact or a data problem. */
|
|
28
|
-
imbalance: number;
|
|
29
|
-
}
|
|
30
18
|
/** Sentinel `accountCode` for the synthetic "Current period
|
|
31
19
|
* earnings" row added to the Equity section by `buildBalanceSheet`.
|
|
32
20
|
* The View detects this code and substitutes a localised label
|
|
@@ -37,58 +25,12 @@ export declare function buildBalanceSheet(input: {
|
|
|
37
25
|
balances: readonly AccountBalance[];
|
|
38
26
|
asOf: string;
|
|
39
27
|
}): BalanceSheet;
|
|
40
|
-
export interface ProfitLoss {
|
|
41
|
-
from: string;
|
|
42
|
-
to: string;
|
|
43
|
-
income: {
|
|
44
|
-
rows: {
|
|
45
|
-
accountCode: string;
|
|
46
|
-
accountName: string;
|
|
47
|
-
amount: number;
|
|
48
|
-
}[];
|
|
49
|
-
total: number;
|
|
50
|
-
};
|
|
51
|
-
expense: {
|
|
52
|
-
rows: {
|
|
53
|
-
accountCode: string;
|
|
54
|
-
accountName: string;
|
|
55
|
-
amount: number;
|
|
56
|
-
}[];
|
|
57
|
-
total: number;
|
|
58
|
-
};
|
|
59
|
-
netIncome: number;
|
|
60
|
-
}
|
|
61
28
|
export declare function buildProfitLoss(input: {
|
|
62
29
|
accounts: readonly Account[];
|
|
63
30
|
entries: readonly JournalEntry[];
|
|
64
31
|
from: string;
|
|
65
32
|
to: string;
|
|
66
33
|
}): ProfitLoss;
|
|
67
|
-
export interface LedgerRow {
|
|
68
|
-
entryId: string;
|
|
69
|
-
date: string;
|
|
70
|
-
kind: JournalEntry["kind"];
|
|
71
|
-
memo?: string;
|
|
72
|
-
debit: number;
|
|
73
|
-
credit: number;
|
|
74
|
-
/** Running netDebit balance for this account, in entry order. */
|
|
75
|
-
runningBalance: number;
|
|
76
|
-
/** Counterparty tax-registration ID copied from the source
|
|
77
|
-
* journal line (T-number / VAT ID / GSTIN / ABN). Surfaced as a
|
|
78
|
-
* Ledger column when the active account is in the input-tax
|
|
79
|
-
* band (14xx — see `isTaxAccountCode` in
|
|
80
|
-
* src/plugins/accounting/components/accountNumbering.ts).
|
|
81
|
-
* Carried per row even on non-tax accounts so a future view
|
|
82
|
-
* that wants to show it elsewhere doesn't need a server change. */
|
|
83
|
-
taxRegistrationId?: string;
|
|
84
|
-
}
|
|
85
|
-
export interface Ledger {
|
|
86
|
-
accountCode: string;
|
|
87
|
-
accountName: string;
|
|
88
|
-
rows: LedgerRow[];
|
|
89
|
-
/** Closing netDebit balance — the sum at the bottom of `rows`. */
|
|
90
|
-
closingBalance: number;
|
|
91
|
-
}
|
|
92
34
|
export declare function buildLedger(input: {
|
|
93
35
|
account: Account;
|
|
94
36
|
entries: readonly JournalEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/server/report.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/server/report.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAe,YAAY,EAAuB,YAAY,EAAE,MAAM,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI/J;;;wCAGwC;AACxC,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,EAAE,CAIlG;AAED;;;;;;;;;wDASwD;AACxD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,cAAc,EAAE,CAYpF;AAUD;;;sCAGsC;AACtC,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAgBhE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CA4B1I;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CA2B/I;AAkDD,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgB7H"}
|
package/dist/server/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { aggregateBalances, buildBalanceSheet, buildLedger, buildProfitLoss } from "./report.js";
|
|
2
2
|
import { type TimeSeriesGranularity, type TimeSeriesMetric, type TimeSeriesPoint } from "./timeSeries.js";
|
|
3
3
|
import { balancesAtEndOf } from "./snapshotCache.js";
|
|
4
|
-
import type { Account, BookSummary, JournalEntry, JournalLine, ReportPeriod } from "
|
|
4
|
+
import type { Account, BookSummary, JournalEntry, JournalLine, ReportPeriod } from "../shared/types.js";
|
|
5
5
|
export declare class AccountingError extends Error {
|
|
6
6
|
status: number;
|
|
7
7
|
details?: unknown | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/server/service.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAoB,eAAe,EAA2E,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/server/service.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAoB,eAAe,EAA2E,MAAM,oBAAoB,CAAC;AAgBhJ,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExG,qBAAa,eAAgB,SAAQ,KAAK;IAE/B,MAAM,EAAE,MAAM;IAEd,OAAO,CAAC,EAAE,OAAO;gBAFjB,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACR,OAAO,CAAC,EAAE,OAAO,YAAA;CAK3B;AAiED,wBAAsB,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,CAGzF;AAyDD,wBAAsB,UAAU,CAC9B,KAAK,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO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AC,CAAA;CAAE,CAAC,CAYrE;AA0CD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,qBAAqB,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAsCD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAYzH;AAID,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAMzI;AAID,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MonthSnapshot } from "./types.js";
|
|
2
|
+
import type { AccountBalance } from "../shared/types.js";
|
|
2
3
|
/** Build a snapshot at end-of-`period` for one book, lazily relying
|
|
3
4
|
* on the previous month's snapshot if it exists. Falls all the way
|
|
4
5
|
* back to the earliest journal month if no upstream snapshot is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotCache.d.ts","sourceRoot":"","sources":["../../src/server/snapshotCache.ts"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C2D;AAC3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAWA;AAED;;mEAEmE;AACnE,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAUlE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Account, JournalEntry } from "
|
|
1
|
+
import type { Account, JournalEntry } from "../shared/types.js";
|
|
2
2
|
import { type FiscalYearEnd, TIME_SERIES_GRANULARITIES, TIME_SERIES_METRICS, type TimeSeriesGranularity, type TimeSeriesMetric } from "../shared";
|
|
3
3
|
export { TIME_SERIES_GRANULARITIES, TIME_SERIES_METRICS };
|
|
4
4
|
export type { TimeSeriesGranularity, TimeSeriesMetric };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeSeries.d.ts","sourceRoot":"","sources":["../../src/server/timeSeries.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAe,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"timeSeries.d.ts","sourceRoot":"","sources":["../../src/server/timeSeries.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAe,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAEL,KAAK,aAAa,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAC;AAExD,MAAM,WAAW,MAAM;IACrB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX;;;;6DAIyD;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX;;;4EAGwE;IACxE,KAAK,EAAE,MAAM,CAAC;CACf;AA8GD;;;;;;8DAM8D;AAC9D,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,qBAAqB,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,MAAM,EAAE,CAazI;AAkED,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,eAAe,EAAE,CAapB"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,119 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const ACCOUNT_TYPES: readonly ["asset", "liability", "equity", "income", "expense"];
|
|
3
|
-
export type AccountType = (typeof ACCOUNT_TYPES)[number];
|
|
4
|
-
/** B/S accounts (assets / liabilities / equity). Used by opening
|
|
5
|
-
* balance validation: opening entries reference balance-sheet
|
|
6
|
-
* accounts only. */
|
|
7
|
-
export declare const BALANCE_SHEET_ACCOUNT_TYPES: readonly AccountType[];
|
|
8
|
-
export interface Account {
|
|
9
|
-
/** Stable identifier the journal lines reference. Typically a
|
|
10
|
-
* numeric string ("1000" / "2000" …) but free-form is allowed
|
|
11
|
-
* so the user can adopt their existing numbering. */
|
|
12
|
-
code: string;
|
|
13
|
-
name: string;
|
|
14
|
-
type: AccountType;
|
|
15
|
-
/** Optional free-form note (tax bucket, parent group, …). Not
|
|
16
|
-
* interpreted by the engine — passes through verbatim. */
|
|
17
|
-
note?: string;
|
|
18
|
-
/** Soft-delete flag. When `false`, the account is hidden from
|
|
19
|
-
* entry/ledger dropdowns but stays visible in Manage Accounts
|
|
20
|
-
* and historical entries — accounting integrity requires that
|
|
21
|
-
* a code referenced by a journal line never disappears. Omitted
|
|
22
|
-
* (treated as active) by default to keep the JSON files clean
|
|
23
|
-
* for books created before this field existed. */
|
|
24
|
-
active?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface BookSummary {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
/** ISO 4217 (e.g. "USD" / "JPY"). Single-currency per book — no
|
|
30
|
-
* cross-book aggregation. */
|
|
31
|
-
currency: string;
|
|
32
|
-
/** ISO 3166-1 alpha-2 country code (e.g. "US" / "JP" / "GB").
|
|
33
|
-
* Identifies the tax jurisdiction the book is kept under so the
|
|
34
|
-
* Accounting role can give country-aware advice (Japanese T-number
|
|
35
|
-
* under インボイス制度, EU VAT ID, GSTIN, ABN, etc.). Constrained
|
|
36
|
-
* to `SupportedCountryCode` (the curated list shared with the UI
|
|
37
|
-
* dropdown and the LLM tool's JSON-schema enum) so a typo from any
|
|
38
|
-
* ingress path is rejected at the service layer rather than silently
|
|
39
|
-
* persisted. Optional for backward compatibility with books created
|
|
40
|
-
* before the field was introduced; the UI prompts existing books
|
|
41
|
-
* to set it. */
|
|
42
|
-
country?: SupportedCountryCode;
|
|
43
|
-
/** Calendar month (1-12) on whose LAST DAY the book's fiscal year
|
|
44
|
-
* closes — e.g. 8 = August 31, 12 = December 31 (calendar year).
|
|
45
|
-
* Drives the UI's "current quarter / current year" date-range
|
|
46
|
-
* shortcuts. Optional in the persisted shape for backward
|
|
47
|
-
* compatibility with books written before this field existed (and
|
|
48
|
-
* with the earlier "Q1".."Q4" token form) — read-side code
|
|
49
|
-
* normalises both via `resolveFiscalYearEnd`, treating an absent
|
|
50
|
-
* value as December. New books require it at the create boundary;
|
|
51
|
-
* the default is 12 (December). */
|
|
52
|
-
fiscalYearEnd?: FiscalYearEnd;
|
|
53
|
-
createdAt: string;
|
|
54
|
-
}
|
|
1
|
+
import type { AccountBalance, BookSummary } from "../shared/types.js";
|
|
55
2
|
export interface AccountingConfig {
|
|
56
3
|
books: BookSummary[];
|
|
57
4
|
}
|
|
58
|
-
export type JournalEntryKind = "normal" | "opening" | "void" | "void-marker";
|
|
59
|
-
export interface JournalLine {
|
|
60
|
-
accountCode: string;
|
|
61
|
-
/** Use exactly one of debit / credit per line, both as positive
|
|
62
|
-
* numbers. The engine treats them as separate fields rather than
|
|
63
|
-
* a single signed amount so the input matches a standard
|
|
64
|
-
* bookkeeping form. */
|
|
65
|
-
debit?: number;
|
|
66
|
-
credit?: number;
|
|
67
|
-
/** Per-line memo (the entry-level memo lives on JournalEntry). */
|
|
68
|
-
memo?: string;
|
|
69
|
-
/** Counterparty's tax-authority-issued registration ID for this
|
|
70
|
-
* line — Japanese 適格請求書発行事業者登録番号 (T-number), EU
|
|
71
|
-
* VAT identification number, UK VAT registration number, India
|
|
72
|
-
* GSTIN, Australia ABN, etc. Required for input-tax-credit
|
|
73
|
-
* eligibility under the Japanese インボイス制度 (effective
|
|
74
|
-
* 2023-10-01) and equivalent regimes elsewhere. Free-form string;
|
|
75
|
-
* format validation belongs upstream (per-jurisdiction). */
|
|
76
|
-
taxRegistrationId?: string;
|
|
77
|
-
}
|
|
78
|
-
export interface JournalEntry {
|
|
79
|
-
/** Globally unique within a book — ULID-style; ordering by id
|
|
80
|
-
* reproduces creation order. */
|
|
81
|
-
id: string;
|
|
82
|
-
/** Calendar date the entry is booked for (YYYY-MM-DD). The month
|
|
83
|
-
* part decides which `journal/YYYY-MM.jsonl` file the entry lives
|
|
84
|
-
* in; entries can be for any past / future date. */
|
|
85
|
-
date: string;
|
|
86
|
-
kind: JournalEntryKind;
|
|
87
|
-
lines: JournalLine[];
|
|
88
|
-
/** Entry-level memo. */
|
|
89
|
-
memo?: string;
|
|
90
|
-
/** When `kind === "void-marker"`: id of the entry being voided.
|
|
91
|
-
* When `kind === "void"`: the system-generated reverse entry
|
|
92
|
-
* references the original via this field. */
|
|
93
|
-
voidedEntryId?: string;
|
|
94
|
-
/** Reason supplied by the user when voiding. */
|
|
95
|
-
voidReason?: string;
|
|
96
|
-
/** When this entry was posted via the "edit" flow (void-then-add),
|
|
97
|
-
* this is the id of the entry it replaces. The void + new-entry
|
|
98
|
-
* pair is *not* atomic on the server — the client issues two
|
|
99
|
-
* sequential calls — but recording the link here makes the
|
|
100
|
-
* edit chain queryable later (e.g. "what corrected entry X?"). */
|
|
101
|
-
replacesEntryId?: string;
|
|
102
|
-
/** ISO timestamp the entry was appended to the journal — the
|
|
103
|
-
* authoritative "when did this hit the books" clock. Distinct
|
|
104
|
-
* from `date`, which is the user-visible booking date. */
|
|
105
|
-
createdAt: string;
|
|
106
|
-
}
|
|
107
|
-
/** Aggregated balance per account at a point in time. The signed
|
|
108
|
-
* number is debit − credit; downstream display logic converts to
|
|
109
|
-
* natural sign per account type (assets debit-positive, liabilities
|
|
110
|
-
* credit-positive). */
|
|
111
|
-
export interface AccountBalance {
|
|
112
|
-
accountCode: string;
|
|
113
|
-
/** Σ debit − Σ credit across all entries up to and including the
|
|
114
|
-
* snapshot's period end. */
|
|
115
|
-
netDebit: number;
|
|
116
|
-
}
|
|
117
5
|
export interface MonthSnapshot {
|
|
118
6
|
/** "YYYY-MM" — the closing month covered. */
|
|
119
7
|
period: string;
|
|
@@ -122,14 +10,4 @@ export interface MonthSnapshot {
|
|
|
122
10
|
/** ISO timestamp the snapshot file was written. */
|
|
123
11
|
builtAt: string;
|
|
124
12
|
}
|
|
125
|
-
/** Period selector for reports. Either a single closing month or a
|
|
126
|
-
* date range. Always inclusive on both ends. */
|
|
127
|
-
export type ReportPeriod = {
|
|
128
|
-
kind: "month";
|
|
129
|
-
period: string;
|
|
130
|
-
} | {
|
|
131
|
-
kind: "range";
|
|
132
|
-
from: string;
|
|
133
|
-
to: string;
|
|
134
|
-
};
|
|
135
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;CACjB"}
|