import { Instrumentation } from '@synnaxlabs/alamos'; import { channel, control, framer, status as cstatus, Synnax } from '@synnaxlabs/client'; import { CrudeSeries } from '@synnaxlabs/x'; import { z } from 'zod'; import { aether } from '../../../aether/aether'; import { theming } from '../../../ether'; import { status } from '../../../status/aether'; import { telem } from '../../aether'; import { AbstractSink } from '../../aether/telem'; import { Colors } from './colors'; export declare const statusZ: z.ZodEnum<{ acquired: "acquired"; released: "released"; overridden: "overridden"; failed: "failed"; }>; export type Status = z.infer; export declare const controllerStateZ: z.ZodObject<{ name: z.ZodString; authority: z.ZodDefault; status: z.ZodOptional>; needsControlOf: z.ZodDefault>]>>>; disabled: z.ZodDefault; }, z.core.$strip>; export declare const controllerMethodsZ: { acquire: z.ZodFunction, z.ZodVoid>; release: z.ZodFunction, z.ZodVoid>; }; /** * Opens the writer a {@link Controller} commands through. The client is an argument * rather than a binding because a Controller resolves its own only after construction. */ export type OpenWriter = (client: Synnax, config: framer.WriterConfig) => Promise; interface InternalState { client: Synnax | null; instrumentation: Instrumentation; colors: Colors; addStatus: status.Adder; runAsync: status.ErrorHandler; theme: theming.Theme; telemCtx: telem.Context; } interface AetherControllerTelem extends telem.Telem { needsControlOf: (client: Synnax) => Promise; } /** * @summary Acquires control over a set of channels by opening a writer to a Synnax * cluster, and then acts as a factory for telemetry that can be used to send commands * to that writer. */ export declare class Controller extends aether.Composite implements telem.Factory, aether.HandlersFromSchema { static readonly TYPE = "Controller"; static readonly METHODS: { acquire: z.ZodFunction, z.ZodVoid>; release: z.ZodFunction, z.ZodVoid>; }; schema: z.ZodObject<{ name: z.ZodString; authority: z.ZodDefault; status: z.ZodOptional>; needsControlOf: z.ZodDefault>]>>>; disabled: z.ZodDefault; }, z.core.$strip>; methods: { acquire: z.ZodFunction, z.ZodVoid>; release: z.ZodFunction, z.ZodVoid>; }; private readonly registry; private readonly openWriter; private writer?; private acquirePromise?; /** Set while an acquisition the user asked for is in flight. The disabled bar does * not apply to it: taking control is what clears the bar. */ private acquireExplicit; constructor(props: aether.ComponentConstructorProps, openWriter?: OpenWriter); afterUpdate(ctx: aether.Context): void; /** The cluster this controller is bound to, or null while disconnected. */ get client(): Synnax | null; afterDelete(): void; private updateNeedsControlOf; acquire(): void; release(): void; private doAcquire; private doAcquireImpl; private doRelease; private static isRetryable; private closeWriter; private withRetry; set(frame: framer.CrudeFrame | Record): Promise; setAuthority(channels: channel.Key[], value: control.Authority): Promise; releaseAuthority(keys: channel.Key[]): Promise; deleteTelem(t: AetherControllerTelem): void; /** @implements telem.Factory to create telemetry that is bound to this controller. */ create(spec: telem.Spec): T | null; } export declare const setChannelValuePropsZ: z.ZodObject<{ channel: z.ZodNumber; }, z.core.$strip>; export type SetChannelValueProps = z.infer; export declare class SetChannelValue extends AbstractSink implements telem.NumberSink, AetherControllerTelem { static readonly TYPE = "controlled-numeric-telem-sink"; private readonly controller; private readonly runAsync; schema: z.ZodObject<{ channel: z.ZodNumber; }, z.core.$strip>; constructor(controller: Controller, runAsync: status.ErrorHandler, props: unknown); invalidate(): void; cleanup(): void; needsControlOf(client: Synnax): Promise; set(...values: number[]): void; } export declare const setChannelValue: (props: SetChannelValueProps) => telem.NumberSinkSpec; export declare const acquireChannelControlPropsZ: z.ZodObject<{ authority: z.ZodDefault; channel: z.ZodNumber; }, z.core.$strip>; export type AcquireChannelControlProps = z.infer; export declare class AcquireChannelControl extends AbstractSink implements telem.BooleanSink, AetherControllerTelem { static readonly TYPE = "acquire-channel-control"; private readonly controller; private readonly runAsync; schema: z.ZodObject<{ authority: z.ZodDefault; channel: z.ZodNumber; }, z.core.$strip>; constructor(controller: Controller, runAsync: status.ErrorHandler, props: unknown); cleanup(): void; needsControlOf(client: Synnax): Promise; set(acquire: boolean): void; } export declare const acquireChannelControl: (props: AcquireChannelControlProps) => telem.BooleanSinkSpec; export declare const authoritySourceProps: z.ZodObject<{ channel: z.ZodNumber; }, z.core.$strip>; export type AuthoritySourceProps = z.infer; export declare const authoritySourceDetailsZ: z.ZodObject<{ valid: z.ZodBoolean; color: z.ZodOptional, z.ZodTuple<[z.ZodInt, z.ZodInt, z.ZodInt, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{ rgba255: z.ZodTuple<[z.ZodInt, z.ZodInt, z.ZodInt, z.ZodNumber], null>; }, z.core.$strip>, z.ZodObject<{ r: z.ZodInt; g: z.ZodInt; b: z.ZodInt; a: z.ZodNumber; }, z.core.$strip>, z.ZodTuple<[z.ZodInt, z.ZodInt, z.ZodInt, z.ZodPipe>], null>, z.ZodObject<{ rgba255: z.ZodTuple<[z.ZodInt, z.ZodInt, z.ZodInt, z.ZodPipe>], null>; }, z.core.$strip>, z.ZodObject<{ r: z.ZodInt; g: z.ZodInt; b: z.ZodInt; a: z.ZodPipe>; }, z.core.$strip>]>, z.ZodTransform<[number, number, number, number], string | [number, number, number] | [number, number, number, number] | { rgba255: [number, number, number, number]; } | { r: number; g: number; b: number; a: number; } | { rgba255: [number, number, number, number]; } | { r: number; g: number; b: number; a: number; }>>>; authority: z.ZodNumber; }, z.core.$strip>; export type AuthoritySourceDetails = z.infer; export declare class AuthoritySource extends telem.AbstractSource implements telem.StatusSource, AetherControllerTelem { static readonly TYPE = "controlled-status-source"; private readonly colors; private readonly controller; private readonly retrieve; private readonly stopListening; schema: z.ZodObject<{ channel: z.ZodNumber; }, z.core.$strip>; constructor(controller: Controller, colors: Colors, runAsync: status.ErrorHandler, props: unknown); needsControlOf(): Promise; value(): cstatus.Status; cleanup(): void; } export declare const authoritySource: (props: AuthoritySourceProps) => telem.StatusSourceSpec; export {}; //# sourceMappingURL=controller.d.ts.map