|
6 | 6 | * LICENSE file in the root directory of this source tree. |
7 | 7 | */ |
8 | 8 |
|
9 | | -import type { PluginDefinition, PluginContextData } from '@objectstack/spec'; |
| 9 | +// Import RuntimePlugin types from @objectql/core instead of @objectstack/runtime |
| 10 | +// to avoid ESM/CJS compatibility issues |
| 11 | +interface RuntimeContext { |
| 12 | + engine: any; // ObjectStackKernel |
| 13 | +} |
10 | 14 |
|
11 | | -const AuditLogPlugin: PluginDefinition = { |
12 | | - id: 'audit-log', |
13 | | - |
14 | | - onEnable: async (context: PluginContextData) => { |
15 | | - console.log('[AuditLogPlugin] Enabling...'); |
| 15 | +interface RuntimePlugin { |
| 16 | + name: string; |
| 17 | + install?: (ctx: RuntimeContext) => void | Promise<void>; |
| 18 | + onStart?: (ctx: RuntimeContext) => void | Promise<void>; |
| 19 | +} |
16 | 20 |
|
17 | | - // TODO: Register event handlers using the new context API |
18 | | - // The PluginContextData provides: |
19 | | - // - context.events for event handling |
20 | | - // - context.ql for data access |
21 | | - // - context.logger for logging |
| 21 | +const AuditLogPlugin: RuntimePlugin = { |
| 22 | + name: 'audit-log', |
| 23 | + |
| 24 | + async install(ctx: RuntimeContext) { |
| 25 | + console.log('[AuditLogPlugin] Installing...'); |
| 26 | + // Plugin installation logic here |
| 27 | + }, |
| 28 | + |
| 29 | + async onStart(ctx: RuntimeContext) { |
| 30 | + console.log('[AuditLogPlugin] Starting...'); |
| 31 | + |
| 32 | + // TODO: Register event handlers using the runtime context |
| 33 | + // The RuntimeContext provides: |
| 34 | + // - ctx.engine for accessing the kernel |
22 | 35 |
|
23 | | - // For now, we'll just log that the plugin is enabled |
24 | | - context.logger.info('[AuditLogPlugin] Plugin enabled'); |
| 36 | + // For now, we'll just log that the plugin is started |
| 37 | + console.log('[AuditLogPlugin] Plugin started'); |
25 | 38 |
|
26 | | - // Note: The new plugin system uses context.events instead of app.on() |
27 | | - // This will need to be implemented when the events API is available |
| 39 | + // Note: The new plugin system uses RuntimeContext instead of PluginContextData |
| 40 | + // This will need to be enhanced when the full events API is available |
28 | 41 | } |
29 | 42 | }; |
30 | 43 |
|
|
0 commit comments