@@ -42,6 +42,7 @@ export interface IndexHandle<T = Record<string, unknown>> {
4242 listIngresses ( ) : Promise < IngressConfig [ ] > ;
4343 createIngress ( params : CreateIngressParams | TypedCreateIngressParams ) : Promise < IngressConfig > ;
4444 getIngress ( ingressId : string ) : Promise < IngressConfig > ;
45+ ingressExists ( ingressId : string ) : Promise < boolean > ;
4546 updateIngress ( ingressId : string , state : IngressState ) : Promise < IngressConfig > ;
4647 deleteIngress ( ingressId : string ) : Promise < void > ;
4748}
@@ -280,6 +281,20 @@ export class BrightClient {
280281 return this . request < IngressConfig > ( `/indexes/${ indexId } /ingresses/${ ingressId } ` ) ;
281282 }
282283
284+ async ingressExists ( indexId : string , ingressId : string ) : Promise < boolean > {
285+ try {
286+ await this . request < IngressConfig > ( `/indexes/${ indexId } /ingresses/${ ingressId } ` , {
287+ method : 'GET' ,
288+ } ) ;
289+ return true ;
290+ } catch ( error ) {
291+ if ( error instanceof NotFoundError ) {
292+ return false ;
293+ }
294+ throw error ;
295+ }
296+ }
297+
283298 async updateIngress (
284299 indexId : string ,
285300 ingressId : string ,
@@ -317,6 +332,7 @@ export class BrightClient {
317332 listIngresses : ( ) => this . listIngresses ( indexId ) ,
318333 createIngress : ( params ) => this . createIngress ( indexId , params ) ,
319334 getIngress : ( ingressId ) => this . getIngress ( indexId , ingressId ) ,
335+ ingressExists : ( ingressId ) => this . ingressExists ( indexId , ingressId ) ,
320336 updateIngress : ( ingressId , state ) => this . updateIngress ( indexId , ingressId , state ) ,
321337 deleteIngress : ( ingressId ) => this . deleteIngress ( indexId , ingressId ) ,
322338 } ;
0 commit comments