|
1 | | -import { ObjectKernel } from './mini-kernel.js'; |
| 1 | +import { ObjectKernel } from './kernel.js'; |
2 | 2 |
|
3 | 3 | /** |
4 | 4 | * PluginContext - Runtime context available to plugins |
@@ -48,56 +48,48 @@ export interface PluginContext { |
48 | 48 | * Get the kernel instance (for advanced use cases) |
49 | 49 | * @returns Kernel instance |
50 | 50 | */ |
51 | | - getKernel?(): ObjectKernel; |
| 51 | + getKernel(): ObjectKernel; |
52 | 52 | } |
53 | 53 |
|
54 | 54 | /** |
55 | | - * Plugin - Standard plugin interface |
| 55 | + * Plugin Interface |
56 | 56 | * |
57 | | - * Plugins are independent modules with standard lifecycle hooks. |
58 | | - * They can declare dependencies on other plugins and register services. |
| 57 | + * All ObjectStack plugins must implement this interface. |
59 | 58 | */ |
60 | 59 | export interface Plugin { |
61 | 60 | /** |
62 | | - * Plugin name (unique identifier) |
| 61 | + * Unique plugin name (e.g., 'com.objectstack.engine.objectql') |
63 | 62 | */ |
64 | 63 | name: string; |
65 | 64 |
|
66 | 65 | /** |
67 | | - * Plugin version (optional) |
| 66 | + * Plugin version |
68 | 67 | */ |
69 | 68 | version?: string; |
70 | 69 |
|
71 | 70 | /** |
72 | | - * Plugin type (optional, for special plugins like 'objectql') |
73 | | - */ |
74 | | - type?: string; |
75 | | - |
76 | | - /** |
77 | | - * Dependencies - list of plugin names this plugin depends on |
78 | | - * Kernel will ensure dependencies are initialized first |
| 71 | + * List of other plugin names that this plugin depends on. |
| 72 | + * The kernel ensures these plugins are initialized before this one. |
79 | 73 | */ |
80 | 74 | dependencies?: string[]; |
81 | 75 |
|
82 | 76 | /** |
83 | | - * Init phase - Register services and prepare plugin |
84 | | - * Called during kernel bootstrap, before start phase |
85 | | - * |
86 | | - * @param ctx - Plugin context |
| 77 | + * Init Phase: Register services |
| 78 | + * Called when kernel is initializing. |
| 79 | + * Use this to register services that other plugins might need. |
87 | 80 | */ |
88 | | - init(ctx: PluginContext): Promise<void>; |
| 81 | + init(ctx: PluginContext): Promise<void> | void; |
89 | 82 |
|
90 | 83 | /** |
91 | | - * Start phase - Execute business logic, start servers, connect to databases |
92 | | - * Called after all plugins have been initialized |
93 | | - * |
94 | | - * @param ctx - Plugin context |
| 84 | + * Start Phase: Execute business logic |
| 85 | + * Called after all plugins have been initialized. |
| 86 | + * Use this to start servers, connect to DBs, or execute main logic. |
95 | 87 | */ |
96 | | - start?(ctx: PluginContext): Promise<void>; |
| 88 | + start?(ctx: PluginContext): Promise<void> | void; |
97 | 89 |
|
98 | 90 | /** |
99 | | - * Destroy phase - Cleanup resources, close connections |
100 | | - * Called during kernel shutdown |
| 91 | + * Destroy Phase: Cleanup |
| 92 | + * Called when kernel is shutting down. |
101 | 93 | */ |
102 | | - destroy?(): Promise<void>; |
| 94 | + destroy?(): Promise<void> | void; |
103 | 95 | } |
0 commit comments