@happyvertical/smrt-commerce 0.55.24 → 0.56.1

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 (220) hide show
  1. package/AGENTS.md +11 -9
  2. package/README.md +114 -2
  3. package/agents/accounting-snapshot-mapper.md +111 -0
  4. package/agents/contract-money.md +18 -0
  5. package/agents/cost-billing.md +7 -2
  6. package/agents/document-money.md +126 -0
  7. package/agents/invoice-calculations.md +14 -2
  8. package/agents/line-amount-migration.md +50 -0
  9. package/agents/minor-unit-migration.md +20 -0
  10. package/agents/money-calculator.md +45 -0
  11. package/agents/money-model.md +113 -0
  12. package/agents/purchasing-ui.md +4 -3
  13. package/agents/quote-ui.md +3 -2
  14. package/agents/revenue-journal.md +23 -0
  15. package/agents/tax-codes.md +48 -0
  16. package/agents/tax-summary.md +126 -0
  17. package/dist/accounting-snapshot.d.ts +79 -0
  18. package/dist/accounting-snapshot.d.ts.map +1 -0
  19. package/dist/billing/runtime.d.ts +2 -0
  20. package/dist/billing/runtime.d.ts.map +1 -1
  21. package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js +265 -0
  22. package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js.map +1 -0
  23. package/dist/chunks/CustomerCollection-DQIujn4f.js +99 -0
  24. package/dist/chunks/CustomerCollection-DQIujn4f.js.map +1 -0
  25. package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js +1639 -0
  26. package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js.map +1 -0
  27. package/dist/chunks/InvoiceCollection-CKQflFjc.js +1047 -0
  28. package/dist/chunks/InvoiceCollection-CKQflFjc.js.map +1 -0
  29. package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js +467 -0
  30. package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js.map +1 -0
  31. package/dist/chunks/TaxCodeCollection-DOpzW4y8.js +149 -0
  32. package/dist/chunks/TaxCodeCollection-DOpzW4y8.js.map +1 -0
  33. package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js +129 -0
  34. package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js.map +1 -0
  35. package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js +319 -0
  36. package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js.map +1 -0
  37. package/dist/chunks/{money-DfrRxrel.js → allocation-integrity-DI3G16BN.js} +7 -12
  38. package/dist/chunks/allocation-integrity-DI3G16BN.js.map +1 -0
  39. package/dist/chunks/{calculations-Bz7RB3qK.js → calculations-DaHR17il.js} +134 -54
  40. package/dist/chunks/calculations-DaHR17il.js.map +1 -0
  41. package/dist/chunks/credit-allocation-yspz0Lab.js +121 -0
  42. package/dist/chunks/credit-allocation-yspz0Lab.js.map +1 -0
  43. package/dist/chunks/document-money-DNVhDJyC.js +860 -0
  44. package/dist/chunks/document-money-DNVhDJyC.js.map +1 -0
  45. package/dist/chunks/invoice-posting-BwV8g7z0.js +229 -0
  46. package/dist/chunks/invoice-posting-BwV8g7z0.js.map +1 -0
  47. package/dist/chunks/money-rational-CcW7gzG5.js +64 -0
  48. package/dist/chunks/money-rational-CcW7gzG5.js.map +1 -0
  49. package/dist/chunks/revenue-journal-DY9fro8E.js +140 -0
  50. package/dist/chunks/revenue-journal-DY9fro8E.js.map +1 -0
  51. package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  52. package/dist/chunks/tenant-money-barrier-DjRXgMnX.js +135 -0
  53. package/dist/chunks/tenant-money-barrier-DjRXgMnX.js.map +1 -0
  54. package/dist/chunks/{types-zVnIjSOk.js → types-LDETvQ1C.js} +3 -14
  55. package/dist/chunks/types-LDETvQ1C.js.map +1 -0
  56. package/dist/chunks/{units-BpZ0_Dpk.js → units-CNcjH_eE.js} +2 -2
  57. package/dist/chunks/{units-BpZ0_Dpk.js.map → units-CNcjH_eE.js.map} +1 -1
  58. package/dist/collections/ContractCollection.d.ts +37 -1
  59. package/dist/collections/ContractCollection.d.ts.map +1 -1
  60. package/dist/collections/ContractLineItemCollection.d.ts +26 -1
  61. package/dist/collections/ContractLineItemCollection.d.ts.map +1 -1
  62. package/dist/collections/DocumentTaxCollection.d.ts +75 -0
  63. package/dist/collections/DocumentTaxCollection.d.ts.map +1 -0
  64. package/dist/collections/InvoiceCollection.d.ts +26 -1
  65. package/dist/collections/InvoiceCollection.d.ts.map +1 -1
  66. package/dist/collections/InvoiceLineItemCollection.d.ts +26 -1
  67. package/dist/collections/InvoiceLineItemCollection.d.ts.map +1 -1
  68. package/dist/collections/MoneyMigrationDocumentCollection.d.ts +12 -0
  69. package/dist/collections/MoneyMigrationDocumentCollection.d.ts.map +1 -0
  70. package/dist/collections/PaymentAllocationCollection.d.ts +2 -0
  71. package/dist/collections/PaymentAllocationCollection.d.ts.map +1 -1
  72. package/dist/collections/PurchaseContractCollection.d.ts +8 -0
  73. package/dist/collections/PurchaseContractCollection.d.ts.map +1 -0
  74. package/dist/collections/SalesContractCollection.d.ts +8 -0
  75. package/dist/collections/SalesContractCollection.d.ts.map +1 -0
  76. package/dist/collections/TaxCodeCollection.d.ts +7 -0
  77. package/dist/collections/TaxCodeCollection.d.ts.map +1 -0
  78. package/dist/collections/TaxComponentCollection.d.ts +6 -0
  79. package/dist/collections/TaxComponentCollection.d.ts.map +1 -0
  80. package/dist/collections/TaxSettingsCollection.d.ts +16 -0
  81. package/dist/collections/TaxSettingsCollection.d.ts.map +1 -0
  82. package/dist/collections/TaxSummaryReportCollection.d.ts +151 -0
  83. package/dist/collections/TaxSummaryReportCollection.d.ts.map +1 -0
  84. package/dist/collections/index.d.ts +8 -0
  85. package/dist/collections/index.d.ts.map +1 -1
  86. package/dist/commerce-money-tools.d.ts +9 -0
  87. package/dist/commerce-money-tools.d.ts.map +1 -0
  88. package/dist/contract-money.d.ts +27 -0
  89. package/dist/contract-money.d.ts.map +1 -0
  90. package/dist/cost-billing.d.ts +0 -1
  91. package/dist/cost-billing.d.ts.map +1 -1
  92. package/dist/cost-billing.js +10 -15
  93. package/dist/cost-billing.js.map +1 -1
  94. package/dist/credit-allocation.d.ts +48 -0
  95. package/dist/credit-allocation.d.ts.map +1 -0
  96. package/dist/document-money-internal.d.ts +44 -0
  97. package/dist/document-money-internal.d.ts.map +1 -0
  98. package/dist/document-money.d.ts +85 -0
  99. package/dist/document-money.d.ts.map +1 -0
  100. package/dist/index.d.ts +16 -4
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +5563 -4243
  103. package/dist/index.js.map +1 -1
  104. package/dist/invoice-accounting-sync.d.ts +96 -0
  105. package/dist/invoice-accounting-sync.d.ts.map +1 -0
  106. package/dist/invoice-mcp.d.ts +16 -0
  107. package/dist/invoice-mcp.d.ts.map +1 -0
  108. package/dist/invoice-posting.d.ts +9 -0
  109. package/dist/invoice-posting.d.ts.map +1 -0
  110. package/dist/invoice-record-screen.d.ts +60 -0
  111. package/dist/invoice-record-screen.d.ts.map +1 -0
  112. package/dist/invoices.d.ts +2 -0
  113. package/dist/invoices.d.ts.map +1 -1
  114. package/dist/invoices.js +3 -2
  115. package/dist/manifest.json +11605 -4598
  116. package/dist/migrations/commerceLineAmounts.d.ts +84 -0
  117. package/dist/migrations/commerceLineAmounts.d.ts.map +1 -0
  118. package/dist/migrations/partyLinks.d.ts +39 -0
  119. package/dist/migrations/partyLinks.d.ts.map +1 -0
  120. package/dist/models/Contract.d.ts +61 -27
  121. package/dist/models/Contract.d.ts.map +1 -1
  122. package/dist/models/ContractLineItem.d.ts +30 -1
  123. package/dist/models/ContractLineItem.d.ts.map +1 -1
  124. package/dist/models/Customer.d.ts +7 -0
  125. package/dist/models/Customer.d.ts.map +1 -1
  126. package/dist/models/DocumentTax.d.ts +50 -0
  127. package/dist/models/DocumentTax.d.ts.map +1 -0
  128. package/dist/models/Invoice.d.ts +46 -2
  129. package/dist/models/Invoice.d.ts.map +1 -1
  130. package/dist/models/InvoiceLineItem.d.ts +33 -2
  131. package/dist/models/InvoiceLineItem.d.ts.map +1 -1
  132. package/dist/models/MoneyMigrationDocument.d.ts +28 -0
  133. package/dist/models/MoneyMigrationDocument.d.ts.map +1 -0
  134. package/dist/models/Payment.d.ts +5 -1
  135. package/dist/models/Payment.d.ts.map +1 -1
  136. package/dist/models/PaymentAllocation.d.ts.map +1 -1
  137. package/dist/models/TaxCode.d.ts +22 -0
  138. package/dist/models/TaxCode.d.ts.map +1 -0
  139. package/dist/models/TaxComponent.d.ts +21 -0
  140. package/dist/models/TaxComponent.d.ts.map +1 -0
  141. package/dist/models/TaxSettings.d.ts +33 -0
  142. package/dist/models/TaxSettings.d.ts.map +1 -0
  143. package/dist/models/TaxSummaryReport.d.ts +35 -0
  144. package/dist/models/TaxSummaryReport.d.ts.map +1 -0
  145. package/dist/models/Vendor.d.ts +9 -0
  146. package/dist/models/Vendor.d.ts.map +1 -1
  147. package/dist/models/index.d.ts +7 -1
  148. package/dist/models/index.d.ts.map +1 -1
  149. package/dist/money-rational.d.ts +15 -0
  150. package/dist/money-rational.d.ts.map +1 -0
  151. package/dist/money.d.ts +106 -25
  152. package/dist/money.d.ts.map +1 -1
  153. package/dist/money.js +274 -0
  154. package/dist/money.js.map +1 -0
  155. package/dist/recipes.d.ts +17 -47
  156. package/dist/recipes.d.ts.map +1 -1
  157. package/dist/revenue-journal.d.ts +61 -0
  158. package/dist/revenue-journal.d.ts.map +1 -0
  159. package/dist/smrt-knowledge.json +6558 -1316
  160. package/dist/svelte/components/InvoiceActions.svelte +12 -0
  161. package/dist/svelte/components/InvoiceActions.svelte.d.ts +5 -0
  162. package/dist/svelte/components/InvoiceActions.svelte.d.ts.map +1 -1
  163. package/dist/svelte/components/InvoiceEditor.svelte +15 -1
  164. package/dist/svelte/components/InvoiceEditor.svelte.d.ts.map +1 -1
  165. package/dist/svelte/components/InvoiceLineItems.svelte +3 -3
  166. package/dist/svelte/components/InvoiceRecordScreen.svelte +94 -0
  167. package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts +21 -0
  168. package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts.map +1 -0
  169. package/dist/svelte/components/InvoiceTotals.svelte +2 -2
  170. package/dist/svelte/components/MoneyInvoiceEditor.svelte +282 -0
  171. package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts +31 -0
  172. package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts.map +1 -0
  173. package/dist/svelte/components/PurchaseOrderEditor.svelte +53 -1
  174. package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts +5 -0
  175. package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts.map +1 -1
  176. package/dist/svelte/components/QuoteEditor.svelte +54 -1
  177. package/dist/svelte/components/QuoteEditor.svelte.d.ts +5 -0
  178. package/dist/svelte/components/QuoteEditor.svelte.d.ts.map +1 -1
  179. package/dist/svelte/i18n.d.ts +16 -0
  180. package/dist/svelte/i18n.d.ts.map +1 -1
  181. package/dist/svelte/i18n.js +16 -0
  182. package/dist/svelte/index.d.ts +7 -2
  183. package/dist/svelte/index.d.ts.map +1 -1
  184. package/dist/svelte/index.js +4 -1
  185. package/dist/svelte/invoices/calculations.d.ts +7 -2
  186. package/dist/svelte/invoices/calculations.d.ts.map +1 -1
  187. package/dist/svelte/invoices/calculations.js +141 -47
  188. package/dist/svelte/invoices/money-editor.d.ts +123 -0
  189. package/dist/svelte/invoices/money-editor.d.ts.map +1 -0
  190. package/dist/svelte/invoices/money-editor.js +101 -0
  191. package/dist/svelte/invoices/types.d.ts +5 -1
  192. package/dist/svelte/invoices/types.d.ts.map +1 -1
  193. package/dist/svelte/purchasing-i18n.d.ts +5 -0
  194. package/dist/svelte/purchasing-i18n.d.ts.map +1 -1
  195. package/dist/svelte/purchasing-i18n.js +5 -0
  196. package/dist/svelte/quote-i18n.d.ts +5 -0
  197. package/dist/svelte/quote-i18n.d.ts.map +1 -1
  198. package/dist/svelte/quote-i18n.js +5 -0
  199. package/dist/tax/cookbook.d.ts +22 -0
  200. package/dist/tax/cookbook.d.ts.map +1 -0
  201. package/dist/tax/example-pack.d.ts +25 -0
  202. package/dist/tax/example-pack.d.ts.map +1 -0
  203. package/dist/tax/identity.d.ts +5 -0
  204. package/dist/tax/identity.d.ts.map +1 -0
  205. package/dist/tax/index.d.ts +4 -0
  206. package/dist/tax/index.d.ts.map +1 -0
  207. package/dist/tax/legacy.d.ts +48 -0
  208. package/dist/tax/legacy.d.ts.map +1 -0
  209. package/dist/tax-summary-report-adapter.d.ts +37 -0
  210. package/dist/tax-summary-report-adapter.d.ts.map +1 -0
  211. package/dist/tax-summary.d.ts +129 -0
  212. package/dist/tax-summary.d.ts.map +1 -0
  213. package/dist/tenant-money-barrier.d.ts +66 -0
  214. package/dist/tenant-money-barrier.d.ts.map +1 -0
  215. package/dist/types/index.d.ts +145 -5
  216. package/dist/types/index.d.ts.map +1 -1
  217. package/package.json +19 -11
  218. package/dist/chunks/calculations-Bz7RB3qK.js.map +0 -1
  219. package/dist/chunks/money-DfrRxrel.js.map +0 -1
  220. package/dist/chunks/types-zVnIjSOk.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ # Money calculator
2
+
3
+ `src/money.ts` is the Svelte-free authority for commercial document arithmetic.
4
+ Import it from `@happyvertical/smrt-commerce/money` (or the package root).
5
+
6
+ - Inputs are signed safe-integer minor units. Quantity and percent values have at
7
+ most six decimal places; calculations use exact `BigInt` rationals and round
8
+ half away from zero. Currency must be a supported ISO 4217 code with a defined
9
+ minor unit; the exponent validates the document currency but does not rescale
10
+ already-minor-unit inputs.
11
+ - `lineAmountType` is `exclusive`, `inclusive`, or `none`. Inclusive `amountMinor`
12
+ is the customer-visible gross; `netMinor = amountMinor - taxMinor`.
13
+ - `roundingScope: 'line'` rounds each line/component. `document` rounds the exact
14
+ sum for each shared component, then allocates from truncation toward zero by
15
+ signed largest remainder. Ties use code-unit line ID order, so input order does
16
+ not affect allocation. The residual's sign, including mixed signed lines, is
17
+ authoritative.
18
+ - `taxes` is split by tax code and component for persistence. Shared components
19
+ are rounded across codes at document scope. Non-taxable codes use a null
20
+ component row with zero tax and taxable minor units equal to summed line net.
21
+ A genuinely unassigned exclusive/inclusive line uses `taxCode: null` and emits
22
+ `{ taxCodeId: null, taxComponentId: null }`; no synthetic ID is persisted.
23
+ - Resolve already-loaded codes with `resolveLineTaxCode()`. `none` mode always
24
+ chooses the supplied out-of-scope code before an override. Active/scope checks
25
+ happen during resolution; issued snapshots are not passed back through it.
26
+ Missing exempt/out-of-scope seeds fail closed and never fall through to a
27
+ taxable default.
28
+ - Discounts are either percent or signed minor units. An amount discount carries
29
+ the gross sign. Editors may accept a positive magnitude, then apply the sign.
30
+
31
+ All business rejections use `MoneyValidationError`. The stable tax-code shape
32
+ codes include `TAX_CODE_DUPLICATE_COMPONENT`,
33
+ `TAX_CODE_NON_TAXABLE_COMPONENTS`, and `TAX_CODE_TAXABLE_EMPTY`, in addition to
34
+ `TAX_CODE_NOT_FOUND`, `TAX_CODE_KIND`, `TAX_COMPONENT_RATE_CONFLICT`, and the
35
+ shared input, discount, percent, compound, state, scope, safety, freeze, and
36
+ currency codes exported as `MoneyValidationCode`.
37
+
38
+ The existing invoice functions in `src/svelte/invoices/calculations.ts` remain
39
+ compatibility adapters for the legacy single-component exclusive model until the
40
+ tenant migration gate enables persisted money-v2 fields. In particular,
41
+ `calculateInvoiceMinorLine(input)` defaults to the legacy negative-tie rule for
42
+ existing model saves. Migration-aware callers explicitly pass
43
+ `{ moneyModel: 'v2' }`; there is no process-global mode. V2 callers pass the
44
+ stored signed discount through unchanged; editor magnitude normalization happens
45
+ before constructing that stored input.
@@ -0,0 +1,113 @@
1
+ # Commercial money model
2
+
3
+ This guide names the public commerce money contract. The exact input and result
4
+ shapes, validation codes, and worked calculator examples live in the
5
+ [calculator guide](money-calculator.md) and
6
+ [package documentation](../../../docs/content/commerce-money.md). Money values
7
+ are signed safe-integer minor units; calculator tax percentages are exact text,
8
+ so `'5'` means 5%. The retained `InvoiceLineItem.taxRate` and
9
+ `ContractLineItem.taxRate` fields are different legacy persisted fractions:
10
+ `0.05` means 5%.
11
+
12
+ ## Calculation contract
13
+
14
+ `calculateMoneyDocument()` accepts `exclusive`, `inclusive`, and `none` line
15
+ amount modes. It first computes quantity times unit price, applies the one
16
+ chosen discount, and returns the post-discount amount, tax components, net, and
17
+ line total. `exclusive` line amounts are tax-exclusive net; `inclusive` line
18
+ amounts are the visible gross and derive net by removing tax; `none` has zero
19
+ tax and requires an out-of-scope code. `subtotalMinor`, `taxMinor`, and
20
+ `totalMinor` are document totals. `discountTotalMinor` is informational because
21
+ the line discounts were already applied; consumers must not subtract it again.
22
+
23
+ The `line` rounding scope rounds each line/component. The `document` scope
24
+ rounds each shared component's exact total, truncates each allocation toward
25
+ zero, and gives signed residual minor units to the largest remainders, with
26
+ line-ID code-unit order breaking ties. It leaves no document residual. Across
27
+ `n` small lines, the two scopes can differ by up to `ceil(n / 2)` minor units
28
+ per component. Store the chosen scope; do not silently substitute a later
29
+ setting. `MoneyValidationError.code` is the public branch point for invalid
30
+ money, discounts, tax-code state and scope, unsupported compound tax, frozen
31
+ records, and unsafe values.
32
+
33
+ Tax-code resolution is pure once the caller has loaded authorized codes. It
34
+ uses a line override, customer exemption, product code, customer code, and app
35
+ default in that order. An unresolved exclusive or inclusive line is a genuine
36
+ zero-tax, null-code case; it is not an out-of-scope inference. The tax-code
37
+ catalogue, seeds, registrations, and cookbook boundary are documented in
38
+ [tax codes](tax-codes.md).
39
+
40
+ ## Stored Invoice facts
41
+
42
+ `TaxSettings.moneyModel` selects the Invoice write behavior. `legacy` keeps the
43
+ compatibility path; `migrating` rejects money writes; `v2` resolves a draft's
44
+ current settings once and atomically writes the header, line snapshots, and
45
+ `DocumentTax` rows. The detailed persistence, freeze, preview, credit-note, and
46
+ refund contracts are in [document money](document-money.md).
47
+
48
+ Once an Invoice leaves `DRAFT`, or receives an AR journal, its money snapshot
49
+ is frozen. Reads use those stored values and must not recompute issued tax from
50
+ new defaults. `DocumentTax` is a derived, read-only per-document/code/component
51
+ snapshot with currency, code and component identities and labels, kind, exact
52
+ percent, liability account, taxable, tax, and recoverable minor-unit values.
53
+ It also represents non-taxable and unassigned zero-tax rows so reporting does
54
+ not invent a taxable component.
55
+
56
+ A credit note is an `Invoice` with `kind: 'credit_note'`. It stores positive
57
+ amounts; posting, reporting, and accounting adapters apply that direction once.
58
+ Issued-credit capacity and refunds are stable Invoice-v2 behavior. A refund is
59
+ a positive `Payment` of kind `refund`, allocated only to a credit note. See
60
+ [document money](document-money.md) before presenting either balance as an
61
+ ordinary incoming payment.
62
+
63
+ ## Invoice MCP `get` projection
64
+
65
+ The standard Invoice MCP `get` tool uses `serializeInvoiceMcpGet`. For a
66
+ legacy tenant, or when tenant settings are absent, it returns the ordinary
67
+ public Invoice projection and omits the `money` alias. For a v2 tenant, the
68
+ optional `money` value is the stored `InvoiceMoneyFacts` projection: its
69
+ header, line snapshots, and `DocumentTax` facts are read from the issued
70
+ snapshot and are never recalculated.
71
+
72
+ A tenant in the `migrating` gate refuses this read with the stable
73
+ `FROZEN_DOCUMENT` code and the public message `Tenant money migration is in
74
+ progress`. If the caller's `PublicJsonOptions` hide any Invoice,
75
+ `InvoiceLineItem`, or `DocumentTax` field needed by the money projection, the
76
+ serializer returns the base Invoice and omits the entire `money` alias. It does
77
+ not expose restricted values through a partial plain-object alias.
78
+
79
+ This applies only to standard MCP `get`. Invoice list and MCP write behavior
80
+ remain their existing public contracts. The general serializer configuration,
81
+ authorization order, and projection rule are in [core MCP get
82
+ serializers](../../core/agents/generators.md#mcp-get-serializers).
83
+
84
+ ## Reporting and integrations
85
+
86
+ The materialized `TaxSummaryReport` and its public descriptor/drilldown bridge
87
+ read stored Invoice `DocumentTax` facts under the tenant v2 gate. See
88
+ [tax summary aggregation](tax-summary.md). Commerce exports
89
+ `createTaxSummaryMaterializedReportHost()` for an application-owned,
90
+ server-only host; register that host in the app's fixed report-host registry to
91
+ opt into the generic `MaterializedReportTable` and its tenant-scoped drilldown
92
+ route. The host binds the authenticated tenant, principal, and
93
+ `taxsummaryreports.read` permission; browser input supplies only a row id
94
+ and visible column id.
95
+
96
+ The accounting snapshot mapper consumes frozen facts and never re-calculates a
97
+ rate or allocation. It maps an inclusive line to the accounting SDK's
98
+ `TaxInclusiveAmt`; tenant mappings provide provider tax-code and component-rate
99
+ identities. The QuickBooks sync boundary persists SDK 0.103.7 invoice or credit
100
+ memo request descriptors before provider I/O, refuses competing writes, and
101
+ requires explicit reconciliation after an unknown outcome. Its supported
102
+ inputs and recovery contract are documented in [accounting snapshot
103
+ mapper](accounting-snapshot-mapper.md).
104
+
105
+ ## Deliberate boundaries
106
+
107
+ The tenant migration and rollback contract is documented in
108
+ [tenant line-amount migration](line-amount-migration.md).
109
+ The marker is a maintenance gate, not a customer-controlled setting. Contract
110
+ money persistence remains a separate aggregate contract; production report
111
+ hosting is an application opt-in over the public host described above. The
112
+ model also does not provide currency conversion, cash-basis/deposit accounting,
113
+ partial recoverability, period locking, or compound tax.
@@ -100,9 +100,10 @@ unavailable vendor or explicitly permit keeping the existing relationship.
100
100
  `shipTo` is a delivery address/instructions snapshot, not a Profile reference.
101
101
  `PurchaseOrder.expectedDate` and `.shipTo` use existing STI metadata, default to
102
102
  empty strings, and accept `PurchaseOrderOptions`; no table migration is needed.
103
- Existing Contract fields own the other three values. Header persistence uses the
104
- existing SQLite/PostgreSQL Contract schema; DuckDB rejects its existing
105
- ON UPDATE CASCADE foreign keys and is not a supported Contract storage lane. Caller retry identities
103
+ `PurchaseContract` owns `vendorId`; `Contract` owns `reference` and `notes`.
104
+ Header persistence uses the existing SQLite/PostgreSQL Contract schema. DuckDB
105
+ rejects its existing ON UPDATE CASCADE foreign keys and is not a supported
106
+ Contract storage lane. Caller retry identities
106
107
  are rendered unchanged; the form itself never persists or retries a mutation.
107
108
 
108
109
  Header regression evidence uses the purchasing SSR suite and the shared quote
@@ -8,8 +8,9 @@ Commerce playground has interactive vendor quotation and customer estimate demos
8
8
  `kind: 'vendor-quotation'` means received supplier evidence;
9
9
  `kind: 'customer-estimate'` means pricing proposed to a customer. Neither widget
10
10
  selects pricing, accepts budgets, awards work, sends messages or mutates a model.
11
- Adapt public Commerce Estimate/Contract fields (`currency`, `totalAmount`,
12
- `status`, `customerId`/`vendorId`) to these presentation DTOs;
11
+ Adapt Commerce `Estimate` fields (`currency`, `totalAmount`, `status`,
12
+ `customerId`) to customer-estimate DTOs. A received vendor quotation is
13
+ caller-held evidence or a draft `PurchaseOrder`, not an `Estimate.vendorId`;
13
14
  construction package allocation and approval policy remain caller extensions.
14
15
  Client records need not become Commerce Customers.
15
16
 
@@ -0,0 +1,23 @@
1
+ # Revenue journal entry builder
2
+
3
+ `buildRevenueJournalEntries()` is a pure boundary between frozen commerce money
4
+ snapshots and `smrt-ledgers` journal creation. It consumes stored document totals,
5
+ stored line amounts/tax, and stored `DocumentTax` component/account snapshots. It
6
+ does not resolve current tax codes or rates.
7
+
8
+ Callers supply the ledger book currency explicitly. A different document currency
9
+ is rejected because this release does not convert currencies. Positive documents
10
+ debit receivables and credit revenue/tax; signed credits naturally swap sides, and
11
+ `direction: -1` creates the symmetric entry set used by later reversal flows.
12
+
13
+ For inclusive documents, stored line net is `amountMinor - taxMinor`; for exclusive
14
+ and no-tax pricing it is `amountMinor`. Revenue is grouped by each line's stored
15
+ account, falling back to the caller's revenue account. Component tax uses the
16
+ stored liability account and falls back to `taxAccountId`. A `legacy-*` code that
17
+ needs this fallback returns a structured warning. Provider tax is posted once as
18
+ its own entry to `taxAccountId`. Zero-tax and null-component reporting rows do not
19
+ produce entries.
20
+
21
+ The helper validates every stored reconciliation before returning entries and uses
22
+ exact integer arithmetic for grouping and balance checks. Debit and credit values
23
+ are always positive safe integers; the sign determines the side.
@@ -0,0 +1,48 @@
1
+ # Tax codes
2
+
3
+ `TaxComponent` owns an immutable percent and optional liability account. To
4
+ change a rate, archive the old component, create a replacement and update the
5
+ editable `TaxCode.components` list. Never edit a used component's percent.
6
+
7
+ Every tenant seeds `exempt`, `zero-rated`, `out-of-scope`, and
8
+ `legacy-unreconciled`. Those kinds have no components because they report
9
+ differently. A legacy zero rate means out-of-scope unless the linked customer
10
+ was explicitly exempt; malformed or out-of-range legacy rates stay visible
11
+ through `legacy-unreconciled` and the mapping report.
12
+
13
+ `TaxSettings` owns tenant defaults, tax registrations, default line amount type
14
+ and rounding scope. Cookbook policies adapt the portable settings document;
15
+ they do not replace persisted tax settings. The per-tenant migration marker is
16
+ owned by the money-snapshot migration. Ordinary saves and generated creates
17
+ cannot change it: a new instance whose tenant natural key would upsert over a
18
+ `migrating` or `v2` row is refused rather than resetting that tenant to legacy.
19
+ The ordinary save transaction locks and re-reads the tenant marker before its
20
+ natural-key upsert, serializing that check with migration claim and activation.
21
+ If the tenant has no marker to lock, its first ordinary save is insert-only: a
22
+ concurrent migration that creates the marker wins and the stale save is refused
23
+ instead of adopting and overwriting the migration-owned row.
24
+
25
+ `applyCommerceCookbookSettings(db, tenantId, cookbook)` is the explicit
26
+ server-side activation boundary for core's portable `taxRate`, inclusion, and
27
+ rounding policies. A host calls it after schema setup, once it has the
28
+ authoritative tenant from its authenticated bootstrap flow:
29
+
30
+ ```ts
31
+ import { applyCommerceCookbookSettings } from '@happyvertical/smrt-commerce';
32
+ import cookbook from './smrt.cookbook.json' with { type: 'json' };
33
+
34
+ await applyCommerceCookbookSettings(db, session.tenantId, cookbook);
35
+ ```
36
+
37
+ `smrt cookbook apply` writes project files and does not have a database or
38
+ tenant, so it deliberately performs no storage writes. Activation creates or
39
+ reuses a component and default tax code, then updates tenant `TaxSettings` in
40
+ one transaction. A zero default rate selects `out-of-scope`; inclusion remains
41
+ the cookbook's explicit inclusive/exclusive choice because individual lines can
42
+ still override the default code.
43
+
44
+ `COMMON_TAX_CODE_EXAMPLE_PACK` demonstrates Canada GST, BC GST+PST, Ontario
45
+ HST, UK VAT, Australian GST and New Zealand GST. Import it idempotently with
46
+ `applyTaxCodeExamplePack(db, tenantId)`, then review local applicability and
47
+ assign liability accounts before selecting a code for production documents.
48
+ The pack supplies examples, not jurisdiction determination.
@@ -0,0 +1,126 @@
1
+ # Tax summary aggregation
2
+
3
+ `src/tax-summary.ts` is the pure reporting compiler used before materializing a
4
+ commerce tax summary. Its input is normalized stored facts supplied by owning
5
+ collections; it never reads Invoice, Contract, DocumentTax, Expense, or ledger
6
+ tables itself.
7
+
8
+ Every input carries a tenant identity. The aggregator only accepts that
9
+ requested tenant, an inclusive issue-date period, and issued, non-cancelled
10
+ document facts. Credit notes are Invoice rows with positive stored values, so
11
+ the aggregator applies their negative sign exactly once.
12
+
13
+ Kind-row bases are deduplicated by document type/id, tax code, currency,
14
+ direction, and code kind before component rows are added. Thus a GST+PST code
15
+ contributes its base once to the kind row while component rows retain each
16
+ component's stored taxable base. Document counts are unique document identities,
17
+ never `DocumentTax` row counts. Currency groups never mix. Zero-rated, exempt,
18
+ and out-of-scope bases remain distinct.
19
+
20
+ Expense supplier components require an explicit tenant-approved code to tax
21
+ component mapping. Missing stored facts, unmapped components, and linked
22
+ purchase/expense provenance are warnings. Link matching includes currency and
23
+ treats a commitment header link as overlapping every linked expense line. A
24
+ linked purchase and expense has no reconciled ITC/net total until a per-line
25
+ allocation exists; its facts remain visible for drilldown. Ledger movements are
26
+ raw posted `credit - debit` values. Components without a liability account are
27
+ reported as unassigned. When multiple components share a
28
+ liability account, component-level reconciliation is ambiguous: the compiler
29
+ keeps the rows visible, emits a warning, and does not compare the full account
30
+ movement to every component.
31
+
32
+ ## Materialized document report path
33
+
34
+ `TaxSummaryReport` is a tenant-scoped, manual materialized report. Its owner,
35
+ `TaxSummaryReportCollection.refreshTaxSummary()`, refuses tenants whose
36
+ `TaxSettings.moneyModel` is not `v2`: legacy and migrating documents are not a
37
+ complete stored-tax source. The caller injects the public Expense and Journal
38
+ source adapters because commerce cannot depend on expenses; omitting either
39
+ adapter is a refusal, never a zero-ITC fallback.
40
+
41
+ `DocumentTaxCollection.listReportFacts()` reads stored Invoice, credit-note,
42
+ and purchase-Contract snapshots. The Invoice branch joins `document_taxes` to
43
+ `invoices` on both document id and tenant id, filters inclusive `issueDate`
44
+ bounds, excludes drafts/cancelled invoices, and retains written-off invoices.
45
+ The Contract branch gets a bounded, hydrated candidate set from
46
+ `ContractCollection.listSnapshotReportContracts()`, then uses the Contract
47
+ owner's descendant classifier before joining only those purchase ids to
48
+ `document_taxes` on document id and tenant id. This preserves custom
49
+ `PurchaseContract` descendants without hard-coding contract enums or party
50
+ display names. Contract rows include every non-draft, non-cancelled frozen
51
+ snapshot, including `DECLINED`; their `issueDate`, reference (falling back to
52
+ the id), and vendor party id are read from the frozen Contract. The query only
53
+ returns stored snapshots and never recalculates tax. A nullable tax-code kind
54
+ becomes an unassigned-source warning; it never becomes out-of-scope by
55
+ inference.
56
+
57
+ The existing reports adapter is exposed by
58
+ `buildTaxSummaryReportAdapterDescriptor()`. Its DataTable columns use the
59
+ runtime's snake-case descriptor ids. `drilldownTaxSummaryInvoiceFacts()` takes
60
+ a tenant id supplied by the authenticated host, rechecks the materialized row
61
+ under that tenant, then applies its currency/component/kind dimensions to the
62
+ same Invoice source query. It cannot widen a row into another tenant.
63
+
64
+ The Invoice branch selects the shared Invoice `kind` discriminator and accepts only
65
+ matching `DocumentTax.documentType` pairs: `invoice`/`invoice` or
66
+ `credit_note`/`credit_note`. Credit rows retain positive stored values and pass
67
+ through the aggregation's single credit sign step.
68
+
69
+ Refresh holds the tenant `TaxSettings` parent lock through the v2 gate, all
70
+ source reads, aggregation, and replacement. Every source-adapter call receives
71
+ the same transaction-bound database executor. Replacement rows use a stable
72
+ UUID derived from tenant, period, currency, row kind, and dimension, so retry
73
+ and concurrent same-period refreshes converge to one row set. Materialized
74
+ `list`, `get`, `count`, and Invoice drilldowns all recheck the tenant's marker;
75
+ `legacy` and `migrating` refuse even existing report rows.
76
+
77
+ Each document drilldown fact carries its printed invoice number or Contract
78
+ reference, tenant-scoped customer/vendor party id, issue date, stored taxable
79
+ base, and stored tax. A runtime host may resolve that party id to an authorized
80
+ display name; the commerce source does not cross-join profile data.
81
+
82
+ `drilldownTaxSummaryContributors()` is the cell-level backend boundary. The
83
+ host supplies one of the closed measures (`taxable`, `tax`, `recoverable`,
84
+ `net`, `ledgerMovement`, `difference`, `documentCount`, or a warning detail),
85
+ and the collection rejects measures that do not belong to that row kind. It
86
+ returns only Invoice facts, mapped reviewed Expense facts, and posted Journal
87
+ movements that match the persisted tenant, period, currency, component, code
88
+ kind, or liability account. Net and reconciliation-difference detail carries
89
+ the signed contribution that sums to the selected cell; credit notes are
90
+ signed once here from their stored Invoice kind.
91
+
92
+ Rows persist compact source-class provenance plus an exact warning source
93
+ identity, not a duplicate set of source amounts. A missing injected owner,
94
+ missing historical provenance, or a source total that no longer equals the
95
+ materialized cell returns `complete: false` with a machine-readable pending
96
+ reason. Purchase Contract contributors reconcile their stored recoverable
97
+ amounts directly and retain the Contract id as `commitmentId`, so a reviewed
98
+ expense drawn against that Contract produces the explicit linked-source warning
99
+ instead of being counted twice. A materialized purchase fact missing from its
100
+ source returns `source-state-diverged`, never a zero ITC. The Ledger detail port is adapted from the public
101
+ `JournalEntryCollection.listPostedMovements()` and remains raw ledger units;
102
+ the host must retain the commerce minor-unit convention.
103
+
104
+ ## Authenticated materialized-report host
105
+
106
+ The production template exposes the generic
107
+ `/reports/materialized/[id]` route. Applications register fixed server-only
108
+ hosts in `src/lib/server/materialized-reports.ts`; a commerce application adds
109
+ `createTaxSummaryMaterializedReportHost(async () =>
110
+ (await runtime.getCollection('TaxSummaryReport')).db, { drilldownSources })`.
111
+ `drilldownSources(context)` resolves Expense and Ledger owner ports plus the
112
+ tenant's expense-code mappings for that authenticated request. It must use the
113
+ provided `context.tenantId`; do not capture a fixed source or mapping set from
114
+ another tenant. The browser never
115
+ supplies a tenant, report class, database, or measure. The route binds the
116
+ verified `locals` user, tenant, and permission snapshot, requires
117
+ `taxsummaryreports.read`, and passes only a materialized row id plus a visible
118
+ descriptor column id to the host. The host re-queries that row under the same
119
+ tenant before mapping the column to a closed contributor measure. Unknown rows,
120
+ unsupported columns, and cross-tenant rows do not return contributors.
121
+
122
+ `MaterializedReportTable` lives in `@happyvertical/smrt-reports/svelte`; it
123
+ formats integer money cells with each row's validated currency and renders the
124
+ host's drilldown response. Commerce supplies the data and authorization
125
+ boundary, and does not duplicate a currency formatter or a runtime-report CRUD
126
+ surface.
@@ -0,0 +1,79 @@
1
+ /** Pure projection of frozen commerce money snapshots into accounting SDK inputs. */
2
+ import { type AccountingProvider, type CreditMemoInput, type InvoiceInput, type InvoiceLineItemInput, type SyncResult, type TaxComponentSnapshot } from '@happyvertical/accounting';
3
+ import type { LineAmountType, TaxRoundingScope } from './money.js';
4
+ export type FrozenAccountingDocumentKind = 'invoice' | 'creditMemo';
5
+ /** Realm-specific references are configuration, never inferred from a tax name or rate. */
6
+ export interface FrozenQuickBooksTaxMapping {
7
+ readonly lines: Readonly<Record<string, {
8
+ readonly itemRef: string;
9
+ readonly taxCodeRef: string;
10
+ }>>;
11
+ readonly components: Readonly<Record<string, {
12
+ readonly quickbooksTaxRateRef: string;
13
+ }>>;
14
+ }
15
+ /** Frozen component fact persisted with a line; all values are minor units except percent. */
16
+ export interface FrozenAccountingTaxComponent {
17
+ readonly taxComponentId: string;
18
+ readonly name: string;
19
+ /** Exact percent text: `5` means 5 percent. */
20
+ readonly percent: string;
21
+ readonly taxMinor: number;
22
+ }
23
+ /** A frozen commerce line. `unitPriceMinor` and `discountMinor` are pre-discount document-mode values. */
24
+ export interface FrozenAccountingLineSnapshot {
25
+ readonly id: string;
26
+ readonly description: string;
27
+ readonly sku?: string;
28
+ readonly quantity: number;
29
+ /** Pre-discount unit price: net for exclusive, gross for inclusive. */
30
+ readonly unitPriceMinor: number;
31
+ /** Pre-discount reduction: net for exclusive, gross for inclusive. */
32
+ readonly discountMinor: number;
33
+ /** Persisted post-discount net amount. */
34
+ readonly amountMinor: number;
35
+ readonly taxMinor: number;
36
+ readonly taxComponents: readonly FrozenAccountingTaxComponent[];
37
+ }
38
+ /** Immutable facts required to project one approved document. */
39
+ export interface FrozenAccountingDocumentSnapshot {
40
+ readonly kind: FrozenAccountingDocumentKind;
41
+ readonly id: string;
42
+ readonly number: string;
43
+ readonly customerId: string;
44
+ readonly customerExternalId?: string;
45
+ readonly issueDate: Date;
46
+ readonly dueDate?: Date;
47
+ readonly currency: string;
48
+ readonly lineAmountType: LineAmountType;
49
+ readonly taxRoundingScope: TaxRoundingScope;
50
+ readonly subtotalMinor: number;
51
+ readonly taxAmountMinor: number;
52
+ /** Header-only provider tax has no frozen component and cannot be sent to QBO. */
53
+ readonly providerTaxMinor: number;
54
+ readonly totalAmountMinor: number;
55
+ readonly lineItems: readonly FrozenAccountingLineSnapshot[];
56
+ /** Required only for a positive credit memo. */
57
+ readonly creditedInvoiceExternalId?: string;
58
+ readonly externalId?: string;
59
+ readonly reference?: string;
60
+ readonly memo?: string;
61
+ }
62
+ /** Public SDK types retained as named aliases for commerce callers. */
63
+ export type AccountingTaxComponentInput = TaxComponentSnapshot;
64
+ export type AccountingSnapshotLineInput = InvoiceLineItemInput;
65
+ export type AccountingSnapshotInvoiceInput = InvoiceInput;
66
+ export type AccountingSnapshotCreditMemoInput = CreditMemoInput;
67
+ export type AccountingSnapshotInput = InvoiceInput | CreditMemoInput;
68
+ /**
69
+ * Map and submit a positive credit memo only when the provider exposes that
70
+ * capability. Mapping runs before the provider is touched, so a malformed
71
+ * frozen snapshot cannot trigger a network write.
72
+ */
73
+ export declare function pushFrozenCreditMemo(provider: Pick<AccountingProvider, 'type' | 'creditMemos'>, snapshot: FrozenAccountingDocumentSnapshot, mapping: FrozenQuickBooksTaxMapping): Promise<SyncResult>;
74
+ /**
75
+ * Project an approved frozen snapshot into the companion SDK's request shape.
76
+ * It does not calculate discounts, taxes, rates, or document allocation.
77
+ */
78
+ export declare function mapFrozenAccountingSnapshot(snapshot: FrozenAccountingDocumentSnapshot, mapping: FrozenQuickBooksTaxMapping): AccountingSnapshotInput;
79
+ //# sourceMappingURL=accounting-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounting-snapshot.d.ts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AM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAC/D,MAAM,MAAM,8BAA8B,GAAG,YAAY,CAAC;AAC1D,MAAM,MAAM,iCAAiC,GAAG,eAAe,CAAC;AAChE,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,eAAe,CAAC;AAErE;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,aAAa,CAAC,EAC1D,QAAQ,EAAE,gCAAgC,EAC1C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,UAAU,CAAC,CASrB;AAkKD;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,gCAAgC,EAC1C,OAAO,EAAE,0BAA0B,GAClC,uBAAuB,CA8FzB"}
@@ -24,6 +24,8 @@ import { type BillingProvider, type BillingProviderCheckoutSession } from './pro
24
24
  import { type AutoTopUpFailureHook, type AutoTopUpHookOptions } from './top-up.js';
25
25
  /** Ledger accounts billing posts to, in the seller's books. */
26
26
  export interface BillingLedgerAccounts {
27
+ /** Explicit currency of this ledger book; required for money-v2 posting. */
28
+ bookCurrency?: string;
27
29
  /** Accounts receivable (debited when an invoice is issued). */
28
30
  arAccountId: string;
29
31
  /** Revenue (credited with the invoice subtotal). */
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/billing/runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,aAAa,EAClB,2BAA2B,EAC3B,KAAK,yBAAyB,EAC9B,sBAAsB,EACtB,mBAAmB,EACnB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