import { ReactNode } from "react"; import * as react_jsx_runtime0 from "react/jsx-runtime"; //#region src/react/hooks/use-resource-status.d.ts /** * Cross-kind severity, ordered worst-first (`error > warning > pending`). * Callers `unpublish` rather than publishing a status for ready resources. */ type ResourceSeverity = "pending" | "warning" | "error"; /** * Readiness snapshot for a single resource (SQL warehouse, Lakebase * connection, model-serving endpoint, …). Plugins publish these while a * user-visible cold start / warm-up / unavailability is in flight. */ interface ResourceStatus { /** Resource family, conventionally lowercase-kebab (`"warehouse"`, `"lakebase"`). */ kind: string; /** Resource-specific raw state, e.g. `"STARTING"`, `"DELETED"`. Opaque to the aggregator. */ state: string; severity: ResourceSeverity; /** Human-readable summary forwarded to the indicator UI. */ summary?: string; /** Epoch ms when the publisher started waiting; drives `elapsedMs`. */ startedAt: number; } /** Aggregate view of every active publisher; returned by {@link useResourceStatus}. */ interface AggregatedResourceStatus { /** Highest-severity status across all publishers, or `null` when nothing is pending. */ worst: ResourceStatus | null; /** Worst status per `kind`. */ byKind: Record; /** De-duped, sorted labels of every publisher with a non-null status. */ affectedLabels: string[]; /** Total registered publishers (including those whose status is `null`). */ activeCount: number; /** Milliseconds since the worst entry's `startedAt`; `0` when nothing is pending. */ elapsedMs: number; /** Monotonic counter bumped on every `publish`/`unpublish`. */ version: number; } /** Optional filter for {@link useResourceStatus}. */ interface ResourceStatusFilter { /** Restrict the aggregate to a single resource kind. */ kind?: string; } interface ResourceStatusProviderProps { children: ReactNode; } /** * Mount once near the root of your app to enable a global, cross-plugin * readiness aggregate. Plugins publish {@link ResourceStatus} snapshots * while a resource is warming up / unavailable; {@link useResourceStatus} * exposes the worst across all of them. * * Without a provider, `useResourceStatus` and `useResourceStatusPublisher` * fall back to no-ops, so plugins are safe to call them unconditionally. * * @example * ```tsx * * * * * ``` */ declare function ResourceStatusProvider({ children }: ResourceStatusProviderProps): react_jsx_runtime0.JSX.Element; /** * Returns the aggregated resource-readiness snapshot across every active * publisher under the nearest {@link ResourceStatusProvider}. Falls back * to the empty/idle aggregate when no provider is mounted. * * @param filter Optional `{ kind }` to scope to a single resource kind. */ declare function useResourceStatus(filter?: ResourceStatusFilter): AggregatedResourceStatus; /** * Register a publisher with the nearest {@link ResourceStatusProvider}. * Safe to call without a provider — `publish`/`unpublish` are no-ops. * * @param id Stable identifier (e.g. a `useId()` value). * @param label Human-readable label surfaced via `affectedLabels`. */ declare function useResourceStatusPublisher(id: string, label: string, options?: { kindHint?: string; }): { publish: (status: ResourceStatus | null) => void; unpublish: () => void; }; //#endregion export { AggregatedResourceStatus, ResourceSeverity, ResourceStatus, ResourceStatusFilter, ResourceStatusProvider, ResourceStatusProviderProps, useResourceStatus, useResourceStatusPublisher }; //# sourceMappingURL=use-resource-status.d.ts.map