@object-ui/types 0.3.1 → 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.
Files changed (141) 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 +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
package/src/ai.ts ADDED
@@ -0,0 +1,454 @@
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 - AI Schema
11
+ *
12
+ * Defines AI-related UI component schemas for intelligent form assistance,
13
+ * recommendations, natural language queries, and data insights.
14
+ */
15
+
16
+ import type { BaseSchema } from './base';
17
+
18
+ /**
19
+ * AI Provider Type
20
+ */
21
+ export type AIProvider = 'openai' | 'anthropic' | 'google' | 'azure' | 'custom';
22
+
23
+ /**
24
+ * AI Model Type
25
+ */
26
+ export type AIModelType = 'gpt-4' | 'gpt-3.5-turbo' | 'claude-3' | 'gemini-pro' | 'custom';
27
+
28
+ /**
29
+ * AI Configuration
30
+ */
31
+ export interface AIConfig {
32
+ /**
33
+ * AI provider to use
34
+ */
35
+ provider?: AIProvider;
36
+
37
+ /**
38
+ * Model identifier
39
+ */
40
+ model?: AIModelType | string;
41
+
42
+ /**
43
+ * Custom API endpoint URL
44
+ */
45
+ apiEndpoint?: string;
46
+
47
+ /**
48
+ * Sampling temperature (0-1)
49
+ */
50
+ temperature?: number;
51
+
52
+ /**
53
+ * Maximum tokens for response
54
+ */
55
+ maxTokens?: number;
56
+
57
+ /**
58
+ * System prompt for the AI model
59
+ */
60
+ systemPrompt?: string;
61
+ }
62
+
63
+ /**
64
+ * AI Field Suggestion
65
+ */
66
+ export interface AIFieldSuggestion {
67
+ /**
68
+ * Name of the field being suggested
69
+ */
70
+ fieldName: string;
71
+
72
+ /**
73
+ * Suggested value for the field
74
+ */
75
+ value: any;
76
+
77
+ /**
78
+ * Confidence score (0-1)
79
+ */
80
+ confidence: number;
81
+
82
+ /**
83
+ * Explanation for the suggestion
84
+ */
85
+ reasoning?: string;
86
+ }
87
+
88
+ /**
89
+ * AI Form Assist Schema - Intelligent form field suggestions
90
+ */
91
+ export interface AIFormAssistSchema extends BaseSchema {
92
+ type: 'ai-form-assist';
93
+
94
+ /**
95
+ * Target form identifier
96
+ */
97
+ formId?: string;
98
+
99
+ /**
100
+ * Object name for context
101
+ */
102
+ objectName?: string;
103
+
104
+ /**
105
+ * Fields to provide suggestions for
106
+ */
107
+ fields?: string[];
108
+
109
+ /**
110
+ * Additional context for generating suggestions
111
+ */
112
+ context?: Record<string, any>;
113
+
114
+ /**
115
+ * AI configuration
116
+ */
117
+ config?: AIConfig;
118
+
119
+ /**
120
+ * Current suggestions
121
+ */
122
+ suggestions?: AIFieldSuggestion[];
123
+
124
+ /**
125
+ * Automatically fill fields with suggestions
126
+ */
127
+ autoFill?: boolean;
128
+
129
+ /**
130
+ * Show confidence scores for suggestions
131
+ */
132
+ showConfidence?: boolean;
133
+
134
+ /**
135
+ * Show reasoning for suggestions
136
+ */
137
+ showReasoning?: boolean;
138
+
139
+ /**
140
+ * Callback when a suggestion is applied
141
+ */
142
+ onApplySuggestion?: string;
143
+
144
+ /**
145
+ * Callback when a suggestion is rejected
146
+ */
147
+ onRejectSuggestion?: string;
148
+ }
149
+
150
+ /**
151
+ * AI Recommendation Item
152
+ */
153
+ export interface AIRecommendationItem {
154
+ /**
155
+ * Unique identifier
156
+ */
157
+ id: string;
158
+
159
+ /**
160
+ * Recommendation title
161
+ */
162
+ title: string;
163
+
164
+ /**
165
+ * Recommendation description
166
+ */
167
+ description?: string;
168
+
169
+ /**
170
+ * Relevance score (0-1)
171
+ */
172
+ score: number;
173
+
174
+ /**
175
+ * Recommendation category
176
+ */
177
+ category?: string;
178
+
179
+ /**
180
+ * Additional metadata
181
+ */
182
+ metadata?: Record<string, any>;
183
+
184
+ /**
185
+ * Action to perform when selected
186
+ */
187
+ action?: {
188
+ /**
189
+ * Action type
190
+ */
191
+ type: string;
192
+
193
+ /**
194
+ * Action target
195
+ */
196
+ target?: string;
197
+ };
198
+ }
199
+
200
+ /**
201
+ * AI Recommendations Schema - Intelligent content recommendations
202
+ */
203
+ export interface AIRecommendationsSchema extends BaseSchema {
204
+ type: 'ai-recommendations';
205
+
206
+ /**
207
+ * Object name for context
208
+ */
209
+ objectName?: string;
210
+
211
+ /**
212
+ * Additional context for generating recommendations
213
+ */
214
+ context?: Record<string, any>;
215
+
216
+ /**
217
+ * AI configuration
218
+ */
219
+ config?: AIConfig;
220
+
221
+ /**
222
+ * Current recommendations
223
+ */
224
+ recommendations?: AIRecommendationItem[];
225
+
226
+ /**
227
+ * Maximum number of results to display
228
+ */
229
+ maxResults?: number;
230
+
231
+ /**
232
+ * Show relevance scores
233
+ */
234
+ showScores?: boolean;
235
+
236
+ /**
237
+ * Display layout
238
+ */
239
+ layout?: 'list' | 'grid' | 'carousel';
240
+
241
+ /**
242
+ * Callback when a recommendation is selected
243
+ */
244
+ onSelect?: string;
245
+
246
+ /**
247
+ * Callback when a recommendation is dismissed
248
+ */
249
+ onDismiss?: string;
250
+
251
+ /**
252
+ * Loading state
253
+ */
254
+ loading?: boolean;
255
+
256
+ /**
257
+ * Message to display when no recommendations are available
258
+ */
259
+ emptyMessage?: string;
260
+ }
261
+
262
+ /**
263
+ * Natural Language Query Result
264
+ */
265
+ export interface NLQueryResult {
266
+ /**
267
+ * Original query string
268
+ */
269
+ query: string;
270
+
271
+ /**
272
+ * Parsed query representation
273
+ */
274
+ parsedQuery?: Record<string, any>;
275
+
276
+ /**
277
+ * Result data
278
+ */
279
+ data?: any[];
280
+
281
+ /**
282
+ * Column definitions for the result data
283
+ */
284
+ columns?: Array<{
285
+ /**
286
+ * Column name
287
+ */
288
+ name: string;
289
+
290
+ /**
291
+ * Display label
292
+ */
293
+ label?: string;
294
+
295
+ /**
296
+ * Column data type
297
+ */
298
+ type?: string;
299
+ }>;
300
+
301
+ /**
302
+ * AI-generated summary of the results
303
+ */
304
+ summary?: string;
305
+
306
+ /**
307
+ * Confidence score for the query interpretation (0-1)
308
+ */
309
+ confidence?: number;
310
+ }
311
+
312
+ /**
313
+ * Natural Language Query Schema - Query data using natural language
314
+ */
315
+ export interface NLQuerySchema extends BaseSchema {
316
+ type: 'nl-query';
317
+
318
+ /**
319
+ * Object name for context
320
+ */
321
+ objectName?: string;
322
+
323
+ /**
324
+ * Input placeholder text
325
+ */
326
+ placeholder?: string;
327
+
328
+ /**
329
+ * AI configuration
330
+ */
331
+ config?: AIConfig;
332
+
333
+ /**
334
+ * Current query result
335
+ */
336
+ result?: NLQueryResult;
337
+
338
+ /**
339
+ * Example queries to suggest
340
+ */
341
+ suggestions?: string[];
342
+
343
+ /**
344
+ * Show query history
345
+ */
346
+ showHistory?: boolean;
347
+
348
+ /**
349
+ * Query history entries
350
+ */
351
+ history?: Array<{
352
+ /**
353
+ * Query string
354
+ */
355
+ query: string;
356
+
357
+ /**
358
+ * Timestamp of the query
359
+ */
360
+ timestamp: string;
361
+ }>;
362
+
363
+ /**
364
+ * Loading state
365
+ */
366
+ loading?: boolean;
367
+
368
+ /**
369
+ * Callback when a query is submitted
370
+ */
371
+ onSubmit?: string;
372
+ }
373
+
374
+ /**
375
+ * AI Insights Schema - AI-generated data insights and analysis
376
+ */
377
+ export interface AIInsightsSchema extends BaseSchema {
378
+ type: 'ai-insights';
379
+
380
+ /**
381
+ * Object name for context
382
+ */
383
+ objectName?: string;
384
+
385
+ /**
386
+ * Data to analyze
387
+ */
388
+ data?: any[];
389
+
390
+ /**
391
+ * AI configuration
392
+ */
393
+ config?: AIConfig;
394
+
395
+ /**
396
+ * Generated insights
397
+ */
398
+ insights?: Array<{
399
+ /**
400
+ * Insight title
401
+ */
402
+ title: string;
403
+
404
+ /**
405
+ * Insight description
406
+ */
407
+ description: string;
408
+
409
+ /**
410
+ * Insight type
411
+ */
412
+ type: 'trend' | 'anomaly' | 'prediction' | 'recommendation';
413
+
414
+ /**
415
+ * Severity level
416
+ */
417
+ severity?: 'info' | 'warning' | 'critical';
418
+
419
+ /**
420
+ * Associated metric
421
+ */
422
+ metric?: {
423
+ /**
424
+ * Metric value
425
+ */
426
+ value: number;
427
+
428
+ /**
429
+ * Change from previous period
430
+ */
431
+ change?: number;
432
+
433
+ /**
434
+ * Unit of measurement
435
+ */
436
+ unit?: string;
437
+ };
438
+ }>;
439
+
440
+ /**
441
+ * Loading state
442
+ */
443
+ loading?: boolean;
444
+
445
+ /**
446
+ * Automatically refresh insights
447
+ */
448
+ autoRefresh?: boolean;
449
+
450
+ /**
451
+ * Auto-refresh interval (in seconds)
452
+ */
453
+ refreshInterval?: number;
454
+ }
package/src/app.ts CHANGED
@@ -64,6 +64,18 @@ export interface AppSchema extends BaseSchema {
64
64
  * Global Actions (User Profile, Settings, etc)
65
65
  */
66
66
  actions?: AppAction[];
67
+
68
+ /**
69
+ * Home page ID (ObjectStack Spec v2.0.1)
70
+ * Default page to navigate to after login
71
+ */
72
+ homePageId?: string;
73
+
74
+ /**
75
+ * Required permissions (ObjectStack Spec v2.0.1)
76
+ * Permissions required to access this application
77
+ */
78
+ requiredPermissions?: string[];
67
79
  }
68
80
 
69
81
  /**