import { HDict, HGrid, HNum, HRef, HVal } from 'haystack-core'; /** * A Haystack point record with a specific curVal type */ export interface Point extends HDict { /** * Point record id */ id?: HRef; /** * Current value of the readTag */ curVal?: Value; } /** * A hook that allows using a point from an haystack server as react state. * * Important: This hooks requires a ClientContext to work. @see https://github.com/j2inn/haystack-nclient * * @example Example of usage with a numeric point. * * const point= useReadByFilter('point and temp and zone and sp').grid[0] // One-shot reading the first point that matches the filter * const [pointValue, setPointValue, updatedPoint] = useHaystackPoint(point) // Using the point state * * @param originaryPoint point dict used to retrieve its id and initial value. * @param pollRate poll rate for the value subscription. Expressed in seconds. * @param writeOptions default options for the write callback. * @returns Returns the point value, a function to update it and the point dict. */ export declare function useHaystackPoint(originaryPoint: Optional>, pollRate?: number, writeOptions?: HaystackPointWriteOptions): [ Optional, PointWriteFunc | undefined, Optional> ]; type Optional = Value | undefined | null; export type PointWriteFunc = (val: Value, options?: HaystackPointWriteOptions) => Promise>; /** * Options for a PointWrite operation, * See https://project-haystack.org/doc/docHaystack/Ops#pointWrite */ export interface HaystackPointWriteOptions { level?: number; who?: string; duration?: number | HNum; } export {};