@@ -3,14 +3,12 @@ import { SchemaRegistry } from './registry';
33import { ObjectQL } from './engine' ;
44
55/**
6- * Server Data Engine Wrapper
6+ * ObjectStack Kernel (Microkernel)
77 *
8- * This class is now a thin wrapper that initializes the ObjectQL Engine
9- * with the appropriate Server-Side configuration (Registry, Drivers).
10- *
11- * The core logic has been moved to @objectstack/objectql.
8+ * The central container orchestrating the application lifecycle,
9+ * plugins, and the core ObjectQL engine.
1210 */
13- export class DataEngine {
11+ export class ObjectStackKernel {
1412 public ql : ObjectQL ;
1513 private plugins : any [ ] ;
1614
@@ -23,26 +21,26 @@ export class DataEngine {
2321 }
2422
2523 async start ( ) {
26- console . log ( '[DataEngine ] Starting...' ) ;
24+ console . log ( '[Kernel ] Starting...' ) ;
2725
2826 // 0. Register Provided Plugins
2927 for ( const p of this . plugins ) {
3028 // Check if it is a Runtime Plugin (System Capability)
3129 if ( 'onStart' in p || 'install' in p ) {
32- console . log ( `[DataEngine ] Loading Runtime Plugin: ${ p . name } ` ) ;
30+ console . log ( `[Kernel ] Loading Runtime Plugin: ${ p . name } ` ) ;
3331 if ( p . install ) await p . install ( { engine : this } ) ;
3432 continue ;
3533 }
3634
3735 // Otherwise treat as App Manifest
38- console . log ( `[DataEngine ] Loading App Manifest: ${ p . id || p . name } ` ) ;
36+ console . log ( `[Kernel ] Loading App Manifest: ${ p . id || p . name } ` ) ;
3937 SchemaRegistry . registerPlugin ( p ) ;
4038
4139 // Register Objects from App/Plugin
4240 if ( p . objects ) {
4341 for ( const obj of p . objects ) {
4442 SchemaRegistry . registerObject ( obj ) ;
45- console . log ( `[DataEngine ] Registered Object: ${ obj . name } ` ) ;
43+ console . log ( `[Kernel ] Registered Object: ${ obj . name } ` ) ;
4644 }
4745 }
4846 }
@@ -72,7 +70,7 @@ export class DataEngine {
7270 // 4. Start Runtime Plugins
7371 for ( const p of this . plugins ) {
7472 if ( ( 'onStart' in p ) && typeof p . onStart === 'function' ) {
75- console . log ( `[DataEngine ] Starting Plugin: ${ p . name } ` ) ;
73+ console . log ( `[Kernel ] Starting Plugin: ${ p . name } ` ) ;
7674 await p . onStart ( { engine : this } ) ;
7775 }
7876 }
@@ -101,19 +99,19 @@ export class DataEngine {
10199 for ( const appItem of apps ) {
102100 const app = appItem as any ; // Cast to access data prop safely
103101 if ( app . data && Array . isArray ( app . data ) ) {
104- console . log ( `[DataEngine ] Seeding data for ${ app . name || app . id } ...` ) ;
102+ console . log ( `[Kernel ] Seeding data for ${ app . name || app . id } ...` ) ;
105103 for ( const seed of app . data ) {
106104 try {
107105 // Check if data exists
108106 const existing = await this . ql . find ( seed . object , { top : 1 } ) ;
109107 if ( existing . length === 0 ) {
110- console . log ( `[DataEngine ] Inserting ${ seed . records . length } records into ${ seed . object } ` ) ;
108+ console . log ( `[Kernel ] Inserting ${ seed . records . length } records into ${ seed . object } ` ) ;
111109 for ( const record of seed . records ) {
112110 await this . ql . insert ( seed . object , record ) ;
113111 }
114112 }
115113 } catch ( e ) {
116- console . warn ( `[DataEngine ] Failed to seed ${ seed . object } ` , e ) ;
114+ console . warn ( `[Kernel ] Failed to seed ${ seed . object } ` , e ) ;
117115 }
118116 }
119117 }
0 commit comments