@objectql/types 1.8.3 → 1.9.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/dist/view.d.ts ADDED
@@ -0,0 +1,304 @@
1
+ /**
2
+ * View Metadata Definition
3
+ *
4
+ * Defines the structure for list views, grid views, and other data visualization views
5
+ * in ObjectQL applications. Views define how data from objects is displayed to users
6
+ * including columns, filters, sorting, and available actions.
7
+ *
8
+ * Based on common patterns from Salesforce List Views, Airtable Views, and similar platforms.
9
+ */
10
+ import { ValidationOperator } from './validation';
11
+ /**
12
+ * Types of views supported by ObjectQL
13
+ */
14
+ export type ViewType = 'list' | 'kanban' | 'calendar' | 'timeline' | 'gallery' | 'map' | 'pivot' | 'custom';
15
+ /**
16
+ * Column configuration for a view
17
+ */
18
+ export interface ViewColumn {
19
+ /** Field name to display */
20
+ field: string;
21
+ /** Display label (defaults to field label) */
22
+ label?: string;
23
+ /** Column width in pixels */
24
+ width?: number;
25
+ /** Whether this column is visible by default */
26
+ visible?: boolean;
27
+ /** Whether this column is sortable */
28
+ sortable?: boolean;
29
+ /** Whether this column is filterable */
30
+ filterable?: boolean;
31
+ /** Display format (date, currency, percent, etc.) */
32
+ format?: string;
33
+ /** Whether to display as a badge/chip */
34
+ badge?: boolean;
35
+ /** Custom template for rendering */
36
+ template?: string;
37
+ /** Alignment (left, center, right) */
38
+ align?: 'left' | 'center' | 'right';
39
+ /** Whether this column is frozen/pinned */
40
+ frozen?: boolean;
41
+ /** Truncate text after N characters */
42
+ truncate?: number;
43
+ /** Tooltip configuration */
44
+ tooltip?: string | {
45
+ field?: string;
46
+ template?: string;
47
+ };
48
+ }
49
+ /**
50
+ * Filter condition for a view
51
+ */
52
+ export interface ViewFilter {
53
+ /** Field to filter on */
54
+ field: string;
55
+ /** Comparison operator */
56
+ operator: ValidationOperator | 'is_null' | 'is_not_null';
57
+ /** Value to compare against */
58
+ value?: any;
59
+ /** Multiple values (for 'in' operator) */
60
+ values?: any[];
61
+ /** Label for this filter (for UI) */
62
+ label?: string;
63
+ }
64
+ /**
65
+ * Logical grouping of filters
66
+ */
67
+ export interface ViewFilterGroup {
68
+ /** Logical operator */
69
+ operator: 'and' | 'or';
70
+ /** Filters in this group */
71
+ filters: (ViewFilter | ViewFilterGroup)[];
72
+ }
73
+ /**
74
+ * Sort configuration for a view
75
+ */
76
+ export interface ViewSort {
77
+ /** Field to sort by */
78
+ field: string;
79
+ /** Sort direction */
80
+ direction: 'asc' | 'desc';
81
+ }
82
+ /**
83
+ * Action available in the view
84
+ */
85
+ export interface ViewAction {
86
+ /** Action name/identifier */
87
+ name: string;
88
+ /** Display label */
89
+ label?: string;
90
+ /** Icon */
91
+ icon?: string;
92
+ /** Action type */
93
+ type?: 'standard' | 'custom';
94
+ /** Confirmation message before executing */
95
+ confirm?: string;
96
+ /** Visibility condition */
97
+ visible_when?: string;
98
+ /** Enabled condition */
99
+ enabled_when?: string;
100
+ }
101
+ /**
102
+ * Grouping configuration for a view
103
+ */
104
+ export interface ViewGrouping {
105
+ /** Field to group by */
106
+ field: string;
107
+ /** Display label for the group */
108
+ label?: string;
109
+ /** Sort order within groups */
110
+ sort?: 'asc' | 'desc';
111
+ /** Whether groups are collapsed by default */
112
+ collapsed?: boolean;
113
+ }
114
+ /**
115
+ * Pagination configuration
116
+ */
117
+ export interface ViewPagination {
118
+ /** Enable pagination */
119
+ enabled: boolean;
120
+ /** Default page size */
121
+ page_size?: number;
122
+ /** Available page size options */
123
+ page_size_options?: number[];
124
+ }
125
+ /**
126
+ * Kanban view specific configuration
127
+ */
128
+ export interface KanbanViewConfig {
129
+ /** Field to use for columns (status field) */
130
+ column_field: string;
131
+ /** Field to use for card title */
132
+ title_field: string;
133
+ /** Field to use for card subtitle */
134
+ subtitle_field?: string;
135
+ /** Additional fields to display on card */
136
+ card_fields?: string[];
137
+ /** Field to use for card color */
138
+ color_field?: string;
139
+ /** Field to use for card avatar/image */
140
+ avatar_field?: string;
141
+ /** Enable drag and drop */
142
+ enable_drag_drop?: boolean;
143
+ }
144
+ /**
145
+ * Calendar view specific configuration
146
+ */
147
+ export interface CalendarViewConfig {
148
+ /** Field to use for event start date */
149
+ start_date_field: string;
150
+ /** Field to use for event end date */
151
+ end_date_field?: string;
152
+ /** Field to use for event title */
153
+ title_field: string;
154
+ /** Field to use for event color */
155
+ color_field?: string;
156
+ /** Default view mode (day, week, month) */
157
+ default_mode?: 'day' | 'week' | 'month' | 'year';
158
+ /** Enable all-day events */
159
+ all_day_field?: string;
160
+ }
161
+ /**
162
+ * Timeline view specific configuration
163
+ */
164
+ export interface TimelineViewConfig {
165
+ /** Field to use for task start */
166
+ start_field: string;
167
+ /** Field to use for task end */
168
+ end_field: string;
169
+ /** Field to use for task name */
170
+ name_field: string;
171
+ /** Field to use for progress percentage */
172
+ progress_field?: string;
173
+ /** Field to use for dependencies */
174
+ dependencies_field?: string;
175
+ /** Enable drag to resize */
176
+ enable_resize?: boolean;
177
+ /** Enable drag to move */
178
+ enable_move?: boolean;
179
+ }
180
+ /**
181
+ * Gallery view specific configuration
182
+ */
183
+ export interface GalleryViewConfig {
184
+ /** Field to use for card image */
185
+ image_field: string;
186
+ /** Field to use for card title */
187
+ title_field: string;
188
+ /** Field to use for card description */
189
+ description_field?: string;
190
+ /** Number of columns */
191
+ columns?: number;
192
+ /** Card aspect ratio */
193
+ aspect_ratio?: string;
194
+ }
195
+ /**
196
+ * Map view specific configuration
197
+ */
198
+ export interface MapViewConfig {
199
+ /** Field containing location data */
200
+ location_field: string;
201
+ /** Field to use for marker title */
202
+ title_field: string;
203
+ /** Field to use for marker description */
204
+ description_field?: string;
205
+ /** Default map center [latitude, longitude] */
206
+ center?: [number, number];
207
+ /** Default zoom level */
208
+ zoom?: number;
209
+ /** Enable clustering */
210
+ enable_clustering?: boolean;
211
+ }
212
+ /**
213
+ * Complete view configuration
214
+ */
215
+ export interface ViewConfig {
216
+ /** Unique view identifier */
217
+ name: string;
218
+ /** Display label */
219
+ label: string;
220
+ /** Object this view applies to */
221
+ object: string;
222
+ /** View description */
223
+ description?: string;
224
+ /** View type */
225
+ type?: ViewType;
226
+ /** Icon for the view */
227
+ icon?: string;
228
+ /** Columns to display (for list views) */
229
+ columns?: ViewColumn[];
230
+ /** Default filters */
231
+ filters?: (ViewFilter | ViewFilterGroup)[];
232
+ /** Default sorting */
233
+ sort?: ViewSort[];
234
+ /** Grouping configuration */
235
+ grouping?: ViewGrouping;
236
+ /** Pagination configuration */
237
+ pagination?: ViewPagination;
238
+ /** Maximum number of records to fetch */
239
+ limit?: number;
240
+ /** Available actions */
241
+ actions?: ViewAction[];
242
+ /** Enable search */
243
+ enable_search?: boolean;
244
+ /** Searchable fields */
245
+ search_fields?: string[];
246
+ /** Enable inline editing */
247
+ enable_inline_edit?: boolean;
248
+ /** Enable bulk selection */
249
+ enable_bulk_select?: boolean;
250
+ /** Enable export */
251
+ enable_export?: boolean;
252
+ /** Export formats */
253
+ export_formats?: ('csv' | 'xlsx' | 'pdf' | 'json')[];
254
+ /** Kanban-specific config */
255
+ kanban?: KanbanViewConfig;
256
+ /** Calendar-specific config */
257
+ calendar?: CalendarViewConfig;
258
+ /** Timeline-specific config */
259
+ timeline?: TimelineViewConfig;
260
+ /** Gallery-specific config */
261
+ gallery?: GalleryViewConfig;
262
+ /** Map-specific config */
263
+ map?: MapViewConfig;
264
+ /** Whether this is the default view */
265
+ is_default?: boolean;
266
+ /** Access control */
267
+ permissions?: {
268
+ /** Roles allowed to view */
269
+ view?: string[];
270
+ /** Roles allowed to edit view configuration */
271
+ edit?: string[];
272
+ };
273
+ /** Whether the view is shared with all users */
274
+ is_public?: boolean;
275
+ /** Owner of the view (for personal views) */
276
+ owner?: string;
277
+ /** Custom view configuration */
278
+ config?: Record<string, any>;
279
+ /** AI context for view generation */
280
+ ai_context?: {
281
+ /** Purpose of this view */
282
+ intent?: string;
283
+ /** Target user role */
284
+ persona?: string;
285
+ /** Key insights to display */
286
+ insights?: string[];
287
+ };
288
+ }
289
+ /**
290
+ * Lightweight view reference
291
+ * Used in navigation, dropdowns, and view selectors
292
+ */
293
+ export interface ViewReference {
294
+ /** View name/identifier */
295
+ name: string;
296
+ /** Display label */
297
+ label?: string;
298
+ /** Icon */
299
+ icon?: string;
300
+ /** View type */
301
+ type?: ViewType;
302
+ /** Whether this is the default view */
303
+ is_default?: boolean;
304
+ }
package/dist/view.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * View Metadata Definition
4
+ *
5
+ * Defines the structure for list views, grid views, and other data visualization views
6
+ * in ObjectQL applications. Views define how data from objects is displayed to users
7
+ * including columns, filters, sorting, and available actions.
8
+ *
9
+ * Based on common patterns from Salesforce List Views, Airtable Views, and similar platforms.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Workflow and Automation Metadata Definition
3
+ *
4
+ * Defines the structure for workflows, approvals, and automation processes in ObjectQL.
5
+ * Workflows orchestrate business processes, approval chains, and automated actions.
6
+ *
7
+ * Based on patterns from Salesforce Process Builder, Microsoft Power Automate, and similar platforms.
8
+ */
9
+ import { ValidationCondition } from './validation';
10
+ /**
11
+ * Types of workflows supported by ObjectQL
12
+ */
13
+ export type WorkflowType = 'approval' | 'automation' | 'scheduled' | 'sequential' | 'parallel' | 'custom';
14
+ /**
15
+ * Workflow trigger event types
16
+ */
17
+ export type WorkflowTriggerEvent = 'create' | 'update' | 'delete' | 'create_or_update' | 'field_change' | 'schedule' | 'manual' | 'webhook' | 'custom';
18
+ /**
19
+ * Workflow trigger configuration
20
+ */
21
+ export interface WorkflowTrigger {
22
+ /** Trigger event type */
23
+ event: WorkflowTriggerEvent;
24
+ /** Conditions that must be met to trigger the workflow */
25
+ conditions?: ValidationCondition[];
26
+ /** Schedule configuration (for scheduled workflows) */
27
+ schedule?: {
28
+ /** Cron expression */
29
+ cron?: string;
30
+ /** Interval in minutes */
31
+ interval?: number;
32
+ /** Timezone for schedule */
33
+ timezone?: string;
34
+ };
35
+ /** Specific fields to monitor (for field_change event) */
36
+ fields?: string[];
37
+ /** Webhook configuration (for webhook triggers) */
38
+ webhook?: {
39
+ /** Webhook URL pattern */
40
+ path?: string;
41
+ /** HTTP method */
42
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
43
+ /** Authentication required */
44
+ auth?: boolean;
45
+ };
46
+ }
47
+ /**
48
+ * Workflow step types
49
+ */
50
+ export type WorkflowStepType = 'approval' | 'action' | 'notification' | 'field_update' | 'create_record' | 'condition' | 'wait' | 'loop' | 'webhook' | 'script' | 'parallel' | 'custom';
51
+ /**
52
+ * Assignee configuration for approval steps
53
+ */
54
+ export interface WorkflowAssignee {
55
+ /** Assignee type */
56
+ type: 'user' | 'role' | 'field' | 'expression' | 'queue';
57
+ /** Specific user ID (for type: user) */
58
+ user?: string;
59
+ /** Role name (for type: role) */
60
+ role?: string;
61
+ /** Field containing assignee (for type: field) */
62
+ field?: string;
63
+ /** Expression to evaluate assignee (for type: expression) */
64
+ expression?: string;
65
+ /** Queue name (for type: queue) */
66
+ queue?: string;
67
+ }
68
+ /**
69
+ * Approval step action configuration
70
+ */
71
+ export interface ApprovalAction {
72
+ /** Action label */
73
+ label: string;
74
+ /** Action value/identifier */
75
+ value?: string;
76
+ /** Next step to execute */
77
+ next_step?: string;
78
+ /** Workflow outcome if this action is chosen */
79
+ outcome?: 'approved' | 'rejected' | 'pending' | 'custom';
80
+ /** Field updates to apply */
81
+ updates?: Record<string, any>;
82
+ /** Comment field name */
83
+ comment_field?: string;
84
+ /** Whether comment is required */
85
+ comment_required?: boolean;
86
+ }
87
+ /**
88
+ * Field update configuration
89
+ */
90
+ export interface FieldUpdateConfig {
91
+ /** Field to update */
92
+ field: string;
93
+ /** New value */
94
+ value?: any;
95
+ /** Expression to calculate value */
96
+ expression?: string;
97
+ /** Copy value from another field */
98
+ copy_from?: string;
99
+ }
100
+ /**
101
+ * Notification configuration
102
+ */
103
+ export interface NotificationConfig {
104
+ /** Notification type */
105
+ type: 'email' | 'sms' | 'push' | 'in_app' | 'custom';
106
+ /** Recipients */
107
+ to?: {
108
+ /** Recipient type */
109
+ type: 'user' | 'role' | 'field' | 'email';
110
+ /** Value based on type */
111
+ value?: string;
112
+ }[];
113
+ /** Email template or subject */
114
+ subject?: string;
115
+ /** Message template */
116
+ template?: string;
117
+ /** Message body */
118
+ body?: string;
119
+ /** Custom notification handler */
120
+ handler?: string;
121
+ }
122
+ /**
123
+ * Create record configuration
124
+ */
125
+ export interface CreateRecordConfig {
126
+ /** Object to create record in */
127
+ object: string;
128
+ /** Field mappings from trigger record */
129
+ field_mappings?: Record<string, string>;
130
+ /** Static field values */
131
+ values?: Record<string, any>;
132
+ }
133
+ /**
134
+ * Conditional branch configuration
135
+ */
136
+ export interface ConditionalBranch {
137
+ /** Condition to evaluate */
138
+ condition: ValidationCondition;
139
+ /** Steps to execute if condition is true */
140
+ then_steps?: string[];
141
+ /** Steps to execute if condition is false */
142
+ else_steps?: string[];
143
+ }
144
+ /**
145
+ * Wait configuration
146
+ */
147
+ export interface WaitConfig {
148
+ /** Wait type */
149
+ type: 'duration' | 'until' | 'field_change';
150
+ /** Duration to wait (ISO 8601 duration) */
151
+ duration?: string;
152
+ /** Wait until specific datetime */
153
+ until?: string;
154
+ /** Wait until field changes */
155
+ field?: string;
156
+ /** Timeout (ISO 8601 duration) */
157
+ timeout?: string;
158
+ }
159
+ /**
160
+ * Loop configuration
161
+ */
162
+ export interface LoopConfig {
163
+ /** Type of loop */
164
+ type: 'items' | 'count' | 'while';
165
+ /** Items to iterate over (field or expression) */
166
+ items?: string;
167
+ /** Number of iterations */
168
+ count?: number;
169
+ /** Condition for while loop */
170
+ condition?: ValidationCondition;
171
+ /** Steps to execute in each iteration */
172
+ steps?: string[];
173
+ }
174
+ /**
175
+ * Webhook call configuration
176
+ */
177
+ export interface WebhookCallConfig {
178
+ /** URL to call */
179
+ url: string;
180
+ /** HTTP method */
181
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
182
+ /** Headers */
183
+ headers?: Record<string, string>;
184
+ /** Request body */
185
+ body?: any;
186
+ /** Body template */
187
+ body_template?: string;
188
+ /** Authentication configuration */
189
+ auth?: {
190
+ type: 'basic' | 'bearer' | 'api_key' | 'oauth2';
191
+ credentials?: Record<string, any>;
192
+ };
193
+ /** Timeout in milliseconds */
194
+ timeout?: number;
195
+ /** Retry configuration */
196
+ retry?: {
197
+ max_attempts?: number;
198
+ backoff?: 'exponential' | 'linear';
199
+ };
200
+ }
201
+ /**
202
+ * Workflow step definition
203
+ */
204
+ export interface WorkflowStep {
205
+ /** Unique step identifier */
206
+ name: string;
207
+ /** Display label */
208
+ label?: string;
209
+ /** Step description */
210
+ description?: string;
211
+ /** Step type */
212
+ type: WorkflowStepType;
213
+ /** Condition to execute this step */
214
+ condition?: ValidationCondition;
215
+ /** Assignee (for approval steps) */
216
+ assignee?: WorkflowAssignee;
217
+ /** Available actions (for approval steps) */
218
+ actions?: Record<string, ApprovalAction>;
219
+ /** Field updates to apply */
220
+ field_updates?: FieldUpdateConfig[];
221
+ /** Notification configuration */
222
+ notification?: NotificationConfig;
223
+ /** Record creation configuration */
224
+ create_record?: CreateRecordConfig;
225
+ /** Conditional branching */
226
+ conditional?: ConditionalBranch;
227
+ /** Wait configuration */
228
+ wait?: WaitConfig;
229
+ /** Loop configuration */
230
+ loop?: LoopConfig;
231
+ /** Webhook configuration */
232
+ webhook?: WebhookCallConfig;
233
+ /** Custom script */
234
+ script?: string;
235
+ /** Parallel steps to execute */
236
+ parallel_steps?: string[];
237
+ /** Next step to execute (default flow) */
238
+ next_step?: string;
239
+ /** Timeout for this step (ISO 8601 duration) */
240
+ timeout?: string;
241
+ /** Error handling */
242
+ on_error?: {
243
+ /** Action on error */
244
+ action: 'fail' | 'continue' | 'retry' | 'skip';
245
+ /** Next step on error */
246
+ next_step?: string;
247
+ /** Retry configuration */
248
+ retry?: {
249
+ max_attempts?: number;
250
+ delay?: string;
251
+ };
252
+ };
253
+ }
254
+ /**
255
+ * Complete workflow configuration
256
+ */
257
+ export interface WorkflowConfig {
258
+ /** Unique workflow identifier */
259
+ name: string;
260
+ /** Display label */
261
+ label: string;
262
+ /** Workflow type */
263
+ type: WorkflowType;
264
+ /** Object this workflow applies to */
265
+ object: string;
266
+ /** Workflow description */
267
+ description?: string;
268
+ /** Icon for the workflow */
269
+ icon?: string;
270
+ /** Whether the workflow is active */
271
+ is_active?: boolean;
272
+ /** Trigger configuration */
273
+ trigger: WorkflowTrigger;
274
+ /** Ordered list of workflow steps */
275
+ steps: WorkflowStep[];
276
+ /** Initial step to execute */
277
+ initial_step?: string;
278
+ /** Workflow variables */
279
+ variables?: Record<string, any>;
280
+ /** Success outcome field updates */
281
+ on_success?: {
282
+ /** Field updates on successful completion */
283
+ updates?: Record<string, any>;
284
+ /** Notification on success */
285
+ notification?: NotificationConfig;
286
+ };
287
+ /** Failure outcome configuration */
288
+ on_failure?: {
289
+ /** Field updates on failure */
290
+ updates?: Record<string, any>;
291
+ /** Notification on failure */
292
+ notification?: NotificationConfig;
293
+ };
294
+ /** Execution timeout (ISO 8601 duration) */
295
+ timeout?: string;
296
+ /** Execution mode */
297
+ execution_mode?: 'synchronous' | 'asynchronous';
298
+ /** Priority (higher priority workflows execute first) */
299
+ priority?: number;
300
+ /** Access control */
301
+ permissions?: {
302
+ /** Roles that can trigger this workflow */
303
+ execute?: string[];
304
+ /** Roles that can view workflow history */
305
+ view?: string[];
306
+ /** Roles that can edit workflow configuration */
307
+ edit?: string[];
308
+ };
309
+ /** Custom workflow configuration */
310
+ config?: Record<string, any>;
311
+ /** AI context for workflow generation */
312
+ ai_context?: {
313
+ /** Business process description */
314
+ intent?: string;
315
+ /** Process participants */
316
+ stakeholders?: string[];
317
+ /** Expected duration */
318
+ duration?: string;
319
+ };
320
+ }
321
+ /**
322
+ * Workflow execution status
323
+ */
324
+ export type WorkflowStatus = 'pending' | 'running' | 'waiting' | 'completed' | 'approved' | 'rejected' | 'failed' | 'cancelled' | 'timeout';
325
+ /**
326
+ * Workflow instance (execution record)
327
+ */
328
+ export interface WorkflowInstance {
329
+ /** Instance ID */
330
+ id: string;
331
+ /** Workflow name */
332
+ workflow_name: string;
333
+ /** Record ID that triggered the workflow */
334
+ record_id?: string;
335
+ /** Current status */
336
+ status: WorkflowStatus;
337
+ /** Current step */
338
+ current_step?: string;
339
+ /** Started timestamp */
340
+ started_at?: string;
341
+ /** Completed timestamp */
342
+ completed_at?: string;
343
+ /** Triggered by user */
344
+ triggered_by?: string;
345
+ /** Error message (if failed) */
346
+ error?: string;
347
+ /** Execution context */
348
+ context?: Record<string, any>;
349
+ /** Step history */
350
+ step_history?: Array<{
351
+ step: string;
352
+ status: 'completed' | 'failed' | 'skipped';
353
+ started_at: string;
354
+ completed_at?: string;
355
+ actor?: string;
356
+ result?: any;
357
+ }>;
358
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow and Automation Metadata Definition
4
+ *
5
+ * Defines the structure for workflows, approvals, and automation processes in ObjectQL.
6
+ * Workflows orchestrate business processes, approval chains, and automated actions.
7
+ *
8
+ * Based on patterns from Salesforce Process Builder, Microsoft Power Automate, and similar platforms.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectql/types",
3
- "version": "1.8.3",
3
+ "version": "1.9.0",
4
4
  "description": "Pure TypeScript type definitions and interfaces for the ObjectQL protocol - The Contract",
5
5
  "keywords": [
6
6
  "objectql",