@@ -8,7 +8,7 @@ import type {
88 UpdateManyDataRequest ,
99 DeleteManyDataRequest
1010} from '@objectstack/spec/api' ;
11- import type { MetadataCacheRequest , MetadataCacheResponse , ServiceInfo } from '@objectstack/spec/api' ;
11+ import type { MetadataCacheRequest , MetadataCacheResponse , ServiceInfo , ApiRoutes } from '@objectstack/spec/api' ;
1212
1313// We import SchemaRegistry directly since this class lives in the same package
1414import { SchemaRegistry } from './registry.js' ;
@@ -103,21 +103,41 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
103103 } ;
104104
105105 // Build endpoints (only include available services)
106- const endpoints : Record < string , string > = {
107- data : '/api/data' ,
108- metadata : '/api/meta' ,
106+ // Map service names to ApiRoutes keys
107+ const serviceToEndpointKey : Record < string , keyof ApiRoutes > = {
108+ auth : 'auth' ,
109+ automation : 'automation' ,
110+ ui : 'ui' ,
111+ workflow : 'workflow' ,
112+ realtime : 'realtime' ,
113+ notification : 'notifications' ,
114+ ai : 'ai' ,
115+ i18n : 'i18n' ,
116+ graphql : 'graphql' ,
117+ 'file-storage' : 'storage' ,
118+ search : 'analytics' ,
119+ } ;
120+
121+ const optionalEndpoints : Partial < ApiRoutes > = {
109122 analytics : '/api/analytics' ,
110123 } ;
111124
112125 // Add routes for available plugin services
113126 for ( const [ serviceName , config ] of Object . entries ( SERVICE_CONFIG ) ) {
114127 if ( registeredServices . has ( serviceName ) ) {
115- // Map service name to endpoint key (some services use different names)
116- const endpointKey = serviceName === 'file-storage' ? 'storage' : serviceName ;
117- endpoints [ endpointKey ] = config . route ;
128+ const endpointKey = serviceToEndpointKey [ serviceName ] ;
129+ if ( endpointKey ) {
130+ optionalEndpoints [ endpointKey ] = config . route ;
131+ }
118132 }
119133 }
120134
135+ const endpoints : ApiRoutes = {
136+ data : '/api/data' ,
137+ metadata : '/api/meta' ,
138+ ...optionalEndpoints ,
139+ } ;
140+
121141 return {
122142 version : '1.0' ,
123143 apiName : 'ObjectStack API' ,
0 commit comments