@object-ui/core 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 (118) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/CHANGELOG.md +11 -0
  3. package/dist/actions/ActionRunner.d.ts +228 -4
  4. package/dist/actions/ActionRunner.js +397 -45
  5. package/dist/actions/TransactionManager.d.ts +193 -0
  6. package/dist/actions/TransactionManager.js +410 -0
  7. package/dist/actions/index.d.ts +2 -1
  8. package/dist/actions/index.js +2 -1
  9. package/dist/adapters/ApiDataSource.d.ts +69 -0
  10. package/dist/adapters/ApiDataSource.js +293 -0
  11. package/dist/adapters/ValueDataSource.d.ts +55 -0
  12. package/dist/adapters/ValueDataSource.js +287 -0
  13. package/dist/adapters/index.d.ts +3 -0
  14. package/dist/adapters/index.js +5 -2
  15. package/dist/adapters/resolveDataSource.d.ts +40 -0
  16. package/dist/adapters/resolveDataSource.js +59 -0
  17. package/dist/data-scope/DataScopeManager.d.ts +127 -0
  18. package/dist/data-scope/DataScopeManager.js +229 -0
  19. package/dist/data-scope/index.d.ts +10 -0
  20. package/dist/data-scope/index.js +10 -0
  21. package/dist/evaluator/ExpressionCache.d.ts +101 -0
  22. package/dist/evaluator/ExpressionCache.js +135 -0
  23. package/dist/evaluator/ExpressionEvaluator.d.ts +30 -2
  24. package/dist/evaluator/ExpressionEvaluator.js +60 -16
  25. package/dist/evaluator/FormulaFunctions.d.ts +58 -0
  26. package/dist/evaluator/FormulaFunctions.js +350 -0
  27. package/dist/evaluator/index.d.ts +4 -2
  28. package/dist/evaluator/index.js +4 -2
  29. package/dist/index.d.ts +14 -7
  30. package/dist/index.js +13 -9
  31. package/dist/query/index.d.ts +6 -0
  32. package/dist/query/index.js +6 -0
  33. package/dist/query/query-ast.d.ts +32 -0
  34. package/dist/query/query-ast.js +268 -0
  35. package/dist/registry/PluginScopeImpl.d.ts +80 -0
  36. package/dist/registry/PluginScopeImpl.js +243 -0
  37. package/dist/registry/PluginSystem.d.ts +66 -0
  38. package/dist/registry/PluginSystem.js +142 -0
  39. package/dist/registry/Registry.d.ts +83 -4
  40. package/dist/registry/Registry.js +113 -7
  41. package/dist/registry/WidgetRegistry.d.ts +120 -0
  42. package/dist/registry/WidgetRegistry.js +275 -0
  43. package/dist/theme/ThemeEngine.d.ts +82 -0
  44. package/dist/theme/ThemeEngine.js +400 -0
  45. package/dist/theme/index.d.ts +8 -0
  46. package/dist/theme/index.js +8 -0
  47. package/dist/validation/index.d.ts +9 -0
  48. package/dist/validation/index.js +9 -0
  49. package/dist/validation/validation-engine.d.ts +88 -0
  50. package/dist/validation/validation-engine.js +428 -0
  51. package/dist/validation/validators/index.d.ts +16 -0
  52. package/dist/validation/validators/index.js +16 -0
  53. package/dist/validation/validators/object-validation-engine.d.ts +118 -0
  54. package/dist/validation/validators/object-validation-engine.js +538 -0
  55. package/package.json +14 -5
  56. package/src/actions/ActionRunner.ts +577 -55
  57. package/src/actions/TransactionManager.ts +521 -0
  58. package/src/actions/__tests__/ActionRunner.params.test.ts +134 -0
  59. package/src/actions/__tests__/ActionRunner.test.ts +711 -0
  60. package/src/actions/__tests__/TransactionManager.test.ts +447 -0
  61. package/src/actions/index.ts +2 -1
  62. package/src/adapters/ApiDataSource.ts +349 -0
  63. package/src/adapters/ValueDataSource.ts +332 -0
  64. package/src/adapters/__tests__/ApiDataSource.test.ts +418 -0
  65. package/src/adapters/__tests__/ValueDataSource.test.ts +325 -0
  66. package/src/adapters/__tests__/resolveDataSource.test.ts +144 -0
  67. package/src/adapters/index.ts +6 -1
  68. package/src/adapters/resolveDataSource.ts +79 -0
  69. package/src/builder/__tests__/schema-builder.test.ts +235 -0
  70. package/src/data-scope/DataScopeManager.ts +269 -0
  71. package/src/data-scope/__tests__/DataScopeManager.test.ts +211 -0
  72. package/src/data-scope/index.ts +16 -0
  73. package/src/evaluator/ExpressionCache.ts +192 -0
  74. package/src/evaluator/ExpressionEvaluator.ts +61 -16
  75. package/src/evaluator/FormulaFunctions.ts +398 -0
  76. package/src/evaluator/__tests__/ExpressionCache.test.ts +135 -0
  77. package/src/evaluator/__tests__/ExpressionContext.test.ts +110 -0
  78. package/src/evaluator/__tests__/FormulaFunctions.test.ts +447 -0
  79. package/src/evaluator/index.ts +4 -2
  80. package/src/index.ts +14 -10
  81. package/src/query/__tests__/query-ast.test.ts +211 -0
  82. package/src/query/__tests__/window-functions.test.ts +275 -0
  83. package/src/query/index.ts +7 -0
  84. package/src/query/query-ast.ts +341 -0
  85. package/src/registry/PluginScopeImpl.ts +259 -0
  86. package/src/registry/PluginSystem.ts +161 -0
  87. package/src/registry/Registry.ts +136 -8
  88. package/src/registry/WidgetRegistry.ts +316 -0
  89. package/src/registry/__tests__/PluginSystem.test.ts +226 -0
  90. package/src/registry/__tests__/Registry.test.ts +293 -0
  91. package/src/registry/__tests__/WidgetRegistry.test.ts +321 -0
  92. package/src/registry/__tests__/plugin-scope-integration.test.ts +283 -0
  93. package/src/theme/ThemeEngine.ts +452 -0
  94. package/src/theme/__tests__/ThemeEngine.test.ts +606 -0
  95. package/src/theme/index.ts +22 -0
  96. package/src/validation/__tests__/object-validation-engine.test.ts +567 -0
  97. package/src/validation/__tests__/schema-validator.test.ts +118 -0
  98. package/src/validation/__tests__/validation-engine.test.ts +102 -0
  99. package/src/validation/index.ts +10 -0
  100. package/src/validation/validation-engine.ts +520 -0
  101. package/src/validation/validators/index.ts +25 -0
  102. package/src/validation/validators/object-validation-engine.ts +722 -0
  103. package/tsconfig.tsbuildinfo +1 -1
  104. package/vitest.config.ts +2 -0
  105. package/src/adapters/index.d.ts +0 -8
  106. package/src/adapters/index.js +0 -10
  107. package/src/builder/schema-builder.d.ts +0 -294
  108. package/src/builder/schema-builder.js +0 -503
  109. package/src/index.d.ts +0 -13
  110. package/src/index.js +0 -16
  111. package/src/registry/Registry.d.ts +0 -56
  112. package/src/registry/Registry.js +0 -43
  113. package/src/types/index.d.ts +0 -19
  114. package/src/types/index.js +0 -8
  115. package/src/utils/filter-converter.d.ts +0 -57
  116. package/src/utils/filter-converter.js +0 -100
  117. package/src/validation/schema-validator.d.ts +0 -94
  118. package/src/validation/schema-validator.js +0 -278
@@ -1,503 +0,0 @@
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
- * Base builder class
10
- */
11
- class SchemaBuilder {
12
- constructor(type) {
13
- Object.defineProperty(this, "schema", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- this.schema = { type };
20
- }
21
- /**
22
- * Set the ID
23
- */
24
- id(id) {
25
- this.schema.id = id;
26
- return this;
27
- }
28
- /**
29
- * Set the className
30
- */
31
- className(className) {
32
- this.schema.className = className;
33
- return this;
34
- }
35
- /**
36
- * Set visibility
37
- */
38
- visible(visible) {
39
- this.schema.visible = visible;
40
- return this;
41
- }
42
- /**
43
- * Set conditional visibility
44
- */
45
- visibleOn(expression) {
46
- this.schema.visibleOn = expression;
47
- return this;
48
- }
49
- /**
50
- * Set disabled state
51
- */
52
- disabled(disabled) {
53
- this.schema.disabled = disabled;
54
- return this;
55
- }
56
- /**
57
- * Set test ID
58
- */
59
- testId(testId) {
60
- this.schema.testId = testId;
61
- return this;
62
- }
63
- /**
64
- * Build the final schema
65
- */
66
- build() {
67
- return this.schema;
68
- }
69
- }
70
- /**
71
- * Form builder
72
- */
73
- export class FormBuilder extends SchemaBuilder {
74
- constructor() {
75
- super('form');
76
- this.schema.fields = [];
77
- }
78
- /**
79
- * Add a field to the form
80
- */
81
- field(field) {
82
- this.schema.fields = [...(this.schema.fields || []), field];
83
- return this;
84
- }
85
- /**
86
- * Add multiple fields
87
- */
88
- fields(fields) {
89
- this.schema.fields = fields;
90
- return this;
91
- }
92
- /**
93
- * Set default values
94
- */
95
- defaultValues(values) {
96
- this.schema.defaultValues = values;
97
- return this;
98
- }
99
- /**
100
- * Set submit label
101
- */
102
- submitLabel(label) {
103
- this.schema.submitLabel = label;
104
- return this;
105
- }
106
- /**
107
- * Set form layout
108
- */
109
- layout(layout) {
110
- this.schema.layout = layout;
111
- return this;
112
- }
113
- /**
114
- * Set number of columns
115
- */
116
- columns(columns) {
117
- this.schema.columns = columns;
118
- return this;
119
- }
120
- /**
121
- * Set submit handler
122
- */
123
- onSubmit(handler) {
124
- this.schema.onSubmit = handler;
125
- return this;
126
- }
127
- }
128
- /**
129
- * CRUD builder
130
- */
131
- export class CRUDBuilder extends SchemaBuilder {
132
- constructor() {
133
- super('crud');
134
- this.schema.columns = [];
135
- }
136
- /**
137
- * Set resource name
138
- */
139
- resource(resource) {
140
- this.schema.resource = resource;
141
- return this;
142
- }
143
- /**
144
- * Set API endpoint
145
- */
146
- api(api) {
147
- this.schema.api = api;
148
- return this;
149
- }
150
- /**
151
- * Set title
152
- */
153
- title(title) {
154
- this.schema.title = title;
155
- return this;
156
- }
157
- /**
158
- * Set description
159
- */
160
- description(description) {
161
- this.schema.description = description;
162
- return this;
163
- }
164
- /**
165
- * Add a column
166
- */
167
- column(column) {
168
- this.schema.columns = [...(this.schema.columns || []), column];
169
- return this;
170
- }
171
- /**
172
- * Set all columns
173
- */
174
- columns(columns) {
175
- this.schema.columns = columns;
176
- return this;
177
- }
178
- /**
179
- * Set form fields
180
- */
181
- fields(fields) {
182
- this.schema.fields = fields;
183
- return this;
184
- }
185
- /**
186
- * Enable create operation
187
- */
188
- enableCreate(label) {
189
- if (!this.schema.operations)
190
- this.schema.operations = {};
191
- this.schema.operations.create = {
192
- enabled: true,
193
- label: label || 'Create',
194
- api: this.schema.api,
195
- method: 'POST'
196
- };
197
- return this;
198
- }
199
- /**
200
- * Enable update operation
201
- */
202
- enableUpdate(label) {
203
- if (!this.schema.operations)
204
- this.schema.operations = {};
205
- this.schema.operations.update = {
206
- enabled: true,
207
- label: label || 'Update',
208
- api: `${this.schema.api}/\${id}`,
209
- method: 'PUT'
210
- };
211
- return this;
212
- }
213
- /**
214
- * Enable delete operation
215
- */
216
- enableDelete(label, confirmText) {
217
- if (!this.schema.operations)
218
- this.schema.operations = {};
219
- this.schema.operations.delete = {
220
- enabled: true,
221
- label: label || 'Delete',
222
- api: `${this.schema.api}/\${id}`,
223
- method: 'DELETE',
224
- confirmText: confirmText || 'Are you sure?'
225
- };
226
- return this;
227
- }
228
- /**
229
- * Set pagination
230
- */
231
- pagination(pageSize = 20) {
232
- this.schema.pagination = {
233
- enabled: true,
234
- pageSize,
235
- pageSizeOptions: [10, 20, 50, 100],
236
- showTotal: true,
237
- showSizeChanger: true
238
- };
239
- return this;
240
- }
241
- /**
242
- * Enable row selection
243
- */
244
- selectable(mode = 'multiple') {
245
- this.schema.selectable = mode;
246
- return this;
247
- }
248
- /**
249
- * Add a batch action
250
- */
251
- batchAction(action) {
252
- this.schema.batchActions = [...(this.schema.batchActions || []), action];
253
- return this;
254
- }
255
- /**
256
- * Add a row action
257
- */
258
- rowAction(action) {
259
- this.schema.rowActions = [...(this.schema.rowActions || []), action];
260
- return this;
261
- }
262
- }
263
- /**
264
- * Button builder
265
- */
266
- export class ButtonBuilder extends SchemaBuilder {
267
- constructor() {
268
- super('button');
269
- }
270
- /**
271
- * Set button label
272
- */
273
- label(label) {
274
- this.schema.label = label;
275
- return this;
276
- }
277
- /**
278
- * Set button variant
279
- */
280
- variant(variant) {
281
- this.schema.variant = variant;
282
- return this;
283
- }
284
- /**
285
- * Set button size
286
- */
287
- size(size) {
288
- this.schema.size = size;
289
- return this;
290
- }
291
- /**
292
- * Set button icon
293
- */
294
- icon(icon) {
295
- this.schema.icon = icon;
296
- return this;
297
- }
298
- /**
299
- * Set click handler
300
- */
301
- onClick(handler) {
302
- this.schema.onClick = handler;
303
- return this;
304
- }
305
- /**
306
- * Set loading state
307
- */
308
- loading(loading) {
309
- this.schema.loading = loading;
310
- return this;
311
- }
312
- }
313
- /**
314
- * Input builder
315
- */
316
- export class InputBuilder extends SchemaBuilder {
317
- constructor() {
318
- super('input');
319
- }
320
- /**
321
- * Set field name
322
- */
323
- name(name) {
324
- this.schema.name = name;
325
- return this;
326
- }
327
- /**
328
- * Set label
329
- */
330
- label(label) {
331
- this.schema.label = label;
332
- return this;
333
- }
334
- /**
335
- * Set placeholder
336
- */
337
- placeholder(placeholder) {
338
- this.schema.placeholder = placeholder;
339
- return this;
340
- }
341
- /**
342
- * Set input type
343
- */
344
- inputType(type) {
345
- this.schema.inputType = type;
346
- return this;
347
- }
348
- /**
349
- * Mark as required
350
- */
351
- required(required = true) {
352
- this.schema.required = required;
353
- return this;
354
- }
355
- /**
356
- * Set default value
357
- */
358
- defaultValue(value) {
359
- this.schema.defaultValue = value;
360
- return this;
361
- }
362
- }
363
- /**
364
- * Card builder
365
- */
366
- export class CardBuilder extends SchemaBuilder {
367
- constructor() {
368
- super('card');
369
- }
370
- /**
371
- * Set card title
372
- */
373
- title(title) {
374
- this.schema.title = title;
375
- return this;
376
- }
377
- /**
378
- * Set card description
379
- */
380
- description(description) {
381
- this.schema.description = description;
382
- return this;
383
- }
384
- /**
385
- * Set card content
386
- */
387
- content(content) {
388
- this.schema.content = content;
389
- return this;
390
- }
391
- /**
392
- * Set card variant
393
- */
394
- variant(variant) {
395
- this.schema.variant = variant;
396
- return this;
397
- }
398
- /**
399
- * Make card hoverable
400
- */
401
- hoverable(hoverable = true) {
402
- this.schema.hoverable = hoverable;
403
- return this;
404
- }
405
- }
406
- /**
407
- * Grid builder
408
- */
409
- export class GridBuilder extends SchemaBuilder {
410
- constructor() {
411
- super('grid');
412
- this.schema.children = [];
413
- }
414
- /**
415
- * Set number of columns
416
- */
417
- columns(columns) {
418
- this.schema.columns = columns;
419
- return this;
420
- }
421
- /**
422
- * Set gap
423
- */
424
- gap(gap) {
425
- this.schema.gap = gap;
426
- return this;
427
- }
428
- /**
429
- * Add a child
430
- */
431
- child(child) {
432
- const children = Array.isArray(this.schema.children) ? this.schema.children : [];
433
- this.schema.children = [...children, child];
434
- return this;
435
- }
436
- /**
437
- * Set all children
438
- */
439
- children(children) {
440
- this.schema.children = children;
441
- return this;
442
- }
443
- }
444
- /**
445
- * Flex builder
446
- */
447
- export class FlexBuilder extends SchemaBuilder {
448
- constructor() {
449
- super('flex');
450
- this.schema.children = [];
451
- }
452
- /**
453
- * Set flex direction
454
- */
455
- direction(direction) {
456
- this.schema.direction = direction;
457
- return this;
458
- }
459
- /**
460
- * Set justify content
461
- */
462
- justify(justify) {
463
- this.schema.justify = justify;
464
- return this;
465
- }
466
- /**
467
- * Set align items
468
- */
469
- align(align) {
470
- this.schema.align = align;
471
- return this;
472
- }
473
- /**
474
- * Set gap
475
- */
476
- gap(gap) {
477
- this.schema.gap = gap;
478
- return this;
479
- }
480
- /**
481
- * Add a child
482
- */
483
- child(child) {
484
- const children = Array.isArray(this.schema.children) ? this.schema.children : [];
485
- this.schema.children = [...children, child];
486
- return this;
487
- }
488
- /**
489
- * Set all children
490
- */
491
- children(children) {
492
- this.schema.children = children;
493
- return this;
494
- }
495
- }
496
- // Export factory functions
497
- export const form = () => new FormBuilder();
498
- export const crud = () => new CRUDBuilder();
499
- export const button = () => new ButtonBuilder();
500
- export const input = () => new InputBuilder();
501
- export const card = () => new CardBuilder();
502
- export const grid = () => new GridBuilder();
503
- export const flex = () => new FlexBuilder();
package/src/index.d.ts DELETED
@@ -1,13 +0,0 @@
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
- export * from './types';
9
- export * from './registry/Registry';
10
- export * from './validation/schema-validator';
11
- export * from './builder/schema-builder';
12
- export * from './adapters';
13
- export * from './utils/filter-converter';
package/src/index.js DELETED
@@ -1,16 +0,0 @@
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
- export * from './types';
9
- export * from './registry/Registry';
10
- export * from './validation/schema-validator';
11
- export * from './builder/schema-builder';
12
- export * from './utils/filter-converter';
13
- export * from './evaluator';
14
- export * from './actions';
15
- // export * from './data-scope'; // TODO
16
- // export * from './validators'; // TODO
@@ -1,56 +0,0 @@
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
- import type { SchemaNode } from '../types';
9
- export type ComponentRenderer<T = any> = T;
10
- export type ComponentInput = {
11
- name: string;
12
- type: 'string' | 'number' | 'boolean' | 'enum' | 'array' | 'object' | 'color' | 'date' | 'code' | 'file' | 'slot';
13
- label?: string;
14
- defaultValue?: any;
15
- required?: boolean;
16
- enum?: string[] | {
17
- label: string;
18
- value: any;
19
- }[];
20
- description?: string;
21
- advanced?: boolean;
22
- inputType?: string;
23
- };
24
- export type ComponentMeta = {
25
- label?: string;
26
- icon?: string;
27
- category?: string;
28
- inputs?: ComponentInput[];
29
- defaultProps?: Record<string, any>;
30
- defaultChildren?: SchemaNode[];
31
- examples?: Record<string, any>;
32
- isContainer?: boolean;
33
- resizable?: boolean;
34
- resizeConstraints?: {
35
- width?: boolean;
36
- height?: boolean;
37
- minWidth?: number;
38
- maxWidth?: number;
39
- minHeight?: number;
40
- maxHeight?: number;
41
- };
42
- };
43
- export type ComponentConfig<T = any> = ComponentMeta & {
44
- type: string;
45
- component: ComponentRenderer<T>;
46
- };
47
- export declare class Registry<T = any> {
48
- private components;
49
- register(type: string, component: ComponentRenderer<T>, meta?: ComponentMeta): void;
50
- get(type: string): ComponentRenderer<T> | undefined;
51
- getConfig(type: string): ComponentConfig<T> | undefined;
52
- has(type: string): boolean;
53
- getAllTypes(): string[];
54
- getAllConfigs(): ComponentConfig<T>[];
55
- }
56
- export declare const ComponentRegistry: Registry<any>;
@@ -1,43 +0,0 @@
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
- export class Registry {
9
- constructor() {
10
- Object.defineProperty(this, "components", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: new Map()
15
- });
16
- }
17
- register(type, component, meta) {
18
- if (this.components.has(type)) {
19
- console.warn(`Component type "${type}" is already registered. Overwriting.`);
20
- }
21
- this.components.set(type, {
22
- type,
23
- component,
24
- ...meta
25
- });
26
- }
27
- get(type) {
28
- return this.components.get(type)?.component;
29
- }
30
- getConfig(type) {
31
- return this.components.get(type);
32
- }
33
- has(type) {
34
- return this.components.has(type);
35
- }
36
- getAllTypes() {
37
- return Array.from(this.components.keys());
38
- }
39
- getAllConfigs() {
40
- return Array.from(this.components.values());
41
- }
42
- }
43
- export const ComponentRegistry = new Registry();
@@ -1,19 +0,0 @@
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
- export interface SchemaNode {
9
- type: string;
10
- id?: string;
11
- className?: string;
12
- data?: any;
13
- body?: SchemaNode | SchemaNode[];
14
- [key: string]: any;
15
- }
16
- export interface ComponentRendererProps {
17
- schema: SchemaNode;
18
- [key: string]: any;
19
- }
@@ -1,8 +0,0 @@
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
- export {};
@@ -1,57 +0,0 @@
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
- * Filter Converter Utilities
10
- *
11
- * Shared utilities for converting MongoDB-like filter operators
12
- * to ObjectStack FilterNode AST format.
13
- */
14
- /**
15
- * FilterNode AST type definition
16
- * Represents a filter condition or a logical combination of conditions
17
- *
18
- * @example
19
- * // Simple condition
20
- * ['status', '=', 'active']
21
- *
22
- * // Logical combination
23
- * ['and', ['age', '>=', 18], ['status', '=', 'active']]
24
- */
25
- export type FilterNode = [string, string, any] | [string, ...FilterNode[]];
26
- /**
27
- * Map MongoDB-like operators to ObjectStack filter operators.
28
- *
29
- * @param operator - MongoDB-style operator (e.g., '$gte', '$in')
30
- * @returns ObjectStack operator or null if not recognized
31
- */
32
- export declare function convertOperatorToAST(operator: string): string | null;
33
- /**
34
- * Convert object-based filters to ObjectStack FilterNode AST format.
35
- * Converts MongoDB-like operators to ObjectStack filter expressions.
36
- *
37
- * @param filter - Object-based filter with optional operators
38
- * @returns FilterNode AST array
39
- *
40
- * @example
41
- * // Simple filter - converted to AST
42
- * convertFiltersToAST({ status: 'active' })
43
- * // => ['status', '=', 'active']
44
- *
45
- * @example
46
- * // Complex filter with operators
47
- * convertFiltersToAST({ age: { $gte: 18 } })
48
- * // => ['age', '>=', 18]
49
- *
50
- * @example
51
- * // Multiple conditions
52
- * convertFiltersToAST({ age: { $gte: 18, $lte: 65 }, status: 'active' })
53
- * // => ['and', ['age', '>=', 18], ['age', '<=', 65], ['status', '=', 'active']]
54
- *
55
- * @throws {Error} If an unknown operator is encountered
56
- */
57
- export declare function convertFiltersToAST(filter: Record<string, any>): FilterNode | Record<string, any>;