Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpaige committed Jan 8, 2025
1 parent c5ff61b commit bf4a932
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/libs/api/package/itemExists.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import * as os from "libs/opensearch-lib";
import { getDomain } from "libs/utils";
import { getDomain, getNamespace } from "libs/utils";
import { BaseIndex } from "lib/packages/shared-types/opensearch";

export async function itemExists(params: {
id: string;
osDomain?: string;
indexNamespace?: string;
}): Promise<boolean> {
const domain = params.osDomain || getDomain();
const index = `${params.indexNamespace ?? ""}main` as `${string}main`;
const index: `${string}${BaseIndex}` = params.indexNamespace
? `${params.indexNamespace}main`
: getNamespace("main");

const packageResult = await os.getItem(domain, index, params.id);
return !!packageResult?._source;
Expand Down

0 comments on commit bf4a932

Please sign in to comment.