@happyvertical/smrt-expenses 0.57.3 → 0.57.5
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/AGENTS.md +42 -3
- package/README.md +129 -9
- package/agents/financial-facts-test-matrix.md +57 -0
- package/agents/supplier-payable-test-matrix.md +24 -0
- package/dist/actions/expense-actions.d.ts +2 -0
- package/dist/actions/expense-actions.d.ts.map +1 -1
- package/dist/chunks/Expense-C_WC5VLF.js +1364 -0
- package/dist/chunks/Expense-C_WC5VLF.js.map +1 -0
- package/dist/chunks/{ExpenseReceiptCollection-y1SlmnBS.js → ExpenseReceiptCollection-BO5yvJLm.js} +2 -2
- package/dist/chunks/{ExpenseReceiptCollection-y1SlmnBS.js.map → ExpenseReceiptCollection-BO5yvJLm.js.map} +1 -1
- package/dist/chunks/{expense-actions-Ce5CBaBE.js → expense-actions-Bxzeb4s2.js} +8 -3
- package/dist/chunks/expense-actions-Bxzeb4s2.js.map +1 -0
- package/dist/collections/ExpenseCollection.d.ts +17 -1
- package/dist/collections/ExpenseCollection.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -7
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +304 -7
- package/dist/models/Expense.d.ts +35 -1
- package/dist/models/Expense.d.ts.map +1 -1
- package/dist/recipes.d.ts +9 -0
- package/dist/recipes.d.ts.map +1 -1
- package/dist/refund-position.d.ts +11 -0
- package/dist/refund-position.d.ts.map +1 -0
- package/dist/reimbursement-position.d.ts +20 -0
- package/dist/reimbursement-position.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +267 -10
- package/dist/supplier-payable.d.ts +128 -0
- package/dist/supplier-payable.d.ts.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -9
- package/dist/chunks/Expense-7afLcUTn.js +0 -681
- package/dist/chunks/Expense-7afLcUTn.js.map +0 -1
- package/dist/chunks/expense-actions-Ce5CBaBE.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/__smrt-register__.ts","../src/collections/ExpenseCollection.ts","../src/recipes.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"packageVersion\\\":\\\"0.57.3\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-expenses:ExpenseCollection\\\":{\\\"name\\\":\\\"expensecollection\\\",\\\"className\\\":\\\"ExpenseCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseCollection\\\",\\\"collection\\\":\\\"expenses\\\",\\\"description\\\":\\\"Collection for Expense. Reads go through the normal tenant interceptors, so inside withTenant() every method here sees only that tenant's expenses.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/collections/ExpenseCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"record\\\":{\\\"name\\\":\\\"record\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"RecordExpenseActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"record\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Record a new expense for review (service-backed).\\\"}},\\\"attachReceipt\\\":{\\\"name\\\":\\\"attachReceipt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"AttachExpenseReceiptActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"attachReceipt\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Attach a receipt file to an expense (service-backed).\\\"}},\\\"recordReview\\\":{\\\"name\\\":\\\"recordReview\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ReviewExpenseActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"recordReview\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Approve or reject an expense with a reason (service-backed).\\\"}},\\\"recordReimbursement\\\":{\\\"name\\\":\\\"recordReimbursement\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"MarkExpenseReimbursedActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"recordReimbursement\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Record that an expense was reimbursed (service-backed).\\\"}},\\\"forCostObject\\\":{\\\"name\\\":\\\"forCostObject\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"costObjectType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"costObjectId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"totalsByCurrency\\\":{\\\"name\\\":\\\"totalsByCurrency\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ExpenseTotalsOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<CurrencyTotals>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"listReviewedTaxFacts\\\":{\\\"name\\\":\\\"listReviewedTaxFacts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ReviewedExpenseTaxFactsOptions\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ReviewedExpenseTaxFact[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"commitmentPosition\\\":{\\\"name\\\":\\\"commitmentPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"commitmentId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<CommitmentPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"record\\\",\\\"attachReceipt\\\",\\\"recordReview\\\",\\\"recordReimbursement\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"expenses\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Expense\\\",\\\"exportName\\\":\\\"ExpenseCollection\\\",\\\"collectionExportName\\\":\\\"ExpenseCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expenses\\\\\\\" (\\\\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 \\\\\\\"cost_object_type\\\\\\\" TEXT,\\\\n \\\\\\\"cost_object_id\\\\\\\" TEXT,\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"amount\\\\\\\" INTEGER,\\\\n \\\\\\\"currency\\\\\\\" TEXT,\\\\n \\\\\\\"financial_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_name\\\\\\\" TEXT,\\\\n \\\\\\\"refund_of_id\\\\\\\" UUID,\\\\n \\\\\\\"incurred_on\\\\\\\" TEXT,\\\\n \\\\\\\"recorded_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"recorded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"paid_by\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"vendor_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_line_id\\\\\\\" UUID,\\\\n \\\\\\\"review_status\\\\\\\" TEXT,\\\\n \\\\\\\"reviewed_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"reviewed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"review_note\\\\\\\" TEXT,\\\\n \\\\\\\"duplicate_of_id\\\\\\\" UUID,\\\\n \\\\\\\"reimbursable\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reimbursed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"reimbursement_reference\\\\\\\" TEXT\\\\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},\\\"cost_object_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"cost_object_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"currency\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"financial_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"refund_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"incurred_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"vendor_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_line_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"duplicate_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"SET NULL\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursement_reference\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"cost_object_type\\\",\\\"cost_object_id\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"commitment_id\\\",\\\"review_status\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"review_status\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expenses_refund_of_id_idx\\\",\\\"columns\\\":[\\\"refund_of_id\\\"]},{\\\"name\\\":\\\"expenses_recorded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"recorded_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_paid_by_profile_id_idx\\\",\\\"columns\\\":[\\\"paid_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_vendor_id_idx\\\",\\\"columns\\\":[\\\"vendor_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_id_idx\\\",\\\"columns\\\":[\\\"commitment_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_line_id_idx\\\",\\\"columns\\\":[\\\"commitment_line_id\\\"]},{\\\"name\\\":\\\"expenses_reviewed_by_profile_id_idx\\\",\\\"columns\\\":[\\\"reviewed_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_duplicate_of_id_idx\\\",\\\"columns\\\":[\\\"duplicate_of_id\\\"]}],\\\"version\\\":\\\"287668fa\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:ExpenseReceiptCollection\\\":{\\\"name\\\":\\\"expensereceiptcollection\\\",\\\"className\\\":\\\"ExpenseReceiptCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseReceiptCollection\\\",\\\"collection\\\":\\\"expensereceipts\\\",\\\"description\\\":\\\"Junction collection over expense_receipts (left: expense, right: asset). Reads go through the normal tenant interceptors.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/collections/ExpenseReceiptCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"byRight\\\":{\\\"name\\\":\\\"byRight\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"rightId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<TItem[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"byLeft\\\":{\\\"name\\\":\\\"byLeft\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"leftId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<TItem[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"attach\\\":{\\\"name\\\":\\\"attach\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"_expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_assetId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_opts\\\",\\\"type\\\":\\\"JunctionAttachOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"detach\\\":{\\\"name\\\":\\\"detach\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"leftId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"rightId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setLinks\\\":{\\\"name\\\":\\\"setLinks\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"_expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_assetIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_opts\\\",\\\"type\\\":\\\"JunctionAttachOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"attachReceipt\\\":{\\\"name\\\":\\\"attachReceipt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"AttachReceiptInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"receiptsFor\\\":{\\\"name\\\":\\\"receiptsFor\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findDuplicateReceipts\\\":{\\\"name\\\":\\\"findDuplicateReceipts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"FindDuplicateReceiptsOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<DuplicateReceiptGroup[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"expense_receipts\\\"},\\\"extends\\\":\\\"SmrtJunction\\\",\\\"extendsTypeArg\\\":\\\"ExpenseReceipt\\\",\\\"exportName\\\":\\\"ExpenseReceiptCollection\\\",\\\"collectionExportName\\\":\\\"ExpenseReceiptCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expense_receipts\\\\\\\" (\\\\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 \\\\\\\"expense_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"asset_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"uploaded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"mime_type\\\\\\\" TEXT,\\\\n \\\\\\\"byte_count\\\\\\\" INTEGER,\\\\n \\\\\\\"content_sha256\\\\\\\" TEXT NOT NULL\\\\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},\\\"expense_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"asset_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"uploaded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"mime_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"byte_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_sha256\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expense_id\\\",\\\"content_sha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"content_sha256\\\"]},{\\\"name\\\":\\\"expense_receipts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expense_receipts_asset_id_idx\\\",\\\"columns\\\":[\\\"asset_id\\\"]},{\\\"name\\\":\\\"expense_receipts_uploaded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"uploaded_by_profile_id\\\"]}],\\\"version\\\":\\\"5aa77571\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:Expense\\\":{\\\"name\\\":\\\"expense\\\",\\\"className\\\":\\\"Expense\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"collection\\\":\\\"expenses\\\",\\\"description\\\":\\\"A cost someone incurred.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/models/Expense.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"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}}},\\\"costObjectType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"costObjectId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"category\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"amount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"currency\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"financialBreakdown\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"paidByName\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"refundOfId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"incurredOn\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"recordedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"recordedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"paidBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"company\\\",\\\"person\\\",\\\"third-party\\\"]},\\\"paidByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"vendorId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:Vendor\\\"},\\\"commitmentId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:PurchaseContract\\\",\\\"_meta\\\":{\\\"validateSubtype\\\":true}},\\\"commitmentLineId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:ContractLineItem\\\"},\\\"reviewStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"enum\\\":[\\\"unreviewed\\\",\\\"reviewed\\\",\\\"rejected\\\"],\\\"readonly\\\":true},\\\"reviewedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"reviewedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"reviewNote\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"duplicateOfId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"SET NULL\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"reimbursedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"reimbursementReference\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}}},\\\"methods\\\":{\\\"getFinancialBreakdown\\\":{\\\"name\\\":\\\"getFinancialBreakdown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ExpenseFinancialBreakdown | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setFinancialBreakdown\\\":{\\\"name\\\":\\\"setFinancialBreakdown\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"ExpenseFinancialBreakdown | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"ExpenseFinancialBreakdown\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCostBasis\\\":{\\\"name\\\":\\\"getCostBasis\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ExpenseCostBasis | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isReimbursed\\\":{\\\"name\\\":\\\"isReimbursed\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isCountable\\\":{\\\"name\\\":\\\"isCountable\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"review\\\":{\\\"name\\\":\\\"review\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ReviewExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"reject\\\":{\\\"name\\\":\\\"reject\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RejectExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markDuplicate\\\":{\\\"name\\\":\\\"markDuplicate\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"MarkDuplicateExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"reopen\\\":{\\\"name\\\":\\\"reopen\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ReopenExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markReimbursed\\\":{\\\"name\\\":\\\"markReimbursed\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"MarkReimbursedInput\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCostObject\\\":{\\\"name\\\":\\\"getCostObject\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"api\\\":{\\\"include\\\":[\\\"record\\\",\\\"attachReceipt\\\",\\\"recordReview\\\",\\\"recordReimbursement\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"costObjectType\\\",\\\"costObjectId\\\",\\\"incurredOn\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"commitmentId\\\",\\\"reviewStatus\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"reviewStatus\\\",\\\"incurredOn\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Expense\\\",\\\"collectionExportName\\\":\\\"ExpenseCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expenses\\\\\\\" (\\\\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 \\\\\\\"cost_object_type\\\\\\\" TEXT,\\\\n \\\\\\\"cost_object_id\\\\\\\" TEXT,\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"amount\\\\\\\" INTEGER,\\\\n \\\\\\\"currency\\\\\\\" TEXT,\\\\n \\\\\\\"financial_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_name\\\\\\\" TEXT,\\\\n \\\\\\\"refund_of_id\\\\\\\" UUID,\\\\n \\\\\\\"incurred_on\\\\\\\" TEXT,\\\\n \\\\\\\"recorded_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"recorded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"paid_by\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"vendor_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_line_id\\\\\\\" UUID,\\\\n \\\\\\\"review_status\\\\\\\" TEXT,\\\\n \\\\\\\"reviewed_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"reviewed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"review_note\\\\\\\" TEXT,\\\\n \\\\\\\"duplicate_of_id\\\\\\\" UUID,\\\\n \\\\\\\"reimbursable\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reimbursed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"reimbursement_reference\\\\\\\" TEXT\\\\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},\\\"cost_object_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"cost_object_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"currency\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"financial_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"refund_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"incurred_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"vendor_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_line_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"duplicate_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"SET NULL\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursement_reference\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"cost_object_type\\\",\\\"cost_object_id\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"commitment_id\\\",\\\"review_status\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"review_status\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expenses_refund_of_id_idx\\\",\\\"columns\\\":[\\\"refund_of_id\\\"]},{\\\"name\\\":\\\"expenses_recorded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"recorded_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_paid_by_profile_id_idx\\\",\\\"columns\\\":[\\\"paid_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_vendor_id_idx\\\",\\\"columns\\\":[\\\"vendor_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_id_idx\\\",\\\"columns\\\":[\\\"commitment_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_line_id_idx\\\",\\\"columns\\\":[\\\"commitment_line_id\\\"]},{\\\"name\\\":\\\"expenses_reviewed_by_profile_id_idx\\\",\\\"columns\\\":[\\\"reviewed_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_duplicate_of_id_idx\\\",\\\"columns\\\":[\\\"duplicate_of_id\\\"]}],\\\"version\\\":\\\"287668fa\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\":{\\\"name\\\":\\\"expensereceipt\\\",\\\"className\\\":\\\"ExpenseReceipt\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\",\\\"collection\\\":\\\"expensereceipts\\\",\\\"description\\\":\\\"A receipt file attached to an expense.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseReceipt.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"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}}},\\\"expenseId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"CASCADE\\\"}},\\\"assetId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-assets:Asset\\\"},\\\"uploadedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"filename\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"mimeType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"byteCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"contentSha256\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expenseId\\\",\\\"contentSha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"contentSha256\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"ExpenseReceipt\\\",\\\"collectionExportName\\\":\\\"ExpenseReceiptCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"expenseId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"assetId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"contentSha256\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expense_receipts\\\\\\\" (\\\\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 \\\\\\\"expense_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"asset_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"uploaded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"mime_type\\\\\\\" TEXT,\\\\n \\\\\\\"byte_count\\\\\\\" INTEGER,\\\\n \\\\\\\"content_sha256\\\\\\\" TEXT NOT NULL\\\\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},\\\"expense_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"asset_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"uploaded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"mime_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"byte_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_sha256\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expense_id\\\",\\\"content_sha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"content_sha256\\\"]},{\\\"name\\\":\\\"expense_receipts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expense_receipts_asset_id_idx\\\",\\\"columns\\\":[\\\"asset_id\\\"]},{\\\"name\\\":\\\"expense_receipts_uploaded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"uploaded_by_profile_id\\\"]}],\\\"version\\\":\\\"5aa77571\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"expenses.tracking\\\",\\\"className\\\":\\\"ExpensesRecipe\\\",\\\"label\\\":\\\"Expenses\\\",\\\"summary\\\":\\\"Record what the business spends, with receipts, and review it.\\\",\\\"synonyms\\\":[\\\"costs\\\",\\\"receipts\\\",\\\"spending\\\",\\\"reimbursements\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Expenses\\\",\\\"model\\\":\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"icon\\\":\\\"receipt\\\",\\\"description\\\":\\\"Costs you have paid, with the receipt and who paid.\\\"}],\\\"requires\\\":[],\\\"section\\\":{\\\"id\\\":\\\"accounting\\\",\\\"label\\\":\\\"Accounting\\\",\\\"icon\\\":\\\"bank\\\",\\\"description\\\":\\\"Your books: accounts, journals and balances.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-expenses:Expense\\\":{\\\"fields\\\":{\\\"description\\\":{\\\"order\\\":1,\\\"required\\\":true},\\\"amount\\\":{\\\"order\\\":2},\\\"currency\\\":{\\\"order\\\":3},\\\"incurredOn\\\":{\\\"label\\\":\\\"Date\\\",\\\"order\\\":4,\\\"help\\\":\\\"The date on the receipt, as YYYY-MM-DD.\\\"},\\\"category\\\":{\\\"order\\\":5,\\\"help\\\":\\\"One word, such as material, travel, freight or other.\\\"},\\\"vendorId\\\":{\\\"label\\\":\\\"Vendor\\\",\\\"order\\\":6},\\\"paidBy\\\":{\\\"order\\\":7},\\\"paidByProfileId\\\":{\\\"label\\\":\\\"Person who paid\\\",\\\"order\\\":8,\\\"help\\\":\\\"Who paid out of their own pocket, when a person paid.\\\"},\\\"paidByName\\\":{\\\"order\\\":9},\\\"reimbursable\\\":{\\\"order\\\":10},\\\"costObjectId\\\":{\\\"label\\\":\\\"Charged to\\\",\\\"order\\\":11,\\\"help\\\":\\\"The job, project or client the cost belongs to.\\\"},\\\"costObjectType\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"financialBreakdown\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"refundOfId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"recordedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"commitmentId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"commitmentLineId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"reviewedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"duplicateOfId\\\":{\\\"visibility\\\":\\\"hidden\\\"}}},\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\":{\\\"fields\\\":{\\\"contentSha256\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"byteCount\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"uploadedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"}}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nExpenses are the costs the business pays: a receipt, who paid it and what it\\\\nwas for. Each expense is reviewed once, and a reimbursable one is marked when\\\\nthe person is paid back.\\\\n\\\\n## Tasks\\\\n\\\\n### Record an expense\\\\n\\\\n1. Create a new expense and write a short **{field:description}**.\\\\n2. Enter the **{field:amount}** and its **{field:currency}**.\\\\n3. Set the **{field:incurredOn}** date from the receipt and pick a\\\\n **{field:category}**.\\\\n4. Choose who **{field:paidBy}**: the company, a person or a third party.\\\\n5. When a person paid, pick the **{field:paidByProfileId}** and tick\\\\n **{field:reimbursable}** when they are owed the money back.\\\\n\\\\n### Review it\\\\n\\\\n1. Open the expense and check the receipt attached to it.\\\\n2. **{field:reviewStatus}** moves from unreviewed to reviewed, or to rejected,\\\\n when someone reviews it. A rejected expense can be reopened.\\\\n\\\",\\\"fieldRefs\\\":[\\\"amount\\\",\\\"category\\\",\\\"currency\\\",\\\"description\\\",\\\"incurredOn\\\",\\\"paidBy\\\",\\\"paidByProfileId\\\",\\\"reimbursable\\\",\\\"reviewStatus\\\"]},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package does not build for a browser: node:crypto; and its package depends on @happyvertical/smrt-agents, @happyvertical/smrt-commerce, @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-products, @happyvertical/smrt-profiles, @happyvertical/smrt-reports, @happyvertical/smrt-secrets, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3616, #3617, #3624, #3625, #3626, #3627).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-assets\\\",\\\"@happyvertical/smrt-commerce\\\",\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3615\\\",\\\"#3616\\\",\\\"#3617\\\",\\\"#3624\\\",\\\"#3625\\\",\\\"#3626\\\",\\\"#3627\\\"],\\\"reason\\\":\\\"node:crypto\\\",\\\"via\\\":[\\\"@happyvertical/smrt-agents\\\",\\\"@happyvertical/smrt-commerce\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-ledgers\\\",\\\"@happyvertical/smrt-products\\\",\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-reports\\\",\\\"@happyvertical/smrt-secrets\\\",\\\"@happyvertical/smrt-subscriptions\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"]},\\\"stampsConstructors\\\":true}\"));\n","/**\n * ExpenseCollection — queries, per-currency totals, and commitment drawdown.\n *\n * @packageDocumentation\n */\n\nimport {\n ContractLineItemCollection,\n PurchaseContractCollection,\n} from '@happyvertical/smrt-commerce';\nimport { method, SmrtCollection, smrt } from '@happyvertical/smrt-core';\nimport type {\n AttachExpenseReceiptActionInput,\n MarkExpenseReimbursedActionInput,\n RecordExpenseActionInput,\n ReviewExpenseActionInput,\n} from '../actions/expense-actions.js';\nimport { Expense } from '../models/Expense.js';\nimport type { ExpenseReceipt } from '../models/ExpenseReceipt.js';\nimport {\n type CommitmentPosition,\n type CurrencyTotals,\n ExpenseError,\n type ExpenseFinancialBreakdown,\n type ExpenseReviewStatus,\n type ExpenseTotalsOptions,\n} from '../types.js';\n\n/** A reviewed, non-duplicate expense and its optional stored supplier facts. */\nexport interface ReviewedExpenseTaxFact {\n /** Legacy owner identity alias retained for existing callers. */\n id: string;\n /** Reporting identity consumed by commerce tax-summary facts. */\n expenseId: string;\n tenantId: string;\n incurredOn: string;\n currency: string;\n commitmentId: string | null;\n commitmentLineId: string | null;\n /** `null` is unknown legacy supplier tax, never an implied zero. */\n financialBreakdown: ExpenseFinancialBreakdown | null;\n}\n\nexport interface ReviewedExpenseTaxFactsOptions {\n tenantId: string;\n from: string;\n to: string;\n currency?: string;\n}\n\nfunction isCalendarDate(value: string): boolean {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return false;\n const date = new Date(`${value}T00:00:00.000Z`);\n return (\n !Number.isNaN(date.getTime()) && date.toISOString().slice(0, 10) === value\n );\n}\n\n/** Plain projection read for sums: never hydrates objects. */\ninterface AmountRow {\n id: string;\n amount: number | string;\n currency: string;\n reviewStatus: ExpenseReviewStatus;\n duplicateOfId: string | null;\n}\n\nconst AMOUNT_FIELDS = [\n 'id',\n 'amount',\n 'currency',\n 'reviewStatus',\n 'duplicateOfId',\n] as const;\n\nfunction toMinorUnits(value: number | string): number {\n const amount = typeof value === 'number' ? value : Number(value);\n if (!Number.isSafeInteger(amount)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Stored expense amount ${String(value)} is not a safe integer.`,\n );\n }\n return amount;\n}\n\nfunction addTo(totals: CurrencyTotals, currency: string, amount: number) {\n const entry = totals[currency] ?? { amount: 0, count: 0 };\n const sum = entry.amount + amount;\n if (!Number.isSafeInteger(sum)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Total for ${currency} exceeds the safe integer range.`,\n );\n }\n totals[currency] = { amount: sum, count: entry.count + 1 };\n}\n\n/**\n * Collection for {@link Expense}. Reads go through the normal tenant\n * interceptors, so inside `withTenant()` every method here sees only that\n * tenant's expenses.\n *\n * Collection classes are registered too, so this one carries its own\n * surface; without it every public method here would become an MCP tool. It\n * publishes only the service-backed write actions (#4001), on REST: each\n * authorizes the signed-in person itself (`expenses.<action>`) and delegates\n * to the guarded domain flow. Reads, MCP and CLI stay closed.\n */\n@smrt({\n api: {\n include: ['record', 'attachReceipt', 'recordReview', 'recordReimbursement'],\n },\n mcp: { include: [] },\n cli: false,\n})\nexport class ExpenseCollection extends SmrtCollection<Expense> { static __smrtPackage__ = \"@happyvertical/smrt-expenses\";\n static readonly _itemClass = Expense;\n\n /**\n * Record a new, unreviewed expense for the signed-in person in their\n * tenant. Needs `expenses.record`; a person-paid expense for someone else\n * also needs `expenses.recordReview`.\n */\n @method({\n httpMethod: 'POST',\n path: 'record',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Record a new expense for review (service-backed).',\n })\n async record(options: RecordExpenseActionInput): Promise<Expense> {\n const { recordExpenseAction } = await import(\n '../actions/expense-actions.js'\n );\n return recordExpenseAction(this, options);\n }\n\n /**\n * Attach a stored asset to an expense as its receipt. Needs\n * `expenses.attachReceipt`; only the recorder or payer may attach unless\n * the caller holds `expenses.recordReview`.\n */\n @method({\n httpMethod: 'POST',\n path: 'attachReceipt',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Attach a receipt file to an expense (service-backed).',\n })\n async attachReceipt(\n options: AttachExpenseReceiptActionInput,\n ): Promise<ExpenseReceipt> {\n const { attachExpenseReceiptAction } = await import(\n '../actions/expense-actions.js'\n );\n return attachExpenseReceiptAction(this, options);\n }\n\n /**\n * Accept or refuse (with a reason) an expense, attributed to the signed-in\n * reviewer. Needs an explicit `expenses.recordReview` grant.\n */\n @method({\n httpMethod: 'POST',\n path: 'recordReview',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Approve or reject an expense with a reason (service-backed).',\n })\n async recordReview(options: ReviewExpenseActionInput): Promise<Expense> {\n const { reviewExpenseAction } = await import(\n '../actions/expense-actions.js'\n );\n return reviewExpenseAction(this, options);\n }\n\n /**\n * Record that the person who paid an expense has been paid back. Needs an\n * explicit `expenses.recordReimbursement` grant.\n */\n @method({\n httpMethod: 'POST',\n path: 'recordReimbursement',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Record that an expense was reimbursed (service-backed).',\n })\n async recordReimbursement(\n options: MarkExpenseReimbursedActionInput,\n ): Promise<Expense> {\n const { markExpenseReimbursedAction } = await import(\n '../actions/expense-actions.js'\n );\n return markExpenseReimbursedAction(this, options);\n }\n\n /**\n * Expenses charged to one cost object, oldest incurred first.\n *\n * @param costObjectType - Qualified class name of the cost object.\n * @param costObjectId - Id of the cost object.\n */\n async forCostObject(\n costObjectType: string,\n costObjectId: string,\n ): Promise<Expense[]> {\n return this.list({\n where: { costObjectType, costObjectId },\n orderBy: ['incurred_on ASC', 'created_at ASC'],\n });\n }\n\n /**\n * Sum expenses per currency. Amounts in different currencies are never\n * added together: the result is keyed by ISO 4217 code.\n *\n * By default only `reviewed` expenses count; a duplicate never counts.\n *\n * @example\n * ```typescript\n * const totals = await expenses.totalsByCurrency({\n * where: { costObjectType: JOB, costObjectId: job.id },\n * });\n * // { USD: { amount: 125000, count: 3 }, CAD: { amount: 4000, count: 1 } }\n * ```\n */\n async totalsByCurrency(\n options: ExpenseTotalsOptions = {},\n ): Promise<CurrencyTotals> {\n const statuses = options.reviewStatuses ?? ['reviewed'];\n if (statuses.length === 0) return {};\n const rows = (await this.list({\n where: {\n ...(options.where ?? {}),\n reviewStatus: [...statuses],\n duplicateOfId: null,\n },\n select: [...AMOUNT_FIELDS],\n })) as unknown as AmountRow[];\n\n const totals: CurrencyTotals = {};\n const seen = new Set<string>();\n for (const row of rows) {\n if (seen.has(row.id)) continue;\n seen.add(row.id);\n addTo(totals, row.currency, toMinorUnits(row.amount));\n }\n return totals;\n }\n\n /**\n * Stored supplier-tax facts for reporting. Only reviewed non-duplicate\n * expenses are returned; callers must retain a null breakdown as unknown.\n */\n async listReviewedTaxFacts(\n options: ReviewedExpenseTaxFactsOptions,\n ): Promise<ReviewedExpenseTaxFact[]> {\n if (\n !options.tenantId?.trim() ||\n !isCalendarDate(options.from) ||\n !isCalendarDate(options.to) ||\n options.from > options.to ||\n (options.currency !== undefined && !options.currency.trim())\n ) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Tax facts require a tenant, an ordered calendar-date range, and a nonempty currency when supplied.',\n );\n }\n const expenses = await this.list({\n where: {\n tenantId: options.tenantId,\n reviewStatus: 'reviewed',\n duplicateOfId: null,\n 'incurredOn >=': options.from,\n 'incurredOn <=': options.to,\n ...(options.currency ? { currency: options.currency } : {}),\n },\n orderBy: ['incurred_on ASC', 'id ASC'],\n });\n return expenses.map((expense) => {\n if (!expense.id || expense.tenantId !== options.tenantId) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Tenant tax-fact query returned a row without its requested tenant identity.',\n );\n }\n return {\n id: expense.id,\n expenseId: expense.id,\n tenantId: expense.tenantId,\n incurredOn: expense.incurredOn,\n currency: expense.currency,\n commitmentId: expense.commitmentId,\n commitmentLineId: expense.commitmentLineId,\n financialBreakdown: expense.getFinancialBreakdown(),\n };\n });\n }\n\n /**\n * What remains open on a commitment — a commerce `Contract`, normally a\n * `PurchaseOrder` — or on one of its lines.\n *\n * `committed` is the contract's `totalAmount` (or the line's `amount`);\n * `drawn` sums the matched actuals that are `reviewed` and not marked\n * duplicate, in the commitment's currency, each expense once. Unreviewed,\n * rejected and duplicate matches are counted in `excluded` and never\n * drawn. A 4,600 commitment with 1,000 reviewed leaves 3,600 open.\n *\n * @param commitmentId - The commitment's contract id.\n * @param options.lineId - Restrict to one line of the commitment.\n * @throws {ExpenseError} `EXPENSE_COMMITMENT_MISMATCH` when the commitment\n * (or line) is not visible in the current tenant.\n */\n async commitmentPosition(\n commitmentId: string,\n options: { lineId?: string } = {},\n ): Promise<CommitmentPosition> {\n const contracts = await PurchaseContractCollection.create({ db: this.db });\n const commitment = await contracts.get({ id: commitmentId });\n if (!commitment) {\n throw new ExpenseError(\n 'EXPENSE_COMMITMENT_MISMATCH',\n `Commitment ${commitmentId} was not found.`,\n );\n }\n let committed = toMinorUnits(commitment.totalAmount);\n if (options.lineId) {\n const lines = await ContractLineItemCollection.create({ db: this.db });\n const line = await lines.get({ id: options.lineId });\n if (!line || line.contractId !== commitmentId) {\n throw new ExpenseError(\n 'EXPENSE_COMMITMENT_MISMATCH',\n `Line ${options.lineId} is not a line of commitment ${commitmentId}.`,\n );\n }\n committed = toMinorUnits(line.amount);\n }\n const currency = String(commitment.currency).toUpperCase();\n\n const rows = (await this.list({\n where: {\n commitmentId,\n ...(options.lineId ? { commitmentLineId: options.lineId } : {}),\n },\n select: [...AMOUNT_FIELDS],\n })) as unknown as AmountRow[];\n\n const position: CommitmentPosition = {\n commitmentId,\n commitmentLineId: options.lineId ?? null,\n currency,\n committed,\n drawn: 0,\n open: 0,\n overrun: 0,\n countedExpenseIds: [],\n excluded: { unreviewed: 0, rejected: 0, duplicate: 0 },\n otherCurrencies: {},\n };\n const seen = new Set<string>();\n for (const row of rows) {\n if (seen.has(row.id)) continue;\n seen.add(row.id);\n if (row.duplicateOfId) {\n position.excluded.duplicate += 1;\n } else if (row.reviewStatus === 'unreviewed') {\n position.excluded.unreviewed += 1;\n } else if (row.reviewStatus === 'rejected') {\n position.excluded.rejected += 1;\n } else if (row.currency !== currency) {\n addTo(position.otherCurrencies, row.currency, toMinorUnits(row.amount));\n } else {\n const drawn = position.drawn + toMinorUnits(row.amount);\n if (!Number.isSafeInteger(drawn)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Drawdown on commitment ${commitmentId} exceeds the safe range.`,\n );\n }\n position.drawn = drawn;\n position.countedExpenseIds.push(row.id);\n }\n }\n position.countedExpenseIds.sort();\n position.open = Math.max(committed - position.drawn, 0);\n position.overrun = Math.max(position.drawn - committed, 0);\n return position;\n }\n}\n","/**\n * Declared recipes for smrt-expenses (#3590, #3604): user-facing units of\n * functionality an app or agent can pick instead of the whole package.\n * The scanner reads these statics into the `recipes` array of `manifest.json`\n * and `smrt-knowledge.json`; nothing here runs at that point.\n *\n * @packageDocumentation\n */\n\nimport { SmrtRecipe } from '@happyvertical/smrt-core';\nimport { Expense } from './models/Expense.js';\nimport { ExpenseReceipt } from './models/ExpenseReceipt.js';\n\n/** Expenses: Record what the business spends, with receipts, and review it. */\nexport class ExpensesRecipe extends SmrtRecipe {\n static id = 'expenses.tracking';\n static help = './tracking.recipe.md';\n static label = 'Expenses';\n static summary =\n 'Record what the business spends, with receipts, and review it.';\n static synonyms = ['costs', 'receipts', 'spending', 'reimbursements'];\n static section = {\n id: 'accounting',\n label: 'Accounting',\n icon: 'bank',\n description: 'Your books: accounts, journals and balances.',\n };\n static models = [Expense, ExpenseReceipt];\n static nav = [\n {\n label: 'Expenses',\n model: Expense,\n icon: 'receipt',\n description: 'Costs you have paid, with the receipt and who paid.',\n },\n ];\n static options = {\n Expense: {\n fields: {\n description: { order: 1, required: true },\n amount: { order: 2 },\n currency: { order: 3 },\n incurredOn: {\n label: 'Date',\n order: 4,\n help: 'The date on the receipt, as YYYY-MM-DD.',\n },\n category: {\n order: 5,\n help: 'One word, such as material, travel, freight or other.',\n },\n vendorId: { label: 'Vendor', order: 6 },\n paidBy: { order: 7 },\n paidByProfileId: {\n label: 'Person who paid',\n order: 8,\n help: 'Who paid out of their own pocket, when a person paid.',\n },\n paidByName: { order: 9 },\n reimbursable: { order: 10 },\n costObjectId: {\n label: 'Charged to',\n order: 11,\n help: 'The job, project or client the cost belongs to.',\n },\n costObjectType: { visibility: 'hidden' },\n financialBreakdown: { visibility: 'hidden' },\n refundOfId: { visibility: 'hidden' },\n recordedByProfileId: { visibility: 'hidden' },\n commitmentId: { visibility: 'hidden' },\n commitmentLineId: { visibility: 'hidden' },\n reviewedByProfileId: { visibility: 'hidden' },\n duplicateOfId: { visibility: 'hidden' },\n },\n },\n ExpenseReceipt: {\n fields: {\n contentSha256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,OAAO,EAAE;GACvB,cAAc,EAAE,OAAO,GAAG;GAC1B,cAAc;IACZ,OAAO;IACP,OAAO;IACP,MAAM;GACR;GACA,gBAAgB,EAAE,YAAY,SAAS;GACvC,oBAAoB,EAAE,YAAY,SAAS;GAC3C,YAAY,EAAE,YAAY,SAAS;GACnC,qBAAqB,EAAE,YAAY,SAAS;GAC5C,cAAc,EAAE,YAAY,SAAS;GACrC,kBAAkB,EAAE,YAAY,SAAS;GACzC,qBAAqB,EAAE,YAAY,SAAS;GAC5C,eAAe,EAAE,YAAY,SAAS;EACxC,EACF;EACA,gBAAgB,EACd,QAAQ;GACN,eAAe,EAAE,YAAY,SAAS;GACtC,WAAW,EAAE,YAAY,SAAS;GAClC,qBAAqB,EAAE,YAAY,SAAS;EAC9C,EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/__smrt-register__.ts","../src/collections/ExpenseCollection.ts","../src/recipes.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"packageVersion\\\":\\\"0.57.5\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-expenses:ExpenseCollection\\\":{\\\"name\\\":\\\"expensecollection\\\",\\\"className\\\":\\\"ExpenseCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseCollection\\\",\\\"collection\\\":\\\"expenses\\\",\\\"description\\\":\\\"Collection for Expense. Reads go through the normal tenant interceptors, so inside withTenant() every method here sees only that tenant's expenses.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/collections/ExpenseCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"recordSupplierPayable\\\":{\\\"name\\\":\\\"recordSupplierPayable\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RecordSupplierPayableInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordSupplierPayableEvent\\\":{\\\"name\\\":\\\"recordSupplierPayableEvent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RecordSupplierPayableEventInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"completeSupplierPayableBasis\\\":{\\\"name\\\":\\\"completeSupplierPayableBasis\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"CompleteSupplierPayableBasisInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"supplierPayablePosition\\\":{\\\"name\\\":\\\"supplierPayablePosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"reimbursementPosition\\\":{\\\"name\\\":\\\"reimbursementPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sourceId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReimbursementPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"refundPosition\\\":{\\\"name\\\":\\\"refundPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sourceId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseRefundPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"record\\\":{\\\"name\\\":\\\"record\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"RecordExpenseActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"record\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Record a new expense for review (service-backed).\\\"}},\\\"attachReceipt\\\":{\\\"name\\\":\\\"attachReceipt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"AttachExpenseReceiptActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"attachReceipt\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Attach a receipt file to an expense (service-backed).\\\"}},\\\"recordReview\\\":{\\\"name\\\":\\\"recordReview\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ReviewExpenseActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"recordReview\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Approve or reject an expense with a reason (service-backed).\\\"}},\\\"recordReimbursement\\\":{\\\"name\\\":\\\"recordReimbursement\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"MarkExpenseReimbursedActionInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true,\\\"decoratorConfig\\\":{\\\"httpMethod\\\":\\\"POST\\\",\\\"path\\\":\\\"recordReimbursement\\\",\\\"effect\\\":\\\"write\\\",\\\"idempotent\\\":false,\\\"openWorld\\\":false,\\\"description\\\":\\\"Record that an expense was reimbursed (service-backed).\\\"}},\\\"forCostObject\\\":{\\\"name\\\":\\\"forCostObject\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"costObjectType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"costObjectId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Expense[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"totalsByCurrency\\\":{\\\"name\\\":\\\"totalsByCurrency\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ExpenseTotalsOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<CurrencyTotals>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"listReviewedTaxFacts\\\":{\\\"name\\\":\\\"listReviewedTaxFacts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"ReviewedExpenseTaxFactsOptions\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ReviewedExpenseTaxFact[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"commitmentPosition\\\":{\\\"name\\\":\\\"commitmentPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"commitmentId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<CommitmentPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"record\\\",\\\"attachReceipt\\\",\\\"recordReview\\\",\\\"recordReimbursement\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"expenses\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Expense\\\",\\\"exportName\\\":\\\"ExpenseCollection\\\",\\\"collectionExportName\\\":\\\"ExpenseCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expenses\\\\\\\" (\\\\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 \\\\\\\"cost_object_type\\\\\\\" TEXT,\\\\n \\\\\\\"cost_object_id\\\\\\\" TEXT,\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"amount\\\\\\\" INTEGER,\\\\n \\\\\\\"currency\\\\\\\" TEXT,\\\\n \\\\\\\"financial_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"supplier_payable_json\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_name\\\\\\\" TEXT,\\\\n \\\\\\\"refund_of_id\\\\\\\" UUID,\\\\n \\\\\\\"refund_recipient\\\\\\\" TEXT,\\\\n \\\\\\\"incurred_on\\\\\\\" TEXT,\\\\n \\\\\\\"recorded_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"recorded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"paid_by\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"vendor_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_line_id\\\\\\\" UUID,\\\\n \\\\\\\"review_status\\\\\\\" TEXT,\\\\n \\\\\\\"reviewed_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"reviewed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"review_note\\\\\\\" TEXT,\\\\n \\\\\\\"duplicate_of_id\\\\\\\" UUID,\\\\n \\\\\\\"reimbursable\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reimbursed_amount\\\\\\\" INTEGER,\\\\n \\\\\\\"reimbursed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"reimbursement_reference\\\\\\\" TEXT\\\\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},\\\"cost_object_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"cost_object_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"currency\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"financial_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"supplier_payable_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"refund_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"refund_recipient\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"incurred_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"vendor_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_line_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"duplicate_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"SET NULL\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursement_reference\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"cost_object_type\\\",\\\"cost_object_id\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"commitment_id\\\",\\\"review_status\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"review_status\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expenses_refund_of_id_idx\\\",\\\"columns\\\":[\\\"refund_of_id\\\"]},{\\\"name\\\":\\\"expenses_recorded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"recorded_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_paid_by_profile_id_idx\\\",\\\"columns\\\":[\\\"paid_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_vendor_id_idx\\\",\\\"columns\\\":[\\\"vendor_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_id_idx\\\",\\\"columns\\\":[\\\"commitment_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_line_id_idx\\\",\\\"columns\\\":[\\\"commitment_line_id\\\"]},{\\\"name\\\":\\\"expenses_reviewed_by_profile_id_idx\\\",\\\"columns\\\":[\\\"reviewed_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_duplicate_of_id_idx\\\",\\\"columns\\\":[\\\"duplicate_of_id\\\"]}],\\\"version\\\":\\\"dc99ff87\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:ExpenseReceiptCollection\\\":{\\\"name\\\":\\\"expensereceiptcollection\\\",\\\"className\\\":\\\"ExpenseReceiptCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseReceiptCollection\\\",\\\"collection\\\":\\\"expensereceipts\\\",\\\"description\\\":\\\"Junction collection over expense_receipts (left: expense, right: asset). Reads go through the normal tenant interceptors.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/collections/ExpenseReceiptCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"byRight\\\":{\\\"name\\\":\\\"byRight\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"rightId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<TItem[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"byLeft\\\":{\\\"name\\\":\\\"byLeft\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"leftId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<TItem[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"attach\\\":{\\\"name\\\":\\\"attach\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"_expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_assetId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_opts\\\",\\\"type\\\":\\\"JunctionAttachOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"detach\\\":{\\\"name\\\":\\\"detach\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"leftId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"rightId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"opts\\\",\\\"type\\\":\\\"JunctionFilterOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setLinks\\\":{\\\"name\\\":\\\"setLinks\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"_expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_assetIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"_opts\\\",\\\"type\\\":\\\"JunctionAttachOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"attachReceipt\\\":{\\\"name\\\":\\\"attachReceipt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"AttachReceiptInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"receiptsFor\\\":{\\\"name\\\":\\\"receiptsFor\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expenseId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ExpenseReceipt[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findDuplicateReceipts\\\":{\\\"name\\\":\\\"findDuplicateReceipts\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"FindDuplicateReceiptsOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<DuplicateReceiptGroup[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"expense_receipts\\\"},\\\"extends\\\":\\\"SmrtJunction\\\",\\\"extendsTypeArg\\\":\\\"ExpenseReceipt\\\",\\\"exportName\\\":\\\"ExpenseReceiptCollection\\\",\\\"collectionExportName\\\":\\\"ExpenseReceiptCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expense_receipts\\\\\\\" (\\\\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 \\\\\\\"expense_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"asset_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"uploaded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"mime_type\\\\\\\" TEXT,\\\\n \\\\\\\"byte_count\\\\\\\" INTEGER,\\\\n \\\\\\\"content_sha256\\\\\\\" TEXT NOT NULL\\\\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},\\\"expense_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"asset_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"uploaded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"mime_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"byte_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_sha256\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expense_id\\\",\\\"content_sha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"content_sha256\\\"]},{\\\"name\\\":\\\"expense_receipts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expense_receipts_asset_id_idx\\\",\\\"columns\\\":[\\\"asset_id\\\"]},{\\\"name\\\":\\\"expense_receipts_uploaded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"uploaded_by_profile_id\\\"]}],\\\"version\\\":\\\"5aa77571\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:Expense\\\":{\\\"name\\\":\\\"expense\\\",\\\"className\\\":\\\"Expense\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"collection\\\":\\\"expenses\\\",\\\"description\\\":\\\"A cost someone incurred.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/models/Expense.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"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}}},\\\"costObjectType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"costObjectId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"category\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"amount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"currency\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"financialBreakdown\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"supplierPayableJson\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"paidByName\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"refundOfId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"refundRecipient\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"incurredOn\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"recordedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"recordedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"paidBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"company\\\",\\\"person\\\",\\\"third-party\\\"]},\\\"paidByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"vendorId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:Vendor\\\"},\\\"commitmentId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:PurchaseContract\\\",\\\"_meta\\\":{\\\"validateSubtype\\\":true}},\\\"commitmentLineId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-commerce:ContractLineItem\\\"},\\\"reviewStatus\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"enum\\\":[\\\"unreviewed\\\",\\\"reviewed\\\",\\\"rejected\\\"],\\\"readonly\\\":true},\\\"reviewedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"PROFILE\\\"},\\\"reviewedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"reviewNote\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"duplicateOfId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"SET NULL\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"reimbursedAmount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"reimbursedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"reimbursementReference\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"readonly\\\":true},\\\"readonly\\\":true}},\\\"methods\\\":{\\\"getFinancialBreakdown\\\":{\\\"name\\\":\\\"getFinancialBreakdown\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ExpenseFinancialBreakdown | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setFinancialBreakdown\\\":{\\\"name\\\":\\\"setFinancialBreakdown\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"ExpenseFinancialBreakdown | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"ExpenseFinancialBreakdown\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRefundRecipient\\\":{\\\"name\\\":\\\"getRefundRecipient\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ExpenseRefundRecipient | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setRefundRecipient\\\":{\\\"name\\\":\\\"setRefundRecipient\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"ExpenseRefundRecipient | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"ExpenseRefundRecipient\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCostBasis\\\":{\\\"name\\\":\\\"getCostBasis\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ExpenseCostBasis | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isReimbursed\\\":{\\\"name\\\":\\\"isReimbursed\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isCountable\\\":{\\\"name\\\":\\\"isCountable\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"review\\\":{\\\"name\\\":\\\"review\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ReviewExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"reject\\\":{\\\"name\\\":\\\"reject\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RejectExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markDuplicate\\\":{\\\"name\\\":\\\"markDuplicate\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"MarkDuplicateExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"reopen\\\":{\\\"name\\\":\\\"reopen\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ReopenExpenseInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markReimbursed\\\":{\\\"name\\\":\\\"markReimbursed\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"MarkReimbursedInput\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCostObject\\\":{\\\"name\\\":\\\"getCostObject\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<T | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordSupplierPayable\\\":{\\\"name\\\":\\\"recordSupplierPayable\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RecordSupplierPayableInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordSupplierPayableEvent\\\":{\\\"name\\\":\\\"recordSupplierPayableEvent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RecordSupplierPayableEventInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"completeSupplierPayableBasis\\\":{\\\"name\\\":\\\"completeSupplierPayableBasis\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"CompleteSupplierPayableBasisInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSupplierPayablePosition\\\":{\\\"name\\\":\\\"getSupplierPayablePosition\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<SupplierPayablePosition | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"Date | string\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getReimbursementPosition\\\":{\\\"name\\\":\\\"getReimbursementPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<ExpenseReimbursementPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRefundPosition\\\":{\\\"name\\\":\\\"getRefundPosition\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<ExpenseRefundPosition>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"api\\\":{\\\"include\\\":[\\\"record\\\",\\\"attachReceipt\\\",\\\"recordReview\\\",\\\"recordReimbursement\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"costObjectType\\\",\\\"costObjectId\\\",\\\"incurredOn\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"commitmentId\\\",\\\"reviewStatus\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"reviewStatus\\\",\\\"incurredOn\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Expense\\\",\\\"collectionExportName\\\":\\\"ExpenseCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"expenses\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expenses\\\\\\\" (\\\\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 \\\\\\\"cost_object_type\\\\\\\" TEXT,\\\\n \\\\\\\"cost_object_id\\\\\\\" TEXT,\\\\n \\\\\\\"category\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"amount\\\\\\\" INTEGER,\\\\n \\\\\\\"currency\\\\\\\" TEXT,\\\\n \\\\\\\"financial_breakdown\\\\\\\" TEXT,\\\\n \\\\\\\"supplier_payable_json\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_name\\\\\\\" TEXT,\\\\n \\\\\\\"refund_of_id\\\\\\\" UUID,\\\\n \\\\\\\"refund_recipient\\\\\\\" TEXT,\\\\n \\\\\\\"incurred_on\\\\\\\" TEXT,\\\\n \\\\\\\"recorded_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"recorded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"paid_by\\\\\\\" TEXT,\\\\n \\\\\\\"paid_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"vendor_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_id\\\\\\\" UUID,\\\\n \\\\\\\"commitment_line_id\\\\\\\" UUID,\\\\n \\\\\\\"review_status\\\\\\\" TEXT,\\\\n \\\\\\\"reviewed_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"reviewed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"review_note\\\\\\\" TEXT,\\\\n \\\\\\\"duplicate_of_id\\\\\\\" UUID,\\\\n \\\\\\\"reimbursable\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reimbursed_amount\\\\\\\" INTEGER,\\\\n \\\\\\\"reimbursed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"reimbursement_reference\\\\\\\" TEXT\\\\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},\\\"cost_object_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"cost_object_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"currency\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"financial_breakdown\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"supplier_payable_json\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"refund_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"refund_recipient\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"incurred_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"recorded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"paid_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"vendor_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"commitment_line_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reviewed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"review_note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"duplicate_of_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"SET NULL\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"reimbursable\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_amount\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reimbursement_reference\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expenses_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expenses_cost_object_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"cost_object_type\\\",\\\"cost_object_id\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_commitment_review_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"commitment_id\\\",\\\"review_status\\\"]},{\\\"name\\\":\\\"expenses_review_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"review_status\\\",\\\"incurred_on\\\"]},{\\\"name\\\":\\\"expenses_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expenses_refund_of_id_idx\\\",\\\"columns\\\":[\\\"refund_of_id\\\"]},{\\\"name\\\":\\\"expenses_recorded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"recorded_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_paid_by_profile_id_idx\\\",\\\"columns\\\":[\\\"paid_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_vendor_id_idx\\\",\\\"columns\\\":[\\\"vendor_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_id_idx\\\",\\\"columns\\\":[\\\"commitment_id\\\"]},{\\\"name\\\":\\\"expenses_commitment_line_id_idx\\\",\\\"columns\\\":[\\\"commitment_line_id\\\"]},{\\\"name\\\":\\\"expenses_reviewed_by_profile_id_idx\\\",\\\"columns\\\":[\\\"reviewed_by_profile_id\\\"]},{\\\"name\\\":\\\"expenses_duplicate_of_id_idx\\\",\\\"columns\\\":[\\\"duplicate_of_id\\\"]}],\\\"version\\\":\\\"dc99ff87\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"},\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\":{\\\"name\\\":\\\"expensereceipt\\\",\\\"className\\\":\\\"ExpenseReceipt\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\",\\\"collection\\\":\\\"expensereceipts\\\",\\\"description\\\":\\\"A receipt file attached to an expense.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseReceipt.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-expenses\\\",\\\"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}}},\\\"expenseId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Expense\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"CASCADE\\\"}},\\\"assetId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":true,\\\"related\\\":\\\"@happyvertical/smrt-assets:Asset\\\"},\\\"uploadedByProfileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\"},\\\"filename\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"mimeType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"byteCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"contentSha256\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expenseId\\\",\\\"contentSha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"contentSha256\\\"]}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"ExpenseReceipt\\\",\\\"collectionExportName\\\":\\\"ExpenseReceiptCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"expenseId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"assetId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"crossPackageRef\\\"},{\\\"field\\\":\\\"contentSha256\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"expense_receipts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"expense_receipts\\\\\\\" (\\\\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 \\\\\\\"expense_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"asset_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"uploaded_by_profile_id\\\\\\\" UUID,\\\\n \\\\\\\"filename\\\\\\\" TEXT,\\\\n \\\\\\\"mime_type\\\\\\\" TEXT,\\\\n \\\\\\\"byte_count\\\\\\\" INTEGER,\\\\n \\\\\\\"content_sha256\\\\\\\" TEXT NOT NULL\\\\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},\\\"expense_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"expenses\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"CASCADE\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"asset_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"uploaded_by_profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"filename\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"mime_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"byte_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"content_sha256\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"expense_receipts_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"expense_receipts_expense_sha256_key\\\",\\\"columns\\\":[\\\"expense_id\\\",\\\"content_sha256\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"expense_receipts_tenant_sha256_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"content_sha256\\\"]},{\\\"name\\\":\\\"expense_receipts_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"expense_receipts_asset_id_idx\\\",\\\"columns\\\":[\\\"asset_id\\\"]},{\\\"name\\\":\\\"expense_receipts_uploaded_by_profile_id_idx\\\",\\\"columns\\\":[\\\"uploaded_by_profile_id\\\"]}],\\\"version\\\":\\\"5aa77571\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-expenses\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"expenses.tracking\\\",\\\"className\\\":\\\"ExpensesRecipe\\\",\\\"label\\\":\\\"Expenses\\\",\\\"summary\\\":\\\"Record what the business spends, with receipts, and review it.\\\",\\\"synonyms\\\":[\\\"costs\\\",\\\"receipts\\\",\\\"spending\\\",\\\"reimbursements\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Expenses\\\",\\\"model\\\":\\\"@happyvertical/smrt-expenses:Expense\\\",\\\"icon\\\":\\\"receipt\\\",\\\"description\\\":\\\"Costs you have paid, with the receipt and who paid.\\\"}],\\\"requires\\\":[],\\\"section\\\":{\\\"id\\\":\\\"accounting\\\",\\\"label\\\":\\\"Accounting\\\",\\\"icon\\\":\\\"bank\\\",\\\"description\\\":\\\"Your books: accounts, journals and balances.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-expenses:Expense\\\":{\\\"fields\\\":{\\\"description\\\":{\\\"order\\\":1,\\\"required\\\":true},\\\"amount\\\":{\\\"order\\\":2},\\\"currency\\\":{\\\"order\\\":3},\\\"incurredOn\\\":{\\\"label\\\":\\\"Date\\\",\\\"order\\\":4,\\\"help\\\":\\\"The date on the receipt, as YYYY-MM-DD.\\\"},\\\"category\\\":{\\\"order\\\":5,\\\"help\\\":\\\"One word, such as material, travel, freight or other.\\\"},\\\"vendorId\\\":{\\\"label\\\":\\\"Vendor\\\",\\\"order\\\":6},\\\"paidBy\\\":{\\\"order\\\":7},\\\"paidByProfileId\\\":{\\\"label\\\":\\\"Person who paid\\\",\\\"order\\\":8,\\\"help\\\":\\\"Who paid out of their own pocket, when a person paid.\\\"},\\\"paidByName\\\":{\\\"order\\\":9},\\\"reimbursable\\\":{\\\"order\\\":10},\\\"costObjectId\\\":{\\\"label\\\":\\\"Charged to\\\",\\\"order\\\":11,\\\"help\\\":\\\"The job, project or client the cost belongs to.\\\"},\\\"costObjectType\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"financialBreakdown\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"supplierPayableJson\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"refundRecipient\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"reimbursedAmount\\\":{\\\"help\\\":\\\"The recorded amount paid back to the person who paid.\\\"},\\\"refundOfId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"recordedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"commitmentId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"commitmentLineId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"reviewedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"duplicateOfId\\\":{\\\"visibility\\\":\\\"hidden\\\"}}},\\\"@happyvertical/smrt-expenses:ExpenseReceipt\\\":{\\\"fields\\\":{\\\"contentSha256\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"byteCount\\\":{\\\"visibility\\\":\\\"hidden\\\"},\\\"uploadedByProfileId\\\":{\\\"visibility\\\":\\\"hidden\\\"}}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nExpenses are the costs the business pays: a receipt, who paid it and what it\\\\nwas for. Each expense is reviewed once, and a reimbursable one is marked when\\\\nthe person is paid back.\\\\n\\\\n## Tasks\\\\n\\\\n### Record an expense\\\\n\\\\n1. Create a new expense and write a short **{field:description}**.\\\\n2. Enter the **{field:amount}** and its **{field:currency}**.\\\\n3. Set the **{field:incurredOn}** date from the receipt and pick a\\\\n **{field:category}**.\\\\n4. Choose who **{field:paidBy}**: the company, a person or a third party.\\\\n5. When a person paid, pick the **{field:paidByProfileId}** and tick\\\\n **{field:reimbursable}** when they are owed the money back.\\\\n\\\\n### Review it\\\\n\\\\n1. Open the expense and check the receipt attached to it.\\\\n2. **{field:reviewStatus}** moves from unreviewed to reviewed, or to rejected,\\\\n when someone reviews it. A rejected expense can be reopened.\\\\n\\\",\\\"fieldRefs\\\":[\\\"amount\\\",\\\"category\\\",\\\"currency\\\",\\\"description\\\",\\\"incurredOn\\\",\\\"paidBy\\\",\\\"paidByProfileId\\\",\\\"reimbursable\\\",\\\"reviewStatus\\\"]},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package does not build for a browser: node:crypto; and its package depends on @happyvertical/smrt-agents, @happyvertical/smrt-commerce, @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-products, @happyvertical/smrt-profiles, @happyvertical/smrt-reports, @happyvertical/smrt-secrets, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3616, #3617, #3624, #3625, #3626, #3627).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-assets\\\",\\\"@happyvertical/smrt-commerce\\\",\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3615\\\",\\\"#3616\\\",\\\"#3617\\\",\\\"#3624\\\",\\\"#3625\\\",\\\"#3626\\\",\\\"#3627\\\"],\\\"reason\\\":\\\"node:crypto\\\",\\\"via\\\":[\\\"@happyvertical/smrt-agents\\\",\\\"@happyvertical/smrt-commerce\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-ledgers\\\",\\\"@happyvertical/smrt-products\\\",\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-reports\\\",\\\"@happyvertical/smrt-secrets\\\",\\\"@happyvertical/smrt-subscriptions\\\",\\\"@happyvertical/smrt-tenancy\\\",\\\"@happyvertical/smrt-users\\\"]},\\\"stampsConstructors\\\":true}\"));\n","/**\n * ExpenseCollection — queries, per-currency totals, and commitment drawdown.\n *\n * @packageDocumentation\n */\n\nimport {\n ContractLineItemCollection,\n PurchaseContractCollection,\n} from '@happyvertical/smrt-commerce';\nimport { method, SmrtCollection, smrt } from '@happyvertical/smrt-core';\nimport type {\n AttachExpenseReceiptActionInput,\n MarkExpenseReimbursedActionInput,\n RecordExpenseActionInput,\n ReviewExpenseActionInput,\n} from '../actions/expense-actions.js';\nimport { Expense } from '../models/Expense.js';\nimport type { ExpenseReceipt } from '../models/ExpenseReceipt.js';\nimport type {\n CompleteSupplierPayableBasisInput,\n RecordSupplierPayableEventInput,\n RecordSupplierPayableInput,\n SupplierPayablePosition,\n} from '../supplier-payable.js';\nimport {\n type CommitmentPosition,\n type CurrencyTotals,\n ExpenseError,\n type ExpenseFinancialBreakdown,\n type ExpenseRefundPosition,\n type ExpenseReimbursementPosition,\n type ExpenseReviewStatus,\n type ExpenseTotalsOptions,\n} from '../types.js';\n\n/** A reviewed, non-duplicate expense and its optional stored supplier facts. */\nexport interface ReviewedExpenseTaxFact {\n /** Legacy owner identity alias retained for existing callers. */\n id: string;\n /** Reporting identity consumed by commerce tax-summary facts. */\n expenseId: string;\n tenantId: string;\n incurredOn: string;\n currency: string;\n commitmentId: string | null;\n commitmentLineId: string | null;\n /** `null` is unknown legacy supplier tax, never an implied zero. */\n financialBreakdown: ExpenseFinancialBreakdown | null;\n}\n\nexport interface ReviewedExpenseTaxFactsOptions {\n tenantId: string;\n from: string;\n to: string;\n currency?: string;\n}\n\nfunction isCalendarDate(value: string): boolean {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return false;\n const date = new Date(`${value}T00:00:00.000Z`);\n return (\n !Number.isNaN(date.getTime()) && date.toISOString().slice(0, 10) === value\n );\n}\n\n/** Plain projection read for sums: never hydrates objects. */\ninterface AmountRow {\n id: string;\n amount: number | string;\n currency: string;\n reviewStatus: ExpenseReviewStatus;\n duplicateOfId: string | null;\n}\n\nconst AMOUNT_FIELDS = [\n 'id',\n 'amount',\n 'currency',\n 'reviewStatus',\n 'duplicateOfId',\n] as const;\n\nfunction toMinorUnits(value: number | string): number {\n const amount = typeof value === 'number' ? value : Number(value);\n if (!Number.isSafeInteger(amount)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Stored expense amount ${String(value)} is not a safe integer.`,\n );\n }\n return amount;\n}\n\nfunction addTo(totals: CurrencyTotals, currency: string, amount: number) {\n const entry = totals[currency] ?? { amount: 0, count: 0 };\n const sum = entry.amount + amount;\n if (!Number.isSafeInteger(sum)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Total for ${currency} exceeds the safe integer range.`,\n );\n }\n totals[currency] = { amount: sum, count: entry.count + 1 };\n}\n\n/**\n * Collection for {@link Expense}. Reads go through the normal tenant\n * interceptors, so inside `withTenant()` every method here sees only that\n * tenant's expenses.\n *\n * Collection classes are registered too, so this one carries its own\n * surface; without it every public method here would become an MCP tool. It\n * publishes only the service-backed write actions (#4001), on REST: each\n * authorizes the signed-in person itself (`expenses.<action>`) and delegates\n * to the guarded domain flow. Reads, MCP and CLI stay closed.\n */\n@smrt({\n api: {\n include: ['record', 'attachReceipt', 'recordReview', 'recordReimbursement'],\n },\n mcp: { include: [] },\n cli: false,\n})\nexport class ExpenseCollection extends SmrtCollection<Expense> { static __smrtPackage__ = \"@happyvertical/smrt-expenses\";\n static readonly _itemClass = Expense;\n\n /** Record immutable original supplier retention/payable evidence on its Expense. */\n async recordSupplierPayable(\n expenseId: string,\n input: RecordSupplierPayableInput,\n ): Promise<SupplierPayablePosition> {\n const expense = await this.requireSupplierPayableExpense(expenseId);\n return expense.recordSupplierPayable(input);\n }\n\n /** Append a dated supplier event; no external money movement is executed. */\n async recordSupplierPayableEvent(\n expenseId: string,\n input: RecordSupplierPayableEventInput,\n ): Promise<SupplierPayablePosition> {\n return (\n await this.requireSupplierPayableExpense(expenseId)\n ).recordSupplierPayableEvent(input);\n }\n\n /** Independently review an originally unknown payable basis exactly once. */\n async completeSupplierPayableBasis(\n expenseId: string,\n input: CompleteSupplierPayableBasisInput,\n ): Promise<SupplierPayablePosition> {\n return (\n await this.requireSupplierPayableExpense(expenseId)\n ).completeSupplierPayableBasis(input);\n }\n\n /** Dated supplier position is independent of incurred cost and reimbursement. */\n async supplierPayablePosition(\n expenseId: string,\n input: { asOfDate?: string } = {},\n ): Promise<SupplierPayablePosition | null> {\n return (\n await this.requireSupplierPayableExpense(expenseId)\n ).getSupplierPayablePosition(input);\n }\n\n private async requireSupplierPayableExpense(\n expenseId: string,\n ): Promise<Expense> {\n const expense = await this.get({ id: expenseId }, { cache: false });\n if (!expense)\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Supplier payable source was not found.',\n );\n return expense;\n }\n\n /** Cash claim after explicit refund receipts and retained historical payments. */\n async reimbursementPosition(\n sourceId: string,\n ): Promise<ExpenseReimbursementPosition> {\n const source = await this.get({ id: sourceId }, { cache: false });\n if (!source)\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Reimbursement source was not found.',\n );\n return source.getReimbursementPosition();\n }\n\n /** All persisted linked refunds reserve source capacity, irrespective of review. */\n async refundPosition(sourceId: string): Promise<ExpenseRefundPosition> {\n const source = await this.get({ id: sourceId }, { cache: false });\n if (!source)\n throw new ExpenseError('EXPENSE_INVALID', 'Refund source was not found.');\n return source.getRefundPosition();\n }\n\n /**\n * Record a new, unreviewed expense for the signed-in person in their\n * tenant. Needs `expenses.record`; a person-paid expense for someone else\n * also needs `expenses.recordReview`.\n */\n @method({\n httpMethod: 'POST',\n path: 'record',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Record a new expense for review (service-backed).',\n })\n async record(options: RecordExpenseActionInput): Promise<Expense> {\n const { recordExpenseAction } = await import(\n '../actions/expense-actions.js'\n );\n return recordExpenseAction(this, options);\n }\n\n /**\n * Attach a stored asset to an expense as its receipt. Needs\n * `expenses.attachReceipt`; only the recorder or payer may attach unless\n * the caller holds `expenses.recordReview`.\n */\n @method({\n httpMethod: 'POST',\n path: 'attachReceipt',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Attach a receipt file to an expense (service-backed).',\n })\n async attachReceipt(\n options: AttachExpenseReceiptActionInput,\n ): Promise<ExpenseReceipt> {\n const { attachExpenseReceiptAction } = await import(\n '../actions/expense-actions.js'\n );\n return attachExpenseReceiptAction(this, options);\n }\n\n /**\n * Accept or refuse (with a reason) an expense, attributed to the signed-in\n * reviewer. Needs an explicit `expenses.recordReview` grant.\n */\n @method({\n httpMethod: 'POST',\n path: 'recordReview',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Approve or reject an expense with a reason (service-backed).',\n })\n async recordReview(options: ReviewExpenseActionInput): Promise<Expense> {\n const { reviewExpenseAction } = await import(\n '../actions/expense-actions.js'\n );\n return reviewExpenseAction(this, options);\n }\n\n /**\n * Record that the person who paid an expense has been paid back. Needs an\n * explicit `expenses.recordReimbursement` grant.\n */\n @method({\n httpMethod: 'POST',\n path: 'recordReimbursement',\n effect: 'write',\n idempotent: false,\n openWorld: false,\n description: 'Record that an expense was reimbursed (service-backed).',\n })\n async recordReimbursement(\n options: MarkExpenseReimbursedActionInput,\n ): Promise<Expense> {\n const { markExpenseReimbursedAction } = await import(\n '../actions/expense-actions.js'\n );\n return markExpenseReimbursedAction(this, options);\n }\n\n /**\n * Expenses charged to one cost object, oldest incurred first.\n *\n * @param costObjectType - Qualified class name of the cost object.\n * @param costObjectId - Id of the cost object.\n */\n async forCostObject(\n costObjectType: string,\n costObjectId: string,\n ): Promise<Expense[]> {\n return this.list({\n where: { costObjectType, costObjectId },\n orderBy: ['incurred_on ASC', 'created_at ASC'],\n });\n }\n\n /**\n * Sum expenses per currency. Amounts in different currencies are never\n * added together: the result is keyed by ISO 4217 code.\n *\n * By default only `reviewed` expenses count; a duplicate never counts.\n *\n * @example\n * ```typescript\n * const totals = await expenses.totalsByCurrency({\n * where: { costObjectType: JOB, costObjectId: job.id },\n * });\n * // { USD: { amount: 125000, count: 3 }, CAD: { amount: 4000, count: 1 } }\n * ```\n */\n async totalsByCurrency(\n options: ExpenseTotalsOptions = {},\n ): Promise<CurrencyTotals> {\n const statuses = options.reviewStatuses ?? ['reviewed'];\n if (statuses.length === 0) return {};\n const rows = (await this.list({\n where: {\n ...(options.where ?? {}),\n reviewStatus: [...statuses],\n duplicateOfId: null,\n },\n select: [...AMOUNT_FIELDS],\n })) as unknown as AmountRow[];\n\n const totals: CurrencyTotals = {};\n const seen = new Set<string>();\n for (const row of rows) {\n if (seen.has(row.id)) continue;\n seen.add(row.id);\n addTo(totals, row.currency, toMinorUnits(row.amount));\n }\n return totals;\n }\n\n /**\n * Stored supplier-tax facts for reporting. Only reviewed non-duplicate\n * expenses are returned; callers must retain a null breakdown as unknown.\n */\n async listReviewedTaxFacts(\n options: ReviewedExpenseTaxFactsOptions,\n ): Promise<ReviewedExpenseTaxFact[]> {\n if (\n !options.tenantId?.trim() ||\n !isCalendarDate(options.from) ||\n !isCalendarDate(options.to) ||\n options.from > options.to ||\n (options.currency !== undefined && !options.currency.trim())\n ) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Tax facts require a tenant, an ordered calendar-date range, and a nonempty currency when supplied.',\n );\n }\n const expenses = await this.list({\n where: {\n tenantId: options.tenantId,\n reviewStatus: 'reviewed',\n duplicateOfId: null,\n 'incurredOn >=': options.from,\n 'incurredOn <=': options.to,\n ...(options.currency ? { currency: options.currency } : {}),\n },\n orderBy: ['incurred_on ASC', 'id ASC'],\n });\n return expenses.map((expense) => {\n if (!expense.id || expense.tenantId !== options.tenantId) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n 'Tenant tax-fact query returned a row without its requested tenant identity.',\n );\n }\n return {\n id: expense.id,\n expenseId: expense.id,\n tenantId: expense.tenantId,\n incurredOn: expense.incurredOn,\n currency: expense.currency,\n commitmentId: expense.commitmentId,\n commitmentLineId: expense.commitmentLineId,\n financialBreakdown: expense.getFinancialBreakdown(),\n };\n });\n }\n\n /**\n * What remains open on a commitment — a commerce `Contract`, normally a\n * `PurchaseOrder` — or on one of its lines.\n *\n * `committed` is the contract's `totalAmount` (or the line's `amount`);\n * `drawn` sums the matched actuals that are `reviewed` and not marked\n * duplicate, in the commitment's currency, each expense once. Unreviewed,\n * rejected and duplicate matches are counted in `excluded` and never\n * drawn. A 4,600 commitment with 1,000 reviewed leaves 3,600 open.\n *\n * @param commitmentId - The commitment's contract id.\n * @param options.lineId - Restrict to one line of the commitment.\n * @throws {ExpenseError} `EXPENSE_COMMITMENT_MISMATCH` when the commitment\n * (or line) is not visible in the current tenant.\n */\n async commitmentPosition(\n commitmentId: string,\n options: { lineId?: string } = {},\n ): Promise<CommitmentPosition> {\n const contracts = await PurchaseContractCollection.create({ db: this.db });\n const commitment = await contracts.get({ id: commitmentId });\n if (!commitment) {\n throw new ExpenseError(\n 'EXPENSE_COMMITMENT_MISMATCH',\n `Commitment ${commitmentId} was not found.`,\n );\n }\n let committed = toMinorUnits(commitment.totalAmount);\n if (options.lineId) {\n const lines = await ContractLineItemCollection.create({ db: this.db });\n const line = await lines.get({ id: options.lineId });\n if (!line || line.contractId !== commitmentId) {\n throw new ExpenseError(\n 'EXPENSE_COMMITMENT_MISMATCH',\n `Line ${options.lineId} is not a line of commitment ${commitmentId}.`,\n );\n }\n committed = toMinorUnits(line.amount);\n }\n const currency = String(commitment.currency).toUpperCase();\n\n const rows = (await this.list({\n where: {\n commitmentId,\n ...(options.lineId ? { commitmentLineId: options.lineId } : {}),\n },\n select: [...AMOUNT_FIELDS],\n })) as unknown as AmountRow[];\n\n const position: CommitmentPosition = {\n commitmentId,\n commitmentLineId: options.lineId ?? null,\n currency,\n committed,\n drawn: 0,\n open: 0,\n overrun: 0,\n countedExpenseIds: [],\n excluded: { unreviewed: 0, rejected: 0, duplicate: 0 },\n otherCurrencies: {},\n };\n const seen = new Set<string>();\n for (const row of rows) {\n if (seen.has(row.id)) continue;\n seen.add(row.id);\n if (row.duplicateOfId) {\n position.excluded.duplicate += 1;\n } else if (row.reviewStatus === 'unreviewed') {\n position.excluded.unreviewed += 1;\n } else if (row.reviewStatus === 'rejected') {\n position.excluded.rejected += 1;\n } else if (row.currency !== currency) {\n addTo(position.otherCurrencies, row.currency, toMinorUnits(row.amount));\n } else {\n const drawn = position.drawn + toMinorUnits(row.amount);\n if (!Number.isSafeInteger(drawn)) {\n throw new ExpenseError(\n 'EXPENSE_INVALID',\n `Drawdown on commitment ${commitmentId} exceeds the safe range.`,\n );\n }\n position.drawn = drawn;\n position.countedExpenseIds.push(row.id);\n }\n }\n position.countedExpenseIds.sort();\n position.open = Math.max(committed - position.drawn, 0);\n position.overrun = Math.max(position.drawn - committed, 0);\n return position;\n }\n}\n","/**\n * Declared recipes for smrt-expenses (#3590, #3604): user-facing units of\n * functionality an app or agent can pick instead of the whole package.\n * The scanner reads these statics into the `recipes` array of `manifest.json`\n * and `smrt-knowledge.json`; nothing here runs at that point.\n *\n * @packageDocumentation\n */\n\nimport { SmrtRecipe } from '@happyvertical/smrt-core';\nimport { Expense } from './models/Expense.js';\nimport { ExpenseReceipt } from './models/ExpenseReceipt.js';\n\n/** Expenses: Record what the business spends, with receipts, and review it. */\nexport class ExpensesRecipe extends SmrtRecipe {\n static id = 'expenses.tracking';\n static help = './tracking.recipe.md';\n static label = 'Expenses';\n static summary =\n 'Record what the business spends, with receipts, and review it.';\n static synonyms = ['costs', 'receipts', 'spending', 'reimbursements'];\n static section = {\n id: 'accounting',\n label: 'Accounting',\n icon: 'bank',\n description: 'Your books: accounts, journals and balances.',\n };\n static models = [Expense, ExpenseReceipt];\n static nav = [\n {\n label: 'Expenses',\n model: Expense,\n icon: 'receipt',\n description: 'Costs you have paid, with the receipt and who paid.',\n },\n ];\n static options = {\n Expense: {\n fields: {\n description: { order: 1, required: true },\n amount: { order: 2 },\n currency: { order: 3 },\n incurredOn: {\n label: 'Date',\n order: 4,\n help: 'The date on the receipt, as YYYY-MM-DD.',\n },\n category: {\n order: 5,\n help: 'One word, such as material, travel, freight or other.',\n },\n vendorId: { label: 'Vendor', order: 6 },\n paidBy: { order: 7 },\n paidByProfileId: {\n label: 'Person who paid',\n order: 8,\n help: 'Who paid out of their own pocket, when a person paid.',\n },\n paidByName: { order: 9 },\n reimbursable: { order: 10 },\n costObjectId: {\n label: 'Charged to',\n order: 11,\n help: 'The job, project or client the cost belongs to.',\n },\n costObjectType: { visibility: 'hidden' },\n financialBreakdown: { visibility: 'hidden' },\n supplierPayableJson: { visibility: 'hidden' },\n refundRecipient: { visibility: 'hidden' },\n reimbursedAmount: {\n help: 'The recorded amount paid back to the person who paid.',\n },\n refundOfId: { visibility: 'hidden' },\n recordedByProfileId: { visibility: 'hidden' },\n commitmentId: { visibility: 'hidden' },\n commitmentLineId: { visibility: 'hidden' },\n reviewedByProfileId: { visibility: 'hidden' },\n duplicateOfId: { visibility: 'hidden' },\n },\n },\n ExpenseReceipt: {\n fields: {\n contentSha256: { visibility: 'hidden' },\n byteCount: { visibility: 'hidden' },\n uploadedByProfileId: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n"],"mappings":";;;;;;;AAOA,eAAe,wBAAwB,KAAK,MAAM,kynCAA0twC,CAAC;;;;;;;;;;;;;;;;;;;ACmD7wwC,SAAS,eAAe,OAAwB;CAC9C,IAAI,CAAC,sBAAsB,KAAK,KAAK,GAAG,OAAO;CAC/C,MAAM,uBAAO,IAAI,KAAK,GAAG,MAAK,eAAgB;CAC9C,OACE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,KAAK,KAAK,YAAY,CAAA,CAAE,MAAM,GAAG,EAAE,MAAM;AAEzE;AAWA,IAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,aAAa,OAAgC;CACpD,MAAM,SAAS,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;CAC/D,IAAI,CAAC,OAAO,cAAc,MAAM,GAC9B,MAAM,IAAI,aACR,mBACA,yBAAyB,OAAO,KAAK,EAAC,wBACxC;CAEF,OAAO;AACT;AAEA,SAAS,MAAM,QAAwB,UAAkB,QAAgB;CACvE,MAAM,QAAQ,OAAO,aAAa;EAAE,QA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