@happyvertical/smrt-commerce 0.55.7 → 0.55.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/AGENTS.md +4 -0
  2. package/README.md +34 -0
  3. package/agents/customer-vendor-ui.md +31 -0
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +642 -240
  7. package/dist/index.js.map +1 -1
  8. package/dist/manifest.json +1449 -109
  9. package/dist/models/Contract.d.ts.map +1 -1
  10. package/dist/models/ContractLineItem.d.ts.map +1 -1
  11. package/dist/models/Customer.d.ts.map +1 -1
  12. package/dist/models/Fulfillment.d.ts.map +1 -1
  13. package/dist/models/FulfillmentLineItem.d.ts.map +1 -1
  14. package/dist/models/Invoice.d.ts.map +1 -1
  15. package/dist/models/InvoiceLineItem.d.ts.map +1 -1
  16. package/dist/models/Payment.d.ts.map +1 -1
  17. package/dist/models/PaymentAllocation.d.ts.map +1 -1
  18. package/dist/models/Vendor.d.ts.map +1 -1
  19. package/dist/playground.js +19 -0
  20. package/dist/playground.js.map +1 -1
  21. package/dist/recipes.d.ts +733 -19
  22. package/dist/recipes.d.ts.map +1 -1
  23. package/dist/smrt-knowledge.json +1147 -123
  24. package/dist/svelte/components/CustomerSelect.svelte +53 -0
  25. package/dist/svelte/components/CustomerSelect.svelte.d.ts +47 -0
  26. package/dist/svelte/components/CustomerSelect.svelte.d.ts.map +1 -0
  27. package/dist/svelte/components/PartySelect.svelte +138 -0
  28. package/dist/svelte/components/PartySelect.svelte.d.ts +70 -0
  29. package/dist/svelte/components/PartySelect.svelte.d.ts.map +1 -0
  30. package/dist/svelte/components/VendorSelect.svelte +53 -0
  31. package/dist/svelte/components/VendorSelect.svelte.d.ts +47 -0
  32. package/dist/svelte/components/VendorSelect.svelte.d.ts.map +1 -0
  33. package/dist/svelte/i18n.d.ts +8 -0
  34. package/dist/svelte/i18n.d.ts.map +1 -1
  35. package/dist/svelte/i18n.js +8 -0
  36. package/dist/svelte/index.d.ts +6 -0
  37. package/dist/svelte/index.d.ts.map +1 -1
  38. package/dist/svelte/index.js +6 -0
  39. package/dist/svelte/playground/PartySelectPreview.svelte +108 -0
  40. package/dist/svelte/playground/PartySelectPreview.svelte.d.ts +8 -0
  41. package/dist/svelte/playground/PartySelectPreview.svelte.d.ts.map +1 -0
  42. package/dist/svelte/playground.d.ts.map +1 -1
  43. package/dist/svelte/playground.js +19 -0
  44. package/dist/ui.d.ts.map +1 -1
  45. package/dist/ui.js +20 -0
  46. package/dist/ui.js.map +1 -1
  47. package/package.json +16 -12
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ var __exportAll = (all, no_symbols) => {
24
24
  };
25
25
  //#endregion
26
26
  //#region src/__smrt-register__.ts
27
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-commerce","packageVersion":"0.55.7","objects":{"@happyvertical/smrt-commerce:ContractCollection":{"name":"contractcollection","className":"ContractCollection","qualifiedName":"@happyvertical/smrt-commerce:ContractCollection","collection":"contracts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/ContractCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByVendor":{"name":"findByVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"contractType","type":"ContractType","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"ContractStatus","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findAccepted":{"name":"findAccepted","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findOverdue":{"name":"findOverdue","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findExpired":{"name":"findExpired","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Contract","exportName":"ContractCollection","collectionExportName":"ContractCollectionCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"9c2e9c49"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ContractLineItemCollection":{"name":"contractlineitemcollection","className":"ContractLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:ContractLineItemCollection","collection":"contractlineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/ContractLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"ContractLineItem","exportName":"ContractLineItemCollection","collectionExportName":"ContractLineItemCollectionCollection","schema":{"tableName":"contract_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"contract_line_items\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"product_id\\" UUID,\\n \\"sku\\" TEXT DEFAULT '',\\n \\"start_date\\" TIMESTAMP,\\n \\"end_date\\" TIMESTAMP,\\n \\"billing_period\\" TEXT DEFAULT '',\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"default":""},"quantity":{"type":"REAL","notNull":false,"default":1},"unit_price":{"type":"INTEGER","notNull":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"default":0},"product_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"sku":{"type":"TEXT","notNull":false,"default":""},"start_date":{"type":"TIMESTAMP","notNull":false},"end_date":{"type":"TIMESTAMP","notNull":false},"billing_period":{"type":"TEXT","notNull":false,"default":""},"sort_order":{"type":"INTEGER","notNull":false,"default":0}},"indexes":[{"name":"contract_line_items_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contract_line_items_meta_type_idx","columns":["_meta_type"]},{"name":"contract_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contract_line_items_contract_id_idx","columns":["contract_id"]},{"name":"contract_line_items_product_id_idx","columns":["product_id"]}],"version":"be2b46cd"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:CustomerCollection":{"name":"customercollection","className":"CustomerCollection","qualifiedName":"@happyvertical/smrt-commerce:CustomerCollection","collection":"customers","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/CustomerCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByProfile":{"name":"findByProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"CustomerStatus","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"getOrCreateForProfile":{"name":"getOrCreateForProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["number","string"]}],"returnType":"Promise<Customer>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Customer","exportName":"CustomerCollection","collectionExportName":"CustomerCollectionCollection","schema":{"tableName":"customers","ddl":"CREATE TABLE IF NOT EXISTS \\"customers\\" (\\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 \\"profile_id\\" UUID,\\n \\"credit_limit\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"tax_exempt\\" BOOLEAN DEFAULT FALSE,\\n \\"tax_id\\" TEXT DEFAULT '',\\n \\"default_shipping_address\\" JSON,\\n \\"default_billing_address\\" JSON,\\n \\"status\\" TEXT,\\n \\"customer_type\\" TEXT,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"credit_limit":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"tax_exempt":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"tax_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_shipping_address":{"type":"JSON","notNull":false,"unique":false},"default_billing_address":{"type":"JSON","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"customer_type":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"customers_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"customers_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"customers_profile_id_idx","columns":["profile_id"]}],"version":"ad1b9967"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentCollection":{"name":"fulfillmentcollection","className":"FulfillmentCollection","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentCollection","collection":"fulfillments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/FulfillmentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"FulfillmentStatus","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"fulfillmentType","type":"FulfillmentType","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findInTransit":{"name":"findInTransit","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByTracking":{"name":"findByTracking","async":true,"parameters":[{"name":"trackingNumber","type":"string","optional":false}],"returnType":"Promise<Fulfillment | null>","isStatic":false,"isPublic":true},"findShippedInRange":{"name":"findShippedInRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Fulfillment","exportName":"FulfillmentCollection","collectionExportName":"FulfillmentCollectionCollection","schema":{"tableName":"fulfillments","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillments\\" (\\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 \\"contract_id\\" UUID,\\n \\"fulfillment_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"tracking_number\\" TEXT DEFAULT '',\\n \\"carrier\\" TEXT DEFAULT '',\\n \\"shipping_address\\" JSON,\\n \\"shipped_at\\" TIMESTAMP,\\n \\"delivered_at\\" TIMESTAMP,\\n \\"estimated_delivery\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"fulfillment_type":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"tracking_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"carrier":{"type":"TEXT","notNull":false,"unique":false,"default":""},"shipping_address":{"type":"JSON","notNull":false,"unique":false},"shipped_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"delivered_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"estimated_delivery":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillments_contract_id_idx","columns":["contract_id"]}],"version":"2f708fc5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentLineItemCollection":{"name":"fulfillmentlineitemcollection","className":"FulfillmentLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentLineItemCollection","collection":"fulfillmentlineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/FulfillmentLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByFulfillment":{"name":"findByFulfillment","async":true,"parameters":[{"name":"fulfillmentId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findByContractLineItem":{"name":"findByContractLineItem","async":true,"parameters":[{"name":"contractLineItemId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"getTotalFulfilledForContractLine":{"name":"getTotalFulfilledForContractLine","async":true,"parameters":[{"name":"contractLineItemId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"FulfillmentLineItem","exportName":"FulfillmentLineItemCollection","collectionExportName":"FulfillmentLineItemCollectionCollection","schema":{"tableName":"fulfillment_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillment_line_items\\" (\\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 \\"fulfillment_id\\" UUID,\\n \\"contract_line_item_id\\" UUID,\\n \\"quantity_fulfilled\\" REAL DEFAULT 1,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"fulfillment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"fulfillments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_line_item_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contract_line_items","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"quantity_fulfilled":{"type":"REAL","notNull":false,"unique":false,"default":1},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillment_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillment_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillment_line_items_fulfillment_id_idx","columns":["fulfillment_id"]},{"name":"fulfillment_line_items_contract_line_item_id_idx","columns":["contract_line_item_id"]}],"version":"14537dbe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceCollection":{"name":"invoicecollection","className":"InvoiceCollection","qualifiedName":"@happyvertical/smrt-commerce:InvoiceCollection","collection":"invoices","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/InvoiceCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"InvoiceStatus","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findSent":{"name":"findSent","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findPaid":{"name":"findPaid","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findPartial":{"name":"findPartial","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findOverdue":{"name":"findOverdue","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByExternalId":{"name":"findByExternalId","async":true,"parameters":[{"name":"externalId","type":"string","optional":false}],"returnType":"Promise<Invoice | null>","isStatic":false,"isPublic":true},"findNeedingSync":{"name":"findNeedingSync","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"invoiceNumber","type":"string","optional":false}],"returnType":"Promise<Invoice | null>","isStatic":false,"isPublic":true},"countForYear":{"name":"countForYear","async":true,"parameters":[{"name":"year","type":"number","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"generateInvoiceNumber":{"name":"generateInvoiceNumber","async":true,"parameters":[{"name":"options","type":"InvoiceNumberOptions","optional":true}],"returnType":"Promise<string>","isStatic":false,"isPublic":true},"getTotalOutstandingForCustomer":{"name":"getTotalOutstandingForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Invoice","exportName":"InvoiceCollection","collectionExportName":"InvoiceCollectionCollection","schema":{"tableName":"invoices","ddl":"CREATE TABLE IF NOT EXISTS \\"invoices\\" (\\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 \\"customer_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"invoice_number\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"paid_date\\" TIMESTAMP,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"provider_tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'CAD',\\n \\"status\\" TEXT,\\n \\"ar_journal_id\\" UUID,\\n \\"revenue_journal_id\\" UUID,\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"customer_external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"collection_method\\" TEXT DEFAULT '',\\n \\"sent_at\\" TIMESTAMP,\\n \\"viewed_at\\" TIMESTAMP,\\n \\"reminders_sent\\" INTEGER DEFAULT 0,\\n \\"last_reminder_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"customer_notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"issue_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"due_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"paid_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"provider_tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"CAD"},"status":{"type":"TEXT","notNull":false,"unique":false},"ar_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"revenue_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"collection_method":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"viewed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"reminders_sent":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_reminder_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"terms":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"invoices_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoices_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoices_customer_id_idx","columns":["customer_id"]},{"name":"invoices_contract_id_idx","columns":["contract_id"]},{"name":"invoices_ar_journal_id_idx","columns":["ar_journal_id"]},{"name":"invoices_revenue_journal_id_idx","columns":["revenue_journal_id"]}],"version":"e7573840"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceLineItemCollection":{"name":"invoicelineitemcollection","className":"InvoiceLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:InvoiceLineItemCollection","collection":"invoicelineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/InvoiceLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByInvoice":{"name":"findByInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findBySourceType":{"name":"findBySourceType","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"getTotalForInvoice":{"name":"getTotalForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getSubtotalForInvoice":{"name":"getSubtotalForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTaxForInvoice":{"name":"getTaxForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getNextSortOrder":{"name":"getNextSortOrder","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"recalculateAmounts":{"name":"recalculateAmounts","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"toAccountingLineItems":{"name":"toAccountingLineItems","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<AccountingLineItemInput[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"InvoiceLineItem","exportName":"InvoiceLineItemCollection","collectionExportName":"InvoiceLineItemCollectionCollection","schema":{"tableName":"invoice_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"invoice_line_items\\" (\\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 \\"invoice_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"sku\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"invoice_editor_state_json\\" TEXT DEFAULT '',\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"revenue_account_id\\" UUID,\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sku":{"type":"TEXT","notNull":false,"unique":false,"default":""},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":1},"invoice_editor_state_json":{"type":"TEXT","notNull":false,"unique":false,"default":""},"unit_price":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"unique":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"revenue_account_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"invoice_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoice_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoice_line_items_invoice_id_idx","columns":["invoice_id"]},{"name":"invoice_line_items_revenue_account_id_idx","columns":["revenue_account_id"]}],"version":"6d388b43"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentAllocationCollection":{"name":"paymentallocationcollection","className":"PaymentAllocationCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentAllocationCollection","collection":"paymentallocations","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentAllocationCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByPayment":{"name":"findByPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByInvoice":{"name":"findByInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"getTotalAllocatedToInvoice":{"name":"getTotalAllocatedToInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTotalAllocatedFromPayment":{"name":"getTotalAllocatedFromPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getUnallocatedFromPayment":{"name":"getUnallocatedFromPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false},{"name":"paymentAmount","type":"number","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByPaymentAndInvoice":{"name":"findByPaymentAndInvoice","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false},{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation | null>","isStatic":false,"isPublic":true},"findByAllocator":{"name":"findByAllocator","async":true,"parameters":[{"name":"allocatedBy","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentAllocation","exportName":"PaymentAllocationCollection","collectionExportName":"PaymentAllocationCollectionCollection","schema":{"tableName":"payment_allocations","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_allocations\\" (\\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 \\"payment_id\\" UUID,\\n \\"invoice_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"allocated_at\\" TIMESTAMP,\\n \\"allocated_by\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"payments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"allocated_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"allocated_by":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_allocations_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_allocations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_allocations_payment_id_idx","columns":["payment_id"]},{"name":"payment_allocations_invoice_id_idx","columns":["invoice_id"]}],"version":"102e6fbc"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentCollection":{"name":"paymentcollection","className":"PaymentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentCollection","collection":"payments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PaymentStatus","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByMethod":{"name":"findByMethod","async":true,"parameters":[{"name":"method","type":"PaymentMethod","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findCompleted":{"name":"findCompleted","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByTransactionId":{"name":"findByTransactionId","async":true,"parameters":[{"name":"transactionId","type":"string","optional":false}],"returnType":"Promise<Payment | null>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"getTotalForContract":{"name":"getTotalForContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByJournal":{"name":"findByJournal","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<Payment | null>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Payment","exportName":"PaymentCollection","collectionExportName":"PaymentCollectionCollection","schema":{"tableName":"payments","ddl":"CREATE TABLE IF NOT EXISTS \\"payments\\" (\\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 \\"contract_id\\" UUID,\\n \\"customer_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"method\\" TEXT,\\n \\"status\\" TEXT,\\n \\"transaction_id\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"journal_id\\" UUID,\\n \\"paid_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"native_amount\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"usd_at_quote\\" INTEGER DEFAULT 0,\\n \\"usd_at_confirmation\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"method":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"transaction_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"usd_at_quote":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"usd_at_confirmation":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"payments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payments_contract_id_idx","columns":["contract_id"]},{"name":"payments_customer_id_idx","columns":["customer_id"]},{"name":"payments_journal_id_idx","columns":["journal_id"]}],"version":"33f80e50"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentInstrumentCollection":{"name":"paymentinstrumentcollection","className":"PaymentInstrumentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentInstrumentCollection","collection":"paymentinstruments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentInstrumentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findActiveByCustomer":{"name":"findActiveByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findDefaultForCustomer":{"name":"findDefaultForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument | null>","isStatic":false,"isPublic":true},"findByProviderPaymentMethodId":{"name":"findByProviderPaymentMethodId","async":true,"parameters":[{"name":"providerPaymentMethodId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument | null>","isStatic":false,"isPublic":true},"setDefaultForCustomer":{"name":"setDefaultForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false},{"name":"instrumentId","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentInstrument","exportName":"PaymentInstrumentCollection","collectionExportName":"PaymentInstrumentCollectionCollection","schema":{"tableName":"payment_instruments","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_instruments\\" (\\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 \\"customer_id\\" UUID,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"provider_payment_method_id\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'card',\\n \\"brand\\" TEXT DEFAULT '',\\n \\"last4\\" TEXT DEFAULT '',\\n \\"exp_month\\" INTEGER DEFAULT 0,\\n \\"exp_year\\" INTEGER DEFAULT 0,\\n \\"is_default\\" BOOLEAN DEFAULT FALSE,\\n \\"status\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_payment_method_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"card"},"brand":{"type":"TEXT","notNull":false,"unique":false,"default":""},"last4":{"type":"TEXT","notNull":false,"unique":false,"default":""},"exp_month":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"exp_year":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"is_default":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"status":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"payment_instruments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_instruments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_instruments_customer_id_idx","columns":["customer_id"]}],"version":"722393fe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentIntentCollection":{"name":"paymentintentcollection","className":"PaymentIntentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentIntentCollection","collection":"paymentintents","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentIntentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByIdempotencyKey":{"name":"findByIdempotencyKey","async":true,"parameters":[{"name":"args","type":"PaymentIntentIdempotencyArgs","optional":false}],"returnType":"Promise<PaymentIntent | null>","isStatic":false,"isPublic":true},"getOrCreateByIdempotencyKey":{"name":"getOrCreateByIdempotencyKey","async":true,"parameters":[{"name":"seed","type":"PaymentIntentSeed","optional":false}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"findOpen":{"name":"findOpen","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findStale":{"name":"findStale","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByLicenseeEmail":{"name":"findByLicenseeEmail","async":true,"parameters":[{"name":"email","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByOfferingRef":{"name":"findByOfferingRef","async":true,"parameters":[{"name":"offeringRef","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PaymentIntentStatus","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentIntent","exportName":"PaymentIntentCollection","collectionExportName":"PaymentIntentCollectionCollection","schema":{"tableName":"payment_intents","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_intents\\" (\\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 \\"sku_id\\" TEXT DEFAULT '',\\n \\"offering_ref\\" TEXT DEFAULT '',\\n \\"licensee_email\\" TEXT DEFAULT '',\\n \\"customer_id\\" TEXT DEFAULT '',\\n \\"payment_options\\" JSON DEFAULT '[]',\\n \\"usd_price_locked\\" INTEGER DEFAULT 0,\\n \\"price_lock_window_ms\\" INTEGER,\\n \\"price_lock_expires_at\\" TIMESTAMP,\\n \\"status\\" TEXT,\\n \\"idempotency_key\\" TEXT DEFAULT '',\\n \\"paid_option_backend_id\\" TEXT DEFAULT '',\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"paid_at\\" TIMESTAMP,\\n \\"issued_at\\" TIMESTAMP,\\n \\"expired_at\\" TIMESTAMP,\\n \\"cancelled_at\\" TIMESTAMP,\\n \\"retired_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"offering_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"licensee_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_options":{"type":"JSON","notNull":false,"unique":false,"default":[]},"usd_price_locked":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"price_lock_window_ms":{"type":"INTEGER","notNull":false,"unique":false},"price_lock_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"idempotency_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_option_backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"expired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"cancelled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"retired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_intents_tenant_id_offering_ref_idx","columns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"unique":true,"nullsNotDistinct":true},{"name":"payment_intents_slug_context_idx","columns":["slug","context"]},{"name":"payment_intents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"c565aaef"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PayoutCollection":{"name":"payoutcollection","className":"PayoutCollection","qualifiedName":"@happyvertical/smrt-commerce:PayoutCollection","collection":"payouts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PayoutCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"createFromPayment":{"name":"createFromPayment","async":true,"parameters":[{"name":"args","type":"CreatePayoutFromPaymentArgs","optional":false}],"returnType":"Promise<Payout>","isStatic":false,"isPublic":true},"findByPayment":{"name":"findByPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByVendor":{"name":"findByVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PayoutStatus","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findFailed":{"name":"findFailed","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByBackendTxRef":{"name":"findByBackendTxRef","async":true,"parameters":[{"name":"backendTxRef","type":"string","optional":false}],"returnType":"Promise<Payout | null>","isStatic":false,"isPublic":true},"getConfirmedTotalForVendor":{"name":"getConfirmedTotalForVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Payout","exportName":"PayoutCollection","collectionExportName":"PayoutCollectionCollection","schema":{"tableName":"payouts","ddl":"CREATE TABLE IF NOT EXISTS \\"payouts\\" (\\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 \\"payment_id\\" TEXT DEFAULT '',\\n \\"vendor_id\\" UUID,\\n \\"gross_amount\\" INTEGER DEFAULT 0,\\n \\"operator_fee\\" INTEGER DEFAULT 0,\\n \\"supplier_net\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT '',\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"sent_at\\" TIMESTAMP,\\n \\"confirmed_at\\" TIMESTAMP,\\n \\"failed_at\\" TIMESTAMP,\\n \\"failure_reason\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"gross_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"operator_fee":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"supplier_net":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"confirmed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failure_reason":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payouts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payouts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payouts_vendor_id_idx","columns":["vendor_id"]}],"version":"98fa81d5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:VendorCollection":{"name":"vendorcollection","className":"VendorCollection","qualifiedName":"@happyvertical/smrt-commerce:VendorCollection","collection":"vendors","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/VendorCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByProfile":{"name":"findByProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"VendorStatus","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"getOrCreateForProfile":{"name":"getOrCreateForProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["number","string"]}],"returnType":"Promise<Vendor>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Vendor","exportName":"VendorCollection","collectionExportName":"VendorCollectionCollection","schema":{"tableName":"vendors","ddl":"CREATE TABLE IF NOT EXISTS \\"vendors\\" (\\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 \\"profile_id\\" UUID,\\n \\"lead_time_days\\" INTEGER DEFAULT 0,\\n \\"minimum_order_amount\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"default_contact_email\\" TEXT DEFAULT '',\\n \\"default_contact_phone\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"payout_addresses\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"lead_time_days":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"minimum_order_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"default_contact_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_contact_phone":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payout_addresses":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"vendors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"vendors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"vendors_profile_id_idx","columns":["profile_id"]}],"version":"1dc2b65e"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Contract":{"name":"contract","className":"Contract","qualifiedName":"@happyvertical/smrt-commerce:Contract","collection":"contracts","description":"Contract is the base class for all commercial agreements.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"Contract","collectionExportName":"ContractCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"9c2e9c49"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Estimate":{"name":"estimate","className":"Estimate","qualifiedName":"@happyvertical/smrt-commerce:Estimate","collection":"contracts","description":"Quote or proposal for a customer","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Estimate","collectionExportName":"EstimateCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"2f1624b2"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Order":{"name":"order","className":"Order","qualifiedName":"@happyvertical/smrt-commerce:Order","collection":"contracts","description":"Customer purchase order","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Order","collectionExportName":"OrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"b7667cf3"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Lease":{"name":"lease","className":"Lease","qualifiedName":"@happyvertical/smrt-commerce:Lease","collection":"contracts","description":"Rental or lease agreement","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Lease","collectionExportName":"LeaseCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"b24cdace"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Agreement":{"name":"agreement","className":"Agreement","qualifiedName":"@happyvertical/smrt-commerce:Agreement","collection":"contracts","description":"Service or maintenance agreement","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Agreement","collectionExportName":"AgreementCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"28f0c394"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PurchaseOrder":{"name":"purchaseorder","className":"PurchaseOrder","qualifiedName":"@happyvertical/smrt-commerce:PurchaseOrder","collection":"contracts","description":"Order sent to vendor/supplier","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"PurchaseOrder","collectionExportName":"PurchaseOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"91ec64bb"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:WholesaleOrder":{"name":"wholesaleorder","className":"WholesaleOrder","qualifiedName":"@happyvertical/smrt-commerce:WholesaleOrder","collection":"contracts","description":"B2B order placed by a wholesale customer.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"WholesaleOrder","collectionExportName":"WholesaleOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"ccb8a3ae"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ProductionOrder":{"name":"productionorder","className":"ProductionOrder","qualifiedName":"@happyvertical/smrt-commerce:ProductionOrder","collection":"contracts","description":"Instruction to commission goods from an internal or external factory.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}},"productId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"bomId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"ProductionOrder","collectionExportName":"ProductionOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"c6b977a5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Cart":{"name":"cart","className":"Cart","qualifiedName":"@happyvertical/smrt-commerce:Cart","collection":"contracts","description":"Transient order-in-progress for a shopper.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Cart","collectionExportName":"CartCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"fba16d4f"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:LicenseSale":{"name":"licensesale","className":"LicenseSale","qualifiedName":"@happyvertical/smrt-commerce:LicenseSale","collection":"contracts","description":"Industry-neutral licensing primitive.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts."}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this."}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions."}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}},"skuId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"paymentId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeEmail":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeLegalEntity":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeJurisdiction":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsMedium":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsDistributionScope":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsExclusivity":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsDuration":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsTerritory":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsSublicensing":{"type":"meta","required":false,"default":false,"_meta":{"underlyingType":"boolean"}},"rightsDerivatives":{"type":"meta","required":false,"default":false,"_meta":{"underlyingType":"boolean"}},"pdfUrl":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"pdfHash":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"onChainHashRegistryRef":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"getRightsSnapshot":{"name":"getRightsSnapshot","async":false,"parameters":[],"returnType":"LicenseRightsSnapshot","isStatic":false,"isPublic":true},"revoke":{"name":"revoke","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"LicenseSale","collectionExportName":"LicenseSaleCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"d6d82bad"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ContractLineItem":{"name":"contractlineitem","className":"ContractLineItem","qualifiedName":"@happyvertical/smrt-commerce:ContractLineItem","collection":"contractlineitems","description":"ContractLineItem represents a single line item on a contract.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/ContractLineItem.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract"},"description":{"type":"text","required":false,"default":""},"quantity":{"type":"decimal","required":false,"default":1},"unitPrice":{"type":"integer","required":false,"default":0},"discount":{"type":"integer","required":false,"default":0},"taxRate":{"type":"decimal","required":false,"default":0},"amount":{"type":"integer","required":false,"default":0},"productId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-products:Product"},"sku":{"type":"text","required":false,"default":""},"startDate":{"type":"datetime","required":false},"endDate":{"type":"datetime","required":false},"billingPeriod":{"type":"text","required":false,"default":""},"sortOrder":{"type":"integer","required":false,"default":0}},"methods":{"calculateAmount":{"name":"calculateAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"isRecurring":{"name":"isRecurring","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSubscriptionActive":{"name":"isSubscriptionActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"ContractLineItem","collectionExportName":"ContractLineItemCollection","schema":{"tableName":"contract_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"contract_line_items\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"product_id\\" UUID,\\n \\"sku\\" TEXT DEFAULT '',\\n \\"start_date\\" TIMESTAMP,\\n \\"end_date\\" TIMESTAMP,\\n \\"billing_period\\" TEXT DEFAULT '',\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"default":""},"quantity":{"type":"REAL","notNull":false,"default":1},"unit_price":{"type":"INTEGER","notNull":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"default":0},"product_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"sku":{"type":"TEXT","notNull":false,"default":""},"start_date":{"type":"TIMESTAMP","notNull":false},"end_date":{"type":"TIMESTAMP","notNull":false},"billing_period":{"type":"TEXT","notNull":false,"default":""},"sort_order":{"type":"INTEGER","notNull":false,"default":0}},"indexes":[{"name":"contract_line_items_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contract_line_items_meta_type_idx","columns":["_meta_type"]},{"name":"contract_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contract_line_items_contract_id_idx","columns":["contract_id"]},{"name":"contract_line_items_product_id_idx","columns":["product_id"]}],"version":"be2b46cd"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Customer":{"name":"customer","className":"Customer","qualifiedName":"@happyvertical/smrt-commerce:Customer","collection":"customers","description":"Customer represents the customer role for a Profile.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Customer.ts","packageName":"@happyvertical/smrt-commerce","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}}},"profileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","_meta":{"description":"Links this customer to their profile record, where their name and contact details are kept."}},"creditLimit":{"type":"integer","required":false,"default":0,"description":"The most this customer may owe you at one time. Leave it at zero if you do not set limits.","_meta":{"description":"The most this customer may owe you at one time. Leave it at zero if you do not set limits."}},"paymentTerms":{"type":"text","required":false,"default":"","description":"How long the customer has to pay, written the way you would say it, for example \\"Net 30\\".","_meta":{"description":"How long the customer has to pay, written the way you would say it, for example \\"Net 30\\"."}},"taxExempt":{"type":"boolean","required":false,"default":false,"description":"Turn this on if you do not charge this customer sales tax.","_meta":{"description":"Turn this on if you do not charge this customer sales tax."}},"taxId":{"type":"text","required":false,"default":"","description":"The tax or VAT number of the customer, kept on file for tax-exempt sales.","_meta":{"sensitive":true,"description":"The tax or VAT number of the customer, kept on file for tax-exempt sales."},"sensitive":true},"defaultShippingAddress":{"type":"json","required":false,"description":"Where you usually send goods to this customer, so you do not retype it on every order.","_meta":{"description":"Where you usually send goods to this customer, so you do not retype it on every order."}},"defaultBillingAddress":{"type":"json","required":false,"description":"Where you send invoices to this customer.","_meta":{"description":"Where you send invoices to this customer."}},"status":{"type":"text","required":false,"description":"Whether you are still dealing with this customer: active, inactive or suspended.","_meta":{"description":"Whether you are still dealing with this customer: active, inactive or suspended."},"enum":["active","inactive","suspended"]},"customerType":{"type":"text","required":false,"description":"The kind of customer: a direct shopper, a wholesale buyer or a retail customer.","_meta":{"description":"The kind of customer: a direct shopper, a wholesale buyer or a retail customer."},"enum":["dtc","wholesale","retail"]},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this customer.","_meta":{"description":"Anything worth remembering about this customer."}}},"methods":{"isWholesale":{"name":"isWholesale","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"hasAvailableCredit":{"name":"hasAvailableCredit","async":false,"parameters":[{"name":"amount","type":"number","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getProfileId":{"name":"getProfileId","async":false,"parameters":[],"returnType":"string","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Customer","collectionExportName":"CustomerCollection","schema":{"tableName":"customers","ddl":"CREATE TABLE IF NOT EXISTS \\"customers\\" (\\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 \\"profile_id\\" UUID,\\n \\"credit_limit\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"tax_exempt\\" BOOLEAN DEFAULT FALSE,\\n \\"tax_id\\" TEXT DEFAULT '',\\n \\"default_shipping_address\\" JSON,\\n \\"default_billing_address\\" JSON,\\n \\"status\\" TEXT,\\n \\"customer_type\\" TEXT,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"credit_limit":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"tax_exempt":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"tax_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_shipping_address":{"type":"JSON","notNull":false,"unique":false},"default_billing_address":{"type":"JSON","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"customer_type":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"customers_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"customers_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"customers_profile_id_idx","columns":["profile_id"]}],"version":"ad1b9967"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Fulfillment":{"name":"fulfillment","className":"Fulfillment","qualifiedName":"@happyvertical/smrt-commerce:Fulfillment","collection":"fulfillments","description":"Fulfillment tracks the delivery or completion of contract items.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Fulfillment.ts","packageName":"@happyvertical/smrt-commerce","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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract"},"fulfillmentType":{"type":"text","required":false,"enum":["shipment","delivery","pickup","digital","service"]},"status":{"type":"text","required":false,"enum":["pending","processing","shipped","delivered","cancelled"]},"trackingNumber":{"type":"text","required":false,"default":""},"carrier":{"type":"text","required":false,"default":""},"shippingAddress":{"type":"json","required":false},"shippedAt":{"type":"datetime","required":false},"deliveredAt":{"type":"datetime","required":false},"estimatedDelivery":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isDelivered":{"name":"isDelivered","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isInTransit":{"name":"isInTransit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markShipped":{"name":"markShipped","async":false,"parameters":[{"name":"trackingNumber","type":"string","optional":true},{"name":"carrier","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"markDelivered":{"name":"markDelivered","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Fulfillment","collectionExportName":"FulfillmentCollection","schema":{"tableName":"fulfillments","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillments\\" (\\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 \\"contract_id\\" UUID,\\n \\"fulfillment_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"tracking_number\\" TEXT DEFAULT '',\\n \\"carrier\\" TEXT DEFAULT '',\\n \\"shipping_address\\" JSON,\\n \\"shipped_at\\" TIMESTAMP,\\n \\"delivered_at\\" TIMESTAMP,\\n \\"estimated_delivery\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"fulfillment_type":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"tracking_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"carrier":{"type":"TEXT","notNull":false,"unique":false,"default":""},"shipping_address":{"type":"JSON","notNull":false,"unique":false},"shipped_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"delivered_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"estimated_delivery":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillments_contract_id_idx","columns":["contract_id"]}],"version":"2f708fc5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentLineItem":{"name":"fulfillmentlineitem","className":"FulfillmentLineItem","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentLineItem","collection":"fulfillmentlineitems","description":"FulfillmentLineItem tracks which contract line items are included in a specific fulfillment and how much was fulfilled.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/FulfillmentLineItem.ts","packageName":"@happyvertical/smrt-commerce","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}}},"fulfillmentId":{"type":"foreignKey","required":false,"related":"Fulfillment"},"contractLineItemId":{"type":"foreignKey","required":false,"related":"ContractLineItem"},"quantityFulfilled":{"type":"decimal","required":false,"default":1},"notes":{"type":"text","required":false,"default":""}},"methods":{"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"FulfillmentLineItem","collectionExportName":"FulfillmentLineItemCollection","schema":{"tableName":"fulfillment_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillment_line_items\\" (\\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 \\"fulfillment_id\\" UUID,\\n \\"contract_line_item_id\\" UUID,\\n \\"quantity_fulfilled\\" REAL DEFAULT 1,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"fulfillment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"fulfillments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_line_item_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contract_line_items","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"quantity_fulfilled":{"type":"REAL","notNull":false,"unique":false,"default":1},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillment_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillment_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillment_line_items_fulfillment_id_idx","columns":["fulfillment_id"]},{"name":"fulfillment_line_items_contract_line_item_id_idx","columns":["contract_line_item_id"]}],"version":"14537dbe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Invoice":{"name":"invoice","className":"Invoice","qualifiedName":"@happyvertical/smrt-commerce:Invoice","collection":"invoices","description":"Invoice represents a bill sent to a customer for goods or services.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Invoice.ts","packageName":"@happyvertical/smrt-commerce","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}}},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"contractId":{"type":"foreignKey","required":false,"related":"Contract"},"invoiceNumber":{"type":"text","required":false,"default":""},"reference":{"type":"text","required":false,"default":""},"issueDate":{"type":"datetime","required":false},"dueDate":{"type":"datetime","required":false},"paidDate":{"type":"datetime","required":false},"subtotal":{"type":"integer","required":false,"default":0},"taxAmount":{"type":"integer","required":false,"default":0},"providerTaxAmount":{"type":"integer","required":false,"default":0},"totalAmount":{"type":"integer","required":false,"default":0},"amountPaid":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"CAD"},"status":{"type":"text","required":false,"enum":["draft","sent","viewed","partial","paid","overdue","cancelled","written_off"]},"arJournalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"revenueJournalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"externalId":{"type":"text","required":false,"default":""},"customerExternalId":{"type":"text","required":false,"default":""},"externalProvider":{"type":"text","required":false,"default":""},"syncedAt":{"type":"datetime","required":false},"collectionMethod":{"type":"text","required":false,"default":"","enum":["","send_invoice","charge_automatically"]},"sentAt":{"type":"datetime","required":false},"viewedAt":{"type":"datetime","required":false},"remindersSent":{"type":"integer","required":false,"default":0},"lastReminderAt":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":""},"customerNotes":{"type":"text","required":false,"default":""},"terms":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSent":{"name":"isSent","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPaid":{"name":"isPaid","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPartial":{"name":"isPartial","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getAmountDue":{"name":"getAmountDue","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"markSent":{"name":"markSent","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markViewed":{"name":"markViewed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"updatePaymentStatus":{"name":"updatePaymentStatus","async":false,"parameters":[{"name":"amountPaid","type":"number","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"writeOff":{"name":"writeOff","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"recognizeRevenue":{"name":"recognizeRevenue","async":true,"parameters":[{"name":"options","type":"RecognizeRevenueOptions","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"getArJournal":{"name":"getArJournal","async":true,"parameters":[],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"toAccountingInput":{"name":"toAccountingInput","async":true,"parameters":[],"returnType":"Promise<AccountingInvoiceInput>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["customerId","contractId","invoiceNumber","reference","issueDate","dueDate","currency","notes","customerNotes","terms","externalId","customerExternalId","externalProvider"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Invoice","collectionExportName":"InvoiceCollection","schema":{"tableName":"invoices","ddl":"CREATE TABLE IF NOT EXISTS \\"invoices\\" (\\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 \\"customer_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"invoice_number\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"paid_date\\" TIMESTAMP,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"provider_tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'CAD',\\n \\"status\\" TEXT,\\n \\"ar_journal_id\\" UUID,\\n \\"revenue_journal_id\\" UUID,\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"customer_external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"collection_method\\" TEXT DEFAULT '',\\n \\"sent_at\\" TIMESTAMP,\\n \\"viewed_at\\" TIMESTAMP,\\n \\"reminders_sent\\" INTEGER DEFAULT 0,\\n \\"last_reminder_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"customer_notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"issue_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"due_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"paid_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"provider_tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"CAD"},"status":{"type":"TEXT","notNull":false,"unique":false},"ar_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"revenue_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"collection_method":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"viewed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"reminders_sent":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_reminder_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"terms":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"invoices_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoices_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoices_customer_id_idx","columns":["customer_id"]},{"name":"invoices_contract_id_idx","columns":["contract_id"]},{"name":"invoices_ar_journal_id_idx","columns":["ar_journal_id"]},{"name":"invoices_revenue_journal_id_idx","columns":["revenue_journal_id"]}],"version":"e7573840"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceLineItem":{"name":"invoicelineitem","className":"InvoiceLineItem","qualifiedName":"@happyvertical/smrt-commerce:InvoiceLineItem","collection":"invoicelineitems","description":"InvoiceLineItem represents a single line item on an invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/InvoiceLineItem.ts","packageName":"@happyvertical/smrt-commerce","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}}},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice"},"description":{"type":"text","required":false,"default":""},"sku":{"type":"text","required":false,"default":""},"quantity":{"type":"decimal","required":false,"default":1},"invoiceEditorStateJson":{"type":"text","required":false,"default":""},"unitPrice":{"type":"integer","required":false,"default":0},"discount":{"type":"integer","required":false,"default":0},"taxRate":{"type":"decimal","required":false,"default":0},"amount":{"type":"integer","required":false,"default":0},"sourceType":{"type":"text","required":false,"default":""},"sourceId":{"type":"text","required":false,"default":""},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false},"revenueAccountId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Account"},"sortOrder":{"type":"integer","required":false,"default":0}},"methods":{"calculateAmount":{"name":"calculateAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getSubtotal":{"name":"getSubtotal","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getTaxAmount":{"name":"getTaxAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"applyEditorDraft":{"name":"applyEditorDraft","async":false,"parameters":[{"name":"draft","type":"InvoiceLineDraft","optional":false},{"name":"context","type":"InvoiceCalculationContext","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getEditorDraft":{"name":"getEditorDraft","async":false,"parameters":[{"name":"authorizedContext","type":"InvoiceCalculationContext","optional":false}],"returnType":"InvoiceLineDraft | null","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"hasSource":{"name":"hasSource","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"hasPeriod":{"name":"hasPeriod","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"toAccountingLineItem":{"name":"toAccountingLineItem","async":false,"parameters":[{"name":"currency","type":"string","optional":true}],"returnType":"AccountingLineItemInput","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"InvoiceLineItem","collectionExportName":"InvoiceLineItemCollection","schema":{"tableName":"invoice_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"invoice_line_items\\" (\\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 \\"invoice_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"sku\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"invoice_editor_state_json\\" TEXT DEFAULT '',\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"revenue_account_id\\" UUID,\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sku":{"type":"TEXT","notNull":false,"unique":false,"default":""},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":1},"invoice_editor_state_json":{"type":"TEXT","notNull":false,"unique":false,"default":""},"unit_price":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"unique":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"revenue_account_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"invoice_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoice_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoice_line_items_invoice_id_idx","columns":["invoice_id"]},{"name":"invoice_line_items_revenue_account_id_idx","columns":["revenue_account_id"]}],"version":"6d388b43"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Payment":{"name":"payment","className":"Payment","qualifiedName":"@happyvertical/smrt-commerce:Payment","collection":"payments","description":"Payment represents a financial transaction against a contract.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Payment.ts","packageName":"@happyvertical/smrt-commerce","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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract"},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"amount":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"method":{"type":"text","required":false,"enum":["cash","check","credit_card","bank_transfer","crypto","other"]},"status":{"type":"text","required":false,"enum":["pending","completed","failed","refunded","cancelled"]},"transactionId":{"type":"text","required":false,"default":""},"reference":{"type":"text","required":false,"default":""},"journalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"paidAt":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":""},"externalId":{"type":"text","required":false,"default":""},"externalProvider":{"type":"text","required":false,"default":""},"syncedAt":{"type":"datetime","required":false},"backendId":{"type":"text","required":false,"default":""},"backendTxRef":{"type":"text","required":false,"default":""},"nativeAmount":{"type":"integer","required":false,"default":0},"nativeCurrency":{"type":"text","required":false,"default":""},"usdAtQuote":{"type":"integer","required":false,"default":0},"usdAtConfirmation":{"type":"integer","required":false,"default":0}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"usdDrift":{"name":"usdDrift","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRefunded":{"name":"isRefunded","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recordPayment":{"name":"recordPayment","async":true,"parameters":[{"name":"options","type":"RecordPaymentOptions","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"getJournal":{"name":"getJournal","async":true,"parameters":[],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"markFailed":{"name":"markFailed","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["contractId","customerId","amount","currency","method","transactionId","reference","notes","externalId","externalProvider","backendId","backendTxRef","nativeAmount","nativeCurrency","usdAtQuote","usdAtConfirmation"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Payment","collectionExportName":"PaymentCollection","schema":{"tableName":"payments","ddl":"CREATE TABLE IF NOT EXISTS \\"payments\\" (\\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 \\"contract_id\\" UUID,\\n \\"customer_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"method\\" TEXT,\\n \\"status\\" TEXT,\\n \\"transaction_id\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"journal_id\\" UUID,\\n \\"paid_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"native_amount\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"usd_at_quote\\" INTEGER DEFAULT 0,\\n \\"usd_at_confirmation\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"method":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"transaction_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"usd_at_quote":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"usd_at_confirmation":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"payments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payments_contract_id_idx","columns":["contract_id"]},{"name":"payments_customer_id_idx","columns":["customer_id"]},{"name":"payments_journal_id_idx","columns":["journal_id"]}],"version":"33f80e50"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentAllocation":{"name":"paymentallocation","className":"PaymentAllocation","qualifiedName":"@happyvertical/smrt-commerce:PaymentAllocation","collection":"paymentallocations","description":"PaymentAllocation tracks how payments are applied to invoices.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentAllocation.ts","packageName":"@happyvertical/smrt-commerce","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}}},"paymentId":{"type":"foreignKey","required":false,"related":"Payment"},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice"},"amount":{"type":"integer","required":false,"default":0},"allocatedAt":{"type":"datetime","required":false},"allocatedBy":{"type":"text","required":false,"default":""},"notes":{"type":"text","required":false,"default":""}},"methods":{"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PaymentAllocation","collectionExportName":"PaymentAllocationCollection","schema":{"tableName":"payment_allocations","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_allocations\\" (\\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 \\"payment_id\\" UUID,\\n \\"invoice_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"allocated_at\\" TIMESTAMP,\\n \\"allocated_by\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"payments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"allocated_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"allocated_by":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_allocations_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_allocations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_allocations_payment_id_idx","columns":["payment_id"]},{"name":"payment_allocations_invoice_id_idx","columns":["invoice_id"]}],"version":"102e6fbc"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentInstrument":{"name":"paymentinstrument","className":"PaymentInstrument","qualifiedName":"@happyvertical/smrt-commerce:PaymentInstrument","collection":"paymentinstruments","description":"PaymentInstrument stores a reusable payment method a customer has saved with a payment backend (e.g. a card vaulted by Stripe), so it can be charged later without the customer present.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentInstrument.ts","packageName":"@happyvertical/smrt-commerce","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}}},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"backendId":{"type":"text","required":false,"default":""},"providerCustomerId":{"type":"text","required":false,"default":""},"providerPaymentMethodId":{"type":"text","required":false,"default":""},"type":{"type":"text","required":false,"default":"card"},"brand":{"type":"text","required":false,"default":""},"last4":{"type":"text","required":false,"default":""},"expMonth":{"type":"integer","required":false,"default":0},"expYear":{"type":"integer","required":false,"default":0},"isDefault":{"type":"boolean","required":false,"default":false},"status":{"type":"text","required":false,"enum":["active","expired","removed"]}},"methods":{"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRemoved":{"name":"isRemoved","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markExpired":{"name":"markExpired","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markRemoved":{"name":"markRemoved","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["customerId","backendId","providerCustomerId","providerPaymentMethodId","type","brand","last4","expMonth","expYear","status"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PaymentInstrument","collectionExportName":"PaymentInstrumentCollection","schema":{"tableName":"payment_instruments","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_instruments\\" (\\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 \\"customer_id\\" UUID,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"provider_payment_method_id\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'card',\\n \\"brand\\" TEXT DEFAULT '',\\n \\"last4\\" TEXT DEFAULT '',\\n \\"exp_month\\" INTEGER DEFAULT 0,\\n \\"exp_year\\" INTEGER DEFAULT 0,\\n \\"is_default\\" BOOLEAN DEFAULT FALSE,\\n \\"status\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_payment_method_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"card"},"brand":{"type":"TEXT","notNull":false,"unique":false,"default":""},"last4":{"type":"TEXT","notNull":false,"unique":false,"default":""},"exp_month":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"exp_year":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"is_default":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"status":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"payment_instruments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_instruments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_instruments_customer_id_idx","columns":["customer_id"]}],"version":"722393fe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentIntent":{"name":"paymentintent","className":"PaymentIntent","qualifiedName":"@happyvertical/smrt-commerce:PaymentIntent","collection":"paymentintents","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentIntent.ts","packageName":"@happyvertical/smrt-commerce","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}}},"skuId":{"type":"text","required":false,"default":""},"offeringRef":{"type":"text","required":false,"default":""},"licenseeEmail":{"type":"text","required":false,"default":""},"customerId":{"type":"text","required":false,"default":""},"paymentOptions":{"type":"json","required":false,"default":[]},"usdPriceLocked":{"type":"integer","required":false,"default":0},"priceLockWindowMs":{"type":"integer","required":false},"priceLockExpiresAt":{"type":"datetime","required":false},"status":{"type":"text","required":false,"enum":["awaiting_payment","paid","issued","retired","expired","cancelled"]},"idempotencyKey":{"type":"text","required":false,"default":""},"paidOptionBackendId":{"type":"text","required":false,"default":""},"paymentId":{"type":"text","required":false,"default":""},"paidAt":{"type":"datetime","required":false},"issuedAt":{"type":"datetime","required":false},"expiredAt":{"type":"datetime","required":false},"cancelledAt":{"type":"datetime","required":false},"retiredAt":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isAwaitingPayment":{"name":"isAwaitingPayment","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPaid":{"name":"isPaid","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isIssued":{"name":"isIssued","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCancelled":{"name":"isCancelled","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRetired":{"name":"isRetired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isTerminal":{"name":"isTerminal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markPaid":{"name":"markPaid","async":false,"parameters":[{"name":"args","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"void","isStatic":false,"isPublic":true},"verifyAndMarkPaid":{"name":"verifyAndMarkPaid","async":true,"parameters":[{"name":"args","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"markIssued":{"name":"markIssued","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"expire":{"name":"expire","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"retire":{"name":"retire","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"getOption":{"name":"getOption","async":false,"parameters":[{"name":"backendId","type":"string","optional":false}],"returnType":"PaymentOption | undefined","isStatic":false,"isPublic":true},"isOptionRetired":{"name":"isOptionRetired","async":false,"parameters":[{"name":"backendId","type":"string","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getRetiredOptions":{"name":"getRetiredOptions","async":false,"parameters":[],"returnType":"PaymentOption[]","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"api":{"include":["list","get","create","update"],"writable":["skuId","offeringRef","licenseeEmail","customerId","paymentOptions","usdPriceLocked","priceLockWindowMs","idempotencyKey","notes"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"PaymentIntent","collectionExportName":"PaymentIntentCollection","schema":{"tableName":"payment_intents","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_intents\\" (\\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 \\"sku_id\\" TEXT DEFAULT '',\\n \\"offering_ref\\" TEXT DEFAULT '',\\n \\"licensee_email\\" TEXT DEFAULT '',\\n \\"customer_id\\" TEXT DEFAULT '',\\n \\"payment_options\\" JSON DEFAULT '[]',\\n \\"usd_price_locked\\" INTEGER DEFAULT 0,\\n \\"price_lock_window_ms\\" INTEGER,\\n \\"price_lock_expires_at\\" TIMESTAMP,\\n \\"status\\" TEXT,\\n \\"idempotency_key\\" TEXT DEFAULT '',\\n \\"paid_option_backend_id\\" TEXT DEFAULT '',\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"paid_at\\" TIMESTAMP,\\n \\"issued_at\\" TIMESTAMP,\\n \\"expired_at\\" TIMESTAMP,\\n \\"cancelled_at\\" TIMESTAMP,\\n \\"retired_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"offering_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"licensee_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_options":{"type":"JSON","notNull":false,"unique":false,"default":[]},"usd_price_locked":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"price_lock_window_ms":{"type":"INTEGER","notNull":false,"unique":false},"price_lock_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"idempotency_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_option_backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"expired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"cancelled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"retired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_intents_tenant_id_offering_ref_idx","columns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"unique":true,"nullsNotDistinct":true},{"name":"payment_intents_slug_context_idx","columns":["slug","context"]},{"name":"payment_intents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"c565aaef"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Payout":{"name":"payout","className":"Payout","qualifiedName":"@happyvertical/smrt-commerce:Payout","collection":"payouts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Payout.ts","packageName":"@happyvertical/smrt-commerce","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}}},"paymentId":{"type":"text","required":false,"default":""},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor"},"grossAmount":{"type":"integer","required":false,"default":0},"operatorFee":{"type":"integer","required":false,"default":0},"supplierNet":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":""},"backendId":{"type":"text","required":false,"default":""},"backendTxRef":{"type":"text","required":false,"default":""},"status":{"type":"text","required":false,"enum":["pending","sent","confirmed","failed"]},"sentAt":{"type":"datetime","required":false},"confirmedAt":{"type":"datetime","required":false},"failedAt":{"type":"datetime","required":false},"failureReason":{"type":"text","required":false,"default":""},"notes":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSent":{"name":"isSent","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isConfirmed":{"name":"isConfirmed","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isFailed":{"name":"isFailed","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markSent":{"name":"markSent","async":false,"parameters":[{"name":"backendTxRef","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"markConfirmed":{"name":"markConfirmed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markFailed":{"name":"markFailed","async":false,"parameters":[{"name":"reason","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"resetFromFailed":{"name":"resetFromFailed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"validateAmounts":{"name":"validateAmounts","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Payout","collectionExportName":"PayoutCollection","schema":{"tableName":"payouts","ddl":"CREATE TABLE IF NOT EXISTS \\"payouts\\" (\\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 \\"payment_id\\" TEXT DEFAULT '',\\n \\"vendor_id\\" UUID,\\n \\"gross_amount\\" INTEGER DEFAULT 0,\\n \\"operator_fee\\" INTEGER DEFAULT 0,\\n \\"supplier_net\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT '',\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"sent_at\\" TIMESTAMP,\\n \\"confirmed_at\\" TIMESTAMP,\\n \\"failed_at\\" TIMESTAMP,\\n \\"failure_reason\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"gross_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"operator_fee":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"supplier_net":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"confirmed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failure_reason":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payouts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payouts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payouts_vendor_id_idx","columns":["vendor_id"]}],"version":"98fa81d5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Vendor":{"name":"vendor","className":"Vendor","qualifiedName":"@happyvertical/smrt-commerce:Vendor","collection":"vendors","description":"Vendor represents the vendor/supplier role for a Profile.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Vendor.ts","packageName":"@happyvertical/smrt-commerce","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}}},"profileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","_meta":{"description":"Links this vendor to their profile record, where their name and contact details are kept."}},"leadTimeDays":{"type":"integer","required":false,"default":0,"description":"How many days the vendor usually takes between your order and delivery.","_meta":{"description":"How many days the vendor usually takes between your order and delivery."}},"minimumOrderAmount":{"type":"integer","required":false,"default":0,"description":"The smallest order the vendor will accept.","_meta":{"description":"The smallest order the vendor will accept."}},"paymentTerms":{"type":"text","required":false,"default":"","description":"How long you have to pay this vendor, written the way you would say it, for example \\"Net 30\\".","_meta":{"description":"How long you have to pay this vendor, written the way you would say it, for example \\"Net 30\\"."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency this vendor bills you in.","_meta":{"description":"The currency this vendor bills you in."}},"defaultContactEmail":{"type":"text","required":false,"default":"","description":"The email address you normally use to reach this vendor.","_meta":{"description":"The email address you normally use to reach this vendor."}},"defaultContactPhone":{"type":"text","required":false,"default":"","description":"The phone number you normally use to reach this vendor.","_meta":{"description":"The phone number you normally use to reach this vendor."}},"status":{"type":"text","required":false,"description":"Whether you still buy from this vendor: active, inactive or suspended.","_meta":{"description":"Whether you still buy from this vendor: active, inactive or suspended."},"enum":["active","inactive","suspended"]},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this vendor.","_meta":{"description":"Anything worth remembering about this vendor."}},"payoutAddresses":{"type":"json","required":false,"default":{},"description":"Where payments to this vendor should be sent.","_meta":{"sensitive":true,"description":"Where payments to this vendor should be sent."},"sensitive":true}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"meetsMinimumOrder":{"name":"meetsMinimumOrder","async":false,"parameters":[{"name":"amount","type":"number","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getProfileId":{"name":"getProfileId","async":false,"parameters":[],"returnType":"string","isStatic":false,"isPublic":true},"getPayoutAddress":{"name":"getPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false}],"returnType":"string | undefined","isStatic":false,"isPublic":true},"setPayoutAddress":{"name":"setPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false},{"name":"destination","type":"string","optional":false}],"returnType":"this","isStatic":false,"isPublic":true},"clearPayoutAddress":{"name":"clearPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false}],"returnType":"this","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Vendor","collectionExportName":"VendorCollection","schema":{"tableName":"vendors","ddl":"CREATE TABLE IF NOT EXISTS \\"vendors\\" (\\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 \\"profile_id\\" UUID,\\n \\"lead_time_days\\" INTEGER DEFAULT 0,\\n \\"minimum_order_amount\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"default_contact_email\\" TEXT DEFAULT '',\\n \\"default_contact_phone\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"payout_addresses\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"lead_time_days":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"minimum_order_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"default_contact_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_contact_phone":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payout_addresses":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"vendors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"vendors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"vendors_profile_id_idx","columns":["profile_id"]}],"version":"1dc2b65e"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingAccount":{"name":"billingaccount","className":"BillingAccount","qualifiedName":"@happyvertical/smrt-commerce:BillingAccount","collection":"billingaccounts","description":"One payer's account with one seller: the commerce Customer invoices are issued to, the provider customer they are pushed to, and the payer's billing terms.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"name":{"type":"text","required":false,"default":""},"email":{"type":"text","required":false,"default":""},"provider":{"type":"text","required":false,"default":""},"providerCustomerId":{"type":"text","required":false,"default":""},"automaticTax":{"type":"boolean","required":false,"default":true},"flatDiscountBasisPoints":{"type":"integer","required":false,"default":0},"paymentTermsDays":{"type":"integer","required":false,"default":30},"standing":{"type":"text","required":false,"default":"current","enum":["current","past_due","uncollectible"]},"billingAnchorAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"prorateFlatPlans":{"type":"boolean","required":false,"default":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_accounts","conflictColumns":["seller_tenant_id","payer_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingAccount","collectionExportName":"BillingAccountCollection","displayLabelField":"name","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"customer_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"email\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"automatic_tax\\" BOOLEAN DEFAULT TRUE,\\n \\"flat_discount_basis_points\\" INTEGER DEFAULT 0,\\n \\"payment_terms_days\\" INTEGER DEFAULT 30,\\n \\"standing\\" TEXT DEFAULT 'current',\\n \\"billing_anchor_at\\" TIMESTAMP,\\n \\"prorate_flat_plans\\" BOOLEAN DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"automatic_tax":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"flat_discount_basis_points":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms_days":{"type":"INTEGER","notNull":false,"unique":false,"default":30},"standing":{"type":"TEXT","notNull":false,"unique":false,"default":"current"},"billing_anchor_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"prorate_flat_plans":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false}},"indexes":[{"name":"_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx","columns":["seller_tenant_id","payer_tenant_id"],"unique":true},{"name":"_smrt_billing_accounts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_accounts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_accounts_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_accounts_customer_id_idx","columns":["customer_id"]}],"version":"58124e47"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPeriodClose":{"name":"billingperiodclose","className":"BillingPeriodClose","qualifiedName":"@happyvertical/smrt-commerce:BillingPeriodClose","collection":"billingperiodcloses","description":"The idempotency anchor for one payer's invoice in one currency for one period. Its id is derived from that identity, so a retried close always resumes the same row, invoice, and provider invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"kind":{"type":"text","required":false,"default":"provider","enum":["provider","reseller"]},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"currency":{"type":"text","required":false,"default":"USD"},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false},"billingAccountId":{"type":"foreignKey","required":false,"related":"BillingAccount"},"status":{"type":"text","required":false,"default":"collecting","enum":["collecting","invoiced","pushed","sent","completed","carried_forward"]},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice"},"providerInvoiceId":{"type":"text","required":false,"default":""},"subtotal":{"type":"integer","required":false,"default":0},"lineCount":{"type":"integer","required":false,"default":0},"issuedAt":{"type":"datetime","required":false},"leaseToken":{"type":"text","required":false,"_meta":{"nullable":true}},"leaseExpiresAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"attempts":{"type":"integer","required":false,"default":0},"lastError":{"type":"text","required":false,"default":""}},"methods":{"runPeriodClose":{"name":"runPeriodClose","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true},"processBillingEvents":{"name":"processBillingEvents","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_billing_period_closes","conflictColumns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingPeriodClose","collectionExportName":"BillingPeriodCloseCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_period_closes","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_period_closes\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT DEFAULT 'provider',\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"billing_account_id\\" UUID,\\n \\"status\\" TEXT DEFAULT 'collecting',\\n \\"invoice_id\\" UUID,\\n \\"provider_invoice_id\\" TEXT DEFAULT '',\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"line_count\\" INTEGER DEFAULT 0,\\n \\"issued_at\\" TIMESTAMP,\\n \\"lease_token\\" TEXT,\\n \\"lease_expires_at\\" TIMESTAMP,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"last_error\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"provider"},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"billing_account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"collecting"},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"provider_invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"line_count":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_error":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"_smrt_billing_period_closes_seller_tenant_id_kind_idx","columns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_period_closes_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_period_closes_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_period_closes_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_period_closes_billing_account_id_idx","columns":["billing_account_id"]},{"name":"_smrt_billing_period_closes_invoice_id_idx","columns":["invoice_id"]}],"version":"753d2e86"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingLineSource":{"name":"billinglinesource","className":"BillingLineSource","qualifiedName":"@happyvertical/smrt-commerce:BillingLineSource","collection":"billinglinesources","description":"A claim that one billable source \u2014 a charge, an adjustment, or a window of a flat plan \u2014 is billed on exactly one period close.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"periodCloseId":{"type":"foreignKey","required":false,"related":"BillingPeriodClose"},"sourceType":{"type":"text","required":false,"default":"client_charge","enum":["client_charge","billing_adjustment","retail_charge","subscription_period","credit_carry_forward"]},"sourceId":{"type":"text","required":false,"default":""},"lineKey":{"type":"text","required":false,"default":""},"lineDescription":{"type":"text","required":false,"default":""},"amount":{"type":"integer","required":false,"default":0},"discount":{"type":"integer","required":false,"default":0},"quantity":{"type":"decimal","required":false,"default":0},"chainSequence":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_line_sources","conflictColumns":["source_type","source_id"],"indexes":[{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["lineKey","chainSequence"]}],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingLineSource","collectionExportName":"BillingLineSourceCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_line_sources","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_line_sources\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"period_close_id\\" UUID,\\n \\"source_type\\" TEXT DEFAULT 'client_charge',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"line_key\\" TEXT DEFAULT '',\\n \\"line_description\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"quantity\\" REAL DEFAULT 0,\\n \\"chain_sequence\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"period_close_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_period_closes","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":"client_charge"},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":0},"chain_sequence":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_billing_line_sources_source_type_source_id_idx","columns":["source_type","source_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_line_sources_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["line_key","chain_sequence"]},{"name":"_smrt_billing_line_sources_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_line_sources_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_line_sources_period_close_id_idx","columns":["period_close_id"]}],"version":"35e3aaa7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPaymentAttempt":{"name":"billingpaymentattempt","className":"BillingPaymentAttempt","qualifiedName":"@happyvertical/smrt-commerce:BillingPaymentAttempt","collection":"billingpaymentattempts","description":"One payment attempt on a payment rail (#3138): a short-lived provider checkout (for example a BTCPay invoice) paying a credit purchase or an issued invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingAccountId":{"type":"text","required":false,"default":""},"purpose":{"type":"text","required":false,"default":"credit_purchase","enum":["credit_purchase","invoice_payment"]},"invoiceId":{"type":"text","required":false,"default":""},"spendingPolicyId":{"type":"text","required":false,"default":""},"provider":{"type":"text","required":false,"default":""},"orderId":{"type":"text","required":false,"default":""},"checkoutId":{"type":"text","required":false,"default":""},"status":{"type":"text","required":false,"default":"open"},"exception":{"type":"text","required":false,"default":"none"},"flag":{"type":"text","required":false,"default":"","enum":["","overpaid","underpaid","paid_late","manually_marked","invalidated_after_settlement","invoice_already_paid","amount_mismatch","out_of_band_without_settlement"]},"amount":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"amountPaid":{"type":"integer","required":false,"default":0},"nativeCurrency":{"type":"text","required":false,"default":""},"nativeAmountDue":{"type":"integer","required":false,"default":0},"nativeAmountPaid":{"type":"integer","required":false,"default":0},"rate":{"type":"text","required":false,"default":""},"rateSource":{"type":"text","required":false,"default":""},"checkoutUrl":{"type":"text","required":false,"default":""},"expiresAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"payments":{"type":"json","required":false,"default":[]},"timeline":{"type":"json","required":false,"default":[]},"settledAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"paymentId":{"type":"text","required":false,"default":""},"creditGrantId":{"type":"text","required":false,"default":""},"resolution":{"type":"text","required":false,"default":""},"resolvedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"outOfBandRequestedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"pausedStanding":{"type":"text","required":false,"default":""},"excessAmount":{"type":"integer","required":false,"default":0},"excessRevision":{"type":"integer","required":false,"default":0},"settlementOutcome":{"type":"text","required":false,"default":""},"refundedAmount":{"type":"integer","required":false,"default":0},"refundedPrincipal":{"type":"integer","required":false,"default":0},"refunds":{"type":"json","required":false,"default":[]}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_payment_attempts","conflictColumns":["provider","checkout_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingPaymentAttempt","collectionExportName":"BillingPaymentAttemptCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_payment_attempts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_payment_attempts\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"billing_account_id\\" TEXT DEFAULT '',\\n \\"purpose\\" TEXT DEFAULT 'credit_purchase',\\n \\"invoice_id\\" TEXT DEFAULT '',\\n \\"spending_policy_id\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"order_id\\" TEXT DEFAULT '',\\n \\"checkout_id\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'open',\\n \\"exception\\" TEXT DEFAULT 'none',\\n \\"flag\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"native_amount_due\\" INTEGER DEFAULT 0,\\n \\"native_amount_paid\\" INTEGER DEFAULT 0,\\n \\"rate\\" TEXT DEFAULT '',\\n \\"rate_source\\" TEXT DEFAULT '',\\n \\"checkout_url\\" TEXT DEFAULT '',\\n \\"expires_at\\" TIMESTAMP,\\n \\"payments\\" JSON DEFAULT '[]',\\n \\"timeline\\" JSON DEFAULT '[]',\\n \\"settled_at\\" TIMESTAMP,\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"credit_grant_id\\" TEXT DEFAULT '',\\n \\"resolution\\" TEXT DEFAULT '',\\n \\"resolved_at\\" TIMESTAMP,\\n \\"out_of_band_requested_at\\" TIMESTAMP,\\n \\"paused_standing\\" TEXT DEFAULT '',\\n \\"excess_amount\\" INTEGER DEFAULT 0,\\n \\"excess_revision\\" INTEGER DEFAULT 0,\\n \\"settlement_outcome\\" TEXT DEFAULT '',\\n \\"refunded_amount\\" INTEGER DEFAULT 0,\\n \\"refunded_principal\\" INTEGER DEFAULT 0,\\n \\"refunds\\" JSON DEFAULT '[]'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_account_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"purpose":{"type":"TEXT","notNull":false,"unique":false,"default":"credit_purchase"},"invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"spending_policy_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"order_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"open"},"exception":{"type":"TEXT","notNull":false,"unique":false,"default":"none"},"flag":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount_due":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"rate":{"type":"TEXT","notNull":false,"unique":false,"default":""},"rate_source":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_url":{"type":"TEXT","notNull":false,"unique":false,"default":""},"expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payments":{"type":"JSON","notNull":false,"unique":false,"default":[]},"timeline":{"type":"JSON","notNull":false,"unique":false,"default":[]},"settled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"credit_grant_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolution":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolved_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"out_of_band_requested_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"paused_standing":{"type":"TEXT","notNull":false,"unique":false,"default":""},"excess_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"excess_revision":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"settlement_outcome":{"type":"TEXT","notNull":false,"unique":false,"default":""},"refunded_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunded_principal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunds":{"type":"JSON","notNull":false,"unique":false,"default":[]}},"indexes":[{"name":"_smrt_billing_payment_attempts_provider_checkout_id_idx","columns":["provider","checkout_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_payment_attempts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_payment_attempts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_payment_attempts_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_payment_attempts_payer_tenant_id_idx","columns":["payer_tenant_id"]}],"version":"43aceca7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingAccountCollection":{"name":"billingaccountcollection","className":"BillingAccountCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingAccountCollection","collection":"billingaccounts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_accounts","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingAccount","exportName":"BillingAccountCollection","collectionExportName":"BillingAccountCollectionCollection","schema":{"tableName":"_smrt_billing_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"customer_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"email\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"automatic_tax\\" BOOLEAN DEFAULT TRUE,\\n \\"flat_discount_basis_points\\" INTEGER DEFAULT 0,\\n \\"payment_terms_days\\" INTEGER DEFAULT 30,\\n \\"standing\\" TEXT DEFAULT 'current',\\n \\"billing_anchor_at\\" TIMESTAMP,\\n \\"prorate_flat_plans\\" BOOLEAN DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"automatic_tax":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"flat_discount_basis_points":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms_days":{"type":"INTEGER","notNull":false,"unique":false,"default":30},"standing":{"type":"TEXT","notNull":false,"unique":false,"default":"current"},"billing_anchor_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"prorate_flat_plans":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false}},"indexes":[{"name":"_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx","columns":["seller_tenant_id","payer_tenant_id"],"unique":true},{"name":"_smrt_billing_accounts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_accounts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_accounts_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_accounts_customer_id_idx","columns":["customer_id"]}],"version":"58124e47"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPeriodCloseCollection":{"name":"billingperiodclosecollection","className":"BillingPeriodCloseCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingPeriodCloseCollection","collection":"billingperiodcloses","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_period_closes","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingPeriodClose","exportName":"BillingPeriodCloseCollection","collectionExportName":"BillingPeriodCloseCollectionCollection","schema":{"tableName":"_smrt_billing_period_closes","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_period_closes\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT DEFAULT 'provider',\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"billing_account_id\\" UUID,\\n \\"status\\" TEXT DEFAULT 'collecting',\\n \\"invoice_id\\" UUID,\\n \\"provider_invoice_id\\" TEXT DEFAULT '',\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"line_count\\" INTEGER DEFAULT 0,\\n \\"issued_at\\" TIMESTAMP,\\n \\"lease_token\\" TEXT,\\n \\"lease_expires_at\\" TIMESTAMP,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"last_error\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"provider"},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"billing_account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"collecting"},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"provider_invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"line_count":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_error":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"_smrt_billing_period_closes_seller_tenant_id_kind_idx","columns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_period_closes_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_period_closes_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_period_closes_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_period_closes_billing_account_id_idx","columns":["billing_account_id"]},{"name":"_smrt_billing_period_closes_invoice_id_idx","columns":["invoice_id"]}],"version":"753d2e86"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingLineSourceCollection":{"name":"billinglinesourcecollection","className":"BillingLineSourceCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingLineSourceCollection","collection":"billinglinesources","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_line_sources","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingLineSource","exportName":"BillingLineSourceCollection","collectionExportName":"BillingLineSourceCollectionCollection","schema":{"tableName":"_smrt_billing_line_sources","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_line_sources\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"period_close_id\\" UUID,\\n \\"source_type\\" TEXT DEFAULT 'client_charge',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"line_key\\" TEXT DEFAULT '',\\n \\"line_description\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"quantity\\" REAL DEFAULT 0,\\n \\"chain_sequence\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"period_close_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_period_closes","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":"client_charge"},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":0},"chain_sequence":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_billing_line_sources_source_type_source_id_idx","columns":["source_type","source_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_line_sources_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["line_key","chain_sequence"]},{"name":"_smrt_billing_line_sources_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_line_sources_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_line_sources_period_close_id_idx","columns":["period_close_id"]}],"version":"35e3aaa7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPaymentAttemptCollection":{"name":"billingpaymentattemptcollection","className":"BillingPaymentAttemptCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingPaymentAttemptCollection","collection":"billingpaymentattempts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_payment_attempts","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingPaymentAttempt","exportName":"BillingPaymentAttemptCollection","collectionExportName":"BillingPaymentAttemptCollectionCollection","schema":{"tableName":"_smrt_billing_payment_attempts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_payment_attempts\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"billing_account_id\\" TEXT DEFAULT '',\\n \\"purpose\\" TEXT DEFAULT 'credit_purchase',\\n \\"invoice_id\\" TEXT DEFAULT '',\\n \\"spending_policy_id\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"order_id\\" TEXT DEFAULT '',\\n \\"checkout_id\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'open',\\n \\"exception\\" TEXT DEFAULT 'none',\\n \\"flag\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"native_amount_due\\" INTEGER DEFAULT 0,\\n \\"native_amount_paid\\" INTEGER DEFAULT 0,\\n \\"rate\\" TEXT DEFAULT '',\\n \\"rate_source\\" TEXT DEFAULT '',\\n \\"checkout_url\\" TEXT DEFAULT '',\\n \\"expires_at\\" TIMESTAMP,\\n \\"payments\\" JSON DEFAULT '[]',\\n \\"timeline\\" JSON DEFAULT '[]',\\n \\"settled_at\\" TIMESTAMP,\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"credit_grant_id\\" TEXT DEFAULT '',\\n \\"resolution\\" TEXT DEFAULT '',\\n \\"resolved_at\\" TIMESTAMP,\\n \\"out_of_band_requested_at\\" TIMESTAMP,\\n \\"paused_standing\\" TEXT DEFAULT '',\\n \\"excess_amount\\" INTEGER DEFAULT 0,\\n \\"excess_revision\\" INTEGER DEFAULT 0,\\n \\"settlement_outcome\\" TEXT DEFAULT '',\\n \\"refunded_amount\\" INTEGER DEFAULT 0,\\n \\"refunded_principal\\" INTEGER DEFAULT 0,\\n \\"refunds\\" JSON DEFAULT '[]'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_account_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"purpose":{"type":"TEXT","notNull":false,"unique":false,"default":"credit_purchase"},"invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"spending_policy_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"order_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"open"},"exception":{"type":"TEXT","notNull":false,"unique":false,"default":"none"},"flag":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount_due":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"rate":{"type":"TEXT","notNull":false,"unique":false,"default":""},"rate_source":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_url":{"type":"TEXT","notNull":false,"unique":false,"default":""},"expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payments":{"type":"JSON","notNull":false,"unique":false,"default":[]},"timeline":{"type":"JSON","notNull":false,"unique":false,"default":[]},"settled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"credit_grant_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolution":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolved_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"out_of_band_requested_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"paused_standing":{"type":"TEXT","notNull":false,"unique":false,"default":""},"excess_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"excess_revision":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"settlement_outcome":{"type":"TEXT","notNull":false,"unique":false,"default":""},"refunded_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunded_principal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunds":{"type":"JSON","notNull":false,"unique":false,"default":[]}},"indexes":[{"name":"_smrt_billing_payment_attempts_provider_checkout_id_idx","columns":["provider","checkout_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_payment_attempts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_payment_attempts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_payment_attempts_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_payment_attempts_payer_tenant_id_idx","columns":["payer_tenant_id"]}],"version":"43aceca7"},"importPath":"@happyvertical/smrt-commerce"}},"moduleType":"smrt","recipes":[{"id":"commerce.customers","className":"CustomersRecipe","label":"Customers","summary":"Keep a list of the customers you sell to.","synonyms":["clients","buyers","accounts"],"models":["@happyvertical/smrt-commerce:Customer"],"nav":[{"label":"Customers","model":"@happyvertical/smrt-commerce:Customer"}],"requires":[],"help":{"markdown":"## Overview\\n\\nCustomers is your address book for the people and businesses you sell to. Keep\\none record for each customer so you can see who they are, how they like to pay\\nand what you have agreed with them, then refer back to them whenever you take an\\norder.\\n\\n## Tasks\\n\\n### Add a new customer\\n\\n1. Choose the **New** button above the list.\\n2. Describe the customer with **{field:customerType}**: a direct shopper, a\\n wholesale buyer or a retail customer. Note in **{field:status}** whether you\\n are still dealing with them.\\n3. Fill in the **{field:defaultShippingAddress}** and\\n **{field:defaultBillingAddress}** so you do not have to type them again on\\n every order.\\n4. Add **{field:paymentTerms}**, for example \\"Net 30\\", if you give this\\n customer time to pay.\\n5. Save. The customer is now on your list and ready to use on a sales order.\\n\\n### Keep track of what a customer can owe\\n\\n1. Open the customer from the list and choose Edit.\\n2. Set **{field:creditLimit}** to the most you are comfortable letting them owe\\n you at one time.\\n3. If you do not charge them sales tax, turn on **{field:taxExempt}**, and keep\\n their tax number on file.\\n4. Use **{field:notes}** for anything the next person who deals with this\\n customer should know.\\n\\n### Find a customer\\n\\nScan the list for the customer you want, or open a record to see everything you\\nhave on file. To stop dealing with someone without losing their history, change\\ntheir **{field:status}** to inactive instead of deleting them.\\n","fieldRefs":["creditLimit","customerType","defaultBillingAddress","defaultShippingAddress","notes","paymentTerms","status","taxExempt"]}},{"id":"commerce.purchases","className":"PurchasesRecipe","label":"Purchases","summary":"Place orders with vendors and track them.","synonyms":["purchase orders","buying","procurement"],"models":["@happyvertical/smrt-commerce:PurchaseOrder"],"nav":[{"label":"Purchase Orders","model":"@happyvertical/smrt-commerce:PurchaseOrder"}],"requires":["commerce.vendors"],"options":{"@happyvertical/smrt-commerce:PurchaseOrder":{"fields":{"contractType":{"default":"purchase_order","visibility":"hidden","locked":true},"customerId":{"visibility":"hidden","locked":true},"vendorId":{"label":"Vendor","order":1}}}},"help":{"markdown":"## Overview\\n\\nPurchases is where you order from your vendors and keep track of what you have\\nbought. Every purchase order belongs to one of your vendors and records the\\namounts, the dates and where the order stands.\\n\\n## Tasks\\n\\n### Place a purchase order\\n\\n1. Choose the **New** button above the list.\\n2. Enter the **{field:vendorId}** you are buying from. Add them under Vendors\\n first so they are on your list.\\n3. Enter the **{field:subtotal}** and **{field:taxAmount}**, then the\\n **{field:totalAmount}** you expect to pay.\\n4. Set the **{field:issueDate}**, and the **{field:dueDate}** for when the\\n goods or the payment are due.\\n5. Add your own **{field:reference}**, such as the vendor's quote number, so\\n you can match it to their paperwork.\\n6. Save.\\n\\n### Follow an order until it arrives\\n\\n1. Open the purchase order from the list and choose Edit.\\n2. Update **{field:status}** as the order moves along, for example from draft to\\n sent, accepted and completed.\\n3. Use **{field:notes}** to record what the vendor told you, such as delays or\\n partial shipments.\\n\\n### Record the agreement\\n\\n1. Open the purchase order and choose Edit.\\n2. Write down the **{field:terms}** you agreed with the vendor, such as payment\\n or delivery conditions.\\n3. Set **{field:expiryDate}** if the vendor's offer is only good until a certain\\n day.\\n","fieldRefs":["dueDate","expiryDate","issueDate","notes","reference","status","subtotal","taxAmount","terms","totalAmount","vendorId"]}},{"id":"commerce.sales","className":"SalesRecipe","label":"Sales","summary":"Take customer orders and track them.","synonyms":["sales orders","orders","customer orders"],"models":["@happyvertical/smrt-commerce:Order"],"nav":[{"label":"Sales Orders","model":"@happyvertical/smrt-commerce:Order"}],"requires":["commerce.customers"],"options":{"@happyvertical/smrt-commerce:Order":{"fields":{"contractType":{"default":"order","visibility":"hidden","locked":true},"vendorId":{"visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1}}}},"help":{"markdown":"## Overview\\n\\nSales is where you take orders from your customers and see where each one\\nstands. Every order belongs to one of your customers, carries its amounts and\\ndates, and keeps a status so you always know what is still open.\\n\\n## Tasks\\n\\n### Take an order\\n\\n1. Choose the **New** button above the list.\\n2. Enter the **{field:customerId}** the order is for. Add them under Customers\\n first so they are on your list.\\n3. Enter the **{field:subtotal}** and **{field:taxAmount}**, then the\\n **{field:totalAmount}** the customer will pay.\\n4. Set the **{field:issueDate}**, and the **{field:dueDate}** if you expect\\n payment by a certain day.\\n5. Add your own **{field:reference}**, such as a purchase order number the\\n customer gave you, so you can find the order later.\\n6. Save.\\n\\n### Follow an order through to the end\\n\\n1. Open the order from the list and choose Edit.\\n2. Update **{field:status}** as the order moves along, for example from draft to\\n sent, accepted and completed.\\n3. Check the **{field:dueDate}** against today to spot orders that are overdue.\\n4. Use **{field:notes}** to record calls, changes and anything promised.\\n\\n### Make a quote with an expiry\\n\\n1. Create the order as usual and set its **{field:status}** to show it is still\\n a draft.\\n2. Set **{field:expiryDate}** to the last day the price is good for.\\n3. Put your conditions, such as deposits or delivery, in **{field:terms}**.\\n","fieldRefs":["customerId","dueDate","expiryDate","issueDate","notes","reference","status","subtotal","taxAmount","terms","totalAmount"]}},{"id":"commerce.vendors","className":"VendorsRecipe","label":"Vendors","summary":"Keep a list of the vendors and suppliers you buy from.","synonyms":["suppliers","sellers"],"models":["@happyvertical/smrt-commerce:Vendor"],"nav":[{"label":"Vendors","model":"@happyvertical/smrt-commerce:Vendor"}],"requires":[],"help":{"markdown":"## Overview\\n\\nVendors is your list of the suppliers you buy from. Each record holds who they\\nare, how to reach them and the terms you have agreed, so you can order from them\\nquickly and keep track of what you have bought.\\n\\n## Tasks\\n\\n### Add a vendor\\n\\n1. Choose the **New** button above the list.\\n2. Enter **{field:defaultContactEmail}** and **{field:defaultContactPhone}** for\\n the person you normally deal with.\\n3. Set the **{field:currency}** they bill you in and your **{field:paymentTerms}**,\\n for example \\"Net 30\\".\\n4. Save. The vendor is now on your list and ready to use on a purchase order.\\n\\n### Note how a vendor likes to work\\n\\n1. Open the vendor from the list and choose Edit.\\n2. Enter **{field:leadTimeDays}**, the number of days they usually need between\\n your order and delivery, so you can plan ahead.\\n3. Enter **{field:minimumOrderAmount}** if they will not accept small orders.\\n4. Use **{field:notes}** for anything else worth remembering, such as the best\\n time to call.\\n\\n### Keep payment details in one place\\n\\n1. Open the vendor and choose Edit.\\n2. Record where payments to this vendor should be sent, so it is all in one\\n place.\\n3. Set **{field:status}** to show whether you still buy from them: active,\\n inactive or suspended.\\n","fieldRefs":["currency","defaultContactEmail","defaultContactPhone","leadTimeDays","minimumOrderAmount","notes","paymentTerms","status"]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-ledgers","@happyvertical/smrt-subscriptions","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
27
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-commerce","packageVersion":"0.55.9","objects":{"@happyvertical/smrt-commerce:ContractCollection":{"name":"contractcollection","className":"ContractCollection","qualifiedName":"@happyvertical/smrt-commerce:ContractCollection","collection":"contracts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/ContractCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByVendor":{"name":"findByVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"contractType","type":"ContractType","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"ContractStatus","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findAccepted":{"name":"findAccepted","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findOverdue":{"name":"findOverdue","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findExpired":{"name":"findExpired","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Contract[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Contract","exportName":"ContractCollection","collectionExportName":"ContractCollectionCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"9c2e9c49"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ContractLineItemCollection":{"name":"contractlineitemcollection","className":"ContractLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:ContractLineItemCollection","collection":"contractlineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/ContractLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<ContractLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"ContractLineItem","exportName":"ContractLineItemCollection","collectionExportName":"ContractLineItemCollectionCollection","schema":{"tableName":"contract_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"contract_line_items\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"product_id\\" UUID,\\n \\"sku\\" TEXT DEFAULT '',\\n \\"start_date\\" TIMESTAMP,\\n \\"end_date\\" TIMESTAMP,\\n \\"billing_period\\" TEXT DEFAULT '',\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"default":""},"quantity":{"type":"REAL","notNull":false,"default":1},"unit_price":{"type":"INTEGER","notNull":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"default":0},"product_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"sku":{"type":"TEXT","notNull":false,"default":""},"start_date":{"type":"TIMESTAMP","notNull":false},"end_date":{"type":"TIMESTAMP","notNull":false},"billing_period":{"type":"TEXT","notNull":false,"default":""},"sort_order":{"type":"INTEGER","notNull":false,"default":0}},"indexes":[{"name":"contract_line_items_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contract_line_items_meta_type_idx","columns":["_meta_type"]},{"name":"contract_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contract_line_items_contract_id_idx","columns":["contract_id"]},{"name":"contract_line_items_product_id_idx","columns":["product_id"]}],"version":"be2b46cd"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:CustomerCollection":{"name":"customercollection","className":"CustomerCollection","qualifiedName":"@happyvertical/smrt-commerce:CustomerCollection","collection":"customers","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/CustomerCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByProfile":{"name":"findByProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"CustomerStatus","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"getOrCreateForProfile":{"name":"getOrCreateForProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["number","string"]}],"returnType":"Promise<Customer>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Customer[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Customer","exportName":"CustomerCollection","collectionExportName":"CustomerCollectionCollection","schema":{"tableName":"customers","ddl":"CREATE TABLE IF NOT EXISTS \\"customers\\" (\\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 \\"profile_id\\" UUID,\\n \\"credit_limit\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"tax_exempt\\" BOOLEAN DEFAULT FALSE,\\n \\"tax_id\\" TEXT DEFAULT '',\\n \\"default_shipping_address\\" JSON,\\n \\"default_billing_address\\" JSON,\\n \\"status\\" TEXT,\\n \\"customer_type\\" TEXT,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"credit_limit":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"tax_exempt":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"tax_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_shipping_address":{"type":"JSON","notNull":false,"unique":false},"default_billing_address":{"type":"JSON","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"customer_type":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"customers_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"customers_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"customers_profile_id_idx","columns":["profile_id"]}],"version":"ad1b9967"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentCollection":{"name":"fulfillmentcollection","className":"FulfillmentCollection","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentCollection","collection":"fulfillments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/FulfillmentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"FulfillmentStatus","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByType":{"name":"findByType","async":true,"parameters":[{"name":"fulfillmentType","type":"FulfillmentType","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findInTransit":{"name":"findInTransit","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByTracking":{"name":"findByTracking","async":true,"parameters":[{"name":"trackingNumber","type":"string","optional":false}],"returnType":"Promise<Fulfillment | null>","isStatic":false,"isPublic":true},"findShippedInRange":{"name":"findShippedInRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Fulfillment[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Fulfillment","exportName":"FulfillmentCollection","collectionExportName":"FulfillmentCollectionCollection","schema":{"tableName":"fulfillments","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillments\\" (\\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 \\"contract_id\\" UUID,\\n \\"fulfillment_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"tracking_number\\" TEXT DEFAULT '',\\n \\"carrier\\" TEXT DEFAULT '',\\n \\"shipping_address\\" JSON,\\n \\"shipped_at\\" TIMESTAMP,\\n \\"delivered_at\\" TIMESTAMP,\\n \\"estimated_delivery\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"fulfillment_type":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"tracking_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"carrier":{"type":"TEXT","notNull":false,"unique":false,"default":""},"shipping_address":{"type":"JSON","notNull":false,"unique":false},"shipped_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"delivered_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"estimated_delivery":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillments_contract_id_idx","columns":["contract_id"]}],"version":"2f708fc5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentLineItemCollection":{"name":"fulfillmentlineitemcollection","className":"FulfillmentLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentLineItemCollection","collection":"fulfillmentlineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/FulfillmentLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByFulfillment":{"name":"findByFulfillment","async":true,"parameters":[{"name":"fulfillmentId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findByContractLineItem":{"name":"findByContractLineItem","async":true,"parameters":[{"name":"contractLineItemId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"getTotalFulfilledForContractLine":{"name":"getTotalFulfilledForContractLine","async":true,"parameters":[{"name":"contractLineItemId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<FulfillmentLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"FulfillmentLineItem","exportName":"FulfillmentLineItemCollection","collectionExportName":"FulfillmentLineItemCollectionCollection","schema":{"tableName":"fulfillment_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillment_line_items\\" (\\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 \\"fulfillment_id\\" UUID,\\n \\"contract_line_item_id\\" UUID,\\n \\"quantity_fulfilled\\" REAL DEFAULT 1,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"fulfillment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"fulfillments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_line_item_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contract_line_items","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"quantity_fulfilled":{"type":"REAL","notNull":false,"unique":false,"default":1},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillment_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillment_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillment_line_items_fulfillment_id_idx","columns":["fulfillment_id"]},{"name":"fulfillment_line_items_contract_line_item_id_idx","columns":["contract_line_item_id"]}],"version":"14537dbe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceCollection":{"name":"invoicecollection","className":"InvoiceCollection","qualifiedName":"@happyvertical/smrt-commerce:InvoiceCollection","collection":"invoices","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/InvoiceCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"InvoiceStatus","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findDrafts":{"name":"findDrafts","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findSent":{"name":"findSent","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findPaid":{"name":"findPaid","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findPartial":{"name":"findPartial","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findOverdue":{"name":"findOverdue","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByExternalId":{"name":"findByExternalId","async":true,"parameters":[{"name":"externalId","type":"string","optional":false}],"returnType":"Promise<Invoice | null>","isStatic":false,"isPublic":true},"findNeedingSync":{"name":"findNeedingSync","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findByNumber":{"name":"findByNumber","async":true,"parameters":[{"name":"invoiceNumber","type":"string","optional":false}],"returnType":"Promise<Invoice | null>","isStatic":false,"isPublic":true},"countForYear":{"name":"countForYear","async":true,"parameters":[{"name":"year","type":"number","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"generateInvoiceNumber":{"name":"generateInvoiceNumber","async":true,"parameters":[{"name":"options","type":"InvoiceNumberOptions","optional":true}],"returnType":"Promise<string>","isStatic":false,"isPublic":true},"getTotalOutstandingForCustomer":{"name":"getTotalOutstandingForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Invoice[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Invoice","exportName":"InvoiceCollection","collectionExportName":"InvoiceCollectionCollection","schema":{"tableName":"invoices","ddl":"CREATE TABLE IF NOT EXISTS \\"invoices\\" (\\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 \\"customer_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"invoice_number\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"paid_date\\" TIMESTAMP,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"provider_tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'CAD',\\n \\"status\\" TEXT,\\n \\"ar_journal_id\\" UUID,\\n \\"revenue_journal_id\\" UUID,\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"customer_external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"collection_method\\" TEXT DEFAULT '',\\n \\"sent_at\\" TIMESTAMP,\\n \\"viewed_at\\" TIMESTAMP,\\n \\"reminders_sent\\" INTEGER DEFAULT 0,\\n \\"last_reminder_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"customer_notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"issue_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"due_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"paid_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"provider_tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"CAD"},"status":{"type":"TEXT","notNull":false,"unique":false},"ar_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"revenue_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"collection_method":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"viewed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"reminders_sent":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_reminder_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"terms":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"invoices_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoices_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoices_customer_id_idx","columns":["customer_id"]},{"name":"invoices_contract_id_idx","columns":["contract_id"]},{"name":"invoices_ar_journal_id_idx","columns":["ar_journal_id"]},{"name":"invoices_revenue_journal_id_idx","columns":["revenue_journal_id"]}],"version":"e7573840"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceLineItemCollection":{"name":"invoicelineitemcollection","className":"InvoiceLineItemCollection","qualifiedName":"@happyvertical/smrt-commerce:InvoiceLineItemCollection","collection":"invoicelineitems","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/InvoiceLineItemCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByInvoice":{"name":"findByInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findBySource":{"name":"findBySource","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false},{"name":"sourceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findBySourceType":{"name":"findBySourceType","async":true,"parameters":[{"name":"sourceType","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"getTotalForInvoice":{"name":"getTotalForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getSubtotalForInvoice":{"name":"getSubtotalForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTaxForInvoice":{"name":"getTaxForInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getNextSortOrder":{"name":"getNextSortOrder","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"recalculateAmounts":{"name":"recalculateAmounts","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"toAccountingLineItems":{"name":"toAccountingLineItems","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<AccountingLineItemInput[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<InvoiceLineItem[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"InvoiceLineItem","exportName":"InvoiceLineItemCollection","collectionExportName":"InvoiceLineItemCollectionCollection","schema":{"tableName":"invoice_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"invoice_line_items\\" (\\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 \\"invoice_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"sku\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"invoice_editor_state_json\\" TEXT DEFAULT '',\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"revenue_account_id\\" UUID,\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sku":{"type":"TEXT","notNull":false,"unique":false,"default":""},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":1},"invoice_editor_state_json":{"type":"TEXT","notNull":false,"unique":false,"default":""},"unit_price":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"unique":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"revenue_account_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"invoice_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoice_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoice_line_items_invoice_id_idx","columns":["invoice_id"]},{"name":"invoice_line_items_revenue_account_id_idx","columns":["revenue_account_id"]}],"version":"6d388b43"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentAllocationCollection":{"name":"paymentallocationcollection","className":"PaymentAllocationCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentAllocationCollection","collection":"paymentallocations","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentAllocationCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByPayment":{"name":"findByPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByInvoice":{"name":"findByInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"getTotalAllocatedToInvoice":{"name":"getTotalAllocatedToInvoice","async":true,"parameters":[{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getTotalAllocatedFromPayment":{"name":"getTotalAllocatedFromPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"getUnallocatedFromPayment":{"name":"getUnallocatedFromPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false},{"name":"paymentAmount","type":"number","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByPaymentAndInvoice":{"name":"findByPaymentAndInvoice","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false},{"name":"invoiceId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation | null>","isStatic":false,"isPublic":true},"findByAllocator":{"name":"findByAllocator","async":true,"parameters":[{"name":"allocatedBy","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentAllocation[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentAllocation","exportName":"PaymentAllocationCollection","collectionExportName":"PaymentAllocationCollectionCollection","schema":{"tableName":"payment_allocations","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_allocations\\" (\\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 \\"payment_id\\" UUID,\\n \\"invoice_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"allocated_at\\" TIMESTAMP,\\n \\"allocated_by\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"payments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"allocated_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"allocated_by":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_allocations_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_allocations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_allocations_payment_id_idx","columns":["payment_id"]},{"name":"payment_allocations_invoice_id_idx","columns":["invoice_id"]}],"version":"102e6fbc"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentCollection":{"name":"paymentcollection","className":"PaymentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentCollection","collection":"payments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByContract":{"name":"findByContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PaymentStatus","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByMethod":{"name":"findByMethod","async":true,"parameters":[{"name":"method","type":"PaymentMethod","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findCompleted":{"name":"findCompleted","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findByTransactionId":{"name":"findByTransactionId","async":true,"parameters":[{"name":"transactionId","type":"string","optional":false}],"returnType":"Promise<Payment | null>","isStatic":false,"isPublic":true},"findByDateRange":{"name":"findByDateRange","async":true,"parameters":[{"name":"startDate","type":"Date","optional":false},{"name":"endDate","type":"Date","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"getTotalForContract":{"name":"getTotalForContract","async":true,"parameters":[{"name":"contractId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByJournal":{"name":"findByJournal","async":true,"parameters":[{"name":"journalId","type":"string","optional":false}],"returnType":"Promise<Payment | null>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payment[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Payment","exportName":"PaymentCollection","collectionExportName":"PaymentCollectionCollection","schema":{"tableName":"payments","ddl":"CREATE TABLE IF NOT EXISTS \\"payments\\" (\\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 \\"contract_id\\" UUID,\\n \\"customer_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"method\\" TEXT,\\n \\"status\\" TEXT,\\n \\"transaction_id\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"journal_id\\" UUID,\\n \\"paid_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"native_amount\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"usd_at_quote\\" INTEGER DEFAULT 0,\\n \\"usd_at_confirmation\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"method":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"transaction_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"usd_at_quote":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"usd_at_confirmation":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"payments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payments_contract_id_idx","columns":["contract_id"]},{"name":"payments_customer_id_idx","columns":["customer_id"]},{"name":"payments_journal_id_idx","columns":["journal_id"]}],"version":"33f80e50"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentInstrumentCollection":{"name":"paymentinstrumentcollection","className":"PaymentInstrumentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentInstrumentCollection","collection":"paymentinstruments","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentInstrumentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByCustomer":{"name":"findByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findActiveByCustomer":{"name":"findActiveByCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findDefaultForCustomer":{"name":"findDefaultForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument | null>","isStatic":false,"isPublic":true},"findByProviderPaymentMethodId":{"name":"findByProviderPaymentMethodId","async":true,"parameters":[{"name":"providerPaymentMethodId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument | null>","isStatic":false,"isPublic":true},"setDefaultForCustomer":{"name":"setDefaultForCustomer","async":true,"parameters":[{"name":"customerId","type":"string","optional":false},{"name":"instrumentId","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentInstrument[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentInstrument","exportName":"PaymentInstrumentCollection","collectionExportName":"PaymentInstrumentCollectionCollection","schema":{"tableName":"payment_instruments","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_instruments\\" (\\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 \\"customer_id\\" UUID,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"provider_payment_method_id\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'card',\\n \\"brand\\" TEXT DEFAULT '',\\n \\"last4\\" TEXT DEFAULT '',\\n \\"exp_month\\" INTEGER DEFAULT 0,\\n \\"exp_year\\" INTEGER DEFAULT 0,\\n \\"is_default\\" BOOLEAN DEFAULT FALSE,\\n \\"status\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_payment_method_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"card"},"brand":{"type":"TEXT","notNull":false,"unique":false,"default":""},"last4":{"type":"TEXT","notNull":false,"unique":false,"default":""},"exp_month":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"exp_year":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"is_default":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"status":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"payment_instruments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_instruments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_instruments_customer_id_idx","columns":["customer_id"]}],"version":"722393fe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentIntentCollection":{"name":"paymentintentcollection","className":"PaymentIntentCollection","qualifiedName":"@happyvertical/smrt-commerce:PaymentIntentCollection","collection":"paymentintents","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PaymentIntentCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByIdempotencyKey":{"name":"findByIdempotencyKey","async":true,"parameters":[{"name":"args","type":"PaymentIntentIdempotencyArgs","optional":false}],"returnType":"Promise<PaymentIntent | null>","isStatic":false,"isPublic":true},"getOrCreateByIdempotencyKey":{"name":"getOrCreateByIdempotencyKey","async":true,"parameters":[{"name":"seed","type":"PaymentIntentSeed","optional":false}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"findOpen":{"name":"findOpen","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findStale":{"name":"findStale","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByLicenseeEmail":{"name":"findByLicenseeEmail","async":true,"parameters":[{"name":"email","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByOfferingRef":{"name":"findByOfferingRef","async":true,"parameters":[{"name":"offeringRef","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PaymentIntentStatus","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<PaymentIntent[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"PaymentIntent","exportName":"PaymentIntentCollection","collectionExportName":"PaymentIntentCollectionCollection","schema":{"tableName":"payment_intents","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_intents\\" (\\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 \\"sku_id\\" TEXT DEFAULT '',\\n \\"offering_ref\\" TEXT DEFAULT '',\\n \\"licensee_email\\" TEXT DEFAULT '',\\n \\"customer_id\\" TEXT DEFAULT '',\\n \\"payment_options\\" JSON DEFAULT '[]',\\n \\"usd_price_locked\\" INTEGER DEFAULT 0,\\n \\"price_lock_window_ms\\" INTEGER,\\n \\"price_lock_expires_at\\" TIMESTAMP,\\n \\"status\\" TEXT,\\n \\"idempotency_key\\" TEXT DEFAULT '',\\n \\"paid_option_backend_id\\" TEXT DEFAULT '',\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"paid_at\\" TIMESTAMP,\\n \\"issued_at\\" TIMESTAMP,\\n \\"expired_at\\" TIMESTAMP,\\n \\"cancelled_at\\" TIMESTAMP,\\n \\"retired_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"offering_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"licensee_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_options":{"type":"JSON","notNull":false,"unique":false,"default":[]},"usd_price_locked":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"price_lock_window_ms":{"type":"INTEGER","notNull":false,"unique":false},"price_lock_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"idempotency_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_option_backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"expired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"cancelled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"retired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_intents_tenant_id_offering_ref_idx","columns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"unique":true,"nullsNotDistinct":true},{"name":"payment_intents_slug_context_idx","columns":["slug","context"]},{"name":"payment_intents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"c565aaef"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PayoutCollection":{"name":"payoutcollection","className":"PayoutCollection","qualifiedName":"@happyvertical/smrt-commerce:PayoutCollection","collection":"payouts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/PayoutCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"createFromPayment":{"name":"createFromPayment","async":true,"parameters":[{"name":"args","type":"CreatePayoutFromPaymentArgs","optional":false}],"returnType":"Promise<Payout>","isStatic":false,"isPublic":true},"findByPayment":{"name":"findByPayment","async":true,"parameters":[{"name":"paymentId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByVendor":{"name":"findByVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"PayoutStatus","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findPending":{"name":"findPending","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findFailed":{"name":"findFailed","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findByBackendTxRef":{"name":"findByBackendTxRef","async":true,"parameters":[{"name":"backendTxRef","type":"string","optional":false}],"returnType":"Promise<Payout | null>","isStatic":false,"isPublic":true},"getConfirmedTotalForVendor":{"name":"getConfirmedTotalForVendor","async":true,"parameters":[{"name":"vendorId","type":"string","optional":false}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Payout[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Payout","exportName":"PayoutCollection","collectionExportName":"PayoutCollectionCollection","schema":{"tableName":"payouts","ddl":"CREATE TABLE IF NOT EXISTS \\"payouts\\" (\\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 \\"payment_id\\" TEXT DEFAULT '',\\n \\"vendor_id\\" UUID,\\n \\"gross_amount\\" INTEGER DEFAULT 0,\\n \\"operator_fee\\" INTEGER DEFAULT 0,\\n \\"supplier_net\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT '',\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"sent_at\\" TIMESTAMP,\\n \\"confirmed_at\\" TIMESTAMP,\\n \\"failed_at\\" TIMESTAMP,\\n \\"failure_reason\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"gross_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"operator_fee":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"supplier_net":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"confirmed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failure_reason":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payouts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payouts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payouts_vendor_id_idx","columns":["vendor_id"]}],"version":"98fa81d5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:VendorCollection":{"name":"vendorcollection","className":"VendorCollection","qualifiedName":"@happyvertical/smrt-commerce:VendorCollection","collection":"vendors","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/collections/VendorCollection.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{"findByProfile":{"name":"findByProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findActive":{"name":"findActive","async":true,"parameters":[],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findByStatus":{"name":"findByStatus","async":true,"parameters":[{"name":"status","type":"VendorStatus","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"getOrCreateForProfile":{"name":"getOrCreateForProfile","async":true,"parameters":[{"name":"profileId","type":"string","optional":false},{"name":"defaults","type":"Partial<object>","optional":true,"memberTypes":["number","string"]}],"returnType":"Promise<Vendor>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Vendor[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Vendor","exportName":"VendorCollection","collectionExportName":"VendorCollectionCollection","schema":{"tableName":"vendors","ddl":"CREATE TABLE IF NOT EXISTS \\"vendors\\" (\\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 \\"profile_id\\" UUID,\\n \\"lead_time_days\\" INTEGER DEFAULT 0,\\n \\"minimum_order_amount\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"default_contact_email\\" TEXT DEFAULT '',\\n \\"default_contact_phone\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"payout_addresses\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"lead_time_days":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"minimum_order_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"default_contact_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_contact_phone":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payout_addresses":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"vendors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"vendors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"vendors_profile_id_idx","columns":["profile_id"]}],"version":"1dc2b65e"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Contract":{"name":"contract","className":"Contract","qualifiedName":"@happyvertical/smrt-commerce:Contract","collection":"contracts","description":"Contract is the base class for all commercial agreements.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"Contract","collectionExportName":"ContractCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"9c2e9c49"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Estimate":{"name":"estimate","className":"Estimate","qualifiedName":"@happyvertical/smrt-commerce:Estimate","collection":"contracts","description":"Quote or proposal for a customer","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Estimate","collectionExportName":"EstimateCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"2f1624b2"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Order":{"name":"order","className":"Order","qualifiedName":"@happyvertical/smrt-commerce:Order","collection":"contracts","description":"Customer purchase order","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Order","collectionExportName":"OrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"b7667cf3"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Lease":{"name":"lease","className":"Lease","qualifiedName":"@happyvertical/smrt-commerce:Lease","collection":"contracts","description":"Rental or lease agreement","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Lease","collectionExportName":"LeaseCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"b24cdace"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Agreement":{"name":"agreement","className":"Agreement","qualifiedName":"@happyvertical/smrt-commerce:Agreement","collection":"contracts","description":"Service or maintenance agreement","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Agreement","collectionExportName":"AgreementCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"28f0c394"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PurchaseOrder":{"name":"purchaseorder","className":"PurchaseOrder","qualifiedName":"@happyvertical/smrt-commerce:PurchaseOrder","collection":"contracts","description":"Order sent to vendor/supplier","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"PurchaseOrder","collectionExportName":"PurchaseOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"91ec64bb"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:WholesaleOrder":{"name":"wholesaleorder","className":"WholesaleOrder","qualifiedName":"@happyvertical/smrt-commerce:WholesaleOrder","collection":"contracts","description":"B2B order placed by a wholesale customer.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"WholesaleOrder","collectionExportName":"WholesaleOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"ccb8a3ae"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ProductionOrder":{"name":"productionorder","className":"ProductionOrder","qualifiedName":"@happyvertical/smrt-commerce:ProductionOrder","collection":"contracts","description":"Instruction to commission goods from an internal or external factory.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}},"productId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"bomId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"ProductionOrder","collectionExportName":"ProductionOrderCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"c6b977a5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Cart":{"name":"cart","className":"Cart","qualifiedName":"@happyvertical/smrt-commerce:Cart","collection":"contracts","description":"Transient order-in-progress for a shopper.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"Cart","collectionExportName":"CartCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"fba16d4f"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:LicenseSale":{"name":"licensesale","className":"LicenseSale","qualifiedName":"@happyvertical/smrt-commerce:LicenseSale","collection":"contracts","description":"Industry-neutral licensing primitive.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Contract.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractType":{"type":"text","required":false,"description":"The kind of contract: order, estimate, lease, agreement and so on.","_meta":{"description":"The kind of contract: order, estimate, lease, agreement and so on."},"enum":["estimate","order","lease","agreement","purchase_order","wholesale_order","production_order","cart","license_sale"]},"status":{"type":"text","required":false,"description":"Where the order or agreement stands, for example draft, sent, accepted or completed.","_meta":{"description":"Where the order or agreement stands, for example draft, sent, accepted or completed."},"enum":["draft","sent","accepted","declined","completed","cancelled"]},"customerId":{"type":"foreignKey","required":false,"related":"Customer","_meta":{"description":"The customer a sales order or agreement is for."}},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor","_meta":{"description":"The vendor a purchase order is placed with."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"totalAmount":{"type":"integer","required":false,"default":0,"description":"The full amount, tax included.","_meta":{"description":"The full amount, tax included."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the amounts.","_meta":{"description":"The currency of the amounts.","ui":{"widget":"currency"}}},"issueDate":{"type":"datetime","required":false,"description":"The date it was issued or placed.","_meta":{"description":"The date it was issued or placed."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment or delivery is due.","_meta":{"description":"The date payment or delivery is due."}},"expiryDate":{"type":"datetime","required":false,"description":"The last day the price or offer is good for.","_meta":{"description":"The last day the price or offer is good for."}},"reference":{"type":"text","required":false,"default":"","description":"Your own number or note for finding this later, such as a purchase order or quote number.","_meta":{"description":"Your own number or note for finding this later, such as a purchase order or quote number."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this.","_meta":{"description":"Anything worth remembering about this.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The conditions agreed, such as deposits, payment or delivery conditions.","_meta":{"description":"The conditions agreed, such as deposits, payment or delivery conditions.","ui":{"widget":"textarea"}}},"channelId":{"type":"text","required":false,"default":"","description":"Where it came from, for example your shop, a marketplace or a phone call.","_meta":{"description":"Where it came from, for example your shop, a marketplace or a phone call."}},"skuId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"paymentId":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeEmail":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeLegalEntity":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"licenseeJurisdiction":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsMedium":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsDistributionScope":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsExclusivity":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsDuration":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsTerritory":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"rightsSublicensing":{"type":"meta","required":false,"default":false,"_meta":{"underlyingType":"boolean"}},"rightsDerivatives":{"type":"meta","required":false,"default":false,"_meta":{"underlyingType":"boolean"}},"pdfUrl":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"pdfHash":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}},"onChainHashRegistryRef":{"type":"meta","required":false,"default":"","_meta":{"underlyingType":"text"}}},"methods":{"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isAccepted":{"name":"isAccepted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recalculateTotals":{"name":"recalculateTotals","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"getRightsSnapshot":{"name":"getRightsSnapshot","async":false,"parameters":[],"returnType":"LicenseRightsSnapshot","isStatic":false,"isPublic":true},"revoke":{"name":"revoke","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"tenantScoped":{"mode":"optional"},"tableName":"contracts","tableStrategy":"sti"},"extends":"Contract","exportName":"LicenseSale","collectionExportName":"LicenseSaleCollection","schema":{"tableName":"contracts","ddl":"CREATE TABLE IF NOT EXISTS \\"contracts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"customer_id\\" UUID,\\n \\"vendor_id\\" UUID,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"expiry_date\\" TIMESTAMP,\\n \\"reference\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT '',\\n \\"channel_id\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_type":{"type":"TEXT","notNull":false},"status":{"type":"TEXT","notNull":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"subtotal":{"type":"INTEGER","notNull":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"default":0},"currency":{"type":"TEXT","notNull":false,"default":"USD"},"issue_date":{"type":"TIMESTAMP","notNull":false},"due_date":{"type":"TIMESTAMP","notNull":false},"expiry_date":{"type":"TIMESTAMP","notNull":false},"reference":{"type":"TEXT","notNull":false,"default":""},"notes":{"type":"TEXT","notNull":false,"default":""},"terms":{"type":"TEXT","notNull":false,"default":""},"channel_id":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"contracts_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contracts_meta_type_idx","columns":["_meta_type"]},{"name":"contracts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contracts_customer_id_idx","columns":["customer_id"]},{"name":"contracts_vendor_id_idx","columns":["vendor_id"]}],"version":"d6d82bad"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:ContractLineItem":{"name":"contractlineitem","className":"ContractLineItem","qualifiedName":"@happyvertical/smrt-commerce:ContractLineItem","collection":"contractlineitems","description":"ContractLineItem represents a single line item on a contract.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/ContractLineItem.ts","packageName":"@happyvertical/smrt-commerce","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract","description":"The order, quote or agreement this line belongs to.","_meta":{"description":"The order, quote or agreement this line belongs to."}},"description":{"type":"text","required":false,"default":"","description":"What is being sold or bought on this line.","_meta":{"description":"What is being sold or bought on this line."}},"quantity":{"type":"decimal","required":false,"default":1,"description":"How many.","_meta":{"description":"How many."}},"unitPrice":{"type":"integer","required":false,"default":0,"description":"The price of one, before tax.","_meta":{"description":"The price of one, before tax."}},"discount":{"type":"integer","required":false,"default":0},"taxRate":{"type":"decimal","required":false,"default":0,"description":"The tax rate for this line, as a percentage (5 means 5%).","_meta":{"description":"The tax rate for this line, as a percentage (5 means 5%)."}},"amount":{"type":"integer","required":false,"default":0,"description":"The line total.","_meta":{"description":"The line total."}},"productId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-products:Product","description":"The product this line is for, if it is one you list.","_meta":{"description":"The product this line is for, if it is one you list."}},"sku":{"type":"text","required":false,"default":""},"startDate":{"type":"datetime","required":false},"endDate":{"type":"datetime","required":false},"billingPeriod":{"type":"text","required":false,"default":""},"sortOrder":{"type":"integer","required":false,"default":0}},"methods":{"calculateAmount":{"name":"calculateAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"isRecurring":{"name":"isRecurring","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSubscriptionActive":{"name":"isSubscriptionActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"ContractLineItem","collectionExportName":"ContractLineItemCollection","schema":{"tableName":"contract_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"contract_line_items\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"product_id\\" UUID,\\n \\"sku\\" TEXT DEFAULT '',\\n \\"start_date\\" TIMESTAMP,\\n \\"end_date\\" TIMESTAMP,\\n \\"billing_period\\" TEXT DEFAULT '',\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"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},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"default":""},"quantity":{"type":"REAL","notNull":false,"default":1},"unit_price":{"type":"INTEGER","notNull":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"default":0},"product_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"sku":{"type":"TEXT","notNull":false,"default":""},"start_date":{"type":"TIMESTAMP","notNull":false},"end_date":{"type":"TIMESTAMP","notNull":false},"billing_period":{"type":"TEXT","notNull":false,"default":""},"sort_order":{"type":"INTEGER","notNull":false,"default":0}},"indexes":[{"name":"contract_line_items_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"contract_line_items_meta_type_idx","columns":["_meta_type"]},{"name":"contract_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"contract_line_items_contract_id_idx","columns":["contract_id"]},{"name":"contract_line_items_product_id_idx","columns":["product_id"]}],"version":"be2b46cd"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Customer":{"name":"customer","className":"Customer","qualifiedName":"@happyvertical/smrt-commerce:Customer","collection":"customers","description":"Customer represents the customer role for a Profile.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Customer.ts","packageName":"@happyvertical/smrt-commerce","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}}},"profileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","_meta":{"description":"Links this customer to their profile record, where their name and contact details are kept."}},"creditLimit":{"type":"integer","required":false,"default":0,"description":"The most this customer may owe you at one time. Leave it at zero if you do not set limits.","_meta":{"description":"The most this customer may owe you at one time. Leave it at zero if you do not set limits."}},"paymentTerms":{"type":"text","required":false,"default":"","description":"How long the customer has to pay, written the way you would say it, for example \\"Net 30\\".","_meta":{"description":"How long the customer has to pay, written the way you would say it, for example \\"Net 30\\"."}},"taxExempt":{"type":"boolean","required":false,"default":false,"description":"Turn this on if you do not charge this customer sales tax.","_meta":{"description":"Turn this on if you do not charge this customer sales tax."}},"taxId":{"type":"text","required":false,"default":"","description":"The tax or VAT number of the customer, kept on file for tax-exempt sales.","_meta":{"sensitive":true,"description":"The tax or VAT number of the customer, kept on file for tax-exempt sales."},"sensitive":true},"defaultShippingAddress":{"type":"json","required":false,"description":"Where you usually send goods to this customer, so you do not retype it on every order.","_meta":{"description":"Where you usually send goods to this customer, so you do not retype it on every order."}},"defaultBillingAddress":{"type":"json","required":false,"description":"Where you send invoices to this customer.","_meta":{"description":"Where you send invoices to this customer."}},"status":{"type":"text","required":false,"description":"Whether you are still dealing with this customer: active, inactive or suspended.","_meta":{"description":"Whether you are still dealing with this customer: active, inactive or suspended."},"enum":["active","inactive","suspended"]},"customerType":{"type":"text","required":false,"description":"The kind of customer: a direct shopper, a wholesale buyer or a retail customer.","_meta":{"description":"The kind of customer: a direct shopper, a wholesale buyer or a retail customer."},"enum":["dtc","wholesale","retail"]},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this customer.","_meta":{"description":"Anything worth remembering about this customer.","ui":{"widget":"textarea"}}}},"methods":{"isWholesale":{"name":"isWholesale","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"hasAvailableCredit":{"name":"hasAvailableCredit","async":false,"parameters":[{"name":"amount","type":"number","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getProfileId":{"name":"getProfileId","async":false,"parameters":[],"returnType":"string","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Customer","collectionExportName":"CustomerCollection","schema":{"tableName":"customers","ddl":"CREATE TABLE IF NOT EXISTS \\"customers\\" (\\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 \\"profile_id\\" UUID,\\n \\"credit_limit\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"tax_exempt\\" BOOLEAN DEFAULT FALSE,\\n \\"tax_id\\" TEXT DEFAULT '',\\n \\"default_shipping_address\\" JSON,\\n \\"default_billing_address\\" JSON,\\n \\"status\\" TEXT,\\n \\"customer_type\\" TEXT,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"credit_limit":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"tax_exempt":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"tax_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_shipping_address":{"type":"JSON","notNull":false,"unique":false},"default_billing_address":{"type":"JSON","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"customer_type":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"customers_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"customers_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"customers_profile_id_idx","columns":["profile_id"]}],"version":"ad1b9967"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Fulfillment":{"name":"fulfillment","className":"Fulfillment","qualifiedName":"@happyvertical/smrt-commerce:Fulfillment","collection":"fulfillments","description":"Fulfillment tracks the delivery or completion of contract items.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Fulfillment.ts","packageName":"@happyvertical/smrt-commerce","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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract","description":"The order being fulfilled.","_meta":{"description":"The order being fulfilled."}},"fulfillmentType":{"type":"text","required":false,"description":"How it gets to the customer: shipment, delivery, pickup, digital or service.","_meta":{"description":"How it gets to the customer: shipment, delivery, pickup, digital or service."},"enum":["shipment","delivery","pickup","digital","service"]},"status":{"type":"text","required":false,"description":"Where it stands: pending, processing, shipped, delivered or cancelled.","_meta":{"description":"Where it stands: pending, processing, shipped, delivered or cancelled."},"enum":["pending","processing","shipped","delivered","cancelled"]},"trackingNumber":{"type":"text","required":false,"default":"","description":"The carrier's tracking number.","_meta":{"description":"The carrier's tracking number."}},"carrier":{"type":"text","required":false,"default":"","description":"The company carrying it.","_meta":{"description":"The company carrying it."}},"shippingAddress":{"type":"json","required":false},"shippedAt":{"type":"datetime","required":false,"description":"When it was dispatched.","_meta":{"description":"When it was dispatched."}},"deliveredAt":{"type":"datetime","required":false,"description":"When it arrived.","_meta":{"description":"When it arrived."}},"estimatedDelivery":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this shipment.","_meta":{"description":"Anything worth remembering about this shipment."}}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isDelivered":{"name":"isDelivered","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isInTransit":{"name":"isInTransit","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markShipped":{"name":"markShipped","async":false,"parameters":[{"name":"trackingNumber","type":"string","optional":true},{"name":"carrier","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"markDelivered":{"name":"markDelivered","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Fulfillment","collectionExportName":"FulfillmentCollection","schema":{"tableName":"fulfillments","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillments\\" (\\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 \\"contract_id\\" UUID,\\n \\"fulfillment_type\\" TEXT,\\n \\"status\\" TEXT,\\n \\"tracking_number\\" TEXT DEFAULT '',\\n \\"carrier\\" TEXT DEFAULT '',\\n \\"shipping_address\\" JSON,\\n \\"shipped_at\\" TIMESTAMP,\\n \\"delivered_at\\" TIMESTAMP,\\n \\"estimated_delivery\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"fulfillment_type":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"tracking_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"carrier":{"type":"TEXT","notNull":false,"unique":false,"default":""},"shipping_address":{"type":"JSON","notNull":false,"unique":false},"shipped_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"delivered_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"estimated_delivery":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillments_contract_id_idx","columns":["contract_id"]}],"version":"2f708fc5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:FulfillmentLineItem":{"name":"fulfillmentlineitem","className":"FulfillmentLineItem","qualifiedName":"@happyvertical/smrt-commerce:FulfillmentLineItem","collection":"fulfillmentlineitems","description":"FulfillmentLineItem tracks which contract line items are included in a specific fulfillment and how much was fulfilled.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/FulfillmentLineItem.ts","packageName":"@happyvertical/smrt-commerce","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}}},"fulfillmentId":{"type":"foreignKey","required":false,"related":"Fulfillment","description":"The shipment this line belongs to.","_meta":{"description":"The shipment this line belongs to."}},"contractLineItemId":{"type":"foreignKey","required":false,"related":"ContractLineItem","description":"The order line being sent.","_meta":{"description":"The order line being sent."}},"quantityFulfilled":{"type":"decimal","required":false,"default":1,"description":"How many of that line are in this shipment.","_meta":{"description":"How many of that line are in this shipment."}},"notes":{"type":"text","required":false,"default":""}},"methods":{"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":true,"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"FulfillmentLineItem","collectionExportName":"FulfillmentLineItemCollection","schema":{"tableName":"fulfillment_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"fulfillment_line_items\\" (\\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 \\"fulfillment_id\\" UUID,\\n \\"contract_line_item_id\\" UUID,\\n \\"quantity_fulfilled\\" REAL DEFAULT 1,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"fulfillment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"fulfillments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_line_item_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contract_line_items","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"quantity_fulfilled":{"type":"REAL","notNull":false,"unique":false,"default":1},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"fulfillment_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"fulfillment_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"fulfillment_line_items_fulfillment_id_idx","columns":["fulfillment_id"]},{"name":"fulfillment_line_items_contract_line_item_id_idx","columns":["contract_line_item_id"]}],"version":"14537dbe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Invoice":{"name":"invoice","className":"Invoice","qualifiedName":"@happyvertical/smrt-commerce:Invoice","collection":"invoices","description":"Invoice represents a bill sent to a customer for goods or services.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Invoice.ts","packageName":"@happyvertical/smrt-commerce","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}}},"customerId":{"type":"foreignKey","required":false,"related":"Customer","description":"The customer being billed.","_meta":{"description":"The customer being billed."}},"contractId":{"type":"foreignKey","required":false,"related":"Contract","description":"The order or agreement this invoice bills for, if any.","_meta":{"description":"The order or agreement this invoice bills for, if any."}},"invoiceNumber":{"type":"text","required":false,"default":"","description":"The number printed on the invoice.","_meta":{"description":"The number printed on the invoice."}},"reference":{"type":"text","required":false,"default":""},"issueDate":{"type":"datetime","required":false,"description":"The date the invoice was issued.","_meta":{"description":"The date the invoice was issued."}},"dueDate":{"type":"datetime","required":false,"description":"The date payment is expected.","_meta":{"description":"The date payment is expected."}},"paidDate":{"type":"datetime","required":false,"description":"The date it was paid in full.","_meta":{"description":"The date it was paid in full."}},"subtotal":{"type":"integer","required":false,"default":0,"description":"The amount before tax.","_meta":{"description":"The amount before tax."}},"taxAmount":{"type":"integer","required":false,"default":0,"description":"The tax charged.","_meta":{"description":"The tax charged."}},"providerTaxAmount":{"type":"integer","required":false,"default":0},"totalAmount":{"type":"integer","required":false,"default":0,"description":"What the customer owes in all, tax included.","_meta":{"description":"What the customer owes in all, tax included."}},"amountPaid":{"type":"integer","required":false,"default":0,"description":"How much of the total has been paid so far.","_meta":{"description":"How much of the total has been paid so far."}},"currency":{"type":"text","required":false,"default":"CAD","description":"The currency of the invoice.","_meta":{"description":"The currency of the invoice.","ui":{"widget":"currency"}}},"status":{"type":"text","required":false,"description":"Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled.","_meta":{"description":"Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled."},"enum":["draft","sent","viewed","partial","paid","overdue","cancelled","written_off"]},"arJournalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"revenueJournalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"externalId":{"type":"text","required":false,"default":""},"customerExternalId":{"type":"text","required":false,"default":""},"externalProvider":{"type":"text","required":false,"default":""},"syncedAt":{"type":"datetime","required":false},"collectionMethod":{"type":"text","required":false,"default":"","enum":["","send_invoice","charge_automatically"]},"sentAt":{"type":"datetime","required":false},"viewedAt":{"type":"datetime","required":false},"remindersSent":{"type":"integer","required":false,"default":0},"lastReminderAt":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":"","description":"Private notes, not shown to the customer.","_meta":{"description":"Private notes, not shown to the customer.","ui":{"widget":"textarea"}}},"customerNotes":{"type":"text","required":false,"default":"","description":"A message shown to the customer on the invoice.","_meta":{"description":"A message shown to the customer on the invoice.","ui":{"widget":"textarea"}}},"terms":{"type":"text","required":false,"default":"","description":"The payment conditions, such as Net 30.","_meta":{"description":"The payment conditions, such as Net 30.","ui":{"widget":"textarea"}}}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isDraft":{"name":"isDraft","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSent":{"name":"isSent","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPaid":{"name":"isPaid","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPartial":{"name":"isPartial","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isOverdue":{"name":"isOverdue","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"getAmountDue":{"name":"getAmountDue","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"markSent":{"name":"markSent","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markViewed":{"name":"markViewed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"updatePaymentStatus":{"name":"updatePaymentStatus","async":false,"parameters":[{"name":"amountPaid","type":"number","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"writeOff":{"name":"writeOff","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"recognizeRevenue":{"name":"recognizeRevenue","async":true,"parameters":[{"name":"options","type":"RecognizeRevenueOptions","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"getArJournal":{"name":"getArJournal","async":true,"parameters":[],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"toAccountingInput":{"name":"toAccountingInput","async":true,"parameters":[],"returnType":"Promise<AccountingInvoiceInput>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["customerId","contractId","invoiceNumber","reference","issueDate","dueDate","currency","notes","customerNotes","terms","externalId","customerExternalId","externalProvider"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Invoice","collectionExportName":"InvoiceCollection","schema":{"tableName":"invoices","ddl":"CREATE TABLE IF NOT EXISTS \\"invoices\\" (\\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 \\"customer_id\\" UUID,\\n \\"contract_id\\" UUID,\\n \\"invoice_number\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"issue_date\\" TIMESTAMP,\\n \\"due_date\\" TIMESTAMP,\\n \\"paid_date\\" TIMESTAMP,\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"tax_amount\\" INTEGER DEFAULT 0,\\n \\"provider_tax_amount\\" INTEGER DEFAULT 0,\\n \\"total_amount\\" INTEGER DEFAULT 0,\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'CAD',\\n \\"status\\" TEXT,\\n \\"ar_journal_id\\" UUID,\\n \\"revenue_journal_id\\" UUID,\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"customer_external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"collection_method\\" TEXT DEFAULT '',\\n \\"sent_at\\" TIMESTAMP,\\n \\"viewed_at\\" TIMESTAMP,\\n \\"reminders_sent\\" INTEGER DEFAULT 0,\\n \\"last_reminder_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"customer_notes\\" TEXT DEFAULT '',\\n \\"terms\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_number":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"issue_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"due_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"paid_date":{"type":"TIMESTAMP","notNull":false,"unique":false},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"provider_tax_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"total_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"CAD"},"status":{"type":"TEXT","notNull":false,"unique":false},"ar_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"revenue_journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"collection_method":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"viewed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"reminders_sent":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_reminder_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"terms":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"invoices_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoices_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoices_customer_id_idx","columns":["customer_id"]},{"name":"invoices_contract_id_idx","columns":["contract_id"]},{"name":"invoices_ar_journal_id_idx","columns":["ar_journal_id"]},{"name":"invoices_revenue_journal_id_idx","columns":["revenue_journal_id"]}],"version":"e7573840"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:InvoiceLineItem":{"name":"invoicelineitem","className":"InvoiceLineItem","qualifiedName":"@happyvertical/smrt-commerce:InvoiceLineItem","collection":"invoicelineitems","description":"InvoiceLineItem represents a single line item on an invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/InvoiceLineItem.ts","packageName":"@happyvertical/smrt-commerce","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}}},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice","description":"The invoice this line belongs to.","_meta":{"description":"The invoice this line belongs to."}},"description":{"type":"text","required":false,"default":"","description":"What is being billed on this line.","_meta":{"description":"What is being billed on this line."}},"sku":{"type":"text","required":false,"default":""},"quantity":{"type":"decimal","required":false,"default":1,"description":"How many.","_meta":{"description":"How many."}},"invoiceEditorStateJson":{"type":"text","required":false,"default":""},"unitPrice":{"type":"integer","required":false,"default":0,"description":"The price of one, before tax.","_meta":{"description":"The price of one, before tax."}},"discount":{"type":"integer","required":false,"default":0},"taxRate":{"type":"decimal","required":false,"default":0,"description":"The tax rate for this line, as a percentage (5 means 5%).","_meta":{"description":"The tax rate for this line, as a percentage (5 means 5%)."}},"amount":{"type":"integer","required":false,"default":0,"description":"The line total.","_meta":{"description":"The line total."}},"sourceType":{"type":"text","required":false,"default":""},"sourceId":{"type":"text","required":false,"default":""},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false},"revenueAccountId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Account"},"sortOrder":{"type":"integer","required":false,"default":0}},"methods":{"calculateAmount":{"name":"calculateAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getSubtotal":{"name":"getSubtotal","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"getTaxAmount":{"name":"getTaxAmount","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"applyEditorDraft":{"name":"applyEditorDraft","async":false,"parameters":[{"name":"draft","type":"InvoiceLineDraft","optional":false},{"name":"context","type":"InvoiceCalculationContext","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getEditorDraft":{"name":"getEditorDraft","async":false,"parameters":[{"name":"authorizedContext","type":"InvoiceCalculationContext","optional":false}],"returnType":"InvoiceLineDraft | null","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"hasSource":{"name":"hasSource","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"hasPeriod":{"name":"hasPeriod","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"toAccountingLineItem":{"name":"toAccountingLineItem","async":false,"parameters":[{"name":"currency","type":"string","optional":true}],"returnType":"AccountingLineItemInput","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"InvoiceLineItem","collectionExportName":"InvoiceLineItemCollection","schema":{"tableName":"invoice_line_items","ddl":"CREATE TABLE IF NOT EXISTS \\"invoice_line_items\\" (\\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 \\"invoice_id\\" UUID,\\n \\"description\\" TEXT DEFAULT '',\\n \\"sku\\" TEXT DEFAULT '',\\n \\"quantity\\" REAL DEFAULT 1,\\n \\"invoice_editor_state_json\\" TEXT DEFAULT '',\\n \\"unit_price\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"tax_rate\\" REAL DEFAULT 0,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"source_type\\" TEXT DEFAULT '',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"revenue_account_id\\" UUID,\\n \\"sort_order\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"sku":{"type":"TEXT","notNull":false,"unique":false,"default":""},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":1},"invoice_editor_state_json":{"type":"TEXT","notNull":false,"unique":false,"default":""},"unit_price":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"tax_rate":{"type":"REAL","notNull":false,"unique":false,"default":0},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":""},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"revenue_account_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"sort_order":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"invoice_line_items_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"invoice_line_items_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"invoice_line_items_invoice_id_idx","columns":["invoice_id"]},{"name":"invoice_line_items_revenue_account_id_idx","columns":["revenue_account_id"]}],"version":"6d388b43"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Payment":{"name":"payment","className":"Payment","qualifiedName":"@happyvertical/smrt-commerce:Payment","collection":"payments","description":"Payment represents a financial transaction against a contract.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Payment.ts","packageName":"@happyvertical/smrt-commerce","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}}},"contractId":{"type":"foreignKey","required":false,"related":"Contract","description":"The order or agreement this payment is for, if any.","_meta":{"description":"The order or agreement this payment is for, if any."}},"customerId":{"type":"foreignKey","required":false,"related":"Customer","description":"The customer who paid.","_meta":{"description":"The customer who paid."}},"amount":{"type":"integer","required":false,"default":0,"description":"How much was paid.","_meta":{"description":"How much was paid."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency of the payment.","_meta":{"description":"The currency of the payment.","ui":{"widget":"currency"}}},"method":{"type":"text","required":false,"description":"How it was paid: cash, check, card, bank transfer or other.","_meta":{"description":"How it was paid: cash, check, card, bank transfer or other."},"enum":["cash","check","credit_card","bank_transfer","crypto","other"]},"status":{"type":"text","required":false,"description":"Whether the payment is pending, completed, failed or refunded.","_meta":{"description":"Whether the payment is pending, completed, failed or refunded."},"enum":["pending","completed","failed","refunded","cancelled"]},"transactionId":{"type":"text","required":false,"default":""},"reference":{"type":"text","required":false,"default":"","description":"A reference note, such as a check number.","_meta":{"description":"A reference note, such as a check number."}},"journalId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-ledgers:Journal"},"paidAt":{"type":"datetime","required":false,"description":"When the money was received.","_meta":{"description":"When the money was received."}},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this payment.","_meta":{"description":"Anything worth remembering about this payment.","ui":{"widget":"textarea"}}},"externalId":{"type":"text","required":false,"default":""},"externalProvider":{"type":"text","required":false,"default":""},"syncedAt":{"type":"datetime","required":false},"backendId":{"type":"text","required":false,"default":""},"backendTxRef":{"type":"text","required":false,"default":""},"nativeAmount":{"type":"integer","required":false,"default":0},"nativeCurrency":{"type":"text","required":false,"default":""},"usdAtQuote":{"type":"integer","required":false,"default":0},"usdAtConfirmation":{"type":"integer","required":false,"default":0}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"usdDrift":{"name":"usdDrift","async":false,"parameters":[],"returnType":"number","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCompleted":{"name":"isCompleted","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRefunded":{"name":"isRefunded","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"recordPayment":{"name":"recordPayment","async":true,"parameters":[{"name":"options","type":"RecordPaymentOptions","optional":false}],"returnType":"Promise<Journal>","isStatic":false,"isPublic":true},"getJournal":{"name":"getJournal","async":true,"parameters":[],"returnType":"Promise<Journal | null>","isStatic":false,"isPublic":true},"markFailed":{"name":"markFailed","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["contractId","customerId","amount","currency","method","transactionId","reference","notes","externalId","externalProvider","backendId","backendTxRef","nativeAmount","nativeCurrency","usdAtQuote","usdAtConfirmation"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Payment","collectionExportName":"PaymentCollection","schema":{"tableName":"payments","ddl":"CREATE TABLE IF NOT EXISTS \\"payments\\" (\\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 \\"contract_id\\" UUID,\\n \\"customer_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"method\\" TEXT,\\n \\"status\\" TEXT,\\n \\"transaction_id\\" TEXT DEFAULT '',\\n \\"reference\\" TEXT DEFAULT '',\\n \\"journal_id\\" UUID,\\n \\"paid_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"external_id\\" TEXT DEFAULT '',\\n \\"external_provider\\" TEXT DEFAULT '',\\n \\"synced_at\\" TIMESTAMP,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"native_amount\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"usd_at_quote\\" INTEGER DEFAULT 0,\\n \\"usd_at_confirmation\\" INTEGER DEFAULT 0\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"contract_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"contracts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"method":{"type":"TEXT","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"transaction_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"reference":{"type":"TEXT","notNull":false,"unique":false,"default":""},"journal_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"external_provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"synced_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"usd_at_quote":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"usd_at_confirmation":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"payments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payments_contract_id_idx","columns":["contract_id"]},{"name":"payments_customer_id_idx","columns":["customer_id"]},{"name":"payments_journal_id_idx","columns":["journal_id"]}],"version":"33f80e50"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentAllocation":{"name":"paymentallocation","className":"PaymentAllocation","qualifiedName":"@happyvertical/smrt-commerce:PaymentAllocation","collection":"paymentallocations","description":"PaymentAllocation tracks how payments are applied to invoices.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentAllocation.ts","packageName":"@happyvertical/smrt-commerce","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}}},"paymentId":{"type":"foreignKey","required":false,"related":"Payment","description":"The payment being applied.","_meta":{"description":"The payment being applied."}},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice","description":"The invoice it settles.","_meta":{"description":"The invoice it settles."}},"amount":{"type":"integer","required":false,"default":0,"description":"How much of the payment goes to this invoice.","_meta":{"description":"How much of the payment goes to this invoice."}},"allocatedAt":{"type":"datetime","required":false,"description":"When it was applied.","_meta":{"description":"When it was applied."}},"allocatedBy":{"type":"text","required":false,"default":""},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this allocation.","_meta":{"description":"Anything worth remembering about this allocation."}}},"methods":{"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PaymentAllocation","collectionExportName":"PaymentAllocationCollection","schema":{"tableName":"payment_allocations","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_allocations\\" (\\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 \\"payment_id\\" UUID,\\n \\"invoice_id\\" UUID,\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"allocated_at\\" TIMESTAMP,\\n \\"allocated_by\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"payments","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"allocated_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"allocated_by":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_allocations_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_allocations_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_allocations_payment_id_idx","columns":["payment_id"]},{"name":"payment_allocations_invoice_id_idx","columns":["invoice_id"]}],"version":"102e6fbc"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentInstrument":{"name":"paymentinstrument","className":"PaymentInstrument","qualifiedName":"@happyvertical/smrt-commerce:PaymentInstrument","collection":"paymentinstruments","description":"PaymentInstrument stores a reusable payment method a customer has saved with a payment backend (e.g. a card vaulted by Stripe), so it can be charged later without the customer present.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentInstrument.ts","packageName":"@happyvertical/smrt-commerce","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}}},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"backendId":{"type":"text","required":false,"default":""},"providerCustomerId":{"type":"text","required":false,"default":""},"providerPaymentMethodId":{"type":"text","required":false,"default":""},"type":{"type":"text","required":false,"default":"card"},"brand":{"type":"text","required":false,"default":""},"last4":{"type":"text","required":false,"default":""},"expMonth":{"type":"integer","required":false,"default":0},"expYear":{"type":"integer","required":false,"default":0},"isDefault":{"type":"boolean","required":false,"default":false},"status":{"type":"text","required":false,"enum":["active","expired","removed"]}},"methods":{"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRemoved":{"name":"isRemoved","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markExpired":{"name":"markExpired","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markRemoved":{"name":"markRemoved","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"],"writable":["customerId","backendId","providerCustomerId","providerPaymentMethodId","type","brand","last4","expMonth","expYear","status"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"PaymentInstrument","collectionExportName":"PaymentInstrumentCollection","schema":{"tableName":"payment_instruments","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_instruments\\" (\\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 \\"customer_id\\" UUID,\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"provider_payment_method_id\\" TEXT DEFAULT '',\\n \\"type\\" TEXT DEFAULT 'card',\\n \\"brand\\" TEXT DEFAULT '',\\n \\"last4\\" TEXT DEFAULT '',\\n \\"exp_month\\" INTEGER DEFAULT 0,\\n \\"exp_year\\" INTEGER DEFAULT 0,\\n \\"is_default\\" BOOLEAN DEFAULT FALSE,\\n \\"status\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_payment_method_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"type":{"type":"TEXT","notNull":false,"unique":false,"default":"card"},"brand":{"type":"TEXT","notNull":false,"unique":false,"default":""},"last4":{"type":"TEXT","notNull":false,"unique":false,"default":""},"exp_month":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"exp_year":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"is_default":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false},"status":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"payment_instruments_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payment_instruments_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payment_instruments_customer_id_idx","columns":["customer_id"]}],"version":"722393fe"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:PaymentIntent":{"name":"paymentintent","className":"PaymentIntent","qualifiedName":"@happyvertical/smrt-commerce:PaymentIntent","collection":"paymentintents","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/PaymentIntent.ts","packageName":"@happyvertical/smrt-commerce","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}}},"skuId":{"type":"text","required":false,"default":""},"offeringRef":{"type":"text","required":false,"default":""},"licenseeEmail":{"type":"text","required":false,"default":""},"customerId":{"type":"text","required":false,"default":""},"paymentOptions":{"type":"json","required":false,"default":[]},"usdPriceLocked":{"type":"integer","required":false,"default":0},"priceLockWindowMs":{"type":"integer","required":false},"priceLockExpiresAt":{"type":"datetime","required":false},"status":{"type":"text","required":false,"enum":["awaiting_payment","paid","issued","retired","expired","cancelled"]},"idempotencyKey":{"type":"text","required":false,"default":""},"paidOptionBackendId":{"type":"text","required":false,"default":""},"paymentId":{"type":"text","required":false,"default":""},"paidAt":{"type":"datetime","required":false},"issuedAt":{"type":"datetime","required":false},"expiredAt":{"type":"datetime","required":false},"cancelledAt":{"type":"datetime","required":false},"retiredAt":{"type":"datetime","required":false},"notes":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isAwaitingPayment":{"name":"isAwaitingPayment","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isPaid":{"name":"isPaid","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isIssued":{"name":"isIssued","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isCancelled":{"name":"isCancelled","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isRetired":{"name":"isRetired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isTerminal":{"name":"isTerminal","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isExpired":{"name":"isExpired","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markPaid":{"name":"markPaid","async":false,"parameters":[{"name":"args","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"void","isStatic":false,"isPublic":true},"verifyAndMarkPaid":{"name":"verifyAndMarkPaid","async":true,"parameters":[{"name":"args","type":"object","optional":false,"memberTypes":["string"]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"markIssued":{"name":"markIssued","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"expire":{"name":"expire","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"cancel":{"name":"cancel","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"retire":{"name":"retire","async":false,"parameters":[{"name":"reason","type":"string","optional":true}],"returnType":"void","isStatic":false,"isPublic":true},"getOption":{"name":"getOption","async":false,"parameters":[{"name":"backendId","type":"string","optional":false}],"returnType":"PaymentOption | undefined","isStatic":false,"isPublic":true},"isOptionRetired":{"name":"isOptionRetired","async":false,"parameters":[{"name":"backendId","type":"string","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getRetiredOptions":{"name":"getRetiredOptions","async":false,"parameters":[],"returnType":"PaymentOption[]","isStatic":false,"isPublic":true}},"decoratorConfig":{"conflictColumns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"api":{"include":["list","get","create","update"],"writable":["skuId","offeringRef","licenseeEmail","customerId","paymentOptions","usdPriceLocked","priceLockWindowMs","idempotencyKey","notes"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"}},"extends":"SmrtObject","exportName":"PaymentIntent","collectionExportName":"PaymentIntentCollection","schema":{"tableName":"payment_intents","ddl":"CREATE TABLE IF NOT EXISTS \\"payment_intents\\" (\\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 \\"sku_id\\" TEXT DEFAULT '',\\n \\"offering_ref\\" TEXT DEFAULT '',\\n \\"licensee_email\\" TEXT DEFAULT '',\\n \\"customer_id\\" TEXT DEFAULT '',\\n \\"payment_options\\" JSON DEFAULT '[]',\\n \\"usd_price_locked\\" INTEGER DEFAULT 0,\\n \\"price_lock_window_ms\\" INTEGER,\\n \\"price_lock_expires_at\\" TIMESTAMP,\\n \\"status\\" TEXT,\\n \\"idempotency_key\\" TEXT DEFAULT '',\\n \\"paid_option_backend_id\\" TEXT DEFAULT '',\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"paid_at\\" TIMESTAMP,\\n \\"issued_at\\" TIMESTAMP,\\n \\"expired_at\\" TIMESTAMP,\\n \\"cancelled_at\\" TIMESTAMP,\\n \\"retired_at\\" TIMESTAMP,\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"sku_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"offering_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"licensee_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_options":{"type":"JSON","notNull":false,"unique":false,"default":[]},"usd_price_locked":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"price_lock_window_ms":{"type":"INTEGER","notNull":false,"unique":false},"price_lock_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false},"idempotency_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_option_backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"paid_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"expired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"cancelled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"retired_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payment_intents_tenant_id_offering_ref_idx","columns":["tenant_id","offering_ref","licensee_email","idempotency_key"],"unique":true,"nullsNotDistinct":true},{"name":"payment_intents_slug_context_idx","columns":["slug","context"]},{"name":"payment_intents_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"c565aaef"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Payout":{"name":"payout","className":"Payout","qualifiedName":"@happyvertical/smrt-commerce:Payout","collection":"payouts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Payout.ts","packageName":"@happyvertical/smrt-commerce","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}}},"paymentId":{"type":"text","required":false,"default":""},"vendorId":{"type":"foreignKey","required":false,"related":"Vendor"},"grossAmount":{"type":"integer","required":false,"default":0},"operatorFee":{"type":"integer","required":false,"default":0},"supplierNet":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":""},"backendId":{"type":"text","required":false,"default":""},"backendTxRef":{"type":"text","required":false,"default":""},"status":{"type":"text","required":false,"enum":["pending","sent","confirmed","failed"]},"sentAt":{"type":"datetime","required":false},"confirmedAt":{"type":"datetime","required":false},"failedAt":{"type":"datetime","required":false},"failureReason":{"type":"text","required":false,"default":""},"notes":{"type":"text","required":false,"default":""}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isPending":{"name":"isPending","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isSent":{"name":"isSent","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isConfirmed":{"name":"isConfirmed","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isFailed":{"name":"isFailed","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"markSent":{"name":"markSent","async":false,"parameters":[{"name":"backendTxRef","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"markConfirmed":{"name":"markConfirmed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"markFailed":{"name":"markFailed","async":false,"parameters":[{"name":"reason","type":"string","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"resetFromFailed":{"name":"resetFromFailed","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"validateAmounts":{"name":"validateAmounts","async":false,"parameters":[],"returnType":"void","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get"]},"mcp":{"include":["list","get"]},"cli":{"include":["list","get"]},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Payout","collectionExportName":"PayoutCollection","schema":{"tableName":"payouts","ddl":"CREATE TABLE IF NOT EXISTS \\"payouts\\" (\\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 \\"payment_id\\" TEXT DEFAULT '',\\n \\"vendor_id\\" UUID,\\n \\"gross_amount\\" INTEGER DEFAULT 0,\\n \\"operator_fee\\" INTEGER DEFAULT 0,\\n \\"supplier_net\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT '',\\n \\"backend_id\\" TEXT DEFAULT '',\\n \\"backend_tx_ref\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"sent_at\\" TIMESTAMP,\\n \\"confirmed_at\\" TIMESTAMP,\\n \\"failed_at\\" TIMESTAMP,\\n \\"failure_reason\\" TEXT DEFAULT '',\\n \\"notes\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"vendor_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"vendors","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"gross_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"operator_fee":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"supplier_net":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"backend_tx_ref":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"sent_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"confirmed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failed_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"failure_reason":{"type":"TEXT","notNull":false,"unique":false,"default":""},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"payouts_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"payouts_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"payouts_vendor_id_idx","columns":["vendor_id"]}],"version":"98fa81d5"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:Vendor":{"name":"vendor","className":"Vendor","qualifiedName":"@happyvertical/smrt-commerce:Vendor","collection":"vendors","description":"Vendor represents the vendor/supplier role for a Profile.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/Vendor.ts","packageName":"@happyvertical/smrt-commerce","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}}},"profileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","_meta":{"description":"Links this vendor to their profile record, where their name and contact details are kept."}},"leadTimeDays":{"type":"integer","required":false,"default":0,"description":"How many days the vendor usually takes between your order and delivery.","_meta":{"description":"How many days the vendor usually takes between your order and delivery."}},"minimumOrderAmount":{"type":"integer","required":false,"default":0,"description":"The smallest order the vendor will accept.","_meta":{"description":"The smallest order the vendor will accept."}},"paymentTerms":{"type":"text","required":false,"default":"","description":"How long you have to pay this vendor, written the way you would say it, for example \\"Net 30\\".","_meta":{"description":"How long you have to pay this vendor, written the way you would say it, for example \\"Net 30\\"."}},"currency":{"type":"text","required":false,"default":"USD","description":"The currency this vendor bills you in.","_meta":{"description":"The currency this vendor bills you in.","ui":{"widget":"currency"}}},"defaultContactEmail":{"type":"text","required":false,"default":"","description":"The email address you normally use to reach this vendor.","_meta":{"description":"The email address you normally use to reach this vendor.","ui":{"widget":"email"}}},"defaultContactPhone":{"type":"text","required":false,"default":"","description":"The phone number you normally use to reach this vendor.","_meta":{"description":"The phone number you normally use to reach this vendor.","ui":{"widget":"phone"}}},"status":{"type":"text","required":false,"description":"Whether you still buy from this vendor: active, inactive or suspended.","_meta":{"description":"Whether you still buy from this vendor: active, inactive or suspended."},"enum":["active","inactive","suspended"]},"notes":{"type":"text","required":false,"default":"","description":"Anything worth remembering about this vendor.","_meta":{"description":"Anything worth remembering about this vendor.","ui":{"widget":"textarea"}}},"payoutAddresses":{"type":"json","required":false,"default":{},"description":"Where payments to this vendor should be sent.","_meta":{"sensitive":true,"description":"Where payments to this vendor should be sent."},"sensitive":true}},"methods":{"initialize":{"name":"initialize","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"isActive":{"name":"isActive","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"meetsMinimumOrder":{"name":"meetsMinimumOrder","async":false,"parameters":[{"name":"amount","type":"number","optional":false}],"returnType":"boolean","isStatic":false,"isPublic":true},"getProfileId":{"name":"getProfileId","async":false,"parameters":[],"returnType":"string","isStatic":false,"isPublic":true},"getPayoutAddress":{"name":"getPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false}],"returnType":"string | undefined","isStatic":false,"isPublic":true},"setPayoutAddress":{"name":"setPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false},{"name":"destination","type":"string","optional":false}],"returnType":"this","isStatic":false,"isPublic":true},"clearPayoutAddress":{"name":"clearPayoutAddress","async":false,"parameters":[{"name":"currency","type":"string","optional":false}],"returnType":"this","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update"]},"mcp":{"include":["list","get"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"Vendor","collectionExportName":"VendorCollection","schema":{"tableName":"vendors","ddl":"CREATE TABLE IF NOT EXISTS \\"vendors\\" (\\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 \\"profile_id\\" UUID,\\n \\"lead_time_days\\" INTEGER DEFAULT 0,\\n \\"minimum_order_amount\\" INTEGER DEFAULT 0,\\n \\"payment_terms\\" TEXT DEFAULT '',\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"default_contact_email\\" TEXT DEFAULT '',\\n \\"default_contact_phone\\" TEXT DEFAULT '',\\n \\"status\\" TEXT,\\n \\"notes\\" TEXT DEFAULT '',\\n \\"payout_addresses\\" JSON DEFAULT '{}'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false,"unique":false},"lead_time_days":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"minimum_order_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms":{"type":"TEXT","notNull":false,"unique":false,"default":""},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"default_contact_email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"default_contact_phone":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false},"notes":{"type":"TEXT","notNull":false,"unique":false,"default":""},"payout_addresses":{"type":"JSON","notNull":false,"unique":false,"default":{}}},"indexes":[{"name":"vendors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"vendors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"vendors_profile_id_idx","columns":["profile_id"]}],"version":"1dc2b65e"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingAccount":{"name":"billingaccount","className":"BillingAccount","qualifiedName":"@happyvertical/smrt-commerce:BillingAccount","collection":"billingaccounts","description":"One payer's account with one seller: the commerce Customer invoices are issued to, the provider customer they are pushed to, and the payer's billing terms.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"customerId":{"type":"foreignKey","required":false,"related":"Customer"},"name":{"type":"text","required":false,"default":""},"email":{"type":"text","required":false,"default":""},"provider":{"type":"text","required":false,"default":""},"providerCustomerId":{"type":"text","required":false,"default":""},"automaticTax":{"type":"boolean","required":false,"default":true},"flatDiscountBasisPoints":{"type":"integer","required":false,"default":0},"paymentTermsDays":{"type":"integer","required":false,"default":30},"standing":{"type":"text","required":false,"default":"current","enum":["current","past_due","uncollectible"]},"billingAnchorAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"prorateFlatPlans":{"type":"boolean","required":false,"default":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_accounts","conflictColumns":["seller_tenant_id","payer_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingAccount","collectionExportName":"BillingAccountCollection","displayLabelField":"name","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"customer_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"email\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"automatic_tax\\" BOOLEAN DEFAULT TRUE,\\n \\"flat_discount_basis_points\\" INTEGER DEFAULT 0,\\n \\"payment_terms_days\\" INTEGER DEFAULT 30,\\n \\"standing\\" TEXT DEFAULT 'current',\\n \\"billing_anchor_at\\" TIMESTAMP,\\n \\"prorate_flat_plans\\" BOOLEAN DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"automatic_tax":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"flat_discount_basis_points":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms_days":{"type":"INTEGER","notNull":false,"unique":false,"default":30},"standing":{"type":"TEXT","notNull":false,"unique":false,"default":"current"},"billing_anchor_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"prorate_flat_plans":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false}},"indexes":[{"name":"_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx","columns":["seller_tenant_id","payer_tenant_id"],"unique":true},{"name":"_smrt_billing_accounts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_accounts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_accounts_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_accounts_customer_id_idx","columns":["customer_id"]}],"version":"58124e47"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPeriodClose":{"name":"billingperiodclose","className":"BillingPeriodClose","qualifiedName":"@happyvertical/smrt-commerce:BillingPeriodClose","collection":"billingperiodcloses","description":"The idempotency anchor for one payer's invoice in one currency for one period. Its id is derived from that identity, so a retried close always resumes the same row, invoice, and provider invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"kind":{"type":"text","required":false,"default":"provider","enum":["provider","reseller"]},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"currency":{"type":"text","required":false,"default":"USD"},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false},"billingAccountId":{"type":"foreignKey","required":false,"related":"BillingAccount"},"status":{"type":"text","required":false,"default":"collecting","enum":["collecting","invoiced","pushed","sent","completed","carried_forward"]},"invoiceId":{"type":"foreignKey","required":false,"related":"Invoice"},"providerInvoiceId":{"type":"text","required":false,"default":""},"subtotal":{"type":"integer","required":false,"default":0},"lineCount":{"type":"integer","required":false,"default":0},"issuedAt":{"type":"datetime","required":false},"leaseToken":{"type":"text","required":false,"_meta":{"nullable":true}},"leaseExpiresAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"attempts":{"type":"integer","required":false,"default":0},"lastError":{"type":"text","required":false,"default":""}},"methods":{"runPeriodClose":{"name":"runPeriodClose","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true},"processBillingEvents":{"name":"processBillingEvents","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<unknown>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_billing_period_closes","conflictColumns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingPeriodClose","collectionExportName":"BillingPeriodCloseCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_period_closes","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_period_closes\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT DEFAULT 'provider',\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"billing_account_id\\" UUID,\\n \\"status\\" TEXT DEFAULT 'collecting',\\n \\"invoice_id\\" UUID,\\n \\"provider_invoice_id\\" TEXT DEFAULT '',\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"line_count\\" INTEGER DEFAULT 0,\\n \\"issued_at\\" TIMESTAMP,\\n \\"lease_token\\" TEXT,\\n \\"lease_expires_at\\" TIMESTAMP,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"last_error\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"provider"},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"billing_account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"collecting"},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"provider_invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"line_count":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_error":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"_smrt_billing_period_closes_seller_tenant_id_kind_idx","columns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_period_closes_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_period_closes_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_period_closes_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_period_closes_billing_account_id_idx","columns":["billing_account_id"]},{"name":"_smrt_billing_period_closes_invoice_id_idx","columns":["invoice_id"]}],"version":"753d2e86"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingLineSource":{"name":"billinglinesource","className":"BillingLineSource","qualifiedName":"@happyvertical/smrt-commerce:BillingLineSource","collection":"billinglinesources","description":"A claim that one billable source \u2014 a charge, an adjustment, or a window of a flat plan \u2014 is billed on exactly one period close.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"periodCloseId":{"type":"foreignKey","required":false,"related":"BillingPeriodClose"},"sourceType":{"type":"text","required":false,"default":"client_charge","enum":["client_charge","billing_adjustment","retail_charge","subscription_period","credit_carry_forward"]},"sourceId":{"type":"text","required":false,"default":""},"lineKey":{"type":"text","required":false,"default":""},"lineDescription":{"type":"text","required":false,"default":""},"amount":{"type":"integer","required":false,"default":0},"discount":{"type":"integer","required":false,"default":0},"quantity":{"type":"decimal","required":false,"default":0},"chainSequence":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"periodStart":{"type":"datetime","required":false},"periodEnd":{"type":"datetime","required":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_line_sources","conflictColumns":["source_type","source_id"],"indexes":[{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["lineKey","chainSequence"]}],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingLineSource","collectionExportName":"BillingLineSourceCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_line_sources","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_line_sources\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"period_close_id\\" UUID,\\n \\"source_type\\" TEXT DEFAULT 'client_charge',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"line_key\\" TEXT DEFAULT '',\\n \\"line_description\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"quantity\\" REAL DEFAULT 0,\\n \\"chain_sequence\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"period_close_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_period_closes","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":"client_charge"},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":0},"chain_sequence":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_billing_line_sources_source_type_source_id_idx","columns":["source_type","source_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_line_sources_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["line_key","chain_sequence"]},{"name":"_smrt_billing_line_sources_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_line_sources_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_line_sources_period_close_id_idx","columns":["period_close_id"]}],"version":"35e3aaa7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPaymentAttempt":{"name":"billingpaymentattempt","className":"BillingPaymentAttempt","qualifiedName":"@happyvertical/smrt-commerce:BillingPaymentAttempt","collection":"billingpaymentattempts","description":"One payment attempt on a payment rail (#3138): a short-lived provider checkout (for example a BTCPay invoice) paying a credit purchase or an issued invoice.","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{"sellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"payerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingAccountId":{"type":"text","required":false,"default":""},"purpose":{"type":"text","required":false,"default":"credit_purchase","enum":["credit_purchase","invoice_payment"]},"invoiceId":{"type":"text","required":false,"default":""},"spendingPolicyId":{"type":"text","required":false,"default":""},"provider":{"type":"text","required":false,"default":""},"orderId":{"type":"text","required":false,"default":""},"checkoutId":{"type":"text","required":false,"default":""},"status":{"type":"text","required":false,"default":"open"},"exception":{"type":"text","required":false,"default":"none"},"flag":{"type":"text","required":false,"default":"","enum":["","overpaid","underpaid","paid_late","manually_marked","invalidated_after_settlement","invoice_already_paid","amount_mismatch","out_of_band_without_settlement"]},"amount":{"type":"integer","required":false,"default":0},"currency":{"type":"text","required":false,"default":"USD"},"amountPaid":{"type":"integer","required":false,"default":0},"nativeCurrency":{"type":"text","required":false,"default":""},"nativeAmountDue":{"type":"integer","required":false,"default":0},"nativeAmountPaid":{"type":"integer","required":false,"default":0},"rate":{"type":"text","required":false,"default":""},"rateSource":{"type":"text","required":false,"default":""},"checkoutUrl":{"type":"text","required":false,"default":""},"expiresAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"payments":{"type":"json","required":false,"default":[]},"timeline":{"type":"json","required":false,"default":[]},"settledAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"paymentId":{"type":"text","required":false,"default":""},"creditGrantId":{"type":"text","required":false,"default":""},"resolution":{"type":"text","required":false,"default":""},"resolvedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"outOfBandRequestedAt":{"type":"datetime","required":false,"_meta":{"nullable":true}},"pausedStanding":{"type":"text","required":false,"default":""},"excessAmount":{"type":"integer","required":false,"default":0},"excessRevision":{"type":"integer","required":false,"default":0},"settlementOutcome":{"type":"text","required":false,"default":""},"refundedAmount":{"type":"integer","required":false,"default":0},"refundedPrincipal":{"type":"integer","required":false,"default":0},"refunds":{"type":"json","required":false,"default":[]}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_payment_attempts","conflictColumns":["provider","checkout_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingPaymentAttempt","collectionExportName":"BillingPaymentAttemptCollection","validationRules":[{"field":"sellerTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"payerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_payment_attempts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_payment_attempts\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"billing_account_id\\" TEXT DEFAULT '',\\n \\"purpose\\" TEXT DEFAULT 'credit_purchase',\\n \\"invoice_id\\" TEXT DEFAULT '',\\n \\"spending_policy_id\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"order_id\\" TEXT DEFAULT '',\\n \\"checkout_id\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'open',\\n \\"exception\\" TEXT DEFAULT 'none',\\n \\"flag\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"native_amount_due\\" INTEGER DEFAULT 0,\\n \\"native_amount_paid\\" INTEGER DEFAULT 0,\\n \\"rate\\" TEXT DEFAULT '',\\n \\"rate_source\\" TEXT DEFAULT '',\\n \\"checkout_url\\" TEXT DEFAULT '',\\n \\"expires_at\\" TIMESTAMP,\\n \\"payments\\" JSON DEFAULT '[]',\\n \\"timeline\\" JSON DEFAULT '[]',\\n \\"settled_at\\" TIMESTAMP,\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"credit_grant_id\\" TEXT DEFAULT '',\\n \\"resolution\\" TEXT DEFAULT '',\\n \\"resolved_at\\" TIMESTAMP,\\n \\"out_of_band_requested_at\\" TIMESTAMP,\\n \\"paused_standing\\" TEXT DEFAULT '',\\n \\"excess_amount\\" INTEGER DEFAULT 0,\\n \\"excess_revision\\" INTEGER DEFAULT 0,\\n \\"settlement_outcome\\" TEXT DEFAULT '',\\n \\"refunded_amount\\" INTEGER DEFAULT 0,\\n \\"refunded_principal\\" INTEGER DEFAULT 0,\\n \\"refunds\\" JSON DEFAULT '[]'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_account_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"purpose":{"type":"TEXT","notNull":false,"unique":false,"default":"credit_purchase"},"invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"spending_policy_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"order_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"open"},"exception":{"type":"TEXT","notNull":false,"unique":false,"default":"none"},"flag":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount_due":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"rate":{"type":"TEXT","notNull":false,"unique":false,"default":""},"rate_source":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_url":{"type":"TEXT","notNull":false,"unique":false,"default":""},"expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payments":{"type":"JSON","notNull":false,"unique":false,"default":[]},"timeline":{"type":"JSON","notNull":false,"unique":false,"default":[]},"settled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"credit_grant_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolution":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolved_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"out_of_band_requested_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"paused_standing":{"type":"TEXT","notNull":false,"unique":false,"default":""},"excess_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"excess_revision":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"settlement_outcome":{"type":"TEXT","notNull":false,"unique":false,"default":""},"refunded_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunded_principal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunds":{"type":"JSON","notNull":false,"unique":false,"default":[]}},"indexes":[{"name":"_smrt_billing_payment_attempts_provider_checkout_id_idx","columns":["provider","checkout_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_payment_attempts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_payment_attempts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_payment_attempts_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_payment_attempts_payer_tenant_id_idx","columns":["payer_tenant_id"]}],"version":"43aceca7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingAccountCollection":{"name":"billingaccountcollection","className":"BillingAccountCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingAccountCollection","collection":"billingaccounts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_accounts","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingAccount","exportName":"BillingAccountCollection","collectionExportName":"BillingAccountCollectionCollection","schema":{"tableName":"_smrt_billing_accounts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_accounts\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"customer_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"email\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"provider_customer_id\\" TEXT DEFAULT '',\\n \\"automatic_tax\\" BOOLEAN DEFAULT TRUE,\\n \\"flat_discount_basis_points\\" INTEGER DEFAULT 0,\\n \\"payment_terms_days\\" INTEGER DEFAULT 30,\\n \\"standing\\" TEXT DEFAULT 'current',\\n \\"billing_anchor_at\\" TIMESTAMP,\\n \\"prorate_flat_plans\\" BOOLEAN DEFAULT FALSE\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"customer_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"customers","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"unique":false,"default":""},"email":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider_customer_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"automatic_tax":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"flat_discount_basis_points":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"payment_terms_days":{"type":"INTEGER","notNull":false,"unique":false,"default":30},"standing":{"type":"TEXT","notNull":false,"unique":false,"default":"current"},"billing_anchor_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"prorate_flat_plans":{"type":"BOOLEAN","notNull":false,"unique":false,"default":false}},"indexes":[{"name":"_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx","columns":["seller_tenant_id","payer_tenant_id"],"unique":true},{"name":"_smrt_billing_accounts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_accounts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_accounts_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_accounts_customer_id_idx","columns":["customer_id"]}],"version":"58124e47"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPeriodCloseCollection":{"name":"billingperiodclosecollection","className":"BillingPeriodCloseCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingPeriodCloseCollection","collection":"billingperiodcloses","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_period_closes","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingPeriodClose","exportName":"BillingPeriodCloseCollection","collectionExportName":"BillingPeriodCloseCollectionCollection","schema":{"tableName":"_smrt_billing_period_closes","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_period_closes\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"kind\\" TEXT DEFAULT 'provider',\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP,\\n \\"billing_account_id\\" UUID,\\n \\"status\\" TEXT DEFAULT 'collecting',\\n \\"invoice_id\\" UUID,\\n \\"provider_invoice_id\\" TEXT DEFAULT '',\\n \\"subtotal\\" INTEGER DEFAULT 0,\\n \\"line_count\\" INTEGER DEFAULT 0,\\n \\"issued_at\\" TIMESTAMP,\\n \\"lease_token\\" TEXT,\\n \\"lease_expires_at\\" TIMESTAMP,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"last_error\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"kind":{"type":"TEXT","notNull":false,"unique":false,"default":"provider"},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false},"billing_account_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_accounts","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"collecting"},"invoice_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"invoices","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"provider_invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"subtotal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"line_count":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"issued_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"last_error":{"type":"TEXT","notNull":false,"unique":false,"default":""}},"indexes":[{"name":"_smrt_billing_period_closes_seller_tenant_id_kind_idx","columns":["seller_tenant_id","kind","payer_tenant_id","currency","period_start","period_end"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_period_closes_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_period_closes_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_period_closes_payer_tenant_id_idx","columns":["payer_tenant_id"]},{"name":"_smrt_billing_period_closes_billing_account_id_idx","columns":["billing_account_id"]},{"name":"_smrt_billing_period_closes_invoice_id_idx","columns":["invoice_id"]}],"version":"753d2e86"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingLineSourceCollection":{"name":"billinglinesourcecollection","className":"BillingLineSourceCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingLineSourceCollection","collection":"billinglinesources","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_line_sources","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingLineSource","exportName":"BillingLineSourceCollection","collectionExportName":"BillingLineSourceCollectionCollection","schema":{"tableName":"_smrt_billing_line_sources","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_line_sources\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"period_close_id\\" UUID,\\n \\"source_type\\" TEXT DEFAULT 'client_charge',\\n \\"source_id\\" TEXT DEFAULT '',\\n \\"line_key\\" TEXT DEFAULT '',\\n \\"line_description\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"discount\\" INTEGER DEFAULT 0,\\n \\"quantity\\" REAL DEFAULT 0,\\n \\"chain_sequence\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"period_start\\" TIMESTAMP,\\n \\"period_end\\" TIMESTAMP\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"period_close_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_billing_period_closes","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"source_type":{"type":"TEXT","notNull":false,"unique":false,"default":"client_charge"},"source_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_key":{"type":"TEXT","notNull":false,"unique":false,"default":""},"line_description":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"discount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"quantity":{"type":"REAL","notNull":false,"unique":false,"default":0},"chain_sequence":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"period_start":{"type":"TIMESTAMP","notNull":false,"unique":false},"period_end":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_billing_line_sources_source_type_source_id_idx","columns":["source_type","source_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_line_sources_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_line_sources_line_key_chain_sequence_idx","columns":["line_key","chain_sequence"]},{"name":"_smrt_billing_line_sources_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_line_sources_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_line_sources_period_close_id_idx","columns":["period_close_id"]}],"version":"35e3aaa7"},"importPath":"@happyvertical/smrt-commerce"},"@happyvertical/smrt-commerce:BillingPaymentAttemptCollection":{"name":"billingpaymentattemptcollection","className":"BillingPaymentAttemptCollection","qualifiedName":"@happyvertical/smrt-commerce:BillingPaymentAttemptCollection","collection":"billingpaymentattempts","filePath":"/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts","packageName":"@happyvertical/smrt-commerce","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_payment_attempts","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingPaymentAttempt","exportName":"BillingPaymentAttemptCollection","collectionExportName":"BillingPaymentAttemptCollectionCollection","schema":{"tableName":"_smrt_billing_payment_attempts","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_payment_attempts\\" (\\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 \\"seller_tenant_id\\" UUID NOT NULL,\\n \\"payer_tenant_id\\" UUID NOT NULL,\\n \\"billing_account_id\\" TEXT DEFAULT '',\\n \\"purpose\\" TEXT DEFAULT 'credit_purchase',\\n \\"invoice_id\\" TEXT DEFAULT '',\\n \\"spending_policy_id\\" TEXT DEFAULT '',\\n \\"provider\\" TEXT DEFAULT '',\\n \\"order_id\\" TEXT DEFAULT '',\\n \\"checkout_id\\" TEXT DEFAULT '',\\n \\"status\\" TEXT DEFAULT 'open',\\n \\"exception\\" TEXT DEFAULT 'none',\\n \\"flag\\" TEXT DEFAULT '',\\n \\"amount\\" INTEGER DEFAULT 0,\\n \\"currency\\" TEXT DEFAULT 'USD',\\n \\"amount_paid\\" INTEGER DEFAULT 0,\\n \\"native_currency\\" TEXT DEFAULT '',\\n \\"native_amount_due\\" INTEGER DEFAULT 0,\\n \\"native_amount_paid\\" INTEGER DEFAULT 0,\\n \\"rate\\" TEXT DEFAULT '',\\n \\"rate_source\\" TEXT DEFAULT '',\\n \\"checkout_url\\" TEXT DEFAULT '',\\n \\"expires_at\\" TIMESTAMP,\\n \\"payments\\" JSON DEFAULT '[]',\\n \\"timeline\\" JSON DEFAULT '[]',\\n \\"settled_at\\" TIMESTAMP,\\n \\"payment_id\\" TEXT DEFAULT '',\\n \\"credit_grant_id\\" TEXT DEFAULT '',\\n \\"resolution\\" TEXT DEFAULT '',\\n \\"resolved_at\\" TIMESTAMP,\\n \\"out_of_band_requested_at\\" TIMESTAMP,\\n \\"paused_standing\\" TEXT DEFAULT '',\\n \\"excess_amount\\" INTEGER DEFAULT 0,\\n \\"excess_revision\\" INTEGER DEFAULT 0,\\n \\"settlement_outcome\\" TEXT DEFAULT '',\\n \\"refunded_amount\\" INTEGER DEFAULT 0,\\n \\"refunded_principal\\" INTEGER DEFAULT 0,\\n \\"refunds\\" JSON DEFAULT '[]'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"seller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"payer_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_account_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"purpose":{"type":"TEXT","notNull":false,"unique":false,"default":"credit_purchase"},"invoice_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"spending_policy_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"provider":{"type":"TEXT","notNull":false,"unique":false,"default":""},"order_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"open"},"exception":{"type":"TEXT","notNull":false,"unique":false,"default":"none"},"flag":{"type":"TEXT","notNull":false,"unique":false,"default":""},"amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"currency":{"type":"TEXT","notNull":false,"unique":false,"default":"USD"},"amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_currency":{"type":"TEXT","notNull":false,"unique":false,"default":""},"native_amount_due":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"native_amount_paid":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"rate":{"type":"TEXT","notNull":false,"unique":false,"default":""},"rate_source":{"type":"TEXT","notNull":false,"unique":false,"default":""},"checkout_url":{"type":"TEXT","notNull":false,"unique":false,"default":""},"expires_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payments":{"type":"JSON","notNull":false,"unique":false,"default":[]},"timeline":{"type":"JSON","notNull":false,"unique":false,"default":[]},"settled_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"payment_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"credit_grant_id":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolution":{"type":"TEXT","notNull":false,"unique":false,"default":""},"resolved_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"out_of_band_requested_at":{"type":"TIMESTAMP","notNull":false,"unique":false},"paused_standing":{"type":"TEXT","notNull":false,"unique":false,"default":""},"excess_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"excess_revision":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"settlement_outcome":{"type":"TEXT","notNull":false,"unique":false,"default":""},"refunded_amount":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunded_principal":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"refunds":{"type":"JSON","notNull":false,"unique":false,"default":[]}},"indexes":[{"name":"_smrt_billing_payment_attempts_provider_checkout_id_idx","columns":["provider","checkout_id"],"unique":true,"nullsNotDistinct":true},{"name":"_smrt_billing_payment_attempts_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_payment_attempts_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_payment_attempts_seller_tenant_id_idx","columns":["seller_tenant_id"]},{"name":"_smrt_billing_payment_attempts_payer_tenant_id_idx","columns":["payer_tenant_id"]}],"version":"43aceca7"},"importPath":"@happyvertical/smrt-commerce"}},"moduleType":"smrt","recipes":[{"id":"commerce.agreements","className":"AgreementsRecipe","label":"General agreements","summary":"Keep signed agreements with customers, and see every contract in one list.","synonyms":["contracts","terms","deals"],"models":["@happyvertical/smrt-commerce:Agreement","@happyvertical/smrt-commerce:Contract","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Agreements","model":"@happyvertical/smrt-commerce:Agreement","icon":"fileText","description":"Signed deals and terms with your customers, in one place."},{"label":"All contracts","model":"@happyvertical/smrt-commerce:Contract","icon":"fileText","description":"Every contract you hold, whoever it is with."}],"requires":["commerce.customers"],"group":{"id":"agreements","label":"Agreements","summary":"Contracts with customers: general agreements, leases and licence sales."},"section":{"id":"agreements","label":"Agreements","icon":"fileText","description":"Contracts, leases and licenses with customers."},"options":{"@happyvertical/smrt-commerce:Agreement":{"fields":{"contractType":{"default":"agreement","visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1,"required":true},"vendorId":{"visibility":"hidden"},"subtotal":{"visibility":"hidden"},"taxAmount":{"visibility":"hidden"},"channelId":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}},"@happyvertical/smrt-commerce:Contract":{"fields":{"channelId":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nAgreements are contracts you keep with customers. General agreements live here;\\nleases and licence sales are separate recipes in the same group.\\n**All contracts** lists every kind together, including orders and quotes.\\n\\n## Tasks\\n\\n### Record an agreement\\n\\n1. Create a new agreement.\\n2. Pick the **{field:customerId}**.\\n3. Set the **{field:issueDate}** and **{field:expiryDate}**.\\n4. Put the conditions in **{field:terms}** and save.\\n\\n### Follow it\\n\\n1. Update **{field:status}** from draft to accepted to completed.\\n2. Check **{field:expiryDate}** to spot agreements about to lapse.\\n","fieldRefs":["customerId","expiryDate","issueDate","status","terms"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.customers","className":"CustomersRecipe","label":"Customers","summary":"Keep a list of the people and companies you sell to.","synonyms":["clients","buyers","accounts"],"models":["@happyvertical/smrt-commerce:Customer"],"nav":[{"label":"Customers","model":"@happyvertical/smrt-commerce:Customer","icon":"users","description":"The people and companies you sell to, with how to reach them."}],"requires":[],"section":{"id":"sales","label":"Sales","icon":"shoppingBag","description":"Customers, orders and quotes: everything you sell."},"options":{"@happyvertical/smrt-commerce:Customer":{"fields":{"profileId":{"label":"Name","order":-1}}}},"help":{"markdown":"## Overview\\n\\nCustomers is your address book for the people and businesses you sell to. Keep\\none record for each customer so you can see who they are, how they like to pay\\nand what you have agreed with them, then refer back to them whenever you take an\\norder.\\n\\n## Tasks\\n\\n### Add a new customer\\n\\n1. Choose the **New** button above the list.\\n2. Describe the customer with **{field:customerType}**: a direct shopper, a\\n wholesale buyer or a retail customer. Note in **{field:status}** whether you\\n are still dealing with them.\\n3. Fill in the **{field:defaultShippingAddress}** and\\n **{field:defaultBillingAddress}** so you do not have to type them again on\\n every order.\\n4. Add **{field:paymentTerms}**, for example \\"Net 30\\", if you give this\\n customer time to pay.\\n5. Save. The customer is now on your list and ready to use on a sales order.\\n\\n### Keep track of what a customer can owe\\n\\n1. Open the customer from the list and choose Edit.\\n2. Set **{field:creditLimit}** to the most you are comfortable letting them owe\\n you at one time.\\n3. If you do not charge them sales tax, turn on **{field:taxExempt}**, and keep\\n their tax number on file.\\n4. Use **{field:notes}** for anything the next person who deals with this\\n customer should know.\\n\\n### Find a customer\\n\\nScan the list for the customer you want, or open a record to see everything you\\nhave on file. To stop dealing with someone without losing their history, change\\ntheir **{field:status}** to inactive instead of deleting them.\\n","fieldRefs":["creditLimit","customerType","defaultBillingAddress","defaultShippingAddress","notes","paymentTerms","status","taxExempt"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.estimates","className":"EstimatesRecipe","label":"Estimates","summary":"Send customers a price quote before they commit.","synonyms":["quotes","quotations","proposals","bids"],"models":["@happyvertical/smrt-commerce:Estimate","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Estimates","model":"@happyvertical/smrt-commerce:Estimate","icon":"fileText","description":"Price quotes you have sent to customers."}],"requires":["commerce.customers"],"section":{"id":"sales","label":"Sales","icon":"shoppingBag","description":"Customers, orders and quotes: everything you sell."},"options":{"@happyvertical/smrt-commerce:Estimate":{"fields":{"contractType":{"default":"estimate","visibility":"hidden","locked":true},"vendorId":{"visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1,"required":true},"channelId":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nEstimates are price quotes you send before a customer commits. Each one belongs\\nto a customer, lists its line items and shows how long the price is good for.\\n\\n## Tasks\\n\\n### Write an estimate\\n\\n1. Create a new estimate.\\n2. Pick the **{field:customerId}** the quote is for.\\n3. Add the line items, then check the **{field:totalAmount}**.\\n4. Set **{field:expiryDate}** to the last day the price is good for.\\n5. Put your conditions in **{field:terms}** and save.\\n\\n### Follow it up\\n\\n1. Set **{field:status}** to sent once it goes out.\\n2. Move it to accepted or declined when the customer answers.\\n","fieldRefs":["customerId","expiryDate","status","terms","totalAmount"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.fulfillment","className":"FulfillmentRecipe","label":"Shipping","summary":"Pack, ship and deliver orders, with tracking.","synonyms":["fulfillment","delivery","shipments","tracking"],"models":["@happyvertical/smrt-commerce:Fulfillment","@happyvertical/smrt-commerce:FulfillmentLineItem"],"nav":[{"label":"Shipments","model":"@happyvertical/smrt-commerce:Fulfillment","icon":"truck","description":"What has gone out the door and where it is now."}],"requires":[],"requiresAny":[["commerce.sales","commerce.wholesale"]],"group":{"id":"billing","label":"Billing & shipping","summary":"Invoice your customers, record what they pay and ship what they ordered."},"section":{"id":"operations","label":"Operations","icon":"wrench","description":"Fulfillment and the day-to-day work behind an order."},"options":{"@happyvertical/smrt-commerce:Fulfillment":{"fields":{"estimatedDelivery":{"visibility":"hidden"},"shippingAddress":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:FulfillmentLineItem":{"fields":{"notes":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nShipping tracks how an order gets to the customer. Each shipment belongs to an\\norder and lists which line items are in it, so an order can go out in parts.\\n\\n## Tasks\\n\\n### Ship an order\\n\\n1. Create a new shipment.\\n2. Pick the order in **{field:contractId}** and choose the\\n **{field:fulfillmentType}**.\\n3. Enter the **{field:carrier}** and **{field:trackingNumber}**.\\n4. List the items and quantities in the shipment.\\n5. Set **{field:status}** to shipped and record **{field:shippedAt}**.\\n\\n### Confirm delivery\\n\\n1. Open the shipment and set **{field:status}** to delivered.\\n2. Record **{field:deliveredAt}**.\\n","fieldRefs":["carrier","contractId","deliveredAt","fulfillmentType","shippedAt","status","trackingNumber"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.invoicing","className":"InvoicingRecipe","label":"Invoicing","summary":"Bill customers and record the payments that come in.","synonyms":["invoices","billing","payments","receivables"],"models":["@happyvertical/smrt-commerce:Invoice","@happyvertical/smrt-commerce:InvoiceLineItem","@happyvertical/smrt-commerce:Payment","@happyvertical/smrt-commerce:PaymentAllocation"],"nav":[{"label":"Invoices","model":"@happyvertical/smrt-commerce:Invoice","icon":"receipt","description":"Bills you have sent and which ones are still waiting to be paid."},{"label":"Payments","model":"@happyvertical/smrt-commerce:Payment","icon":"creditCard","description":"Money received, matched to the invoices it paid."}],"requires":["commerce.customers"],"group":{"id":"billing","label":"Billing & shipping","summary":"Invoice your customers, record what they pay and ship what they ordered."},"section":{"id":"billing","label":"Billing","icon":"receipt","description":"Invoices and the payments against them."},"options":{"@happyvertical/smrt-commerce:Invoice":{"fields":{"providerTaxAmount":{"visibility":"hidden"},"arJournalId":{"visibility":"hidden"},"revenueJournalId":{"visibility":"hidden"},"externalId":{"visibility":"hidden"},"customerExternalId":{"visibility":"hidden"},"externalProvider":{"visibility":"hidden"},"syncedAt":{"visibility":"hidden"},"collectionMethod":{"visibility":"hidden"},"sentAt":{"visibility":"hidden"},"viewedAt":{"visibility":"hidden"},"remindersSent":{"visibility":"hidden"},"lastReminderAt":{"visibility":"hidden"},"reference":{"visibility":"hidden"},"customerId":{"required":true}}},"@happyvertical/smrt-commerce:InvoiceLineItem":{"fields":{"invoiceEditorStateJson":{"visibility":"hidden"},"sourceType":{"visibility":"hidden"},"sourceId":{"visibility":"hidden"},"periodStart":{"visibility":"hidden"},"periodEnd":{"visibility":"hidden"},"revenueAccountId":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"sku":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}},"@happyvertical/smrt-commerce:Payment":{"fields":{"journalId":{"visibility":"hidden"},"externalId":{"visibility":"hidden"},"externalProvider":{"visibility":"hidden"},"syncedAt":{"visibility":"hidden"},"backendId":{"visibility":"hidden"},"backendTxRef":{"visibility":"hidden"},"nativeAmount":{"visibility":"hidden"},"nativeCurrency":{"visibility":"hidden"},"usdAtQuote":{"visibility":"hidden"},"usdAtConfirmation":{"visibility":"hidden"},"transactionId":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:PaymentAllocation":{"fields":{"allocatedBy":{"visibility":"hidden"}}}},"help":{"markdown":"## Overview\\n\\nInvoicing bills your customers and records what they pay. An invoice lists its\\nline items; a payment can be spread across one or more invoices.\\n\\n## Tasks\\n\\n### Send an invoice\\n\\n1. Create a new invoice.\\n2. Pick the **{field:customerId}** and add the line items.\\n3. Check the **{field:totalAmount}** and set the **{field:dueDate}**.\\n4. Set **{field:status}** to sent once it goes out.\\n\\n### Record a payment\\n\\n1. Create a new payment.\\n2. Pick the **{field:customerId}**, then enter the **{field:Payment.amount}** and the\\n **{field:method}** used.\\n3. Set **{field:Payment.status}** to completed once the money has arrived.\\n4. Apply it to the invoices it settles; each one shows what is still owed.\\n","fieldRefs":["Payment.amount","Payment.status","customerId","dueDate","method","status","totalAmount"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.leases","className":"LeasesRecipe","label":"Leases","summary":"Rent things out and track the term and the payments due.","synonyms":["rentals","renting","hire"],"models":["@happyvertical/smrt-commerce:Lease","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Leases","model":"@happyvertical/smrt-commerce:Lease","icon":"home","description":"Rentals you give or take, with terms and dates."}],"requires":["commerce.customers"],"group":{"id":"agreements","label":"Agreements","summary":"Contracts with customers: general agreements, leases and licence sales."},"section":{"id":"agreements","label":"Agreements","icon":"fileText","description":"Contracts, leases and licenses with customers."},"options":{"@happyvertical/smrt-commerce:Lease":{"fields":{"contractType":{"default":"lease","visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1,"required":true},"vendorId":{"visibility":"hidden"},"subtotal":{"visibility":"hidden"},"taxAmount":{"visibility":"hidden"},"channelId":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nLeases are agreements where a customer rents something from you for a period.\\nEach lease keeps its own line items and dates.\\n\\n## Tasks\\n\\n### Record a lease\\n\\n1. Create a new lease.\\n2. Pick the **{field:customerId}** renting from you.\\n3. Set the **{field:issueDate}** it starts and the **{field:expiryDate}** it ends.\\n4. Add a line item for each thing rented, then save.\\n\\n### Keep an eye on it\\n\\n1. Update **{field:status}** as the lease goes from draft to accepted to\\n completed.\\n2. Check **{field:expiryDate}** to see which leases end soon.\\n","fieldRefs":["customerId","expiryDate","issueDate","status"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.licenses","className":"LicensesRecipe","label":"Licence sales","summary":"Sell licences to software, content or other rights.","synonyms":["licenses","licensing","subscriptions"],"models":["@happyvertical/smrt-commerce:LicenseSale","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Licence sales","model":"@happyvertical/smrt-commerce:LicenseSale","icon":"shoppingBag","description":"Licences you have sold and who holds them."}],"requires":["commerce.customers"],"group":{"id":"agreements","label":"Agreements","summary":"Contracts with customers: general agreements, leases and licence sales."},"section":{"id":"agreements","label":"Agreements","icon":"fileText","description":"Contracts, leases and licenses with customers."},"options":{"@happyvertical/smrt-commerce:LicenseSale":{"fields":{"contractType":{"default":"license_sale","visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1,"required":true},"vendorId":{"visibility":"hidden"},"subtotal":{"visibility":"hidden"},"taxAmount":{"visibility":"hidden"},"channelId":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nLicence sales record selling the right to use something, such as software or\\ncontent, rather than a physical item.\\n\\n## Tasks\\n\\n### Record a licence sale\\n\\n1. Create a new licence sale.\\n2. Pick the **{field:customerId}** who bought the licence.\\n3. Add a line item for what is licensed and check the **{field:totalAmount}**.\\n4. Set the **{field:expiryDate}** if the licence runs out, then save.\\n\\n### Follow it\\n\\n1. Update **{field:status}** when the customer accepts or the sale completes.\\n","fieldRefs":["customerId","expiryDate","status","totalAmount"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.purchases","className":"PurchasesRecipe","label":"Purchases","summary":"Order from your vendors and track what you have bought.","synonyms":["purchase orders","buying","procurement"],"models":["@happyvertical/smrt-commerce:PurchaseOrder","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Purchase orders","model":"@happyvertical/smrt-commerce:PurchaseOrder","icon":"truck","description":"What you have ordered from your suppliers and when it arrives."}],"requires":["commerce.vendors"],"section":{"id":"purchasing","label":"Purchasing","icon":"truck","description":"Vendors and purchase orders: everything you buy."},"options":{"@happyvertical/smrt-commerce:PurchaseOrder":{"fields":{"contractType":{"default":"purchase_order","visibility":"hidden","locked":true},"customerId":{"visibility":"hidden","locked":true},"vendorId":{"label":"Vendor","order":1},"channelId":{"visibility":"hidden"},"expiryDate":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nPurchases is where you order from your vendors and keep track of what you have\\nbought. Every purchase order belongs to one of your vendors and records the\\namounts, the dates and where the order stands.\\n\\n## Tasks\\n\\n### Place a purchase order\\n\\n1. Choose the **New** button above the list.\\n2. Enter the **{field:vendorId}** you are buying from. Add them under Vendors\\n first so they are on your list.\\n3. Enter the **{field:subtotal}** and **{field:taxAmount}**, then the\\n **{field:totalAmount}** you expect to pay.\\n4. Set the **{field:issueDate}**, and the **{field:dueDate}** for when the\\n goods or the payment are due.\\n5. Add your own **{field:reference}**, such as the vendor's quote number, so\\n you can match it to their paperwork.\\n6. Save.\\n\\n### Follow an order until it arrives\\n\\n1. Open the purchase order from the list and choose Edit.\\n2. Update **{field:status}** as the order moves along, for example from draft to\\n sent, accepted and completed.\\n3. Use **{field:notes}** to record what the vendor told you, such as delays or\\n partial shipments.\\n\\n### Record the agreement\\n\\n1. Open the purchase order and choose Edit.\\n2. Write down the **{field:terms}** you agreed with the vendor, such as payment\\n or delivery conditions.\\n3. Set **{field:expiryDate}** if the vendor's offer is only good until a certain\\n day.\\n","fieldRefs":["dueDate","expiryDate","issueDate","notes","reference","status","subtotal","taxAmount","terms","totalAmount","vendorId"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.sales","className":"SalesRecipe","label":"Sales","summary":"Take customer orders and track them.","synonyms":["sales orders","orders","customer orders"],"models":["@happyvertical/smrt-commerce:Order","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Sales orders","model":"@happyvertical/smrt-commerce:Order","icon":"shoppingBag","description":"Orders from your customers, from placed to delivered."}],"requires":["commerce.customers"],"section":{"id":"sales","label":"Sales","icon":"shoppingBag","description":"Customers, orders and quotes: everything you sell."},"options":{"@happyvertical/smrt-commerce:Order":{"fields":{"contractType":{"default":"order","visibility":"hidden","locked":true},"vendorId":{"visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1,"required":true},"channelId":{"visibility":"hidden"},"expiryDate":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nSales is where you take orders from your customers and see where each one\\nstands. Every order belongs to one of your customers, carries its amounts and\\ndates, and keeps a status so you always know what is still open.\\n\\n## Tasks\\n\\n### Take an order\\n\\n1. Choose the **New** button above the list.\\n2. Enter the **{field:customerId}** the order is for. Add them under Customers\\n first so they are on your list.\\n3. Enter the **{field:subtotal}** and **{field:taxAmount}**, then the\\n **{field:totalAmount}** the customer will pay.\\n4. Set the **{field:issueDate}**, and the **{field:dueDate}** if you expect\\n payment by a certain day.\\n5. Add your own **{field:reference}**, such as a purchase order number the\\n customer gave you, so you can find the order later.\\n6. Save.\\n\\n### Follow an order through to the end\\n\\n1. Open the order from the list and choose Edit.\\n2. Update **{field:status}** as the order moves along, for example from draft to\\n sent, accepted and completed.\\n3. Check the **{field:dueDate}** against today to spot orders that are overdue.\\n4. Use **{field:notes}** to record calls, changes and anything promised.\\n\\n### Make a quote with an expiry\\n\\n1. Create the order as usual and set its **{field:status}** to show it is still\\n a draft.\\n2. Set **{field:expiryDate}** to the last day the price is good for.\\n3. Put your conditions, such as deposits or delivery, in **{field:terms}**.\\n","fieldRefs":["customerId","dueDate","expiryDate","issueDate","notes","reference","status","subtotal","taxAmount","terms","totalAmount"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.vendors","className":"VendorsRecipe","label":"Vendors","summary":"Keep a list of the suppliers you buy from.","synonyms":["suppliers","sellers"],"models":["@happyvertical/smrt-commerce:Vendor"],"nav":[{"label":"Vendors","model":"@happyvertical/smrt-commerce:Vendor","icon":"briefcase","description":"The suppliers you buy from, with terms and contacts."}],"requires":[],"section":{"id":"purchasing","label":"Purchasing","icon":"truck","description":"Vendors and purchase orders: everything you buy."},"options":{"@happyvertical/smrt-commerce:Vendor":{"fields":{"profileId":{"label":"Name","order":-1}}}},"help":{"markdown":"## Overview\\n\\nVendors is your list of the suppliers you buy from. Each record holds who they\\nare, how to reach them and the terms you have agreed, so you can order from them\\nquickly and keep track of what you have bought.\\n\\n## Tasks\\n\\n### Add a vendor\\n\\n1. Choose the **New** button above the list.\\n2. Enter **{field:defaultContactEmail}** and **{field:defaultContactPhone}** for\\n the person you normally deal with.\\n3. Set the **{field:currency}** they bill you in and your **{field:paymentTerms}**,\\n for example \\"Net 30\\".\\n4. Save. The vendor is now on your list and ready to use on a purchase order.\\n\\n### Note how a vendor likes to work\\n\\n1. Open the vendor from the list and choose Edit.\\n2. Enter **{field:leadTimeDays}**, the number of days they usually need between\\n your order and delivery, so you can plan ahead.\\n3. Enter **{field:minimumOrderAmount}** if they will not accept small orders.\\n4. Use **{field:notes}** for anything else worth remembering, such as the best\\n time to call.\\n\\n### Keep payment details in one place\\n\\n1. Open the vendor and choose Edit.\\n2. Record where payments to this vendor should be sent, so it is all in one\\n place.\\n3. Set **{field:status}** to show whether you still buy from them: active,\\n inactive or suspended.\\n","fieldRefs":["currency","defaultContactEmail","defaultContactPhone","leadTimeDays","minimumOrderAmount","notes","paymentTerms","status"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}},{"id":"commerce.wholesale","className":"WholesaleRecipe","label":"Wholesale orders","summary":"Take bulk orders from trade customers.","synonyms":["bulk orders","trade orders","b2b"],"models":["@happyvertical/smrt-commerce:WholesaleOrder","@happyvertical/smrt-commerce:ContractLineItem"],"nav":[{"label":"Wholesale orders","model":"@happyvertical/smrt-commerce:WholesaleOrder","icon":"shoppingBag","description":"Bulk orders from cafes, shops and other businesses."}],"requires":["commerce.customers"],"section":{"id":"sales","label":"Sales","icon":"shoppingBag","description":"Customers, orders and quotes: everything you sell."},"options":{"@happyvertical/smrt-commerce:WholesaleOrder":{"fields":{"contractType":{"default":"wholesale_order","visibility":"hidden","locked":true},"vendorId":{"visibility":"hidden","locked":true},"customerId":{"label":"Customer","order":1},"channelId":{"visibility":"hidden"},"expiryDate":{"visibility":"hidden"}}},"@happyvertical/smrt-commerce:ContractLineItem":{"fields":{"sku":{"visibility":"hidden"},"startDate":{"visibility":"hidden"},"endDate":{"visibility":"hidden"},"billingPeriod":{"visibility":"hidden"},"sortOrder":{"visibility":"hidden"},"discount":{"visibility":"hidden"},"taxRate":{"help":"Type a percentage: 5 means 5%."}}}},"help":{"markdown":"## Overview\\n\\nWholesale orders are bulk orders from trade customers. They work like sales\\norders, with a list of line items, but are kept in their own list so trade and\\nretail sales stay apart.\\n\\n## Tasks\\n\\n### Take a wholesale order\\n\\n1. Create a new wholesale order.\\n2. Pick the **{field:customerId}** placing the order.\\n3. Add the line items and check the **{field:totalAmount}**.\\n4. Set the **{field:dueDate}** for payment and save.\\n\\n### Track it\\n\\n1. Update **{field:status}** as the order moves from draft to completed.\\n2. Use **{field:reference}** for the buyer's own order number.\\n","fieldRefs":["customerId","dueDate","reference","status","totalAmount"]},"demo":{"mode":"server","reasons":["Needs a server because its package does not build for a browser: @happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-ledgers, @happyvertical/smrt-subscriptions, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3626, #3627)."]}}],"uiSelectors":{"customer-select":{"slotId":"customer-select","selects":"@happyvertical/smrt-commerce:Customer","label":"Customer Select","description":"Searchable customer picker for relation fields; the caller supplies the lookup"},"vendor-select":{"slotId":"vendor-select","selects":"@happyvertical/smrt-commerce:Vendor","label":"Vendor Select","description":"Searchable vendor picker for relation fields; the caller supplies the lookup"}},"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-ledgers","@happyvertical/smrt-subscriptions","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3615","#3624","#3626","#3627"],"reason":"@happyvertical/payments btcpay (node:crypto); core migrations (node:os). The jobs runner edge (#3615) is reported on smrt-jobs","via":["@happyvertical/smrt-jobs","@happyvertical/smrt-ledgers","@happyvertical/smrt-subscriptions","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
28
28
  //#endregion
29
29
  //#region src/billing/provider.ts
30
30
  function providerCapabilities(provider) {
@@ -143,7 +143,10 @@ __decorateClass$13([field({ description: "Where you usually send goods to this c
143
143
  __decorateClass$13([field({ description: "Where you send invoices to this customer." })], Customer.prototype, "defaultBillingAddress", 2);
144
144
  __decorateClass$13([field({ description: "Whether you are still dealing with this customer: active, inactive or suspended." })], Customer.prototype, "status", 2);
145
145
  __decorateClass$13([field({ description: "The kind of customer: a direct shopper, a wholesale buyer or a retail customer." })], Customer.prototype, "customerType", 2);
146
- __decorateClass$13([field({ description: "Anything worth remembering about this customer." })], Customer.prototype, "notes", 2);
146
+ __decorateClass$13([field({
147
+ description: "Anything worth remembering about this customer.",
148
+ ui: { widget: "textarea" }
149
+ })], Customer.prototype, "notes", 2);
147
150
  Customer = __decorateClass$13([TenantScoped({ mode: "optional" }), smrt({
148
151
  api: { include: [
149
152
  "list",
@@ -756,43 +759,17 @@ var Payment = class extends SmrtObject {
756
759
  tenantId = null;
757
760
  contractId = null;
758
761
  customerId = null;
759
- /**
760
- * Payment amount, in **integer minor units** (cents, satoshis).
761
- *
762
- * The `= 0` initializer is load-bearing: SMRT maps an integer literal to
763
- * INTEGER and a decimal literal to DECIMAL. This is the figure
764
- * `PaymentAllocation.save()` caps allocations against and `Invoice.amountPaid`
765
- * is summed from, so it must be in the same exact units as both (#2401).
766
- */
767
762
  amount = 0;
768
- /**
769
- * Currency code (ISO 4217)
770
- */
771
763
  currency = "USD";
772
- /**
773
- * Payment method used
774
- */
775
764
  method = PaymentMethod.BANK_TRANSFER;
776
- /**
777
- * Current payment status
778
- */
779
765
  status = PaymentStatus.PENDING;
780
766
  /**
781
767
  * External transaction ID (from payment processor)
782
768
  */
783
769
  transactionId = "";
784
- /**
785
- * Internal reference number
786
- */
787
770
  reference = "";
788
771
  journalId = "";
789
- /**
790
- * When the payment was completed
791
- */
792
772
  paidAt = null;
793
- /**
794
- * Notes about the payment
795
- */
796
773
  notes = "";
797
774
  /**
798
775
  * External ID in accounting provider (e.g., QBO payment ID)
@@ -1028,7 +1005,7 @@ var Payment = class extends SmrtObject {
1028
1005
  Number(this.usdAtConfirmation ?? 0)
1029
1006
  ]
1030
1007
  ];
1031
- for (const [field, prior, next] of frozen) if (prior !== next) throw new Error(`Payment ${this.id}: '${field}' is frozen once the payment is COMPLETED (was '${prior}', got '${next}'). A settled payment's monetary fields cannot be mutated \u2014 issue a refund instead.`);
1008
+ for (const [field2, prior, next] of frozen) if (prior !== next) throw new Error(`Payment ${this.id}: '${field2}' is frozen once the payment is COMPLETED (was '${prior}', got '${next}'). A settled payment's monetary fields cannot be mutated \u2014 issue a refund instead.`);
1032
1009
  }
1033
1010
  /**
1034
1011
  * USD drift between quote time and confirmation time — what the
@@ -1145,9 +1122,22 @@ var Payment = class extends SmrtObject {
1145
1122
  };
1146
1123
  __publicField$11(Payment, "__smrtPackage__", "@happyvertical/smrt-commerce");
1147
1124
  __decorateClass$11([tenantId({ nullable: true })], Payment.prototype, "tenantId", 2);
1148
- __decorateClass$11([foreignKey("Contract")], Payment.prototype, "contractId", 2);
1149
- __decorateClass$11([foreignKey("Customer")], Payment.prototype, "customerId", 2);
1125
+ __decorateClass$11([field({ description: "The order or agreement this payment is for, if any." }), foreignKey("Contract")], Payment.prototype, "contractId", 2);
1126
+ __decorateClass$11([field({ description: "The customer who paid." }), foreignKey("Customer")], Payment.prototype, "customerId", 2);
1127
+ __decorateClass$11([field({ description: "How much was paid." })], Payment.prototype, "amount", 2);
1128
+ __decorateClass$11([field({
1129
+ description: "The currency of the payment.",
1130
+ ui: { widget: "currency" }
1131
+ })], Payment.prototype, "currency", 2);
1132
+ __decorateClass$11([field({ description: "How it was paid: cash, check, card, bank transfer or other." })], Payment.prototype, "method", 2);
1133
+ __decorateClass$11([field({ description: "Whether the payment is pending, completed, failed or refunded." })], Payment.prototype, "status", 2);
1134
+ __decorateClass$11([field({ description: "A reference note, such as a check number." })], Payment.prototype, "reference", 2);
1150
1135
  __decorateClass$11([crossPackageRef("@happyvertical/smrt-ledgers:Journal")], Payment.prototype, "journalId", 2);
1136
+ __decorateClass$11([field({ description: "When the money was received." })], Payment.prototype, "paidAt", 2);
1137
+ __decorateClass$11([field({
1138
+ description: "Anything worth remembering about this payment.",
1139
+ ui: { widget: "textarea" }
1140
+ })], Payment.prototype, "notes", 2);
1151
1141
  Payment = __decorateClass$11([TenantScoped({ mode: "optional" }), smrt({
1152
1142
  api: {
1153
1143
  include: [
@@ -2207,28 +2197,12 @@ var PaymentAllocation = class extends SmrtObject {
2207
2197
  tenantId = null;
2208
2198
  paymentId = "";
2209
2199
  invoiceId = "";
2210
- /**
2211
- * Amount allocated from payment to invoice, in **integer minor units**
2212
- * (cents, satoshis).
2213
- *
2214
- * Matches `Invoice.amountPaid` (derived by summing these rows) and
2215
- * `Payment.amount` (which `save()` caps against). All three converted
2216
- * together in #2401 — the cap is a subtraction across the pair, so a
2217
- * dollars-vs-cents split there would reject every allocation as
2218
- * over-applying.
2219
- */
2220
2200
  amount = 0;
2221
- /**
2222
- * When the allocation was made
2223
- */
2224
2201
  allocatedAt = /* @__PURE__ */ new Date();
2225
2202
  /**
2226
2203
  * User/agent who made the allocation
2227
2204
  */
2228
2205
  allocatedBy = "";
2229
- /**
2230
- * Notes about the allocation
2231
- */
2232
2206
  notes = "";
2233
2207
  constructor(options = {}) {
2234
2208
  super(options);
@@ -2293,8 +2267,11 @@ var PaymentAllocation = class extends SmrtObject {
2293
2267
  };
2294
2268
  __publicField$10(PaymentAllocation, "__smrtPackage__", "@happyvertical/smrt-commerce");
2295
2269
  __decorateClass$10([tenantId({ nullable: true })], PaymentAllocation.prototype, "tenantId", 2);
2296
- __decorateClass$10([foreignKey("Payment")], PaymentAllocation.prototype, "paymentId", 2);
2297
- __decorateClass$10([foreignKey("Invoice")], PaymentAllocation.prototype, "invoiceId", 2);
2270
+ __decorateClass$10([field({ description: "The payment being applied." }), foreignKey("Payment")], PaymentAllocation.prototype, "paymentId", 2);
2271
+ __decorateClass$10([field({ description: "The invoice it settles." }), foreignKey("Invoice")], PaymentAllocation.prototype, "invoiceId", 2);
2272
+ __decorateClass$10([field({ description: "How much of the payment goes to this invoice." })], PaymentAllocation.prototype, "amount", 2);
2273
+ __decorateClass$10([field({ description: "When it was applied." })], PaymentAllocation.prototype, "allocatedAt", 2);
2274
+ __decorateClass$10([field({ description: "Anything worth remembering about this allocation." })], PaymentAllocation.prototype, "notes", 2);
2298
2275
  PaymentAllocation = __decorateClass$10([TenantScoped({ mode: "optional" }), smrt({
2299
2276
  api: { include: ["list", "get"] },
2300
2277
  mcp: { include: ["list", "get"] },
@@ -2683,41 +2660,15 @@ var Invoice = class extends SmrtObject {
2683
2660
  tenantId = null;
2684
2661
  customerId = "";
2685
2662
  contractId = "";
2686
- /**
2687
- * Invoice number (e.g., INV-2025-0001)
2688
- * Generated via InvoiceCollection.generateInvoiceNumber()
2689
- */
2690
2663
  invoiceNumber = "";
2691
2664
  /**
2692
2665
  * External reference (e.g., customer PO number)
2693
2666
  */
2694
2667
  reference = "";
2695
- /**
2696
- * Date invoice was issued
2697
- */
2698
2668
  issueDate = /* @__PURE__ */ new Date();
2699
- /**
2700
- * Payment due date
2701
- */
2702
2669
  dueDate = /* @__PURE__ */ new Date();
2703
- /**
2704
- * Date invoice was fully paid
2705
- */
2706
2670
  paidDate = null;
2707
- /**
2708
- * Subtotal before tax, in **integer minor units** (cents, satoshis).
2709
- *
2710
- * The `= 0` initializer is load-bearing: SMRT maps an integer literal to
2711
- * INTEGER and a decimal literal to DECIMAL. Money is exact, so it is stored
2712
- * as minor units and never as a float — `$19.99` is `1999`, not `19.99`.
2713
- * Writing a fractional major-unit value here is the bug; PostgreSQL rejects
2714
- * it with `22P02` while SQLite's affinity silently stores it (#2361).
2715
- */
2716
2671
  subtotal = 0;
2717
- /**
2718
- * Tax amount, in integer minor units (#2361). With line items this is the
2719
- * sum of their rate-based tax plus {@link providerTaxAmount}.
2720
- */
2721
2672
  taxAmount = 0;
2722
2673
  /**
2723
2674
  * Tax calculated by the payment provider (for example Stripe Tax) from the
@@ -2727,21 +2678,9 @@ var Invoice = class extends SmrtObject {
2727
2678
  * authoritative from line items plus this one provider figure.
2728
2679
  */
2729
2680
  providerTaxAmount = 0;
2730
- /**
2731
- * Total amount due (subtotal + tax), in integer minor units (#2361).
2732
- */
2733
2681
  totalAmount = 0;
2734
- /**
2735
- * Amount paid (sum of PaymentAllocations), in integer minor units (#2361).
2736
- */
2737
2682
  amountPaid = 0;
2738
- /**
2739
- * Currency code (ISO 4217)
2740
- */
2741
2683
  currency = "CAD";
2742
- /**
2743
- * Current invoice status
2744
- */
2745
2684
  status = InvoiceStatus.DRAFT;
2746
2685
  arJournalId = "";
2747
2686
  revenueJournalId = "";
@@ -2786,17 +2725,8 @@ var Invoice = class extends SmrtObject {
2786
2725
  * When last reminder was sent
2787
2726
  */
2788
2727
  lastReminderAt = null;
2789
- /**
2790
- * Internal notes (not shown to customer)
2791
- */
2792
2728
  notes = "";
2793
- /**
2794
- * Notes shown to customer on invoice
2795
- */
2796
2729
  customerNotes = "";
2797
- /**
2798
- * Payment terms text
2799
- */
2800
2730
  terms = "";
2801
2731
  constructor(options = {}) {
2802
2732
  super(options);
@@ -3008,7 +2938,7 @@ var Invoice = class extends SmrtObject {
3008
2938
  ["amountPaid", this.amountPaid]
3009
2939
  ];
3010
2940
  assertIntegerMinorUnits("Invoice", label, amounts);
3011
- for (const [field, value] of amounts) if (value < 0) throw new Error(`Invoice ${label}: ${field} must be a non-negative number (got ${value}).`);
2941
+ for (const [field2, value] of amounts) if (value < 0) throw new Error(`Invoice ${label}: ${field2} must be a non-negative number (got ${value}).`);
3012
2942
  if (this.amountPaid > this.totalAmount) throw new Error(`Invoice ${label}: amountPaid ${this.amountPaid} cannot exceed totalAmount ${this.totalAmount}.`);
3013
2943
  }
3014
2944
  /**
@@ -3239,10 +3169,35 @@ var Invoice = class extends SmrtObject {
3239
3169
  };
3240
3170
  __publicField$9(Invoice, "__smrtPackage__", "@happyvertical/smrt-commerce");
3241
3171
  __decorateClass$9([tenantId({ nullable: true })], Invoice.prototype, "tenantId", 2);
3242
- __decorateClass$9([foreignKey("Customer")], Invoice.prototype, "customerId", 2);
3243
- __decorateClass$9([foreignKey("Contract")], Invoice.prototype, "contractId", 2);
3172
+ __decorateClass$9([field({ description: "The customer being billed." }), foreignKey("Customer")], Invoice.prototype, "customerId", 2);
3173
+ __decorateClass$9([field({ description: "The order or agreement this invoice bills for, if any." }), foreignKey("Contract")], Invoice.prototype, "contractId", 2);
3174
+ __decorateClass$9([field({ description: "The number printed on the invoice." })], Invoice.prototype, "invoiceNumber", 2);
3175
+ __decorateClass$9([field({ description: "The date the invoice was issued." })], Invoice.prototype, "issueDate", 2);
3176
+ __decorateClass$9([field({ description: "The date payment is expected." })], Invoice.prototype, "dueDate", 2);
3177
+ __decorateClass$9([field({ description: "The date it was paid in full." })], Invoice.prototype, "paidDate", 2);
3178
+ __decorateClass$9([field({ description: "The amount before tax." })], Invoice.prototype, "subtotal", 2);
3179
+ __decorateClass$9([field({ description: "The tax charged." })], Invoice.prototype, "taxAmount", 2);
3180
+ __decorateClass$9([field({ description: "What the customer owes in all, tax included." })], Invoice.prototype, "totalAmount", 2);
3181
+ __decorateClass$9([field({ description: "How much of the total has been paid so far." })], Invoice.prototype, "amountPaid", 2);
3182
+ __decorateClass$9([field({
3183
+ description: "The currency of the invoice.",
3184
+ ui: { widget: "currency" }
3185
+ })], Invoice.prototype, "currency", 2);
3186
+ __decorateClass$9([field({ description: "Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled." })], Invoice.prototype, "status", 2);
3244
3187
  __decorateClass$9([crossPackageRef("@happyvertical/smrt-ledgers:Journal")], Invoice.prototype, "arJournalId", 2);
3245
3188
  __decorateClass$9([crossPackageRef("@happyvertical/smrt-ledgers:Journal")], Invoice.prototype, "revenueJournalId", 2);
3189
+ __decorateClass$9([field({
3190
+ description: "Private notes, not shown to the customer.",
3191
+ ui: { widget: "textarea" }
3192
+ })], Invoice.prototype, "notes", 2);
3193
+ __decorateClass$9([field({
3194
+ description: "A message shown to the customer on the invoice.",
3195
+ ui: { widget: "textarea" }
3196
+ })], Invoice.prototype, "customerNotes", 2);
3197
+ __decorateClass$9([field({
3198
+ description: "The payment conditions, such as Net 30.",
3199
+ ui: { widget: "textarea" }
3200
+ })], Invoice.prototype, "terms", 2);
3246
3201
  Invoice = __decorateClass$9([TenantScoped({ mode: "optional" }), smrt({
3247
3202
  api: {
3248
3203
  include: [
@@ -5233,15 +5188,11 @@ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !==
5233
5188
  var InvoiceLineItem = class extends SmrtObject {
5234
5189
  tenantId = null;
5235
5190
  invoiceId = "";
5236
- /**
5237
- * Item description
5238
- */
5239
5191
  description = "";
5240
5192
  /**
5241
5193
  * SKU or item code
5242
5194
  */
5243
5195
  sku = "";
5244
- /** Nonnegative decimal quantity (hours, weight, units), up to six fractional digits. */
5245
5196
  quantity = 1;
5246
5197
  /** Raw editor modes retained only while they resolve to the authoritative model fields. */
5247
5198
  invoiceEditorStateJson = "";
@@ -5259,29 +5210,12 @@ var InvoiceLineItem = class extends SmrtObject {
5259
5210
  set invoiceEditorState(value) {
5260
5211
  this.invoiceEditorStateJson = value ? JSON.stringify(value) : "";
5261
5212
  }
5262
- /**
5263
- * Unit price before discount, in **integer minor units** (cents, satoshis).
5264
- *
5265
- * Money is exact, so it is stored as minor units and never as a float —
5266
- * `$19.99` is `1999`. An integer literal is what maps this to an INTEGER
5267
- * column (#2361).
5268
- */
5269
5213
  unitPrice = 0;
5270
5214
  /**
5271
5215
  * Discount amount (flat, not percentage), in integer minor units (#2361).
5272
5216
  */
5273
5217
  discount = 0;
5274
- /**
5275
- * Tax rate as a decimal fraction (e.g., 0.05 for 5%).
5276
- *
5277
- * A genuine rate, not money: it is inherently fractional, so the `0.0`
5278
- * initializer is load-bearing and maps it to a DECIMAL column. INTEGER would
5279
- * truncate every rate to 0 (#2361).
5280
- */
5281
5218
  taxRate = 0;
5282
- /**
5283
- * Calculated line amount, in integer minor units (#2361).
5284
- */
5285
5219
  amount = 0;
5286
5220
  /**
5287
5221
  * Type of source ('campaign' | 'contract' | 'manual' | etc.)
@@ -5400,7 +5334,12 @@ var InvoiceLineItem = class extends SmrtObject {
5400
5334
  };
5401
5335
  __publicField$7(InvoiceLineItem, "__smrtPackage__", "@happyvertical/smrt-commerce");
5402
5336
  __decorateClass$7([tenantId({ nullable: true })], InvoiceLineItem.prototype, "tenantId", 2);
5403
- __decorateClass$7([foreignKey("Invoice")], InvoiceLineItem.prototype, "invoiceId", 2);
5337
+ __decorateClass$7([field({ description: "The invoice this line belongs to." }), foreignKey("Invoice")], InvoiceLineItem.prototype, "invoiceId", 2);
5338
+ __decorateClass$7([field({ description: "What is being billed on this line." })], InvoiceLineItem.prototype, "description", 2);
5339
+ __decorateClass$7([field({ description: "How many." })], InvoiceLineItem.prototype, "quantity", 2);
5340
+ __decorateClass$7([field({ description: "The price of one, before tax." })], InvoiceLineItem.prototype, "unitPrice", 2);
5341
+ __decorateClass$7([field({ description: "The tax rate for this line, as a percentage (5 means 5%)." })], InvoiceLineItem.prototype, "taxRate", 2);
5342
+ __decorateClass$7([field({ description: "The line total." })], InvoiceLineItem.prototype, "amount", 2);
5404
5343
  __decorateClass$7([crossPackageRef("@happyvertical/smrt-ledgers:Account")], InvoiceLineItem.prototype, "revenueAccountId", 2);
5405
5344
  InvoiceLineItem = __decorateClass$7([TenantScoped({ mode: "optional" }), smrt({
5406
5345
  api: { include: [
@@ -6646,11 +6585,23 @@ __decorateClass$6([crossPackageRef("@happyvertical/smrt-profiles:Profile", { des
6646
6585
  __decorateClass$6([field({ description: "How many days the vendor usually takes between your order and delivery." })], Vendor.prototype, "leadTimeDays", 2);
6647
6586
  __decorateClass$6([field({ description: "The smallest order the vendor will accept." })], Vendor.prototype, "minimumOrderAmount", 2);
6648
6587
  __decorateClass$6([field({ description: "How long you have to pay this vendor, written the way you would say it, for example \"Net 30\"." })], Vendor.prototype, "paymentTerms", 2);
6649
- __decorateClass$6([field({ description: "The currency this vendor bills you in." })], Vendor.prototype, "currency", 2);
6650
- __decorateClass$6([field({ description: "The email address you normally use to reach this vendor." })], Vendor.prototype, "defaultContactEmail", 2);
6651
- __decorateClass$6([field({ description: "The phone number you normally use to reach this vendor." })], Vendor.prototype, "defaultContactPhone", 2);
6588
+ __decorateClass$6([field({
6589
+ description: "The currency this vendor bills you in.",
6590
+ ui: { widget: "currency" }
6591
+ })], Vendor.prototype, "currency", 2);
6592
+ __decorateClass$6([field({
6593
+ description: "The email address you normally use to reach this vendor.",
6594
+ ui: { widget: "email" }
6595
+ })], Vendor.prototype, "defaultContactEmail", 2);
6596
+ __decorateClass$6([field({
6597
+ description: "The phone number you normally use to reach this vendor.",
6598
+ ui: { widget: "phone" }
6599
+ })], Vendor.prototype, "defaultContactPhone", 2);
6652
6600
  __decorateClass$6([field({ description: "Whether you still buy from this vendor: active, inactive or suspended." })], Vendor.prototype, "status", 2);
6653
- __decorateClass$6([field({ description: "Anything worth remembering about this vendor." })], Vendor.prototype, "notes", 2);
6601
+ __decorateClass$6([field({
6602
+ description: "Anything worth remembering about this vendor.",
6603
+ ui: { widget: "textarea" }
6604
+ })], Vendor.prototype, "notes", 2);
6654
6605
  __decorateClass$6([field({
6655
6606
  sensitive: true,
6656
6607
  description: "Where payments to this vendor should be sent."
@@ -6702,9 +6653,6 @@ var CONTRACT_STATUS_TRANSITIONS = {
6702
6653
  var loadedContractStatus = /* @__PURE__ */ new WeakMap();
6703
6654
  var Contract = class extends SmrtObject {
6704
6655
  tenantId = null;
6705
- /**
6706
- * Contract type discriminator (STI)
6707
- */
6708
6656
  contractType = ContractType.ORDER;
6709
6657
  status = ContractStatus.DRAFT;
6710
6658
  customerId = null;
@@ -6851,19 +6799,29 @@ __publicField$5(Contract, "__smrtPackage__", "@happyvertical/smrt-commerce");
6851
6799
  */
6852
6800
  __publicField$5(Contract, "_stiField", "contractType");
6853
6801
  __decorateClass$5([tenantId({ nullable: true })], Contract.prototype, "tenantId", 2);
6802
+ __decorateClass$5([field({ description: "The kind of contract: order, estimate, lease, agreement and so on." })], Contract.prototype, "contractType", 2);
6854
6803
  __decorateClass$5([field({ description: "Where the order or agreement stands, for example draft, sent, accepted or completed." })], Contract.prototype, "status", 2);
6855
6804
  __decorateClass$5([foreignKey(Customer, { description: "The customer a sales order or agreement is for." })], Contract.prototype, "customerId", 2);
6856
6805
  __decorateClass$5([foreignKey(Vendor, { description: "The vendor a purchase order is placed with." })], Contract.prototype, "vendorId", 2);
6857
6806
  __decorateClass$5([field({ description: "The amount before tax." })], Contract.prototype, "subtotal", 2);
6858
6807
  __decorateClass$5([field({ description: "The tax charged." })], Contract.prototype, "taxAmount", 2);
6859
6808
  __decorateClass$5([field({ description: "The full amount, tax included." })], Contract.prototype, "totalAmount", 2);
6860
- __decorateClass$5([field({ description: "The currency of the amounts." })], Contract.prototype, "currency", 2);
6809
+ __decorateClass$5([field({
6810
+ description: "The currency of the amounts.",
6811
+ ui: { widget: "currency" }
6812
+ })], Contract.prototype, "currency", 2);
6861
6813
  __decorateClass$5([field({ description: "The date it was issued or placed." })], Contract.prototype, "issueDate", 2);
6862
6814
  __decorateClass$5([field({ description: "The date payment or delivery is due." })], Contract.prototype, "dueDate", 2);
6863
6815
  __decorateClass$5([field({ description: "The last day the price or offer is good for." })], Contract.prototype, "expiryDate", 2);
6864
6816
  __decorateClass$5([field({ description: "Your own number or note for finding this later, such as a purchase order or quote number." })], Contract.prototype, "reference", 2);
6865
- __decorateClass$5([field({ description: "Anything worth remembering about this." })], Contract.prototype, "notes", 2);
6866
- __decorateClass$5([field({ description: "The conditions agreed, such as deposits, payment or delivery conditions." })], Contract.prototype, "terms", 2);
6817
+ __decorateClass$5([field({
6818
+ description: "Anything worth remembering about this.",
6819
+ ui: { widget: "textarea" }
6820
+ })], Contract.prototype, "notes", 2);
6821
+ __decorateClass$5([field({
6822
+ description: "The conditions agreed, such as deposits, payment or delivery conditions.",
6823
+ ui: { widget: "textarea" }
6824
+ })], Contract.prototype, "terms", 2);
6867
6825
  __decorateClass$5([field({ description: "Where it came from, for example your shop, a marketplace or a phone call." })], Contract.prototype, "channelId", 2);
6868
6826
  Contract = __decorateClass$5([TenantScoped({ mode: "optional" }), smrt({
6869
6827
  tableStrategy: "sti",
@@ -7257,37 +7215,14 @@ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !==
7257
7215
  var ContractLineItem = class extends SmrtObject {
7258
7216
  tenantId = null;
7259
7217
  contractId = "";
7260
- /**
7261
- * Item description
7262
- */
7263
7218
  description = "";
7264
- /**
7265
- * Quantity ordered. Decimal on purpose — contracts price fractional
7266
- * quantities (hours, weight, bandwidth), as do invoice line items.
7267
- */
7268
7219
  quantity = 1;
7269
- /**
7270
- * Unit price before discount, in **integer minor units** (cents, satoshis).
7271
- *
7272
- * The `= 0` initializer is load-bearing: SMRT maps an integer literal to
7273
- * INTEGER and a decimal literal to DECIMAL. Money is exact, so `$49.99` is
7274
- * `4999` (#2401).
7275
- */
7276
7220
  unitPrice = 0;
7277
7221
  /**
7278
7222
  * Discount amount (flat, not percentage), in integer minor units (#2401).
7279
7223
  */
7280
7224
  discount = 0;
7281
- /**
7282
- * Tax rate as decimal (e.g., 0.08 for 8%). A rate is inherently fractional,
7283
- * so it stays DECIMAL — INTEGER would truncate every meaningful value.
7284
- */
7285
7225
  taxRate = 0;
7286
- /**
7287
- * Calculated line amount (qty * price - discount + tax), in integer minor
7288
- * units. Derived by {@link ContractLineItem.calculateAmount}, which rounds
7289
- * the fractional tax to a whole minor unit (#2401).
7290
- */
7291
7226
  amount = 0;
7292
7227
  productId = "";
7293
7228
  /**
@@ -7361,8 +7296,13 @@ var ContractLineItem = class extends SmrtObject {
7361
7296
  };
7362
7297
  __publicField$4(ContractLineItem, "__smrtPackage__", "@happyvertical/smrt-commerce");
7363
7298
  __decorateClass$4([tenantId({ nullable: true })], ContractLineItem.prototype, "tenantId", 2);
7364
- __decorateClass$4([foreignKey("Contract")], ContractLineItem.prototype, "contractId", 2);
7365
- __decorateClass$4([crossPackageRef("@happyvertical/smrt-products:Product")], ContractLineItem.prototype, "productId", 2);
7299
+ __decorateClass$4([field({ description: "The order, quote or agreement this line belongs to." }), foreignKey("Contract")], ContractLineItem.prototype, "contractId", 2);
7300
+ __decorateClass$4([field({ description: "What is being sold or bought on this line." })], ContractLineItem.prototype, "description", 2);
7301
+ __decorateClass$4([field({ description: "How many." })], ContractLineItem.prototype, "quantity", 2);
7302
+ __decorateClass$4([field({ description: "The price of one, before tax." })], ContractLineItem.prototype, "unitPrice", 2);
7303
+ __decorateClass$4([field({ description: "The tax rate for this line, as a percentage (5 means 5%)." })], ContractLineItem.prototype, "taxRate", 2);
7304
+ __decorateClass$4([field({ description: "The line total." })], ContractLineItem.prototype, "amount", 2);
7305
+ __decorateClass$4([field({ description: "The product this line is for, if it is one you list." }), crossPackageRef("@happyvertical/smrt-products:Product")], ContractLineItem.prototype, "productId", 2);
7366
7306
  ContractLineItem = __decorateClass$4([TenantScoped({ mode: "optional" }), smrt({
7367
7307
  tableStrategy: "sti",
7368
7308
  api: { include: [
@@ -7463,41 +7403,20 @@ var loadedFulfillmentStatus = /* @__PURE__ */ new WeakMap();
7463
7403
  var Fulfillment = class extends SmrtObject {
7464
7404
  tenantId = null;
7465
7405
  contractId = "";
7466
- /**
7467
- * Type of fulfillment
7468
- */
7469
7406
  fulfillmentType = FulfillmentType.SHIPMENT;
7470
- /**
7471
- * Current fulfillment status
7472
- */
7473
7407
  status = FulfillmentStatus.PENDING;
7474
- /**
7475
- * Tracking number from carrier
7476
- */
7477
7408
  trackingNumber = "";
7478
- /**
7479
- * Shipping carrier name
7480
- */
7481
7409
  carrier = "";
7482
7410
  /**
7483
7411
  * Shipping destination address
7484
7412
  */
7485
7413
  shippingAddress = {};
7486
- /**
7487
- * When the shipment was sent
7488
- */
7489
7414
  shippedAt = null;
7490
- /**
7491
- * When the shipment was delivered
7492
- */
7493
7415
  deliveredAt = null;
7494
7416
  /**
7495
7417
  * Estimated delivery date
7496
7418
  */
7497
7419
  estimatedDelivery = null;
7498
- /**
7499
- * Notes about this fulfillment
7500
- */
7501
7420
  notes = "";
7502
7421
  constructor(options = {}) {
7503
7422
  super(options);
@@ -7619,7 +7538,14 @@ var Fulfillment = class extends SmrtObject {
7619
7538
  };
7620
7539
  __publicField$3(Fulfillment, "__smrtPackage__", "@happyvertical/smrt-commerce");
7621
7540
  __decorateClass$3([tenantId({ nullable: true })], Fulfillment.prototype, "tenantId", 2);
7622
- __decorateClass$3([foreignKey("Contract")], Fulfillment.prototype, "contractId", 2);
7541
+ __decorateClass$3([field({ description: "The order being fulfilled." }), foreignKey("Contract")], Fulfillment.prototype, "contractId", 2);
7542
+ __decorateClass$3([field({ description: "How it gets to the customer: shipment, delivery, pickup, digital or service." })], Fulfillment.prototype, "fulfillmentType", 2);
7543
+ __decorateClass$3([field({ description: "Where it stands: pending, processing, shipped, delivered or cancelled." })], Fulfillment.prototype, "status", 2);
7544
+ __decorateClass$3([field({ description: "The carrier's tracking number." })], Fulfillment.prototype, "trackingNumber", 2);
7545
+ __decorateClass$3([field({ description: "The company carrying it." })], Fulfillment.prototype, "carrier", 2);
7546
+ __decorateClass$3([field({ description: "When it was dispatched." })], Fulfillment.prototype, "shippedAt", 2);
7547
+ __decorateClass$3([field({ description: "When it arrived." })], Fulfillment.prototype, "deliveredAt", 2);
7548
+ __decorateClass$3([field({ description: "Anything worth remembering about this shipment." })], Fulfillment.prototype, "notes", 2);
7623
7549
  Fulfillment = __decorateClass$3([TenantScoped({ mode: "optional" }), smrt({
7624
7550
  api: { include: [
7625
7551
  "list",
@@ -7771,9 +7697,6 @@ var FulfillmentLineItem = class extends SmrtObject {
7771
7697
  tenantId = null;
7772
7698
  fulfillmentId = "";
7773
7699
  contractLineItemId = "";
7774
- /**
7775
- * Quantity fulfilled in this fulfillment
7776
- */
7777
7700
  quantityFulfilled = 1;
7778
7701
  /**
7779
7702
  * Notes about this line item
@@ -7831,8 +7754,9 @@ var FulfillmentLineItem = class extends SmrtObject {
7831
7754
  };
7832
7755
  __publicField$2(FulfillmentLineItem, "__smrtPackage__", "@happyvertical/smrt-commerce");
7833
7756
  __decorateClass$2([tenantId({ nullable: true })], FulfillmentLineItem.prototype, "tenantId", 2);
7834
- __decorateClass$2([foreignKey("Fulfillment")], FulfillmentLineItem.prototype, "fulfillmentId", 2);
7835
- __decorateClass$2([foreignKey("ContractLineItem")], FulfillmentLineItem.prototype, "contractLineItemId", 2);
7757
+ __decorateClass$2([field({ description: "The shipment this line belongs to." }), foreignKey("Fulfillment")], FulfillmentLineItem.prototype, "fulfillmentId", 2);
7758
+ __decorateClass$2([field({ description: "The order line being sent." }), foreignKey("ContractLineItem")], FulfillmentLineItem.prototype, "contractLineItemId", 2);
7759
+ __decorateClass$2([field({ description: "How many of that line are in this shipment." })], FulfillmentLineItem.prototype, "quantityFulfilled", 2);
7836
7760
  FulfillmentLineItem = __decorateClass$2([TenantScoped({ mode: "optional" }), smrt({
7837
7761
  api: { include: [
7838
7762
  "list",
@@ -9326,29 +9250,82 @@ var CustomersRecipe = class extends SmrtRecipe {
9326
9250
  static id = "commerce.customers";
9327
9251
  static help = "./customers.recipe.md";
9328
9252
  static label = "Customers";
9329
- static summary = "Keep a list of the customers you sell to.";
9253
+ static summary = "Keep a list of the people and companies you sell to.";
9330
9254
  static synonyms = [
9331
9255
  "clients",
9332
9256
  "buyers",
9333
9257
  "accounts"
9334
9258
  ];
9259
+ static section = {
9260
+ id: "sales",
9261
+ label: "Sales",
9262
+ icon: "shoppingBag",
9263
+ description: "Customers, orders and quotes: everything you sell."
9264
+ };
9335
9265
  static models = [Customer];
9336
9266
  static nav = [{
9337
9267
  label: "Customers",
9338
- model: Customer
9268
+ model: Customer,
9269
+ icon: "users",
9270
+ description: "The people and companies you sell to, with how to reach them."
9339
9271
  }];
9272
+ static options = { Customer: { fields: { profileId: {
9273
+ label: "Name",
9274
+ order: -1
9275
+ } } } };
9340
9276
  };
9341
- var VendorsRecipe = class extends SmrtRecipe {
9342
- static id = "commerce.vendors";
9343
- static help = "./vendors.recipe.md";
9344
- static label = "Vendors";
9345
- static summary = "Keep a list of the vendors and suppliers you buy from.";
9346
- static synonyms = ["suppliers", "sellers"];
9347
- static models = [Vendor];
9277
+ var PurchasesRecipe = class extends SmrtRecipe {
9278
+ static id = "commerce.purchases";
9279
+ static help = "./purchases.recipe.md";
9280
+ static label = "Purchases";
9281
+ static summary = "Order from your vendors and track what you have bought.";
9282
+ static synonyms = [
9283
+ "purchase orders",
9284
+ "buying",
9285
+ "procurement"
9286
+ ];
9287
+ static section = {
9288
+ id: "purchasing",
9289
+ label: "Purchasing",
9290
+ icon: "truck",
9291
+ description: "Vendors and purchase orders: everything you buy."
9292
+ };
9293
+ static models = [PurchaseOrder, ContractLineItem];
9348
9294
  static nav = [{
9349
- label: "Vendors",
9350
- model: Vendor
9295
+ label: "Purchase orders",
9296
+ model: PurchaseOrder,
9297
+ icon: "truck",
9298
+ description: "What you have ordered from your suppliers and when it arrives."
9351
9299
  }];
9300
+ static requires = ["commerce.vendors"];
9301
+ static options = {
9302
+ PurchaseOrder: { fields: {
9303
+ contractType: {
9304
+ default: "purchase_order",
9305
+ visibility: "hidden",
9306
+ locked: true
9307
+ },
9308
+ customerId: {
9309
+ visibility: "hidden",
9310
+ locked: true
9311
+ },
9312
+ vendorId: {
9313
+ label: "Vendor",
9314
+ order: 1
9315
+ },
9316
+ channelId: { visibility: "hidden" },
9317
+ expiryDate: { visibility: "hidden" }
9318
+ } },
9319
+ ContractLineItem: { fields: {
9320
+ sku: { visibility: "hidden" },
9321
+ startDate: { visibility: "hidden" },
9322
+ endDate: { visibility: "hidden" },
9323
+ billingPeriod: { visibility: "hidden" },
9324
+ sortOrder: { visibility: "hidden" },
9325
+ discount: { visibility: "hidden" },
9326
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9327
+ } }
9328
+ };
9352
9329
  };
9353
9330
  var SalesRecipe = class extends SmrtRecipe {
9354
9331
  static id = "commerce.sales";
@@ -9360,61 +9337,486 @@ var SalesRecipe = class extends SmrtRecipe {
9360
9337
  "orders",
9361
9338
  "customer orders"
9362
9339
  ];
9363
- static models = [Order];
9340
+ static section = {
9341
+ id: "sales",
9342
+ label: "Sales",
9343
+ icon: "shoppingBag",
9344
+ description: "Customers, orders and quotes: everything you sell."
9345
+ };
9346
+ static models = [Order, ContractLineItem];
9364
9347
  static nav = [{
9365
- label: "Sales Orders",
9366
- model: Order
9348
+ label: "Sales orders",
9349
+ model: Order,
9350
+ icon: "shoppingBag",
9351
+ description: "Orders from your customers, from placed to delivered."
9367
9352
  }];
9368
9353
  static requires = ["commerce.customers"];
9369
- static options = { Order: { fields: {
9370
- contractType: {
9371
- default: "order",
9372
- visibility: "hidden",
9373
- locked: true
9374
- },
9375
- vendorId: {
9376
- visibility: "hidden",
9377
- locked: true
9378
- },
9379
- customerId: {
9380
- label: "Customer",
9381
- order: 1
9382
- }
9383
- } } };
9354
+ static options = {
9355
+ Order: { fields: {
9356
+ contractType: {
9357
+ default: "order",
9358
+ visibility: "hidden",
9359
+ locked: true
9360
+ },
9361
+ vendorId: {
9362
+ visibility: "hidden",
9363
+ locked: true
9364
+ },
9365
+ customerId: {
9366
+ label: "Customer",
9367
+ order: 1,
9368
+ required: true
9369
+ },
9370
+ channelId: { visibility: "hidden" },
9371
+ expiryDate: { visibility: "hidden" }
9372
+ } },
9373
+ ContractLineItem: { fields: {
9374
+ sku: { visibility: "hidden" },
9375
+ startDate: { visibility: "hidden" },
9376
+ endDate: { visibility: "hidden" },
9377
+ billingPeriod: { visibility: "hidden" },
9378
+ sortOrder: { visibility: "hidden" },
9379
+ discount: { visibility: "hidden" },
9380
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9381
+ } }
9382
+ };
9384
9383
  };
9385
- var PurchasesRecipe = class extends SmrtRecipe {
9386
- static id = "commerce.purchases";
9387
- static help = "./purchases.recipe.md";
9388
- static label = "Purchases";
9389
- static summary = "Place orders with vendors and track them.";
9384
+ var VendorsRecipe = class extends SmrtRecipe {
9385
+ static id = "commerce.vendors";
9386
+ static help = "./vendors.recipe.md";
9387
+ static label = "Vendors";
9388
+ static summary = "Keep a list of the suppliers you buy from.";
9389
+ static synonyms = ["suppliers", "sellers"];
9390
+ static section = {
9391
+ id: "purchasing",
9392
+ label: "Purchasing",
9393
+ icon: "truck",
9394
+ description: "Vendors and purchase orders: everything you buy."
9395
+ };
9396
+ static models = [Vendor];
9397
+ static nav = [{
9398
+ label: "Vendors",
9399
+ model: Vendor,
9400
+ icon: "briefcase",
9401
+ description: "The suppliers you buy from, with terms and contacts."
9402
+ }];
9403
+ static options = { Vendor: { fields: { profileId: {
9404
+ label: "Name",
9405
+ order: -1
9406
+ } } } };
9407
+ };
9408
+ var EstimatesRecipe = class extends SmrtRecipe {
9409
+ static id = "commerce.estimates";
9410
+ static help = "./estimates.recipe.md";
9411
+ static label = "Estimates";
9412
+ static summary = "Send customers a price quote before they commit.";
9390
9413
  static synonyms = [
9391
- "purchase orders",
9392
- "buying",
9393
- "procurement"
9414
+ "quotes",
9415
+ "quotations",
9416
+ "proposals",
9417
+ "bids"
9394
9418
  ];
9395
- static models = [PurchaseOrder];
9419
+ static section = {
9420
+ id: "sales",
9421
+ label: "Sales",
9422
+ icon: "shoppingBag",
9423
+ description: "Customers, orders and quotes: everything you sell."
9424
+ };
9425
+ static models = [Estimate, ContractLineItem];
9396
9426
  static nav = [{
9397
- label: "Purchase Orders",
9398
- model: PurchaseOrder
9427
+ label: "Estimates",
9428
+ model: Estimate,
9429
+ icon: "fileText",
9430
+ description: "Price quotes you have sent to customers."
9399
9431
  }];
9400
- static requires = ["commerce.vendors"];
9401
- static options = { PurchaseOrder: { fields: {
9402
- contractType: {
9403
- default: "purchase_order",
9404
- visibility: "hidden",
9405
- locked: true
9406
- },
9407
- customerId: {
9408
- visibility: "hidden",
9409
- locked: true
9410
- },
9411
- vendorId: {
9412
- label: "Vendor",
9413
- order: 1
9414
- }
9415
- } } };
9432
+ static requires = ["commerce.customers"];
9433
+ static options = {
9434
+ Estimate: { fields: {
9435
+ contractType: {
9436
+ default: "estimate",
9437
+ visibility: "hidden",
9438
+ locked: true
9439
+ },
9440
+ vendorId: {
9441
+ visibility: "hidden",
9442
+ locked: true
9443
+ },
9444
+ customerId: {
9445
+ label: "Customer",
9446
+ order: 1,
9447
+ required: true
9448
+ },
9449
+ channelId: { visibility: "hidden" }
9450
+ } },
9451
+ ContractLineItem: { fields: {
9452
+ sku: { visibility: "hidden" },
9453
+ startDate: { visibility: "hidden" },
9454
+ endDate: { visibility: "hidden" },
9455
+ billingPeriod: { visibility: "hidden" },
9456
+ sortOrder: { visibility: "hidden" },
9457
+ discount: { visibility: "hidden" },
9458
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9459
+ } }
9460
+ };
9461
+ };
9462
+ var WholesaleRecipe = class extends SmrtRecipe {
9463
+ static id = "commerce.wholesale";
9464
+ static help = "./wholesale.recipe.md";
9465
+ static label = "Wholesale orders";
9466
+ static summary = "Take bulk orders from trade customers.";
9467
+ static synonyms = [
9468
+ "bulk orders",
9469
+ "trade orders",
9470
+ "b2b"
9471
+ ];
9472
+ static section = {
9473
+ id: "sales",
9474
+ label: "Sales",
9475
+ icon: "shoppingBag",
9476
+ description: "Customers, orders and quotes: everything you sell."
9477
+ };
9478
+ static models = [WholesaleOrder, ContractLineItem];
9479
+ static nav = [{
9480
+ label: "Wholesale orders",
9481
+ model: WholesaleOrder,
9482
+ icon: "shoppingBag",
9483
+ description: "Bulk orders from cafes, shops and other businesses."
9484
+ }];
9485
+ static requires = ["commerce.customers"];
9486
+ static options = {
9487
+ WholesaleOrder: { fields: {
9488
+ contractType: {
9489
+ default: "wholesale_order",
9490
+ visibility: "hidden",
9491
+ locked: true
9492
+ },
9493
+ vendorId: {
9494
+ visibility: "hidden",
9495
+ locked: true
9496
+ },
9497
+ customerId: {
9498
+ label: "Customer",
9499
+ order: 1
9500
+ },
9501
+ channelId: { visibility: "hidden" },
9502
+ expiryDate: { visibility: "hidden" }
9503
+ } },
9504
+ ContractLineItem: { fields: {
9505
+ sku: { visibility: "hidden" },
9506
+ startDate: { visibility: "hidden" },
9507
+ endDate: { visibility: "hidden" },
9508
+ billingPeriod: { visibility: "hidden" },
9509
+ sortOrder: { visibility: "hidden" },
9510
+ discount: { visibility: "hidden" },
9511
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9512
+ } }
9513
+ };
9514
+ };
9515
+ var InvoicingRecipe = class extends SmrtRecipe {
9516
+ static id = "commerce.invoicing";
9517
+ static help = "./invoicing.recipe.md";
9518
+ static label = "Invoicing";
9519
+ static summary = "Bill customers and record the payments that come in.";
9520
+ static synonyms = [
9521
+ "invoices",
9522
+ "billing",
9523
+ "payments",
9524
+ "receivables"
9525
+ ];
9526
+ static group = {
9527
+ id: "billing",
9528
+ label: "Billing & shipping",
9529
+ summary: "Invoice your customers, record what they pay and ship what they ordered."
9530
+ };
9531
+ static section = {
9532
+ id: "billing",
9533
+ label: "Billing",
9534
+ icon: "receipt",
9535
+ description: "Invoices and the payments against them."
9536
+ };
9537
+ static models = [
9538
+ Invoice,
9539
+ InvoiceLineItem,
9540
+ Payment,
9541
+ PaymentAllocation
9542
+ ];
9543
+ static nav = [{
9544
+ label: "Invoices",
9545
+ model: Invoice,
9546
+ icon: "receipt",
9547
+ description: "Bills you have sent and which ones are still waiting to be paid."
9548
+ }, {
9549
+ label: "Payments",
9550
+ model: Payment,
9551
+ icon: "creditCard",
9552
+ description: "Money received, matched to the invoices it paid."
9553
+ }];
9554
+ static requires = ["commerce.customers"];
9555
+ static options = {
9556
+ Invoice: { fields: {
9557
+ providerTaxAmount: { visibility: "hidden" },
9558
+ arJournalId: { visibility: "hidden" },
9559
+ revenueJournalId: { visibility: "hidden" },
9560
+ externalId: { visibility: "hidden" },
9561
+ customerExternalId: { visibility: "hidden" },
9562
+ externalProvider: { visibility: "hidden" },
9563
+ syncedAt: { visibility: "hidden" },
9564
+ collectionMethod: { visibility: "hidden" },
9565
+ sentAt: { visibility: "hidden" },
9566
+ viewedAt: { visibility: "hidden" },
9567
+ remindersSent: { visibility: "hidden" },
9568
+ lastReminderAt: { visibility: "hidden" },
9569
+ reference: { visibility: "hidden" },
9570
+ customerId: { required: true }
9571
+ } },
9572
+ InvoiceLineItem: { fields: {
9573
+ invoiceEditorStateJson: { visibility: "hidden" },
9574
+ sourceType: { visibility: "hidden" },
9575
+ sourceId: { visibility: "hidden" },
9576
+ periodStart: { visibility: "hidden" },
9577
+ periodEnd: { visibility: "hidden" },
9578
+ revenueAccountId: { visibility: "hidden" },
9579
+ sortOrder: { visibility: "hidden" },
9580
+ sku: { visibility: "hidden" },
9581
+ discount: { visibility: "hidden" },
9582
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9583
+ } },
9584
+ Payment: { fields: {
9585
+ journalId: { visibility: "hidden" },
9586
+ externalId: { visibility: "hidden" },
9587
+ externalProvider: { visibility: "hidden" },
9588
+ syncedAt: { visibility: "hidden" },
9589
+ backendId: { visibility: "hidden" },
9590
+ backendTxRef: { visibility: "hidden" },
9591
+ nativeAmount: { visibility: "hidden" },
9592
+ nativeCurrency: { visibility: "hidden" },
9593
+ usdAtQuote: { visibility: "hidden" },
9594
+ usdAtConfirmation: { visibility: "hidden" },
9595
+ transactionId: { visibility: "hidden" }
9596
+ } },
9597
+ PaymentAllocation: { fields: { allocatedBy: { visibility: "hidden" } } }
9598
+ };
9599
+ };
9600
+ var FulfillmentRecipe = class extends SmrtRecipe {
9601
+ static id = "commerce.fulfillment";
9602
+ static help = "./fulfillment.recipe.md";
9603
+ static label = "Shipping";
9604
+ static summary = "Pack, ship and deliver orders, with tracking.";
9605
+ static synonyms = [
9606
+ "fulfillment",
9607
+ "delivery",
9608
+ "shipments",
9609
+ "tracking"
9610
+ ];
9611
+ static group = {
9612
+ id: "billing",
9613
+ label: "Billing & shipping",
9614
+ summary: "Invoice your customers, record what they pay and ship what they ordered."
9615
+ };
9616
+ static section = {
9617
+ id: "operations",
9618
+ label: "Operations",
9619
+ icon: "wrench",
9620
+ description: "Fulfillment and the day-to-day work behind an order."
9621
+ };
9622
+ static models = [Fulfillment, FulfillmentLineItem];
9623
+ static nav = [{
9624
+ label: "Shipments",
9625
+ model: Fulfillment,
9626
+ icon: "truck",
9627
+ description: "What has gone out the door and where it is now."
9628
+ }];
9629
+ static requiresAny = [["commerce.sales", "commerce.wholesale"]];
9630
+ static options = {
9631
+ Fulfillment: { fields: {
9632
+ estimatedDelivery: { visibility: "hidden" },
9633
+ shippingAddress: { visibility: "hidden" }
9634
+ } },
9635
+ FulfillmentLineItem: { fields: { notes: { visibility: "hidden" } } }
9636
+ };
9637
+ };
9638
+ var AgreementsRecipe = class extends SmrtRecipe {
9639
+ static id = "commerce.agreements";
9640
+ static help = "./agreements.recipe.md";
9641
+ static label = "General agreements";
9642
+ static summary = "Keep signed agreements with customers, and see every contract in one list.";
9643
+ static synonyms = [
9644
+ "contracts",
9645
+ "terms",
9646
+ "deals"
9647
+ ];
9648
+ static group = {
9649
+ id: "agreements",
9650
+ label: "Agreements",
9651
+ summary: "Contracts with customers: general agreements, leases and licence sales."
9652
+ };
9653
+ static section = {
9654
+ id: "agreements",
9655
+ label: "Agreements",
9656
+ icon: "fileText",
9657
+ description: "Contracts, leases and licenses with customers."
9658
+ };
9659
+ static models = [
9660
+ Agreement,
9661
+ Contract,
9662
+ ContractLineItem
9663
+ ];
9664
+ static nav = [{
9665
+ label: "Agreements",
9666
+ model: Agreement,
9667
+ icon: "fileText",
9668
+ description: "Signed deals and terms with your customers, in one place."
9669
+ }, {
9670
+ label: "All contracts",
9671
+ model: Contract,
9672
+ icon: "fileText",
9673
+ description: "Every contract you hold, whoever it is with."
9674
+ }];
9675
+ static requires = ["commerce.customers"];
9676
+ static options = {
9677
+ Agreement: { fields: {
9678
+ contractType: {
9679
+ default: "agreement",
9680
+ visibility: "hidden",
9681
+ locked: true
9682
+ },
9683
+ customerId: {
9684
+ label: "Customer",
9685
+ order: 1,
9686
+ required: true
9687
+ },
9688
+ vendorId: { visibility: "hidden" },
9689
+ subtotal: { visibility: "hidden" },
9690
+ taxAmount: { visibility: "hidden" },
9691
+ channelId: { visibility: "hidden" }
9692
+ } },
9693
+ ContractLineItem: { fields: {
9694
+ sku: { visibility: "hidden" },
9695
+ startDate: { visibility: "hidden" },
9696
+ endDate: { visibility: "hidden" },
9697
+ billingPeriod: { visibility: "hidden" },
9698
+ sortOrder: { visibility: "hidden" },
9699
+ discount: { visibility: "hidden" },
9700
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9701
+ } },
9702
+ Contract: { fields: { channelId: { visibility: "hidden" } } }
9703
+ };
9704
+ };
9705
+ var LeasesRecipe = class extends SmrtRecipe {
9706
+ static id = "commerce.leases";
9707
+ static help = "./leases.recipe.md";
9708
+ static label = "Leases";
9709
+ static summary = "Rent things out and track the term and the payments due.";
9710
+ static synonyms = [
9711
+ "rentals",
9712
+ "renting",
9713
+ "hire"
9714
+ ];
9715
+ static group = {
9716
+ id: "agreements",
9717
+ label: "Agreements",
9718
+ summary: "Contracts with customers: general agreements, leases and licence sales."
9719
+ };
9720
+ static section = {
9721
+ id: "agreements",
9722
+ label: "Agreements",
9723
+ icon: "fileText",
9724
+ description: "Contracts, leases and licenses with customers."
9725
+ };
9726
+ static models = [Lease, ContractLineItem];
9727
+ static nav = [{
9728
+ label: "Leases",
9729
+ model: Lease,
9730
+ icon: "home",
9731
+ description: "Rentals you give or take, with terms and dates."
9732
+ }];
9733
+ static requires = ["commerce.customers"];
9734
+ static options = {
9735
+ Lease: { fields: {
9736
+ contractType: {
9737
+ default: "lease",
9738
+ visibility: "hidden",
9739
+ locked: true
9740
+ },
9741
+ customerId: {
9742
+ label: "Customer",
9743
+ order: 1,
9744
+ required: true
9745
+ },
9746
+ vendorId: { visibility: "hidden" },
9747
+ subtotal: { visibility: "hidden" },
9748
+ taxAmount: { visibility: "hidden" },
9749
+ channelId: { visibility: "hidden" }
9750
+ } },
9751
+ ContractLineItem: { fields: {
9752
+ sku: { visibility: "hidden" },
9753
+ startDate: { visibility: "hidden" },
9754
+ endDate: { visibility: "hidden" },
9755
+ billingPeriod: { visibility: "hidden" },
9756
+ sortOrder: { visibility: "hidden" },
9757
+ discount: { visibility: "hidden" },
9758
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9759
+ } }
9760
+ };
9761
+ };
9762
+ var LicensesRecipe = class extends SmrtRecipe {
9763
+ static id = "commerce.licenses";
9764
+ static help = "./licenses.recipe.md";
9765
+ static label = "Licence sales";
9766
+ static summary = "Sell licences to software, content or other rights.";
9767
+ static synonyms = [
9768
+ "licenses",
9769
+ "licensing",
9770
+ "subscriptions"
9771
+ ];
9772
+ static group = {
9773
+ id: "agreements",
9774
+ label: "Agreements",
9775
+ summary: "Contracts with customers: general agreements, leases and licence sales."
9776
+ };
9777
+ static section = {
9778
+ id: "agreements",
9779
+ label: "Agreements",
9780
+ icon: "fileText",
9781
+ description: "Contracts, leases and licenses with customers."
9782
+ };
9783
+ static models = [LicenseSale, ContractLineItem];
9784
+ static nav = [{
9785
+ label: "Licence sales",
9786
+ model: LicenseSale,
9787
+ icon: "shoppingBag",
9788
+ description: "Licences you have sold and who holds them."
9789
+ }];
9790
+ static requires = ["commerce.customers"];
9791
+ static options = {
9792
+ LicenseSale: { fields: {
9793
+ contractType: {
9794
+ default: "license_sale",
9795
+ visibility: "hidden",
9796
+ locked: true
9797
+ },
9798
+ customerId: {
9799
+ label: "Customer",
9800
+ order: 1,
9801
+ required: true
9802
+ },
9803
+ vendorId: { visibility: "hidden" },
9804
+ subtotal: { visibility: "hidden" },
9805
+ taxAmount: { visibility: "hidden" },
9806
+ channelId: { visibility: "hidden" }
9807
+ } },
9808
+ ContractLineItem: { fields: {
9809
+ sku: { visibility: "hidden" },
9810
+ startDate: { visibility: "hidden" },
9811
+ endDate: { visibility: "hidden" },
9812
+ billingPeriod: { visibility: "hidden" },
9813
+ sortOrder: { visibility: "hidden" },
9814
+ discount: { visibility: "hidden" },
9815
+ taxRate: { help: "Type a percentage: 5 means 5%." }
9816
+ } }
9817
+ };
9416
9818
  };
9417
9819
  //#endregion
9418
- export { Agreement, BillingAccount, BillingLineSource, BillingPaymentAttempt, BillingPaymentRefusedError, BillingPeriodClose, BillingPeriodCloseError, BillingProviderUnsupportedError, BillingRuntime, BillingWebhookVerificationError, COMMERCE_MODULE_META, COMMERCE_MONEY_COLUMNS, COMMERCE_MONEY_MINOR_UNITS_BACKFILL, COMMERCE_NATIVE_UNIT_COLUMNS, COMMERCE_UI_SLOTS, Cart, Contract, ContractCollection, ContractLineItem, ContractLineItemCollection, ContractStatus, ContractType, Customer, CustomerCollection, CustomerStatus, CustomerType, CustomersRecipe, Estimate, Fulfillment, FulfillmentCollection, FulfillmentLineItem, FulfillmentLineItemCollection, FulfillmentStatus, FulfillmentType, INVOICE_PAYMENT_PURPOSE, Invoice, InvoiceCollection, InvoiceLineItem, InvoiceLineItemCollection, InvoiceStatus, Lease, LicenseSale, Order, Payment, PaymentAllocation, PaymentAllocationCollection, PaymentCollection, PaymentInstrument, PaymentInstrumentCollection, PaymentInstrumentStatus, PaymentIntent, PaymentIntentCollection, PaymentIntentStatus, PaymentMethod, PaymentStatus, Payout, PayoutCollection, PayoutStatus, ProductionOrder, PurchaseOrder, PurchasesRecipe, SalesRecipe, UNPAID_STATUSES, Vendor, VendorCollection, VendorStatus, VendorsRecipe, WholesaleOrder, addBillingMonths, assertIntegerMinorUnits, billingPeriodContaining, createBtcPayBillingProvider, createCryptoBillingProvider, createStripeBillingProvider, currencyMinorUnitExponent, decideAttempt, enqueueBillingEvents, enqueueBillingPeriodClose, getBillingRuntime, lastEndedBillingPeriod, majorToMinorUnits, migrateCommerceMoneyToMinorUnits, migrateInvoiceEditorStorage, minorToMajorUnits, preflightCommerceMoneyMinorUnits, preflightInvoiceEditorStorage, previousCalendarMonth, prorateMinorUnits, providerCapabilities, registerBillingRuntime, unregisterBillingRuntime };
9820
+ export { Agreement, AgreementsRecipe, BillingAccount, BillingLineSource, BillingPaymentAttempt, BillingPaymentRefusedError, BillingPeriodClose, BillingPeriodCloseError, BillingProviderUnsupportedError, BillingRuntime, BillingWebhookVerificationError, COMMERCE_MODULE_META, COMMERCE_MONEY_COLUMNS, COMMERCE_MONEY_MINOR_UNITS_BACKFILL, COMMERCE_NATIVE_UNIT_COLUMNS, COMMERCE_UI_SLOTS, Cart, Contract, ContractCollection, ContractLineItem, ContractLineItemCollection, ContractStatus, ContractType, Customer, CustomerCollection, CustomerStatus, CustomerType, CustomersRecipe, Estimate, EstimatesRecipe, Fulfillment, FulfillmentCollection, FulfillmentLineItem, FulfillmentLineItemCollection, FulfillmentRecipe, FulfillmentStatus, FulfillmentType, INVOICE_PAYMENT_PURPOSE, Invoice, InvoiceCollection, InvoiceLineItem, InvoiceLineItemCollection, InvoiceStatus, InvoicingRecipe, Lease, LeasesRecipe, LicenseSale, LicensesRecipe, Order, Payment, PaymentAllocation, PaymentAllocationCollection, PaymentCollection, PaymentInstrument, PaymentInstrumentCollection, PaymentInstrumentStatus, PaymentIntent, PaymentIntentCollection, PaymentIntentStatus, PaymentMethod, PaymentStatus, Payout, PayoutCollection, PayoutStatus, ProductionOrder, PurchaseOrder, PurchasesRecipe, SalesRecipe, UNPAID_STATUSES, Vendor, VendorCollection, VendorStatus, VendorsRecipe, WholesaleOrder, WholesaleRecipe, addBillingMonths, assertIntegerMinorUnits, billingPeriodContaining, createBtcPayBillingProvider, createCryptoBillingProvider, createStripeBillingProvider, currencyMinorUnitExponent, decideAttempt, enqueueBillingEvents, enqueueBillingPeriodClose, getBillingRuntime, lastEndedBillingPeriod, majorToMinorUnits, migrateCommerceMoneyToMinorUnits, migrateInvoiceEditorStorage, minorToMajorUnits, preflightCommerceMoneyMinorUnits, preflightInvoiceEditorStorage, previousCalendarMonth, prorateMinorUnits, providerCapabilities, registerBillingRuntime, unregisterBillingRuntime };
9419
9821
 
9420
9822
  //# sourceMappingURL=index.js.map