@cosmicdrift/kumiko-types 0.377.0 → 0.378.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/dist/config.d.ts CHANGED
@@ -219,7 +219,10 @@ export type TemplateListVariableDef = TemplateVariableCommon & {
219
219
  readonly item: Readonly<Record<string, TemplateScalarVariableDef>>;
220
220
  readonly example?: readonly Readonly<Record<string, unknown>>[];
221
221
  };
222
- export type TemplateVariableDef = TemplateScalarVariableDef | TemplateListVariableDef;
222
+ export type TemplateImagesVariableDef = TemplateVariableCommon & {
223
+ readonly type: "images";
224
+ };
225
+ export type TemplateVariableDef = TemplateScalarVariableDef | TemplateListVariableDef | TemplateImagesVariableDef;
223
226
  export type TemplateVariables = Readonly<Record<string, TemplateVariableDef>>;
224
227
  export type NotificationTemplateMeta = {
225
228
  readonly subject: string;
package/dist/fields.d.ts CHANGED
@@ -489,7 +489,8 @@ export type EmbeddedSubFieldDef = (EmbeddedSubFieldBase & {
489
489
  * precision its target sub-field in `schema` declares (money → integer,
490
490
  * decimal → `scale`) before it's validated. */
491
491
  export type EmbeddedDerivedCellDef = {
492
- readonly op: "multiply" | "sum" | "subtract";
492
+ /** `percent` = `from[0] * from[1] / 100` (exactly two sources, e.g. amount and rate). */
493
+ readonly op: "multiply" | "sum" | "subtract" | "percent";
493
494
  readonly from: readonly string[];
494
495
  };
495
496
  export type EmbeddedFieldDef = {
package/dist/screen.d.ts CHANGED
@@ -63,8 +63,9 @@ export interface FieldFormatRegistry {
63
63
  image: {
64
64
  readonly variant?: string;
65
65
  };
66
- /** List cell: FileRef id (or id array) as a download link with the file name.
67
- * Outside list cells the raw value is shown. */
66
+ /** FileRef id (or id array) as a download link with the file name. On a
67
+ * read-only detail field it renders a file list with download links and an
68
+ * inline preview for PDFs; elsewhere the raw value is shown. */
68
69
  file: object;
69
70
  }
70
71
  export type FormatSpec = {
@@ -1522,6 +1523,21 @@ export type EntityEditActionPlacement = "inline" | "menu";
1522
1523
  export type EntityEditAction = RowAction & {
1523
1524
  readonly placement?: EntityEditActionPlacement;
1524
1525
  };
1526
+ /** A form field computed from other fields of the same form. `listSum` adds one
1527
+ * numeric cell over all rows of an embedded list field; its `whenEmpty`
1528
+ * fallback applies while the list has no rows (it must not be a `listSum`). */
1529
+ export type FormFieldDerivation = {
1530
+ readonly op: "sum" | "subtract" | "multiply" | "percent";
1531
+ readonly from: readonly string[];
1532
+ } | {
1533
+ readonly op: "listSum";
1534
+ readonly list: string;
1535
+ readonly cell: string;
1536
+ readonly whenEmpty?: FormFieldDerivationWithoutList;
1537
+ };
1538
+ export type FormFieldDerivationWithoutList = Extract<FormFieldDerivation, {
1539
+ from: unknown;
1540
+ }>;
1525
1541
  export type ActionFormScreenDefinition = {
1526
1542
  readonly id: string;
1527
1543
  readonly type: "actionForm";
@@ -1560,6 +1576,13 @@ export type ActionFormScreenDefinition = {
1560
1576
  * A `money` field here must name its own currency source: this screen
1561
1577
  * has no entity whose `defaultCurrency` it could inherit (fw#2839). */
1562
1578
  readonly fields: Readonly<Record<string, FormFieldDefinition>>;
1579
+ /** Fields computed from other fields, shown read-only and recomputed on every
1580
+ * change. A `listSum` over an empty list without `whenEmpty` leaves the field
1581
+ * a normal input, and then the client value counts. Otherwise the client value
1582
+ * is never trusted: the handler must wrap its schema with
1583
+ * `withFormDerivations(schema, screen)`, which the boot validator enforces.
1584
+ * A field read only as `whenEmpty` operand is read-only while every such list has rows. */
1585
+ readonly derive?: Readonly<Record<string, FormFieldDerivation>>;
1563
1586
  /** Layout analog zu EntityEditScreen: sections mit fields aus dem
1564
1587
  * fields-Map oben. */
1565
1588
  readonly layout: EditLayout;
@@ -46,6 +46,11 @@ export type TenantDb = {
46
46
  selectMany<T = Record<string, unknown>>(table: SchemaTable | EntityTableMeta, where?: WhereObject, options?: SelectOptions): Promise<readonly T[]>;
47
47
  fetchOne<T = Record<string, unknown>>(table: SchemaTable | EntityTableMeta, where: WhereObject): Promise<T | undefined>;
48
48
  count(table: SchemaTable | EntityTableMeta, where?: WhereObject): Promise<number>;
49
+ /**
50
+ * Transaction-scoped advisory lock keyed on (namespace, this handle's tenantId + key); released at
51
+ * commit or rollback. Keys of different tenants never contend. Only serialises inside a transaction.
52
+ */
53
+ advisoryXactLock(namespace: number, key: string): Promise<void>;
49
54
  aggregate(table: SchemaTable | EntityTableMeta, spec: AggregateSpec, where?: WhereObject): Promise<readonly AggregateRow[]>;
50
55
  insertOne<T = Record<string, unknown>>(table: WritableTable, values: Record<string, unknown>): Promise<T | undefined>;
51
56
  updateMany<T = Record<string, unknown>>(table: WritableTable, set: Record<string, unknown>, where: WhereObject): Promise<readonly T[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.377.0",
3
+ "version": "0.378.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>",