@arizeai/phoenix-client
Version:
A client for the Phoenix API
47 lines • 2.12 kB
TypeScript
/**
* Phoenix server version utilities.
*
* Provides guards for capabilities that require a minimum Phoenix **server**
* version. The server version is detected from the
* `x-phoenix-server-version` response header or by calling
* `GET /arize_phoenix_version`.
*
* ## Capability guard pattern
*
* Each server-side feature that was introduced after the initial release is
* represented by a {@link CapabilityRequirement} constant (defined in
* `constants/serverRequirements`). Before calling such a feature, the client
* passes the requirement to {@link ensureServerCapability}, which compares the
* connected server's version against the requirement's minimum version and
* throws a descriptive error when the server is too old. This lets callers
* see *exactly* which feature is unavailable and which version they need,
* rather than receiving an opaque HTTP 404 or 400 response.
*/
import type { PhoenixClient } from "../client.js";
import type { CapabilityRequirement } from "../types/serverRequirements.js";
/**
* Derive a human-readable label from a structured capability requirement.
* Uses `description` if provided, otherwise auto-derives from metadata.
*/
export declare function capabilityLabel(req: CapabilityRequirement): string;
/**
* Check the **Phoenix server version** before allowing a capability to proceed.
*
* Throws if the connected Phoenix server is older than the minimum version
* required by the given capability. Also throws if the server version cannot
* be determined — this typically means the server is too old to report its
* version at all and is therefore incompatible with this client.
*
* @example
* ```ts
* import { ensureServerCapability } from "../utils/serverVersionUtils.js";
* import { GET_SESSION } from "../constants/serverRequirements.js";
*
* await ensureServerCapability({ client, requirement: GET_SESSION });
* ```
*/
export declare function ensureServerCapability({ client, requirement, }: {
client: PhoenixClient;
requirement: CapabilityRequirement;
}): Promise<void>;
//# sourceMappingURL=serverVersionUtils.d.ts.map