@@ -507,6 +507,72 @@ export class HonoServerPlugin implements Plugin {
507507 priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
508508 } ) ;
509509
510+ // Analytics Endpoints
511+ endpoints . push (
512+ {
513+ id : 'analytics_query' ,
514+ method : 'POST' ,
515+ path : `${ apiPath } /analytics/query` ,
516+ summary : 'Analytics Query' ,
517+ description : 'Execute analytics query' ,
518+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
519+ } ,
520+ {
521+ id : 'get_analytics_meta' ,
522+ method : 'GET' ,
523+ path : `${ apiPath } /analytics/meta` ,
524+ summary : 'Analytics Metadata' ,
525+ description : 'Get analytics cubes definitions' ,
526+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
527+ }
528+ ) ;
529+
530+ // Automation Endpoints
531+ endpoints . push (
532+ {
533+ id : 'automation_trigger' ,
534+ method : 'POST' ,
535+ path : `${ apiPath } /automation/trigger/:trigger` ,
536+ summary : 'Trigger Automation' ,
537+ description : 'Trigger a named automation' ,
538+ parameters : [ {
539+ name : 'trigger' ,
540+ in : 'path' ,
541+ required : true ,
542+ schema : { type : 'string' }
543+ } ] ,
544+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
545+ }
546+ ) ;
547+
548+ // Hub Endpoints
549+ endpoints . push (
550+ {
551+ id : 'hub_list_spaces' ,
552+ method : 'GET' ,
553+ path : `${ apiPath } /hub/spaces` ,
554+ summary : 'List Spaces' ,
555+ description : 'List all Hub spaces' ,
556+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
557+ } ,
558+ {
559+ id : 'hub_create_space' ,
560+ method : 'POST' ,
561+ path : `${ apiPath } /hub/spaces` ,
562+ summary : 'Create Space' ,
563+ description : 'Create a new Hub space' ,
564+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
565+ } ,
566+ {
567+ id : 'hub_install_plugin' ,
568+ method : 'POST' ,
569+ path : `${ apiPath } /hub/plugins/install` ,
570+ summary : 'Install Plugin' ,
571+ description : 'Install a plugin from marketplace' ,
572+ priority : HonoServerPlugin . DISCOVERY_ENDPOINT_PRIORITY
573+ }
574+ ) ;
575+
510576 // Register the API in the registry
511577 const apiEntry : ApiRegistryEntryInput = {
512578 id : 'objectstack_core_api' ,
@@ -798,6 +864,65 @@ export class HonoServerPlugin implements Plugin {
798864 ctx . logger . warn ( 'UI view not found' , { object : req . params . object } ) ;
799865 res . status ( 404 ) . json ( { error : e . message } ) ;
800866 }
867+ } ,
868+ // Analytics
869+ 'analytics_query' : async ( req : any , res : any ) => {
870+ ctx . logger . info ( 'Analytics query request' ) ;
871+ try {
872+ const result = await p . analyticsQuery ( req . body ) ;
873+ res . json ( result ) ;
874+ } catch ( e : any ) {
875+ ctx . logger . error ( 'Analytics query failed' , e ) ;
876+ res . status ( 400 ) . json ( { error : e . message } ) ;
877+ }
878+ } ,
879+ 'get_analytics_meta' : async ( req : any , res : any ) => {
880+ ctx . logger . info ( 'Analytics meta request' ) ;
881+ try {
882+ const result = await p . getAnalyticsMeta ( { } ) ;
883+ res . json ( result ) ;
884+ } catch ( e : any ) {
885+ ctx . logger . error ( 'Analytics meta failed' , e ) ;
886+ res . status ( 500 ) . json ( { error : e . message } ) ;
887+ }
888+ } ,
889+ // Automation
890+ 'automation_trigger' : async ( req : any , res : any ) => {
891+ const trigger = req . params . trigger ;
892+ ctx . logger . info ( 'Automation trigger request' , { trigger } ) ;
893+ try {
894+ const result = await p . triggerAutomation ( { trigger, payload : req . body } ) ;
895+ res . json ( result ) ;
896+ } catch ( e : any ) {
897+ ctx . logger . error ( 'Automation trigger failed' , e , { trigger } ) ;
898+ res . status ( 500 ) . json ( { error : e . message } ) ;
899+ }
900+ } ,
901+ // Hub
902+ 'hub_list_spaces' : async ( req : any , res : any ) => {
903+ try {
904+ const result = await p . listSpaces ( { ...req . query } ) ;
905+ res . json ( result ) ;
906+ } catch ( e : any ) {
907+ res . status ( 500 ) . json ( { error : e . message } ) ;
908+ }
909+ } ,
910+ 'hub_create_space' : async ( req : any , res : any ) => {
911+ try {
912+ const result = await p . createSpace ( req . body ) ;
913+ res . status ( 201 ) . json ( result ) ;
914+ } catch ( e : any ) {
915+ res . status ( 500 ) . json ( { error : e . message } ) ;
916+ }
917+ } ,
918+ 'hub_install_plugin' : async ( req : any , res : any ) => {
919+ const spaceId = req . params . space_id ;
920+ try {
921+ const result = await p . installPlugin ( { spaceId, ...req . body } ) ;
922+ res . json ( result ) ;
923+ } catch ( e : any ) {
924+ res . status ( 500 ) . json ( { error : e . message } ) ;
925+ }
801926 }
802927 } ;
803928
0 commit comments