@@ -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,40 @@ 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+ } ;
119+
120+ const optionalEndpoints : Partial < ApiRoutes > = {
109121 analytics : '/api/analytics' ,
110122 } ;
111123
112124 // Add routes for available plugin services
113125 for ( const [ serviceName , config ] of Object . entries ( SERVICE_CONFIG ) ) {
114126 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 ;
127+ const endpointKey = serviceToEndpointKey [ serviceName ] ;
128+ if ( endpointKey ) {
129+ optionalEndpoints [ endpointKey ] = config . route ;
130+ }
118131 }
119132 }
120133
134+ const endpoints : ApiRoutes = {
135+ data : '/api/data' ,
136+ metadata : '/api/meta' ,
137+ ...optionalEndpoints ,
138+ } ;
139+
121140 return {
122141 version : '1.0' ,
123142 apiName : 'ObjectStack API' ,
0 commit comments