Skip to content

Commit e63a7ea

Browse files
committed
Add AppManifestPlugin and DriverPlugin; refactor exports in ObjectQL
1 parent 96dec98 commit e63a7ea

File tree

7 files changed

+25
-163
lines changed

7 files changed

+25
-163
lines changed

packages/runtime/src/app-manifest-plugin.ts renamed to packages/objectql/src/app-manifest-plugin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
import { Plugin, PluginContext } from '@objectstack/core';
2-
import { SchemaRegistry, ObjectQL } from '@objectstack/objectql';
1+
import { Plugin, PluginContext } from './plugin'; // Import local minimal context or from core if available?
2+
// Actually ObjectQL probably hasn't added @objectstack/core as dependency yet properly or local imports are preferred.
3+
// Let's use internal types where possible if they exist, OR ensure @objectstack/core is in package.json
4+
// But wait, objectql/src/plugin.ts defines PluginContext locally to avoid circular dep?
5+
// Let's check objectql/package.json
6+
import { SchemaRegistry, ObjectQL } from './index';
37

48
/**
59
* AppManifestPlugin
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin, PluginContext } from '@objectstack/core';
1+
import { Plugin, PluginContext } from './plugin';
22

33
/**
44
* Driver Plugin

packages/objectql/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,5 @@ export class ObjectQL implements IDataEngine {
403403
}
404404
}
405405
export * from './plugin';
406+
export * from './driver-plugin';
407+
export * from './app-manifest-plugin';

packages/objectql/src/plugin.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@ import { ObjectStackProtocolImplementation } from './protocol';
55
// Minimal Context interface to avoid circular dependency on @objectstack/runtime
66
export interface PluginContext {
77
registerService(name: string, service: any): void;
8+
getService<T>(name: string): T;
9+
hook(name: string, handler: any): void;
10+
trigger(name: string, ...args: any[]): Promise<void>;
811
logger: Console;
9-
// We need access to the kernel-like object to pass to protocol,
10-
// or at least expose getService on context if it's there
11-
getService?: <T>(name: string) => T;
1212
[key: string]: any;
1313
}
1414

15+
export interface Plugin {
16+
name: string;
17+
version?: string;
18+
dependencies?: string[];
19+
init?: (ctx: PluginContext) => Promise<void> | void;
20+
start?: (ctx: PluginContext) => Promise<void> | void;
21+
destroy?: () => Promise<void> | void;
22+
}
23+
1524
export class ObjectQLPlugin {
1625
name = 'com.objectstack.engine.objectql';
1726
type = 'objectql' as const;

packages/runtime/src/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ export { ObjectQL, SchemaRegistry } from '@objectstack/objectql';
55
export { ObjectKernel } from '@objectstack/core';
66

77
// Export Plugins
8-
export { ObjectQLPlugin } from '@objectstack/objectql';
9-
export { DriverPlugin } from './driver-plugin.js';
10-
export { AppManifestPlugin } from './app-manifest-plugin.js';
11-
12-
// Export Protocol
13-
// export { ObjectStackRuntimeProtocol } from './protocol.js';
8+
export { ObjectQLPlugin, DriverPlugin, AppManifestPlugin } from '@objectstack/objectql';
149

1510
// Export Types
1611
export * from '@objectstack/core';
1712

18-
// Export Interfaces (Capability Contracts)
19-
export * from './interfaces/http-server.js';
20-
export * from './interfaces/data-engine.js';
13+
// Export Protocol Intefaces from Spec
14+
export { IHttpServer, IHttpRequest, IHttpResponse, RouteHandler, Middleware } from '@objectstack/spec/api';
15+
export { IDataEngine, DataEngineFilter, DataEngineQueryOptions } from '@objectstack/spec/system';
2116

packages/runtime/src/interfaces/data-engine.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/runtime/src/interfaces/http-server.ts

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)