@happyvertical/smrt-ledgers 0.54.2 → 0.54.4
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/chunks/{Account-Dr4tA_Gn.js → Account-CkLJrn_J.js} +9 -1
- package/dist/chunks/Account-CkLJrn_J.js.map +1 -0
- package/dist/collections/Accounts.d.ts +2 -2
- package/dist/collections/Accounts.d.ts.map +1 -1
- package/dist/collections/JournalEntries.d.ts +2 -2
- package/dist/collections/JournalEntries.d.ts.map +1 -1
- package/dist/collections/Journals.d.ts +2 -2
- package/dist/collections/Journals.d.ts.map +1 -1
- package/dist/collections/index.d.ts +3 -3
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +3 -2
- package/dist/models/Account.d.ts +1 -1
- package/dist/models/Account.d.ts.map +1 -1
- package/dist/models/Journal.d.ts +2 -2
- package/dist/models/Journal.d.ts.map +1 -1
- package/dist/models/JournalEntry.d.ts +3 -3
- package/dist/models/JournalEntry.d.ts.map +1 -1
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunks/Account-Dr4tA_Gn.js.map +0 -1
|
@@ -3,12 +3,19 @@ import { TenantScoped, tenantId } from "@happyvertical/smrt-tenancy";
|
|
|
3
3
|
//#region src/models/Account.ts
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value
|
|
11
|
+
}) : obj[key] = value;
|
|
6
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
13
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
14
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
15
|
if (kind && result) __defProp(target, key, result);
|
|
10
16
|
return result;
|
|
11
17
|
};
|
|
18
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
12
19
|
var Account = class extends SmrtHierarchical {
|
|
13
20
|
tenantId = null;
|
|
14
21
|
/**
|
|
@@ -105,6 +112,7 @@ var Account = class extends SmrtHierarchical {
|
|
|
105
112
|
return account;
|
|
106
113
|
}
|
|
107
114
|
};
|
|
115
|
+
__publicField(Account, "__smrtPackage__", "@happyvertical/smrt-ledgers");
|
|
108
116
|
__decorateClass([tenantId({ nullable: true })], Account.prototype, "tenantId", 2);
|
|
109
117
|
Account = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
|
|
110
118
|
tableName: "ledger_accounts",
|
|
@@ -125,4 +133,4 @@ Account = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
|
|
|
125
133
|
//#endregion
|
|
126
134
|
export { Account as t };
|
|
127
135
|
|
|
128
|
-
//# sourceMappingURL=Account-
|
|
136
|
+
//# sourceMappingURL=Account-CkLJrn_J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account-CkLJrn_J.js","names":[],"sources":["../../src/models/Account.ts"],"sourcesContent":["/**\n * Account model - Chart of accounts entry\n *\n * Represents a single account in the chart of accounts.\n * The 5 core types: Asset, Liability, Equity, Revenue, Expense\n */\n\nimport { SmrtHierarchical, smrt } from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { AccountOptions, AccountTreeNode, AccountType } from '../types';\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n // Own table, never the derived `accounts`: smrt-messages declares an\n // unrelated `Account` on that table (#3098). Existing `accounts`-hosted\n // ledgers move with `smrt db:migrate-ledger-accounts`.\n tableName: 'ledger_accounts',\n api: { include: ['list', 'get', 'create', 'update', 'delete'] },\n mcp: { include: ['list', 'get', 'create'] },\n cli: { skipApiCheck: true },\n})\nexport class Account extends SmrtHierarchical { static __smrtPackage__ = \"@happyvertical/smrt-ledgers\";\n /**\n * Tenant ID for multi-tenancy support (nullable for global accounts)\n */\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n /**\n * Account number (e.g., \"1000\", \"5030\")\n */\n number: string = '';\n\n /**\n * Account name (e.g., \"Cash\", \"Coffee Expense\")\n */\n name: string = '';\n\n /**\n * Account description\n */\n description: string = '';\n\n /**\n * Account type - one of the 5 core types\n */\n type: AccountType = 'asset';\n\n // parentId inherited from SmrtHierarchical (null = top-level)\n\n /**\n * Whether the account is active\n */\n active: boolean = true;\n\n /**\n * Extensible metadata\n */\n metadata: Record<string, unknown> = {};\n\n constructor(options: AccountOptions = {}) {\n super(options);\n if (options.number !== undefined) this.number = options.number;\n if (options.name !== undefined) this.name = options.name;\n if (options.description !== undefined)\n this.description = options.description;\n if (options.type !== undefined) this.type = options.type;\n if (options.parentId !== undefined) this.parentId = options.parentId;\n if (options.active !== undefined) this.active = options.active;\n if (options.metadata !== undefined) this.metadata = options.metadata;\n }\n\n /**\n * Check if this is a top-level account (no parent)\n */\n isTopLevel(): boolean {\n return this.parentId === null;\n }\n\n /**\n * Check if this is a debit-normal account (Asset, Expense)\n * Debit-normal accounts increase with debits\n */\n isDebitNormal(): boolean {\n return this.type === 'asset' || this.type === 'expense';\n }\n\n /**\n * Check if this is a credit-normal account (Liability, Equity, Revenue)\n * Credit-normal accounts increase with credits\n */\n isCreditNormal(): boolean {\n return (\n this.type === 'liability' ||\n this.type === 'equity' ||\n this.type === 'revenue'\n );\n }\n\n // Hierarchy traversal (getParent / getChildren / getAncestors /\n // getDescendants / getHierarchy / moveTo) provided by SmrtHierarchical.\n // Account-specific helpers (getFullPath / getBalance / createChild /\n // toTreeNode) remain below.\n\n /**\n * Get full account path (e.g., \"Assets > Current > Cash\")\n */\n async getFullPath(): Promise<string> {\n const ancestors = await this.getAncestors();\n const names = [...ancestors.map((a) => a.name), this.name];\n return names.join(' > ');\n }\n\n /**\n * Build tree node for this account and its children\n */\n async toTreeNode(): Promise<AccountTreeNode> {\n const children = await this.getChildren();\n const childNodes = await Promise.all(children.map((c) => c.toTreeNode()));\n return {\n account: this,\n children: childNodes,\n };\n }\n\n /**\n * Get the current balance of this account\n */\n async getBalance(asOfDate?: Date): Promise<number> {\n if (!this.id) return 0;\n const { JournalEntryCollection } = await import(\n '../collections/JournalEntries'\n );\n const collection = await JournalEntryCollection.create(this.options);\n return await collection.getAccountBalance(this.id, asOfDate);\n }\n\n /**\n * Create a sub-account under this account\n */\n async createChild(\n options: Omit<AccountOptions, 'parentId' | 'type'>,\n ): Promise<Account> {\n if (!this.id) {\n throw new Error('Account must be saved before creating children');\n }\n const { AccountCollection } = await import('../collections/Accounts');\n const collection = await AccountCollection.create(this.options);\n const account = await collection.create({\n ...options,\n parentId: this.id,\n type: this.type, // Inherit type from parent\n });\n await account.save();\n return account;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBO,IAAM,UAAN,cAAsB,iBAAiB;CAK5C,WAA0B;;;;CAK1B,SAAiB;;;;CAKjB,OAAe;;;;CAKf,cAAsB;;;;CAKtB,OAAoB;;;;CAOpB,SAAkB;;;;CAKlB,WAAoC,CAAC;CAErC,YAAY,UAA0B,CAAC,GAAG;EACxC,MAAM,OAAO;EACb,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;EACxD,IAAI,QAAQ,SAAS,KAAA,GAAW,KAAK,OAAO,QAAQ;EACpD,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,KAAK,cAAc,QAAQ;EAC7B,IAAI,QAAQ,SAAS,KAAA,GAAW,KAAK,OAAO,QAAQ;EACpD,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;EAC5D,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;EACxD,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;CAC9D;;;;CAKA,aAAsB;EACpB,OAAO,KAAK,aAAa;CAC3B;;;;;CAMA,gBAAyB;EACvB,OAAO,KAAK,SAAS,WAAW,KAAK,SAAS;CAChD;;;;;CAMA,iBAA0B;EACxB,OACE,KAAK,SAAS,eACd,KAAK,SAAS,YACd,KAAK,SAAS;CAElB;;;;CAUA,MAAM,cAA+B;EAGnC,OAAO,CADQ,IAAG,MADM,KAAK,aAAa,EAAA,CACd,KAAK,MAAM,EAAE,IAAI,GAAG,KAAK,IAC9C,CAAA,CAAM,KAAK,KAAK;CACzB;;;;CAKA,MAAM,aAAuC;EAC3C,MAAM,WAAW,MAAM,KAAK,YAAY;EACxC,MAAM,aAAa,MAAM,QAAQ,IAAI,SAAS,KAAK,MAAM,EAAE,WAAW,CAAC,CAAC;EACxE,OAAO;GACL,SAAS;GACT,UAAU;EACZ;CACF;;;;CAKA,MAAM,WAAW,UAAkC;EACjD,IAAI,CAAC,KAAK,IAAI,OAAO;EACrB,MAAM,EAAE,2BAA2B,MAAM,OACvC,cAAA,CAAA,MAAA,MAAA,EAAA,CAAA;EAGF,OAAO,OAAM,MADY,uBAAuB,OAAO,KAAK,OAAO,EAAA,CAC3C,kBAAkB,KAAK,IAAI,QAAQ;CAC7D;;;;CAKA,MAAM,YACJ,SACkB;EAClB,IAAI,CAAC,KAAK,IACR,MAAM,IAAI,MAAM,gDAAgD;EAElE,MAAM,EAAE,sBAAsB,MAAM,OAAO,cAAA,CAAA,MAAA,MAAA,EAAA,CAAA;EAE3C,MAAM,UAAU,OAAM,MADG,kBAAkB,OAAO,KAAK,OAAO,EAAA,CAC7B,OAAO;GACtC,GAAG;GACH,UAAU,KAAK;GACf,MAAM,KAAK;EACb,CAAC;EACD,MAAM,QAAQ,KAAK;EACnB,OAAO;CACT;AACF;AAvIgD,cAAnC,SAA0C,mBAAkB,6BAAA;AAKvE,gBAAA,CADC,SAAS,EAAE,UAAU,KAAK,CAAC,CAAA,GAJjB,QAKX,WAAA,YAAA,CAAA;AALW,UAAN,gBAAA,CAVN,aAAa,EAAE,MAAM,WAAW,CAAC,GACjC,KAAK;CAIJ,WAAW;CACX,KAAK,EAAE,SAAS;EAAC;EAAQ;EAAO;EAAU;EAAU;CAAQ,EAAE;CAC9D,KAAK,EAAE,SAAS;EAAC;EAAQ;EAAO;CAAQ,EAAE;CAC1C,KAAK,EAAE,cAAc,KAAK;AAC5B,CAAC,CAAA,GACY,OAAA"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Provides querying and tree operations for chart of accounts.
|
|
5
5
|
*/
|
|
6
6
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
-
import { Account } from
|
|
8
|
-
import type { AccountTree, AccountType } from
|
|
7
|
+
import { Account } from "../models/Account.js";
|
|
8
|
+
import type { AccountTree, AccountType } from "../types.js";
|
|
9
9
|
export declare class AccountCollection extends SmrtCollection<Account> {
|
|
10
10
|
static readonly _itemClass: typeof Account;
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accounts.d.ts","sourceRoot":"","sources":["../../src/collections/Accounts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Accounts.d.ts","sourceRoot":"","sources":["../../src/collections/Accounts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,aAAU,CAAC;AAE1E,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,UAAU,iBAAW;IAErC;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAQ3D;;;;;OAKG;IACG,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAOvD;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAOtC;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAOxC;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAOxD;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAoCrC;;;;;;OAMG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,OAAO,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,WAAW,CAAC;QAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,OAAO,CAAC;IAiBnB;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAiB5D;;;;;OAKG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAyB3D;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIxD;;;;;;;;OAQG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;;;;OAQG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAG5D"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Provides querying and balance calculations for ledger entries.
|
|
5
5
|
*/
|
|
6
6
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
-
import { JournalEntry } from
|
|
8
|
-
import { type TrialBalanceRow } from
|
|
7
|
+
import { JournalEntry } from "../models/JournalEntry.js";
|
|
8
|
+
import { type TrialBalanceRow } from "../types.js";
|
|
9
9
|
export declare class JournalEntryCollection extends SmrtCollection<JournalEntry> {
|
|
10
10
|
static readonly _itemClass: typeof JournalEntry;
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JournalEntries.d.ts","sourceRoot":"","sources":["../../src/collections/JournalEntries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"JournalEntries.d.ts","sourceRoot":"","sources":["../../src/collections/JournalEntries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAAwB,CAAC;AACtD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,aAAU,CAAC;AAEjE,qBAAa,sBAAuB,SAAQ,cAAc,CAAC,YAAY,CAAC;IACtE,MAAM,CAAC,QAAQ,CAAC,UAAU,sBAAgB;IAE1C;;;;;OAKG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM/D;;;;;OAKG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM/D;;;;;;;;;OASG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IA4C5E;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IA+BlE;;;;;;OAMG;IACG,qBAAqB,CACzB,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,GACR,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAsBzD;;;;;OAKG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAWnE;;;;;OAKG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IA+ClE;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAI7D;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAI3C;;;;;;;;OAQG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAOjE"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Provides querying and operations for financial journals.
|
|
5
5
|
*/
|
|
6
6
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
7
|
-
import { Journal } from
|
|
8
|
-
import { type CreateJournalData, type JournalStatus } from
|
|
7
|
+
import { Journal } from "../models/Journal.js";
|
|
8
|
+
import { type CreateJournalData, type JournalStatus } from "../types.js";
|
|
9
9
|
export declare class JournalCollection extends SmrtCollection<Journal> {
|
|
10
10
|
static readonly _itemClass: typeof Journal;
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Journals.d.ts","sourceRoot":"","sources":["../../src/collections/Journals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Journals.d.ts","sourceRoot":"","sources":["../../src/collections/Journals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAmB,CAAC;AAC5C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,aAAU,CAAC;AAElB,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,UAAU,iBAAW;IAErC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAQ3D;;;;;;OAMG;IACG,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAUjE;;;;;OAKG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO5D;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO7D;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;OAKG;IACG,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAwClE;;;;;OAKG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS/C;;;;;;OAMG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS/D;;;;;OAKG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAO5D;;;;;;OAMG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAUlE;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIxD;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAItC;;;;;;;;OAQG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAG5D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AccountCollection } from
|
|
2
|
-
export { JournalEntryCollection } from
|
|
3
|
-
export { JournalCollection } from
|
|
1
|
+
export { AccountCollection } from "./Accounts.js";
|
|
2
|
+
export { JournalEntryCollection } from "./JournalEntries.js";
|
|
3
|
+
export { JournalCollection } from "./Journals.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAY,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAkB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
*/
|
|
62
62
|
import './__smrt-register__.js';
|
|
63
63
|
import './prompts.js';
|
|
64
|
-
export { AccountCollection } from
|
|
65
|
-
export { JournalEntryCollection } from
|
|
66
|
-
export { JournalCollection } from
|
|
67
|
-
export { LEDGER_ACCOUNTS_TABLE, LEDGER_ACCOUNTS_TABLE_MOVE, LEGACY_ACCOUNTS_TABLE, LedgerAccountsTableMoveError, type LedgerAccountsTableMoveOptions, type LedgerAccountsTableMovePlan, type LedgerAccountsTableMoveResult, migrateLedgerAccountsTable, planLedgerAccountsTableMove, } from
|
|
68
|
-
export { Account } from
|
|
69
|
-
export { Journal } from
|
|
70
|
-
export { JournalEntry } from
|
|
71
|
-
export { promptMessageOptions, smrtLedgersJournalSummarizePrompt, } from
|
|
72
|
-
export type { AccountOptions, AccountTree, AccountTreeNode, AccountType, CreateJournalData, JournalEntryData, JournalEntryOptions, JournalOptions, JournalStatus, TrialBalanceRow, } from
|
|
64
|
+
export { AccountCollection } from "./collections/Accounts.js";
|
|
65
|
+
export { JournalEntryCollection } from "./collections/JournalEntries.js";
|
|
66
|
+
export { JournalCollection } from "./collections/Journals.js";
|
|
67
|
+
export { LEDGER_ACCOUNTS_TABLE, LEDGER_ACCOUNTS_TABLE_MOVE, LEGACY_ACCOUNTS_TABLE, LedgerAccountsTableMoveError, type LedgerAccountsTableMoveOptions, type LedgerAccountsTableMovePlan, type LedgerAccountsTableMoveResult, migrateLedgerAccountsTable, planLedgerAccountsTableMove, } from "./migrations/ledger-accounts-table.js";
|
|
68
|
+
export { Account } from "./models/Account.js";
|
|
69
|
+
export { Journal } from "./models/Journal.js";
|
|
70
|
+
export { JournalEntry } from "./models/JournalEntry.js";
|
|
71
|
+
export { promptMessageOptions, smrtLedgersJournalSummarizePrompt, } from "./prompts.js";
|
|
72
|
+
export type { AccountOptions, AccountTree, AccountTreeNode, AccountType, CreateJournalData, JournalEntryData, JournalEntryOptions, JournalOptions, JournalStatus, TrialBalanceRow, } from "./types.js";
|
|
73
73
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAAwB,CAAC;AAE3D,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,uCAAoC,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;AAIrD,OAAO,EACL,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,cAAW,CAAC;AAGnB,YAAY,EACV,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,YAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Account } from "./chunks/Account-
|
|
1
|
+
import { t as Account } from "./chunks/Account-CkLJrn_J.js";
|
|
2
2
|
import { BALANCE_EPSILON } from "./types.js";
|
|
3
3
|
import { ObjectRegistry, SmrtCollection, SmrtObject, detectEngine, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
4
4
|
import { definePrompt, resolvePrompt } from "@happyvertical/smrt-prompts";
|
|
@@ -17,7 +17,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/__smrt-register__.ts
|
|
20
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-ledgers\",\"packageVersion\":\"0.54.2\",\"objects\":{\"@happyvertical/smrt-ledgers:AccountCollection\":{\"name\":\"accountcollection\",\"className\":\"AccountCollection\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:AccountCollection\",\"collection\":\"accounts\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{},\"methods\":{\"findByNumber\":{\"name\":\"findByNumber\",\"async\":true,\"parameters\":[{\"name\":\"number\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Account | null>\",\"isStatic\":false,\"isPublic\":true},\"findByType\":{\"name\":\"findByType\",\"async\":true,\"parameters\":[{\"name\":\"type\",\"type\":\"AccountType\",\"optional\":false}],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findActive\":{\"name\":\"findActive\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findTopLevel\":{\"name\":\"findTopLevel\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findChildren\":{\"name\":\"findChildren\",\"async\":true,\"parameters\":[{\"name\":\"parentId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"getTree\":{\"name\":\"getTree\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<AccountTree>\",\"isStatic\":false,\"isPublic\":true},\"getOrCreateByNumber\":{\"name\":\"getOrCreateByNumber\",\"async\":true,\"parameters\":[{\"name\":\"number\",\"type\":\"string\",\"optional\":false},{\"name\":\"defaults\",\"type\":\"Partial<object>\",\"optional\":true,\"memberTypes\":[\"string\",\"AccountType\",\"string | null\"]}],\"returnType\":\"Promise<Account>\",\"isStatic\":false,\"isPublic\":true},\"groupByType\":{\"name\":\"groupByType\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Record<AccountType, Account[]>>\",\"isStatic\":false,\"isPublic\":true},\"getDescendants\":{\"name\":\"getDescendants\",\"async\":true,\"parameters\":[{\"name\":\"accountId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Account[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"ledger_accounts\"},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Account\",\"exportName\":\"AccountCollection\",\"collectionExportName\":\"AccountCollectionCollection\",\"schema\":{\"tableName\":\"ledger_accounts\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"ledger_accounts\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"number\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"type\\\" TEXT DEFAULT 'asset',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"ledger_accounts\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"number\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"asset\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"ledger_accounts_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"ledger_accounts_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"ledger_accounts_parent_id_idx\",\"columns\":[\"parent_id\"]}],\"version\":\"49630dae\"},\"importPath\":\"@happyvertical/smrt-ledgers\"},\"@happyvertical/smrt-ledgers:JournalEntryCollection\":{\"name\":\"journalentrycollection\",\"className\":\"JournalEntryCollection\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:JournalEntryCollection\",\"collection\":\"journalentries\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{},\"methods\":{\"findByJournal\":{\"name\":\"findByJournal\",\"async\":true,\"parameters\":[{\"name\":\"journalId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true},\"findByAccount\":{\"name\":\"findByAccount\",\"async\":true,\"parameters\":[{\"name\":\"accountId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true},\"getAccountBalance\":{\"name\":\"getAccountBalance\",\"async\":true,\"parameters\":[{\"name\":\"accountId\",\"type\":\"string\",\"optional\":false},{\"name\":\"asOfDate\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"getTrialBalance\":{\"name\":\"getTrialBalance\",\"async\":true,\"parameters\":[{\"name\":\"asOfDate\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<TrialBalanceRow[]>\",\"isStatic\":false,\"isPublic\":true},\"getTotalsForDateRange\":{\"name\":\"getTotalsForDateRange\",\"async\":true,\"parameters\":[{\"name\":\"start\",\"type\":\"Date\",\"optional\":false},{\"name\":\"end\",\"type\":\"Date\",\"optional\":false}],\"returnType\":\"Promise<object>\",\"isStatic\":false,\"isPublic\":true},\"findByAccounts\":{\"name\":\"findByAccounts\",\"async\":true,\"parameters\":[{\"name\":\"accountIds\",\"type\":\"string[]\",\"optional\":false}],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true},\"getAccountLedger\":{\"name\":\"getAccountLedger\",\"async\":true,\"parameters\":[{\"name\":\"accountId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Array<object>>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<JournalEntry[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"JournalEntry\",\"exportName\":\"JournalEntryCollection\",\"collectionExportName\":\"JournalEntryCollectionCollection\",\"schema\":{\"tableName\":\"journal_entries\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journal_entries\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"journal_id\\\" UUID,\\n \\\"account_id\\\" UUID,\\n \\\"debit\\\" REAL DEFAULT 0,\\n \\\"credit\\\" REAL DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"exchange_rate\\\" REAL DEFAULT 1,\\n \\\"memo\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"journal_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"journals\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"account_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"ledger_accounts\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"debit\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"credit\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"exchange_rate\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":1},\"memo\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"journal_entries_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"journal_entries_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"journal_entries_journal_id_idx\",\"columns\":[\"journal_id\"]},{\"name\":\"journal_entries_account_id_idx\",\"columns\":[\"account_id\"]}],\"version\":\"93cdc848\"},\"importPath\":\"@happyvertical/smrt-ledgers\"},\"@happyvertical/smrt-ledgers:JournalCollection\":{\"name\":\"journalcollection\",\"className\":\"JournalCollection\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:JournalCollection\",\"collection\":\"journals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Journals.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{},\"methods\":{\"findByNumber\":{\"name\":\"findByNumber\",\"async\":true,\"parameters\":[{\"name\":\"number\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal | null>\",\"isStatic\":false,\"isPublic\":true},\"findByDateRange\":{\"name\":\"findByDateRange\",\"async\":true,\"parameters\":[{\"name\":\"start\",\"type\":\"Date\",\"optional\":false},{\"name\":\"end\",\"type\":\"Date\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findBySource\":{\"name\":\"findBySource\",\"async\":true,\"parameters\":[{\"name\":\"sourceModule\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findByStatus\":{\"name\":\"findByStatus\",\"async\":true,\"parameters\":[{\"name\":\"status\",\"type\":\"JournalStatus\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findDrafts\":{\"name\":\"findDrafts\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findPosted\":{\"name\":\"findPosted\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"createWithEntries\":{\"name\":\"createWithEntries\",\"async\":true,\"parameters\":[{\"name\":\"data\",\"type\":\"CreateJournalData\",\"optional\":false}],\"returnType\":\"Promise<Journal>\",\"isStatic\":false,\"isPublic\":true},\"post\":{\"name\":\"post\",\"async\":true,\"parameters\":[{\"name\":\"journalId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal>\",\"isStatic\":false,\"isPublic\":true},\"void\":{\"name\":\"void\",\"async\":true,\"parameters\":[{\"name\":\"journalId\",\"type\":\"string\",\"optional\":false},{\"name\":\"reason\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal>\",\"isStatic\":false,\"isPublic\":true},\"findBySourceRef\":{\"name\":\"findBySourceRef\",\"async\":true,\"parameters\":[{\"name\":\"sourceRef\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findByMonth\":{\"name\":\"findByMonth\",\"async\":true,\"parameters\":[{\"name\":\"year\",\"type\":\"number\",\"optional\":false},{\"name\":\"month\",\"type\":\"number\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findByTenant\":{\"name\":\"findByTenant\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findGlobal\":{\"name\":\"findGlobal\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true},\"findWithGlobals\":{\"name\":\"findWithGlobals\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Journal[]>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Journal\",\"exportName\":\"JournalCollection\",\"collectionExportName\":\"JournalCollectionCollection\",\"schema\":{\"tableName\":\"journals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"number\\\" TEXT DEFAULT '',\\n \\\"date\\\" TIMESTAMP,\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"source_module\\\" TEXT DEFAULT '',\\n \\\"source_ref\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"posted_at\\\" TIMESTAMP,\\n \\\"voided_at\\\" TIMESTAMP,\\n \\\"void_reason\\\" TEXT,\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"number\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"date\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_module\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_ref\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"posted_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"voided_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"void_reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"journals_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"journals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"4b51d204\"},\"importPath\":\"@happyvertical/smrt-ledgers\"},\"@happyvertical/smrt-ledgers:Account\":{\"name\":\"account\",\"className\":\"Account\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:Account\",\"collection\":\"accounts\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Account.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{\"parentId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Account\",\"_meta\":{\"nullable\":true}},\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"number\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"type\":{\"type\":\"text\",\"required\":false,\"default\":\"asset\"},\"active\":{\"type\":\"boolean\",\"required\":false,\"default\":true},\"metadata\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"getParent\":{\"name\":\"getParent\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this | null>\",\"isStatic\":false,\"isPublic\":true},\"getChildren\":{\"name\":\"getChildren\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getAncestors\":{\"name\":\"getAncestors\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getDescendants\":{\"name\":\"getDescendants\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<this[]>\",\"isStatic\":false,\"isPublic\":true},\"getHierarchy\":{\"name\":\"getHierarchy\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<HierarchyView<this>>\",\"isStatic\":false,\"isPublic\":true},\"moveTo\":{\"name\":\"moveTo\",\"async\":true,\"parameters\":[{\"name\":\"newParent\",\"type\":\"this | string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"this\"},{\"type\":\"string\"},{\"type\":\"null\"}]}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"isTopLevel\":{\"name\":\"isTopLevel\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isDebitNormal\":{\"name\":\"isDebitNormal\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isCreditNormal\":{\"name\":\"isCreditNormal\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getFullPath\":{\"name\":\"getFullPath\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<string>\",\"isStatic\":false,\"isPublic\":true},\"toTreeNode\":{\"name\":\"toTreeNode\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<AccountTreeNode>\",\"isStatic\":false,\"isPublic\":true},\"getBalance\":{\"name\":\"getBalance\",\"async\":true,\"parameters\":[{\"name\":\"asOfDate\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"createChild\":{\"name\":\"createChild\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"Omit<AccountOptions, 'parentId' | 'type'>\",\"optional\":false}],\"returnType\":\"Promise<Account>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tableName\":\"ledger_accounts\",\"api\":{\"include\":[\"list\",\"get\",\"create\",\"update\",\"delete\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtHierarchical\",\"exportName\":\"Account\",\"collectionExportName\":\"AccountCollection\",\"schema\":{\"tableName\":\"ledger_accounts\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"ledger_accounts\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"parent_id\\\" UUID,\\n \\\"tenant_id\\\" UUID,\\n \\\"number\\\" TEXT DEFAULT '',\\n \\\"name\\\" TEXT DEFAULT '',\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"type\\\" TEXT DEFAULT 'asset',\\n \\\"active\\\" BOOLEAN DEFAULT TRUE,\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"parent_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"ledger_accounts\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"number\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"type\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"asset\"},\"active\":{\"type\":\"BOOLEAN\",\"notNull\":false,\"unique\":false,\"default\":true},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"ledger_accounts_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"ledger_accounts_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"ledger_accounts_parent_id_idx\",\"columns\":[\"parent_id\"]}],\"version\":\"49630dae\"},\"importPath\":\"@happyvertical/smrt-ledgers\"},\"@happyvertical/smrt-ledgers:Journal\":{\"name\":\"journal\",\"className\":\"Journal\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:Journal\",\"collection\":\"journals\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Journal.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"number\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"date\":{\"type\":\"datetime\",\"required\":false},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceModule\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"sourceRef\":{\"type\":\"text\",\"required\":false},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"draft\"},\"postedAt\":{\"type\":\"datetime\",\"required\":false},\"voidedAt\":{\"type\":\"datetime\",\"required\":false},\"voidReason\":{\"type\":\"text\",\"required\":false},\"metadata\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isDraft\":{\"name\":\"isDraft\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isPosted\":{\"name\":\"isPosted\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isVoided\":{\"name\":\"isVoided\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isEditable\":{\"name\":\"isEditable\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getEntries\":{\"name\":\"getEntries\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getTotalDebits\":{\"name\":\"getTotalDebits\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"getTotalCredits\":{\"name\":\"getTotalCredits\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true},\"isBalanced\":{\"name\":\"isBalanced\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true},\"addEntry\":{\"name\":\"addEntry\",\"async\":true,\"parameters\":[{\"name\":\"data\",\"type\":\"JournalEntryData\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"post\":{\"name\":\"post\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"void\":{\"name\":\"void\",\"async\":true,\"parameters\":[{\"name\":\"reason\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<void>\",\"isStatic\":false,\"isPublic\":true},\"summarize\":{\"name\":\"summarize\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<string>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":{\"include\":[\"list\",\"get\",\"create\"]},\"mcp\":{\"include\":[\"list\",\"get\",\"create\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"Journal\",\"collectionExportName\":\"JournalCollection\",\"schema\":{\"tableName\":\"journals\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journals\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"number\\\" TEXT DEFAULT '',\\n \\\"date\\\" TIMESTAMP,\\n \\\"description\\\" TEXT DEFAULT '',\\n \\\"source_module\\\" TEXT DEFAULT '',\\n \\\"source_ref\\\" TEXT,\\n \\\"status\\\" TEXT DEFAULT 'draft',\\n \\\"posted_at\\\" TIMESTAMP,\\n \\\"voided_at\\\" TIMESTAMP,\\n \\\"void_reason\\\" TEXT,\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"number\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"date\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_module\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"source_ref\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"draft\"},\"posted_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"voided_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"void_reason\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"journals_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"journals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"4b51d204\"},\"importPath\":\"@happyvertical/smrt-ledgers\"},\"@happyvertical/smrt-ledgers:JournalEntry\":{\"name\":\"journalentry\",\"className\":\"JournalEntry\",\"qualifiedName\":\"@happyvertical/smrt-ledgers:JournalEntry\",\"collection\":\"journalentries\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts\",\"packageName\":\"@happyvertical/smrt-ledgers\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"nullable\":true,\"__tenancy\":{\"isTenantIdField\":true,\"autoFilter\":true,\"required\":false,\"autoPopulate\":true,\"nullable\":true,\"mode\":\"optional\",\"field\":\"tenantId\",\"allowSuperAdminBypass\":false}}},\"journalId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Journal\"},\"accountId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Account\"},\"debit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"credit\":{\"type\":\"decimal\",\"required\":false,\"default\":0},\"currency\":{\"type\":\"text\",\"required\":false,\"default\":\"USD\"},\"exchangeRate\":{\"type\":\"decimal\",\"required\":false,\"default\":1},\"memo\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"metadata\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isDebit\":{\"name\":\"isDebit\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isCredit\":{\"name\":\"isCredit\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"getAmount\":{\"name\":\"getAmount\",\"async\":false,\"parameters\":[],\"returnType\":\"number\",\"isStatic\":false,\"isPublic\":true},\"getBaseAmount\":{\"name\":\"getBaseAmount\",\"async\":false,\"parameters\":[],\"returnType\":\"number\",\"isStatic\":false,\"isPublic\":true},\"getJournal\":{\"name\":\"getJournal\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getAccount\":{\"name\":\"getAccount\",\"async\":true,\"parameters\":[],\"returnType\":\"any\",\"isStatic\":false,\"isPublic\":true},\"getDescription\":{\"name\":\"getDescription\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<string>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":{\"include\":[\"list\",\"get\"]},\"mcp\":{\"include\":[\"list\",\"get\"]},\"cli\":{\"skipApiCheck\":true},\"tenantScoped\":{\"mode\":\"optional\"},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"JournalEntry\",\"collectionExportName\":\"JournalEntryCollection\",\"schema\":{\"tableName\":\"journal_entries\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journal_entries\\\" (\\n \\\"id\\\" UUID PRIMARY KEY NOT NULL,\\n \\\"slug\\\" TEXT NOT NULL,\\n \\\"context\\\" TEXT NOT NULL DEFAULT '',\\n \\\"created_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"updated_at\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\\"tenant_id\\\" UUID,\\n \\\"journal_id\\\" UUID,\\n \\\"account_id\\\" UUID,\\n \\\"debit\\\" REAL DEFAULT 0,\\n \\\"credit\\\" REAL DEFAULT 0,\\n \\\"currency\\\" TEXT DEFAULT 'USD',\\n \\\"exchange_rate\\\" REAL DEFAULT 1,\\n \\\"memo\\\" TEXT DEFAULT '',\\n \\\"metadata\\\" JSON DEFAULT '{}'\\n);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"journal_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"journals\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"account_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false,\"foreignKey\":{\"table\":\"ledger_accounts\",\"column\":\"id\",\"onDelete\":\"NO ACTION\",\"onUpdate\":\"CASCADE\"}},\"debit\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"credit\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":0},\"currency\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"USD\"},\"exchange_rate\":{\"type\":\"REAL\",\"notNull\":false,\"unique\":false,\"default\":1},\"memo\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"journal_entries_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"journal_entries_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"journal_entries_journal_id_idx\",\"columns\":[\"journal_id\"]},{\"name\":\"journal_entries_account_id_idx\",\"columns\":[\"account_id\"]}],\"version\":\"93cdc848\"},\"importPath\":\"@happyvertical/smrt-ledgers\"}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
20
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-ledgers","packageVersion":"0.54.4","objects":{"@happyvertical/smrt-ledgers:AccountCollection":{"name":"accountcollection","className":"AccountCollection","qualifiedName":"@happyvertical/smrt-ledgers:AccountCollection","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Accounts.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Account | null>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"type","type":"AccountType","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findTopLevel":{"name":"findTopLevel","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findChildren":{"name":"findChildren","async":true,"parameters":[{"name":"parentId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"getTree":{"name":"getTree","async":true,"parameters":[],"returnType":"Promise<AccountTree>","isStatic":false,"isPublic":true},"getOrCreateByNumber":{"name":"getOrCreateByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["string","AccountType","string | null"]}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true},"groupByType":{"name":"groupByType","async":true,"parameters":[],"returnType":"Promise<Record<AccountType, Account[]>>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Account[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts"},"extends":"SmrtCollection","extendsTypeArg":"Account","exportName":"AccountCollection","collectionExportName":"AccountCollectionCollection","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntryCollection":{"name":"journalentrycollection","className":"JournalEntryCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntryCollection","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/JournalEntries.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByJournal":{"name":"findByJournal","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findByAccount":{"name":"findByAccount","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountBalance":{"name":"getAccountBalance","async":true,"parameters":[{"name":"accountId","type":"string","optional":false},{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTrialBalance":{"name":"getTrialBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<TrialBalanceRow[]>","isStatic":false,"isPublic":true},"getTotalsForDateRange":{"name":"getTotalsForDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"findByAccounts":{"name":"findByAccounts","async":true,"parameters":[{"name":"accountIds","type":"string[]","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"getAccountLedger":{"name":"getAccountLedger","async":true,"parameters":[{"name":"accountId","type":"string","optional":false}],"returnType":"Promise<Array<object>>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<JournalEntry[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"JournalEntry","exportName":"JournalEntryCollection","collectionExportName":"JournalEntryCollectionCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalCollection":{"name":"journalcollection","className":"JournalCollection","qualifiedName":"@happyvertical/smrt-ledgers:JournalCollection","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/collections/Journals.ts","packageName":"@happyvertical/smrt-ledgers","fields":{},"methods":{"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"number","type":"string","optional":false}],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"start","type":"Date","optional":false},{"name":"end","type":"Date","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceModule","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"JournalStatus","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findPosted":{"name":"findPosted","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"createWithEntries":{"name":"createWithEntries","async":true,"parameters":[{"name":"data","type":"CreateJournalData","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"journalId","type":"string","optional":false},{"name":"reason","type":"string","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"findBySourceRef":{"name":"findBySourceRef","async":true,"parameters":[{"name":"sourceRef","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByMonth":{"name":"findByMonth","async":true,"parameters":[{"name":"year","type":"number","optional":false},{"name":"month","type":"number","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Journal[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Journal","exportName":"JournalCollection","collectionExportName":"JournalCollectionCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Account":{"name":"account","className":"Account","qualifiedName":"@happyvertical/smrt-ledgers:Account","collection":"accounts","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Account.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"parentId":{"type":"foreignKey","required":false,"related":"Account","_meta":{"nullable":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":""},"name":{"type":"text","required":false,"default":""},"description":{"type":"text","required":false,"default":""},"type":{"type":"text","required":false,"default":"asset"},"active":{"type":"boolean","required":false,"default":true},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"getParent":{"name":"getParent","async":true,"parameters":[],"returnType":"Promise<this | null>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getAncestors":{"name":"getAncestors","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[],"returnType":"Promise<HierarchyView<this>>","isStatic":false,"isPublic":true},"moveTo":{"name":"moveTo","async":true,"parameters":[{"name":"newParent","type":"this | string | null","optional":false,"unionBranches":[{"type":"this"},{"type":"string"},{"type":"null"}]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"isTopLevel":{"name":"isTopLevel","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isDebitNormal":{"name":"isDebitNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCreditNormal":{"name":"isCreditNormal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getFullPath":{"name":"getFullPath","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true},"toTreeNode":{"name":"toTreeNode","async":true,"parameters":[],"returnType":"Promise<AccountTreeNode>","isStatic":false,"isPublic":true},"getBalance":{"name":"getBalance","async":true,"parameters":[{"name":"asOfDate","type":"Date","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"createChild":{"name":"createChild","async":true,"parameters":[{"name":"options","type":"Omit<AccountOptions, 'parentId' | 'type'>","optional":false}],"returnType":"Promise<Account>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"ledger_accounts","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtHierarchical","exportName":"Account","collectionExportName":"AccountCollection","schema":{"tableName":"ledger_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"ledger_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"parent_id\\" UUID,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"name\\" TEXT DEFAULT '',\\n \\"description\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'asset',\\n \\"active\\" BOOLEAN DEFAULT TRUE,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"asset"},"active":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"ledger_accounts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"ledger_accounts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"ledger_accounts_parent_id_idx","columns":["parent_id"]}],"version":"49630dae"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:Journal":{"name":"journal","className":"Journal","qualifiedName":"@happyvertical/smrt-ledgers:Journal","collection":"journals","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/Journal.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"number":{"type":"text","required":false,"default":""},"date":{"type":"datetime","required":false},"description":{"type":"text","required":false,"default":""},"sourceModule":{"type":"text","required":false,"default":""},"sourceRef":{"type":"text","required":false},"status":{"type":"text","required":false,"default":"draft"},"postedAt":{"type":"datetime","required":false},"voidedAt":{"type":"datetime","required":false},"voidReason":{"type":"text","required":false},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPosted":{"name":"isPosted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isVoided":{"name":"isVoided","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isEditable":{"name":"isEditable","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getEntries":{"name":"getEntries","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getTotalDebits":{"name":"getTotalDebits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTotalCredits":{"name":"getTotalCredits","async":true,"parameters":[],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"isBalanced":{"name":"isBalanced","async":true,"parameters":[],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true},"addEntry":{"name":"addEntry","async":true,"parameters":[{"name":"data","type":"JournalEntryData","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"post":{"name":"post","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"void":{"name":"void","async":true,"parameters":[{"name":"reason","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"summarize":{"name":"summarize","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Journal","collectionExportName":"JournalCollection","schema":{"tableName":"journals","ddl":"CREATE TABLE IF NOT EXISTS \\"journals\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"number\\" TEXT DEFAULT '',\\n \\"date\\" TIMESTAMP,\\n \\"description\\" TEXT DEFAULT '',\\n \\"source_module\\" TEXT DEFAULT '',\\n \\"source_ref\\" TEXT,\\n \\"status\\" TEXT DEFAULT 'draft',\\n \\"posted_at\\" TIMESTAMP,\\n \\"voided_at\\" TIMESTAMP,\\n \\"void_reason\\" TEXT,\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"date":{"type":"TIMESTAMP","notNull":false,"unique":false},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_module":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_ref":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"draft"},"posted_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"voided_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"void_reason":{"type":"TEXT","notNull":false,"unique":false},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journals_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journals_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"4b51d204"},"importPath":"@happyvertical/smrt-ledgers"},"@happyvertical/smrt-ledgers:JournalEntry":{"name":"journalentry","className":"JournalEntry","qualifiedName":"@happyvertical/smrt-ledgers:JournalEntry","collection":"journalentries","filePath":"/home/runner/work/smrt/smrt/packages/ledgers/src/models/JournalEntry.ts","packageName":"@happyvertical/smrt-ledgers","fields":{"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"journalId":{"type":"foreignKey","required":false,"related":"Journal"},"accountId":{"type":"foreignKey","required":false,"related":"Account"},"debit":{"type":"decimal","required":false,"default":0},"credit":{"type":"decimal","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"exchangeRate":{"type":"decimal","required":false,"default":1},"memo":{"type":"text","required":false,"default":""},"metadata":{"type":"json","required":false,"default":{}}},"methods":{"isDebit":{"name":"isDebit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCredit":{"name":"isCredit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getAmount":{"name":"getAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getBaseAmount":{"name":"getBaseAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getJournal":{"name":"getJournal","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getAccount":{"name":"getAccount","async":true,"parameters":[],"returnType":"any","isStatic":false,"isPublic":true},"getDescription":{"name":"getDescription","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"JournalEntry","collectionExportName":"JournalEntryCollection","schema":{"tableName":"journal_entries","ddl":"CREATE TABLE IF NOT EXISTS \\"journal_entries\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"journal_id\\" UUID,\\n \\"account_id\\" UUID,\\n \\"debit\\" REAL DEFAULT 0,\\n \\"credit\\" REAL DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"exchange_rate\\" REAL DEFAULT 1,\\n \\"memo\\" TEXT DEFAULT '',\\n \\"metadata\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"journal_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"journals","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"ledger_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"debit":{"type":"REAL","notNull":false,"unique":false,"default":0},"credit":{"type":"REAL","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"exchange_rate":{"type":"REAL","notNull":false,"unique":false,"default":1},"memo":{"type":"TEXT","notNull":false,"unique":false,"default":""},"metadata":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"journal_entries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"journal_entries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"journal_entries_journal_id_idx","columns":["journal_id"]},{"name":"journal_entries_account_id_idx","columns":["account_id"]}],"version":"93cdc848"},"importPath":"@happyvertical/smrt-ledgers"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-prompts","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/prompts.ts
|
|
23
23
|
var smrtLedgersJournalSummarizePrompt = definePrompt({
|
|
@@ -225,12 +225,19 @@ var AccountCollection = class extends SmrtCollection {
|
|
|
225
225
|
//#region src/models/JournalEntry.ts
|
|
226
226
|
var __defProp$1 = Object.defineProperty;
|
|
227
227
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
228
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
value
|
|
233
|
+
}) : obj[key] = value;
|
|
228
234
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
229
235
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
230
236
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
231
237
|
if (kind && result) __defProp$1(target, key, result);
|
|
232
238
|
return result;
|
|
233
239
|
};
|
|
240
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
234
241
|
var JournalEntry = class extends SmrtObject {
|
|
235
242
|
tenantId = null;
|
|
236
243
|
journalId = "";
|
|
@@ -329,6 +336,7 @@ var JournalEntry = class extends SmrtObject {
|
|
|
329
336
|
return `${this.isDebit() ? "DR" : "CR"} ${accountName}: $${this.getAmount().toFixed(2)}${this.memo ? ` - ${this.memo}` : ""}`;
|
|
330
337
|
}
|
|
331
338
|
};
|
|
339
|
+
__publicField$1(JournalEntry, "__smrtPackage__", "@happyvertical/smrt-ledgers");
|
|
332
340
|
__decorateClass$1([tenantId({ nullable: true })], JournalEntry.prototype, "tenantId", 2);
|
|
333
341
|
__decorateClass$1([foreignKey("Journal")], JournalEntry.prototype, "journalId", 2);
|
|
334
342
|
__decorateClass$1([foreignKey(Account)], JournalEntry.prototype, "accountId", 2);
|
|
@@ -522,12 +530,19 @@ var JournalEntryCollection = class extends SmrtCollection {
|
|
|
522
530
|
//#region src/models/Journal.ts
|
|
523
531
|
var __defProp = Object.defineProperty;
|
|
524
532
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
533
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
534
|
+
enumerable: true,
|
|
535
|
+
configurable: true,
|
|
536
|
+
writable: true,
|
|
537
|
+
value
|
|
538
|
+
}) : obj[key] = value;
|
|
525
539
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
526
540
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
527
541
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
528
542
|
if (kind && result) __defProp(target, key, result);
|
|
529
543
|
return result;
|
|
530
544
|
};
|
|
545
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
531
546
|
var Journal = class extends SmrtObject {
|
|
532
547
|
tenantId = null;
|
|
533
548
|
/**
|
|
@@ -713,6 +728,7 @@ var Journal = class extends SmrtObject {
|
|
|
713
728
|
return (await (await this.getAiClient()).message(resolvedPrompt.text, promptMessageOptions(resolvedPrompt.ai))).trim();
|
|
714
729
|
}
|
|
715
730
|
};
|
|
731
|
+
__publicField(Journal, "__smrtPackage__", "@happyvertical/smrt-ledgers");
|
|
716
732
|
__decorateClass([tenantId({ nullable: true })], Journal.prototype, "tenantId", 2);
|
|
717
733
|
Journal = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
|
|
718
734
|
api: { include: [
|