11import { describe , it , expect , beforeEach , vi } from 'vitest' ;
22import { ApiRegistry } from './api-registry' ;
33import type {
4- ApiRegistryEntry ,
4+ ApiRegistryEntryInput ,
55} from '@objectstack/spec/api' ;
66import type { Logger } from '@objectstack/spec/contracts' ;
77
@@ -40,7 +40,7 @@ describe('ApiRegistry', () => {
4040
4141 describe ( 'registerApi' , ( ) => {
4242 it ( 'should register a simple REST API' , ( ) => {
43- const api : ApiRegistryEntry = {
43+ const api : ApiRegistryEntryInput = {
4444 id : 'customer_api' ,
4545 name : 'Customer API' ,
4646 type : 'rest' ,
@@ -71,7 +71,7 @@ describe('ApiRegistry', () => {
7171 } ) ;
7272
7373 it ( 'should throw error when registering duplicate API' , ( ) => {
74- const api : ApiRegistryEntry = {
74+ const api : ApiRegistryEntryInput = {
7575 id : 'test_api' ,
7676 name : 'Test API' ,
7777 type : 'rest' ,
@@ -88,7 +88,7 @@ describe('ApiRegistry', () => {
8888 } ) ;
8989
9090 it ( 'should register API with multiple endpoints' , ( ) => {
91- const api : ApiRegistryEntry = {
91+ const api : ApiRegistryEntryInput = {
9292 id : 'crud_api' ,
9393 name : 'CRUD API' ,
9494 type : 'rest' ,
@@ -135,7 +135,7 @@ describe('ApiRegistry', () => {
135135 } ) ;
136136
137137 it ( 'should register API with RBAC permissions' , ( ) => {
138- const api : ApiRegistryEntry = {
138+ const api : ApiRegistryEntryInput = {
139139 id : 'protected_api' ,
140140 name : 'Protected API' ,
141141 type : 'rest' ,
@@ -162,7 +162,7 @@ describe('ApiRegistry', () => {
162162
163163 describe ( 'unregisterApi' , ( ) => {
164164 it ( 'should unregister an API' , ( ) => {
165- const api : ApiRegistryEntry = {
165+ const api : ApiRegistryEntryInput = {
166166 id : 'temp_api' ,
167167 name : 'Temporary API' ,
168168 type : 'rest' ,
@@ -195,7 +195,7 @@ describe('ApiRegistry', () => {
195195 describe ( 'Route Conflict Detection' , ( ) => {
196196 describe ( 'error strategy' , ( ) => {
197197 it ( 'should throw error on route conflict' , ( ) => {
198- const api1 : ApiRegistryEntry = {
198+ const api1 : ApiRegistryEntryInput = {
199199 id : 'api1' ,
200200 name : 'API 1' ,
201201 type : 'rest' ,
@@ -211,7 +211,7 @@ describe('ApiRegistry', () => {
211211 ] ,
212212 } ;
213213
214- const api2 : ApiRegistryEntry = {
214+ const api2 : ApiRegistryEntryInput = {
215215 id : 'api2' ,
216216 name : 'API 2' ,
217217 type : 'rest' ,
@@ -232,7 +232,7 @@ describe('ApiRegistry', () => {
232232 } ) ;
233233
234234 it ( 'should allow same path with different methods' , ( ) => {
235- const api : ApiRegistryEntry = {
235+ const api : ApiRegistryEntryInput = {
236236 id : 'multi_method' ,
237237 name : 'Multi Method API' ,
238238 type : 'rest' ,
@@ -271,7 +271,7 @@ describe('ApiRegistry', () => {
271271 } ) ;
272272
273273 it ( 'should prefer higher priority endpoint' , ( ) => {
274- const api1 : ApiRegistryEntry = {
274+ const api1 : ApiRegistryEntryInput = {
275275 id : 'low_priority' ,
276276 name : 'Low Priority API' ,
277277 type : 'rest' ,
@@ -288,7 +288,7 @@ describe('ApiRegistry', () => {
288288 ] ,
289289 } ;
290290
291- const api2 : ApiRegistryEntry = {
291+ const api2 : ApiRegistryEntryInput = {
292292 id : 'high_priority' ,
293293 name : 'High Priority API' ,
294294 type : 'rest' ,
@@ -314,7 +314,7 @@ describe('ApiRegistry', () => {
314314 } ) ;
315315
316316 it ( 'should keep higher priority when registering lower priority' , ( ) => {
317- const api1 : ApiRegistryEntry = {
317+ const api1 : ApiRegistryEntryInput = {
318318 id : 'high_priority' ,
319319 name : 'High Priority API' ,
320320 type : 'rest' ,
@@ -331,7 +331,7 @@ describe('ApiRegistry', () => {
331331 ] ,
332332 } ;
333333
334- const api2 : ApiRegistryEntry = {
334+ const api2 : ApiRegistryEntryInput = {
335335 id : 'low_priority' ,
336336 name : 'Low Priority API' ,
337337 type : 'rest' ,
@@ -363,7 +363,7 @@ describe('ApiRegistry', () => {
363363 } ) ;
364364
365365 it ( 'should keep first registered endpoint' , ( ) => {
366- const api1 : ApiRegistryEntry = {
366+ const api1 : ApiRegistryEntryInput = {
367367 id : 'first' ,
368368 name : 'First API' ,
369369 type : 'rest' ,
@@ -379,7 +379,7 @@ describe('ApiRegistry', () => {
379379 ] ,
380380 } ;
381381
382- const api2 : ApiRegistryEntry = {
382+ const api2 : ApiRegistryEntryInput = {
383383 id : 'second' ,
384384 name : 'Second API' ,
385385 type : 'rest' ,
@@ -410,7 +410,7 @@ describe('ApiRegistry', () => {
410410 } ) ;
411411
412412 it ( 'should use last registered endpoint' , ( ) => {
413- const api1 : ApiRegistryEntry = {
413+ const api1 : ApiRegistryEntryInput = {
414414 id : 'first' ,
415415 name : 'First API' ,
416416 type : 'rest' ,
@@ -426,7 +426,7 @@ describe('ApiRegistry', () => {
426426 ] ,
427427 } ;
428428
429- const api2 : ApiRegistryEntry = {
429+ const api2 : ApiRegistryEntryInput = {
430430 id : 'second' ,
431431 name : 'Second API' ,
432432 type : 'rest' ,
@@ -543,7 +543,7 @@ describe('ApiRegistry', () => {
543543
544544 describe ( 'getEndpoint' , ( ) => {
545545 it ( 'should get endpoint by API and endpoint ID' , ( ) => {
546- const api : ApiRegistryEntry = {
546+ const api : ApiRegistryEntryInput = {
547547 id : 'test_api' ,
548548 name : 'Test API' ,
549549 type : 'rest' ,
@@ -575,7 +575,7 @@ describe('ApiRegistry', () => {
575575
576576 describe ( 'findEndpointByRoute' , ( ) => {
577577 it ( 'should find endpoint by method and path' , ( ) => {
578- const api : ApiRegistryEntry = {
578+ const api : ApiRegistryEntryInput = {
579579 id : 'route_api' ,
580580 name : 'Route API' ,
581581 type : 'rest' ,
@@ -721,7 +721,7 @@ describe('ApiRegistry', () => {
721721
722722 describe ( 'Multi-protocol Support' , ( ) => {
723723 it ( 'should register GraphQL API' , ( ) => {
724- const api : ApiRegistryEntry = {
724+ const api : ApiRegistryEntryInput = {
725725 id : 'graphql' ,
726726 name : 'GraphQL API' ,
727727 type : 'graphql' ,
@@ -742,7 +742,7 @@ describe('ApiRegistry', () => {
742742 } ) ;
743743
744744 it ( 'should register WebSocket API' , ( ) => {
745- const api : ApiRegistryEntry = {
745+ const api : ApiRegistryEntryInput = {
746746 id : 'websocket' ,
747747 name : 'WebSocket API' ,
748748 type : 'websocket' ,
@@ -769,7 +769,7 @@ describe('ApiRegistry', () => {
769769 } ) ;
770770
771771 it ( 'should register Plugin API' , ( ) => {
772- const api : ApiRegistryEntry = {
772+ const api : ApiRegistryEntryInput = {
773773 id : 'custom_plugin' ,
774774 name : 'Custom Plugin API' ,
775775 type : 'plugin' ,
0 commit comments