Skip to content

Commit a56c78c

Browse files
authored
Merge pull request #421 from objectstack-ai/copilot/fix-objectql-plugin-import
2 parents 24ae307 + 8474ee0 commit a56c78c

File tree

12 files changed

+76
-23
lines changed

12 files changed

+76
-23
lines changed

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ const kernel = new ObjectStackKernel([
842842
| Extract validator wiring | Already in `@objectql/plugin-validator` — remove re-export from aggregator | ✅ |
843843
| Extract formula wiring | Already in `@objectql/plugin-formula` — remove re-export from aggregator | ✅ |
844844
| Deprecate `ObjectQLPlugin` aggregator class | Mark as deprecated with `console.warn`, point to explicit imports | ✅ |
845+
| Migrate `objectstack.config.ts` to upstream | Import `ObjectQLPlugin` from `@objectstack/objectql`, compose sub-plugins directly, register MemoryDriver as `driver.default` service — fixes `app.*` discovery chain for AuthPlugin | ✅ |
846+
| Add `init`/`start` adapter to `QueryPlugin` | Consistent with ValidatorPlugin / FormulaPlugin adapter pattern for `@objectstack/core` kernel compatibility | ✅ |
845847

846848
### Phase B: Dispose Bridge Class ✅
847849

content/blog/security-by-design.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ When using `@objectstack/plugin-hono-server`, CSRF protection is enabled by defa
407407
```typescript
408408
import { ObjectStackKernel } from '@objectstack/runtime';
409409
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
410-
import { ObjectQLPlugin } from '@objectql/core';
410+
import { ObjectQLPlugin } from '@objectstack/objectql';
411411
import { MemoryDriver } from '@objectql/driver-memory';
412412

413413
const kernel = new ObjectStackKernel([

content/docs/reference/api/attachments.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ ObjectQL provides a flexible file storage abstraction that supports multiple bac
10831083
```typescript
10841084
import { ObjectStackKernel } from '@objectstack/runtime';
10851085
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
1086-
import { ObjectQLPlugin } from '@objectql/core';
1086+
import { ObjectQLPlugin } from '@objectstack/objectql';
10871087
import { SqlDriver } from '@objectql/driver-sql';
10881088

10891089
const kernel = new ObjectStackKernel([

content/docs/reference/api/custom-routes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Configure custom routes when creating the Kernel with protocol plugins:
3131
```typescript
3232
import { ObjectStackKernel } from '@objectstack/runtime';
3333
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
34-
import { ObjectQLPlugin } from '@objectql/core';
34+
import { ObjectQLPlugin } from '@objectstack/objectql';
3535
import { JSONRPCPlugin } from '@objectql/protocol-json-rpc';
3636
import { MemoryDriver } from '@objectql/driver-memory';
3737

@@ -89,7 +89,7 @@ interface ApiRouteConfig {
8989
```typescript
9090
import { ObjectStackKernel } from '@objectstack/runtime';
9191
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
92-
import { ObjectQLPlugin } from '@objectql/core';
92+
import { ObjectQLPlugin } from '@objectstack/objectql';
9393
import { SqlDriver } from '@objectql/driver-sql';
9494
import { JSONRPCPlugin } from '@objectql/protocol-json-rpc';
9595

content/docs/reference/api/graphql.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ ObjectQL doesn't include GraphQL Playground by default, but you can easily add i
905905
```typescript
906906
import { ObjectStackKernel } from '@objectstack/runtime';
907907
import { GraphQLPlugin } from '@objectql/protocol-graphql';
908-
import { ObjectQLPlugin } from '@objectql/core';
908+
import { ObjectQLPlugin } from '@objectstack/objectql';
909909
import { MemoryDriver } from '@objectql/driver-memory';
910910

911911
const kernel = new ObjectStackKernel([

content/docs/server/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Extend ObjectQL with plugins:
6161
// objectstack.config.ts
6262
import { ObjectStackKernel } from '@objectstack/runtime';
6363
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
64-
import { ObjectQLPlugin } from '@objectql/core';
64+
import { ObjectQLPlugin } from '@objectstack/objectql';
6565
import { SqlDriver } from '@objectql/driver-sql';
6666

6767
const kernel = new ObjectStackKernel([

content/docs/server/integration.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Instead of a monolithic server package, ObjectQL uses a plugin architecture wher
1212

1313
```bash
1414
pnpm add @objectstack/runtime @objectstack/plugin-hono-server
15-
pnpm add @objectql/core @objectql/protocol-json-rpc
15+
pnpm add @objectstack/objectql @objectql/protocol-json-rpc
1616
```
1717

1818
## Getting Started
@@ -22,7 +22,7 @@ pnpm add @objectql/core @objectql/protocol-json-rpc
2222
```typescript
2323
import { ObjectStackKernel } from '@objectstack/runtime';
2424
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
25-
import { ObjectQLPlugin } from '@objectql/core';
25+
import { ObjectQLPlugin } from '@objectstack/objectql';
2626
import { MemoryDriver } from '@objectql/driver-memory';
2727

2828
const appConfig = {
@@ -55,7 +55,7 @@ Expose your data through multiple protocols simultaneously:
5555
```typescript
5656
import { ObjectStackKernel } from '@objectstack/runtime';
5757
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
58-
import { ObjectQLPlugin } from '@objectql/core';
58+
import { ObjectQLPlugin } from '@objectstack/objectql';
5959
import { JSONRPCPlugin } from '@objectql/protocol-json-rpc';
6060
import { GraphQLPlugin } from '@objectql/protocol-graphql';
6161
import { SqlDriver } from '@objectql/driver-sql';

examples/integrations/express-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ app.init().then(() => {
2727
```typescript
2828
// ✅ New Pattern
2929
import { ObjectStackKernel } from '@objectstack/runtime';
30-
import { ObjectQLPlugin } from '@objectql/core';
30+
import { ObjectQLPlugin } from '@objectstack/objectql';
3131

3232
const appConfig = {
3333
name: 'my-app',

objectstack.config.ts

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import { JSONRPCPlugin } from '@objectql/protocol-json-rpc';
2525
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
2626
import { AuthPlugin } from '@objectstack/plugin-auth';
2727
import { ConsolePlugin } from '@object-ui/console';
28-
import { ObjectQLPlugin } from '@objectql/core';
28+
import { ObjectQLPlugin } from '@objectstack/objectql';
29+
import { QueryPlugin } from '@objectql/plugin-query';
30+
import { ValidatorPlugin } from '@objectql/plugin-validator';
31+
import { FormulaPlugin } from '@objectql/plugin-formula';
2932
import { createApiRegistryPlugin } from '@objectstack/core';
3033
import { MemoryDriver } from '@objectql/driver-memory';
3134
import * as fs from 'fs';
@@ -55,6 +58,10 @@ function loadObjects(dir: string) {
5558

5659
const projectTrackerDir = path.join(__dirname, 'examples/showcase/project-tracker/src');
5760

61+
// Shared driver instance — registered as 'driver.default' service for
62+
// upstream ObjectQLPlugin discovery and passed to QueryPlugin for query execution.
63+
const defaultDriver = new MemoryDriver();
64+
5865
export default {
5966
metadata: {
6067
name: 'objectos',
@@ -66,25 +73,30 @@ export default {
6673
createApiRegistryPlugin(),
6774
new HonoServerPlugin({}),
6875
new ConsolePlugin(),
69-
new ObjectQLPlugin({
70-
enableRepository: true,
71-
enableQueryService: true,
72-
// Validator and Formula plugins are included by default
73-
enableValidator: true,
74-
enableFormulas: true,
75-
datasources: {
76-
default: new MemoryDriver()
77-
}
78-
}),
76+
// Register MemoryDriver as 'driver.default' service so upstream
77+
// ObjectQLPlugin can discover it during start() phase.
78+
{
79+
name: 'driver-memory',
80+
init: async (ctx: any) => {
81+
ctx.registerService('driver.default', defaultDriver);
82+
},
83+
start: async () => {},
84+
},
85+
// Upstream ObjectQLPlugin from @objectstack/objectql:
86+
// - Registers objectql, metadata, data, protocol services
87+
// - Discovers driver.* and app.* services (fixes auth plugin object registration)
88+
// - Registers audit hooks (created_by/updated_by) and tenant isolation middleware
89+
new ObjectQLPlugin(),
90+
new QueryPlugin({ datasources: { default: defaultDriver } }),
91+
new ValidatorPlugin(),
92+
new FormulaPlugin(),
7993
new ObjectQLSecurityPlugin({
8094
enableAudit: false
8195
}),
8296
new AuthPlugin({
8397
secret: process.env.AUTH_SECRET || 'objectql-dev-secret-change-me-in-production',
8498
trustedOrigins: ['http://localhost:*'],
8599
}),
86-
// ValidatorPlugin is managed by ObjectQLPlugin now
87-
// new ValidatorPlugin(),
88100
new GraphQLPlugin({
89101
basePath: '/graphql',
90102
introspection: true,

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@
3131
"@objectql/example-enterprise-erp": "workspace:*",
3232
"@objectql/example-project-tracker": "workspace:*",
3333
"@objectql/plugin-security": "workspace:*",
34+
"@objectql/plugin-formula": "workspace:*",
35+
"@objectql/plugin-query": "workspace:*",
3436
"@objectql/plugin-validator": "workspace:*",
3537
"@objectql/protocol-graphql": "workspace:*",
3638
"@objectql/protocol-json-rpc": "workspace:*",
3739
"@objectql/protocol-odata-v4": "workspace:*",
3840
"@object-ui/console": "^3.1.3",
3941
"@objectstack/cli": "^3.2.8",
4042
"@objectstack/core": "^3.2.8",
43+
"@objectstack/objectql": "^3.2.8",
4144
"@objectstack/plugin-auth": "^3.2.8",
4245
"@objectstack/plugin-hono-server": "^3.2.8",
4346
"@types/js-yaml": "^4.0.9",

0 commit comments

Comments
 (0)