@objectql/types 1.6.1 → 1.7.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/package.json +10 -3
- package/schemas/app.schema.json +50 -0
- package/schemas/menu.schema.json +129 -0
- package/schemas/object.schema.json +1384 -0
- package/schemas/page.schema.json +604 -0
- package/CHANGELOG.md +0 -62
- package/jest.config.js +0 -5
- package/src/action.ts +0 -96
- package/src/app.ts +0 -23
- package/src/application.ts +0 -46
- package/src/config.ts +0 -37
- package/src/context.ts +0 -45
- package/src/driver.ts +0 -27
- package/src/field.ts +0 -149
- package/src/hook.ts +0 -131
- package/src/index.ts +0 -18
- package/src/loader.ts +0 -17
- package/src/menu.ts +0 -102
- package/src/object.ts +0 -60
- package/src/page.ts +0 -332
- package/src/permission.ts +0 -477
- package/src/plugin.ts +0 -6
- package/src/query.ts +0 -23
- package/src/registry.ts +0 -61
- package/src/repository.ts +0 -17
- package/src/validation.ts +0 -390
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/src/object.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { FieldConfig } from './field';
|
|
2
|
-
import { ActionConfig } from './action';
|
|
3
|
-
import { AnyValidationRule } from './validation';
|
|
4
|
-
|
|
5
|
-
export interface IndexConfig {
|
|
6
|
-
/** List of fields involved in the index */
|
|
7
|
-
fields: string[];
|
|
8
|
-
/** Whether the index enforces uniqueness */
|
|
9
|
-
unique?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AiSearchConfig {
|
|
13
|
-
/** Enable semantic search for this object */
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
/** Fields to include in the embedding generation */
|
|
16
|
-
fields: string[];
|
|
17
|
-
/** The AI model to use for embedding (e.g. 'openai/text-embedding-3-small') */
|
|
18
|
-
model?: string;
|
|
19
|
-
/** Optional: Target vector field name if manually defined */
|
|
20
|
-
target_field?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ObjectAiConfig {
|
|
24
|
-
/** Configuration for semantic search / RAG */
|
|
25
|
-
search?: AiSearchConfig;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ObjectConfig {
|
|
29
|
-
name: string;
|
|
30
|
-
datasource?: string; // The name of the datasource to use
|
|
31
|
-
label?: string;
|
|
32
|
-
icon?: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
|
|
35
|
-
fields: Record<string, FieldConfig>;
|
|
36
|
-
indexes?: Record<string, IndexConfig>;
|
|
37
|
-
/** AI capabilities configuration */
|
|
38
|
-
ai?: ObjectAiConfig;
|
|
39
|
-
actions?: Record<string, ActionConfig>;
|
|
40
|
-
/** Validation rules for this object */
|
|
41
|
-
validation?: {
|
|
42
|
-
/** Validation rules */
|
|
43
|
-
rules?: AnyValidationRule[];
|
|
44
|
-
/** AI context for validation strategy */
|
|
45
|
-
ai_context?: {
|
|
46
|
-
intent?: string;
|
|
47
|
-
validation_strategy?: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Base interface for all ObjectQL documents.
|
|
54
|
-
*/
|
|
55
|
-
export interface ObjectDoc {
|
|
56
|
-
_id?: string | number;
|
|
57
|
-
created_at?: Date | string;
|
|
58
|
-
updated_at?: Date | string;
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
}
|
package/src/page.ts
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Page Metadata Definition
|
|
3
|
-
*
|
|
4
|
-
* Defines the structure for pages in ObjectQL applications.
|
|
5
|
-
* Inspired by low-code platforms like Airtable, Retool, Appsmith, and Salesforce Lightning.
|
|
6
|
-
*
|
|
7
|
-
* Pages are composable UI containers that can render data from objects,
|
|
8
|
-
* display custom components, and orchestrate user interactions.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Layout types for page arrangement
|
|
13
|
-
*/
|
|
14
|
-
export type PageLayoutType =
|
|
15
|
-
| 'single_column' // Single vertical column
|
|
16
|
-
| 'two_column' // Left and right columns
|
|
17
|
-
| 'three_column' // Left, center, right columns
|
|
18
|
-
| 'dashboard' // Grid-based dashboard layout
|
|
19
|
-
| 'canvas' // Free-form canvas with absolute positioning
|
|
20
|
-
| 'tabs' // Tab-based layout
|
|
21
|
-
| 'wizard' // Step-by-step wizard
|
|
22
|
-
| 'custom'; // Custom layout defined by component
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Component types that can be placed on a page
|
|
26
|
-
*/
|
|
27
|
-
export type PageComponentType =
|
|
28
|
-
| 'data_grid' // Table/grid displaying records
|
|
29
|
-
| 'form' // Data entry form
|
|
30
|
-
| 'detail_view' // Record detail display
|
|
31
|
-
| 'chart' // Visualization (bar, line, pie, etc.)
|
|
32
|
-
| 'metric' // Single metric/KPI display
|
|
33
|
-
| 'list' // List view of records
|
|
34
|
-
| 'calendar' // Calendar view
|
|
35
|
-
| 'kanban' // Kanban board
|
|
36
|
-
| 'timeline' // Timeline/Gantt chart
|
|
37
|
-
| 'text' // Static text/markdown content
|
|
38
|
-
| 'html' // Custom HTML content
|
|
39
|
-
| 'iframe' // Embedded external content
|
|
40
|
-
| 'button' // Action button
|
|
41
|
-
| 'tabs' // Tab container
|
|
42
|
-
| 'container' // Generic container for grouping
|
|
43
|
-
| 'divider' // Visual separator
|
|
44
|
-
| 'image' // Image display
|
|
45
|
-
| 'custom'; // Custom component
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Responsive breakpoint configuration
|
|
49
|
-
*/
|
|
50
|
-
export interface ResponsiveConfig {
|
|
51
|
-
/** Mobile viewport (< 640px) */
|
|
52
|
-
mobile?: {
|
|
53
|
-
columns?: number;
|
|
54
|
-
visible?: boolean;
|
|
55
|
-
order?: number;
|
|
56
|
-
};
|
|
57
|
-
/** Tablet viewport (640px - 1024px) */
|
|
58
|
-
tablet?: {
|
|
59
|
-
columns?: number;
|
|
60
|
-
visible?: boolean;
|
|
61
|
-
order?: number;
|
|
62
|
-
};
|
|
63
|
-
/** Desktop viewport (> 1024px) */
|
|
64
|
-
desktop?: {
|
|
65
|
-
columns?: number;
|
|
66
|
-
visible?: boolean;
|
|
67
|
-
order?: number;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Data source configuration for components
|
|
73
|
-
*/
|
|
74
|
-
export interface ComponentDataSource {
|
|
75
|
-
/** Object name to query */
|
|
76
|
-
object?: string;
|
|
77
|
-
/** Filter conditions */
|
|
78
|
-
filters?: any[];
|
|
79
|
-
/** Fields to display */
|
|
80
|
-
fields?: string[];
|
|
81
|
-
/** Sort configuration */
|
|
82
|
-
sort?: Array<[string, 'asc' | 'desc']>;
|
|
83
|
-
/** Maximum records to fetch */
|
|
84
|
-
limit?: number;
|
|
85
|
-
/** Enable pagination */
|
|
86
|
-
paginate?: boolean;
|
|
87
|
-
/** Related objects to expand */
|
|
88
|
-
expand?: Record<string, any>;
|
|
89
|
-
/** Custom query override */
|
|
90
|
-
query?: any;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Action triggered by component interaction
|
|
95
|
-
*/
|
|
96
|
-
export interface ComponentAction {
|
|
97
|
-
/** Action type */
|
|
98
|
-
type: 'navigate' | 'open_modal' | 'run_action' | 'submit_form' | 'refresh' | 'custom';
|
|
99
|
-
/** Navigation path (for type: navigate) */
|
|
100
|
-
path?: string;
|
|
101
|
-
/** Modal component to open (for type: open_modal) */
|
|
102
|
-
modal?: string;
|
|
103
|
-
/** Action name to execute (for type: run_action) */
|
|
104
|
-
action?: string;
|
|
105
|
-
/** Target object for action */
|
|
106
|
-
object?: string;
|
|
107
|
-
/** Custom handler function */
|
|
108
|
-
handler?: string;
|
|
109
|
-
/** Confirmation message before executing */
|
|
110
|
-
confirm?: string;
|
|
111
|
-
/** Success message after execution */
|
|
112
|
-
success_message?: string;
|
|
113
|
-
/** Error handling */
|
|
114
|
-
on_error?: 'show_toast' | 'show_modal' | 'ignore';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Styling configuration for components
|
|
119
|
-
*/
|
|
120
|
-
export interface ComponentStyle {
|
|
121
|
-
/** Width (e.g., '100%', '300px', 'auto') */
|
|
122
|
-
width?: string;
|
|
123
|
-
/** Height */
|
|
124
|
-
height?: string;
|
|
125
|
-
/** Minimum width */
|
|
126
|
-
min_width?: string;
|
|
127
|
-
/** Minimum height */
|
|
128
|
-
min_height?: string;
|
|
129
|
-
/** Background color */
|
|
130
|
-
background?: string;
|
|
131
|
-
/** Text color */
|
|
132
|
-
color?: string;
|
|
133
|
-
/** Border */
|
|
134
|
-
border?: string;
|
|
135
|
-
/** Border radius */
|
|
136
|
-
border_radius?: string;
|
|
137
|
-
/** Padding */
|
|
138
|
-
padding?: string;
|
|
139
|
-
/** Margin */
|
|
140
|
-
margin?: string;
|
|
141
|
-
/** Custom CSS classes */
|
|
142
|
-
class_name?: string;
|
|
143
|
-
/** Inline styles */
|
|
144
|
-
custom_css?: Record<string, any>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Base component configuration
|
|
149
|
-
*/
|
|
150
|
-
export interface PageComponent {
|
|
151
|
-
/** Unique component identifier within the page */
|
|
152
|
-
id: string;
|
|
153
|
-
/** Component type */
|
|
154
|
-
type: PageComponentType;
|
|
155
|
-
/** Display label */
|
|
156
|
-
label?: string;
|
|
157
|
-
/** Component description */
|
|
158
|
-
description?: string;
|
|
159
|
-
|
|
160
|
-
/** Data source configuration */
|
|
161
|
-
data_source?: ComponentDataSource;
|
|
162
|
-
|
|
163
|
-
/** Component-specific configuration */
|
|
164
|
-
config?: Record<string, any>;
|
|
165
|
-
|
|
166
|
-
/** Actions triggered by this component */
|
|
167
|
-
actions?: {
|
|
168
|
-
on_click?: ComponentAction;
|
|
169
|
-
on_submit?: ComponentAction;
|
|
170
|
-
on_load?: ComponentAction;
|
|
171
|
-
on_change?: ComponentAction;
|
|
172
|
-
[key: string]: ComponentAction | undefined;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
/** Visual styling */
|
|
176
|
-
style?: ComponentStyle;
|
|
177
|
-
|
|
178
|
-
/** Responsive behavior */
|
|
179
|
-
responsive?: ResponsiveConfig;
|
|
180
|
-
|
|
181
|
-
/** Visibility conditions */
|
|
182
|
-
visible_when?: Record<string, any>;
|
|
183
|
-
|
|
184
|
-
/** Access control */
|
|
185
|
-
permissions?: string[];
|
|
186
|
-
|
|
187
|
-
/** Nested components (for containers, tabs, etc.) */
|
|
188
|
-
components?: PageComponent[];
|
|
189
|
-
|
|
190
|
-
/** Grid position (for dashboard layout) */
|
|
191
|
-
grid?: {
|
|
192
|
-
x: number;
|
|
193
|
-
y: number;
|
|
194
|
-
w: number; // width in grid units
|
|
195
|
-
h: number; // height in grid units
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
/** Custom component reference */
|
|
199
|
-
component?: string;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Page section/region configuration
|
|
204
|
-
*/
|
|
205
|
-
export interface PageSection {
|
|
206
|
-
/** Section identifier */
|
|
207
|
-
id: string;
|
|
208
|
-
/** Section label */
|
|
209
|
-
label?: string;
|
|
210
|
-
/** Section type */
|
|
211
|
-
type?: 'header' | 'sidebar' | 'content' | 'footer' | 'custom';
|
|
212
|
-
/** Components in this section */
|
|
213
|
-
components: PageComponent[];
|
|
214
|
-
/** Section styling */
|
|
215
|
-
style?: ComponentStyle;
|
|
216
|
-
/** Collapsible section */
|
|
217
|
-
collapsible?: boolean;
|
|
218
|
-
/** Default collapsed state */
|
|
219
|
-
collapsed?: boolean;
|
|
220
|
-
/** Visibility conditions */
|
|
221
|
-
visible_when?: Record<string, any>;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Page metadata configuration
|
|
226
|
-
*/
|
|
227
|
-
export interface PageConfig {
|
|
228
|
-
/** Unique page identifier */
|
|
229
|
-
name: string;
|
|
230
|
-
/** Display label */
|
|
231
|
-
label: string;
|
|
232
|
-
/** Page description */
|
|
233
|
-
description?: string;
|
|
234
|
-
/** Icon for navigation */
|
|
235
|
-
icon?: string;
|
|
236
|
-
|
|
237
|
-
/** Layout type */
|
|
238
|
-
layout: PageLayoutType;
|
|
239
|
-
|
|
240
|
-
/** Page sections */
|
|
241
|
-
sections?: PageSection[];
|
|
242
|
-
|
|
243
|
-
/** Components (alternative to sections for simple layouts) */
|
|
244
|
-
components?: PageComponent[];
|
|
245
|
-
|
|
246
|
-
/** Page-level data sources */
|
|
247
|
-
data_sources?: Record<string, ComponentDataSource>;
|
|
248
|
-
|
|
249
|
-
/** Page-level actions */
|
|
250
|
-
actions?: Record<string, ComponentAction>;
|
|
251
|
-
|
|
252
|
-
/** Page styling */
|
|
253
|
-
style?: ComponentStyle;
|
|
254
|
-
|
|
255
|
-
/** Access control */
|
|
256
|
-
permissions?: {
|
|
257
|
-
/** Roles allowed to view this page */
|
|
258
|
-
view?: string[];
|
|
259
|
-
/** Roles allowed to edit this page */
|
|
260
|
-
edit?: string[];
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
/** SEO and metadata */
|
|
264
|
-
meta?: {
|
|
265
|
-
title?: string;
|
|
266
|
-
description?: string;
|
|
267
|
-
keywords?: string[];
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
/** Page state management */
|
|
271
|
-
state?: {
|
|
272
|
-
/** Initial state values */
|
|
273
|
-
initial?: Record<string, any>;
|
|
274
|
-
/** State persistence */
|
|
275
|
-
persist?: boolean;
|
|
276
|
-
/** Storage key for persistence */
|
|
277
|
-
storage_key?: string;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
/** Responsive configuration */
|
|
281
|
-
responsive?: ResponsiveConfig;
|
|
282
|
-
|
|
283
|
-
/** Custom page handler/controller */
|
|
284
|
-
handler?: string;
|
|
285
|
-
|
|
286
|
-
/** Enable real-time updates */
|
|
287
|
-
realtime?: boolean;
|
|
288
|
-
|
|
289
|
-
/** Refresh interval in seconds */
|
|
290
|
-
refresh_interval?: number;
|
|
291
|
-
|
|
292
|
-
/** AI context for page generation and understanding */
|
|
293
|
-
ai_context?: {
|
|
294
|
-
/** Purpose of the page */
|
|
295
|
-
intent?: string;
|
|
296
|
-
/** Target user persona */
|
|
297
|
-
persona?: string;
|
|
298
|
-
/** Key user tasks */
|
|
299
|
-
tasks?: string[];
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Lightweight page reference (for menus, navigation, etc.)
|
|
305
|
-
*
|
|
306
|
-
* Used in application navigation menus and links to reference pages
|
|
307
|
-
* without loading the full page configuration. This is useful for:
|
|
308
|
-
* - Building navigation menus
|
|
309
|
-
* - Creating page links
|
|
310
|
-
* - Page selection dropdowns
|
|
311
|
-
*
|
|
312
|
-
* @example
|
|
313
|
-
* ```typescript
|
|
314
|
-
* // In navigation menu
|
|
315
|
-
* const menuItem: PageReference = {
|
|
316
|
-
* name: 'dashboard',
|
|
317
|
-
* label: 'Dashboard',
|
|
318
|
-
* icon: 'dashboard',
|
|
319
|
-
* path: '/dashboard'
|
|
320
|
-
* };
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
export interface PageReference {
|
|
324
|
-
/** Page name/identifier */
|
|
325
|
-
name: string;
|
|
326
|
-
/** Display label */
|
|
327
|
-
label?: string;
|
|
328
|
-
/** Icon */
|
|
329
|
-
icon?: string;
|
|
330
|
-
/** Path/route */
|
|
331
|
-
path?: string;
|
|
332
|
-
}
|