@happyvertical/smrt-commerce 0.51.23 → 0.51.24

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 (42) hide show
  1. package/AGENTS.md +47 -0
  2. package/README.md +104 -0
  3. package/dist/billing/credits.d.ts +33 -0
  4. package/dist/billing/credits.d.ts.map +1 -0
  5. package/dist/billing/events.d.ts +26 -0
  6. package/dist/billing/events.d.ts.map +1 -0
  7. package/dist/billing/index.d.ts +13 -0
  8. package/dist/billing/index.d.ts.map +1 -0
  9. package/dist/billing/jobs.d.ts +31 -0
  10. package/dist/billing/jobs.d.ts.map +1 -0
  11. package/dist/billing/period-close.d.ts +41 -0
  12. package/dist/billing/period-close.d.ts.map +1 -0
  13. package/dist/billing/provider.d.ts +136 -0
  14. package/dist/billing/provider.d.ts.map +1 -0
  15. package/dist/billing/runtime.d.ts +168 -0
  16. package/dist/billing/runtime.d.ts.map +1 -0
  17. package/dist/billing/stripe.d.ts +12 -0
  18. package/dist/billing/stripe.d.ts.map +1 -0
  19. package/dist/billing/units.d.ts +31 -0
  20. package/dist/billing/units.d.ts.map +1 -0
  21. package/dist/chunks/types-CRnln577.js.map +1 -1
  22. package/dist/chunks/units--tTn2ps8.js +52 -0
  23. package/dist/chunks/units--tTn2ps8.js.map +1 -0
  24. package/dist/collections/InvoiceLineItemCollection.d.ts +2 -1
  25. package/dist/collections/InvoiceLineItemCollection.d.ts.map +1 -1
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +4258 -2584
  29. package/dist/index.js.map +1 -1
  30. package/dist/manifest.json +1397 -6
  31. package/dist/models/Invoice.d.ts +13 -2
  32. package/dist/models/Invoice.d.ts.map +1 -1
  33. package/dist/models/InvoiceLineItem.d.ts +6 -2
  34. package/dist/models/InvoiceLineItem.d.ts.map +1 -1
  35. package/dist/models/billing.d.ts +117 -0
  36. package/dist/models/billing.d.ts.map +1 -0
  37. package/dist/models/index.d.ts +1 -0
  38. package/dist/models/index.d.ts.map +1 -1
  39. package/dist/smrt-knowledge.json +529 -9
  40. package/dist/types/index.d.ts +3 -1
  41. package/dist/types/index.d.ts.map +1 -1
  42. package/package.json +10 -7
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-commerce",
5
- "packageVersion": "0.51.23",
5
+ "packageVersion": "0.51.24",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-commerce:ContractCollection": {
8
8
  "name": "contractcollection",
@@ -1478,7 +1478,7 @@
1478
1478
  "collectionExportName": "InvoiceCollectionCollection",
1479
1479
  "schema": {
1480
1480
  "tableName": "invoices",
1481
- "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 \"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 \"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);",
1481
+ "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 \"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);",
1482
1482
  "columns": {
1483
1483
  "id": {
1484
1484
  "type": "UUID",
@@ -1574,6 +1574,12 @@
1574
1574
  "unique": false,
1575
1575
  "default": 0
1576
1576
  },
1577
+ "provider_tax_amount": {
1578
+ "type": "INTEGER",
1579
+ "notNull": false,
1580
+ "unique": false,
1581
+ "default": 0
1582
+ },
1577
1583
  "total_amount": {
1578
1584
  "type": "INTEGER",
1579
1585
  "notNull": false,
@@ -1715,7 +1721,7 @@
1715
1721
  ]
1716
1722
  }
1717
1723
  ],
1718
- "version": "ea71241c"
1724
+ "version": "40c25b56"
1719
1725
  },
1720
1726
  "importPath": "@happyvertical/smrt-commerce"
1721
1727
  },
@@ -8644,6 +8650,11 @@
8644
8650
  "required": false,
8645
8651
  "default": 0
8646
8652
  },
8653
+ "providerTaxAmount": {
8654
+ "type": "integer",
8655
+ "required": false,
8656
+ "default": 0
8657
+ },
8647
8658
  "totalAmount": {
8648
8659
  "type": "integer",
8649
8660
  "required": false,
@@ -8914,7 +8925,7 @@
8914
8925
  "collectionExportName": "InvoiceCollection",
8915
8926
  "schema": {
8916
8927
  "tableName": "invoices",
8917
- "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 \"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 \"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);",
8928
+ "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 \"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);",
8918
8929
  "columns": {
8919
8930
  "id": {
8920
8931
  "type": "UUID",
@@ -9010,6 +9021,12 @@
9010
9021
  "unique": false,
9011
9022
  "default": 0
9012
9023
  },
9024
+ "provider_tax_amount": {
9025
+ "type": "INTEGER",
9026
+ "notNull": false,
9027
+ "unique": false,
9028
+ "default": 0
9029
+ },
9013
9030
  "total_amount": {
9014
9031
  "type": "INTEGER",
9015
9032
  "notNull": false,
@@ -9151,7 +9168,7 @@
9151
9168
  ]
9152
9169
  }
9153
9170
  ],
9154
- "version": "ea71241c"
9171
+ "version": "40c25b56"
9155
9172
  },
9156
9173
  "importPath": "@happyvertical/smrt-commerce"
9157
9174
  },
@@ -9294,7 +9311,13 @@
9294
9311
  "toAccountingLineItem": {
9295
9312
  "name": "toAccountingLineItem",
9296
9313
  "async": false,
9297
- "parameters": [],
9314
+ "parameters": [
9315
+ {
9316
+ "name": "currency",
9317
+ "type": "string",
9318
+ "optional": true
9319
+ }
9320
+ ],
9298
9321
  "returnType": "AccountingLineItemInput",
9299
9322
  "isStatic": false,
9300
9323
  "isPublic": true
@@ -11687,12 +11710,1380 @@
11687
11710
  "version": "1dc2b65e"
11688
11711
  },
11689
11712
  "importPath": "@happyvertical/smrt-commerce"
11713
+ },
11714
+ "@happyvertical/smrt-commerce:BillingAccount": {
11715
+ "name": "billingaccount",
11716
+ "className": "BillingAccount",
11717
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingAccount",
11718
+ "collection": "billingaccounts",
11719
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
11720
+ "packageName": "@happyvertical/smrt-commerce",
11721
+ "fields": {
11722
+ "sellerTenantId": {
11723
+ "type": "crossPackageRef",
11724
+ "required": true,
11725
+ "related": "@happyvertical/smrt-users:Tenant",
11726
+ "_meta": {
11727
+ "required": true
11728
+ }
11729
+ },
11730
+ "payerTenantId": {
11731
+ "type": "crossPackageRef",
11732
+ "required": true,
11733
+ "related": "@happyvertical/smrt-users:Tenant",
11734
+ "_meta": {
11735
+ "required": true
11736
+ }
11737
+ },
11738
+ "customerId": {
11739
+ "type": "foreignKey",
11740
+ "required": false,
11741
+ "related": "Customer"
11742
+ },
11743
+ "name": {
11744
+ "type": "text",
11745
+ "required": false,
11746
+ "default": ""
11747
+ },
11748
+ "email": {
11749
+ "type": "text",
11750
+ "required": false,
11751
+ "default": ""
11752
+ },
11753
+ "provider": {
11754
+ "type": "text",
11755
+ "required": false,
11756
+ "default": ""
11757
+ },
11758
+ "providerCustomerId": {
11759
+ "type": "text",
11760
+ "required": false,
11761
+ "default": ""
11762
+ },
11763
+ "automaticTax": {
11764
+ "type": "boolean",
11765
+ "required": false,
11766
+ "default": true
11767
+ },
11768
+ "flatDiscountBasisPoints": {
11769
+ "type": "integer",
11770
+ "required": false,
11771
+ "default": 0
11772
+ },
11773
+ "paymentTermsDays": {
11774
+ "type": "integer",
11775
+ "required": false,
11776
+ "default": 30
11777
+ },
11778
+ "standing": {
11779
+ "type": "text",
11780
+ "required": false,
11781
+ "default": "current"
11782
+ }
11783
+ },
11784
+ "methods": {},
11785
+ "decoratorConfig": {
11786
+ "tableName": "_smrt_billing_accounts",
11787
+ "conflictColumns": [
11788
+ "seller_tenant_id",
11789
+ "payer_tenant_id"
11790
+ ],
11791
+ "api": false,
11792
+ "cli": false,
11793
+ "mcp": false
11794
+ },
11795
+ "extends": "SmrtObject",
11796
+ "exportName": "BillingAccount",
11797
+ "collectionExportName": "BillingAccountCollection",
11798
+ "validationRules": [
11799
+ {
11800
+ "field": "sellerTenantId",
11801
+ "rule": "required",
11802
+ "fieldType": "crossPackageRef"
11803
+ },
11804
+ {
11805
+ "field": "payerTenantId",
11806
+ "rule": "required",
11807
+ "fieldType": "crossPackageRef"
11808
+ }
11809
+ ],
11810
+ "schema": {
11811
+ "tableName": "_smrt_billing_accounts",
11812
+ "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);",
11813
+ "columns": {
11814
+ "id": {
11815
+ "type": "UUID",
11816
+ "primaryKey": true,
11817
+ "referenceKind": "id",
11818
+ "notNull": true
11819
+ },
11820
+ "slug": {
11821
+ "type": "TEXT",
11822
+ "notNull": true
11823
+ },
11824
+ "context": {
11825
+ "type": "TEXT",
11826
+ "notNull": true,
11827
+ "default": ""
11828
+ },
11829
+ "created_at": {
11830
+ "type": "TIMESTAMP",
11831
+ "notNull": true,
11832
+ "default": "current_timestamp"
11833
+ },
11834
+ "updated_at": {
11835
+ "type": "TIMESTAMP",
11836
+ "notNull": true,
11837
+ "default": "current_timestamp"
11838
+ },
11839
+ "seller_tenant_id": {
11840
+ "type": "UUID",
11841
+ "referenceKind": "crossPackageRef",
11842
+ "notNull": true,
11843
+ "unique": false
11844
+ },
11845
+ "payer_tenant_id": {
11846
+ "type": "UUID",
11847
+ "referenceKind": "crossPackageRef",
11848
+ "notNull": true,
11849
+ "unique": false
11850
+ },
11851
+ "customer_id": {
11852
+ "type": "UUID",
11853
+ "referenceKind": "foreignKey",
11854
+ "notNull": false,
11855
+ "unique": false,
11856
+ "foreignKey": {
11857
+ "table": "customers",
11858
+ "column": "id",
11859
+ "onDelete": "NO ACTION",
11860
+ "onUpdate": "CASCADE"
11861
+ }
11862
+ },
11863
+ "name": {
11864
+ "type": "TEXT",
11865
+ "notNull": false,
11866
+ "unique": false,
11867
+ "default": ""
11868
+ },
11869
+ "email": {
11870
+ "type": "TEXT",
11871
+ "notNull": false,
11872
+ "unique": false,
11873
+ "default": ""
11874
+ },
11875
+ "provider": {
11876
+ "type": "TEXT",
11877
+ "notNull": false,
11878
+ "unique": false,
11879
+ "default": ""
11880
+ },
11881
+ "provider_customer_id": {
11882
+ "type": "TEXT",
11883
+ "notNull": false,
11884
+ "unique": false,
11885
+ "default": ""
11886
+ },
11887
+ "automatic_tax": {
11888
+ "type": "BOOLEAN",
11889
+ "notNull": false,
11890
+ "unique": false,
11891
+ "default": true
11892
+ },
11893
+ "flat_discount_basis_points": {
11894
+ "type": "INTEGER",
11895
+ "notNull": false,
11896
+ "unique": false,
11897
+ "default": 0
11898
+ },
11899
+ "payment_terms_days": {
11900
+ "type": "INTEGER",
11901
+ "notNull": false,
11902
+ "unique": false,
11903
+ "default": 30
11904
+ },
11905
+ "standing": {
11906
+ "type": "TEXT",
11907
+ "notNull": false,
11908
+ "unique": false,
11909
+ "default": "current"
11910
+ }
11911
+ },
11912
+ "indexes": [
11913
+ {
11914
+ "name": "_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx",
11915
+ "columns": [
11916
+ "seller_tenant_id",
11917
+ "payer_tenant_id"
11918
+ ],
11919
+ "unique": true
11920
+ },
11921
+ {
11922
+ "name": "_smrt_billing_accounts_slug_context_idx",
11923
+ "columns": [
11924
+ "slug",
11925
+ "context"
11926
+ ]
11927
+ },
11928
+ {
11929
+ "name": "_smrt_billing_accounts_created_at_idx",
11930
+ "columns": [
11931
+ "created_at"
11932
+ ]
11933
+ },
11934
+ {
11935
+ "name": "_smrt_billing_accounts_payer_tenant_id_idx",
11936
+ "columns": [
11937
+ "payer_tenant_id"
11938
+ ]
11939
+ },
11940
+ {
11941
+ "name": "_smrt_billing_accounts_customer_id_idx",
11942
+ "columns": [
11943
+ "customer_id"
11944
+ ]
11945
+ }
11946
+ ],
11947
+ "version": "c9e78d38"
11948
+ },
11949
+ "importPath": "@happyvertical/smrt-commerce"
11950
+ },
11951
+ "@happyvertical/smrt-commerce:BillingPeriodClose": {
11952
+ "name": "billingperiodclose",
11953
+ "className": "BillingPeriodClose",
11954
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingPeriodClose",
11955
+ "collection": "billingperiodcloses",
11956
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
11957
+ "packageName": "@happyvertical/smrt-commerce",
11958
+ "fields": {
11959
+ "sellerTenantId": {
11960
+ "type": "crossPackageRef",
11961
+ "required": true,
11962
+ "related": "@happyvertical/smrt-users:Tenant",
11963
+ "_meta": {
11964
+ "required": true
11965
+ }
11966
+ },
11967
+ "kind": {
11968
+ "type": "text",
11969
+ "required": false,
11970
+ "default": "provider"
11971
+ },
11972
+ "payerTenantId": {
11973
+ "type": "crossPackageRef",
11974
+ "required": true,
11975
+ "related": "@happyvertical/smrt-users:Tenant",
11976
+ "_meta": {
11977
+ "required": true
11978
+ }
11979
+ },
11980
+ "currency": {
11981
+ "type": "text",
11982
+ "required": false,
11983
+ "default": "USD"
11984
+ },
11985
+ "periodStart": {
11986
+ "type": "datetime",
11987
+ "required": false
11988
+ },
11989
+ "periodEnd": {
11990
+ "type": "datetime",
11991
+ "required": false
11992
+ },
11993
+ "billingAccountId": {
11994
+ "type": "foreignKey",
11995
+ "required": false,
11996
+ "related": "BillingAccount"
11997
+ },
11998
+ "status": {
11999
+ "type": "text",
12000
+ "required": false,
12001
+ "default": "collecting"
12002
+ },
12003
+ "invoiceId": {
12004
+ "type": "foreignKey",
12005
+ "required": false,
12006
+ "related": "Invoice"
12007
+ },
12008
+ "providerInvoiceId": {
12009
+ "type": "text",
12010
+ "required": false,
12011
+ "default": ""
12012
+ },
12013
+ "subtotal": {
12014
+ "type": "integer",
12015
+ "required": false,
12016
+ "default": 0
12017
+ },
12018
+ "lineCount": {
12019
+ "type": "integer",
12020
+ "required": false,
12021
+ "default": 0
12022
+ },
12023
+ "issuedAt": {
12024
+ "type": "datetime",
12025
+ "required": false
12026
+ },
12027
+ "leaseToken": {
12028
+ "type": "text",
12029
+ "required": false,
12030
+ "_meta": {
12031
+ "nullable": true
12032
+ }
12033
+ },
12034
+ "leaseExpiresAt": {
12035
+ "type": "datetime",
12036
+ "required": false,
12037
+ "_meta": {
12038
+ "nullable": true
12039
+ }
12040
+ },
12041
+ "attempts": {
12042
+ "type": "integer",
12043
+ "required": false,
12044
+ "default": 0
12045
+ },
12046
+ "lastError": {
12047
+ "type": "text",
12048
+ "required": false,
12049
+ "default": ""
12050
+ }
12051
+ },
12052
+ "methods": {
12053
+ "runPeriodClose": {
12054
+ "name": "runPeriodClose",
12055
+ "async": true,
12056
+ "parameters": [
12057
+ {
12058
+ "name": "args",
12059
+ "type": "Record<string, unknown>",
12060
+ "optional": true
12061
+ },
12062
+ {
12063
+ "name": "_context",
12064
+ "type": "JobExecutionContext",
12065
+ "optional": true
12066
+ }
12067
+ ],
12068
+ "returnType": "Promise<unknown>",
12069
+ "isStatic": false,
12070
+ "isPublic": true
12071
+ },
12072
+ "processBillingEvents": {
12073
+ "name": "processBillingEvents",
12074
+ "async": true,
12075
+ "parameters": [
12076
+ {
12077
+ "name": "args",
12078
+ "type": "Record<string, unknown>",
12079
+ "optional": true
12080
+ },
12081
+ {
12082
+ "name": "_context",
12083
+ "type": "JobExecutionContext",
12084
+ "optional": true
12085
+ }
12086
+ ],
12087
+ "returnType": "Promise<unknown>",
12088
+ "isStatic": false,
12089
+ "isPublic": true
12090
+ }
12091
+ },
12092
+ "decoratorConfig": {
12093
+ "tableName": "_smrt_billing_period_closes",
12094
+ "conflictColumns": [
12095
+ "seller_tenant_id",
12096
+ "kind",
12097
+ "payer_tenant_id",
12098
+ "currency",
12099
+ "period_start",
12100
+ "period_end"
12101
+ ],
12102
+ "api": false,
12103
+ "cli": false,
12104
+ "mcp": false
12105
+ },
12106
+ "extends": "SmrtObject",
12107
+ "exportName": "BillingPeriodClose",
12108
+ "collectionExportName": "BillingPeriodCloseCollection",
12109
+ "validationRules": [
12110
+ {
12111
+ "field": "sellerTenantId",
12112
+ "rule": "required",
12113
+ "fieldType": "crossPackageRef"
12114
+ },
12115
+ {
12116
+ "field": "payerTenantId",
12117
+ "rule": "required",
12118
+ "fieldType": "crossPackageRef"
12119
+ }
12120
+ ],
12121
+ "schema": {
12122
+ "tableName": "_smrt_billing_period_closes",
12123
+ "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);",
12124
+ "columns": {
12125
+ "id": {
12126
+ "type": "UUID",
12127
+ "primaryKey": true,
12128
+ "referenceKind": "id",
12129
+ "notNull": true
12130
+ },
12131
+ "slug": {
12132
+ "type": "TEXT",
12133
+ "notNull": true
12134
+ },
12135
+ "context": {
12136
+ "type": "TEXT",
12137
+ "notNull": true,
12138
+ "default": ""
12139
+ },
12140
+ "created_at": {
12141
+ "type": "TIMESTAMP",
12142
+ "notNull": true,
12143
+ "default": "current_timestamp"
12144
+ },
12145
+ "updated_at": {
12146
+ "type": "TIMESTAMP",
12147
+ "notNull": true,
12148
+ "default": "current_timestamp"
12149
+ },
12150
+ "seller_tenant_id": {
12151
+ "type": "UUID",
12152
+ "referenceKind": "crossPackageRef",
12153
+ "notNull": true,
12154
+ "unique": false
12155
+ },
12156
+ "kind": {
12157
+ "type": "TEXT",
12158
+ "notNull": false,
12159
+ "unique": false,
12160
+ "default": "provider"
12161
+ },
12162
+ "payer_tenant_id": {
12163
+ "type": "UUID",
12164
+ "referenceKind": "crossPackageRef",
12165
+ "notNull": true,
12166
+ "unique": false
12167
+ },
12168
+ "currency": {
12169
+ "type": "TEXT",
12170
+ "notNull": false,
12171
+ "unique": false,
12172
+ "default": "USD"
12173
+ },
12174
+ "period_start": {
12175
+ "type": "TIMESTAMP",
12176
+ "notNull": false,
12177
+ "unique": false
12178
+ },
12179
+ "period_end": {
12180
+ "type": "TIMESTAMP",
12181
+ "notNull": false,
12182
+ "unique": false
12183
+ },
12184
+ "billing_account_id": {
12185
+ "type": "UUID",
12186
+ "referenceKind": "foreignKey",
12187
+ "notNull": false,
12188
+ "unique": false,
12189
+ "foreignKey": {
12190
+ "table": "_smrt_billing_accounts",
12191
+ "column": "id",
12192
+ "onDelete": "NO ACTION",
12193
+ "onUpdate": "CASCADE"
12194
+ }
12195
+ },
12196
+ "status": {
12197
+ "type": "TEXT",
12198
+ "notNull": false,
12199
+ "unique": false,
12200
+ "default": "collecting"
12201
+ },
12202
+ "invoice_id": {
12203
+ "type": "UUID",
12204
+ "referenceKind": "foreignKey",
12205
+ "notNull": false,
12206
+ "unique": false,
12207
+ "foreignKey": {
12208
+ "table": "invoices",
12209
+ "column": "id",
12210
+ "onDelete": "NO ACTION",
12211
+ "onUpdate": "CASCADE"
12212
+ }
12213
+ },
12214
+ "provider_invoice_id": {
12215
+ "type": "TEXT",
12216
+ "notNull": false,
12217
+ "unique": false,
12218
+ "default": ""
12219
+ },
12220
+ "subtotal": {
12221
+ "type": "INTEGER",
12222
+ "notNull": false,
12223
+ "unique": false,
12224
+ "default": 0
12225
+ },
12226
+ "line_count": {
12227
+ "type": "INTEGER",
12228
+ "notNull": false,
12229
+ "unique": false,
12230
+ "default": 0
12231
+ },
12232
+ "issued_at": {
12233
+ "type": "TIMESTAMP",
12234
+ "notNull": false,
12235
+ "unique": false
12236
+ },
12237
+ "lease_token": {
12238
+ "type": "TEXT",
12239
+ "notNull": false,
12240
+ "unique": false
12241
+ },
12242
+ "lease_expires_at": {
12243
+ "type": "TIMESTAMP",
12244
+ "notNull": false,
12245
+ "unique": false
12246
+ },
12247
+ "attempts": {
12248
+ "type": "INTEGER",
12249
+ "notNull": false,
12250
+ "unique": false,
12251
+ "default": 0
12252
+ },
12253
+ "last_error": {
12254
+ "type": "TEXT",
12255
+ "notNull": false,
12256
+ "unique": false,
12257
+ "default": ""
12258
+ }
12259
+ },
12260
+ "indexes": [
12261
+ {
12262
+ "name": "_smrt_billing_period_closes_seller_tenant_id_kind_idx",
12263
+ "columns": [
12264
+ "seller_tenant_id",
12265
+ "kind",
12266
+ "payer_tenant_id",
12267
+ "currency",
12268
+ "period_start",
12269
+ "period_end"
12270
+ ],
12271
+ "unique": true,
12272
+ "nullsNotDistinct": true
12273
+ },
12274
+ {
12275
+ "name": "_smrt_billing_period_closes_slug_context_idx",
12276
+ "columns": [
12277
+ "slug",
12278
+ "context"
12279
+ ]
12280
+ },
12281
+ {
12282
+ "name": "_smrt_billing_period_closes_created_at_idx",
12283
+ "columns": [
12284
+ "created_at"
12285
+ ]
12286
+ },
12287
+ {
12288
+ "name": "_smrt_billing_period_closes_payer_tenant_id_idx",
12289
+ "columns": [
12290
+ "payer_tenant_id"
12291
+ ]
12292
+ },
12293
+ {
12294
+ "name": "_smrt_billing_period_closes_billing_account_id_idx",
12295
+ "columns": [
12296
+ "billing_account_id"
12297
+ ]
12298
+ },
12299
+ {
12300
+ "name": "_smrt_billing_period_closes_invoice_id_idx",
12301
+ "columns": [
12302
+ "invoice_id"
12303
+ ]
12304
+ }
12305
+ ],
12306
+ "version": "753d2e86"
12307
+ },
12308
+ "importPath": "@happyvertical/smrt-commerce"
12309
+ },
12310
+ "@happyvertical/smrt-commerce:BillingLineSource": {
12311
+ "name": "billinglinesource",
12312
+ "className": "BillingLineSource",
12313
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingLineSource",
12314
+ "collection": "billinglinesources",
12315
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12316
+ "packageName": "@happyvertical/smrt-commerce",
12317
+ "fields": {
12318
+ "sellerTenantId": {
12319
+ "type": "crossPackageRef",
12320
+ "required": true,
12321
+ "related": "@happyvertical/smrt-users:Tenant",
12322
+ "_meta": {
12323
+ "required": true
12324
+ }
12325
+ },
12326
+ "periodCloseId": {
12327
+ "type": "foreignKey",
12328
+ "required": false,
12329
+ "related": "BillingPeriodClose"
12330
+ },
12331
+ "sourceType": {
12332
+ "type": "text",
12333
+ "required": false,
12334
+ "default": "client_charge"
12335
+ },
12336
+ "sourceId": {
12337
+ "type": "text",
12338
+ "required": false,
12339
+ "default": ""
12340
+ },
12341
+ "lineKey": {
12342
+ "type": "text",
12343
+ "required": false,
12344
+ "default": ""
12345
+ },
12346
+ "lineDescription": {
12347
+ "type": "text",
12348
+ "required": false,
12349
+ "default": ""
12350
+ },
12351
+ "amount": {
12352
+ "type": "integer",
12353
+ "required": false,
12354
+ "default": 0
12355
+ },
12356
+ "discount": {
12357
+ "type": "integer",
12358
+ "required": false,
12359
+ "default": 0
12360
+ },
12361
+ "quantity": {
12362
+ "type": "decimal",
12363
+ "required": false,
12364
+ "default": 0
12365
+ },
12366
+ "currency": {
12367
+ "type": "text",
12368
+ "required": false,
12369
+ "default": "USD"
12370
+ },
12371
+ "periodStart": {
12372
+ "type": "datetime",
12373
+ "required": false
12374
+ },
12375
+ "periodEnd": {
12376
+ "type": "datetime",
12377
+ "required": false
12378
+ }
12379
+ },
12380
+ "methods": {},
12381
+ "decoratorConfig": {
12382
+ "tableName": "_smrt_billing_line_sources",
12383
+ "conflictColumns": [
12384
+ "source_type",
12385
+ "source_id"
12386
+ ],
12387
+ "api": false,
12388
+ "cli": false,
12389
+ "mcp": false
12390
+ },
12391
+ "extends": "SmrtObject",
12392
+ "exportName": "BillingLineSource",
12393
+ "collectionExportName": "BillingLineSourceCollection",
12394
+ "validationRules": [
12395
+ {
12396
+ "field": "sellerTenantId",
12397
+ "rule": "required",
12398
+ "fieldType": "crossPackageRef"
12399
+ }
12400
+ ],
12401
+ "schema": {
12402
+ "tableName": "_smrt_billing_line_sources",
12403
+ "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 \"currency\" TEXT DEFAULT 'USD',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP\n);",
12404
+ "columns": {
12405
+ "id": {
12406
+ "type": "UUID",
12407
+ "primaryKey": true,
12408
+ "referenceKind": "id",
12409
+ "notNull": true
12410
+ },
12411
+ "slug": {
12412
+ "type": "TEXT",
12413
+ "notNull": true
12414
+ },
12415
+ "context": {
12416
+ "type": "TEXT",
12417
+ "notNull": true,
12418
+ "default": ""
12419
+ },
12420
+ "created_at": {
12421
+ "type": "TIMESTAMP",
12422
+ "notNull": true,
12423
+ "default": "current_timestamp"
12424
+ },
12425
+ "updated_at": {
12426
+ "type": "TIMESTAMP",
12427
+ "notNull": true,
12428
+ "default": "current_timestamp"
12429
+ },
12430
+ "seller_tenant_id": {
12431
+ "type": "UUID",
12432
+ "referenceKind": "crossPackageRef",
12433
+ "notNull": true,
12434
+ "unique": false
12435
+ },
12436
+ "period_close_id": {
12437
+ "type": "UUID",
12438
+ "referenceKind": "foreignKey",
12439
+ "notNull": false,
12440
+ "unique": false,
12441
+ "foreignKey": {
12442
+ "table": "_smrt_billing_period_closes",
12443
+ "column": "id",
12444
+ "onDelete": "NO ACTION",
12445
+ "onUpdate": "CASCADE"
12446
+ }
12447
+ },
12448
+ "source_type": {
12449
+ "type": "TEXT",
12450
+ "notNull": false,
12451
+ "unique": false,
12452
+ "default": "client_charge"
12453
+ },
12454
+ "source_id": {
12455
+ "type": "TEXT",
12456
+ "notNull": false,
12457
+ "unique": false,
12458
+ "default": ""
12459
+ },
12460
+ "line_key": {
12461
+ "type": "TEXT",
12462
+ "notNull": false,
12463
+ "unique": false,
12464
+ "default": ""
12465
+ },
12466
+ "line_description": {
12467
+ "type": "TEXT",
12468
+ "notNull": false,
12469
+ "unique": false,
12470
+ "default": ""
12471
+ },
12472
+ "amount": {
12473
+ "type": "INTEGER",
12474
+ "notNull": false,
12475
+ "unique": false,
12476
+ "default": 0
12477
+ },
12478
+ "discount": {
12479
+ "type": "INTEGER",
12480
+ "notNull": false,
12481
+ "unique": false,
12482
+ "default": 0
12483
+ },
12484
+ "quantity": {
12485
+ "type": "REAL",
12486
+ "notNull": false,
12487
+ "unique": false,
12488
+ "default": 0
12489
+ },
12490
+ "currency": {
12491
+ "type": "TEXT",
12492
+ "notNull": false,
12493
+ "unique": false,
12494
+ "default": "USD"
12495
+ },
12496
+ "period_start": {
12497
+ "type": "TIMESTAMP",
12498
+ "notNull": false,
12499
+ "unique": false
12500
+ },
12501
+ "period_end": {
12502
+ "type": "TIMESTAMP",
12503
+ "notNull": false,
12504
+ "unique": false
12505
+ }
12506
+ },
12507
+ "indexes": [
12508
+ {
12509
+ "name": "_smrt_billing_line_sources_source_type_source_id_idx",
12510
+ "columns": [
12511
+ "source_type",
12512
+ "source_id"
12513
+ ],
12514
+ "unique": true,
12515
+ "nullsNotDistinct": true
12516
+ },
12517
+ {
12518
+ "name": "_smrt_billing_line_sources_slug_context_idx",
12519
+ "columns": [
12520
+ "slug",
12521
+ "context"
12522
+ ]
12523
+ },
12524
+ {
12525
+ "name": "_smrt_billing_line_sources_created_at_idx",
12526
+ "columns": [
12527
+ "created_at"
12528
+ ]
12529
+ },
12530
+ {
12531
+ "name": "_smrt_billing_line_sources_seller_tenant_id_idx",
12532
+ "columns": [
12533
+ "seller_tenant_id"
12534
+ ]
12535
+ },
12536
+ {
12537
+ "name": "_smrt_billing_line_sources_period_close_id_idx",
12538
+ "columns": [
12539
+ "period_close_id"
12540
+ ]
12541
+ }
12542
+ ],
12543
+ "version": "60dec9a2"
12544
+ },
12545
+ "importPath": "@happyvertical/smrt-commerce"
12546
+ },
12547
+ "@happyvertical/smrt-commerce:BillingAccountCollection": {
12548
+ "name": "billingaccountcollection",
12549
+ "className": "BillingAccountCollection",
12550
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingAccountCollection",
12551
+ "collection": "billingaccounts",
12552
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12553
+ "packageName": "@happyvertical/smrt-commerce",
12554
+ "fields": {},
12555
+ "methods": {},
12556
+ "decoratorConfig": {
12557
+ "tableName": "_smrt_billing_accounts",
12558
+ "api": false,
12559
+ "mcp": false,
12560
+ "cli": false
12561
+ },
12562
+ "extends": "SmrtCollection",
12563
+ "extendsTypeArg": "BillingAccount",
12564
+ "exportName": "BillingAccountCollection",
12565
+ "collectionExportName": "BillingAccountCollectionCollection",
12566
+ "schema": {
12567
+ "tableName": "_smrt_billing_accounts",
12568
+ "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);",
12569
+ "columns": {
12570
+ "id": {
12571
+ "type": "UUID",
12572
+ "primaryKey": true,
12573
+ "referenceKind": "id",
12574
+ "notNull": true
12575
+ },
12576
+ "slug": {
12577
+ "type": "TEXT",
12578
+ "notNull": true
12579
+ },
12580
+ "context": {
12581
+ "type": "TEXT",
12582
+ "notNull": true,
12583
+ "default": ""
12584
+ },
12585
+ "created_at": {
12586
+ "type": "TIMESTAMP",
12587
+ "notNull": true,
12588
+ "default": "current_timestamp"
12589
+ },
12590
+ "updated_at": {
12591
+ "type": "TIMESTAMP",
12592
+ "notNull": true,
12593
+ "default": "current_timestamp"
12594
+ },
12595
+ "seller_tenant_id": {
12596
+ "type": "UUID",
12597
+ "referenceKind": "crossPackageRef",
12598
+ "notNull": true,
12599
+ "unique": false
12600
+ },
12601
+ "payer_tenant_id": {
12602
+ "type": "UUID",
12603
+ "referenceKind": "crossPackageRef",
12604
+ "notNull": true,
12605
+ "unique": false
12606
+ },
12607
+ "customer_id": {
12608
+ "type": "UUID",
12609
+ "referenceKind": "foreignKey",
12610
+ "notNull": false,
12611
+ "unique": false,
12612
+ "foreignKey": {
12613
+ "table": "customers",
12614
+ "column": "id",
12615
+ "onDelete": "NO ACTION",
12616
+ "onUpdate": "CASCADE"
12617
+ }
12618
+ },
12619
+ "name": {
12620
+ "type": "TEXT",
12621
+ "notNull": false,
12622
+ "unique": false,
12623
+ "default": ""
12624
+ },
12625
+ "email": {
12626
+ "type": "TEXT",
12627
+ "notNull": false,
12628
+ "unique": false,
12629
+ "default": ""
12630
+ },
12631
+ "provider": {
12632
+ "type": "TEXT",
12633
+ "notNull": false,
12634
+ "unique": false,
12635
+ "default": ""
12636
+ },
12637
+ "provider_customer_id": {
12638
+ "type": "TEXT",
12639
+ "notNull": false,
12640
+ "unique": false,
12641
+ "default": ""
12642
+ },
12643
+ "automatic_tax": {
12644
+ "type": "BOOLEAN",
12645
+ "notNull": false,
12646
+ "unique": false,
12647
+ "default": true
12648
+ },
12649
+ "flat_discount_basis_points": {
12650
+ "type": "INTEGER",
12651
+ "notNull": false,
12652
+ "unique": false,
12653
+ "default": 0
12654
+ },
12655
+ "payment_terms_days": {
12656
+ "type": "INTEGER",
12657
+ "notNull": false,
12658
+ "unique": false,
12659
+ "default": 30
12660
+ },
12661
+ "standing": {
12662
+ "type": "TEXT",
12663
+ "notNull": false,
12664
+ "unique": false,
12665
+ "default": "current"
12666
+ }
12667
+ },
12668
+ "indexes": [
12669
+ {
12670
+ "name": "_smrt_billing_accounts_seller_tenant_id_payer_tenant_id_idx",
12671
+ "columns": [
12672
+ "seller_tenant_id",
12673
+ "payer_tenant_id"
12674
+ ],
12675
+ "unique": true
12676
+ },
12677
+ {
12678
+ "name": "_smrt_billing_accounts_slug_context_idx",
12679
+ "columns": [
12680
+ "slug",
12681
+ "context"
12682
+ ]
12683
+ },
12684
+ {
12685
+ "name": "_smrt_billing_accounts_created_at_idx",
12686
+ "columns": [
12687
+ "created_at"
12688
+ ]
12689
+ },
12690
+ {
12691
+ "name": "_smrt_billing_accounts_payer_tenant_id_idx",
12692
+ "columns": [
12693
+ "payer_tenant_id"
12694
+ ]
12695
+ },
12696
+ {
12697
+ "name": "_smrt_billing_accounts_customer_id_idx",
12698
+ "columns": [
12699
+ "customer_id"
12700
+ ]
12701
+ }
12702
+ ],
12703
+ "version": "c9e78d38"
12704
+ },
12705
+ "importPath": "@happyvertical/smrt-commerce"
12706
+ },
12707
+ "@happyvertical/smrt-commerce:BillingPeriodCloseCollection": {
12708
+ "name": "billingperiodclosecollection",
12709
+ "className": "BillingPeriodCloseCollection",
12710
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingPeriodCloseCollection",
12711
+ "collection": "billingperiodcloses",
12712
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12713
+ "packageName": "@happyvertical/smrt-commerce",
12714
+ "fields": {},
12715
+ "methods": {},
12716
+ "decoratorConfig": {
12717
+ "tableName": "_smrt_billing_period_closes",
12718
+ "api": false,
12719
+ "mcp": false,
12720
+ "cli": false
12721
+ },
12722
+ "extends": "SmrtCollection",
12723
+ "extendsTypeArg": "BillingPeriodClose",
12724
+ "exportName": "BillingPeriodCloseCollection",
12725
+ "collectionExportName": "BillingPeriodCloseCollectionCollection",
12726
+ "schema": {
12727
+ "tableName": "_smrt_billing_period_closes",
12728
+ "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);",
12729
+ "columns": {
12730
+ "id": {
12731
+ "type": "UUID",
12732
+ "primaryKey": true,
12733
+ "referenceKind": "id",
12734
+ "notNull": true
12735
+ },
12736
+ "slug": {
12737
+ "type": "TEXT",
12738
+ "notNull": true
12739
+ },
12740
+ "context": {
12741
+ "type": "TEXT",
12742
+ "notNull": true,
12743
+ "default": ""
12744
+ },
12745
+ "created_at": {
12746
+ "type": "TIMESTAMP",
12747
+ "notNull": true,
12748
+ "default": "current_timestamp"
12749
+ },
12750
+ "updated_at": {
12751
+ "type": "TIMESTAMP",
12752
+ "notNull": true,
12753
+ "default": "current_timestamp"
12754
+ },
12755
+ "seller_tenant_id": {
12756
+ "type": "UUID",
12757
+ "referenceKind": "crossPackageRef",
12758
+ "notNull": true,
12759
+ "unique": false
12760
+ },
12761
+ "kind": {
12762
+ "type": "TEXT",
12763
+ "notNull": false,
12764
+ "unique": false,
12765
+ "default": "provider"
12766
+ },
12767
+ "payer_tenant_id": {
12768
+ "type": "UUID",
12769
+ "referenceKind": "crossPackageRef",
12770
+ "notNull": true,
12771
+ "unique": false
12772
+ },
12773
+ "currency": {
12774
+ "type": "TEXT",
12775
+ "notNull": false,
12776
+ "unique": false,
12777
+ "default": "USD"
12778
+ },
12779
+ "period_start": {
12780
+ "type": "TIMESTAMP",
12781
+ "notNull": false,
12782
+ "unique": false
12783
+ },
12784
+ "period_end": {
12785
+ "type": "TIMESTAMP",
12786
+ "notNull": false,
12787
+ "unique": false
12788
+ },
12789
+ "billing_account_id": {
12790
+ "type": "UUID",
12791
+ "referenceKind": "foreignKey",
12792
+ "notNull": false,
12793
+ "unique": false,
12794
+ "foreignKey": {
12795
+ "table": "_smrt_billing_accounts",
12796
+ "column": "id",
12797
+ "onDelete": "NO ACTION",
12798
+ "onUpdate": "CASCADE"
12799
+ }
12800
+ },
12801
+ "status": {
12802
+ "type": "TEXT",
12803
+ "notNull": false,
12804
+ "unique": false,
12805
+ "default": "collecting"
12806
+ },
12807
+ "invoice_id": {
12808
+ "type": "UUID",
12809
+ "referenceKind": "foreignKey",
12810
+ "notNull": false,
12811
+ "unique": false,
12812
+ "foreignKey": {
12813
+ "table": "invoices",
12814
+ "column": "id",
12815
+ "onDelete": "NO ACTION",
12816
+ "onUpdate": "CASCADE"
12817
+ }
12818
+ },
12819
+ "provider_invoice_id": {
12820
+ "type": "TEXT",
12821
+ "notNull": false,
12822
+ "unique": false,
12823
+ "default": ""
12824
+ },
12825
+ "subtotal": {
12826
+ "type": "INTEGER",
12827
+ "notNull": false,
12828
+ "unique": false,
12829
+ "default": 0
12830
+ },
12831
+ "line_count": {
12832
+ "type": "INTEGER",
12833
+ "notNull": false,
12834
+ "unique": false,
12835
+ "default": 0
12836
+ },
12837
+ "issued_at": {
12838
+ "type": "TIMESTAMP",
12839
+ "notNull": false,
12840
+ "unique": false
12841
+ },
12842
+ "lease_token": {
12843
+ "type": "TEXT",
12844
+ "notNull": false,
12845
+ "unique": false
12846
+ },
12847
+ "lease_expires_at": {
12848
+ "type": "TIMESTAMP",
12849
+ "notNull": false,
12850
+ "unique": false
12851
+ },
12852
+ "attempts": {
12853
+ "type": "INTEGER",
12854
+ "notNull": false,
12855
+ "unique": false,
12856
+ "default": 0
12857
+ },
12858
+ "last_error": {
12859
+ "type": "TEXT",
12860
+ "notNull": false,
12861
+ "unique": false,
12862
+ "default": ""
12863
+ }
12864
+ },
12865
+ "indexes": [
12866
+ {
12867
+ "name": "_smrt_billing_period_closes_seller_tenant_id_kind_idx",
12868
+ "columns": [
12869
+ "seller_tenant_id",
12870
+ "kind",
12871
+ "payer_tenant_id",
12872
+ "currency",
12873
+ "period_start",
12874
+ "period_end"
12875
+ ],
12876
+ "unique": true,
12877
+ "nullsNotDistinct": true
12878
+ },
12879
+ {
12880
+ "name": "_smrt_billing_period_closes_slug_context_idx",
12881
+ "columns": [
12882
+ "slug",
12883
+ "context"
12884
+ ]
12885
+ },
12886
+ {
12887
+ "name": "_smrt_billing_period_closes_created_at_idx",
12888
+ "columns": [
12889
+ "created_at"
12890
+ ]
12891
+ },
12892
+ {
12893
+ "name": "_smrt_billing_period_closes_payer_tenant_id_idx",
12894
+ "columns": [
12895
+ "payer_tenant_id"
12896
+ ]
12897
+ },
12898
+ {
12899
+ "name": "_smrt_billing_period_closes_billing_account_id_idx",
12900
+ "columns": [
12901
+ "billing_account_id"
12902
+ ]
12903
+ },
12904
+ {
12905
+ "name": "_smrt_billing_period_closes_invoice_id_idx",
12906
+ "columns": [
12907
+ "invoice_id"
12908
+ ]
12909
+ }
12910
+ ],
12911
+ "version": "753d2e86"
12912
+ },
12913
+ "importPath": "@happyvertical/smrt-commerce"
12914
+ },
12915
+ "@happyvertical/smrt-commerce:BillingLineSourceCollection": {
12916
+ "name": "billinglinesourcecollection",
12917
+ "className": "BillingLineSourceCollection",
12918
+ "qualifiedName": "@happyvertical/smrt-commerce:BillingLineSourceCollection",
12919
+ "collection": "billinglinesources",
12920
+ "filePath": "/home/runner/work/smrt/smrt/packages/commerce/src/models/billing.ts",
12921
+ "packageName": "@happyvertical/smrt-commerce",
12922
+ "fields": {},
12923
+ "methods": {},
12924
+ "decoratorConfig": {
12925
+ "tableName": "_smrt_billing_line_sources",
12926
+ "api": false,
12927
+ "mcp": false,
12928
+ "cli": false
12929
+ },
12930
+ "extends": "SmrtCollection",
12931
+ "extendsTypeArg": "BillingLineSource",
12932
+ "exportName": "BillingLineSourceCollection",
12933
+ "collectionExportName": "BillingLineSourceCollectionCollection",
12934
+ "schema": {
12935
+ "tableName": "_smrt_billing_line_sources",
12936
+ "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 \"currency\" TEXT DEFAULT 'USD',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP\n);",
12937
+ "columns": {
12938
+ "id": {
12939
+ "type": "UUID",
12940
+ "primaryKey": true,
12941
+ "referenceKind": "id",
12942
+ "notNull": true
12943
+ },
12944
+ "slug": {
12945
+ "type": "TEXT",
12946
+ "notNull": true
12947
+ },
12948
+ "context": {
12949
+ "type": "TEXT",
12950
+ "notNull": true,
12951
+ "default": ""
12952
+ },
12953
+ "created_at": {
12954
+ "type": "TIMESTAMP",
12955
+ "notNull": true,
12956
+ "default": "current_timestamp"
12957
+ },
12958
+ "updated_at": {
12959
+ "type": "TIMESTAMP",
12960
+ "notNull": true,
12961
+ "default": "current_timestamp"
12962
+ },
12963
+ "seller_tenant_id": {
12964
+ "type": "UUID",
12965
+ "referenceKind": "crossPackageRef",
12966
+ "notNull": true,
12967
+ "unique": false
12968
+ },
12969
+ "period_close_id": {
12970
+ "type": "UUID",
12971
+ "referenceKind": "foreignKey",
12972
+ "notNull": false,
12973
+ "unique": false,
12974
+ "foreignKey": {
12975
+ "table": "_smrt_billing_period_closes",
12976
+ "column": "id",
12977
+ "onDelete": "NO ACTION",
12978
+ "onUpdate": "CASCADE"
12979
+ }
12980
+ },
12981
+ "source_type": {
12982
+ "type": "TEXT",
12983
+ "notNull": false,
12984
+ "unique": false,
12985
+ "default": "client_charge"
12986
+ },
12987
+ "source_id": {
12988
+ "type": "TEXT",
12989
+ "notNull": false,
12990
+ "unique": false,
12991
+ "default": ""
12992
+ },
12993
+ "line_key": {
12994
+ "type": "TEXT",
12995
+ "notNull": false,
12996
+ "unique": false,
12997
+ "default": ""
12998
+ },
12999
+ "line_description": {
13000
+ "type": "TEXT",
13001
+ "notNull": false,
13002
+ "unique": false,
13003
+ "default": ""
13004
+ },
13005
+ "amount": {
13006
+ "type": "INTEGER",
13007
+ "notNull": false,
13008
+ "unique": false,
13009
+ "default": 0
13010
+ },
13011
+ "discount": {
13012
+ "type": "INTEGER",
13013
+ "notNull": false,
13014
+ "unique": false,
13015
+ "default": 0
13016
+ },
13017
+ "quantity": {
13018
+ "type": "REAL",
13019
+ "notNull": false,
13020
+ "unique": false,
13021
+ "default": 0
13022
+ },
13023
+ "currency": {
13024
+ "type": "TEXT",
13025
+ "notNull": false,
13026
+ "unique": false,
13027
+ "default": "USD"
13028
+ },
13029
+ "period_start": {
13030
+ "type": "TIMESTAMP",
13031
+ "notNull": false,
13032
+ "unique": false
13033
+ },
13034
+ "period_end": {
13035
+ "type": "TIMESTAMP",
13036
+ "notNull": false,
13037
+ "unique": false
13038
+ }
13039
+ },
13040
+ "indexes": [
13041
+ {
13042
+ "name": "_smrt_billing_line_sources_source_type_source_id_idx",
13043
+ "columns": [
13044
+ "source_type",
13045
+ "source_id"
13046
+ ],
13047
+ "unique": true,
13048
+ "nullsNotDistinct": true
13049
+ },
13050
+ {
13051
+ "name": "_smrt_billing_line_sources_slug_context_idx",
13052
+ "columns": [
13053
+ "slug",
13054
+ "context"
13055
+ ]
13056
+ },
13057
+ {
13058
+ "name": "_smrt_billing_line_sources_created_at_idx",
13059
+ "columns": [
13060
+ "created_at"
13061
+ ]
13062
+ },
13063
+ {
13064
+ "name": "_smrt_billing_line_sources_seller_tenant_id_idx",
13065
+ "columns": [
13066
+ "seller_tenant_id"
13067
+ ]
13068
+ },
13069
+ {
13070
+ "name": "_smrt_billing_line_sources_period_close_id_idx",
13071
+ "columns": [
13072
+ "period_close_id"
13073
+ ]
13074
+ }
13075
+ ],
13076
+ "version": "60dec9a2"
13077
+ },
13078
+ "importPath": "@happyvertical/smrt-commerce"
11690
13079
  }
11691
13080
  },
11692
13081
  "moduleType": "smrt",
11693
13082
  "smrtDependencies": [
11694
13083
  "@happyvertical/smrt-core",
13084
+ "@happyvertical/smrt-jobs",
11695
13085
  "@happyvertical/smrt-ledgers",
13086
+ "@happyvertical/smrt-subscriptions",
11696
13087
  "@happyvertical/smrt-tenancy"
11697
13088
  ]
11698
13089
  }