@mulmoclaude/accounting-plugin 1.0.0 → 1.0.2

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 (54) hide show
  1. package/dist/server/accountNormalize.d.ts +1 -1
  2. package/dist/server/accountNormalize.d.ts.map +1 -1
  3. package/dist/server/context.d.ts +3 -10
  4. package/dist/server/context.d.ts.map +1 -1
  5. package/dist/server/defaultAccounts.d.ts +1 -1
  6. package/dist/server/defaultAccounts.d.ts.map +1 -1
  7. package/dist/server/http.d.ts.map +1 -1
  8. package/dist/server/index.d.ts +1 -1
  9. package/dist/server/index.d.ts.map +1 -1
  10. package/dist/server/io.d.ts +2 -1
  11. package/dist/server/io.d.ts.map +1 -1
  12. package/dist/server/journal.d.ts +1 -1
  13. package/dist/server/journal.d.ts.map +1 -1
  14. package/dist/server/openingBalances.d.ts +1 -1
  15. package/dist/server/openingBalances.d.ts.map +1 -1
  16. package/dist/server/report.d.ts +6 -64
  17. package/dist/server/report.d.ts.map +1 -1
  18. package/dist/server/service.d.ts +1 -1
  19. package/dist/server/service.d.ts.map +1 -1
  20. package/dist/server/snapshotCache.d.ts +2 -1
  21. package/dist/server/snapshotCache.d.ts.map +1 -1
  22. package/dist/server/timeSeries.d.ts +1 -1
  23. package/dist/server/timeSeries.d.ts.map +1 -1
  24. package/dist/server/types.d.ts +1 -123
  25. package/dist/server/types.d.ts.map +1 -1
  26. package/dist/server.cjs +22 -73
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.js +14 -65
  29. package/dist/server.js.map +1 -1
  30. package/dist/shared/errors.d.ts +1 -1
  31. package/dist/shared/errors.d.ts.map +1 -1
  32. package/dist/shared/index.d.ts +1 -0
  33. package/dist/shared/index.d.ts.map +1 -1
  34. package/dist/shared/types.d.ts +188 -0
  35. package/dist/shared/types.d.ts.map +1 -0
  36. package/dist/shared-CcU3_qAa.cjs +749 -0
  37. package/dist/shared-CcU3_qAa.cjs.map +1 -0
  38. package/dist/shared-MOpJ1kUa.js +516 -0
  39. package/dist/shared-MOpJ1kUa.js.map +1 -0
  40. package/dist/shared.cjs +40 -519
  41. package/dist/shared.js +2 -483
  42. package/dist/vue/api.d.ts +2 -121
  43. package/dist/vue/api.d.ts.map +1 -1
  44. package/dist/vue/lang/index.d.ts +204 -215
  45. package/dist/vue/lang/index.d.ts.map +1 -1
  46. package/dist/vue.cjs +1651 -1678
  47. package/dist/vue.cjs.map +1 -1
  48. package/dist/vue.js +1652 -1679
  49. package/dist/vue.js.map +1 -1
  50. package/package.json +11 -6
  51. package/dist/server/atomic.d.ts +0 -15
  52. package/dist/server/atomic.d.ts.map +0 -1
  53. package/dist/shared.cjs.map +0 -1
  54. package/dist/shared.js.map +0 -1
@@ -1,2 +1,2 @@
1
- export declare function errorMessage(err: unknown, fallback?: string): string;
1
+ export { errorMessage } from "@mulmoclaude/common";
2
2
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CASpE"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./actions";
2
2
  export * from "./api";
3
+ export * from "./types";
3
4
  export * from "./channels";
4
5
  export * from "./errors";
5
6
  export * from "./paths";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAKA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAKA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,188 @@
1
+ import type { SupportedCountryCode } from "./countries";
2
+ import type { FiscalYearEnd } from "./fiscalYear";
3
+ export declare const ACCOUNT_TYPES: readonly ["asset", "liability", "equity", "income", "expense"];
4
+ export type AccountType = (typeof ACCOUNT_TYPES)[number];
5
+ /** B/S accounts (assets / liabilities / equity). Used by opening
6
+ * balance validation: opening entries reference balance-sheet
7
+ * accounts only. */
8
+ export declare const BALANCE_SHEET_ACCOUNT_TYPES: readonly AccountType[];
9
+ export interface Account {
10
+ /** Stable identifier the journal lines reference. Typically a
11
+ * numeric string ("1000" / "2000" …) but free-form is allowed
12
+ * so the user can adopt their existing numbering. */
13
+ code: string;
14
+ name: string;
15
+ type: AccountType;
16
+ /** Optional free-form note (tax bucket, parent group, …). Not
17
+ * interpreted by the engine — passes through verbatim. */
18
+ note?: string;
19
+ /** Soft-delete flag. When `false`, the account is hidden from
20
+ * entry/ledger dropdowns but stays visible in Manage Accounts
21
+ * and historical entries — accounting integrity requires that
22
+ * a code referenced by a journal line never disappears. Omitted
23
+ * (treated as active) by default to keep the JSON files clean
24
+ * for books created before this field existed. */
25
+ active?: boolean;
26
+ }
27
+ export interface BookSummary {
28
+ id: string;
29
+ name: string;
30
+ /** ISO 4217 (e.g. "USD" / "JPY"). Single-currency per book — no
31
+ * cross-book aggregation. */
32
+ currency: string;
33
+ /** ISO 3166-1 alpha-2 country code (e.g. "US" / "JP" / "GB").
34
+ * Identifies the tax jurisdiction the book is kept under so the
35
+ * Accounting role can give country-aware advice (Japanese T-number
36
+ * under インボイス制度, EU VAT ID, GSTIN, ABN, etc.). Constrained
37
+ * to `SupportedCountryCode` (the curated list shared with the UI
38
+ * dropdown and the LLM tool's JSON-schema enum) so a typo from any
39
+ * ingress path is rejected at the service layer rather than silently
40
+ * persisted. Optional for backward compatibility with books created
41
+ * before the field was introduced; the UI prompts existing books
42
+ * to set it. */
43
+ country?: SupportedCountryCode;
44
+ /** Calendar month (1-12) on whose LAST DAY the book's fiscal year
45
+ * closes — e.g. 8 = August 31, 12 = December 31 (calendar year).
46
+ * Drives the UI's "current quarter / current year" date-range
47
+ * shortcuts. Optional in the persisted shape for backward
48
+ * compatibility with books written before this field existed (and
49
+ * with the earlier "Q1".."Q4" token form) — read-side code
50
+ * normalises both via `resolveFiscalYearEnd`, treating an absent
51
+ * value as December. New books require it at the create boundary;
52
+ * the default is 12 (December). */
53
+ fiscalYearEnd?: FiscalYearEnd;
54
+ createdAt: string;
55
+ }
56
+ export type JournalEntryKind = "normal" | "opening" | "void" | "void-marker";
57
+ export interface JournalLine {
58
+ accountCode: string;
59
+ /** Use exactly one of debit / credit per line, both as positive
60
+ * numbers. The engine treats them as separate fields rather than
61
+ * a single signed amount so the input matches a standard
62
+ * bookkeeping form. */
63
+ debit?: number;
64
+ credit?: number;
65
+ /** Per-line memo (the entry-level memo lives on JournalEntry). */
66
+ memo?: string;
67
+ /** Counterparty's tax-authority-issued registration ID for this
68
+ * line — Japanese 適格請求書発行事業者登録番号 (T-number), EU
69
+ * VAT identification number, UK VAT registration number, India
70
+ * GSTIN, Australia ABN, etc. Required for input-tax-credit
71
+ * eligibility under the Japanese インボイス制度 (effective
72
+ * 2023-10-01) and equivalent regimes elsewhere. Free-form string;
73
+ * format validation belongs upstream (per-jurisdiction). */
74
+ taxRegistrationId?: string;
75
+ }
76
+ export interface JournalEntry {
77
+ /** Globally unique within a book — ULID-style; ordering by id
78
+ * reproduces creation order. */
79
+ id: string;
80
+ /** Calendar date the entry is booked for (YYYY-MM-DD). The month
81
+ * part decides which `journal/YYYY-MM.jsonl` file the entry lives
82
+ * in; entries can be for any past / future date. */
83
+ date: string;
84
+ kind: JournalEntryKind;
85
+ lines: JournalLine[];
86
+ /** Entry-level memo. */
87
+ memo?: string;
88
+ /** When `kind === "void-marker"`: id of the entry being voided.
89
+ * When `kind === "void"`: the system-generated reverse entry
90
+ * references the original via this field. */
91
+ voidedEntryId?: string;
92
+ /** Reason supplied by the user when voiding. */
93
+ voidReason?: string;
94
+ /** When this entry was posted via the "edit" flow (void-then-add),
95
+ * this is the id of the entry it replaces. The void + new-entry
96
+ * pair is *not* atomic on the server — the client issues two
97
+ * sequential calls — but recording the link here makes the
98
+ * edit chain queryable later (e.g. "what corrected entry X?"). */
99
+ replacesEntryId?: string;
100
+ /** ISO timestamp the entry was appended to the journal — the
101
+ * authoritative "when did this hit the books" clock. Distinct
102
+ * from `date`, which is the user-visible booking date. */
103
+ createdAt: string;
104
+ }
105
+ /** Aggregated balance per account at a point in time. The signed
106
+ * number is debit − credit; downstream display logic converts to
107
+ * natural sign per account type (assets debit-positive, liabilities
108
+ * credit-positive). */
109
+ export interface AccountBalance {
110
+ accountCode: string;
111
+ /** Σ debit − Σ credit across all entries up to and including the
112
+ * snapshot's period end. */
113
+ netDebit: number;
114
+ }
115
+ /** Period selector for reports. Either a single closing month or a
116
+ * date range. Always inclusive on both ends. */
117
+ export type ReportPeriod = {
118
+ kind: "month";
119
+ period: string;
120
+ } | {
121
+ kind: "range";
122
+ from: string;
123
+ to: string;
124
+ };
125
+ export interface BalanceSheetSection {
126
+ type: AccountType;
127
+ rows: {
128
+ accountCode: string;
129
+ accountName: string;
130
+ balance: number;
131
+ }[];
132
+ total: number;
133
+ }
134
+ export interface BalanceSheet {
135
+ asOf: string;
136
+ sections: BalanceSheetSection[];
137
+ /** Σ assets − Σ (liabilities + equity). Should be 0 (the
138
+ * accounting equation); a non-zero here indicates either a
139
+ * rounding artefact or a data problem. */
140
+ imbalance: number;
141
+ }
142
+ export interface ProfitLoss {
143
+ from: string;
144
+ to: string;
145
+ income: {
146
+ rows: {
147
+ accountCode: string;
148
+ accountName: string;
149
+ amount: number;
150
+ }[];
151
+ total: number;
152
+ };
153
+ expense: {
154
+ rows: {
155
+ accountCode: string;
156
+ accountName: string;
157
+ amount: number;
158
+ }[];
159
+ total: number;
160
+ };
161
+ netIncome: number;
162
+ }
163
+ export interface LedgerRow {
164
+ entryId: string;
165
+ date: string;
166
+ kind: JournalEntryKind;
167
+ memo?: string;
168
+ debit: number;
169
+ credit: number;
170
+ /** Running netDebit balance for this account, in entry order. */
171
+ runningBalance: number;
172
+ /** Counterparty tax-registration ID copied from the source
173
+ * journal line (T-number / VAT ID / GSTIN / ABN). Surfaced as a
174
+ * Ledger column when the active account is in the input-tax
175
+ * band (14xx — see `isTaxAccountCode` in
176
+ * src/vue/components/accountNumbering.ts). Carried per row even on
177
+ * non-tax accounts so a future view that wants to show it
178
+ * elsewhere doesn't need a server change. */
179
+ taxRegistrationId?: string;
180
+ }
181
+ export interface Ledger {
182
+ accountCode: string;
183
+ accountName: string;
184
+ rows: LedgerRow[];
185
+ /** Closing netDebit balance — the sum at the bottom of `rows`. */
186
+ closingBalance: number;
187
+ }
188
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,aAAa,gEAAiE,CAAC;AAC5F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,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