@@ -20,17 +20,20 @@ export class ObjectStackRuntimeProtocol {
2020 if ( engine instanceof ObjectStackKernel ) {
2121 this . legacyKernel = engine ;
2222 } else if ( engine instanceof ObjectKernel ) {
23- // Get ObjectQL service from kernel
23+ // Get ObjectQL service from kernel - will be validated when needed
2424 try {
2525 this . objectql = engine . getService < ObjectQL > ( 'objectql' ) ;
2626 } catch ( e ) {
27- console . warn ( '[Protocol] ObjectQL service not found in kernel' ) ;
27+ // Don't fail construction - some protocol methods may still work
28+ // Error will be thrown when getObjectQL() is called
29+ console . warn ( '[Protocol] ObjectQL service not found in kernel - data operations will fail' ) ;
2830 }
2931 }
3032 }
3133
3234 /**
3335 * Get ObjectQL instance - works with both kernel types
36+ * @throws Error if ObjectQL is not available
3437 */
3538 private getObjectQL ( ) : ObjectQL {
3639 if ( this . legacyKernel ) {
@@ -40,7 +43,7 @@ export class ObjectStackRuntimeProtocol {
4043 return this . legacyKernel . ql ;
4144 }
4245 if ( ! this . objectql ) {
43- throw new Error ( '[Protocol] ObjectQL service not available' ) ;
46+ throw new Error ( '[Protocol] ObjectQL service not available in kernel. Ensure ObjectQLPlugin is registered and initialized. ' ) ;
4447 }
4548 return this . objectql ;
4649 }
@@ -155,7 +158,7 @@ export class ObjectStackRuntimeProtocol {
155158 return await this . legacyKernel . find ( objectName , query ) ;
156159 }
157160 const ql = this . getObjectQL ( ) ;
158- const results = await ql . find ( objectName , { top : 100 } ) ;
161+ const results = await ql . find ( objectName , query || { top : 100 } ) ;
159162 return { value : results , count : results . length } ;
160163 }
161164
@@ -165,7 +168,7 @@ export class ObjectStackRuntimeProtocol {
165168 return await this . legacyKernel . find ( objectName , body ) ;
166169 }
167170 const ql = this . getObjectQL ( ) ;
168- const results = await ql . find ( objectName , { top : 100 } ) ;
171+ const results = await ql . find ( objectName , body || { top : 100 } ) ;
169172 return { value : results , count : results . length } ;
170173 }
171174
@@ -175,7 +178,9 @@ export class ObjectStackRuntimeProtocol {
175178 return await this . legacyKernel . get ( objectName , id ) ;
176179 }
177180 const ql = this . getObjectQL ( ) ;
178- const results = await ql . find ( objectName , { top : 1 } ) ;
181+ // TODO: Implement proper ID-based lookup once ObjectQL supports it
182+ // For now, this is a limitation of the current ObjectQL API
183+ const results = await ql . find ( objectName , { top : 1 , filter : { id } } ) ;
179184 return results [ 0 ] ;
180185 }
181186
0 commit comments