@object-ui/types 0.5.0 → 3.0.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.
Files changed (127) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +2 -2
  6. package/dist/complex.d.ts +2 -0
  7. package/dist/complex.d.ts.map +1 -1
  8. package/dist/crud.d.ts +3 -0
  9. package/dist/crud.d.ts.map +1 -1
  10. package/dist/data-display.d.ts +40 -0
  11. package/dist/data-display.d.ts.map +1 -1
  12. package/dist/data-protocol.d.ts +19 -19
  13. package/dist/data.d.ts +77 -0
  14. package/dist/data.d.ts.map +1 -1
  15. package/dist/designer.d.ts +473 -0
  16. package/dist/designer.d.ts.map +1 -0
  17. package/dist/designer.js +8 -0
  18. package/dist/form.d.ts +35 -1
  19. package/dist/form.d.ts.map +1 -1
  20. package/dist/index.d.ts +46 -8
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +18 -0
  23. package/dist/layout.d.ts +63 -8
  24. package/dist/layout.d.ts.map +1 -1
  25. package/dist/mobile.d.ts +186 -0
  26. package/dist/mobile.d.ts.map +1 -0
  27. package/dist/mobile.js +8 -0
  28. package/dist/objectql.d.ts +341 -88
  29. package/dist/objectql.d.ts.map +1 -1
  30. package/dist/permissions.d.ts +150 -0
  31. package/dist/permissions.d.ts.map +1 -0
  32. package/dist/permissions.js +8 -0
  33. package/dist/tenant.d.ts +138 -0
  34. package/dist/tenant.d.ts.map +1 -0
  35. package/dist/tenant.js +8 -0
  36. package/dist/theme.d.ts +115 -224
  37. package/dist/theme.d.ts.map +1 -1
  38. package/dist/ui-action.d.ts +126 -11
  39. package/dist/ui-action.d.ts.map +1 -1
  40. package/dist/views.d.ts +20 -0
  41. package/dist/views.d.ts.map +1 -1
  42. package/dist/widget.d.ts +181 -0
  43. package/dist/widget.d.ts.map +1 -0
  44. package/dist/widget.js +8 -0
  45. package/dist/workflow.d.ts +340 -0
  46. package/dist/workflow.d.ts.map +1 -0
  47. package/dist/workflow.js +8 -0
  48. package/dist/zod/blocks.zod.d.ts +2 -2
  49. package/dist/zod/blocks.zod.d.ts.map +1 -1
  50. package/dist/zod/blocks.zod.js +1 -1
  51. package/dist/zod/complex.zod.d.ts +6 -6
  52. package/dist/zod/complex.zod.d.ts.map +1 -1
  53. package/dist/zod/complex.zod.js +1 -1
  54. package/dist/zod/crud.zod.d.ts +5 -5
  55. package/dist/zod/data-display.zod.d.ts +2 -2
  56. package/dist/zod/data-display.zod.d.ts.map +1 -1
  57. package/dist/zod/data-display.zod.js +1 -1
  58. package/dist/zod/disclosure.zod.d.ts +2 -2
  59. package/dist/zod/disclosure.zod.d.ts.map +1 -1
  60. package/dist/zod/disclosure.zod.js +1 -1
  61. package/dist/zod/feedback.zod.d.ts +12 -12
  62. package/dist/zod/feedback.zod.d.ts.map +1 -1
  63. package/dist/zod/feedback.zod.js +1 -1
  64. package/dist/zod/form.zod.d.ts +6 -6
  65. package/dist/zod/form.zod.d.ts.map +1 -1
  66. package/dist/zod/form.zod.js +1 -1
  67. package/dist/zod/index.zod.d.ts +337 -146
  68. package/dist/zod/index.zod.d.ts.map +1 -1
  69. package/dist/zod/index.zod.js +4 -4
  70. package/dist/zod/layout.zod.d.ts +134 -2
  71. package/dist/zod/layout.zod.d.ts.map +1 -1
  72. package/dist/zod/layout.zod.js +35 -1
  73. package/dist/zod/navigation.zod.d.ts +2 -2
  74. package/dist/zod/navigation.zod.d.ts.map +1 -1
  75. package/dist/zod/navigation.zod.js +1 -1
  76. package/dist/zod/objectql.zod.d.ts +32 -16
  77. package/dist/zod/objectql.zod.d.ts.map +1 -1
  78. package/dist/zod/objectql.zod.js +8 -0
  79. package/dist/zod/overlay.zod.d.ts +2 -2
  80. package/dist/zod/overlay.zod.d.ts.map +1 -1
  81. package/dist/zod/overlay.zod.js +1 -1
  82. package/dist/zod/reports.zod.d.ts +19 -19
  83. package/dist/zod/reports.zod.d.ts.map +1 -1
  84. package/dist/zod/reports.zod.js +1 -1
  85. package/dist/zod/theme.zod.d.ts +948 -267
  86. package/dist/zod/theme.zod.d.ts.map +1 -1
  87. package/dist/zod/theme.zod.js +175 -45
  88. package/dist/zod/views.zod.d.ts +22 -22
  89. package/dist/zod/views.zod.d.ts.map +1 -1
  90. package/dist/zod/views.zod.js +1 -1
  91. package/package.json +3 -2
  92. package/src/__tests__/namespace-exports.test.ts +23 -68
  93. package/src/__tests__/phase2-schemas.test.ts +8 -13
  94. package/src/ai.ts +454 -0
  95. package/src/app.ts +2 -2
  96. package/src/complex.ts +2 -0
  97. package/src/crud.ts +3 -0
  98. package/src/data-display.ts +36 -0
  99. package/src/data-protocol.ts +19 -19
  100. package/src/data.ts +91 -0
  101. package/src/designer.ts +509 -0
  102. package/src/form.ts +35 -1
  103. package/src/index.ts +397 -8
  104. package/src/layout.ts +66 -8
  105. package/src/mobile.ts +205 -0
  106. package/src/objectql.ts +419 -93
  107. package/src/permissions.ts +166 -0
  108. package/src/tenant.ts +153 -0
  109. package/src/theme.ts +147 -260
  110. package/src/ui-action.ts +166 -27
  111. package/src/views.ts +17 -0
  112. package/src/widget.ts +197 -0
  113. package/src/workflow.ts +409 -0
  114. package/src/zod/blocks.zod.ts +1 -1
  115. package/src/zod/complex.zod.ts +1 -1
  116. package/src/zod/data-display.zod.ts +1 -1
  117. package/src/zod/disclosure.zod.ts +1 -1
  118. package/src/zod/feedback.zod.ts +1 -1
  119. package/src/zod/form.zod.ts +1 -1
  120. package/src/zod/index.zod.ts +14 -3
  121. package/src/zod/layout.zod.ts +39 -1
  122. package/src/zod/navigation.zod.ts +1 -1
  123. package/src/zod/objectql.zod.ts +8 -0
  124. package/src/zod/overlay.zod.ts +1 -1
  125. package/src/zod/reports.zod.ts +1 -1
  126. package/src/zod/theme.zod.ts +189 -48
  127. package/src/zod/views.zod.ts +1 -1
@@ -0,0 +1,409 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types - Workflow Schema
11
+ *
12
+ * Defines workflow UI types for visual workflow design, approval processes,
13
+ * and workflow instance tracking.
14
+ */
15
+
16
+ import type { BaseSchema } from './base';
17
+
18
+ /**
19
+ * Workflow lifecycle status
20
+ */
21
+ export type WorkflowStatus = 'draft' | 'active' | 'paused' | 'completed' | 'cancelled';
22
+
23
+ /**
24
+ * Types of nodes available in the workflow designer
25
+ */
26
+ export type WorkflowNodeType = 'start' | 'end' | 'task' | 'approval' | 'condition' | 'parallel' | 'delay' | 'notification' | 'script';
27
+
28
+ /**
29
+ * Types of edges connecting workflow nodes
30
+ */
31
+ export type WorkflowEdgeType = 'default' | 'conditional' | 'timeout';
32
+
33
+ /**
34
+ * Action that can be performed on a workflow node
35
+ */
36
+ export interface WorkflowNodeAction {
37
+ /**
38
+ * Action type
39
+ */
40
+ type: 'approve' | 'reject' | 'reassign' | 'comment' | 'escalate' | 'custom';
41
+
42
+ /**
43
+ * Display label for the action
44
+ */
45
+ label: string;
46
+
47
+ /**
48
+ * Target node to transition to after action
49
+ */
50
+ nextNodeId?: string;
51
+
52
+ /**
53
+ * Condition expression for action availability
54
+ */
55
+ condition?: string;
56
+ }
57
+
58
+ /**
59
+ * A node in the workflow graph
60
+ */
61
+ export interface WorkflowNode {
62
+ /**
63
+ * Unique node identifier
64
+ */
65
+ id: string;
66
+
67
+ /**
68
+ * Node type
69
+ */
70
+ type: WorkflowNodeType;
71
+
72
+ /**
73
+ * Display label
74
+ */
75
+ label: string;
76
+
77
+ /**
78
+ * Node description
79
+ */
80
+ description?: string;
81
+
82
+ /**
83
+ * Position in the workflow canvas
84
+ */
85
+ position?: { x: number; y: number };
86
+
87
+ /**
88
+ * Node-specific configuration
89
+ */
90
+ config?: Record<string, any>;
91
+
92
+ /**
93
+ * Assignee identifier
94
+ */
95
+ assignee?: string;
96
+
97
+ /**
98
+ * How the assignee is resolved
99
+ */
100
+ assigneeType?: 'user' | 'role' | 'group' | 'expression';
101
+
102
+ /**
103
+ * Timeout duration in minutes
104
+ */
105
+ timeout?: number;
106
+
107
+ /**
108
+ * Available actions for this node
109
+ */
110
+ actions?: WorkflowNodeAction[];
111
+ }
112
+
113
+ /**
114
+ * An edge connecting two workflow nodes
115
+ */
116
+ export interface WorkflowEdge {
117
+ /**
118
+ * Unique edge identifier
119
+ */
120
+ id: string;
121
+
122
+ /**
123
+ * Source node identifier
124
+ */
125
+ source: string;
126
+
127
+ /**
128
+ * Target node identifier
129
+ */
130
+ target: string;
131
+
132
+ /**
133
+ * Edge type
134
+ */
135
+ type?: WorkflowEdgeType;
136
+
137
+ /**
138
+ * Display label
139
+ */
140
+ label?: string;
141
+
142
+ /**
143
+ * Condition expression for conditional edges
144
+ */
145
+ condition?: string;
146
+ }
147
+
148
+ /**
149
+ * Rule governing how approvals are processed
150
+ */
151
+ export interface ApprovalRule {
152
+ /**
153
+ * Approval strategy type
154
+ */
155
+ type: 'any' | 'all' | 'majority' | 'sequential';
156
+
157
+ /**
158
+ * Minimum number of approvals required
159
+ */
160
+ minApprovals?: number;
161
+
162
+ /**
163
+ * Timeout duration in minutes
164
+ */
165
+ timeout?: number;
166
+
167
+ /**
168
+ * Identifier to escalate to on timeout
169
+ */
170
+ escalateTo?: string;
171
+
172
+ /**
173
+ * Expression that triggers automatic approval
174
+ */
175
+ autoApproveCondition?: string;
176
+ }
177
+
178
+ /**
179
+ * Variable definition for workflow context
180
+ */
181
+ export interface WorkflowVariable {
182
+ /**
183
+ * Variable name
184
+ */
185
+ name: string;
186
+
187
+ /**
188
+ * Variable data type
189
+ */
190
+ type: 'string' | 'number' | 'boolean' | 'date' | 'object';
191
+
192
+ /**
193
+ * Default value
194
+ */
195
+ defaultValue?: any;
196
+
197
+ /**
198
+ * Whether the variable is required
199
+ */
200
+ required?: boolean;
201
+ }
202
+
203
+ /**
204
+ * Workflow Schema - Main workflow definition
205
+ */
206
+ export interface WorkflowSchema extends BaseSchema {
207
+ type: 'workflow';
208
+
209
+ /**
210
+ * Workflow title
211
+ */
212
+ title?: string;
213
+
214
+ /**
215
+ * Workflow description
216
+ */
217
+ description?: string;
218
+
219
+ /**
220
+ * Current workflow status
221
+ */
222
+ status?: WorkflowStatus;
223
+
224
+ /**
225
+ * Workflow nodes
226
+ */
227
+ nodes: WorkflowNode[];
228
+
229
+ /**
230
+ * Workflow edges
231
+ */
232
+ edges: WorkflowEdge[];
233
+
234
+ /**
235
+ * Workflow variables
236
+ */
237
+ variables?: WorkflowVariable[];
238
+
239
+ /**
240
+ * Workflow version number
241
+ */
242
+ version?: number;
243
+ }
244
+
245
+ /**
246
+ * Workflow Designer Schema - Visual workflow editor component
247
+ */
248
+ export interface WorkflowDesignerSchema extends BaseSchema {
249
+ type: 'workflow-designer';
250
+
251
+ /**
252
+ * Workflow to edit
253
+ */
254
+ workflow?: WorkflowSchema;
255
+
256
+ /**
257
+ * Whether the designer is in read-only mode
258
+ */
259
+ readOnly?: boolean;
260
+
261
+ /**
262
+ * Show minimap navigation panel
263
+ */
264
+ showMinimap?: boolean;
265
+
266
+ /**
267
+ * Show designer toolbar
268
+ */
269
+ showToolbar?: boolean;
270
+
271
+ /**
272
+ * Save callback action
273
+ */
274
+ onSave?: string;
275
+
276
+ /**
277
+ * Publish callback action
278
+ */
279
+ onPublish?: string;
280
+ }
281
+
282
+ /**
283
+ * A single entry in the approval history
284
+ */
285
+ export interface ApprovalHistoryItem {
286
+ /**
287
+ * Node where the action was taken
288
+ */
289
+ nodeId: string;
290
+
291
+ /**
292
+ * Action that was performed
293
+ */
294
+ action: string;
295
+
296
+ /**
297
+ * Actor identifier
298
+ */
299
+ actor: string;
300
+
301
+ /**
302
+ * Display name of the actor
303
+ */
304
+ actorName?: string;
305
+
306
+ /**
307
+ * ISO 8601 timestamp of the action
308
+ */
309
+ timestamp: string;
310
+
311
+ /**
312
+ * Optional comment
313
+ */
314
+ comment?: string;
315
+ }
316
+
317
+ /**
318
+ * Approval Process Schema - Approval workflow UI component
319
+ */
320
+ export interface ApprovalProcessSchema extends BaseSchema {
321
+ type: 'approval-process';
322
+
323
+ /**
324
+ * Associated workflow identifier
325
+ */
326
+ workflowId?: string;
327
+
328
+ /**
329
+ * Workflow instance identifier
330
+ */
331
+ instanceId?: string;
332
+
333
+ /**
334
+ * Current active node identifier
335
+ */
336
+ currentNodeId?: string;
337
+
338
+ /**
339
+ * Approval rule configuration
340
+ */
341
+ approvalRule?: ApprovalRule;
342
+
343
+ /**
344
+ * Approval history entries
345
+ */
346
+ history?: ApprovalHistoryItem[];
347
+
348
+ /**
349
+ * Approval process data
350
+ */
351
+ data?: Record<string, any>;
352
+
353
+ /**
354
+ * Show approval history timeline
355
+ */
356
+ showHistory?: boolean;
357
+
358
+ /**
359
+ * Show comments section
360
+ */
361
+ showComments?: boolean;
362
+ }
363
+
364
+ /**
365
+ * Workflow Instance Schema - Runtime state of a workflow execution
366
+ */
367
+ export interface WorkflowInstanceSchema extends BaseSchema {
368
+ type: 'workflow-instance';
369
+
370
+ /**
371
+ * Associated workflow definition identifier
372
+ */
373
+ workflowId: string;
374
+
375
+ /**
376
+ * Unique instance identifier
377
+ */
378
+ instanceId: string;
379
+
380
+ /**
381
+ * Current instance status
382
+ */
383
+ status: WorkflowStatus;
384
+
385
+ /**
386
+ * Currently active node identifiers
387
+ */
388
+ currentNodes: string[];
389
+
390
+ /**
391
+ * Runtime variable values
392
+ */
393
+ variables?: Record<string, any>;
394
+
395
+ /**
396
+ * ISO 8601 timestamp when the instance started
397
+ */
398
+ startedAt?: string;
399
+
400
+ /**
401
+ * ISO 8601 timestamp when the instance completed
402
+ */
403
+ completedAt?: string;
404
+
405
+ /**
406
+ * Instance data payload
407
+ */
408
+ data?: Record<string, any>;
409
+ }
@@ -148,7 +148,7 @@ export const ComponentSchema = BaseSchema.extend({
148
148
  /**
149
149
  * Union of all block schemas
150
150
  */
151
- export const BlockComponentSchema = z.union([
151
+ export const BlockComponentSchema = z.discriminatedUnion('type', [
152
152
  BlockSchema,
153
153
  BlockLibrarySchema,
154
154
  BlockEditorSchema,
@@ -248,7 +248,7 @@ export const DashboardSchema = BaseSchema.extend({
248
248
  /**
249
249
  * Complex Schema Union - All complex component schemas
250
250
  */
251
- export const ComplexSchema = z.union([
251
+ export const ComplexSchema = z.discriminatedUnion('type', [
252
252
  KanbanSchema,
253
253
  CalendarViewSchema,
254
254
  FilterBuilderSchema,
@@ -273,7 +273,7 @@ export const HtmlSchema = BaseSchema.extend({
273
273
  /**
274
274
  * Data Display Schema Union - All data display component schemas
275
275
  */
276
- export const DataDisplaySchema = z.union([
276
+ export const DataDisplaySchema = z.discriminatedUnion('type', [
277
277
  AlertSchema,
278
278
  StatisticSchema,
279
279
  BadgeSchema,
@@ -85,7 +85,7 @@ export const ToggleGroupSchema = BaseSchema.extend({
85
85
  /**
86
86
  * Disclosure Schema Union - All disclosure component schemas
87
87
  */
88
- export const DisclosureSchema = z.union([
88
+ export const DisclosureSchema = z.discriminatedUnion('type', [
89
89
  AccordionSchema,
90
90
  CollapsibleSchema,
91
91
  ToggleGroupSchema,
@@ -126,7 +126,7 @@ export const SonnerSchema = BaseSchema.extend({
126
126
  /**
127
127
  * Feedback Schema Union - All feedback component schemas
128
128
  */
129
- export const FeedbackSchema = z.union([
129
+ export const FeedbackSchema = z.discriminatedUnion('type', [
130
130
  LoadingSchema,
131
131
  ProgressSchema,
132
132
  SkeletonSchema,
@@ -413,7 +413,7 @@ export const FormSchema = BaseSchema.extend({
413
413
  /**
414
414
  * Form Component Schema Union - All form component schemas
415
415
  */
416
- export const FormComponentSchema = z.union([
416
+ export const FormComponentSchema = z.discriminatedUnion('type', [
417
417
  ButtonSchema,
418
418
  InputSchema,
419
419
  TextareaSchema,
@@ -78,6 +78,10 @@ export {
78
78
  ResizablePanelSchema,
79
79
  ResizableSchema,
80
80
  AspectRatioSchema,
81
+ PageRegionWidthSchema,
82
+ PageRegionSchema,
83
+ PageVariableSchema,
84
+ PageTypeSchema,
81
85
  PageSchema,
82
86
  LayoutSchema,
83
87
  } from './layout.zod.js';
@@ -273,14 +277,21 @@ export {
273
277
  export {
274
278
  ColorPaletteSchema,
275
279
  TypographySchema,
280
+ SpacingSchema,
276
281
  SpacingScaleSchema,
277
282
  BorderRadiusSchema,
283
+ ShadowSchema,
284
+ BreakpointsSchema,
285
+ AnimationSchema,
286
+ ZIndexSchema,
287
+ ThemeLogoSchema,
278
288
  ThemeModeSchema,
279
289
  ThemeDefinitionSchema,
280
290
  ThemeSchema,
291
+ ThemeComponentSchema,
292
+ ThemeUnionSchema,
281
293
  ThemeSwitcherSchema,
282
294
  ThemePreviewSchema,
283
- ThemeComponentSchema,
284
295
  } from './theme.zod.js';
285
296
 
286
297
  export {
@@ -340,7 +351,7 @@ import { NavigationSchema } from './navigation.zod.js';
340
351
  import { ComplexSchema } from './complex.zod.js';
341
352
  import { ObjectQLComponentSchema } from './objectql.zod.js';
342
353
  import { CRUDComponentSchema } from './crud.zod.js';
343
- import { ThemeComponentSchema } from './theme.zod.js';
354
+ import { ThemeUnionSchema } from './theme.zod.js';
344
355
  import { ReportComponentSchema } from './reports.zod.js';
345
356
  import { BlockComponentSchema } from './blocks.zod.js';
346
357
  import { ViewComponentSchema } from './views.zod.js';
@@ -361,7 +372,7 @@ export const AnyComponentSchema = z.union([
361
372
  ComplexSchema,
362
373
  ObjectQLComponentSchema,
363
374
  CRUDComponentSchema,
364
- ThemeComponentSchema,
375
+ ThemeUnionSchema,
365
376
  ReportComponentSchema,
366
377
  BlockComponentSchema,
367
378
  ViewComponentSchema,
@@ -227,22 +227,60 @@ export const AspectRatioSchema = BaseSchema.extend({
227
227
  children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
228
228
  });
229
229
 
230
+ /**
231
+ * Page Region Width Schema
232
+ */
233
+ export const PageRegionWidthSchema = z.enum(['small', 'medium', 'large', 'full']);
234
+
235
+ /**
236
+ * Page Region Schema
237
+ */
238
+ export const PageRegionSchema = z.object({
239
+ name: z.string().describe('Region name (e.g. "sidebar", "main", "header")'),
240
+ type: z.enum(['header', 'sidebar', 'main', 'footer', 'aside']).optional().describe('Semantic region type'),
241
+ width: z.union([PageRegionWidthSchema, z.string()]).optional().describe('Region width'),
242
+ components: z.array(SchemaNodeSchema).describe('Components in this region'),
243
+ className: z.string().optional().describe('CSS class overrides'),
244
+ });
245
+
246
+ /**
247
+ * Page Variable Schema
248
+ */
249
+ export const PageVariableSchema = z.object({
250
+ name: z.string().describe('Variable name'),
251
+ type: z.enum(['string', 'number', 'boolean', 'object', 'array']).optional().default('string').describe('Variable type'),
252
+ defaultValue: z.any().optional().describe('Default value'),
253
+ });
254
+
255
+ /**
256
+ * Page Type Schema
257
+ */
258
+ export const PageTypeSchema = z.enum(['record', 'home', 'app', 'utility']);
259
+
230
260
  /**
231
261
  * Page Schema - Top-level page layout
262
+ * Aligned with @objectstack/spec PageSchema
232
263
  */
233
264
  export const PageSchema = BaseSchema.extend({
234
265
  type: z.literal('page'),
235
266
  title: z.string().optional().describe('Page title'),
236
267
  icon: z.string().optional().describe('Page icon (Lucide icon name)'),
237
268
  description: z.string().optional().describe('Page description'),
269
+ pageType: PageTypeSchema.optional().describe('Page type (record, home, app, utility)'),
270
+ object: z.string().optional().describe('Bound object name (for record pages)'),
271
+ template: z.string().optional().default('default').describe('Layout template name'),
272
+ variables: z.array(PageVariableSchema).optional().describe('Local page state variables'),
273
+ regions: z.array(PageRegionSchema).optional().describe('Page layout regions'),
238
274
  body: z.array(SchemaNodeSchema).optional().describe('Main content array'),
239
275
  children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Alternative content prop'),
276
+ isDefault: z.boolean().optional().default(false).describe('Whether this is the default page'),
277
+ assignedProfiles: z.array(z.string()).optional().describe('Profiles that can access this page'),
240
278
  });
241
279
 
242
280
  /**
243
281
  * Layout Schema Union - All layout component schemas
244
282
  */
245
- export const LayoutSchema = z.union([
283
+ export const LayoutSchema = z.discriminatedUnion('type', [
246
284
  DivSchema,
247
285
  SpanSchema,
248
286
  TextSchema,
@@ -149,7 +149,7 @@ export const ButtonGroupSchema = BaseSchema.extend({
149
149
  /**
150
150
  * Navigation Schema Union - All navigation component schemas
151
151
  */
152
- export const NavigationSchema = z.union([
152
+ export const NavigationSchema = z.discriminatedUnion('type', [
153
153
  HeaderBarSchema,
154
154
  SidebarSchema,
155
155
  BreadcrumbSchema,
@@ -21,11 +21,13 @@ import { BaseSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * HTTP Method Schema
24
+ * Mirrors @objectstack/spec/ui HttpMethodSchema.
24
25
  */
25
26
  export const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
26
27
 
27
28
  /**
28
29
  * HTTP Request Schema
30
+ * Mirrors @objectstack/spec/ui HttpRequestSchema.
29
31
  */
30
32
  export const HttpRequestSchema = z.object({
31
33
  url: z.string().describe('API endpoint URL'),
@@ -37,6 +39,7 @@ export const HttpRequestSchema = z.object({
37
39
 
38
40
  /**
39
41
  * View Data Source Schema
42
+ * Mirrors @objectstack/spec/ui ViewDataSchema.
40
43
  */
41
44
  export const ViewDataSchema = z.union([
42
45
  z.object({
@@ -56,6 +59,7 @@ export const ViewDataSchema = z.union([
56
59
 
57
60
  /**
58
61
  * List Column Schema
62
+ * Mirrors @objectstack/spec/ui ListColumnSchema.
59
63
  */
60
64
  export const ListColumnSchema = z.object({
61
65
  field: z.string().describe('Field name'),
@@ -67,10 +71,13 @@ export const ListColumnSchema = z.object({
67
71
  resizable: z.boolean().optional().describe('Allow resizing'),
68
72
  wrap: z.boolean().optional().describe('Allow text wrapping'),
69
73
  type: z.string().optional().describe('Renderer type override'),
74
+ link: z.boolean().optional().describe('Functions as the primary navigation link (triggers View navigation)'),
75
+ action: z.string().optional().describe('Registered Action ID to execute when clicked'),
70
76
  });
71
77
 
72
78
  /**
73
79
  * Selection Config Schema
80
+ * Mirrors @objectstack/spec/ui SelectionConfigSchema.
74
81
  */
75
82
  export const SelectionConfigSchema = z.object({
76
83
  type: z.enum(['none', 'single', 'multiple']).optional().describe('Selection mode'),
@@ -78,6 +85,7 @@ export const SelectionConfigSchema = z.object({
78
85
 
79
86
  /**
80
87
  * Pagination Config Schema
88
+ * Mirrors @objectstack/spec/ui PaginationConfigSchema.
81
89
  */
82
90
  export const PaginationConfigSchema = z.object({
83
91
  pageSize: z.number().optional().describe('Page size'),
@@ -182,7 +182,7 @@ export const MenubarSchema = BaseSchema.extend({
182
182
  /**
183
183
  * Overlay Schema Union - All overlay component schemas
184
184
  */
185
- export const OverlaySchema = z.union([
185
+ export const OverlaySchema = z.discriminatedUnion('type', [
186
186
  DialogSchema,
187
187
  AlertDialogSchema,
188
188
  SheetSchema,
@@ -160,7 +160,7 @@ export const ReportViewerSchema = BaseSchema.extend({
160
160
  /**
161
161
  * Union of all report schemas
162
162
  */
163
- export const ReportComponentSchema = z.union([
163
+ export const ReportComponentSchema = z.discriminatedUnion('type', [
164
164
  ReportSchema,
165
165
  ReportBuilderSchema,
166
166
  ReportViewerSchema,