This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathcomplex.ts
More file actions
2452 lines (2408 loc) · 113 KB
/
Copy pathcomplex.ts
File metadata and controls
2452 lines (2408 loc) · 113 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @object-ui/types - Complex Component Schemas
*
* Type definitions for advanced/composite components.
*
* @module complex
* @packageDocumentation
*/
import type {
DashboardWidget as SpecDashboardWidget,
GlobalFilter as SpecGlobalFilter,
Dashboard as SpecDashboard,
ViewFilterOperator as SpecViewFilterOperator,
} from '@objectstack/spec/ui';
import type { BaseSchema, SchemaNode } from './base.js';
import type { DASHBOARD_SPEC_EXCLUDED } from './zod/complex.zod.js';
// `GroupingConfig`, `KanbanConditionalFormattingRule` and `ViewNavigationConfig`
// were imported for `KanbanSchema`'s `grouping`, `conditionalFormatting` and
// `navigation` members and had no other reader in this module; they left with
// the retired `'kanban'` arm (objectui#8802). All three are still declared and
// still exported from their own modules.
/**
* Kanban card — the shape the registered `'kanban'` renderer reads.
*
* ## Why this dialect lives here (objectui#7664, maintainer ruling (a), 2026-09-05)
*
* `@object-ui/types` used to declare a DIFFERENT board under the same
* `'kanban'` key — the `DeclarativeKanban*` trio (`columns` with `color`,
* `draggable`, cards with `labels` / `assignees` / `priority`), which was the
* `'kanban'` arm of `ComplexSchema` → `AnyComponentSchema` → `safeValidateSchema`
* — while the renderer registered for that key (`ObjectKanbanRenderer` in
* `@object-ui/plugin-kanban`) consumed the plugin's own `KanbanSchema`. A board
* could pass `objectui validate` and render EMPTY, because the validator and the
* renderer honoured two unrelated faces (objectui#6086 measured the consequence).
*
* The ruling: for an authored `type: 'kanban'` document the PLUGIN dialect is
* authoritative, so this package declares exactly that dialect and
* `@object-ui/plugin-kanban` imports it back rather than declaring its own
* (`packages/plugin-kanban/src/types.ts` re-exports these names — one
* declaration, one authority, the dependency direction unchanged: `types`
* declares, the plugin conforms). The declarative trio and its three Zod
* mirrors are retired in the same change (ADR-0049 enforce-or-remove): its only
* retained value was the validator arm, and that arm now validates this shape.
* objectui#6172's "keep both faces" half is what this reverses; the ruling says
* so explicitly.
*
* Every member below was carried from the plugin's declaration verbatim. The
* runtime-computed members (`cardSubtitle`, `cardFieldCells`, `coverImage`,
* a badge's `colorStyle`) are what `ObjectKanban` writes onto the cards it
* hands the board and what `KanbanImpl` / `KanbanEnhanced` read back; the Zod
* mirror (`zod/complex.zod.ts`) passes those through the way it passes
* `TableColumn.headerIcon` through (objectui#6424).
*
* `React.CSSProperties` / `React.ReactNode` resolve through the ambient
* namespace, the way `data-display.ts` already spells `headerIcon` and
* `rowStyle` — this package still declares no React dependency.
*/
export interface KanbanCard {
id: string;
title: string;
description?: string;
badges?: Array<{
label: string;
variant?: "default" | "secondary" | "destructive" | "outline";
/**
* Optional Tailwind class string applied to the badge. When set, it
* overrides `variant` so callers can reuse the same colors as list/grid
* cells.
*
* Derive it the way the grid cell derives it, or the same option renders
* two colours on one screen (objectui#5183): prefer
* `getBadgeHexAppearance(color)` from `@object-ui/fields` and use its
* `className` — passing its `colorStyle` too — and fall back to
* `getBadgeColorClasses(color, value)` only when it returns `undefined`.
*/
colorClass?: string;
/**
* Inline style accompanying `colorClass`. **Required whenever the class
* string came from `getBadgeHexAppearance`** — that className reads CSS
* custom properties which only this style declares, so a badge carrying
* the class without the style references undefined variables. Pass the
* helper's `style` verbatim; leave unset on the palette-family path.
*/
colorStyle?: React.CSSProperties;
}>;
/**
* Synthesized card subtitle (e.g. "Account: Acme · Amount: $150K"). Rendered
* in preference to `description` so we don't have to overwrite the record's
* real `description` field — which would corrupt detail-view and edit-form
* displays once a card is opened.
*
* Read by `KanbanImpl`; absent on a board that renders plain descriptions.
*/
cardSubtitle?: string;
/**
* Structured per-field cells. When provided, the card body renders each
* field via the unified `@object-ui/fields` cell-renderer pipeline (same
* as Grid/Gallery), so lookup/user/email/url/phone/boolean/etc. fields
* keep their semantic styling instead of being flattened to a text join.
*
* Takes precedence over `cardSubtitle` / `description` when present.
*/
cardFieldCells?: Array<{ field: string; label?: string; node: React.ReactNode }>;
/**
* Resolved cover-image URL for the card, derived from the board's
* `coverImageField`. Read by both board implementations.
*/
coverImage?: string;
[key: string]: any;
}
/**
* Kanban column — a lane of the registered `'kanban'` renderer.
*/
export interface KanbanColumn {
id: string;
title: string;
/**
* Cards in this column.
*
* Named `cards` because that is what every board reads and every authored
* document writes: `KanbanImpl` (12 lines), `KanbanEnhanced` (8) and
* `bucketCardsIntoColumns` all read `column.cards`, and the two catalog
* entries, the plugin docs and `content/docs/api/schema-reference.md` all
* author it. The retired declarative face spelled this `items` until
* objectui#6939 — a spelling with zero read sites, which made every authored
* board fail `safeValidateSchema` while rendering correctly (objectui#6318's
* bucket).
*/
cards: KanbanCard[];
/**
* WIP limit — the card count at which the lane warns. Never reaches the
* query; the board's fetch window is `ObjectKanbanSchema.limit`
* (`./objectql.ts`) — the `kanban` arm that used to declare it retired with
* the node key (objectui#8802).
*/
limit?: number;
className?: string;
/**
* Whether the lane renders collapsed: narrowed to a title spine, its cards
* withheld, and its heading a disclosure the viewer can open again.
*
* The AUTHORED value is the lane's initial state only — once a viewer toggles
* the lane, their decision holds for that session, including across the data
* refreshes that rebuild these lane objects. Reading it as a locked state
* would make a lane's cards permanently unreachable and its drop target
* blind.
*
* Honoured by the registered board (`@object-ui/plugin-kanban`'s `KanbanImpl`,
* on BOTH of its layouts — the flat lane and each row of the swimlane grid)
* since objectui#9628, and by `KanbanEnhanced` before it. Until that card the
* key was declared on both published faces and read only by `KanbanEnhanced`,
* which no production source imports — so an authored value parsed green and
* reached nothing.
*/
collapsed?: boolean;
/**
* RETIRED with the declarative face (objectui#7664, ADR-0049) — `color` was a
* `DeclarativeKanbanColumn` member, and no registered board reads a column
* colour (measured: zero `column.color` read sites across `KanbanImpl`,
* `KanbanEnhanced`, `ObjectKanban`).
*
* A tombstone rather than a plain removal on BOTH prongs of the
* discriminator the precedent changesets state (objectui#5941, #7526), in
* the form objectui#7678 amended it to: a `?: never` tombstone is available
* only on a SURVIVING CARRIER — `KanbanColumn` survives this retirement,
* while a whole exported type name has no carrier and is removed outright —
* and on such a carrier it is used when either prong holds: (1) it steers
* authors to a named live replacement KEY, or (2) it keeps loud a key the
* docs taught as working. Both hold here:
*
* - prong 1: `className` is that live replacement — style a lane through
* it;
* - prong 2: `content/docs/api/schema-reference.md` taught this key as
* working. Before this card its kanban example authored a `color` on
* every one of its three columns (`"color": "#6366f1"` and two more) and
* its `columns` row read "each with `id`, `title`, `color`, and `cards`".
*
* ⚠️ The hazard prong 2 guards here is a SILENT STRIP, not a silent keep:
* `KanbanColumn` does not extend {@link BaseSchema}, so its mirror is a plain
* (non-passthrough) object. Measured on the built mirror: an undeclared
* column key is accepted and dropped from the parsed output, while this
* tombstone refuses `color` by name. A board that has always authored lane
* colours therefore gets told, instead of quietly losing them.
* @deprecated Not part of this contract — the value was inert.
*/
color?: never;
}
/**
* ⛔ `KanbanSchema` — the `'kanban'` arm — is RETIRED (objectui#8802,
* maintainer ruling 2026-09-09: 「从我们的业务需求角度,我应该只需要
* `object-kanban`」, recorded verbatim and not translated).
*
* ## What this dissolves
*
* The bare `kanban` node type key published TWO faces with OPPOSITE verdicts on
* the same document: `@object-ui/plugin-kanban`'s registry `inputs` declared
* `titleField` while this arm refused it by name after batch #70
* (objectui#7742). With the key retired there is no arm left to disagree with,
* so objectui#8802's four options are moot rather than chosen between.
*
* ## Where the vocabulary went
*
* ⛔ Nowhere, and that is the point: `object-kanban` has ALWAYS had its own
* declared face, {@link ObjectKanbanSchema} (`./objectql.ts`), and an
* `object-kanban` document has always been judged by it alone. Retiring this
* arm therefore changes the verdict on `type: 'kanban'` documents only. The
* keys this arm alone declared — `columns`, `cardTitle`, `swimlaneField`,
* `grouping`, `conditionalFormatting`, `navigation` — were never part of the
* `object-kanban` face and are not being removed from it.
*
* ## ⚠️ Why the Zod mirror is a NAMED REFUSAL and not a deletion
*
* {@link BaseSchema} closes with `[key: string]: any` and its Zod twin ends
* `.passthrough()`. A dropped MEMBER key is therefore KEPT, not refused — the
* failure objectui#7664's own first cut shipped at `onCardClick`. A dropped
* TYPE LITERAL behaves differently on a DISCRIMINATED union (`AnyComponentSchema`
* selects one arm from the authored literal), so removal alone would already
* refuse — but only with the union's generic `Invalid input`, naming no remedy.
* ⇒ `zod/complex.zod.ts` keeps an arm for the literal and refuses it BY NAME
* through `retiredNodeType()`, pointing the author at `object-kanban`.
*
* The TypeScript half of the refusal is this deletion: with no `kanban` arm in
* {@link ComplexSchema} and no `'kanban'` entry in `SchemaRegistry`, `tsc`
* refuses the literal at the authoring site.
*
* ## ⛔ The layer that did NOT move
*
* `kanban` also names a STORED `NamedListView.type` (`./objectql.ts`) — the
* value `CreateViewDialog` writes and every tenant's database holds. It is
* UNTOUCHED. `plugin-view`'s `ObjectView` maps a stored `kanban` view onto the
* node type `object-kanban` already, as it does for all twelve stored view
* types, so every board any user ever created through the console already
* renders through the surviving spelling and this retirement moves zero stored
* documents.
*
* {@link KanbanCard}, {@link KanbanColumn}, {@link CardTemplate} and
* {@link ColumnWidthConfig} are NOT retired — the renderer and the
* `CardTemplates` component still consume the first three. The one
* `plugin-kanban` reader of {@link ColumnWidthConfig} was removed by
* objectui#8522, whose ruling did not reach the type itself.
*
* Pinned in `./__tests__/bare-kanban-node-key-retired-8802.test.ts`.
*/
/**
* A predefined card template with pre-filled field values.
*/
export interface CardTemplate {
/** Unique template identifier */
id: string;
/** Human-readable template name */
name: string;
/** Optional Lucide icon name */
icon?: string;
/** Pre-filled field values */
values: Record<string, any>;
}
/**
* Configuration for custom column widths.
*/
export interface ColumnWidthConfig {
/** Default column width in pixels */
defaultWidth?: number;
/** Minimum column width in pixels */
minWidth?: number;
/** Maximum column width in pixels */
maxWidth?: number;
/** Per-column width overrides keyed by column ID */
overrides?: Record<string, number>;
}
/**
* Calendar view mode — the registered `calendar-view` renderer's rendered set.
*
* `'agenda'` was retired from this union (objectui#5740): no view ever
* rendered it — the renderer resolved it to the `'month'` default — and no
* measured app authors it (ADR-0049 enforce-or-remove, the value-level
* residue of objectui#5667's key-level convergence).
*/
export type CalendarViewMode = 'month' | 'week' | 'day';
/**
* Calendar event
*/
export interface CalendarEvent {
/**
* Unique event identifier
*/
id: string;
/**
* Event title
*/
title: string;
/**
* Event description
*/
description?: string;
/**
* Event start date/time
*/
start: string | Date;
/**
* Event end date/time
*/
end: string | Date;
/**
* Whether event is all day
*/
allDay?: boolean;
/**
* Event color
*/
color?: string;
/**
* Additional event data
*/
data?: any;
}
/**
* Calendar view component.
*
* The authored surface of the registered `calendar-view` renderer, converged
* on the renderer's measured read set (objectui#5667): the calendar's events
* are COMPUTED from the node's `data` array plus the five field-name keys
* below — there is no authorable `events` key. An authored `events` is dropped
* by design (objectui#4433); this repo's action metadata rides
* `properties.action`, not a calendar prop.
*
* Nine formerly declared keys — `events` (the interface's only required key
* besides `type`, and the one the renderer refuses), `defaultView`,
* `defaultDate`, `date`, `views`, `editable`, `onEventCreate`,
* `onEventUpdate`, `onDateChange` — are RETIRED rather than implemented:
* none had a read site on the authored-node path, and no measured app authors
* any of them (ADR-0049 enforce-or-remove, objectui#5667).
*/
export interface CalendarViewSchema extends BaseSchema {
type: 'calendar-view';
/**
* Records to display as events — the renderer computes its events from this
* array plus the field-name keys below.
*
* Redeclared from `BaseSchema` (same `any` type) because a binding
* expression string is also legal here and resolves to the array before the
* renderer reads it. A non-array value renders an empty calendar.
*/
data?: any;
/**
* Record field to use for the event title.
* @default 'title'
*/
titleField?: string;
/**
* Record field containing the event start date/time.
* @default 'start'
*/
startDateField?: string;
/**
* Record field containing the event end date/time.
* @default 'end'
*/
endDateField?: string;
/**
* Record field indicating an all-day event.
* @default 'allDay'
*/
allDayField?: string;
/**
* Record field to use for the event color.
* @default 'color'
*/
colorField?: string;
/**
* Calendar view mode.
*
* {@link CalendarViewMode} equals the renderer's rendered set since
* objectui#5740 retired `'agenda'`; at runtime the renderer still resolves
* any off-union value in raw metadata to the `'month'` default.
* @default 'month'
*/
view?: CalendarViewMode;
/**
* Initial calendar date — an ISO date string when authored as JSON; a
* `Date` instance is accepted from a React host.
*/
currentDate?: string | Date;
/**
* Show the "New event" affordance; clicking it dispatches a
* `{ type: 'create' }` action on the node's action channel (objectui#4454).
* @default false
*/
allowCreate?: boolean;
/**
* Tailwind classes for the calendar container. Redeclared from `BaseSchema`
* as part of the converged authored surface.
*/
className?: string;
/**
* Event click handler — HOST-ONLY. The renderer forwards it only when the
* value is a function, which authored JSON can never produce; supply it from
* a React host (`<SchemaRenderer ... onEventClick={fn} />`).
*
* RUNTIME SLOT (objectui#7344, the objectui#6124 shape) — the zod twin, which
* declared `z.function()` in a multi-line spelling PR #7339's census missed,
* now refuses this key by name, like `onViewChange` below.
*/
onEventClick?: (event: CalendarEvent) => void;
/**
* View change handler — HOST-ONLY, same rule as {@link
* CalendarViewSchema.onEventClick}.
*
* RUNTIME SLOT (objectui#6124) — a host-supplied function, NOT authorable
* metadata: JSON has no function value, so the zod twin refuses this key by
* name and points at the node-type spelling. Kept callable here because it is
* read by `calendar-view`'s `pickHostCallbacks` off the spread props
* (function values only).
*/
onViewChange?: (view: CalendarViewMode) => void;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `calendar-view` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `allDayField`, `colorField`, `data`, `endDateField`, `startDateField`,
* `titleField` (in
* `packages/plugin-calendar/src/calendar-view-renderer.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `calendar-view` reads — nothing renders it.
*/
body?: never;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `calendar-view` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `allDayField`, `colorField`, `data`, `endDateField`, `startDateField`,
* `titleField` (in
* `packages/plugin-calendar/src/calendar-view-renderer.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `calendar-view` reads — nothing renders it.
*/
children?: never;
}
/**
* Filter operator — the spec's canonical view-filter vocabulary, taken BY
* REFERENCE (`ViewFilterOperator`, the element type of `VIEW_FILTER_OPERATORS`
* in `@objectstack/spec/ui`), so this declaration and its zod mirror
* (`FilterOperatorSchema`, which is the spec rule's own operator member) state
* one set (objectui#9559, ruling B).
*
* It used to be a 14-member local union that disagreed with BOTH the protocol
* and the mirror: it carried `is_empty` / `is_not_empty` where the mirror
* carried `is_null` / `is_not_null`, and neither face had `icontains`,
* `before`, `after` or `between`.
*
* Canonical spellings only, deliberately narrower than what the mirror PARSES:
* the mirror also accepts the spec's legacy aliases (`lessThan`, `gt`, …) and
* normalises them to these members on parse, because stored metadata carries
* them — but the spec marks that table a deprecated migration bridge that new
* producers must not emit, and a type is what a new producer writes against.
*/
export type FilterBuilderOperator = SpecViewFilterOperator;
/**
* Filter condition
*/
export interface FilterBuilderCondition {
/**
* Row identity.
*
* REQUIRED, and deliberately asymmetric with `FilterGroup.id` below
* (objectui#8415). The group's `id` has zero read sites and is optional for
* that reason; a CONDITION's `id` is the identity every affordance on the row
* matches on — `removeCondition`, `updateCondition`, `changeOperator` and
* `changeField` in `packages/components/src/custom/filter-builder.tsx`, plus
* the React `key`. The component's own `FilterBuilderCondition` declares it
* `string`, and `addCondition` emits `crypto.randomUUID()`.
*
* Undeclared, it was STRIPPED by the `z.object` mirror in silence, so a
* correctly authored row validated and rendered with no individual identity:
* every affordance is handed `undefined`, `c.id === conditionId` is TRUE for
* every id-less row, and so one click removes all of them at once — the
* clicked row included — while one edit fans out across all of them. A row
* cannot be edited or removed on its own. (Not "matches none"; the failure is
* en bloc.) Declaring it is what makes `declared = enforced`.
*/
id: string;
/**
* Field to filter
*/
field: string;
/**
* Filter operator
*/
operator: FilterBuilderOperator;
/**
* Filter value
*/
value?: any;
}
/**
* Filter group — the shape `FilterBuilder` reads (objectui#6939, the
* `filter-builder` group; maintainer ruling 2026-09-02, director seat summon
* #8, verbatim 「同意」).
*
* The gate is `isValidGroup`,
* `packages/components/src/custom/filter-builder.tsx:1060`:
* `Array.isArray(v.conditions) && (v.logic === "and" || v.logic === "or")`.
* `logic` is the read key; the former `operator` on this face had zero read
* sites, and a group spelled that way fails the gate, falls back to
* `EMPTY_GROUP` and renders an EMPTY board.
*/
export interface FilterGroup {
/**
* Group id.
*
* OPTIONAL on purpose. `isValidGroup` never consults it and nothing reads
* `filterGroup.id`; measured, deleting it from an authored group renders
* byte-identically. It is declared because the component's own `FilterGroup`
* carries it, `EMPTY_GROUP` emits it and it round-trips out through
* `onChange` — so a document that carries it should be TYPE-CHECKED on it
* rather than admitted unvalidated.
*/
id?: string;
/**
* How the conditions combine — the key `isValidGroup` reads.
* @default 'and'
*/
logic: 'and' | 'or';
/**
* Filter conditions or nested groups
*/
conditions: (FilterBuilderCondition | FilterGroup)[];
}
/**
* Filter builder component
*/
export interface FilterBuilderSchema extends BaseSchema {
type: 'filter-builder';
/**
* Available fields for filtering
*/
fields: FilterField[];
/**
* Default filter configuration
*/
defaultValue?: FilterGroup;
/**
* Controlled filter value
*/
value?: FilterGroup;
/**
* Change handler
*
* RUNTIME SLOT (objectui#6124) — a host-supplied function, NOT authorable
* metadata: JSON has no function value, so the zod twin refuses this key by
* name and points at the node-type spelling. Kept callable here because it is
* called by the `filter-builder` renderer as `props.onChange` after
* `SchemaRenderer` spreads it.
*/
onChange?: (filter: FilterGroup) => void;
/**
* Allow nested groups
* @default true
*/
allowGroups?: boolean;
/**
* Maximum nesting depth
* @default 3
*/
maxDepth?: number;
/**
* Tailwind classes on the outermost wrapper `div`.
*
* READ SITE: `packages/components/src/renderers/complex/filter-builder.tsx:37`
* — `className={schema.wrapperClass || ''}`.
*
* Distinct from {@link BaseSchema.className}, which this renderer applies
* further in. Declared by objectui#6150.
*/
wrapperClass?: string;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `filter-builder` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `fields`, `label`, `name`, `value`, `wrapperClass` (in
* `packages/components/src/renderers/complex/filter-builder.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `filter-builder` reads — nothing renders it.
*/
body?: never;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `filter-builder` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `fields`, `label`, `name`, `value`, `wrapperClass` (in
* `packages/components/src/renderers/complex/filter-builder.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `filter-builder` reads — nothing renders it.
*/
children?: never;
}
/**
* Filter field definition — one entry of `FilterBuilderSchema.fields`
* (objectui#6939, same ruling).
*
* Renamed from `name` to `value`: every read site matches on `value`
* (`fields.find((f) => f.value === …)` in `getOperatorsForField`,
* `changeField`, `getInputType` and `renderValueInput`; `fields[0]?.value` in
* `addCondition`; `<SelectItem value={field.value}>` in the field dropdown),
* `name` had zero, and `FilterBuilderProps.fields` in
* `packages/components/src/custom/filter-builder.tsx` already declares
* `Array<{ value, label, type? }>`.
*/
export interface FilterField {
/**
* Field key — the identity the builder matches a condition's `field`
* against, and the value its field dropdown puts on each option.
*/
value: string;
/**
* Field label
*/
label: string;
/**
* Field type — the value FAMILY the column is edited in. OPTIONAL: absent
* means `text`, which is what `valueFamilyForFieldType` and
* `operatorsForFieldType` both read (`fieldType || "text"`,
* `custom/filter-builder.tsx:408` and `:964`).
*
* The fourteen members are the published doc's
* (`content/docs/components/complex/filter-builder.mdx`), which objectui#7562
* ruled the authority for this authoring surface, in the doc's own order.
* Every one of them was measured to have a renderer branch before this union
* widened — the ruling's precondition — and none had to be withdrawn from the
* doc. The mirror's docblock (`zod/complex.zod.ts`, `FilterFieldSchema`)
* carries the branch-by-branch table with the file:line for each bucket.
*
* `string` is still absent and is the contrast that makes the rest read: it
* is named nowhere in the renderer and reaches the text control only by the
* unrecognised-word fallthrough, so it is a phantom (objectui#6939). `text`
* shares that fallthrough but IS named — line 408 is where an absent `type`
* acquires it — which is why one is declared and the other is not.
*/
type?:
| 'text' | 'number' | 'currency' | 'percent' | 'rating'
| 'date' | 'datetime' | 'time'
| 'boolean'
| 'select' | 'status'
| 'lookup' | 'master_detail' | 'user';
/**
* Available operators for this field.
*
* The spec's canonical filter vocabulary, taken BY REFERENCE
* (`ViewFilterOperator`, the element type of `VIEW_FILTER_OPERATORS` in
* `@objectstack/spec/ui`), so the declaration and its zod mirror state one
* set and cannot drift apart again (objectui#10286, applying the
* objectui#7759 ruling: where the spec declares a vocabulary, both faces
* align to it — and for filter operators the spec's canonical words win).
* Until then this key restated `FilterBuilderOperator` below, which declares
* `is_empty` / `is_not_empty` where the mirror declared `is_null` /
* `is_not_null`, so each face refused a spelling the other accepted.
*
* ⚠️ Nothing renders this key today: the builder draws a field's operator
* dropdown from its `type` alone (`operatorsForFieldType` in
* `packages/components/src/custom/filter-builder.tsx`). The vocabulary is
* settled here; whether the key should be honoured or retired is a separate
* question this declaration does not answer.
*/
operators?: SpecViewFilterOperator[];
/**
* Options (for select type)
*/
options?: { label: string; value: any }[];
}
/**
* Carousel item
*/
export interface CarouselItem {
/**
* Unique item identifier
*/
id?: string;
/**
* Item content
*/
content: SchemaNode | SchemaNode[];
}
/**
* Carousel component
*/
export interface CarouselSchema extends BaseSchema {
type: 'carousel';
/**
* Carousel items
*/
items: CarouselItem[];
/**
* Option bag forwarded VERBATIM to the underlying embla carousel.
*
* READ SITE: `packages/components/src/renderers/complex/carousel.tsx:23` —
* `opts={schema.opts}`, passed straight through to the `Carousel`
* primitive, whose own `opts` is embla's `EmblaOptionsType`.
*
* ⚠️ Deliberately declared OPEN rather than as the two-key shape the docs
* page shows (`{ loop?, align? }`). The renderer forwards the whole bag, so
* every other embla option authored today reaches the library and works;
* declaring the documented pair would REFUSE those authored documents —
* a narrowing of a published surface, which is a ruling and not a
* declaration. objectui#6150 records the capability as it is; picking a
* narrower shape is escalated with that card.
*/
opts?: Record<string, unknown>;
/**
* Scroll axis.
*
* READ SITE: `renderers/complex/carousel.tsx:24` —
* `orientation={schema.orientation || 'horizontal'}`.
*
* @default 'horizontal'
*/
orientation?: 'horizontal' | 'vertical';
/**
* Tailwind classes applied to EACH slide (not the container — that is
* {@link BaseSchema.className}).
*
* READ SITE: `renderers/complex/carousel.tsx:30` —
* `className={schema.itemClassName}` on every `CarouselItem`.
*/
itemClassName?: string;
/**
* Auto-play interval (ms)
*/
autoPlay?: number;
/**
* Show navigation arrows
* @default true
*/
showArrows?: boolean;
/**
* Show pagination dots
* @default true
*/
showDots?: boolean;
/**
* Enable infinite loop
* @default true
*/
loop?: boolean;
/**
* Items visible at once
* @default 1
*/
itemsPerView?: number;
/**
* Gap between items
*/
gap?: number;
/**
* RETIRED (objectui#6124, ADR-0049) — JSON has no function value, and the
* `carousel` renderer spreads it onto a `<div>` that has no such event (React
* attaches nothing). The zod twin refuses it by name; author behaviour as a
* node type (`{ "type": "toast" }`, an `action:button` node) instead.
* @deprecated Not part of this contract — the value was inert.
*/
onSlideChange?: never;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `carousel` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `itemClassName`, `items`, `opts`, `orientation`, `showArrows` (in
* `packages/components/src/renderers/complex/carousel.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `carousel` reads — nothing renders it.
*/
body?: never;
/**
* REFUSED BY NAME (objectui#9256, ADR-0049) — `carousel` reads NEITHER
* content channel: no renderer read consumes `body` or `children` for this
* node.
*
* MEASURED with the TypeScript TYPE CHECKER and not with grep, across all 24
* packages that register components plus the generic traversers — a docblock
* mention is not a read, and `body: schema.requestBody` in
* `packages/plugin-chatbot/src/renderer.tsx` is the kind of prefix hit grep
* scores. Every read is filed under the TYPE of the object it is read from;
* this declaration carries none. What the renderer DOES read off this node:
* `itemClassName`, `items`, `opts`, `orientation`, `showArrows` (in
* `packages/components/src/renderers/complex/carousel.tsx`).
*
* Before objectui#9256 tombstoned them here, `body` and `children` were both
* inherited-and-optional from {@link BaseSchema} — so authoring either here
* type-checked, parsed green through `.passthrough()`, and rendered NOTHING:
* no error, no warning, no element. objectui#6771 has since retired `body` on
* `BaseSchema` itself; `BaseSchema` still declares `children`, so this node's
* own tombstone is what refuses it here. `SchemaRenderer` strips both keys
* out of the props bag it spreads, so neither reaches the component by
* another route either.
*
* @deprecated Not a channel `carousel` reads — nothing renders it.
*/
children?: never;
}
/**
* Chatbot message
*/
export interface ChatMessage {
/**
* Unique message identifier
*/
id: string;
/**
* Message role
*/
role: 'user' | 'assistant' | 'system' | 'tool';
/**
* Message content
*/
content: string;
/**
* Message timestamp
*/
timestamp?: string | Date;
/**
* Message metadata
*/
metadata?: any;
/**
* Whether this message is currently being streamed
*/
streaming?: boolean;
/**
* Tool invocations associated with this message (for tool-calling flows)
*/
toolInvocations?: ChatToolInvocation[];
/**
* Chain-of-thought / reasoning text emitted alongside the answer.
* Surfaced by the chatbot UI as a collapsible "Thoughts" panel.
*/
reasoning?: string;
/**
* Optional citation / RAG sources for this assistant message.
* Surfaced by the chatbot UI as an inline citation panel.
*/
sources?: ChatMessageSource[];
/**
* Optional backend trace id (e.g. the `ai_traces.id` produced by
* `@objectstack/service-ai`'s auto-tracing) for "view trace" affordances.
*/
traceId?: string;
/**
* Per-message avatar image URL, overriding the chatbot-level
* `userAvatarUrl` / `assistantAvatarUrl` for this one message.
*
* READ SITE: `packages/plugin-chatbot/src/index.tsx:173–174` —
* `message.avatar || userAvatarUrl` on a user message and
* `message.avatar || assistantAvatarUrl` on an assistant one; the
* authoring-to-runtime seam (`chatMessageAdapter.ts`, `...passthrough`)
* carries it untouched. Undeclared until objectui#7295: this interface has
* no index signature (objectui#5155 — and must not gain one), so an author
* annotating `ChatbotSchema.messages` was told a value that renders is an
* error (TS2353), and the zod mirror — a plain strip-mode `z.object` —
* dropped it at parse. objectui#4424's `RuntimeOnlyMessageKeys` named only
* the three keys API mode lifts out of the stream, never the two a human
* author writes by hand.
*/
avatar?: string;
/**
* Per-message avatar fallback text (initials), shown when `avatar` is unset
* or fails to load; overrides the chatbot-level `userAvatarFallback` /
* `assistantAvatarFallback` for this one message.
*
* READ SITE: `packages/plugin-chatbot/src/index.tsx:177–178` —
* `message.avatarFallback || userAvatarFallback` on a user message and
* `message.avatarFallback || assistantAvatarFallback` on an assistant one.
* Same history as `avatar` above (objectui#7295).
*/
avatarFallback?: string;
}
/**
* Citation / RAG source attached to a chat message.
*/
export interface ChatMessageSource {
id?: string;
title?: string;
url: string;
}
/**
* Represents a tool invocation from an AI assistant message
*/
export interface ChatToolInvocation {
/**
* Unique tool call identifier
*/
toolCallId: string;
/**
* Name of the tool being invoked
*/
toolName: string;
/**