mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-29 05:41:40 +00:00
* Add container vector policy and indexing policy support * Add vector search capability * hide vector settings for shared throughput DB * update package-lock * fix pipeline * remove comments * Address comments * Address comments
23 lines
886 B
TypeScript
23 lines
886 B
TypeScript
import * as Constants from "../Common/Constants";
|
|
import { userContext } from "../UserContext";
|
|
|
|
export const isCapabilityEnabled = (capabilityName: string): boolean => {
|
|
const { databaseAccount } = userContext;
|
|
if (databaseAccount && databaseAccount.properties && databaseAccount.properties.capabilities) {
|
|
return databaseAccount.properties.capabilities.some((capability) => capability.name === capabilityName);
|
|
}
|
|
return false;
|
|
};
|
|
|
|
export const isServerlessAccount = (): boolean => {
|
|
const { databaseAccount } = userContext;
|
|
return (
|
|
databaseAccount?.properties?.capacityMode === Constants.CapacityMode.Serverless ||
|
|
isCapabilityEnabled(Constants.CapabilityNames.EnableServerless)
|
|
);
|
|
};
|
|
|
|
export const isVectorSearchEnabled = (): boolean => {
|
|
return userContext.apiType === "SQL" && isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLVectorSearch);
|
|
};
|