Skip to content

Commit 6d6caad

Browse files
MagicFun1241claude
andcommitted
feat: add ingressExists method
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 996913e commit 6d6caad

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bright-client",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"description": "TypeScript client library for Bright search database",
55
"main": "dist/index.cjs",
66
"module": "dist/index.mjs",

src/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)