@objectql/types 1.5.0 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @objectql/core
2
2
 
3
+ ## 1.6.1
4
+
5
+ ## 1.6.0
6
+
7
+ ### Minor Changes
8
+
9
+ - Minor version release - 1.6.0
10
+
3
11
  ## 1.5.0
4
12
 
5
13
  ### Minor Changes
package/dist/app.d.ts CHANGED
@@ -3,23 +3,14 @@ import { Driver } from "./driver";
3
3
  import { MetadataRegistry } from "./registry";
4
4
  import { HookName, HookHandler, HookContext } from "./hook";
5
5
  import { ActionHandler, ActionContext } from "./action";
6
- import { LoaderPlugin } from "./loader";
7
6
  export interface IObjectQL {
8
7
  getObject(name: string): ObjectConfig | undefined;
9
8
  getConfigs(): Record<string, ObjectConfig>;
10
9
  datasource(name: string): Driver;
11
10
  init(): Promise<void>;
12
- addPackage(name: string): void;
13
11
  removePackage(name: string): void;
14
12
  metadata: MetadataRegistry;
15
13
  registerObject(object: ObjectConfig): void;
16
- loadFromDirectory(dir: string): void;
17
- addLoader(plugin: LoaderPlugin): void;
18
- /**
19
- * Updates and persists metadata content.
20
- * Only works if the metadata was loaded from a writable file source (e.g. local disk).
21
- */
22
- updateMetadata(type: string, id: string, content: any): Promise<void>;
23
14
  on(event: HookName, objectName: string, handler: HookHandler): void;
24
15
  triggerHook(event: HookName, objectName: string, ctx: HookContext): Promise<void>;
25
16
  registerAction(objectName: string, actionName: string, handler: ActionHandler): void;
@@ -0,0 +1,38 @@
1
+ export interface AppConfig {
2
+ /**
3
+ * Unique identifier for the application
4
+ */
5
+ name: string;
6
+ /**
7
+ * Display label for the application
8
+ */
9
+ label: string;
10
+ /**
11
+ * Description of what this application does
12
+ */
13
+ description?: string;
14
+ /**
15
+ * Icon name/class for the application
16
+ */
17
+ icon?: string;
18
+ /**
19
+ * URL to the application logo
20
+ */
21
+ logo?: string;
22
+ /**
23
+ * Default path to redirect when opening the app
24
+ */
25
+ homepage?: string;
26
+ /**
27
+ * Sort order for display
28
+ */
29
+ sort_no?: number;
30
+ /**
31
+ * Whether the application is enabled
32
+ */
33
+ is_active?: boolean;
34
+ /**
35
+ * Custom metadata/settings
36
+ */
37
+ [key: string]: any;
38
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":""}
package/dist/field.d.ts CHANGED
@@ -85,4 +85,13 @@ export interface FieldConfig {
85
85
  ai_context?: ValidationAiContext;
86
86
  /** Dimension of the vector for 'vector' type fields. */
87
87
  dimension?: number;
88
+ /** Formula expression. */
89
+ formula?: string;
90
+ /** Object to summarize. */
91
+ summary_object?: string;
92
+ /** Field on the summary object. */
93
+ summary_field?: string;
94
+ /** Type of summary (count, sum, min, max, avg). */
95
+ summary_type?: string;
96
+ filters?: any[];
88
97
  }
package/dist/index.d.ts CHANGED
@@ -11,4 +11,8 @@ export * from './plugin';
11
11
  export * from './config';
12
12
  export * from './context';
13
13
  export * from './validation';
14
+ export * from './permission';
15
+ export * from './page';
14
16
  export * from './loader';
17
+ export * from './application';
18
+ export * from './menu';
package/dist/index.js CHANGED
@@ -27,5 +27,9 @@ __exportStar(require("./plugin"), exports);
27
27
  __exportStar(require("./config"), exports);
28
28
  __exportStar(require("./context"), exports);
29
29
  __exportStar(require("./validation"), exports);
30
+ __exportStar(require("./permission"), exports);
31
+ __exportStar(require("./page"), exports);
30
32
  __exportStar(require("./loader"), exports);
33
+ __exportStar(require("./application"), exports);
34
+ __exportStar(require("./menu"), exports);
31
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAG7B,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,+CAA6B;AAC7B,yCAAuB;AACvB,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB"}
package/dist/menu.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ export type MenuType = 'sidebar' | 'topnav' | 'context' | 'mobile' | 'admin';
2
+ export type MenuItemType = 'page' | 'section' | 'url' | 'folder' | 'object' | 'action';
3
+ export interface MenuItem {
4
+ /**
5
+ * Unique identifier for the menu item
6
+ */
7
+ name: string;
8
+ /**
9
+ * Display label
10
+ */
11
+ label: string;
12
+ /**
13
+ * Icon name
14
+ */
15
+ icon?: string;
16
+ /**
17
+ * Item type
18
+ */
19
+ type?: MenuItemType;
20
+ /**
21
+ * Navigation path (for type: page/url)
22
+ */
23
+ path?: string;
24
+ /**
25
+ * Associated Object name (for type: object)
26
+ */
27
+ object?: string;
28
+ /**
29
+ * Object View name (for type: object)
30
+ */
31
+ view?: string;
32
+ /**
33
+ * Nested menu items
34
+ */
35
+ items?: MenuItem[];
36
+ /**
37
+ * Link target (e.g. _blank)
38
+ */
39
+ target?: string;
40
+ /**
41
+ * Visibility condition
42
+ */
43
+ hidden?: boolean | string;
44
+ /**
45
+ * Badge value or expression
46
+ */
47
+ badge?: string;
48
+ /**
49
+ * Custom properties
50
+ */
51
+ [key: string]: any;
52
+ }
53
+ export interface MenuConfig {
54
+ /**
55
+ * Unique identifier for the menu
56
+ */
57
+ name: string;
58
+ /**
59
+ * Display label
60
+ */
61
+ label: string;
62
+ /**
63
+ * Menu type/location
64
+ */
65
+ type?: MenuType;
66
+ /**
67
+ * The application this menu belongs to
68
+ */
69
+ app?: string;
70
+ /**
71
+ * Menu items
72
+ */
73
+ items: MenuItem[];
74
+ /**
75
+ * Whether the menu is active
76
+ */
77
+ is_active?: boolean;
78
+ /**
79
+ * Custom properties
80
+ */
81
+ [key: string]: any;
82
+ }
package/dist/menu.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["../src/menu.ts"],"names":[],"mappings":""}
package/dist/page.d.ts ADDED
@@ -0,0 +1,272 @@
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
+ * Layout types for page arrangement
12
+ */
13
+ export type PageLayoutType = 'single_column' | 'two_column' | 'three_column' | 'dashboard' | 'canvas' | 'tabs' | 'wizard' | 'custom';
14
+ /**
15
+ * Component types that can be placed on a page
16
+ */
17
+ export type PageComponentType = 'data_grid' | 'form' | 'detail_view' | 'chart' | 'metric' | 'list' | 'calendar' | 'kanban' | 'timeline' | 'text' | 'html' | 'iframe' | 'button' | 'tabs' | 'container' | 'divider' | 'image' | 'custom';
18
+ /**
19
+ * Responsive breakpoint configuration
20
+ */
21
+ export interface ResponsiveConfig {
22
+ /** Mobile viewport (< 640px) */
23
+ mobile?: {
24
+ columns?: number;
25
+ visible?: boolean;
26
+ order?: number;
27
+ };
28
+ /** Tablet viewport (640px - 1024px) */
29
+ tablet?: {
30
+ columns?: number;
31
+ visible?: boolean;
32
+ order?: number;
33
+ };
34
+ /** Desktop viewport (> 1024px) */
35
+ desktop?: {
36
+ columns?: number;
37
+ visible?: boolean;
38
+ order?: number;
39
+ };
40
+ }
41
+ /**
42
+ * Data source configuration for components
43
+ */
44
+ export interface ComponentDataSource {
45
+ /** Object name to query */
46
+ object?: string;
47
+ /** Filter conditions */
48
+ filters?: any[];
49
+ /** Fields to display */
50
+ fields?: string[];
51
+ /** Sort configuration */
52
+ sort?: Array<[string, 'asc' | 'desc']>;
53
+ /** Maximum records to fetch */
54
+ limit?: number;
55
+ /** Enable pagination */
56
+ paginate?: boolean;
57
+ /** Related objects to expand */
58
+ expand?: Record<string, any>;
59
+ /** Custom query override */
60
+ query?: any;
61
+ }
62
+ /**
63
+ * Action triggered by component interaction
64
+ */
65
+ export interface ComponentAction {
66
+ /** Action type */
67
+ type: 'navigate' | 'open_modal' | 'run_action' | 'submit_form' | 'refresh' | 'custom';
68
+ /** Navigation path (for type: navigate) */
69
+ path?: string;
70
+ /** Modal component to open (for type: open_modal) */
71
+ modal?: string;
72
+ /** Action name to execute (for type: run_action) */
73
+ action?: string;
74
+ /** Target object for action */
75
+ object?: string;
76
+ /** Custom handler function */
77
+ handler?: string;
78
+ /** Confirmation message before executing */
79
+ confirm?: string;
80
+ /** Success message after execution */
81
+ success_message?: string;
82
+ /** Error handling */
83
+ on_error?: 'show_toast' | 'show_modal' | 'ignore';
84
+ }
85
+ /**
86
+ * Styling configuration for components
87
+ */
88
+ export interface ComponentStyle {
89
+ /** Width (e.g., '100%', '300px', 'auto') */
90
+ width?: string;
91
+ /** Height */
92
+ height?: string;
93
+ /** Minimum width */
94
+ min_width?: string;
95
+ /** Minimum height */
96
+ min_height?: string;
97
+ /** Background color */
98
+ background?: string;
99
+ /** Text color */
100
+ color?: string;
101
+ /** Border */
102
+ border?: string;
103
+ /** Border radius */
104
+ border_radius?: string;
105
+ /** Padding */
106
+ padding?: string;
107
+ /** Margin */
108
+ margin?: string;
109
+ /** Custom CSS classes */
110
+ class_name?: string;
111
+ /** Inline styles */
112
+ custom_css?: Record<string, any>;
113
+ }
114
+ /**
115
+ * Base component configuration
116
+ */
117
+ export interface PageComponent {
118
+ /** Unique component identifier within the page */
119
+ id: string;
120
+ /** Component type */
121
+ type: PageComponentType;
122
+ /** Display label */
123
+ label?: string;
124
+ /** Component description */
125
+ description?: string;
126
+ /** Data source configuration */
127
+ data_source?: ComponentDataSource;
128
+ /** Component-specific configuration */
129
+ config?: Record<string, any>;
130
+ /** Actions triggered by this component */
131
+ actions?: {
132
+ on_click?: ComponentAction;
133
+ on_submit?: ComponentAction;
134
+ on_load?: ComponentAction;
135
+ on_change?: ComponentAction;
136
+ [key: string]: ComponentAction | undefined;
137
+ };
138
+ /** Visual styling */
139
+ style?: ComponentStyle;
140
+ /** Responsive behavior */
141
+ responsive?: ResponsiveConfig;
142
+ /** Visibility conditions */
143
+ visible_when?: Record<string, any>;
144
+ /** Access control */
145
+ permissions?: string[];
146
+ /** Nested components (for containers, tabs, etc.) */
147
+ components?: PageComponent[];
148
+ /** Grid position (for dashboard layout) */
149
+ grid?: {
150
+ x: number;
151
+ y: number;
152
+ w: number;
153
+ h: number;
154
+ };
155
+ /** Custom component reference */
156
+ component?: string;
157
+ }
158
+ /**
159
+ * Page section/region configuration
160
+ */
161
+ export interface PageSection {
162
+ /** Section identifier */
163
+ id: string;
164
+ /** Section label */
165
+ label?: string;
166
+ /** Section type */
167
+ type?: 'header' | 'sidebar' | 'content' | 'footer' | 'custom';
168
+ /** Components in this section */
169
+ components: PageComponent[];
170
+ /** Section styling */
171
+ style?: ComponentStyle;
172
+ /** Collapsible section */
173
+ collapsible?: boolean;
174
+ /** Default collapsed state */
175
+ collapsed?: boolean;
176
+ /** Visibility conditions */
177
+ visible_when?: Record<string, any>;
178
+ }
179
+ /**
180
+ * Page metadata configuration
181
+ */
182
+ export interface PageConfig {
183
+ /** Unique page identifier */
184
+ name: string;
185
+ /** Display label */
186
+ label: string;
187
+ /** Page description */
188
+ description?: string;
189
+ /** Icon for navigation */
190
+ icon?: string;
191
+ /** Layout type */
192
+ layout: PageLayoutType;
193
+ /** Page sections */
194
+ sections?: PageSection[];
195
+ /** Components (alternative to sections for simple layouts) */
196
+ components?: PageComponent[];
197
+ /** Page-level data sources */
198
+ data_sources?: Record<string, ComponentDataSource>;
199
+ /** Page-level actions */
200
+ actions?: Record<string, ComponentAction>;
201
+ /** Page styling */
202
+ style?: ComponentStyle;
203
+ /** Access control */
204
+ permissions?: {
205
+ /** Roles allowed to view this page */
206
+ view?: string[];
207
+ /** Roles allowed to edit this page */
208
+ edit?: string[];
209
+ };
210
+ /** SEO and metadata */
211
+ meta?: {
212
+ title?: string;
213
+ description?: string;
214
+ keywords?: string[];
215
+ };
216
+ /** Page state management */
217
+ state?: {
218
+ /** Initial state values */
219
+ initial?: Record<string, any>;
220
+ /** State persistence */
221
+ persist?: boolean;
222
+ /** Storage key for persistence */
223
+ storage_key?: string;
224
+ };
225
+ /** Responsive configuration */
226
+ responsive?: ResponsiveConfig;
227
+ /** Custom page handler/controller */
228
+ handler?: string;
229
+ /** Enable real-time updates */
230
+ realtime?: boolean;
231
+ /** Refresh interval in seconds */
232
+ refresh_interval?: number;
233
+ /** AI context for page generation and understanding */
234
+ ai_context?: {
235
+ /** Purpose of the page */
236
+ intent?: string;
237
+ /** Target user persona */
238
+ persona?: string;
239
+ /** Key user tasks */
240
+ tasks?: string[];
241
+ };
242
+ }
243
+ /**
244
+ * Lightweight page reference (for menus, navigation, etc.)
245
+ *
246
+ * Used in application navigation menus and links to reference pages
247
+ * without loading the full page configuration. This is useful for:
248
+ * - Building navigation menus
249
+ * - Creating page links
250
+ * - Page selection dropdowns
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * // In navigation menu
255
+ * const menuItem: PageReference = {
256
+ * name: 'dashboard',
257
+ * label: 'Dashboard',
258
+ * icon: 'dashboard',
259
+ * path: '/dashboard'
260
+ * };
261
+ * ```
262
+ */
263
+ export interface PageReference {
264
+ /** Page name/identifier */
265
+ name: string;
266
+ /** Display label */
267
+ label?: string;
268
+ /** Icon */
269
+ icon?: string;
270
+ /** Path/route */
271
+ path?: string;
272
+ }
package/dist/page.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Page Metadata Definition
4
+ *
5
+ * Defines the structure for pages in ObjectQL applications.
6
+ * Inspired by low-code platforms like Airtable, Retool, Appsmith, and Salesforce Lightning.
7
+ *
8
+ * Pages are composable UI containers that can render data from objects,
9
+ * display custom components, and orchestrate user interactions.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}