@cosmicdrift/kumiko-types 0.180.0 → 0.182.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-types",
3
- "version": "0.180.0",
3
+ "version": "0.182.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
- export type EmbeddedSubFieldDef = {
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:
package/src/nav.ts CHANGED
@@ -97,6 +97,18 @@ export type ContentCollectionDefinition = {
97
97
  // snippets an admin curates). "user": every user keeps their own (mail
98
98
  // signatures). Defaults to "tenant".
99
99
  readonly ownership?: "tenant" | "user";
100
+ // Which editor the client renders for this collection's entries — not how
101
+ // the content is stored. "rich" still stores HTML, because mail and PDF
102
+ // rendering want HTML either way. "markdown" stores markdown text, not
103
+ // HTML. Defaults to "plain" (textarea).
104
+ readonly contentFormat?: "plain" | "rich" | "markdown";
105
+ // Fixed variable names the collection's editor offers as insertable chips
106
+ // (e.g. `{ customerName: {}, orderId: {} }` for an ai-prompt collection).
107
+ // Declared once per collection, not per entry — a collection-set write
108
+ // always persists an entry's own `variableSchema` as `{}` (collections
109
+ // never let a user redefine the variable set), so this is the only place
110
+ // the client can learn which variables exist.
111
+ readonly variableSchema?: Record<string, unknown>;
100
112
  readonly nav: {
101
113
  readonly label: string;
102
114
  readonly icon?: string;