@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/api.d.ts CHANGED
@@ -315,6 +315,8 @@ export interface DataApiClientConfig {
315
315
  headers?: Record<string, string>;
316
316
  /** Request timeout in milliseconds */
317
317
  timeout?: number;
318
+ /** Custom data API path (defaults to /api/data) */
319
+ dataPath?: string;
318
320
  }
319
321
  /**
320
322
  * Configuration for Metadata API client
@@ -328,6 +330,8 @@ export interface MetadataApiClientConfig {
328
330
  headers?: Record<string, string>;
329
331
  /** Request timeout in milliseconds */
330
332
  timeout?: number;
333
+ /** Custom metadata API path (defaults to /api/metadata) */
334
+ metadataPath?: string;
331
335
  }
332
336
  /**
333
337
  * Interface for Data API client operations
@@ -425,3 +429,51 @@ export interface IMetadataApiClient {
425
429
  */
426
430
  getMetadata<T = unknown>(metadataType: string, id: string): Promise<MetadataApiResponse<T>>;
427
431
  }
432
+ /**
433
+ * Configuration for API route paths
434
+ * Allows customization of all API endpoints during initialization
435
+ */
436
+ export interface ApiRouteConfig {
437
+ /**
438
+ * Base path for JSON-RPC endpoint
439
+ * @default '/api/objectql'
440
+ */
441
+ rpc?: string;
442
+ /**
443
+ * Base path for REST data API
444
+ * @default '/api/data'
445
+ */
446
+ data?: string;
447
+ /**
448
+ * Base path for metadata API
449
+ * @default '/api/metadata'
450
+ */
451
+ metadata?: string;
452
+ /**
453
+ * Base path for file operations
454
+ * @default '/api/files'
455
+ */
456
+ files?: string;
457
+ }
458
+ /**
459
+ * Complete API route configuration with defaults applied
460
+ */
461
+ export interface ResolvedApiRouteConfig {
462
+ /** JSON-RPC endpoint path */
463
+ rpc: string;
464
+ /** REST data API base path */
465
+ data: string;
466
+ /** Metadata API base path */
467
+ metadata: string;
468
+ /** File operations base path */
469
+ files: string;
470
+ }
471
+ /**
472
+ * Default API route configuration
473
+ */
474
+ export declare const DEFAULT_API_ROUTES: ResolvedApiRouteConfig;
475
+ /**
476
+ * Resolve API route configuration by merging user config with defaults
477
+ * All paths are normalized to start with '/'
478
+ */
479
+ export declare function resolveApiRoutes(config?: ApiRouteConfig): ResolvedApiRouteConfig;
package/dist/api.js CHANGED
@@ -6,7 +6,8 @@
6
6
  * These types enable frontend applications to make type-safe API calls.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ObjectQLError = exports.ApiErrorCode = void 0;
9
+ exports.DEFAULT_API_ROUTES = exports.ObjectQLError = exports.ApiErrorCode = void 0;
10
+ exports.resolveApiRoutes = resolveApiRoutes;
10
11
  // ============================================================================
11
12
  // Error Handling Types
12
13
  // ============================================================================
@@ -42,4 +43,27 @@ class ObjectQLError extends Error {
42
43
  }
43
44
  }
44
45
  exports.ObjectQLError = ObjectQLError;
46
+ /**
47
+ * Default API route configuration
48
+ */
49
+ exports.DEFAULT_API_ROUTES = {
50
+ rpc: '/api/objectql',
51
+ data: '/api/data',
52
+ metadata: '/api/metadata',
53
+ files: '/api/files'
54
+ };
55
+ /**
56
+ * Resolve API route configuration by merging user config with defaults
57
+ * All paths are normalized to start with '/'
58
+ */
59
+ function resolveApiRoutes(config) {
60
+ var _a, _b, _c, _d;
61
+ const normalizePath = (path) => path.startsWith('/') ? path : `/${path}`;
62
+ return {
63
+ rpc: normalizePath((_a = config === null || config === void 0 ? void 0 : config.rpc) !== null && _a !== void 0 ? _a : exports.DEFAULT_API_ROUTES.rpc),
64
+ data: normalizePath((_b = config === null || config === void 0 ? void 0 : config.data) !== null && _b !== void 0 ? _b : exports.DEFAULT_API_ROUTES.data),
65
+ metadata: normalizePath((_c = config === null || config === void 0 ? void 0 : config.metadata) !== null && _c !== void 0 ? _c : exports.DEFAULT_API_ROUTES.metadata),
66
+ files: normalizePath((_d = config === null || config === void 0 ? void 0 : config.files) !== null && _d !== void 0 ? _d : exports.DEFAULT_API_ROUTES.files)
67
+ };
68
+ }
45
69
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAOH,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,IAAY,YAUX;AAVD,WAAY,YAAY;IACpB,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IACrC,6CAA6B,CAAA;IAC7B,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,iDAAiC,CAAA;IACjC,iDAAiC,CAAA;IACjC,2DAA2C,CAAA;AAC/C,CAAC,EAVW,YAAY,4BAAZ,YAAY,QAUvB;AAwBD;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IAIpC,YAAY,KAAkF;QAC1F,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAE7B,uDAAuD;QACvD,MAAM,gBAAgB,GAAG,KAA2F,CAAC;QACrH,IAAI,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC3D,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;CACJ;AAhBD,sCAgBC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAgjBH,4CASC;AAljBD,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,IAAY,YAUX;AAVD,WAAY,YAAY;IACpB,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IACrC,6CAA6B,CAAA;IAC7B,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;IACvB,qCAAqB,CAA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AC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,mCAAI,0BAAkB,CAAC,QAAQ,CAAC;QACxE,KAAK,EAAE,aAAa,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,0BAAkB,CAAC,KAAK,CAAC;KAClE,CAAC;AACN,CAAC"}
package/dist/config.d.ts CHANGED
@@ -20,9 +20,14 @@ export interface ObjectQLConfig {
20
20
  */
21
21
  packages?: string[];
22
22
  /**
23
- * List of npm packages or presets to load.
23
+ * @deprecated Use 'modules' instead.
24
24
  */
25
25
  presets?: string[];
26
+ /**
27
+ * List of modules to load.
28
+ * Can be npm packages or local directories.
29
+ */
30
+ modules?: string[];
26
31
  /**
27
32
  * List of plugins to load.
28
33
  * Can be an instance of ObjectQLPlugin or a package name string.
package/dist/field.d.ts CHANGED
@@ -157,13 +157,23 @@ export interface FieldConfig {
157
157
  ai_context?: ValidationAiContext;
158
158
  /** Dimension of the vector for 'vector' type fields. */
159
159
  dimension?: number;
160
- /** Formula expression. */
160
+ /** Formula expression (for 'formula' type fields). */
161
161
  formula?: string;
162
+ /** Expected return data type for formula fields. */
163
+ data_type?: 'number' | 'text' | 'date' | 'datetime' | 'boolean' | 'currency' | 'percent';
164
+ /** Display format for formula results (e.g., "0.00", "YYYY-MM-DD"). */
165
+ format?: string;
166
+ /** Decimal precision for numeric formula results. */
167
+ precision?: number;
168
+ /** Treat blank/null as zero in formula calculations. */
169
+ blank_as_zero?: boolean;
170
+ /** Default value for null/undefined referenced fields in formulas. */
171
+ treat_blank_as?: string | number | boolean | Date | null;
162
172
  /** Object to summarize. */
163
173
  summary_object?: string;
164
174
  /** Field on the summary object. */
165
175
  summary_field?: string;
166
176
  /** Type of summary (count, sum, min, max, avg). */
167
177
  summary_type?: string;
168
- filters?: any[];
178
+ filters?: unknown[];
169
179
  }
package/dist/form.d.ts ADDED
@@ -0,0 +1,315 @@
1
+ /**
2
+ * Form Metadata Definition
3
+ *
4
+ * Defines the structure for forms, layouts, and field arrangements in ObjectQL.
5
+ * Forms control how data is entered, edited, and displayed to users with
6
+ * sections, tabs, columns, and conditional visibility.
7
+ *
8
+ * Based on patterns from Salesforce Page Layouts, Dynamics Forms, and similar platforms.
9
+ */
10
+ import { ValidationCondition } from './validation';
11
+ /**
12
+ * Form types supported by ObjectQL
13
+ */
14
+ export type FormType = 'create' | 'edit' | 'view' | 'wizard' | 'quick_create' | 'inline' | 'custom';
15
+ /**
16
+ * Layout types for form arrangement
17
+ */
18
+ export type FormLayoutType = 'single_column' | 'two_column' | 'three_column' | 'tabs' | 'accordion' | 'custom';
19
+ /**
20
+ * Field display configuration in form
21
+ */
22
+ export interface FormField {
23
+ /** Field name */
24
+ name: string;
25
+ /** Display label (overrides field config) */
26
+ label?: string;
27
+ /** Help text (overrides field config) */
28
+ help_text?: string;
29
+ /** Placeholder text */
30
+ placeholder?: string;
31
+ /** Whether field is required in this form */
32
+ required?: boolean;
33
+ /** Whether field is readonly in this form */
34
+ readonly?: boolean;
35
+ /** Whether field is hidden in this form */
36
+ hidden?: boolean;
37
+ /** Field width in columns (for multi-column layouts) */
38
+ width?: number;
39
+ /** Span across columns */
40
+ span?: number;
41
+ /** Visibility condition */
42
+ visible_when?: ValidationCondition | string;
43
+ /** Enabled condition */
44
+ enabled_when?: ValidationCondition | string;
45
+ /** Default value override */
46
+ default_value?: any;
47
+ /** Field-specific validation override */
48
+ validation?: any;
49
+ /** Custom CSS class */
50
+ class_name?: string;
51
+ /** Field-specific configuration */
52
+ config?: Record<string, any>;
53
+ }
54
+ /**
55
+ * Form section configuration
56
+ */
57
+ export interface FormSection {
58
+ /** Section identifier */
59
+ id?: string;
60
+ /** Section label */
61
+ label?: string;
62
+ /** Section description */
63
+ description?: string;
64
+ /** Number of columns in this section */
65
+ columns?: number;
66
+ /** Fields in this section */
67
+ fields: (string | FormField)[];
68
+ /** Whether section is collapsible */
69
+ collapsible?: boolean;
70
+ /** Default collapsed state */
71
+ collapsed?: boolean;
72
+ /** Visibility condition */
73
+ visible_when?: ValidationCondition | string;
74
+ /** Section border style */
75
+ border?: boolean;
76
+ /** Section background color */
77
+ background?: string;
78
+ /** Custom CSS class */
79
+ class_name?: string;
80
+ }
81
+ /**
82
+ * Form tab configuration
83
+ */
84
+ export interface FormTab {
85
+ /** Tab identifier */
86
+ id: string;
87
+ /** Tab label */
88
+ label: string;
89
+ /** Tab icon */
90
+ icon?: string;
91
+ /** Sections within this tab */
92
+ sections: FormSection[];
93
+ /** Visibility condition */
94
+ visible_when?: ValidationCondition | string;
95
+ /** Badge/count to display on tab */
96
+ badge?: string | number;
97
+ /** Whether this tab is disabled */
98
+ disabled?: boolean;
99
+ }
100
+ /**
101
+ * Wizard step configuration
102
+ */
103
+ export interface WizardStep {
104
+ /** Step identifier */
105
+ id: string;
106
+ /** Step label */
107
+ label: string;
108
+ /** Step description */
109
+ description?: string;
110
+ /** Icon for step */
111
+ icon?: string;
112
+ /** Sections in this step */
113
+ sections: FormSection[];
114
+ /** Validation to pass before proceeding */
115
+ validation?: ValidationCondition;
116
+ /** Whether user can skip this step */
117
+ skippable?: boolean;
118
+ /** Visibility condition */
119
+ visible_when?: ValidationCondition | string;
120
+ /** Action to execute when step is completed */
121
+ on_complete?: string;
122
+ }
123
+ /**
124
+ * Form action/button configuration
125
+ */
126
+ export interface FormAction {
127
+ /** Action identifier */
128
+ name: string;
129
+ /** Display label */
130
+ label: string;
131
+ /** Button type */
132
+ type?: 'submit' | 'cancel' | 'custom' | 'save' | 'save_new' | 'save_close';
133
+ /** Icon */
134
+ icon?: string;
135
+ /** Button style variant */
136
+ variant?: 'primary' | 'secondary' | 'danger' | 'success' | 'ghost';
137
+ /** Position */
138
+ position?: 'header' | 'footer' | 'both';
139
+ /** Confirmation message before executing */
140
+ confirm?: string;
141
+ /** Visibility condition */
142
+ visible_when?: ValidationCondition | string;
143
+ /** Enabled condition */
144
+ enabled_when?: ValidationCondition | string;
145
+ /** Custom action handler */
146
+ handler?: string;
147
+ /** Navigate to path after action */
148
+ redirect?: string;
149
+ }
150
+ /**
151
+ * Form validation configuration
152
+ */
153
+ export interface FormValidationConfig {
154
+ /** Enable real-time validation */
155
+ realtime?: boolean;
156
+ /** Validate on blur */
157
+ validate_on_blur?: boolean;
158
+ /** Validate on change */
159
+ validate_on_change?: boolean;
160
+ /** Show validation summary */
161
+ show_summary?: boolean;
162
+ /** Custom validation rules */
163
+ rules?: any[];
164
+ }
165
+ /**
166
+ * Form header configuration
167
+ */
168
+ export interface FormHeader {
169
+ /** Show header */
170
+ show?: boolean;
171
+ /** Header title */
172
+ title?: string;
173
+ /** Header subtitle */
174
+ subtitle?: string;
175
+ /** Show record info (created, updated dates) */
176
+ show_record_info?: boolean;
177
+ /** Custom header component */
178
+ component?: string;
179
+ }
180
+ /**
181
+ * Form footer configuration
182
+ */
183
+ export interface FormFooter {
184
+ /** Show footer */
185
+ show?: boolean;
186
+ /** Footer actions */
187
+ actions?: FormAction[];
188
+ /** Footer position */
189
+ position?: 'sticky' | 'static';
190
+ /** Custom footer component */
191
+ component?: string;
192
+ }
193
+ /**
194
+ * Form autosave configuration
195
+ */
196
+ export interface FormAutosaveConfig {
197
+ /** Enable autosave */
198
+ enabled: boolean;
199
+ /** Autosave interval in milliseconds */
200
+ interval?: number;
201
+ /** Show autosave indicator */
202
+ show_indicator?: boolean;
203
+ /** Autosave on field blur */
204
+ on_blur?: boolean;
205
+ }
206
+ /**
207
+ * Complete form configuration
208
+ */
209
+ export interface FormConfig {
210
+ /** Unique form identifier */
211
+ name: string;
212
+ /** Display label */
213
+ label: string;
214
+ /** Form type */
215
+ type?: FormType;
216
+ /** Object this form is for */
217
+ object: string;
218
+ /** Form description */
219
+ description?: string;
220
+ /** Layout type */
221
+ layout: FormLayoutType;
222
+ /** Number of columns (for column layouts) */
223
+ columns?: number;
224
+ /** Sections (for non-tab layouts) */
225
+ sections?: FormSection[];
226
+ /** Tabs (for tab layout) */
227
+ tabs?: FormTab[];
228
+ /** Wizard steps (for wizard layout) */
229
+ steps?: WizardStep[];
230
+ /** Form header */
231
+ header?: FormHeader;
232
+ /** Form footer */
233
+ footer?: FormFooter;
234
+ /** Form actions/buttons */
235
+ actions?: FormAction[];
236
+ /** Validation configuration */
237
+ validation?: FormValidationConfig;
238
+ /** Autosave configuration */
239
+ autosave?: FormAutosaveConfig;
240
+ /** Show required field indicator */
241
+ show_required_indicator?: boolean;
242
+ /** Show field help text */
243
+ show_help_text?: boolean;
244
+ /** Compact mode (reduced spacing) */
245
+ compact?: boolean;
246
+ /** Read-only mode */
247
+ readonly?: boolean;
248
+ /** Disable all fields */
249
+ disabled?: boolean;
250
+ /** Show success message after save */
251
+ success_message?: string;
252
+ /** Redirect after successful save */
253
+ redirect_on_success?: string;
254
+ /** Access control */
255
+ permissions?: {
256
+ /** Roles that can view this form */
257
+ view?: string[];
258
+ /** Roles that can edit using this form */
259
+ edit?: string[];
260
+ };
261
+ /** Custom form handler */
262
+ handler?: string;
263
+ /** Custom CSS class */
264
+ class_name?: string;
265
+ /** Form width (for modal forms) */
266
+ width?: string;
267
+ /** Maximum width */
268
+ max_width?: string;
269
+ /** Custom form configuration */
270
+ config?: Record<string, any>;
271
+ /** AI context for form generation */
272
+ ai_context?: {
273
+ /** Purpose of this form */
274
+ intent?: string;
275
+ /** User experience goals */
276
+ ux_goals?: string[];
277
+ /** Field organization strategy */
278
+ organization_strategy?: string;
279
+ };
280
+ }
281
+ /**
282
+ * Lightweight form reference
283
+ * Used in navigation, dropdowns, and form selectors
284
+ */
285
+ export interface FormReference {
286
+ /** Form name/identifier */
287
+ name: string;
288
+ /** Display label */
289
+ label?: string;
290
+ /** Form type */
291
+ type?: FormType;
292
+ /** Whether this is the default form */
293
+ is_default?: boolean;
294
+ }
295
+ /**
296
+ * Dynamic form state (runtime)
297
+ */
298
+ export interface FormState {
299
+ /** Current form values */
300
+ values: Record<string, any>;
301
+ /** Field errors */
302
+ errors: Record<string, string>;
303
+ /** Touched fields */
304
+ touched: Record<string, boolean>;
305
+ /** Whether form is submitting */
306
+ submitting: boolean;
307
+ /** Whether form is valid */
308
+ valid: boolean;
309
+ /** Whether form is dirty (has changes) */
310
+ dirty: boolean;
311
+ /** Current wizard step (for wizard forms) */
312
+ current_step?: number;
313
+ /** Custom state */
314
+ custom?: Record<string, any>;
315
+ }
package/dist/form.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Form Metadata Definition
4
+ *
5
+ * Defines the structure for forms, layouts, and field arrangements in ObjectQL.
6
+ * Forms control how data is entered, edited, and displayed to users with
7
+ * sections, tabs, columns, and conditional visibility.
8
+ *
9
+ * Based on patterns from Salesforce Page Layouts, Dynamics Forms, and similar platforms.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}