Skip to content

Commit ab6102a

Browse files
committed
Refactor imports to separate ObjectQL from runtime package and update related examples
1 parent 6c53159 commit ab6102a

File tree

13 files changed

+30
-24
lines changed

13 files changed

+30
-24
lines changed

content/docs/developers/micro-kernel.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ The kernel manages plugin lifecycle and provides core services.
4646
**API:**
4747
```typescript
4848
import { ObjectKernel } from '@objectstack/core';
49-
import { ObjectQLPlugin, DriverPlugin } from '@objectstack/runtime';
49+
import { DriverPlugin } from '@objectstack/runtime';
50+
import { ObjectQLPlugin } from '@objectstack/objectql';
5051

5152
const kernel = new ObjectKernel();
5253

@@ -137,7 +138,8 @@ interface PluginContext {
137138
Registers the ObjectQL query engine as a service.
138139

139140
```typescript
140-
import { ObjectKernel, ObjectQLPlugin } from '@objectstack/runtime';
141+
import { ObjectKernel } from '@objectstack/core';
142+
import { ObjectQLPlugin } from '@objectstack/objectql';
141143

142144
const kernel = new ObjectKernel();
143145

@@ -317,7 +319,8 @@ await kernel.bootstrap();
317319
### Integration Tests
318320

319321
```typescript
320-
import { describe, it, expect } from 'vitest';
322+
import { describe, it } from '@objectstack/runtime';
323+
import { ObjectQLPlugin } from '@objectstack/objectql
321324
import { ObjectKernel, ObjectQLPlugin } from '@objectstack/runtime';
322325

323326
describe('MyPlugin', () => {
@@ -432,7 +435,8 @@ await ql.loadObjects([Account, Contact]);
432435
```
433436

434437
### After (MicroKernel)
435-
438+
DriverPlugin } from '@objectstack/runtime';
439+
import { ObjectQLPlugin } from '@objectstack/objectql
436440
```typescript
437441
import { ObjectKernel, ObjectQLPlugin, DriverPlugin } from '@objectstack/runtime';
438442

examples/complete-event-driven-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { DataEnginePlugin } from './data-engine-plugin';
1212
import { FlowEnginePlugin } from './flow-engine-plugin';
1313
import { UiEnginePlugin } from './ui-engine-plugin';
1414
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
15-
import { ObjectQLPlugin } from '@objectstack/runtime';
15+
import { ObjectQLPlugin } from '@objectstack/objectql';
1616
import { PluginRegistry, createKernelFromConfig } from './config-loader';
1717

1818
/**

examples/custom-objectql-example.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* custom configuration.
77
*/
88

9-
import { ObjectKernel, ObjectQLPlugin, DriverPlugin, ObjectQL } from '@objectstack/runtime';
9+
import { ObjectKernel, DriverPlugin } from '@objectstack/runtime';
10+
import { ObjectQLPlugin, ObjectQL } from '@objectstack/objectql';
1011
import { InMemoryDriver } from '@objectstack/driver-memory';
1112

1213
(async () => {

examples/host/debug-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import { ObjectKernel, ObjectQLPlugin, DriverPlugin, AppPlugin } from '@objectstack/runtime';
3-
import { SchemaRegistry, ObjectQL } from '@objectstack/objectql';
2+
import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
3+
import { SchemaRegistry, ObjectQL, ObjectQLPlugin } from '@objectstack/objectql';
44
import { InMemoryDriver } from '@objectstack/driver-memory';
55

66
import TodoApp from '@objectstack/example-todo/objectstack.config';

examples/mini-kernel-example.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* where ObjectQL, Drivers, and HTTP Server are all equal plugins.
66
*/
77

8-
import { ObjectKernel, ObjectQLPlugin, DriverPlugin } from '@objectstack/runtime';
8+
import { ObjectKernel, DriverPlugin } from '@objectstack/runtime';
9+
import { ObjectQLPlugin } from '@objectstack/objectql';
910

1011
// Mock driver for demonstration
1112
const mockDriver = {

examples/msw-react-crud/src/mocks/browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* and the MSW Plugin which automatically exposes the API.
66
*/
77

8-
import { ObjectKernel, ObjectQLPlugin, DriverPlugin, AppPlugin } from '@objectstack/runtime';
8+
import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
9+
import { ObjectQLPlugin } from '@objectstack/objectql';
910
import { InMemoryDriver } from '@objectstack/driver-memory';
1011
import { MSWPlugin } from '@objectstack/plugin-msw';
1112
// import appConfig from '../../objectstack.config';

packages/objectql/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ When building full applications, use the `ObjectKernel` to manage plugins and co
6969

7070
```typescript
7171
import { ObjectKernel } from '@objectstack/core';
72-
import { ObjectQLPlugin, DriverPlugin } from '@objectstack/runtime';
72+
import { DriverPlugin } from '@objectstack/runtime';
73+
import { ObjectQLPlugin } from '@objectstack/objectql';
7374
import { InMemoryDriver } from '@objectstack/driver-memory';
7475

7576
const kernel = new ObjectKernel();

packages/runtime/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ npm install @objectstack/runtime
2424

2525
```typescript
2626
import { ObjectKernel } from '@objectstack/core';
27-
import { ObjectQLPlugin, DriverPlugin, AppPlugin } from '@objectstack/runtime';
27+
import { DriverPlugin, AppPlugin } from '@objectstack/runtime';
28+
import { ObjectQLPlugin } from '@objectstack/objectql';
2829
import { InMemoryDriver } from '@objectstack/driver-memory';
2930

3031
const kernel = new ObjectKernel();
@@ -47,7 +48,8 @@ await kernel.bootstrap();
4748
If you have a separate ObjectQL implementation or need custom configuration:
4849

4950
```typescript
50-
import { ObjectKernel, ObjectQLPlugin, DriverPlugin, ObjectQL } from '@objectstack/runtime';
51+
import { ObjectKernel, DriverPlugin } from '@objectstack/runtime';
52+
import { ObjectQLPlugin, ObjectQL } from '@objectstack/objectql';
5153

5254
// Create custom ObjectQL instance
5355
const customQL = new ObjectQL({

packages/runtime/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
},
1212
"dependencies": {
1313
"@objectstack/core": "workspace:*",
14-
"@objectstack/objectql": "workspace:*",
1514
"@objectstack/types": "workspace:*",
1615
"@objectstack/spec": "workspace:*"
1716
},

packages/runtime/src/app-plugin.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Plugin, PluginContext } from '@objectstack/core';
2-
import { ObjectQL, ObjectQLHostContext } from '@objectstack/objectql';
32

43
/**
54
* AppPlugin
@@ -42,7 +41,7 @@ export class AppPlugin implements Plugin {
4241
// Execute Runtime Step
4342
// Retrieve ObjectQL engine from services
4443
// We cast to any/ObjectQL because ctx.getService returns unknown
45-
const ql = ctx.getService('objectql') as ObjectQL;
44+
const ql = ctx.getService('objectql') as any;
4645

4746
if (!ql) {
4847
ctx.logger?.warn(`[AppPlugin] ObjectQL engine service not found for app: ${this.name}`);
@@ -55,13 +54,13 @@ export class AppPlugin implements Plugin {
5554
ctx.logger?.log(`[AppPlugin] Executing runtime.onEnable for: ${this.name}`);
5655

5756
// Construct the Host Context (mirroring old ObjectQL.use logic)
58-
const hostContext: ObjectQLHostContext = {
57+
const hostContext = {
58+
...ctx,
5959
ql,
6060
logger: ctx.logger || console,
6161
drivers: {
6262
register: (driver: any) => ql.registerDriver(driver)
6363
},
64-
...ctx
6564
};
6665

6766
await runtime.onEnable(hostContext);

0 commit comments

Comments
 (0)