@object-ui/types 3.1.5 → 3.3.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +20 -1
  3. package/dist/app.d.ts +4 -12
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/complex.d.ts +126 -1
  6. package/dist/complex.d.ts.map +1 -1
  7. package/dist/data-display.d.ts +6 -0
  8. package/dist/data-display.d.ts.map +1 -1
  9. package/dist/data.d.ts +34 -0
  10. package/dist/data.d.ts.map +1 -1
  11. package/dist/designer.d.ts +123 -0
  12. package/dist/designer.d.ts.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/objectql.d.ts +14 -0
  16. package/dist/objectql.d.ts.map +1 -1
  17. package/dist/ui-action.d.ts +13 -0
  18. package/dist/ui-action.d.ts.map +1 -1
  19. package/dist/views.d.ts +10 -0
  20. package/dist/views.d.ts.map +1 -1
  21. package/dist/zod/complex.zod.d.ts +68 -2
  22. package/dist/zod/complex.zod.d.ts.map +1 -1
  23. package/dist/zod/complex.zod.js +19 -1
  24. package/dist/zod/data-display.zod.d.ts +2 -0
  25. package/dist/zod/data-display.zod.d.ts.map +1 -1
  26. package/dist/zod/data-display.zod.js +1 -0
  27. package/dist/zod/feedback.zod.d.ts +8 -8
  28. package/dist/zod/index.zod.d.ts +36 -10
  29. package/dist/zod/index.zod.d.ts.map +1 -1
  30. package/dist/zod/index.zod.js +1 -1
  31. package/dist/zod/navigation.zod.d.ts +2 -2
  32. package/dist/zod/objectql.zod.d.ts +8 -4
  33. package/dist/zod/objectql.zod.d.ts.map +1 -1
  34. package/dist/zod/objectql.zod.js +1 -0
  35. package/dist/zod/views.zod.d.ts +6 -2
  36. package/dist/zod/views.zod.d.ts.map +1 -1
  37. package/dist/zod/views.zod.js +2 -0
  38. package/package.json +22 -7
  39. package/src/app.ts +4 -4
  40. package/src/complex.ts +135 -1
  41. package/src/data-display.ts +6 -0
  42. package/src/data.ts +36 -0
  43. package/src/designer.ts +166 -0
  44. package/src/index.ts +11 -0
  45. package/src/objectql.ts +16 -0
  46. package/src/ui-action.ts +14 -0
  47. package/src/views.ts +10 -0
  48. package/src/zod/complex.zod.ts +20 -1
  49. package/src/zod/data-display.zod.ts +1 -0
  50. package/src/zod/index.zod.ts +1 -0
  51. package/src/zod/objectql.zod.ts +1 -0
  52. package/src/zod/views.zod.ts +2 -0
  53. package/src/__tests__/examples-metadata-compliance.test.ts +0 -264
package/src/complex.ts CHANGED
@@ -401,7 +401,7 @@ export interface ChatMessage {
401
401
  /**
402
402
  * Message role
403
403
  */
404
- role: 'user' | 'assistant' | 'system';
404
+ role: 'user' | 'assistant' | 'system' | 'tool';
405
405
  /**
406
406
  * Message content
407
407
  */
@@ -414,6 +414,40 @@ export interface ChatMessage {
414
414
  * Message metadata
415
415
  */
416
416
  metadata?: any;
417
+ /**
418
+ * Whether this message is currently being streamed
419
+ */
420
+ streaming?: boolean;
421
+ /**
422
+ * Tool invocations associated with this message (for tool-calling flows)
423
+ */
424
+ toolInvocations?: ChatToolInvocation[];
425
+ }
426
+
427
+ /**
428
+ * Represents a tool invocation from an AI assistant message
429
+ */
430
+ export interface ChatToolInvocation {
431
+ /**
432
+ * Unique tool call identifier
433
+ */
434
+ toolCallId: string;
435
+ /**
436
+ * Name of the tool being invoked
437
+ */
438
+ toolName: string;
439
+ /**
440
+ * Arguments passed to the tool
441
+ */
442
+ args: Record<string, unknown>;
443
+ /**
444
+ * Result of the tool invocation (set when complete)
445
+ */
446
+ result?: unknown;
447
+ /**
448
+ * Tool invocation state
449
+ */
450
+ state: 'partial-call' | 'call' | 'result';
417
451
  }
418
452
 
419
453
  /**
@@ -460,6 +494,106 @@ export interface ChatbotSchema extends BaseSchema {
460
494
  * Chat height
461
495
  */
462
496
  height?: string | number;
497
+
498
+ // --- AI / service-ai integration fields ---
499
+
500
+ /**
501
+ * Backend API endpoint for chat (e.g., '/api/v1/ai/chat').
502
+ * When set, the chatbot uses streaming SSE via the vercel/ai SDK.
503
+ * When not set, the chatbot falls back to local auto-response mode (legacy/demo).
504
+ */
505
+ api?: string;
506
+ /**
507
+ * Conversation ID for multi-turn context.
508
+ * Sent to the backend as an `x-conversation-id` HTTP header.
509
+ */
510
+ conversationId?: string;
511
+ /**
512
+ * System prompt to configure assistant behavior.
513
+ */
514
+ systemPrompt?: string;
515
+ /**
516
+ * AI model identifier (e.g., 'gpt-4o', 'claude-3-opus').
517
+ */
518
+ model?: string;
519
+ /**
520
+ * Whether streaming is enabled for AI responses.
521
+ * @default true
522
+ */
523
+ streamingEnabled?: boolean;
524
+ /**
525
+ * Additional headers to send with API requests (e.g., auth tokens).
526
+ */
527
+ headers?: Record<string, string>;
528
+ /**
529
+ * Additional body parameters to include with each API request.
530
+ */
531
+ requestBody?: Record<string, unknown>;
532
+ /**
533
+ * Maximum number of tool-calling round-trips per user message.
534
+ * @default 5
535
+ */
536
+ maxToolRoundtrips?: number;
537
+ /**
538
+ * Callback when an error occurs during streaming or API calls.
539
+ */
540
+ onError?: (error: Error) => void;
541
+
542
+ // --- Floating / FAB display mode ---
543
+
544
+ /**
545
+ * Display mode for the chatbot.
546
+ * - `'inline'` (default): Embedded in the page flow.
547
+ * - `'floating'`: Rendered as a floating action button (FAB) that opens a panel overlay.
548
+ */
549
+ displayMode?: 'inline' | 'floating';
550
+
551
+ /**
552
+ * Configuration for floating display mode.
553
+ * Only used when `displayMode` is `'floating'`.
554
+ */
555
+ floatingConfig?: FloatingChatbotConfig;
556
+ }
557
+
558
+ /**
559
+ * Configuration for the floating chatbot FAB widget.
560
+ */
561
+ export interface FloatingChatbotConfig {
562
+ /**
563
+ * Position of the FAB trigger button.
564
+ * @default 'bottom-right'
565
+ */
566
+ position?: 'bottom-right' | 'bottom-left';
567
+ /**
568
+ * Whether the panel is open by default on mount.
569
+ * @default false
570
+ */
571
+ defaultOpen?: boolean;
572
+ /**
573
+ * Width of the floating panel.
574
+ * @default 400
575
+ */
576
+ panelWidth?: number;
577
+ /**
578
+ * Height of the floating panel.
579
+ * @default 520
580
+ */
581
+ panelHeight?: number;
582
+ /**
583
+ * Title displayed in the panel header.
584
+ * @default 'Chat'
585
+ */
586
+ title?: string;
587
+ /**
588
+ * Custom icon name for the FAB trigger (Lucide icon name).
589
+ * @default 'MessageCircle'
590
+ */
591
+ triggerIcon?: string;
592
+ /**
593
+ * Custom size for the FAB trigger button in pixels.
594
+ * @default 56
595
+ */
596
+ triggerSize?: number;
463
597
  }
464
598
 
465
599
  /**
@@ -447,6 +447,12 @@ export interface DataTableSchema extends BaseSchema {
447
447
  * @default false
448
448
  */
449
449
  showAddRow?: boolean;
450
+ /**
451
+ * Optional schema node rendered inside the empty-state, e.g. an
452
+ * "Add record" button. Lets the empty state become an actionable
453
+ * invitation rather than a dead end.
454
+ */
455
+ emptyAction?: SchemaNode;
450
456
  /**
451
457
  * Callback when the "+ Add record" row is clicked
452
458
  */
package/src/data.ts CHANGED
@@ -322,6 +322,42 @@ export interface DataSource<T = any> {
322
322
  * @returns Promise resolving to aggregated results
323
323
  */
324
324
  aggregate?(resource: string, params: AggregateParams): Promise<AggregateResult[]>;
325
+
326
+ /**
327
+ * Subscribe to mutation events.
328
+ * When implemented, data-bound views (ListView, ObjectView) can auto-refresh
329
+ * after any create/update/delete operation on relevant resources.
330
+ *
331
+ * @param callback - Invoked after each successful mutation
332
+ * @returns Unsubscribe function to remove the listener
333
+ *
334
+ * @example
335
+ * ```typescript
336
+ * const unsub = dataSource.onMutation?.((event) => {
337
+ * if (event.resource === 'contacts') {
338
+ * refreshList();
339
+ * }
340
+ * });
341
+ * // later…
342
+ * unsub?.();
343
+ * ```
344
+ */
345
+ onMutation?(callback: (event: MutationEvent<T>) => void): () => void;
346
+ }
347
+
348
+ /**
349
+ * Describes a mutation that occurred on a DataSource.
350
+ * Emitted by `DataSource.onMutation` subscribers after create/update/delete.
351
+ */
352
+ export interface MutationEvent<T = any> {
353
+ /** The type of mutation that occurred */
354
+ type: 'create' | 'update' | 'delete';
355
+ /** The resource (object) name that was mutated */
356
+ resource: string;
357
+ /** The affected record (present for create/update) */
358
+ record?: T;
359
+ /** The ID of the affected record (present for update/delete) */
360
+ id?: string | number;
325
361
  }
326
362
 
327
363
  /**
package/src/designer.ts CHANGED
@@ -632,6 +632,172 @@ export interface DashboardConfig {
632
632
  [key: string]: any;
633
633
  }
634
634
 
635
+ // ============================================================================
636
+ // Object Manager (Enterprise Metadata Management)
637
+ // ============================================================================
638
+
639
+ /** Object definition for the Object Manager */
640
+ export interface ObjectDefinition {
641
+ /** Unique object identifier */
642
+ id: string;
643
+ /** API name (snake_case) */
644
+ name: string;
645
+ /** Display label */
646
+ label: string;
647
+ /** Plural display label */
648
+ pluralLabel?: string;
649
+ /** Object description */
650
+ description?: string;
651
+ /** Icon name (Lucide icon) */
652
+ icon?: string;
653
+ /** Grouping/category */
654
+ group?: string;
655
+ /** Sort order within group */
656
+ sortOrder?: number;
657
+ /** Whether this is a system object (non-deletable) */
658
+ isSystem?: boolean;
659
+ /** Whether this object is enabled/active */
660
+ enabled?: boolean;
661
+ /** Field count (read-only, for display) */
662
+ fieldCount?: number;
663
+ /** Relationships to other objects */
664
+ relationships?: ObjectDefinitionRelationship[];
665
+ }
666
+
667
+ /** Relationship reference for Object Manager */
668
+ export interface ObjectDefinitionRelationship {
669
+ /** Related object name */
670
+ relatedObject: string;
671
+ /** Relationship type */
672
+ type: 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many';
673
+ /** Relationship label */
674
+ label?: string;
675
+ /** Foreign key field */
676
+ foreignKey?: string;
677
+ }
678
+
679
+ /** Object Manager component schema */
680
+ export interface ObjectManagerSchema extends BaseSchema {
681
+ type: 'object-manager';
682
+ /** List of object definitions */
683
+ objects: ObjectDefinition[];
684
+ /** Read-only mode */
685
+ readOnly?: boolean;
686
+ /** Show system objects */
687
+ showSystemObjects?: boolean;
688
+ }
689
+
690
+ // ============================================================================
691
+ // Field Designer (Field Configuration Wizard)
692
+ // ============================================================================
693
+
694
+ /** Supported field types in the Field Designer */
695
+ export type DesignerFieldType =
696
+ | 'text'
697
+ | 'textarea'
698
+ | 'number'
699
+ | 'boolean'
700
+ | 'date'
701
+ | 'datetime'
702
+ | 'time'
703
+ | 'select'
704
+ | 'email'
705
+ | 'phone'
706
+ | 'url'
707
+ | 'password'
708
+ | 'currency'
709
+ | 'percent'
710
+ | 'lookup'
711
+ | 'formula'
712
+ | 'autonumber'
713
+ | 'file'
714
+ | 'image'
715
+ | 'markdown'
716
+ | 'html'
717
+ | 'color'
718
+ | 'code'
719
+ | 'location'
720
+ | 'address'
721
+ | 'rating'
722
+ | 'slider';
723
+
724
+ /** Select option for field designer */
725
+ export interface DesignerFieldOption {
726
+ /** Option label */
727
+ label: string;
728
+ /** Option value */
729
+ value: string;
730
+ /** Option color (for badge display) */
731
+ color?: string;
732
+ }
733
+
734
+ /** Validation rule for field designer */
735
+ export interface DesignerValidationRule {
736
+ /** Rule type */
737
+ type: 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'custom';
738
+ /** Rule value */
739
+ value: string | number;
740
+ /** Error message */
741
+ message?: string;
742
+ }
743
+
744
+ /** Field definition for the Field Designer */
745
+ export interface DesignerFieldDefinition {
746
+ /** Unique field identifier */
747
+ id: string;
748
+ /** API name (snake_case) */
749
+ name: string;
750
+ /** Display label */
751
+ label: string;
752
+ /** Field type */
753
+ type: DesignerFieldType;
754
+ /** Field group/section */
755
+ group?: string;
756
+ /** Sort order within group */
757
+ sortOrder?: number;
758
+ /** Field description / help text */
759
+ description?: string;
760
+ /** Whether field is required */
761
+ required?: boolean;
762
+ /** Whether field is unique */
763
+ unique?: boolean;
764
+ /** Whether field is read-only */
765
+ readonly?: boolean;
766
+ /** Whether field is hidden */
767
+ hidden?: boolean;
768
+ /** Default value */
769
+ defaultValue?: unknown;
770
+ /** Placeholder text */
771
+ placeholder?: string;
772
+ /** Select options (for select type) */
773
+ options?: DesignerFieldOption[];
774
+ /** Validation rules */
775
+ validationRules?: DesignerValidationRule[];
776
+ /** Whether this is a system field */
777
+ isSystem?: boolean;
778
+ /** External ID flag */
779
+ externalId?: boolean;
780
+ /** Track field history */
781
+ trackHistory?: boolean;
782
+ /** Whether field is indexed */
783
+ indexed?: boolean;
784
+ /** Lookup reference object (for lookup type) */
785
+ referenceTo?: string;
786
+ /** Formula expression (for formula type) */
787
+ formula?: string;
788
+ }
789
+
790
+ /** Field Designer component schema */
791
+ export interface FieldDesignerSchema extends BaseSchema {
792
+ type: 'field-designer';
793
+ /** Object name this field designer belongs to */
794
+ objectName: string;
795
+ /** List of field definitions */
796
+ fields: DesignerFieldDefinition[];
797
+ /** Read-only mode */
798
+ readOnly?: boolean;
799
+ }
800
+
635
801
  // ============================================================================
636
802
  // Multi-User Collaborative Editing
637
803
  // ============================================================================
package/src/index.ts CHANGED
@@ -249,7 +249,9 @@ export type {
249
249
  DashboardWidgetSchema,
250
250
  DashboardSchema,
251
251
  ChatMessage,
252
+ ChatToolInvocation,
252
253
  ChatbotSchema,
254
+ FloatingChatbotConfig,
253
255
  ComplexSchema,
254
256
  } from './complex';
255
257
 
@@ -268,6 +270,7 @@ export type {
268
270
  FileUploadResult,
269
271
  AggregateParams,
270
272
  AggregateResult,
273
+ MutationEvent,
271
274
  } from './data';
272
275
 
273
276
  // ============================================================================
@@ -567,6 +570,14 @@ export type {
567
570
  DashboardWidgetType,
568
571
  DashboardWidgetConfig,
569
572
  DashboardConfig,
573
+ ObjectDefinition,
574
+ ObjectDefinitionRelationship,
575
+ ObjectManagerSchema,
576
+ DesignerFieldType,
577
+ DesignerFieldOption,
578
+ DesignerValidationRule,
579
+ DesignerFieldDefinition,
580
+ FieldDesignerSchema,
570
581
  } from './designer';
571
582
 
572
583
  export {
package/src/objectql.ts CHANGED
@@ -339,6 +339,14 @@ export interface ObjectGridSchema extends BaseSchema {
339
339
  * Display borders around cells
340
340
  */
341
341
  bordered?: boolean;
342
+
343
+ /**
344
+ * Show column type icons (T / Tag / Calendar / Hash) in column headers.
345
+ * Off by default — type is usually obvious from cell content; the icons
346
+ * add visual noise that competes with column labels.
347
+ * @default false
348
+ */
349
+ showColumnTypeIcons?: boolean;
342
350
 
343
351
  /**
344
352
  * Row Selection Configuration
@@ -1755,6 +1763,14 @@ export interface ListViewSchema extends BaseSchema {
1755
1763
  * @default false
1756
1764
  */
1757
1765
  allowPrinting?: boolean;
1766
+
1767
+ /**
1768
+ * External refresh trigger.
1769
+ * Increment this value to force the ListView to re-fetch data.
1770
+ * Used by parent components (e.g., ObjectView) to signal that a mutation
1771
+ * (create/update/delete) has occurred and the list should refresh.
1772
+ */
1773
+ refreshTrigger?: number;
1758
1774
  }
1759
1775
  export interface ObjectMapSchema extends BaseSchema {
1760
1776
  type: 'object-map';
package/src/ui-action.ts CHANGED
@@ -212,6 +212,20 @@ export interface ActionSchema {
212
212
 
213
213
  /** Tags for categorization */
214
214
  tags?: string[];
215
+
216
+ /**
217
+ * UI-local escape hatch: synchronous/async callback invoked directly by
218
+ * UI action renderers (e.g., `action:menu`) instead of routing through
219
+ * {@link ActionEngine}. Intended for chrome-level concerns such as
220
+ * toggling inline-edit mode, opening a native Share sheet, or copying the
221
+ * URL to the clipboard — UI side-effects that are not part of the domain
222
+ * action protocol and therefore need not be serialized over the wire.
223
+ *
224
+ * When present, `onClick` takes precedence over `type` / `target` /
225
+ * `execute`. Prefer {@link ActionEngine}-routed actions for anything that
226
+ * could originate from server-driven metadata.
227
+ */
228
+ onClick?: () => void | Promise<void>;
215
229
  }
216
230
 
217
231
  /**
package/src/views.ts CHANGED
@@ -556,6 +556,16 @@ export interface DetailViewSchema extends BaseSchema {
556
556
  * Fields for list view
557
557
  */
558
558
  fields?: string[];
559
+ /**
560
+ * Optional foreign-key field on the child records that points back to the
561
+ * parent record. When provided, the renderer hides this column from the
562
+ * default related-list table because the parent is implicit context.
563
+ */
564
+ referenceField?: string;
565
+ /**
566
+ * Optional Lucide-style icon name to render next to the section title.
567
+ */
568
+ icon?: string;
559
569
  }>;
560
570
  /**
561
571
  * When true, auto-discover related lists from objectSchema reference fields
@@ -192,12 +192,22 @@ export const CarouselSchema = BaseSchema.extend({
192
192
  /**
193
193
  * Chat Message Schema
194
194
  */
195
+ export const ChatToolInvocationSchema = z.object({
196
+ toolCallId: z.string().describe('Unique tool call identifier'),
197
+ toolName: z.string().describe('Name of the tool'),
198
+ args: z.record(z.string(), z.unknown()).describe('Tool arguments'),
199
+ result: z.unknown().optional().describe('Tool result'),
200
+ state: z.enum(['partial-call', 'call', 'result']).describe('Tool invocation state'),
201
+ });
202
+
195
203
  export const ChatMessageSchema = z.object({
196
204
  id: z.string().describe('Message ID'),
197
- role: z.enum(['user', 'assistant', 'system']).describe('Message role'),
205
+ role: z.enum(['user', 'assistant', 'system', 'tool']).describe('Message role'),
198
206
  content: z.string().describe('Message content'),
199
207
  timestamp: z.union([z.string(), z.date()]).optional().describe('Message timestamp'),
200
208
  metadata: z.record(z.string(), z.any()).optional().describe('Custom metadata'),
209
+ streaming: z.boolean().optional().describe('Whether message is being streamed'),
210
+ toolInvocations: z.array(ChatToolInvocationSchema).optional().describe('Tool invocations'),
201
211
  });
202
212
 
203
213
  /**
@@ -214,6 +224,15 @@ export const ChatbotSchema = BaseSchema.extend({
214
224
  assistantAvatar: z.string().optional().describe('Assistant avatar URL'),
215
225
  markdown: z.boolean().optional().describe('Enable markdown rendering'),
216
226
  height: z.union([z.string(), z.number()]).optional().describe('Chatbot height'),
227
+ api: z.string().optional().describe('Backend API endpoint for streaming chat'),
228
+ conversationId: z.string().optional().describe('Conversation ID for multi-turn context'),
229
+ systemPrompt: z.string().optional().describe('System prompt for assistant behavior'),
230
+ model: z.string().optional().describe('AI model identifier'),
231
+ streamingEnabled: z.boolean().optional().describe('Enable streaming responses'),
232
+ headers: z.record(z.string(), z.string()).optional().describe('Additional API headers'),
233
+ body: z.record(z.string(), z.unknown()).optional().describe('Additional API body params'),
234
+ maxToolRoundtrips: z.number().optional().describe('Max tool-calling round-trips'),
235
+ onError: z.function().optional().describe('Error callback'),
217
236
  });
218
237
 
219
238
  /**
@@ -149,6 +149,7 @@ export const DataTableSchema = BaseSchema.extend({
149
149
  onColumnsReorder: z.function().optional().describe('Column reorder handler'),
150
150
  frozenColumns: z.number().optional().describe('Number of frozen columns'),
151
151
  showRowNumbers: z.boolean().optional().describe('Show row numbers'),
152
+ emptyAction: SchemaNodeSchema.optional().describe('Optional schema node rendered inside the empty-state, e.g. an "Add record" button. Lets the empty state become an actionable invitation rather than a dead end.'),
152
153
  });
153
154
 
154
155
  /**
@@ -225,6 +225,7 @@ export {
225
225
  FilterBuilderSchema,
226
226
  CarouselItemSchema,
227
227
  CarouselSchema,
228
+ ChatToolInvocationSchema,
228
229
  ChatMessageSchema,
229
230
  ChatbotSchema,
230
231
  DashboardWidgetLayoutSchema,
@@ -126,6 +126,7 @@ export const ObjectGridSchema = BaseSchema.extend({
126
126
  resizable: z.boolean().optional().describe('Enable column resizing'),
127
127
  striped: z.boolean().optional().describe('Striped rows'),
128
128
  bordered: z.boolean().optional().describe('Show borders'),
129
+ showColumnTypeIcons: z.boolean().optional().describe('Show column type icons (T/Tag/Calendar) in headers. Off by default — type is usually obvious from cell content; the icons add visual noise.'),
129
130
  selection: SelectionConfigSchema.optional().describe('Selection configuration'),
130
131
  pagination: PaginationConfigSchema.optional().describe('Pagination configuration'),
131
132
 
@@ -112,6 +112,8 @@ export const DetailViewSchema = BaseSchema.extend({
112
112
  data: z.array(z.any()).optional().describe('Static data'),
113
113
  columns: z.array(z.any()).optional().describe('Columns for table view'),
114
114
  fields: z.array(z.string()).optional().describe('Fields for list view'),
115
+ referenceField: z.string().optional().describe('Foreign-key field on the child object pointing back to the parent record. The renderer hides this column from the related-list table by default since the parent is implicit context.'),
116
+ icon: z.string().optional().describe('Optional Lucide-style icon name to render next to the section title'),
115
117
  })).optional().describe('Related records section'),
116
118
  });
117
119