@cosmicdrift/kumiko-types 0.238.0 → 0.240.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.238.0",
3
+ "version": "0.240.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>",
@@ -1,4 +1,5 @@
1
1
  import type { CursorResult } from "./cursor-types";
2
+ import type { EntityDefinition } from "./fields";
2
3
  import type { SessionUser, WriteResult } from "./handlers";
3
4
  import type { DeleteContext, SaveContext } from "./hooks";
4
5
  import type { EntityId } from "./identifiers";
@@ -93,6 +94,21 @@ export type EventStoreExecutor = {
93
94
  // — includeDeleted only relaxes the soft-delete predicate, never the
94
95
  // visibility ones, so it can ride untrusted query input safely.
95
96
  readonly includeDeleted?: boolean;
97
+ // fw#2660 — a text search also matches `searchable: true` reference
98
+ // fields (and the implicit tenantId→tenant.name row-meta reference) by
99
+ // their target row's labelField, not just the raw FK column. Only
100
+ // available at request time (registry access), so it rides the same
101
+ // runtime-override extension point as searchAdapter. `fields` and
102
+ // `resolveEntity` travel together — one without the other silently
103
+ // no-ops, so they're grouped instead of two independent optionals.
104
+ readonly referenceSearch?: {
105
+ readonly fields: ReadonlyArray<{
106
+ readonly fieldName: string;
107
+ readonly targetEntityName: string;
108
+ readonly labelField: string;
109
+ }>;
110
+ readonly resolveEntity: (entityName: string) => EntityDefinition | undefined;
111
+ };
96
112
  },
97
113
  ) => Promise<CursorResult<Record<string, unknown>>>;
98
114
 
package/src/feature.ts CHANGED
@@ -883,7 +883,11 @@ export type Registry = {
883
883
  getSearchableFields(entityName: string): readonly string[];
884
884
  getSortableFields(entityName: string): readonly string[];
885
885
  getRelations(entityName: string): EntityRelations;
886
- getSearchIncludes(entityName: string): ReadonlyMap<string, readonly string[]>;
886
+ getSearchableReferences(entityName: string): ReadonlyArray<{
887
+ fieldName: string;
888
+ targetEntityName: string;
889
+ labelField: string;
890
+ }>;
887
891
  getIncomingRelations(entityName: string): ReadonlyArray<{
888
892
  sourceEntity: string;
889
893
  relationName: string;
package/src/fields.ts CHANGED
@@ -471,6 +471,12 @@ export type ReferenceFieldDef = {
471
471
  * statt single UUID. Storage als jsonb-Array<uuid>. UI rendert
472
472
  * Multi-Select-Combobox mit Tag-Anzeige der gewählten Items. */
473
473
  readonly multiple?: boolean;
474
+ /** Include a row in this entity's result set on a text-search hit against
475
+ * the referenced entity's `labelField`, instead of only matching the UUID
476
+ * column itself (fw#2660). Requires an explicit `labelField` — the boot
477
+ * validator rejects it otherwise, since the default "id" is a UUID column
478
+ * and ILIKE against it would crash at runtime. */
479
+ readonly searchable?: true;
474
480
  } & ResolvedPiiFlags;
475
481
 
476
482
  // --- Currency ---
package/src/relations.ts CHANGED
@@ -9,7 +9,6 @@ export type BelongsToRelation = {
9
9
  readonly type: "belongsTo";
10
10
  readonly target: string;
11
11
  readonly foreignKey: string;
12
- readonly searchInclude?: readonly string[];
13
12
  // onDelete is declared on the parent-side (hasMany / manyToMany) because
14
13
  // that's where the "what happens to my children?" decision lives. A
15
14
  // belongsTo node just points at a parent — the parent's onDelete drives
@@ -45,7 +44,6 @@ export type ManyToManyRelation = {
45
44
  readonly sourceKey: string;
46
45
  readonly targetKey: string;
47
46
  };
48
- readonly searchInclude?: readonly string[];
49
47
  readonly onDelete?: OnDeleteStrategy;
50
48
  };
51
49
 
package/src/screen.ts CHANGED
@@ -697,7 +697,11 @@ export type EditFieldSpec =
697
697
  // id, so a bundled feature (e.g. custom-fields) can load and persist its
698
698
  // own data inside the form. `relatedList` runs its own query instead —
699
699
  // see `EditRelatedListSection`.
700
- export type EditSectionSpec = EditFieldsSection | EditExtensionSection | EditRelatedListSection;
700
+ export type EditSectionSpec =
701
+ | EditFieldsSection
702
+ | EditExtensionSection
703
+ | EditRelatedListSection
704
+ | EditWriteFormSection;
701
705
 
702
706
  export type EditFieldsSection = {
703
707
  /** Kebab-case tab id, used as the `?tab=` value. Required by the
@@ -766,6 +770,50 @@ export type EditRelatedListSection = {
766
770
  * is named here. `idColumn` names the row key holding that id (default
767
771
  * "id"). Omit `rowClick` for a non-interactive list. */
768
772
  readonly rowClick?: { readonly entity: string; readonly idColumn?: string };
773
+ /** Per-row actions — same type and dispatch semantics as `entityList`/
774
+ * `projectionList`'s `rowActions` (writeHandler dispatch with a
775
+ * declarative `payload` extractor, or navigate). A successful
776
+ * writeHandler action re-runs this section's own query, same as a
777
+ * projectionList row action re-running its list query. */
778
+ readonly rowActions?: readonly RowAction[];
779
+ };
780
+
781
+ // A declarative, self-persisting form section for `projectionDetail`
782
+ // (fw editable-detail-screens). Unlike the plain `fields` section — which
783
+ // projectionDetail forces read-only, see the type's own doc — this section's
784
+ // fields ARE editable and submit through their own write-handler, entirely
785
+ // independent of the (nonexistent) outer form submit. Modeled on
786
+ // `ActionFormScreenDefinition`: `fieldDefs` carries the field-type map (a
787
+ // projectionDetail's synthesized display entity has no real field types to
788
+ // draw on), `fields` the rendered order/overrides, same as
789
+ // `EditFieldsSection.fields`. Only supported on projectionDetail — the
790
+ // boot-validator rejects it on entityEdit/configEdit/actionForm, same as
791
+ // `relatedList`.
792
+ export type EditWriteFormSection = {
793
+ /** Kebab-case tab id, used as the `?tab=` value. Required by the
794
+ * boot-validator when the enclosing `EditLayout.mode` is "tabs". */
795
+ readonly id?: string;
796
+ readonly kind: "writeForm";
797
+ readonly title?: string;
798
+ readonly description?: string;
799
+ readonly columns?: number;
800
+ readonly icon?: IconKey;
801
+ /** Field-type map for this section's own form — same shape as
802
+ * `ActionFormScreenDefinition.fields`. */
803
+ readonly fieldDefs: Readonly<Record<string, FieldDefinition>>;
804
+ /** Rendered fields, in order — same shape as `EditFieldsSection.fields`.
805
+ * Every referenced field must have an entry in `fieldDefs`. */
806
+ readonly fields: readonly EditFieldSpec[];
807
+ /** Write-handler QN dispatched on submit. The submitted values (not a
808
+ * diff) land 1:1 as payload, same as `ActionFormScreenDefinition.handler`.
809
+ * The payload carries only this section's own fields — no parent/record
810
+ * id is injected automatically. To thread the host record's id through,
811
+ * declare it in `fieldDefs` with `visible: false` on its `fields` entry:
812
+ * it gets prefilled from the loaded record like any other field and rides
813
+ * along in the submit payload without being shown in the form. */
814
+ readonly handler: string;
815
+ /** i18n-key for the submit button. Default: "kumiko.actions.save". */
816
+ readonly submitLabel?: string;
769
817
  };
770
818
 
771
819
  // Max width of the form container (see FormScreenShell in renderer-web).