declare enum FrameType { DataTable = "DataTable", DataSetHeader = "DataSetHeader", DataSetCompletion = "DataSetCompletion" } interface RawDataFrameBase { FrameType: FrameType; } declare enum TableKind { PrimaryResult = "PrimaryResult" } interface RawDataTableColumn { ColumnName: string; ColumnType: string; } type ADXValue = string | number | boolean | null; interface RawDataTable extends RawDataFrameBase { TableName: string; FrameType: FrameType.DataTable; TableKind: TableKind; Columns: RawDataTableColumn[]; Rows: ADXValue[][]; } interface RawDataSetHeader extends RawDataFrameBase { FrameType: FrameType.DataSetHeader; } interface RawDataSetCompletion extends RawDataFrameBase { FrameType: FrameType.DataSetCompletion; } type RawDataFrame = RawDataTable | RawDataSetHeader | RawDataSetCompletion; type RawADXResponse = RawDataFrame[]; /** * A simple holder class for the ADX Response data. * * @remarks * This class is designed to support the TSI Trender library, not to * provide a fully featured ADX client. * * @see {@link https://docs.microsoft.com/en-us/azure/data-explorer/kusto/api/rest/ API Documentation} */ declare class ADXResponse { dataSetHeader: RawDataSetHeader; dataSetCompletion: RawDataSetCompletion; dataTables: RawDataTable[]; constructor(response: RawADXResponse); /** * Getter for tables marked as primary. Used to easily filter out ADX metadata in the response. */ get primaryTables(): RawDataTable[]; /** * Finds the table with the provided name in the response * Use the `as` operator in KQL to name your tables * * @param tableName - A string to match each table name against * @returns The Raw table */ getTable(tableName: string): RawDataTable; /** * Converts an ADX Table (columns, rows) into an array of keyed objects * * @param table - The raw ADX Data Table to convert * @returns An array of native keyed objects */ unfoldTable(table: RawDataTable): RowType[]; } type ADXResponse$1_ADXResponse = ADXResponse; declare const ADXResponse$1_ADXResponse: typeof ADXResponse; type ADXResponse$1_FrameType = FrameType; declare const ADXResponse$1_FrameType: typeof FrameType; type ADXResponse$1_RawADXResponse = RawADXResponse; declare namespace ADXResponse$1 { export { ADXResponse$1_ADXResponse as ADXResponse, ADXResponse$1_FrameType as FrameType }; export type { ADXResponse$1_RawADXResponse as RawADXResponse }; } type ADXTokenProvider = () => Promise; declare global { interface Crypto { randomUUID: () => `${string}-${string}-${string}-${string}-${string}`; } } interface ADXQueryProperties { parameters: Record; } /** * A basic JS wrapper for the ADX Kusto REST Query APIs. * * @remarks * This class is designed to support the TSI Trender library, not to * provide a fully featured ADX client. * * @see {@link https://docs.microsoft.com/en-us/azure/data-explorer/kusto/api/rest/ API Documentation} */ declare class ADXClient { clusterUrl: string; database: string; tokenProvider: ADXTokenProvider; constructor(clusterUrl: string, tokenProvider: ADXTokenProvider, database: string); /** * Getter for the query rest endpoint Url */ get queryUrl(): string; /** * Executes a KQL query against the configured ADX cluster. * * @param query - KQL query * @param properties - Optional * @returns A Promise with an ADXRespnse object */ executeQuery(query: string, properties?: ADXQueryProperties): Promise; private parseResponse; } declare enum HierarchiesExpandKind { OneLevel = "OneLevel", UntilChildren = "UntilChildren" } interface HierarchiesSearchPayload { expand: { kind: HierarchiesExpandKind; }; } interface InstancesSearchPayload { recursive?: boolean; } interface PathSearchPayload { searchString?: string; path?: string[]; hierarchies?: HierarchiesSearchPayload; instances?: InstancesSearchPayload; } interface AvailabilityRange { from: string; to: string; } interface AvailabilityWrapper { availabilityCount: Record<"", Record>; } interface AvailabilityValue { range: AvailabilityRange; availability: AvailabilityWrapper[]; } interface HierarchyValue { HierarchyName: string; } interface ChildValue { Child: string; Count: number; } interface TagValue { TimeseriesId: string; DisplayName: string; Path?: string[]; } /** * A helper subclass of {@link ADXClient} with trender-specific methods. */ declare class ADXTrenderClient extends ADXClient { /** * Returns availability information in a trender-friendly format. * * @remarks This function always returns a one hour interval. */ getAvailability(): Promise; /** * Returns trender instances */ getInstances(): Promise; /** * Returns an aggregate over time for the provided tags and time interval. */ getAggregates(tags: string[], startDate: Date, endDate: Date, interval: string): Promise<{ [x: string]: any; }[]>; /** * Returns available hierarchies. */ getHierarchies(): Promise; getHierarchyLevel(search: PathSearchPayload): Promise<{ tags: TagValue[]; children: ChildValue[]; }>; searchTagsAtPath(payload: PathSearchPayload): Promise; getChildrenTags(search: PathSearchPayload): Promise; /** * Get suggested tag names for a search string. */ getSuggestions(searchString: string): Promise; } /** * A helper that wraps {@link ADXTrenderClient} to help with hierarchy navigation. * This class can be extended to modify the hierarchy component's behavior. */ declare class HierarchyDelegate { client: ADXTrenderClient; constructor(client: ADXTrenderClient); getTimeSeriesTypes(): Promise<{ id: string; name: string; description: string; variables: { EventCount: { kind: string; aggregation: { tsx: string; }; }; }; }[]>; getHierarchies(): Promise<{ name: string; id: string; }[]>; getInstancesSuggestions(text: string): Promise<{ searchString: string; }[]>; getInstancesPathSearch(payload: PathSearchPayload): Promise<{ hierarchyNodes: { hits: { name: any; cumulativeInstanceCount: any; }[]; hitCount: number; }; instances: { hits: { timeSeriesId: string[]; typeId: string; name: string; highlights: { timeSeriesId: string[]; description: string; name: string; }; }[]; hitCount: number; }; } | { hierarchyNodes: { hits: { name: string; cumulativeInstanceCount: number; }[]; hitCount: number; }; instances?: undefined; }>; getInstancesSearch(text: string): Promise<{ instances: { hits: { timeSeriesId: string[]; typeId: string; hierarchyIds: string[]; highlights: { timeSeriesId: string[]; typeName: string; name: string; description: string; hierarchyIds: string[]; hierarchyNames: string[]; instanceFieldNames: string[]; instanceFieldValues: string[]; }; }[]; hitCount: number; }; }>; getInstances(): Promise<{ instances: { typeId: string; timeSeriesId: string[]; name: string; description: string; hierarchyIds: string[]; instanceFields: { Low: string; High: string; PointSource: string; DigitalSet: string; EngUnits: string; PointType: string; Description: string; L1: string; L2: string; }; }[]; }>; } export { ADXClient, ADXResponse$1 as ADXResponse, ADXTrenderClient, HierarchyDelegate };