Skip to content

Commit 437b0b8

Browse files
Copilothotlong
andcommitted
fix(objectql): use proper kernel.use() API in createObjectQLKernel factory
Removed `as any` type assertion and use the proper async kernel.use() API for registering plugins with ObjectKernel. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b0ffd20 commit 437b0b8

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/objectql': minor
3+
---
4+
5+
feat(objectql): add utility functions, introspection types, and kernel factory
6+
7+
Upstream key functionality from downstream `@objectql/core` to enable its future deprecation:
8+
9+
- **Introspection types**: `IntrospectedSchema`, `IntrospectedTable`, `IntrospectedColumn`, `IntrospectedForeignKey`
10+
- **Utility functions**: `toTitleCase()`, `convertIntrospectedSchemaToObjects()`
11+
- **Kernel factory**: `createObjectQLKernel()` with `ObjectQLKernelOptions`

packages/objectql/src/kernel-factory.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ export interface ObjectQLKernelOptions {
3131
* await kernel.bootstrap();
3232
* ```
3333
*/
34-
export function createObjectQLKernel(options: ObjectQLKernelOptions = {}): ObjectKernel {
35-
return new (ObjectKernel as any)([
36-
new ObjectQLPlugin(),
37-
...(options.plugins || []),
38-
]);
34+
export async function createObjectQLKernel(options: ObjectQLKernelOptions = {}): Promise<ObjectKernel> {
35+
const kernel = new ObjectKernel();
36+
37+
// Register the core ObjectQLPlugin first
38+
await kernel.use(new ObjectQLPlugin());
39+
40+
// Register any additional plugins
41+
if (options.plugins) {
42+
for (const plugin of options.plugins) {
43+
await kernel.use(plugin);
44+
}
45+
}
46+
47+
return kernel;
3948
}

0 commit comments

Comments
 (0)