@cosmicdrift/kumiko-types 0.186.2 → 0.187.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/fields.ts +9 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.186.2",
3
+ "version": "0.187.0",
4
4
  "description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
package/src/fields.ts CHANGED
@@ -417,9 +417,10 @@ export type EmbeddedSubFieldDef =
417
417
  });
418
418
 
419
419
  /** A cell computed from other cells of the same row. `from` names the
420
- * sub-fields the operation reads (order matters for `subtract`). Purely
421
- * renderer metadata — the derived value is still validated like any other
422
- * value of its declared sub-field type in `schema`. */
420
+ * sub-fields the operation reads (order matters for `subtract`). Renderer
421
+ * metadata — the derived value is rounded server- and client-side to the
422
+ * precision its target sub-field in `schema` declares (money → integer,
423
+ * decimal → `scale`) before it's validated. */
423
424
  export type EmbeddedDerivedCellDef = {
424
425
  readonly op: "multiply" | "sum" | "subtract";
425
426
  readonly from: readonly string[];
@@ -447,7 +448,8 @@ export type EmbeddedFieldDef = {
447
448
  /** Maximum row count for an embedded list. Only valid with `multiple: true`. */
448
449
  readonly maxItems?: number;
449
450
  /** Renderer metadata: sub-field name → how to compute its cell from other
450
- * sub-fields of the same row. Only valid with `multiple: true`. */
451
+ * sub-fields of the same row, rounded to that sub-field's declared
452
+ * precision. Only valid with `multiple: true`. */
451
453
  readonly derived?: Readonly<Record<string, EmbeddedDerivedCellDef>>;
452
454
  /** Renderer metadata: numeric sub-field names to sum in a totals row. Only
453
455
  * valid with `multiple: true`. */
@@ -455,7 +457,9 @@ export type EmbeddedFieldDef = {
455
457
  /** Maps an embedded-list subfield name to a sibling top-level money field
456
458
  * name — the sum of that subfield across all rows must equal the sibling
457
459
  * field's amount. Validated both client- and server-side (schema-builder
458
- * superRefine). Only meaningful with `multiple: true`. */
460
+ * superRefine). Only meaningful with `multiple: true`. Compares against
461
+ * rounded `derived` cells, i.e. "sum-of-rounded" not "round-of-sum" —
462
+ * see kumiko-framework#1866. */
459
463
  readonly totalsMatch?: Readonly<Record<string, string>>;
460
464
  } & PiiAnnotations;
461
465