@object-ui/core 0.3.1 → 0.5.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 (68) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/dist/actions/index.d.ts +1 -1
  3. package/dist/actions/index.js +1 -1
  4. package/dist/evaluator/ExpressionCache.d.ts +101 -0
  5. package/dist/evaluator/ExpressionCache.js +135 -0
  6. package/dist/evaluator/ExpressionEvaluator.d.ts +20 -2
  7. package/dist/evaluator/ExpressionEvaluator.js +34 -14
  8. package/dist/evaluator/index.d.ts +3 -2
  9. package/dist/evaluator/index.js +3 -2
  10. package/dist/index.d.ts +10 -7
  11. package/dist/index.js +9 -7
  12. package/dist/query/index.d.ts +6 -0
  13. package/dist/query/index.js +6 -0
  14. package/dist/query/query-ast.d.ts +32 -0
  15. package/dist/query/query-ast.js +268 -0
  16. package/dist/registry/PluginScopeImpl.d.ts +80 -0
  17. package/dist/registry/PluginScopeImpl.js +243 -0
  18. package/dist/registry/PluginSystem.d.ts +66 -0
  19. package/dist/registry/PluginSystem.js +142 -0
  20. package/dist/registry/Registry.d.ts +73 -4
  21. package/dist/registry/Registry.js +112 -7
  22. package/dist/validation/index.d.ts +9 -0
  23. package/dist/validation/index.js +9 -0
  24. package/dist/validation/validation-engine.d.ts +70 -0
  25. package/dist/validation/validation-engine.js +363 -0
  26. package/dist/validation/validators/index.d.ts +16 -0
  27. package/dist/validation/validators/index.js +16 -0
  28. package/dist/validation/validators/object-validation-engine.d.ts +118 -0
  29. package/dist/validation/validators/object-validation-engine.js +538 -0
  30. package/package.json +13 -5
  31. package/src/actions/index.ts +1 -1
  32. package/src/evaluator/ExpressionCache.ts +192 -0
  33. package/src/evaluator/ExpressionEvaluator.ts +33 -14
  34. package/src/evaluator/__tests__/ExpressionCache.test.ts +135 -0
  35. package/src/evaluator/index.ts +3 -2
  36. package/src/index.ts +10 -7
  37. package/src/query/__tests__/query-ast.test.ts +211 -0
  38. package/src/query/__tests__/window-functions.test.ts +275 -0
  39. package/src/query/index.ts +7 -0
  40. package/src/query/query-ast.ts +341 -0
  41. package/src/registry/PluginScopeImpl.ts +259 -0
  42. package/src/registry/PluginSystem.ts +161 -0
  43. package/src/registry/Registry.ts +125 -8
  44. package/src/registry/__tests__/PluginSystem.test.ts +226 -0
  45. package/src/registry/__tests__/Registry.test.ts +293 -0
  46. package/src/registry/__tests__/plugin-scope-integration.test.ts +283 -0
  47. package/src/validation/__tests__/object-validation-engine.test.ts +567 -0
  48. package/src/validation/__tests__/validation-engine.test.ts +102 -0
  49. package/src/validation/index.ts +10 -0
  50. package/src/validation/validation-engine.ts +461 -0
  51. package/src/validation/validators/index.ts +25 -0
  52. package/src/validation/validators/object-validation-engine.ts +722 -0
  53. package/tsconfig.tsbuildinfo +1 -1
  54. package/vitest.config.ts +2 -0
  55. package/src/adapters/index.d.ts +0 -8
  56. package/src/adapters/index.js +0 -10
  57. package/src/builder/schema-builder.d.ts +0 -294
  58. package/src/builder/schema-builder.js +0 -503
  59. package/src/index.d.ts +0 -13
  60. package/src/index.js +0 -16
  61. package/src/registry/Registry.d.ts +0 -56
  62. package/src/registry/Registry.js +0 -43
  63. package/src/types/index.d.ts +0 -19
  64. package/src/types/index.js +0 -8
  65. package/src/utils/filter-converter.d.ts +0 -57
  66. package/src/utils/filter-converter.js +0 -100
  67. package/src/validation/schema-validator.d.ts +0 -94
  68. package/src/validation/schema-validator.js +0 -278
@@ -1,294 +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
- * @object-ui/core - Schema Builder
10
- *
11
- * Fluent API for building schemas programmatically.
12
- * Provides type-safe builder functions for common schema patterns.
13
- *
14
- * @module builder
15
- * @packageDocumentation
16
- */
17
- import type { BaseSchema, FormSchema, FormField, CRUDSchema, TableColumn, ActionSchema, ButtonSchema, InputSchema, CardSchema, GridSchema, FlexSchema } from '@object-ui/types';
18
- /**
19
- * Base builder class
20
- */
21
- declare class SchemaBuilder<T extends BaseSchema> {
22
- protected schema: any;
23
- constructor(type: string);
24
- /**
25
- * Set the ID
26
- */
27
- id(id: string): this;
28
- /**
29
- * Set the className
30
- */
31
- className(className: string): this;
32
- /**
33
- * Set visibility
34
- */
35
- visible(visible: boolean): this;
36
- /**
37
- * Set conditional visibility
38
- */
39
- visibleOn(expression: string): this;
40
- /**
41
- * Set disabled state
42
- */
43
- disabled(disabled: boolean): this;
44
- /**
45
- * Set test ID
46
- */
47
- testId(testId: string): this;
48
- /**
49
- * Build the final schema
50
- */
51
- build(): T;
52
- }
53
- /**
54
- * Form builder
55
- */
56
- export declare class FormBuilder extends SchemaBuilder<FormSchema> {
57
- constructor();
58
- /**
59
- * Add a field to the form
60
- */
61
- field(field: FormField): this;
62
- /**
63
- * Add multiple fields
64
- */
65
- fields(fields: FormField[]): this;
66
- /**
67
- * Set default values
68
- */
69
- defaultValues(values: Record<string, any>): this;
70
- /**
71
- * Set submit label
72
- */
73
- submitLabel(label: string): this;
74
- /**
75
- * Set form layout
76
- */
77
- layout(layout: 'vertical' | 'horizontal'): this;
78
- /**
79
- * Set number of columns
80
- */
81
- columns(columns: number): this;
82
- /**
83
- * Set submit handler
84
- */
85
- onSubmit(handler: (data: Record<string, any>) => void | Promise<void>): this;
86
- }
87
- /**
88
- * CRUD builder
89
- */
90
- export declare class CRUDBuilder extends SchemaBuilder<CRUDSchema> {
91
- constructor();
92
- /**
93
- * Set resource name
94
- */
95
- resource(resource: string): this;
96
- /**
97
- * Set API endpoint
98
- */
99
- api(api: string): this;
100
- /**
101
- * Set title
102
- */
103
- title(title: string): this;
104
- /**
105
- * Set description
106
- */
107
- description(description: string): this;
108
- /**
109
- * Add a column
110
- */
111
- column(column: TableColumn): this;
112
- /**
113
- * Set all columns
114
- */
115
- columns(columns: TableColumn[]): this;
116
- /**
117
- * Set form fields
118
- */
119
- fields(fields: FormField[]): this;
120
- /**
121
- * Enable create operation
122
- */
123
- enableCreate(label?: string): this;
124
- /**
125
- * Enable update operation
126
- */
127
- enableUpdate(label?: string): this;
128
- /**
129
- * Enable delete operation
130
- */
131
- enableDelete(label?: string, confirmText?: string): this;
132
- /**
133
- * Set pagination
134
- */
135
- pagination(pageSize?: number): this;
136
- /**
137
- * Enable row selection
138
- */
139
- selectable(mode?: 'single' | 'multiple'): this;
140
- /**
141
- * Add a batch action
142
- */
143
- batchAction(action: ActionSchema): this;
144
- /**
145
- * Add a row action
146
- */
147
- rowAction(action: ActionSchema): this;
148
- }
149
- /**
150
- * Button builder
151
- */
152
- export declare class ButtonBuilder extends SchemaBuilder<ButtonSchema> {
153
- constructor();
154
- /**
155
- * Set button label
156
- */
157
- label(label: string): this;
158
- /**
159
- * Set button variant
160
- */
161
- variant(variant: 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link'): this;
162
- /**
163
- * Set button size
164
- */
165
- size(size: 'default' | 'sm' | 'lg' | 'icon'): this;
166
- /**
167
- * Set button icon
168
- */
169
- icon(icon: string): this;
170
- /**
171
- * Set click handler
172
- */
173
- onClick(handler: () => void | Promise<void>): this;
174
- /**
175
- * Set loading state
176
- */
177
- loading(loading: boolean): this;
178
- }
179
- /**
180
- * Input builder
181
- */
182
- export declare class InputBuilder extends SchemaBuilder<InputSchema> {
183
- constructor();
184
- /**
185
- * Set field name
186
- */
187
- name(name: string): this;
188
- /**
189
- * Set label
190
- */
191
- label(label: string): this;
192
- /**
193
- * Set placeholder
194
- */
195
- placeholder(placeholder: string): this;
196
- /**
197
- * Set input type
198
- */
199
- inputType(type: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url'): this;
200
- /**
201
- * Mark as required
202
- */
203
- required(required?: boolean): this;
204
- /**
205
- * Set default value
206
- */
207
- defaultValue(value: string | number): this;
208
- }
209
- /**
210
- * Card builder
211
- */
212
- export declare class CardBuilder extends SchemaBuilder<CardSchema> {
213
- constructor();
214
- /**
215
- * Set card title
216
- */
217
- title(title: string): this;
218
- /**
219
- * Set card description
220
- */
221
- description(description: string): this;
222
- /**
223
- * Set card content
224
- */
225
- content(content: BaseSchema | BaseSchema[]): this;
226
- /**
227
- * Set card variant
228
- */
229
- variant(variant: 'default' | 'outline' | 'ghost'): this;
230
- /**
231
- * Make card hoverable
232
- */
233
- hoverable(hoverable?: boolean): this;
234
- }
235
- /**
236
- * Grid builder
237
- */
238
- export declare class GridBuilder extends SchemaBuilder<GridSchema> {
239
- constructor();
240
- /**
241
- * Set number of columns
242
- */
243
- columns(columns: number): this;
244
- /**
245
- * Set gap
246
- */
247
- gap(gap: number): this;
248
- /**
249
- * Add a child
250
- */
251
- child(child: BaseSchema): this;
252
- /**
253
- * Set all children
254
- */
255
- children(children: BaseSchema[]): this;
256
- }
257
- /**
258
- * Flex builder
259
- */
260
- export declare class FlexBuilder extends SchemaBuilder<FlexSchema> {
261
- constructor();
262
- /**
263
- * Set flex direction
264
- */
265
- direction(direction: 'row' | 'col' | 'row-reverse' | 'col-reverse'): this;
266
- /**
267
- * Set justify content
268
- */
269
- justify(justify: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'): this;
270
- /**
271
- * Set align items
272
- */
273
- align(align: 'start' | 'end' | 'center' | 'baseline' | 'stretch'): this;
274
- /**
275
- * Set gap
276
- */
277
- gap(gap: number): this;
278
- /**
279
- * Add a child
280
- */
281
- child(child: BaseSchema): this;
282
- /**
283
- * Set all children
284
- */
285
- children(children: BaseSchema[]): this;
286
- }
287
- export declare const form: () => FormBuilder;
288
- export declare const crud: () => CRUDBuilder;
289
- export declare const button: () => ButtonBuilder;
290
- export declare const input: () => InputBuilder;
291
- export declare const card: () => CardBuilder;
292
- export declare const grid: () => GridBuilder;
293
- export declare const flex: () => FlexBuilder;
294
- export {};