@cosmicdrift/kumiko-bundled-features 0.180.0 → 0.181.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.180.0",
3
+ "version": "0.181.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -121,12 +121,12 @@
121
121
  "./step-dispatcher": "./src/step-dispatcher/index.ts"
122
122
  },
123
123
  "dependencies": {
124
- "@cosmicdrift/kumiko-dispatcher-live": "0.180.0",
125
- "@cosmicdrift/kumiko-framework": "0.180.0",
126
- "@cosmicdrift/kumiko-headless": "0.180.0",
127
- "@cosmicdrift/kumiko-renderer": "0.180.0",
128
- "@cosmicdrift/kumiko-renderer-web": "0.180.0",
129
- "@cosmicdrift/kumiko-types": "0.180.0",
124
+ "@cosmicdrift/kumiko-dispatcher-live": "0.181.0",
125
+ "@cosmicdrift/kumiko-framework": "0.181.0",
126
+ "@cosmicdrift/kumiko-headless": "0.181.0",
127
+ "@cosmicdrift/kumiko-renderer": "0.181.0",
128
+ "@cosmicdrift/kumiko-renderer-web": "0.181.0",
129
+ "@cosmicdrift/kumiko-types": "0.181.0",
130
130
  "@mollie/api-client": "^4.5.0",
131
131
  "imapflow": "^1.3.3",
132
132
  "mailparser": "^3.9.8",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createDateField,
3
+ createEmbeddedListField,
3
4
  createEntity,
4
- createJsonbField,
5
5
  createNumberField,
6
6
  createSelectField,
7
7
  createTextField,
@@ -27,7 +27,7 @@ export const accountEntity = createEntity({
27
27
  });
28
28
 
29
29
  // transaction — a journal entry. The balanced posting lines live embedded as
30
- // `lines` (jsonb: { accountId, amount }[], Σ amount = 0), so an entry is atomic:
30
+ // `lines` (embedded list: { accountId, amount }[], Σ amount = 0), so an entry is atomic:
31
31
  // the Σ=0 invariant holds within a single command, no cross-row write. The
32
32
  // framework projects `read_ledger_transactions`; Phase 1 adds a flat
33
33
  // `read_ledger_postings` projection (one row per line) for per-account/period
@@ -50,7 +50,19 @@ export const transactionEntity = createEntity({
50
50
  // For a Storno entry this points at the reversed transaction's id.
51
51
  reference: createTextField({ maxLength: 120 }),
52
52
  status: createSelectField({ options: TRANSACTION_STATUS, required: true }),
53
- lines: createJsonbField(),
53
+ // Posting lines are born with the entry and never change on their own —
54
+ // a correction is a new (reversing) entry. The embedded list validates
55
+ // each line's shape; `money` pins amount to signed integer minor units
56
+ // (the entry's currency is a book-level concern, not per line). The
57
+ // cross-line invariants (Σ=0, ≥2 distinct accounts) stay in
58
+ // createTransactionPayloadSchema.
59
+ lines: createEmbeddedListField(
60
+ {
61
+ accountId: { type: "text", required: true },
62
+ amount: { type: "money", required: true },
63
+ },
64
+ { required: true },
65
+ ),
54
66
  },
55
67
  });
56
68