@happyvertical/smrt-expenses 0.60.15 → 0.60.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { registerPermissionDefinitions } from "@happyvertical/smrt-users";
|
|
|
8
8
|
import { createHash, randomBytes } from "node:crypto";
|
|
9
9
|
import { ContractLineItemCollection, InvoiceCollection, InvoiceLineItemCollection, PurchaseContractCollection, bindInvoiceLineSource, registerInvoiceSourceBinding, unbindInvoiceLineSource } from "@happyvertical/smrt-commerce";
|
|
10
10
|
//#region src/__smrt-register__.ts
|
|
11
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-expenses","packageVersion":"0.60.15","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},"reviewAllocation":{"name":"reviewAllocation","async":true,"parameters":[{"name":"input","type":"ReviewExpenseAllocationInput","optional":false},{"name":"authority","type":"ExpenseAllocationAuthority","optional":false}],"returnType":"Promise<ExpenseAllocationResult>","isStatic":false,"isPublic":true},"withdrawAllocation":{"name":"withdrawAllocation","async":true,"parameters":[{"name":"input","type":"WithdrawExpenseAllocationInput","optional":false},{"name":"authority","type":"ExpenseAllocationAuthority","optional":false}],"returnType":"Promise<WithdrawExpenseAllocationResult>","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","collectionOf":"@happyvertical/smrt-expenses:Expense","schema":{"tableName":"expenses","ddl":"CREATE TABLE IF NOT EXISTS \\"expenses\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"active_allocation_revision_id\\" UUID\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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},"active_allocation_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}}},"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"]},{"name":"expenses_active_allocation_revision_id_idx","columns":["active_allocation_revision_id"]}],"version":"f8413307"},"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","collectionOf":"@happyvertical/smrt-expenses:ExpenseReceipt","schema":{"tableName":"expense_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_receipts\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"8ed688ee"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Revisions":{"name":"revisions","className":"Revisions","qualifiedName":"@happyvertical/smrt-expenses:Revisions","collection":"expenseallocationrevisions","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_revisions"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationRevision","exportName":"Revisions","collectionExportName":"RevisionsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationRevision","schema":{"tableName":"expense_allocation_revisions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_revisions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"kind\\" TEXT DEFAULT 'allocation',\\n \\"source_cost_object_type\\" TEXT,\\n \\"source_cost_object_id\\" TEXT,\\n \\"incurred_on\\" TEXT,\\n \\"paid_by\\" TEXT DEFAULT 'company',\\n \\"reimbursable\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"has_supplier_tax\\" BOOLEAN,\\n \\"basis_equals_gross\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"previous_revision_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"source_fingerprint\\" TEXT,\\n \\"source_fingerprint_nonce\\" TEXT,\\n \\"source_revision\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT,\\n \\"reviewed_by_profile_id\\" UUID NOT NULL,\\n \\"reviewed_by_user_id\\" UUID NOT NULL,\\n \\"review_evidence\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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"},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"allocation"},"source_cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"source_cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"incurred_on":{"type":"TEXT","notNull":false,"unique":false},"paid_by":{"type":"TEXT","notNull":false,"unique":false,"default":"company"},"reimbursable":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"has_supplier_tax":{"type":"BOOLEAN","notNull":false,"unique":false},"basis_equals_gross":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"previous_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint_nonce":{"type":"TEXT","notNull":false,"unique":false},"source_revision":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false},"reviewed_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reviewed_by_user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"review_evidence":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_revisions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_request_key","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previous_revision_id"],"unique":true},{"name":"expense_allocation_revisions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_revisions_reviewed_by_profile_id_idx","columns":["reviewed_by_profile_id"]},{"name":"expense_allocation_revisions_reviewed_by_user_id_idx","columns":["reviewed_by_user_id"]}],"version":"83425a51"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Portions":{"name":"portions","className":"Portions","qualifiedName":"@happyvertical/smrt-expenses:Portions","collection":"expenseallocationportions","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_portions"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationPortion","exportName":"Portions","collectionExportName":"PortionsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationPortion","schema":{"tableName":"expense_allocation_portions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_portions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"revision_id\\" UUID NOT NULL,\\n \\"portion_key\\" TEXT,\\n \\"cost_object_type\\" TEXT,\\n \\"cost_object_id\\" TEXT,\\n \\"cost_code_ref\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_key":{"type":"TEXT","notNull":false,"unique":false},"cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"cost_code_ref":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_portions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_portion_key","columns":["revision_id","portion_key"],"unique":true},{"name":"expense_allocation_portions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_portions_source_expense_id_idx","columns":["source_expense_id"]}],"version":"6b0600b1"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Billings":{"name":"billings","className":"Billings","qualifiedName":"@happyvertical/smrt-expenses:Billings","collection":"expenseallocationbillings","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_billings"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationBilling","exportName":"Billings","collectionExportName":"BillingsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationBilling","schema":{"tableName":"expense_allocation_billings","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_billings\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"portion_id\\" UUID NOT NULL,\\n \\"invoice_id\\" UUID,\\n \\"draft_type\\" TEXT,\\n \\"draft_id\\" TEXT,\\n \\"invoice_line_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"related_reservation_id\\" UUID,\\n \\"kind\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_portions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"draft_type":{"type":"TEXT","notNull":false,"unique":false},"draft_id":{"type":"TEXT","notNull":false,"unique":false},"invoice_line_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"related_reservation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_billings","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"kind":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_billings_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_billing_request","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_billing_release","columns":["related_reservation_id","kind"],"unique":true},{"name":"expense_allocation_billings_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_billings_portion_id_idx","columns":["portion_id"]},{"name":"expense_allocation_billings_invoice_id_idx","columns":["invoice_id"]},{"name":"expense_allocation_billings_invoice_line_id_idx","columns":["invoice_line_id"]}],"version":"432aeb1f"},"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},"activeAllocationRevisionId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationRevision","_meta":{"readonly":true,"nullable":true,"onDelete":"RESTRICT"},"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":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"active_allocation_revision_id\\" UUID\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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},"active_allocation_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}}},"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"]},{"name":"expenses_active_allocation_revision_id_idx","columns":["active_allocation_revision_id"]}],"version":"f8413307"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationRevision":{"name":"expenseallocationrevision","className":"ExpenseAllocationRevision","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationRevision","collection":"expenseallocationrevisions","description":"Persisted command-owned ExpenseAllocationRevision evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"kind":{"type":"text","required":false,"default":"allocation","enum":["allocation","withdrawal"]},"sourceCostObjectType":{"type":"text","required":false},"sourceCostObjectId":{"type":"text","required":false},"incurredOn":{"type":"text","required":false},"paidBy":{"type":"text","required":false,"default":"company","enum":["company","person","third-party"]},"reimbursable":{"type":"boolean","required":true,"default":false},"hasSupplierTax":{"type":"boolean","required":false,"_meta":{"nullable":true}},"basisEqualsGross":{"type":"boolean","required":true,"default":false},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"previousRevisionId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationRevision","_meta":{"nullable":true,"onDelete":"RESTRICT"}},"requestId":{"type":"text","required":false},"requestFingerprint":{"type":"text","required":false},"sourceFingerprint":{"type":"text","required":false},"sourceFingerprintNonce":{"type":"text","required":false},"sourceRevision":{"type":"text","required":false},"amountMinor":{"type":"integer","required":false,"_meta":{}},"currency":{"type":"text","required":false},"reviewedByProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"reviewedByUserId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:User"},"reviewEvidence":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_revisions","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_request_key","columns":["sourceExpenseId","requestId"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previousRevisionId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationRevision","collectionExportName":"ExpenseAllocationRevisionCollection","validationRules":[{"field":"reimbursable","rule":"required","fieldType":"boolean"},{"field":"basisEqualsGross","rule":"required","fieldType":"boolean"},{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"reviewedByProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"reviewedByUserId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"expense_allocation_revisions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_revisions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"kind\\" TEXT DEFAULT 'allocation',\\n \\"source_cost_object_type\\" TEXT,\\n \\"source_cost_object_id\\" TEXT,\\n \\"incurred_on\\" TEXT,\\n \\"paid_by\\" TEXT DEFAULT 'company',\\n \\"reimbursable\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"has_supplier_tax\\" BOOLEAN,\\n \\"basis_equals_gross\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"previous_revision_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"source_fingerprint\\" TEXT,\\n \\"source_fingerprint_nonce\\" TEXT,\\n \\"source_revision\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT,\\n \\"reviewed_by_profile_id\\" UUID NOT NULL,\\n \\"reviewed_by_user_id\\" UUID NOT NULL,\\n \\"review_evidence\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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"},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"allocation"},"source_cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"source_cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"incurred_on":{"type":"TEXT","notNull":false,"unique":false},"paid_by":{"type":"TEXT","notNull":false,"unique":false,"default":"company"},"reimbursable":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"has_supplier_tax":{"type":"BOOLEAN","notNull":false,"unique":false},"basis_equals_gross":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"previous_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint_nonce":{"type":"TEXT","notNull":false,"unique":false},"source_revision":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false},"reviewed_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reviewed_by_user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"review_evidence":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_revisions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_request_key","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previous_revision_id"],"unique":true},{"name":"expense_allocation_revisions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_revisions_reviewed_by_profile_id_idx","columns":["reviewed_by_profile_id"]},{"name":"expense_allocation_revisions_reviewed_by_user_id_idx","columns":["reviewed_by_user_id"]}],"version":"83425a51"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationPortion":{"name":"expenseallocationportion","className":"ExpenseAllocationPortion","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationPortion","collection":"expenseallocationportions","description":"Persisted command-owned ExpenseAllocationPortion evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"revisionId":{"type":"foreignKey","required":true,"related":"ExpenseAllocationRevision","_meta":{"required":true,"onDelete":"RESTRICT"}},"portionKey":{"type":"text","required":false},"costObjectType":{"type":"text","required":false},"costObjectId":{"type":"text","required":false},"costCodeRef":{"type":"text","required":false},"amountMinor":{"type":"integer","required":false,"_meta":{}},"currency":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_portions","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_portion_key","columns":["revisionId","portionKey"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationPortion","collectionExportName":"ExpenseAllocationPortionCollection","validationRules":[{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"revisionId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"expense_allocation_portions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_portions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"revision_id\\" UUID NOT NULL,\\n \\"portion_key\\" TEXT,\\n \\"cost_object_type\\" TEXT,\\n \\"cost_object_id\\" TEXT,\\n \\"cost_code_ref\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_key":{"type":"TEXT","notNull":false,"unique":false},"cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"cost_code_ref":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_portions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_portion_key","columns":["revision_id","portion_key"],"unique":true},{"name":"expense_allocation_portions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_portions_source_expense_id_idx","columns":["source_expense_id"]}],"version":"6b0600b1"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationBilling":{"name":"expenseallocationbilling","className":"ExpenseAllocationBilling","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationBilling","collection":"expenseallocationbillings","description":"Persisted command-owned ExpenseAllocationBilling evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"portionId":{"type":"foreignKey","required":true,"related":"ExpenseAllocationPortion","_meta":{"required":true,"onDelete":"RESTRICT"}},"invoiceId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:Invoice","_meta":{"nullable":true}},"draftType":{"type":"text","required":false},"draftId":{"type":"text","required":false},"invoiceLineId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:InvoiceLineItem","_meta":{"nullable":true}},"requestId":{"type":"text","required":false},"requestFingerprint":{"type":"text","required":false},"relatedReservationId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationBilling","_meta":{"nullable":true,"onDelete":"RESTRICT"}},"kind":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_billings","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_billing_request","columns":["sourceExpenseId","requestId"],"unique":true},{"name":"expense_allocation_billing_release","columns":["relatedReservationId","kind"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationBilling","collectionExportName":"ExpenseAllocationBillingCollection","validationRules":[{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"portionId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"expense_allocation_billings","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_billings\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"portion_id\\" UUID NOT NULL,\\n \\"invoice_id\\" UUID,\\n \\"draft_type\\" TEXT,\\n \\"draft_id\\" TEXT,\\n \\"invoice_line_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"related_reservation_id\\" UUID,\\n \\"kind\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_portions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"draft_type":{"type":"TEXT","notNull":false,"unique":false},"draft_id":{"type":"TEXT","notNull":false,"unique":false},"invoice_line_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"related_reservation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_billings","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"kind":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_billings_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_billing_request","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_billing_release","columns":["related_reservation_id","kind"],"unique":true},{"name":"expense_allocation_billings_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_billings_portion_id_idx","columns":["portion_id"]},{"name":"expense_allocation_billings_invoice_id_idx","columns":["invoice_id"]},{"name":"expense_allocation_billings_invoice_line_id_idx","columns":["invoice_line_id"]}],"version":"432aeb1f"},"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":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","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}},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"8ed688ee"},"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"},"activeAllocationRevisionId":{"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}`));
|
|
11
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-expenses","packageVersion":"0.60.16","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},"reviewAllocation":{"name":"reviewAllocation","async":true,"parameters":[{"name":"input","type":"ReviewExpenseAllocationInput","optional":false},{"name":"authority","type":"ExpenseAllocationAuthority","optional":false}],"returnType":"Promise<ExpenseAllocationResult>","isStatic":false,"isPublic":true},"withdrawAllocation":{"name":"withdrawAllocation","async":true,"parameters":[{"name":"input","type":"WithdrawExpenseAllocationInput","optional":false},{"name":"authority","type":"ExpenseAllocationAuthority","optional":false}],"returnType":"Promise<WithdrawExpenseAllocationResult>","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","collectionOf":"@happyvertical/smrt-expenses:Expense","schema":{"tableName":"expenses","ddl":"CREATE TABLE IF NOT EXISTS \\"expenses\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"active_allocation_revision_id\\" UUID\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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},"active_allocation_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}}},"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"]},{"name":"expenses_active_allocation_revision_id_idx","columns":["active_allocation_revision_id"]}],"version":"f8413307"},"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","collectionOf":"@happyvertical/smrt-expenses:ExpenseReceipt","schema":{"tableName":"expense_receipts","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_receipts\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"8ed688ee"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Revisions":{"name":"revisions","className":"Revisions","qualifiedName":"@happyvertical/smrt-expenses:Revisions","collection":"expenseallocationrevisions","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_revisions"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationRevision","exportName":"Revisions","collectionExportName":"RevisionsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationRevision","schema":{"tableName":"expense_allocation_revisions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_revisions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"kind\\" TEXT DEFAULT 'allocation',\\n \\"source_cost_object_type\\" TEXT,\\n \\"source_cost_object_id\\" TEXT,\\n \\"incurred_on\\" TEXT,\\n \\"paid_by\\" TEXT DEFAULT 'company',\\n \\"reimbursable\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"has_supplier_tax\\" BOOLEAN,\\n \\"basis_equals_gross\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"previous_revision_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"source_fingerprint\\" TEXT,\\n \\"source_fingerprint_nonce\\" TEXT,\\n \\"source_revision\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT,\\n \\"reviewed_by_profile_id\\" UUID NOT NULL,\\n \\"reviewed_by_user_id\\" UUID NOT NULL,\\n \\"review_evidence\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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"},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"allocation"},"source_cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"source_cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"incurred_on":{"type":"TEXT","notNull":false,"unique":false},"paid_by":{"type":"TEXT","notNull":false,"unique":false,"default":"company"},"reimbursable":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"has_supplier_tax":{"type":"BOOLEAN","notNull":false,"unique":false},"basis_equals_gross":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"previous_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint_nonce":{"type":"TEXT","notNull":false,"unique":false},"source_revision":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false},"reviewed_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reviewed_by_user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"review_evidence":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_revisions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_request_key","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previous_revision_id"],"unique":true},{"name":"expense_allocation_revisions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_revisions_reviewed_by_profile_id_idx","columns":["reviewed_by_profile_id"]},{"name":"expense_allocation_revisions_reviewed_by_user_id_idx","columns":["reviewed_by_user_id"]}],"version":"83425a51"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Portions":{"name":"portions","className":"Portions","qualifiedName":"@happyvertical/smrt-expenses:Portions","collection":"expenseallocationportions","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_portions"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationPortion","exportName":"Portions","collectionExportName":"PortionsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationPortion","schema":{"tableName":"expense_allocation_portions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_portions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"revision_id\\" UUID NOT NULL,\\n \\"portion_key\\" TEXT,\\n \\"cost_object_type\\" TEXT,\\n \\"cost_object_id\\" TEXT,\\n \\"cost_code_ref\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_key":{"type":"TEXT","notNull":false,"unique":false},"cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"cost_code_ref":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_portions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_portion_key","columns":["revision_id","portion_key"],"unique":true},{"name":"expense_allocation_portions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_portions_source_expense_id_idx","columns":["source_expense_id"]}],"version":"6b0600b1"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:Billings":{"name":"billings","className":"Billings","qualifiedName":"@happyvertical/smrt-expenses:Billings","collection":"expenseallocationbillings","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/expense-allocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{},"methods":{},"decoratorConfig":{"api":{"include":[]},"mcp":{"include":[]},"cli":false,"tableName":"expense_allocation_billings"},"extends":"SmrtCollection","extendsTypeArg":"ExpenseAllocationBilling","exportName":"Billings","collectionExportName":"BillingsCollection","collectionOf":"@happyvertical/smrt-expenses:ExpenseAllocationBilling","schema":{"tableName":"expense_allocation_billings","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_billings\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"portion_id\\" UUID NOT NULL,\\n \\"invoice_id\\" UUID,\\n \\"draft_type\\" TEXT,\\n \\"draft_id\\" TEXT,\\n \\"invoice_line_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"related_reservation_id\\" UUID,\\n \\"kind\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_portions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"draft_type":{"type":"TEXT","notNull":false,"unique":false},"draft_id":{"type":"TEXT","notNull":false,"unique":false},"invoice_line_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"related_reservation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_billings","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"kind":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_billings_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_billing_request","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_billing_release","columns":["related_reservation_id","kind"],"unique":true},{"name":"expense_allocation_billings_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_billings_portion_id_idx","columns":["portion_id"]},{"name":"expense_allocation_billings_invoice_id_idx","columns":["invoice_id"]},{"name":"expense_allocation_billings_invoice_line_id_idx","columns":["invoice_line_id"]}],"version":"432aeb1f"},"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},"activeAllocationRevisionId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationRevision","_meta":{"readonly":true,"nullable":true,"onDelete":"RESTRICT"},"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":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"active_allocation_revision_id\\" UUID\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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},"active_allocation_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}}},"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"]},{"name":"expenses_active_allocation_revision_id_idx","columns":["active_allocation_revision_id"]}],"version":"f8413307"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationRevision":{"name":"expenseallocationrevision","className":"ExpenseAllocationRevision","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationRevision","collection":"expenseallocationrevisions","description":"Persisted command-owned ExpenseAllocationRevision evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"kind":{"type":"text","required":false,"default":"allocation","enum":["allocation","withdrawal"]},"sourceCostObjectType":{"type":"text","required":false},"sourceCostObjectId":{"type":"text","required":false},"incurredOn":{"type":"text","required":false},"paidBy":{"type":"text","required":false,"default":"company","enum":["company","person","third-party"]},"reimbursable":{"type":"boolean","required":true,"default":false},"hasSupplierTax":{"type":"boolean","required":false,"_meta":{"nullable":true}},"basisEqualsGross":{"type":"boolean","required":true,"default":false},"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"previousRevisionId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationRevision","_meta":{"nullable":true,"onDelete":"RESTRICT"}},"requestId":{"type":"text","required":false},"requestFingerprint":{"type":"text","required":false},"sourceFingerprint":{"type":"text","required":false},"sourceFingerprintNonce":{"type":"text","required":false},"sourceRevision":{"type":"text","required":false},"amountMinor":{"type":"integer","required":false,"_meta":{}},"currency":{"type":"text","required":false},"reviewedByProfileId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-profiles:Profile"},"reviewedByUserId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:User"},"reviewEvidence":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_revisions","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_request_key","columns":["sourceExpenseId","requestId"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previousRevisionId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationRevision","collectionExportName":"ExpenseAllocationRevisionCollection","validationRules":[{"field":"reimbursable","rule":"required","fieldType":"boolean"},{"field":"basisEqualsGross","rule":"required","fieldType":"boolean"},{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"reviewedByProfileId","rule":"required","fieldType":"crossPackageRef"},{"field":"reviewedByUserId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"expense_allocation_revisions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_revisions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 \\"kind\\" TEXT DEFAULT 'allocation',\\n \\"source_cost_object_type\\" TEXT,\\n \\"source_cost_object_id\\" TEXT,\\n \\"incurred_on\\" TEXT,\\n \\"paid_by\\" TEXT DEFAULT 'company',\\n \\"reimbursable\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"has_supplier_tax\\" BOOLEAN,\\n \\"basis_equals_gross\\" BOOLEAN NOT NULL DEFAULT FALSE,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"previous_revision_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"source_fingerprint\\" TEXT,\\n \\"source_fingerprint_nonce\\" TEXT,\\n \\"source_revision\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT,\\n \\"reviewed_by_profile_id\\" UUID NOT NULL,\\n \\"reviewed_by_user_id\\" UUID NOT NULL,\\n \\"review_evidence\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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"},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"allocation"},"source_cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"source_cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"incurred_on":{"type":"TEXT","notNull":false,"unique":false},"paid_by":{"type":"TEXT","notNull":false,"unique":false,"default":"company"},"reimbursable":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"has_supplier_tax":{"type":"BOOLEAN","notNull":false,"unique":false},"basis_equals_gross":{"type":"BOOLEAN","notNull":true,"unique":false,"default":false},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"previous_revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"source_fingerprint_nonce":{"type":"TEXT","notNull":false,"unique":false},"source_revision":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false},"reviewed_by_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reviewed_by_user_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"review_evidence":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_revisions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_request_key","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_revision_successor","columns":["previous_revision_id"],"unique":true},{"name":"expense_allocation_revisions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_revisions_reviewed_by_profile_id_idx","columns":["reviewed_by_profile_id"]},{"name":"expense_allocation_revisions_reviewed_by_user_id_idx","columns":["reviewed_by_user_id"]}],"version":"83425a51"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationPortion":{"name":"expenseallocationportion","className":"ExpenseAllocationPortion","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationPortion","collection":"expenseallocationportions","description":"Persisted command-owned ExpenseAllocationPortion evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"revisionId":{"type":"foreignKey","required":true,"related":"ExpenseAllocationRevision","_meta":{"required":true,"onDelete":"RESTRICT"}},"portionKey":{"type":"text","required":false},"costObjectType":{"type":"text","required":false},"costObjectId":{"type":"text","required":false},"costCodeRef":{"type":"text","required":false},"amountMinor":{"type":"integer","required":false,"_meta":{}},"currency":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_portions","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_portion_key","columns":["revisionId","portionKey"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationPortion","collectionExportName":"ExpenseAllocationPortionCollection","validationRules":[{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"revisionId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"expense_allocation_portions","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_portions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"revision_id\\" UUID NOT NULL,\\n \\"portion_key\\" TEXT,\\n \\"cost_object_type\\" TEXT,\\n \\"cost_object_id\\" TEXT,\\n \\"cost_code_ref\\" TEXT,\\n \\"amount_minor\\" INTEGER,\\n \\"currency\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"revision_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_revisions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_key":{"type":"TEXT","notNull":false,"unique":false},"cost_object_type":{"type":"TEXT","notNull":false,"unique":false},"cost_object_id":{"type":"TEXT","notNull":false,"unique":false},"cost_code_ref":{"type":"TEXT","notNull":false,"unique":false},"amount_minor":{"type":"INTEGER","notNull":false,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_portions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_portion_key","columns":["revision_id","portion_key"],"unique":true},{"name":"expense_allocation_portions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_portions_source_expense_id_idx","columns":["source_expense_id"]}],"version":"6b0600b1"},"importPath":"@happyvertical/smrt-expenses"},"@happyvertical/smrt-expenses:ExpenseAllocationBilling":{"name":"expenseallocationbilling","className":"ExpenseAllocationBilling","qualifiedName":"@happyvertical/smrt-expenses:ExpenseAllocationBilling","collection":"expenseallocationbillings","description":"Persisted command-owned ExpenseAllocationBilling evidence.","filePath":"/home/runner/work/smrt/smrt/packages/expenses/src/models/ExpenseAllocation.ts","packageName":"@happyvertical/smrt-expenses","fields":{"tenantId":{"type":"text","required":true,"_meta":{"sqlType":"UUID","__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false}}},"sourceExpenseId":{"type":"foreignKey","required":true,"related":"Expense","_meta":{"required":true,"onDelete":"RESTRICT"}},"portionId":{"type":"foreignKey","required":true,"related":"ExpenseAllocationPortion","_meta":{"required":true,"onDelete":"RESTRICT"}},"invoiceId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:Invoice","_meta":{"nullable":true}},"draftType":{"type":"text","required":false},"draftId":{"type":"text","required":false},"invoiceLineId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-commerce:InvoiceLineItem","_meta":{"nullable":true}},"requestId":{"type":"text","required":false},"requestFingerprint":{"type":"text","required":false},"relatedReservationId":{"type":"foreignKey","required":false,"related":"ExpenseAllocationBilling","_meta":{"nullable":true,"onDelete":"RESTRICT"}},"kind":{"type":"text","required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"expense_allocation_billings","api":{"include":[]},"mcp":{"include":[]},"cli":false,"indexes":[{"name":"expense_allocation_billing_request","columns":["sourceExpenseId","requestId"],"unique":true},{"name":"expense_allocation_billing_release","columns":["relatedReservationId","kind"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"ExpenseAllocationBilling","collectionExportName":"ExpenseAllocationBillingCollection","validationRules":[{"field":"sourceExpenseId","rule":"required","fieldType":"foreignKey"},{"field":"portionId","rule":"required","fieldType":"foreignKey"}],"schema":{"tableName":"expense_allocation_billings","ddl":"CREATE TABLE IF NOT EXISTS \\"expense_allocation_billings\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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 NOT NULL,\\n \\"source_expense_id\\" UUID NOT NULL,\\n \\"portion_id\\" UUID NOT NULL,\\n \\"invoice_id\\" UUID,\\n \\"draft_type\\" TEXT,\\n \\"draft_id\\" TEXT,\\n \\"invoice_line_id\\" UUID,\\n \\"request_id\\" TEXT,\\n \\"request_fingerprint\\" TEXT,\\n \\"related_reservation_id\\" UUID,\\n \\"kind\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":true,"unique":false},"source_expense_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expenses","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"portion_id":{"type":"UUID","referenceKind":"foreignKey","notNull":true,"unique":false,"foreignKey":{"table":"expense_allocation_portions","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"draft_type":{"type":"TEXT","notNull":false,"unique":false},"draft_id":{"type":"TEXT","notNull":false,"unique":false},"invoice_line_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"request_id":{"type":"TEXT","notNull":false,"unique":false},"request_fingerprint":{"type":"TEXT","notNull":false,"unique":false},"related_reservation_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"expense_allocation_billings","column":"id","onDelete":"RESTRICT","onUpdate":"CASCADE"}},"kind":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"expense_allocation_billings_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"expense_allocation_billing_request","columns":["source_expense_id","request_id"],"unique":true},{"name":"expense_allocation_billing_release","columns":["related_reservation_id","kind"],"unique":true},{"name":"expense_allocation_billings_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"expense_allocation_billings_portion_id_idx","columns":["portion_id"]},{"name":"expense_allocation_billings_invoice_id_idx","columns":["invoice_id"]},{"name":"expense_allocation_billings_invoice_line_id_idx","columns":["invoice_line_id"]}],"version":"432aeb1f"},"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":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","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}},"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 \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\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":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"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":"8ed688ee"},"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"},"activeAllocationRevisionId":{"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}`));
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/permissions.ts
|
|
14
14
|
var EXPENSE_ALLOCATION_PERMISSION_DEFINITIONS = [{
|