@happyvertical/smrt-ledgers 0.49.3 → 0.49.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/index.js +1 -1
- package/dist/manifest.json +233 -22
- package/dist/smrt-knowledge.json +7 -7
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/__smrt-register__.ts
|
|
18
|
-
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-ledgers\",\"packageVersion\":\"0.49.3\",\"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\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Account\",\"exportName\":\"AccountCollection\",\"collectionExportName\":\"AccountCollectionCollection\",\"schema\":{\"tableName\":\"account_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"account_collections\\\" (\\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);\",\"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\"}},\"indexes\":[{\"name\":\"account_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"account_collections_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"3802b462\"}},\"@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_entry_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journal_entry_collections\\\" (\\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);\",\"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\"}},\"indexes\":[{\"name\":\"journal_entry_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"journal_entry_collections_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"2cb6f73a\"}},\"@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\":\"journal_collections\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"journal_collections\\\" (\\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);\",\"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\"}},\"indexes\":[{\"name\":\"journal_collections_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"journal_collections_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"665cc41d\"}},\"@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\":{\"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\":\"accounts\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"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\":\"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\":\"accounts_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true},{\"name\":\"accounts_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"accounts_parent_id_idx\",\"columns\":[\"parent_id\"]}],\"version\":\"62bb562a\"}},\"@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},{\"name\":\"journals_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"4b51d204\"}},\"@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\":\"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},{\"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\":\"0457e0e4\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
18
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-ledgers\",\"packageVersion\":\"0.49.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\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Account\",\"exportName\":\"AccountCollection\",\"collectionExportName\":\"AccountCollectionCollection\",\"schema\":{\"tableName\":\"accounts\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"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\":\"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\":\"accounts_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"accounts_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"accounts_parent_id_idx\",\"columns\":[\"parent_id\"]}],\"version\":\"62bb562a\"}},\"@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\":\"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\":\"0457e0e4\"}},\"@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\"}},\"@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\":{\"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\":\"accounts\",\"ddl\":\"CREATE TABLE IF NOT EXISTS \\\"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\":\"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\":\"accounts_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"accounts_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"accounts_parent_id_idx\",\"columns\":[\"parent_id\"]}],\"version\":\"62bb562a\"}},\"@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\"}},\"@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\":\"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\":\"0457e0e4\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-prompts\",\"@happyvertical/smrt-tenancy\"]}"));
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/prompts.ts
|
|
21
21
|
var smrtLedgersJournalSummarizePrompt = definePrompt({
|
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-ledgers",
|
|
5
|
-
"packageVersion": "0.49.
|
|
5
|
+
"packageVersion": "0.49.4",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-ledgers:AccountCollection": {
|
|
8
8
|
"name": "accountcollection",
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
"exportName": "AccountCollection",
|
|
169
169
|
"collectionExportName": "AccountCollectionCollection",
|
|
170
170
|
"schema": {
|
|
171
|
-
"tableName": "
|
|
172
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
171
|
+
"tableName": "accounts",
|
|
172
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"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);",
|
|
173
173
|
"columns": {
|
|
174
174
|
"id": {
|
|
175
175
|
"type": "UUID",
|
|
@@ -195,25 +195,88 @@
|
|
|
195
195
|
"type": "TIMESTAMP",
|
|
196
196
|
"notNull": true,
|
|
197
197
|
"default": "current_timestamp"
|
|
198
|
+
},
|
|
199
|
+
"parent_id": {
|
|
200
|
+
"type": "UUID",
|
|
201
|
+
"referenceKind": "foreignKey",
|
|
202
|
+
"notNull": false,
|
|
203
|
+
"unique": false,
|
|
204
|
+
"foreignKey": {
|
|
205
|
+
"table": "accounts",
|
|
206
|
+
"column": "id",
|
|
207
|
+
"onDelete": "NO ACTION",
|
|
208
|
+
"onUpdate": "CASCADE"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"tenant_id": {
|
|
212
|
+
"type": "UUID",
|
|
213
|
+
"referenceKind": "tenantId",
|
|
214
|
+
"notNull": false,
|
|
215
|
+
"unique": false
|
|
216
|
+
},
|
|
217
|
+
"number": {
|
|
218
|
+
"type": "TEXT",
|
|
219
|
+
"notNull": false,
|
|
220
|
+
"unique": false,
|
|
221
|
+
"default": ""
|
|
222
|
+
},
|
|
223
|
+
"name": {
|
|
224
|
+
"type": "TEXT",
|
|
225
|
+
"notNull": false,
|
|
226
|
+
"unique": false,
|
|
227
|
+
"default": ""
|
|
228
|
+
},
|
|
229
|
+
"description": {
|
|
230
|
+
"type": "TEXT",
|
|
231
|
+
"notNull": false,
|
|
232
|
+
"unique": false,
|
|
233
|
+
"default": ""
|
|
234
|
+
},
|
|
235
|
+
"type": {
|
|
236
|
+
"type": "TEXT",
|
|
237
|
+
"notNull": false,
|
|
238
|
+
"unique": false,
|
|
239
|
+
"default": "asset"
|
|
240
|
+
},
|
|
241
|
+
"active": {
|
|
242
|
+
"type": "BOOLEAN",
|
|
243
|
+
"notNull": false,
|
|
244
|
+
"unique": false,
|
|
245
|
+
"default": true
|
|
246
|
+
},
|
|
247
|
+
"metadata": {
|
|
248
|
+
"type": "JSON",
|
|
249
|
+
"notNull": false,
|
|
250
|
+
"unique": false,
|
|
251
|
+
"default": {}
|
|
198
252
|
}
|
|
199
253
|
},
|
|
200
254
|
"indexes": [
|
|
201
255
|
{
|
|
202
|
-
"name": "
|
|
256
|
+
"name": "accounts_slug_context_idx",
|
|
203
257
|
"columns": [
|
|
258
|
+
"tenant_id",
|
|
204
259
|
"slug",
|
|
205
260
|
"context"
|
|
206
261
|
],
|
|
207
|
-
"unique": true
|
|
262
|
+
"unique": true,
|
|
263
|
+
"nullsNotDistinct": true
|
|
208
264
|
},
|
|
209
265
|
{
|
|
210
|
-
"name": "
|
|
266
|
+
"name": "accounts_tenant_id_created_at_idx",
|
|
211
267
|
"columns": [
|
|
268
|
+
"tenant_id",
|
|
212
269
|
"created_at"
|
|
213
270
|
]
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "accounts_parent_id_idx",
|
|
274
|
+
"columns": [
|
|
275
|
+
"parent_id"
|
|
276
|
+
]
|
|
214
277
|
}
|
|
215
278
|
],
|
|
216
|
-
"version": "
|
|
279
|
+
"version": "62bb562a"
|
|
217
280
|
}
|
|
218
281
|
},
|
|
219
282
|
"@happyvertical/smrt-ledgers:JournalEntryCollection": {
|
|
@@ -376,8 +439,8 @@
|
|
|
376
439
|
"exportName": "JournalEntryCollection",
|
|
377
440
|
"collectionExportName": "JournalEntryCollectionCollection",
|
|
378
441
|
"schema": {
|
|
379
|
-
"tableName": "
|
|
380
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
442
|
+
"tableName": "journal_entries",
|
|
443
|
+
"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);",
|
|
381
444
|
"columns": {
|
|
382
445
|
"id": {
|
|
383
446
|
"type": "UUID",
|
|
@@ -403,25 +466,106 @@
|
|
|
403
466
|
"type": "TIMESTAMP",
|
|
404
467
|
"notNull": true,
|
|
405
468
|
"default": "current_timestamp"
|
|
469
|
+
},
|
|
470
|
+
"tenant_id": {
|
|
471
|
+
"type": "UUID",
|
|
472
|
+
"referenceKind": "tenantId",
|
|
473
|
+
"notNull": false,
|
|
474
|
+
"unique": false
|
|
475
|
+
},
|
|
476
|
+
"journal_id": {
|
|
477
|
+
"type": "UUID",
|
|
478
|
+
"referenceKind": "foreignKey",
|
|
479
|
+
"notNull": false,
|
|
480
|
+
"unique": false,
|
|
481
|
+
"foreignKey": {
|
|
482
|
+
"table": "journals",
|
|
483
|
+
"column": "id",
|
|
484
|
+
"onDelete": "NO ACTION",
|
|
485
|
+
"onUpdate": "CASCADE"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
"account_id": {
|
|
489
|
+
"type": "UUID",
|
|
490
|
+
"referenceKind": "foreignKey",
|
|
491
|
+
"notNull": false,
|
|
492
|
+
"unique": false,
|
|
493
|
+
"foreignKey": {
|
|
494
|
+
"table": "accounts",
|
|
495
|
+
"column": "id",
|
|
496
|
+
"onDelete": "NO ACTION",
|
|
497
|
+
"onUpdate": "CASCADE"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
"debit": {
|
|
501
|
+
"type": "REAL",
|
|
502
|
+
"notNull": false,
|
|
503
|
+
"unique": false,
|
|
504
|
+
"default": 0
|
|
505
|
+
},
|
|
506
|
+
"credit": {
|
|
507
|
+
"type": "REAL",
|
|
508
|
+
"notNull": false,
|
|
509
|
+
"unique": false,
|
|
510
|
+
"default": 0
|
|
511
|
+
},
|
|
512
|
+
"currency": {
|
|
513
|
+
"type": "TEXT",
|
|
514
|
+
"notNull": false,
|
|
515
|
+
"unique": false,
|
|
516
|
+
"default": "USD"
|
|
517
|
+
},
|
|
518
|
+
"exchange_rate": {
|
|
519
|
+
"type": "REAL",
|
|
520
|
+
"notNull": false,
|
|
521
|
+
"unique": false,
|
|
522
|
+
"default": 1
|
|
523
|
+
},
|
|
524
|
+
"memo": {
|
|
525
|
+
"type": "TEXT",
|
|
526
|
+
"notNull": false,
|
|
527
|
+
"unique": false,
|
|
528
|
+
"default": ""
|
|
529
|
+
},
|
|
530
|
+
"metadata": {
|
|
531
|
+
"type": "JSON",
|
|
532
|
+
"notNull": false,
|
|
533
|
+
"unique": false,
|
|
534
|
+
"default": {}
|
|
406
535
|
}
|
|
407
536
|
},
|
|
408
537
|
"indexes": [
|
|
409
538
|
{
|
|
410
|
-
"name": "
|
|
539
|
+
"name": "journal_entries_slug_context_idx",
|
|
411
540
|
"columns": [
|
|
541
|
+
"tenant_id",
|
|
412
542
|
"slug",
|
|
413
543
|
"context"
|
|
414
544
|
],
|
|
415
|
-
"unique": true
|
|
545
|
+
"unique": true,
|
|
546
|
+
"nullsNotDistinct": true
|
|
416
547
|
},
|
|
417
548
|
{
|
|
418
|
-
"name": "
|
|
549
|
+
"name": "journal_entries_tenant_id_created_at_idx",
|
|
419
550
|
"columns": [
|
|
551
|
+
"tenant_id",
|
|
420
552
|
"created_at"
|
|
421
553
|
]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "journal_entries_journal_id_idx",
|
|
557
|
+
"columns": [
|
|
558
|
+
"journal_id"
|
|
559
|
+
]
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"name": "journal_entries_account_id_idx",
|
|
563
|
+
"columns": [
|
|
564
|
+
"account_id"
|
|
565
|
+
]
|
|
422
566
|
}
|
|
423
567
|
],
|
|
424
|
-
"version": "
|
|
568
|
+
"version": "0457e0e4"
|
|
425
569
|
}
|
|
426
570
|
},
|
|
427
571
|
"@happyvertical/smrt-ledgers:JournalCollection": {
|
|
@@ -633,8 +777,8 @@
|
|
|
633
777
|
"exportName": "JournalCollection",
|
|
634
778
|
"collectionExportName": "JournalCollectionCollection",
|
|
635
779
|
"schema": {
|
|
636
|
-
"tableName": "
|
|
637
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"
|
|
780
|
+
"tableName": "journals",
|
|
781
|
+
"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);",
|
|
638
782
|
"columns": {
|
|
639
783
|
"id": {
|
|
640
784
|
"type": "UUID",
|
|
@@ -660,25 +804,89 @@
|
|
|
660
804
|
"type": "TIMESTAMP",
|
|
661
805
|
"notNull": true,
|
|
662
806
|
"default": "current_timestamp"
|
|
807
|
+
},
|
|
808
|
+
"tenant_id": {
|
|
809
|
+
"type": "UUID",
|
|
810
|
+
"referenceKind": "tenantId",
|
|
811
|
+
"notNull": false,
|
|
812
|
+
"unique": false
|
|
813
|
+
},
|
|
814
|
+
"number": {
|
|
815
|
+
"type": "TEXT",
|
|
816
|
+
"notNull": false,
|
|
817
|
+
"unique": false,
|
|
818
|
+
"default": ""
|
|
819
|
+
},
|
|
820
|
+
"date": {
|
|
821
|
+
"type": "TIMESTAMP",
|
|
822
|
+
"notNull": false,
|
|
823
|
+
"unique": false
|
|
824
|
+
},
|
|
825
|
+
"description": {
|
|
826
|
+
"type": "TEXT",
|
|
827
|
+
"notNull": false,
|
|
828
|
+
"unique": false,
|
|
829
|
+
"default": ""
|
|
830
|
+
},
|
|
831
|
+
"source_module": {
|
|
832
|
+
"type": "TEXT",
|
|
833
|
+
"notNull": false,
|
|
834
|
+
"unique": false,
|
|
835
|
+
"default": ""
|
|
836
|
+
},
|
|
837
|
+
"source_ref": {
|
|
838
|
+
"type": "TEXT",
|
|
839
|
+
"notNull": false,
|
|
840
|
+
"unique": false
|
|
841
|
+
},
|
|
842
|
+
"status": {
|
|
843
|
+
"type": "TEXT",
|
|
844
|
+
"notNull": false,
|
|
845
|
+
"unique": false,
|
|
846
|
+
"default": "draft"
|
|
847
|
+
},
|
|
848
|
+
"posted_at": {
|
|
849
|
+
"type": "TIMESTAMP",
|
|
850
|
+
"notNull": false,
|
|
851
|
+
"unique": false
|
|
852
|
+
},
|
|
853
|
+
"voided_at": {
|
|
854
|
+
"type": "TIMESTAMP",
|
|
855
|
+
"notNull": false,
|
|
856
|
+
"unique": false
|
|
857
|
+
},
|
|
858
|
+
"void_reason": {
|
|
859
|
+
"type": "TEXT",
|
|
860
|
+
"notNull": false,
|
|
861
|
+
"unique": false
|
|
862
|
+
},
|
|
863
|
+
"metadata": {
|
|
864
|
+
"type": "JSON",
|
|
865
|
+
"notNull": false,
|
|
866
|
+
"unique": false,
|
|
867
|
+
"default": {}
|
|
663
868
|
}
|
|
664
869
|
},
|
|
665
870
|
"indexes": [
|
|
666
871
|
{
|
|
667
|
-
"name": "
|
|
872
|
+
"name": "journals_slug_context_idx",
|
|
668
873
|
"columns": [
|
|
874
|
+
"tenant_id",
|
|
669
875
|
"slug",
|
|
670
876
|
"context"
|
|
671
877
|
],
|
|
672
|
-
"unique": true
|
|
878
|
+
"unique": true,
|
|
879
|
+
"nullsNotDistinct": true
|
|
673
880
|
},
|
|
674
881
|
{
|
|
675
|
-
"name": "
|
|
882
|
+
"name": "journals_tenant_id_created_at_idx",
|
|
676
883
|
"columns": [
|
|
884
|
+
"tenant_id",
|
|
677
885
|
"created_at"
|
|
678
886
|
]
|
|
679
887
|
}
|
|
680
888
|
],
|
|
681
|
-
"version": "
|
|
889
|
+
"version": "4b51d204"
|
|
682
890
|
}
|
|
683
891
|
},
|
|
684
892
|
"@happyvertical/smrt-ledgers:Account": {
|
|
@@ -1005,7 +1213,8 @@
|
|
|
1005
1213
|
"slug",
|
|
1006
1214
|
"context"
|
|
1007
1215
|
],
|
|
1008
|
-
"unique": true
|
|
1216
|
+
"unique": true,
|
|
1217
|
+
"nullsNotDistinct": true
|
|
1009
1218
|
},
|
|
1010
1219
|
{
|
|
1011
1220
|
"name": "accounts_tenant_id_created_at_idx",
|
|
@@ -1335,7 +1544,8 @@
|
|
|
1335
1544
|
"slug",
|
|
1336
1545
|
"context"
|
|
1337
1546
|
],
|
|
1338
|
-
"unique": true
|
|
1547
|
+
"unique": true,
|
|
1548
|
+
"nullsNotDistinct": true
|
|
1339
1549
|
},
|
|
1340
1550
|
{
|
|
1341
1551
|
"name": "journals_tenant_id_created_at_idx",
|
|
@@ -1605,7 +1815,8 @@
|
|
|
1605
1815
|
"slug",
|
|
1606
1816
|
"context"
|
|
1607
1817
|
],
|
|
1608
|
-
"unique": true
|
|
1818
|
+
"unique": true,
|
|
1819
|
+
"nullsNotDistinct": true
|
|
1609
1820
|
},
|
|
1610
1821
|
{
|
|
1611
1822
|
"name": "journal_entries_tenant_id_created_at_idx",
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-ledgers",
|
|
6
|
-
"packageVersion": "0.49.
|
|
6
|
+
"packageVersion": "0.49.4",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "17955a665bc5953c3074f1bcf797e6e6e39ad0455b00c2658d6805a5aa548bb8",
|
|
11
|
+
"packageJson": "f2ce48576e2fba42d8e282be9c6b72d30ed2aed5a860a005841711467d2fa090",
|
|
12
12
|
"agents": "6fa28e0fe0c03c7a9c201154f935286ca0e72fd59f7e3fa24b440f87e687d7c8"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"name": "AccountCollection",
|
|
42
42
|
"qualifiedName": "@happyvertical/smrt-ledgers:AccountCollection",
|
|
43
43
|
"collection": "accounts",
|
|
44
|
-
"tableName": "
|
|
44
|
+
"tableName": "accounts",
|
|
45
45
|
"packageName": "@happyvertical/smrt-ledgers",
|
|
46
46
|
"extends": "SmrtCollection",
|
|
47
47
|
"fields": [],
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
"name": "JournalEntryCollection",
|
|
397
397
|
"qualifiedName": "@happyvertical/smrt-ledgers:JournalEntryCollection",
|
|
398
398
|
"collection": "journalentries",
|
|
399
|
-
"tableName": "
|
|
399
|
+
"tableName": "journal_entries",
|
|
400
400
|
"packageName": "@happyvertical/smrt-ledgers",
|
|
401
401
|
"extends": "SmrtCollection",
|
|
402
402
|
"fields": [],
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
"name": "JournalCollection",
|
|
707
707
|
"qualifiedName": "@happyvertical/smrt-ledgers:JournalCollection",
|
|
708
708
|
"collection": "journals",
|
|
709
|
-
"tableName": "
|
|
709
|
+
"tableName": "journals",
|
|
710
710
|
"packageName": "@happyvertical/smrt-ledgers",
|
|
711
711
|
"extends": "SmrtCollection",
|
|
712
712
|
"fields": [],
|
|
@@ -3413,7 +3413,7 @@
|
|
|
3413
3413
|
"junctionCollections": 0,
|
|
3414
3414
|
"hierarchicalObjects": 1,
|
|
3415
3415
|
"polymorphicAssociations": 0,
|
|
3416
|
-
"uuidColumns":
|
|
3416
|
+
"uuidColumns": 18
|
|
3417
3417
|
},
|
|
3418
3418
|
"agentDoc": "# @happyvertical/smrt-ledgers\n\nDouble-entry accounting with chart of accounts, journal lifecycle, and balance enforcement.\n\n## Models\n\n- **Account**: 5 types (asset/liability/equity/revenue/expense). Hierarchical via `parentId`. Debit-normal (asset, expense) vs credit-normal (liability, equity, revenue). Methods: `getAncestors()`, `getFullPath()`, `toTreeNode()`, `getBalance(asOfDate?)`.\n- **Journal**: lifecycle `draft → posted → voided`. **Immutable after posting** (can only void, not edit). `sourceModule`/`sourceRef` for cross-package attribution. Auto-numbered (e.g., \"JNL-0001\"). `summarize()` is AI-powered via the smrt-prompts registry (see Prompt Registry below).\n- **JournalEntry**: debit XOR credit (not both, validated on save). Multi-currency via `exchangeRate`. Non-negative amounts required.\n\n## Key Methods\n\n- **`Journal.summarize()`**: Generates a natural-language summary via the registered `smrtLedgers.journal.summarize` prompt, resolved through `@happyvertical/smrt-prompts`. Tenants can override the template, model, temperature, or other params via `_smrt_prompt_overrides` without code changes. Only non-PII fields (number, date, description, status, aggregate total, entry count, balanced flag) reach the AI provider.\n\n## Prompt Registry\n\nRegistered at module-load time via `definePrompt()` in `src/prompts.ts`. Side-effect imported from `src/index.ts` so consumers automatically see the prompts after importing any export from this package.\n\n| Key | Method | Variables |\n|-----|--------|-----------|\n| `smrtLedgers.journal.summarize` | `Journal.summarize()` | `journalNumber`, `journalDate`, `journalDescription`, `journalStatus`, `journalTotal`, `entryCount`, `journalBalanced` |\n\nPII-conscious variable selection: `tenantId`, `sourceRef` (may reference customer/vendor identifiers), per-entry `accountId`/`id`, and the extensible `metadata` blob are intentionally NOT exposed as prompt variables. Tenants who need richer context should override the template via `PromptOverride` and supply their own variables through a custom call site.\n\n## Balance Enforcement\n\n`journal.post()` validates `Math.abs(totalDebits - totalCredits) < BALANCE_EPSILON` where `BALANCE_EPSILON = 0.01` (float rounding tolerance). Unbalanced journals cannot be posted.\n\n**This package is unit-agnostic** — `debit` / `credit` are plain DECIMAL numbers and the balance check only compares the two sides, so it holds for whatever unit the posting module uses. As of #2401, journals posted from `@happyvertical/smrt-commerce` (`Payment.recordPayment()`, `Invoice.recognizeRevenue()`) carry **integer minor units**, which balance exactly rather than merely within the epsilon. A consumer mixing modules that post in different units will get arithmetically balanced but semantically meaningless journals; pick one unit per ledger.\n\n## Gotchas\n\n- **Float tolerance**: 0.01 epsilon for balance check — not exact equality\n- **Entry requires journalId**: save Journal first, then add entries\n- **Posted journals cannot be modified**: only voided (`voidReason`, `voidedAt`)\n- **Account types inherited by children**: child cannot differ from parent type\n- **getBalance() is async**: requires JournalEntryCollection query (not stored on Account)\n- **Optional tenancy** on all models\n"
|
|
3419
3419
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-ledgers",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.4",
|
|
4
4
|
"description": "Double-entry accounting ledger for the SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@happyvertical/smrt-core": "0.49.
|
|
42
|
-
"@happyvertical/smrt-prompts": "0.49.
|
|
43
|
-
"@happyvertical/smrt-tenancy": "0.49.
|
|
41
|
+
"@happyvertical/smrt-core": "0.49.4",
|
|
42
|
+
"@happyvertical/smrt-prompts": "0.49.4",
|
|
43
|
+
"@happyvertical/smrt-tenancy": "0.49.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@happyvertical/smrt-vitest": "0.49.
|
|
46
|
+
"@happyvertical/smrt-vitest": "0.49.4",
|
|
47
47
|
"@types/node": "24.13.2",
|
|
48
48
|
"fast-glob": "^3.3.3",
|
|
49
49
|
"typescript": "5.9.3",
|