@@ -14,6 +14,7 @@ type NormalizedRestServerConfig = {
1414 apiPath : string | undefined ;
1515 enableCrud : boolean ;
1616 enableMetadata : boolean ;
17+ enableUi : boolean ;
1718 enableBatch : boolean ;
1819 enableDiscovery : boolean ;
1920 documentation : RestApiConfig [ 'documentation' ] ;
@@ -120,6 +121,7 @@ export class RestServer {
120121 apiPath : api . apiPath ,
121122 enableCrud : api . enableCrud ?? true ,
122123 enableMetadata : api . enableMetadata ?? true ,
124+ enableUi : api . enableUi ?? true ,
123125 enableBatch : api . enableBatch ?? true ,
124126 enableDiscovery : api . enableDiscovery ?? true ,
125127 documentation : api . documentation ,
@@ -191,6 +193,11 @@ export class RestServer {
191193 if ( this . config . api . enableMetadata ) {
192194 this . registerMetadataEndpoints ( basePath ) ;
193195 }
196+
197+ // UI endpoints
198+ if ( this . config . api . enableUi ) {
199+ this . registerUiEndpoints ( basePath ) ;
200+ }
194201
195202 // CRUD endpoints
196203 if ( this . config . api . enableCrud ) {
@@ -227,6 +234,10 @@ export class RestServer {
227234 discovery . endpoints . metadata = `${ basePath } ${ this . config . metadata . prefix } ` ;
228235 }
229236
237+ if ( this . config . api . enableUi ) {
238+ discovery . endpoints . ui = `${ basePath } /ui` ;
239+ }
240+
230241 // Align auth endpoint with the versioned base path if present
231242 if ( discovery . endpoints . auth ) {
232243 discovery . endpoints . auth = `${ basePath } /auth` ;
@@ -381,6 +392,38 @@ export class RestServer {
381392 } ,
382393 } ) ;
383394 }
395+
396+ /**
397+ * Register UI endpoints
398+ */
399+ private registerUiEndpoints ( basePath : string ) : void {
400+ const uiPath = `${ basePath } /ui` ;
401+
402+ // GET /ui/view/:object/:type - Resolve view for object
403+ this . routeManager . register ( {
404+ method : 'GET' ,
405+ path : `${ uiPath } /view/:object/:type` ,
406+ handler : async ( req : any , res : any ) => {
407+ try {
408+ if ( this . protocol . getUiView ) {
409+ const view = await this . protocol . getUiView ( {
410+ object : req . params . object ,
411+ type : req . params . type as any
412+ } ) ;
413+ res . json ( view ) ;
414+ } else {
415+ res . status ( 501 ) . json ( { error : 'UI View resolution not supported by protocol implementation' } ) ;
416+ }
417+ } catch ( error : any ) {
418+ res . status ( 404 ) . json ( { error : error . message } ) ;
419+ }
420+ } ,
421+ metadata : {
422+ summary : 'Resolve UI View for object' ,
423+ tags : [ 'ui' ] ,
424+ } ,
425+ } ) ;
426+ }
384427
385428 /**
386429 * Register CRUD endpoints for data operations
0 commit comments