@objectql/core 4.2.0 → 4.2.2

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 (116) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +5 -2
  4. package/dist/app.d.ts +61 -52
  5. package/dist/app.js +100 -435
  6. package/dist/app.js.map +1 -1
  7. package/dist/index.d.ts +14 -20
  8. package/dist/index.js +21 -20
  9. package/dist/index.js.map +1 -1
  10. package/dist/kernel-factory.d.ts +38 -0
  11. package/dist/kernel-factory.js +38 -0
  12. package/dist/kernel-factory.js.map +1 -0
  13. package/dist/plugin.d.ts +9 -16
  14. package/dist/plugin.js +71 -48
  15. package/dist/plugin.js.map +1 -1
  16. package/dist/repository.d.ts +4 -31
  17. package/dist/repository.js +7 -283
  18. package/dist/repository.js.map +1 -1
  19. package/dist/util.js +4 -2
  20. package/dist/util.js.map +1 -1
  21. package/package.json +14 -12
  22. package/src/app.ts +156 -539
  23. package/src/index.ts +18 -42
  24. package/src/kernel-factory.ts +47 -0
  25. package/src/plugin.ts +77 -85
  26. package/src/repository.ts +4 -320
  27. package/src/util.ts +5 -3
  28. package/test/__mocks__/@objectstack/core.ts +250 -1
  29. package/test/__mocks__/@objectstack/objectql.ts +273 -0
  30. package/test/__mocks__/@objectstack/runtime.ts +14 -5
  31. package/test/introspection.test.ts +1 -1
  32. package/test/mock-driver.ts +5 -5
  33. package/test/optimizations.test.ts +2 -2
  34. package/test/plugin-integration.test.ts +1 -3
  35. package/test/utils.ts +6 -6
  36. package/tsconfig.json +3 -1
  37. package/tsconfig.tsbuildinfo +1 -1
  38. package/dist/ai/index.d.ts +0 -8
  39. package/dist/ai/index.js +0 -25
  40. package/dist/ai/index.js.map +0 -1
  41. package/dist/ai/registry.d.ts +0 -23
  42. package/dist/ai/registry.js +0 -78
  43. package/dist/ai/registry.js.map +0 -1
  44. package/dist/gateway.d.ts +0 -37
  45. package/dist/gateway.js +0 -93
  46. package/dist/gateway.js.map +0 -1
  47. package/dist/optimizations/CompiledHookManager.d.ts +0 -56
  48. package/dist/optimizations/CompiledHookManager.js +0 -170
  49. package/dist/optimizations/CompiledHookManager.js.map +0 -1
  50. package/dist/optimizations/DependencyGraph.d.ts +0 -82
  51. package/dist/optimizations/DependencyGraph.js +0 -211
  52. package/dist/optimizations/DependencyGraph.js.map +0 -1
  53. package/dist/optimizations/GlobalConnectionPool.d.ts +0 -89
  54. package/dist/optimizations/GlobalConnectionPool.js +0 -193
  55. package/dist/optimizations/GlobalConnectionPool.js.map +0 -1
  56. package/dist/optimizations/LazyMetadataLoader.d.ts +0 -75
  57. package/dist/optimizations/LazyMetadataLoader.js +0 -149
  58. package/dist/optimizations/LazyMetadataLoader.js.map +0 -1
  59. package/dist/optimizations/OptimizedMetadataRegistry.d.ts +0 -26
  60. package/dist/optimizations/OptimizedMetadataRegistry.js +0 -117
  61. package/dist/optimizations/OptimizedMetadataRegistry.js.map +0 -1
  62. package/dist/optimizations/OptimizedValidationEngine.d.ts +0 -73
  63. package/dist/optimizations/OptimizedValidationEngine.js +0 -141
  64. package/dist/optimizations/OptimizedValidationEngine.js.map +0 -1
  65. package/dist/optimizations/QueryCompiler.d.ts +0 -51
  66. package/dist/optimizations/QueryCompiler.js +0 -216
  67. package/dist/optimizations/QueryCompiler.js.map +0 -1
  68. package/dist/optimizations/SQLQueryOptimizer.d.ts +0 -96
  69. package/dist/optimizations/SQLQueryOptimizer.js +0 -265
  70. package/dist/optimizations/SQLQueryOptimizer.js.map +0 -1
  71. package/dist/optimizations/index.d.ts +0 -32
  72. package/dist/optimizations/index.js +0 -44
  73. package/dist/optimizations/index.js.map +0 -1
  74. package/dist/protocol.d.ts +0 -191
  75. package/dist/protocol.js +0 -272
  76. package/dist/protocol.js.map +0 -1
  77. package/dist/query/filter-translator.d.ts +0 -24
  78. package/dist/query/filter-translator.js +0 -38
  79. package/dist/query/filter-translator.js.map +0 -1
  80. package/dist/query/index.d.ts +0 -22
  81. package/dist/query/index.js +0 -39
  82. package/dist/query/index.js.map +0 -1
  83. package/dist/query/query-analyzer.d.ts +0 -186
  84. package/dist/query/query-analyzer.js +0 -348
  85. package/dist/query/query-analyzer.js.map +0 -1
  86. package/dist/query/query-builder.d.ts +0 -27
  87. package/dist/query/query-builder.js +0 -69
  88. package/dist/query/query-builder.js.map +0 -1
  89. package/dist/query/query-service.d.ts +0 -151
  90. package/dist/query/query-service.js +0 -272
  91. package/dist/query/query-service.js.map +0 -1
  92. package/src/ai/index.ts +0 -9
  93. package/src/ai/registry.ts +0 -81
  94. package/src/gateway.ts +0 -105
  95. package/src/optimizations/CompiledHookManager.ts +0 -193
  96. package/src/optimizations/DependencyGraph.ts +0 -255
  97. package/src/optimizations/GlobalConnectionPool.ts +0 -251
  98. package/src/optimizations/LazyMetadataLoader.ts +0 -180
  99. package/src/optimizations/OptimizedMetadataRegistry.ts +0 -132
  100. package/src/optimizations/OptimizedValidationEngine.ts +0 -172
  101. package/src/optimizations/QueryCompiler.ts +0 -242
  102. package/src/optimizations/SQLQueryOptimizer.ts +0 -329
  103. package/src/optimizations/index.ts +0 -34
  104. package/src/protocol.ts +0 -304
  105. package/src/query/filter-translator.ts +0 -41
  106. package/src/query/index.ts +0 -24
  107. package/src/query/query-analyzer.ts +0 -532
  108. package/src/query/query-builder.ts +0 -64
  109. package/src/query/query-service.ts +0 -397
  110. package/test/ai-registry.test.ts +0 -42
  111. package/test/app.test.ts +0 -578
  112. package/test/filter-syntax.test.ts +0 -233
  113. package/test/gateway.test.ts +0 -88
  114. package/test/protocol.test.ts +0 -143
  115. package/test/repository-validation.test.ts +0 -351
  116. package/test/repository.test.ts +0 -151
@@ -11,9 +11,249 @@
11
11
  */
12
12
 
13
13
  export class ObjectQL {
14
+ private drivers = new Map<string, any>();
15
+ private defaultDriver: any = null;
16
+ private hooks = new Map<string, any[]>();
17
+ private middlewares: Array<{ fn: any; object?: string }> = [];
18
+
14
19
  constructor(public config: any) {}
20
+
15
21
  async connect() {}
16
22
  async disconnect() {}
23
+ async init() {
24
+ // Initialize drivers (connect + sync schema)
25
+ for (const [_name, driver] of this.drivers) {
26
+ if (driver.connect) {
27
+ await driver.connect();
28
+ }
29
+ if (driver.init) {
30
+ const objects = SchemaRegistry.getAllObjects();
31
+ await driver.init(objects);
32
+ }
33
+ }
34
+ }
35
+
36
+ registerDriver(driver: any, isDefault: boolean = false) {
37
+ if (!driver.name) {
38
+ throw new Error('Driver must have a name');
39
+ }
40
+ this.drivers.set(driver.name, driver);
41
+ if (isDefault) {
42
+ this.defaultDriver = driver.name;
43
+ }
44
+ }
45
+
46
+ datasource(name: string): any {
47
+ const driver = this.drivers.get(name);
48
+ if (!driver) {
49
+ throw new Error(`[ObjectQL] Datasource '${name}' not found`);
50
+ }
51
+ return driver;
52
+ }
53
+
54
+ getDriverByName(name: string): any {
55
+ return this.drivers.get(name);
56
+ }
57
+
58
+ registerObject(schema: any, packageId: string = '__runtime__', namespace?: string): string {
59
+ // Auto-assign field names from keys
60
+ if (schema.fields) {
61
+ for (const [key, field] of Object.entries(schema.fields)) {
62
+ if (field && typeof field === 'object' && !('name' in field)) {
63
+ (field as any).name = key;
64
+ }
65
+ }
66
+ }
67
+ return SchemaRegistry.registerObject(schema, packageId, namespace);
68
+ }
69
+
70
+ getObject(name: string) {
71
+ return SchemaRegistry.getObject(name);
72
+ }
73
+
74
+ getConfigs(): Record<string, any> {
75
+ return SchemaRegistry.getAllObjects().reduce((acc: any, obj: any) => {
76
+ if (obj.name) {
77
+ acc[obj.name] = obj;
78
+ }
79
+ return acc;
80
+ }, {});
81
+ }
82
+
83
+ removePackage(packageId: string) {
84
+ SchemaRegistry.unregisterObjectsByPackage(packageId);
85
+ }
86
+
87
+ registerHook(event: string, handler: any, options?: any) {
88
+ if (!this.hooks.has(event)) {
89
+ this.hooks.set(event, []);
90
+ }
91
+ this.hooks.get(event)!.push({ handler, options });
92
+ }
93
+
94
+ on(event: string, objectName: string, handler: any, packageId?: string) {
95
+ this.registerHook(event, handler, { object: objectName, packageId });
96
+ }
97
+
98
+ registerMiddleware(fn: any, options?: { object?: string }) {
99
+ this.middlewares.push({ fn, object: options?.object });
100
+ }
101
+
102
+ private async executeWithMiddleware(opCtx: any, executor: () => Promise<any>) {
103
+ const applicable = this.middlewares.filter(
104
+ (m) => !m.object || m.object === '*' || m.object === opCtx.object
105
+ );
106
+ let index = 0;
107
+ const next = async () => {
108
+ if (index < applicable.length) {
109
+ const mw = applicable[index++];
110
+ await mw.fn(opCtx, next);
111
+ } else {
112
+ opCtx.result = await executor();
113
+ }
114
+ };
115
+ await next();
116
+ return opCtx.result;
117
+ }
118
+
119
+ private async triggerHooks(event: string, context: any) {
120
+ const entries = this.hooks.get(event) || [];
121
+ for (const entry of entries) {
122
+ if (entry.options?.object) {
123
+ const targets = Array.isArray(entry.options.object) ? entry.options.object : [entry.options.object];
124
+ if (!targets.includes('*') && !targets.includes(context.object)) {
125
+ continue;
126
+ }
127
+ }
128
+ await entry.handler(context);
129
+ }
130
+ }
131
+
132
+ createContext(options: any = {}) {
133
+ return {
134
+ isSystem: options.isSystem || false,
135
+ object: (name: string) => ({
136
+ find: async (filter: any) => {
137
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
138
+ const opCtx = { object: name, operation: 'find', options: filter, context: options, result: undefined as any };
139
+ await this.executeWithMiddleware(opCtx, async () => {
140
+ const hookContext = { object: name, event: 'beforeFind', input: { options: filter }, session: options };
141
+ await this.triggerHooks('beforeFind', hookContext);
142
+ const result = driver?.find ? await driver.find(name, filter) : [];
143
+ hookContext.event = 'afterFind';
144
+ (hookContext as any).result = result;
145
+ await this.triggerHooks('afterFind', hookContext);
146
+ return (hookContext as any).result;
147
+ });
148
+ return opCtx.result;
149
+ },
150
+ findOne: async (filter: any) => {
151
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
152
+ const opCtx = { object: name, operation: 'findOne', options: filter, context: options, result: undefined as any };
153
+ await this.executeWithMiddleware(opCtx, async () => {
154
+ return driver?.findOne ? await driver.findOne(name, filter) : null;
155
+ });
156
+ return opCtx.result;
157
+ },
158
+ create: async (data: any) => {
159
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
160
+ const opCtx = { object: name, operation: 'insert', data, context: options, result: undefined as any };
161
+ await this.executeWithMiddleware(opCtx, async () => {
162
+ const hookContext: any = {
163
+ object: name, event: 'beforeCreate',
164
+ input: { data: opCtx.data }, session: options,
165
+ data: opCtx.data, user: options.userId ? { id: options.userId } : options.user
166
+ };
167
+ await this.triggerHooks('beforeCreate', hookContext);
168
+ const finalData = hookContext.data || hookContext.input.data;
169
+ const result = driver?.create ? await driver.create(name, finalData, options) : finalData;
170
+ hookContext.event = 'afterCreate';
171
+ hookContext.result = result;
172
+ await this.triggerHooks('afterCreate', hookContext);
173
+ return hookContext.result;
174
+ });
175
+ return opCtx.result;
176
+ },
177
+ insert: async (data: any) => {
178
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
179
+ const opCtx = { object: name, operation: 'insert', data, context: options, result: undefined as any };
180
+ await this.executeWithMiddleware(opCtx, async () => {
181
+ const hookContext: any = {
182
+ object: name, event: 'beforeCreate',
183
+ input: { data: opCtx.data }, session: options,
184
+ data: opCtx.data, user: options.userId ? { id: options.userId } : options.user
185
+ };
186
+ await this.triggerHooks('beforeCreate', hookContext);
187
+ const finalData = hookContext.data || hookContext.input.data;
188
+ const result = driver?.create ? await driver.create(name, finalData, options)
189
+ : driver?.insert ? await driver.insert(name, finalData)
190
+ : finalData;
191
+ hookContext.event = 'afterCreate';
192
+ hookContext.result = result;
193
+ await this.triggerHooks('afterCreate', hookContext);
194
+ return hookContext.result;
195
+ });
196
+ return opCtx.result;
197
+ },
198
+ update: async (id: string, data: any) => {
199
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
200
+ const opCtx = { object: name, operation: 'update', data, context: options, result: undefined as any };
201
+ await this.executeWithMiddleware(opCtx, async () => {
202
+ // Fetch previous data for hooks that need it
203
+ let previousData: any;
204
+ if (driver?.findOne) {
205
+ try { previousData = await driver.findOne(name, { _id: id }); } catch (_e) { /* ignore */ }
206
+ }
207
+ const hookContext: any = {
208
+ object: name, event: 'beforeUpdate',
209
+ input: { id, data: opCtx.data }, session: options,
210
+ data: opCtx.data, previousData, user: options.userId ? { id: options.userId } : options.user
211
+ };
212
+ await this.triggerHooks('beforeUpdate', hookContext);
213
+ const finalData = hookContext.data || hookContext.input.data;
214
+ const result = driver?.update ? await driver.update(name, id, finalData, options) : finalData;
215
+ hookContext.event = 'afterUpdate';
216
+ hookContext.result = result;
217
+ await this.triggerHooks('afterUpdate', hookContext);
218
+ return hookContext.result;
219
+ });
220
+ return opCtx.result;
221
+ },
222
+ delete: async (id: string) => {
223
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
224
+ const opCtx = { object: name, operation: 'delete', context: options, result: undefined as any };
225
+ await this.executeWithMiddleware(opCtx, async () => {
226
+ // Fetch current data for hooks that need it
227
+ let previousData: any;
228
+ if (driver?.findOne) {
229
+ try { previousData = await driver.findOne(name, { _id: id }); } catch (_e) { /* ignore */ }
230
+ }
231
+ const hookContext: any = {
232
+ object: name, event: 'beforeDelete',
233
+ input: { id }, session: options,
234
+ data: previousData, previousData, user: options.userId ? { id: options.userId } : options.user
235
+ };
236
+ await this.triggerHooks('beforeDelete', hookContext);
237
+ const result = driver?.delete ? await driver.delete(name, id) : true;
238
+ hookContext.event = 'afterDelete';
239
+ hookContext.result = result;
240
+ await this.triggerHooks('afterDelete', hookContext);
241
+ return hookContext.result;
242
+ });
243
+ return opCtx.result;
244
+ },
245
+ count: async (filter?: any) => {
246
+ const driver = this.drivers.get(this.defaultDriver || this.drivers.keys().next().value);
247
+ if (driver?.count) {
248
+ return driver.count(name, filter);
249
+ }
250
+ // Fallback: use find and count
251
+ const results = driver?.find ? await driver.find(name, filter) : [];
252
+ return Array.isArray(results) ? results.length : 0;
253
+ }
254
+ })
255
+ };
256
+ }
17
257
  }
18
258
 
19
259
  const mockStore = new Map<string, Map<string, any>>();
@@ -42,4 +282,37 @@ export const SchemaRegistry = {
42
282
  return items ? Array.from(items.values()) : [];
43
283
  }),
44
284
  metadata: mockStore,
285
+
286
+ // Additional methods needed for ObjectQL compatibility
287
+ registerObject: jest.fn((schema: any, packageId?: string, namespace?: string) => {
288
+ if (!mockStore.has('object')) {
289
+ mockStore.set('object', new Map());
290
+ }
291
+ const name = schema.name || 'unnamed';
292
+ mockStore.get('object')!.set(name, schema);
293
+ return namespace ? `${namespace}.${name}` : name;
294
+ }),
295
+
296
+ getObject: jest.fn((name: string) => {
297
+ return mockStore.get('object')?.get(name);
298
+ }),
299
+
300
+ getAllObjects: jest.fn(() => {
301
+ const objects = mockStore.get('object');
302
+ return objects ? Array.from(objects.values()) : [];
303
+ }),
304
+
305
+ unregisterObjectsByPackage: jest.fn((packageId: string) => {
306
+ // In mock, just clear the objects store
307
+ const objects = mockStore.get('object');
308
+ if (objects) {
309
+ const toDelete: string[] = [];
310
+ objects.forEach((obj, key) => {
311
+ if ((obj as any).__packageId === packageId) {
312
+ toDelete.push(key);
313
+ }
314
+ });
315
+ toDelete.forEach(key => objects.delete(key));
316
+ }
317
+ }),
45
318
  };
@@ -11,12 +11,21 @@
11
11
  class MockMetadataRegistry {
12
12
  private store = new Map<string, Map<string, any>>();
13
13
 
14
- register(type: string, item: any): void {
14
+ register(type: string, nameOrConfig: string | any, config?: any): void {
15
15
  if (!this.store.has(type)) {
16
16
  this.store.set(type, new Map());
17
17
  }
18
18
  const typeMap = this.store.get(type)!;
19
- typeMap.set(item.id || item.name, item);
19
+ let name: string;
20
+ let item: any;
21
+ if (config) {
22
+ name = nameOrConfig as string;
23
+ item = config;
24
+ } else {
25
+ item = nameOrConfig;
26
+ name = item.id || item.name;
27
+ }
28
+ typeMap.set(name, item);
20
29
  }
21
30
 
22
31
  get<T = any>(type: string, id: string): T | undefined {
@@ -43,7 +52,7 @@ class MockMetadataRegistry {
43
52
 
44
53
  unregisterPackage(packageName: string): void {
45
54
  // Simple implementation - in real runtime this would filter by package
46
- for (const [type, typeMap] of this.store.entries()) {
55
+ for (const [_type, typeMap] of this.store.entries()) {
47
56
  const toDelete: string[] = [];
48
57
  for (const [id, item] of typeMap.entries()) {
49
58
  if (item.packageName === packageName || item.package === packageName) {
@@ -233,11 +242,11 @@ export class ObjectKernel {
233
242
  return true;
234
243
  }
235
244
 
236
- getMetadata(objectName: string): any {
245
+ getMetadata(_objectName: string): any {
237
246
  return {};
238
247
  }
239
248
 
240
- getView(objectName: string, viewType?: 'list' | 'form'): any {
249
+ getView(_objectName: string, _viewType?: 'list' | 'form'): any {
241
250
  return null;
242
251
  }
243
252
  }
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { convertIntrospectedSchemaToObjects } from '../src/util';
10
- import { IntrospectedSchema, ObjectConfig } from '@objectql/types';
10
+ import { IntrospectedSchema } from '@objectql/types';
11
11
 
12
12
  describe('convertIntrospectedSchemaToObjects', () => {
13
13
  it('should convert simple table to object config', () => {
@@ -25,7 +25,7 @@ export class MockDriver implements Driver {
25
25
  return this.data[objectName];
26
26
  }
27
27
 
28
- async find(objectName: string, query: any, options?: any): Promise<any[]> {
28
+ async find(objectName: string, query: any, _options?: any): Promise<any[]> {
29
29
  const items = this.getData(objectName);
30
30
  // Very basic filter implementation for testing
31
31
  if (query.filters) {
@@ -42,12 +42,12 @@ export class MockDriver implements Driver {
42
42
  return items;
43
43
  }
44
44
 
45
- async findOne(objectName: string, id: string | number, query?: any, options?: any): Promise<any> {
45
+ async findOne(objectName: string, id: string | number, _query?: any, _options?: any): Promise<any> {
46
46
  const items = this.getData(objectName);
47
47
  return items.find((item: any) => item._id === id);
48
48
  }
49
49
 
50
- async create(objectName: string, data: any, options?: any): Promise<any> {
50
+ async create(objectName: string, data: any, _options?: any): Promise<any> {
51
51
  const items = this.getData(objectName);
52
52
  const newItem = {
53
53
  ...data,
@@ -57,7 +57,7 @@ export class MockDriver implements Driver {
57
57
  return newItem;
58
58
  }
59
59
 
60
- async update(objectName: string, id: string | number, data: any, options?: any): Promise<any> {
60
+ async update(objectName: string, id: string | number, data: any, _options?: any): Promise<any> {
61
61
  const items = this.getData(objectName);
62
62
  const index = items.findIndex((item: any) => item._id === id);
63
63
  if (index > -1) {
@@ -67,7 +67,7 @@ export class MockDriver implements Driver {
67
67
  throw new Error('Not found');
68
68
  }
69
69
 
70
- async delete(objectName: string, id: string | number, options?: any): Promise<any> {
70
+ async delete(objectName: string, id: string | number, _options?: any): Promise<any> {
71
71
  const items = this.getData(objectName);
72
72
  const index = items.findIndex((item: any) => item._id === id);
73
73
  if (index > -1) {
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
 
9
- // import { describe, it, expect, beforeEach } from '@jest/globals';
9
+ // Import from the plugin package where the optimization modules now live
10
10
  import {
11
11
  OptimizedMetadataRegistry,
12
12
  QueryCompiler,
@@ -16,7 +16,7 @@ import {
16
16
  LazyMetadataLoader,
17
17
  DependencyGraph,
18
18
  SQLQueryOptimizer
19
- } from '../src/optimizations';
19
+ } from '@objectql/plugin-optimizations';
20
20
 
21
21
  describe('Kernel Optimizations', () => {
22
22
  describe('OptimizedMetadataRegistry', () => {
@@ -46,7 +46,7 @@ describe('ObjectQLPlugin Integration', () => {
46
46
  it('should have correct name and version', () => {
47
47
  plugin = new ObjectQLPlugin();
48
48
  expect(plugin.name).toBe('@objectql/core');
49
- expect(plugin.version).toBe('4.0.2');
49
+ expect(plugin.version).toBe('4.2.0');
50
50
  });
51
51
  });
52
52
 
@@ -61,7 +61,6 @@ describe('ObjectQLPlugin Integration', () => {
61
61
  enableRepository: false,
62
62
  enableValidator: false,
63
63
  enableFormulas: true,
64
- enableAI: false,
65
64
  });
66
65
  expect(plugin).toBeDefined();
67
66
  });
@@ -176,7 +175,6 @@ describe('ObjectQLPlugin Integration', () => {
176
175
  enableRepository: false,
177
176
  enableValidator: false,
178
177
  enableFormulas: false,
179
- enableAI: false,
180
178
  });
181
179
 
182
180
  const runtimeContext = { engine: mockContext.app };
package/test/utils.ts CHANGED
@@ -20,22 +20,22 @@ export class MockDriver implements Driver {
20
20
  return this.data[objectName];
21
21
  }
22
22
 
23
- async find(objectName: string, query: any, options?: any): Promise<any[]> {
23
+ async find(objectName: string, _query: any, _options?: any): Promise<any[]> {
24
24
  return this.getData(objectName);
25
25
  }
26
26
 
27
- async findOne(objectName: string, id: string | number, query?: any, options?: any): Promise<any> {
27
+ async findOne(objectName: string, id: string | number, _query?: any, _options?: any): Promise<any> {
28
28
  return this.getData(objectName).find(item => item.id == id);
29
29
  }
30
30
 
31
- async create(objectName: string, data: any, options?: any): Promise<any> {
31
+ async create(objectName: string, data: any, _options?: any): Promise<any> {
32
32
  const list = this.getData(objectName);
33
33
  if (!data.id) data.id = list.length + 1;
34
34
  list.push(data);
35
35
  return data;
36
36
  }
37
37
 
38
- async update(objectName: string, id: string | number, data: any, options?: any): Promise<any> {
38
+ async update(objectName: string, id: string | number, data: any, _options?: any): Promise<any> {
39
39
  const list = this.getData(objectName);
40
40
  const idx = list.findIndex(item => item.id == id);
41
41
  if (idx >= 0) {
@@ -45,7 +45,7 @@ export class MockDriver implements Driver {
45
45
  return null;
46
46
  }
47
47
 
48
- async delete(objectName: string, id: string | number, options?: any): Promise<any> {
48
+ async delete(objectName: string, id: string | number, _options?: any): Promise<any> {
49
49
  const list = this.getData(objectName);
50
50
  const idx = list.findIndex(item => item.id == id);
51
51
  if (idx >= 0) {
@@ -56,7 +56,7 @@ export class MockDriver implements Driver {
56
56
  return null;
57
57
  }
58
58
 
59
- async count(objectName: string, filters: any, options?: any): Promise<number> {
59
+ async count(objectName: string, _filters: any, _options?: any): Promise<number> {
60
60
  return this.getData(objectName).length;
61
61
  }
62
62
  }
package/tsconfig.json CHANGED
@@ -12,6 +12,8 @@
12
12
  "references": [
13
13
  { "path": "../types" },
14
14
  { "path": "../plugin-validator" },
15
- { "path": "../plugin-formula" }
15
+ { "path": "../plugin-formula" },
16
+ { "path": "../plugin-query" },
17
+ { "path": "../plugin-optimizations" }
16
18
  ]
17
19
  }