@object-ui/types 0.5.0 → 2.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.
- package/README.md +1 -1
- package/dist/ai.d.ts +376 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/app.d.ts +2 -2
- package/dist/crud.d.ts +3 -0
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-display.d.ts +35 -0
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-protocol.d.ts +19 -19
- package/dist/data.d.ts +68 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/designer.d.ts +473 -0
- package/dist/designer.d.ts.map +1 -0
- package/dist/designer.js +8 -0
- package/dist/form.d.ts +35 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/layout.d.ts +63 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/mobile.d.ts +186 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +8 -0
- package/dist/objectql.d.ts +329 -88
- package/dist/objectql.d.ts.map +1 -1
- package/dist/permissions.d.ts +150 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +8 -0
- package/dist/tenant.d.ts +138 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +8 -0
- package/dist/theme.d.ts +115 -224
- package/dist/theme.d.ts.map +1 -1
- package/dist/ui-action.d.ts +126 -11
- package/dist/ui-action.d.ts.map +1 -1
- package/dist/views.d.ts +10 -0
- package/dist/views.d.ts.map +1 -1
- package/dist/widget.d.ts +181 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +8 -0
- package/dist/workflow.d.ts +340 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +8 -0
- package/dist/zod/complex.zod.d.ts +4 -4
- package/dist/zod/crud.zod.d.ts +5 -5
- package/dist/zod/feedback.zod.d.ts +10 -10
- package/dist/zod/form.zod.d.ts +4 -4
- package/dist/zod/index.zod.d.ts +323 -132
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +4 -4
- package/dist/zod/layout.zod.d.ts +132 -0
- package/dist/zod/layout.zod.d.ts.map +1 -1
- package/dist/zod/layout.zod.js +34 -0
- package/dist/zod/objectql.zod.d.ts +32 -16
- package/dist/zod/objectql.zod.d.ts.map +1 -1
- package/dist/zod/objectql.zod.js +8 -0
- package/dist/zod/reports.zod.d.ts +17 -17
- package/dist/zod/theme.zod.d.ts +947 -266
- package/dist/zod/theme.zod.d.ts.map +1 -1
- package/dist/zod/theme.zod.js +175 -45
- package/dist/zod/views.zod.d.ts +20 -20
- package/package.json +3 -2
- package/src/__tests__/namespace-exports.test.ts +24 -68
- package/src/__tests__/phase2-schemas.test.ts +8 -13
- package/src/ai.ts +454 -0
- package/src/app.ts +2 -2
- package/src/crud.ts +3 -0
- package/src/data-display.ts +31 -0
- package/src/data-protocol.ts +19 -19
- package/src/data.ts +81 -0
- package/src/designer.ts +509 -0
- package/src/form.ts +35 -1
- package/src/index.ts +220 -8
- package/src/layout.ts +66 -8
- package/src/mobile.ts +205 -0
- package/src/objectql.ts +403 -93
- package/src/permissions.ts +166 -0
- package/src/tenant.ts +153 -0
- package/src/theme.ts +147 -260
- package/src/ui-action.ts +166 -27
- package/src/views.ts +7 -0
- package/src/widget.ts +197 -0
- package/src/workflow.ts +409 -0
- package/src/zod/index.zod.ts +14 -3
- package/src/zod/layout.zod.ts +38 -0
- package/src/zod/objectql.zod.ts +8 -0
- package/src/zod/theme.zod.ts +189 -48
package/src/workflow.ts
ADDED
|
@@ -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
|
+
}
|
package/src/zod/index.zod.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
375
|
+
ThemeUnionSchema,
|
|
365
376
|
ReportComponentSchema,
|
|
366
377
|
BlockComponentSchema,
|
|
367
378
|
ViewComponentSchema,
|
package/src/zod/layout.zod.ts
CHANGED
|
@@ -227,16 +227,54 @@ 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
|
/**
|
package/src/zod/objectql.zod.ts
CHANGED
|
@@ -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'),
|