@cosmicdrift/kumiko-types 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 +1 -1
- package/src/fields.ts +30 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.181.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
|
@@ -383,19 +383,47 @@ export type DefaultCurrency =
|
|
|
383
383
|
|
|
384
384
|
// --- Embedded Object ---
|
|
385
385
|
|
|
386
|
-
|
|
387
|
-
readonly type: "text" | "number" | "boolean" | "date";
|
|
386
|
+
type EmbeddedSubFieldBase = {
|
|
388
387
|
readonly required?: boolean;
|
|
389
388
|
readonly searchable?: boolean;
|
|
390
389
|
readonly access?: FieldAccess;
|
|
391
390
|
};
|
|
392
391
|
|
|
392
|
+
/** `money` is a signed integer amount in minor units (cents); which currency
|
|
393
|
+
* it means is defined by the owning aggregate (a head-level field or tenant
|
|
394
|
+
* config), not per row. Unlike the top-level `money` field (BIGINT + currency
|
|
395
|
+
* column) the value lives in jsonb, so it must stay within ±(2^53 − 1).
|
|
396
|
+
*
|
|
397
|
+
* `decimal` bounds a JSON number to `scale` fractional digits (0–15). `scale`
|
|
398
|
+
* is required — no silent default that could truncate — and there is no
|
|
399
|
+
* `precision`: jsonb has no numeric column behind it whose width `precision`
|
|
400
|
+
* could describe. */
|
|
401
|
+
export type EmbeddedSubFieldDef =
|
|
402
|
+
| (EmbeddedSubFieldBase & {
|
|
403
|
+
readonly type: "text" | "number" | "boolean" | "date" | "money";
|
|
404
|
+
})
|
|
405
|
+
| (EmbeddedSubFieldBase & {
|
|
406
|
+
readonly type: "decimal";
|
|
407
|
+
readonly scale: number;
|
|
408
|
+
});
|
|
409
|
+
|
|
393
410
|
export type EmbeddedFieldDef = {
|
|
394
411
|
readonly type: "embedded";
|
|
395
412
|
readonly required?: boolean;
|
|
396
413
|
readonly sensitive?: boolean;
|
|
397
414
|
readonly schema: Readonly<Record<string, EmbeddedSubFieldDef>>;
|
|
398
415
|
readonly access?: FieldAccess;
|
|
416
|
+
/** A list of like-shaped objects instead of exactly one: the value is an
|
|
417
|
+
* array and every element is validated against `schema`. Storage stays
|
|
418
|
+
* jsonb, the column default becomes `[]` instead of `{}`. Built via
|
|
419
|
+
* `createEmbeddedListField()`.
|
|
420
|
+
*
|
|
421
|
+
* Only for rows that come into being with their head and stay immutable
|
|
422
|
+
* with it (posting lines, invoice positions). A row with its own lifetime
|
|
423
|
+
* (own from/to dates, own history) belongs in its own entity referencing
|
|
424
|
+
* the head — an embedded array is rewritten whole on every change and has
|
|
425
|
+
* no per-row history. */
|
|
426
|
+
readonly multiple?: boolean;
|
|
399
427
|
} & PiiAnnotations;
|
|
400
428
|
|
|
401
429
|
// Free-form jsonb — keys/shape NOT validated at write-time. Use for:
|