import { AbortSignal as AbortSignal_2 } from '@dynatrace-sdk/http-client'; import { AnalyzerError } from '@dynatrace-sdk/client-davis-analyzers'; import { AnalyzerResult } from '@dynatrace-sdk/client-davis-analyzers'; import { analyzersClient } from '@dynatrace-sdk/client-davis-analyzers'; import { AppSettingsAccessorPermissions } from '@dynatrace-sdk/client-app-settings-v2'; import { AppSettingsAccessorPermissionsList } from '@dynatrace-sdk/client-app-settings-v2'; import { AppSettingsError } from '@dynatrace-sdk/client-app-settings'; import { AppSettingsObjectResponse } from '@dynatrace-sdk/client-app-settings'; import { AppSettingsObjectResponse as AppSettingsObjectResponse_2 } from '@dynatrace-sdk/client-app-settings-v2'; import { appSettingsObjectsClient } from '@dynatrace-sdk/client-app-settings'; import { appSettingsObjectsClient as appSettingsObjectsClient_2 } from '@dynatrace-sdk/client-app-settings-v2'; import { AppSettingsObjectsList } from '@dynatrace-sdk/client-app-settings'; import { AppSettingsObjectsList as AppSettingsObjectsList_2 } from '@dynatrace-sdk/client-app-settings-v2'; import { AppSettingsUpdateResponse } from '@dynatrace-sdk/client-app-settings-v2'; import { AppState } from '@dynatrace-sdk/client-state'; import { AppStates } from '@dynatrace-sdk/client-state'; import { AutocompleteResponse } from '@dynatrace-sdk/client-query'; import { Binary } from '@dynatrace-sdk/http-client'; import { Context } from 'react'; import { DocumentList } from '@dynatrace-sdk/client-document'; import { DocumentMetaData } from '@dynatrace-sdk/client-document'; import { documentsClient } from '@dynatrace-sdk/client-document'; import { EffectiveAppSettingsValuesList } from '@dynatrace-sdk/client-app-settings'; import { EffectiveAppSettingsValuesList as EffectiveAppSettingsValuesList_2 } from '@dynatrace-sdk/client-app-settings-v2'; import { EffectivePermissions } from '@dynatrace-sdk/client-app-settings'; import { EffectivePermissions as EffectivePermissions_2 } from '@dynatrace-sdk/client-app-settings-v2'; import { Error as Error_2 } from '@dynatrace-sdk/client-state'; import { Error as Error_3 } from '@dynatrace-sdk/client-document'; import { Error as Error_4 } from '@dynatrace-sdk/client-app-settings-v2'; import { ErrorResponse } from '@dynatrace-sdk/client-query'; import type { ExecuteRequest } from '@dynatrace-sdk/client-query'; import type { FilterSegment } from '@dynatrace-sdk/client-query'; import type { FilterSegments } from '@dynatrace-sdk/client-query'; import type { FilterSegmentVariableDefinition } from '@dynatrace-sdk/client-query'; import { FunctionComponentElement } from 'react'; import { GetDocumentResponse } from '@dynatrace-sdk/client-document'; import type { GrailMetadata } from '@dynatrace-sdk/client-query'; import { JSXElementConstructor } from 'react'; import type { Metadata } from '@dynatrace-sdk/client-query'; import { PropsWithChildren } from 'react'; import { ProviderProps } from 'react'; import { QueryClient } from '@tanstack/react-query'; import { queryExecutionClient } from '@dynatrace-sdk/client-query'; import { QueryKey } from '@tanstack/react-query'; import type { QueryOptions } from '@dynatrace-sdk/client-query'; import type { QueryPollResponse } from '@dynatrace-sdk/client-query'; import { QueryResult } from '@dynatrace-sdk/client-query'; import { ReactElement } from 'react'; import type { RestUserPublic } from '@dynatrace-sdk/client-iam'; import { ResultRecord } from '@dynatrace-sdk/client-query'; import { stateClient } from '@dynatrace-sdk/client-state'; import { UpdateDocumentMetadata } from '@dynatrace-sdk/client-document'; import { UserAppState } from '@dynatrace-sdk/client-state'; import { UserAppStates } from '@dynatrace-sdk/client-state'; /** * Provides the parameters for getAppSettingsPermissionByObjectIdAndAccessorId */ export declare type AccessorPermissionsParamsV2 = Omit[0], 'abortSignal'>; /** * @deprecated This interface will be removed in the future, use HookOptions interface instead. */ export declare interface AnalyzerHookOptions extends HookOptions { onError?: (error: Error) => void; } /** * Provides the parameters for executeAnalyzer. */ export declare type AnalyzerParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for the app function */ export declare type AppFunctionParams = { name: string; data?: unknown; responseType?: 'json' | 'text'; }; /** * Provides the parameters for getAppState */ export declare type AppStateParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for getAppStates */ export declare type AppStatesParams = Omit[0], 'abortSignal'>; declare type AsyncStateStatus = 'not-requested' | 'loading' | 'success' | 'error'; /** Options for the autocomplete query passed to {@link useGrailFields}. */ export declare interface AutocompleteQueryOptions extends QueryOverrides { /** The DQL query string used to derive autocomplete field suggestions. */ query: string; } /** * Provides the parameters for createDocument */ export declare type CreateDocumentBodyParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for postAppSettingsPermissionByObjectId */ export declare type CreatePermissionsParamsV2 = Omit[0], 'abortSignal'>; /** * Provides the parameters for postAppSettingsObject * * @deprecated Use V2 instead. */ export declare type CreateSettingsParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for postAppSettingsObject */ export declare type CreateSettingsParamsV2 = Omit[0], 'abortSignal'>; /** * Provides the parameters for deleteAppSettingsPermissionByObjectIdAndAccessorId */ export declare type DeleteAccessorPermissionsParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; /** * Provides the parameters for deleteAppSettingsAllUsersPermissionByObjectId */ export declare type DeleteAllUsersPermissionsParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; /** * Provides the parameters for deleteAppState */ export declare type DeleteAppStateParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for deleteDocument */ export declare type DeleteDocumentsParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for deleteAppSettingsObjectByObjectId * * @deprecated Use V2 instead. */ export declare type DeleteSettingsParams = DistributiveOmit[0], 'abortSignal'>; /** * Provides the parameters for deleteAppSettingsObjectByObjectId */ export declare type DeleteSettingsParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; /** * Provides the parameters for deleteUserAppState */ export declare type DeleteUserAppStateParams = Omit[0], 'abortSignal'>; declare type DistributiveOmit = T extends any ? Omit : never; declare type DistributiveOmit_2 = T extends any ? Omit : never; /** * Provides the parameters for getDocumentMetadata */ export declare type DocumentMetaDataParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for getDocument */ export declare type DocumentParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for downloadDocumentContent */ export declare type DownloadDocumentParams = Omit[0], 'abortSignal'>; /** * Parameters for query execution. */ export declare interface DqlQueryParams extends ExecuteConfig, ExecuteRequest { } /** * Context storing Dql query params. */ export declare const DqlQueryParamsContext: Context; /** * @interface */ export declare type DqlQueryParamsContextProps = Omit; /** * Provider component for Dql query params context to use with the `useDql` hook. */ export declare function DqlQueryParamsProvider(props: PropsWithChildren): FunctionComponentElement>; /** Options for the DSS query passed to {@link useGrailFields}. */ export declare interface DssQueryOptions extends QueryOverrides { /** The target DSS data object (`"logs"`, `"spans"`, `"smartscape.nodes"`, or `"metrics"`). */ dataObject: 'logs' | 'spans' | 'smartscape.nodes' | 'metrics'; /** Optional timeout in milliseconds for the DSS query request. */ requestTimeoutMilliseconds?: number; /** Optional DSS filter statement to scope the internal DSS query. */ filterStatement?: string; } /** * @deprecated Use V2 instead. */ export declare type EffectivePermissionsParams = DistributiveOmit[0], 'abortSignal'>; export declare type EffectivePermissionsParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; declare type ExecuteConfig = Omit[0], 'body' | 'abortSignal'>; export { FilterSegment } export { FilterSegments } export { FilterSegmentVariableDefinition } /** * Creates combined query options for both autocomplete and DSS queries used in {@link useGrailFields}. * This allows consumers to prefetch both queries in parallel. * * @param autocompleteOptions - Options for the autocomplete query. * @param dssOptions - Options for the DSS query. * @returns An object containing query options for both autocomplete and DSS queries. * * @example * ```tsx * const queryClient = useQueryClient(); * const { autocomplete, dss } = getGrailFieldsQueryOptions( * { query: 'fetch logs' }, * { dataObject: 'logs' }, * ); * await Promise.all([ * queryClient.prefetchQuery(autocomplete), * queryClient.prefetchQuery(dss), * ]); * ``` */ export declare function getGrailFieldsQueryOptions(autocompleteOptions: AutocompleteQueryOptions, dssOptions: DssQueryOptions): GrailFieldsQueryOptions; /** * A configured query-option object suitable for passing to * `queryClient.prefetchQuery()` or `queryClient.fetchQuery()`. */ export declare interface GrailFieldQueryOption { /** The query key used for caching and invalidation. */ readonly queryKey: readonly unknown[]; /** The function that fetches the data. */ readonly queryFn: (context: { signal: AbortSignal; }) => Promise; /** Whether the query is enabled. */ readonly enabled?: boolean; /** Time in milliseconds before the query is considered stale. */ readonly staleTime?: number; /** Number of retries or boolean to indicate whether to retry on failure. */ readonly retry?: boolean | number; } /** Return type of {@link getGrailFieldsQueryOptions}, containing query options for both autocomplete and DSS queries. */ export declare interface GrailFieldsQueryOptions { autocomplete: GrailFieldQueryOption; dss: GrailFieldQueryOption; } /** * Available options for react-hooks */ declare type HookOptions = { /** If set to true, the hook will execute the query immediately. If set to false, the query only executes when calling refetch. */ autoFetch: boolean; /** If set to true, the hook will execute the query on a component update. If set to false, it is not executed on update. */ autoFetchOnUpdate: boolean; onError?: (error: Error) => void; }; /** * Provides the parameters for listDocuments */ export declare type ListDocumentsParams = Omit[0]>, 'abortSignal'>; /** * Provides the parameters for getAppSettingsAllUsersPermissionByObjectId */ export declare type LoadAllUsersPermissionsParamsV2 = Omit[0], 'abortSignal'>; /** * Provides the parameters for getAppSettingsPermissionsByObjectId */ export declare type PermissionsParamsV2 = Omit[0], 'abortSignal'>; export { QueryOptions } /** * Subset of `UseQueryOptions` fields (from `@tanstack/react-query`) forwarded to each internal * `useQueries` entry. Mirrors the `enabled`, `staleTime`, and `retry` options. */ export declare interface QueryOverrides { /** Whether the query is enabled. */ enabled?: boolean; /** Time in milliseconds before the query is considered stale. */ staleTime?: number; /** Number of retries or boolean to indicate whether to retry on failure. */ retry?: boolean | number; } /** * Provides the parameters for queryExecute */ export declare type QueryParams = Omit[0], 'abortSignal'>; /** * Options for the refetch functions returned by the useDql hook. */ export declare interface RefetchOptions { /** * If set to `true`, a currently running request will be cancelled before a new request is made * * If set to `false`, no refetch will be made if there is already a request running. * * Defaults to `true`. */ cancelRefetch?: boolean; throwOnError?: boolean; } /** * Provides the parameters for setAppState */ export declare type SetAppStateParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for setUserAppState */ export declare type SetAppUserStateParams = Omit[0], 'abortSignal'>; /** * @deprecated Use V2 instead. */ export declare type SettingsObjectParams = DistributiveOmit[0], 'abortSignal'>; export declare type SettingsObjectParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; /** * @deprecated Use V2 instead. */ export declare type SettingsParams = DistributiveOmit[0], 'abortSignal'>; export declare type SettingsParamsV2 = DistributiveOmit_2[0], 'abortSignal'>; /** * Provides the parameters for postAppSettingsOwnershipByObjectId */ export declare type TransferOwnershipParamsV2 = Omit[0], 'abortSignal'>; /** * Generic type that allows to type data returned from Grail. * @interface */ export declare type TypedQueryResult = Omit & { records: T[]; metadata: UseDqlMetadata; }; /** * Provides the parameters for putAppSettingsPermissionByObjectIdAndAccessorId */ export declare type UpdateAccessorPermissionsParamsV2 = Omit[0], 'abortSignal'>; /** * Provides the parameters for putAppSettingsAllUsersPermissionByObjectId */ export declare type UpdateAllUsersPermissionsParamsV2 = Omit[0], 'abortSignal'>; /** * Provides the parameters for updateDocumentMetadata */ export declare type UpdateDocumentMetadataParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for updateDocument */ export declare type UpdateDocumentParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for putAppSettingsObjectByObjectId * * @deprecated Use V2 instead. */ export declare type UpdateSettingsParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for putAppSettingsObjectByObjectId */ export declare type UpdateSettingsParamsV2 = Omit[0], 'abortSignal'>; /** * Load accessor permissions. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useAccessorPermissionsV2(params: AccessorPermissionsParamsV2, options?: HookOptions): { data: AppSettingsAccessorPermissions | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AppSettingsAccessorPermissions | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Load all-users permissions. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useAllUsersPermissionsV2(params: LoadAllUsersPermissionsParamsV2, options?: HookOptions): { data: AppSettingsAccessorPermissions | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AppSettingsAccessorPermissions | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Execute an analyzer with the given data. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare const useAnalyzer: (params: AnalyzerParams, options?: HookOptions) => { data: AnalyzerResult | undefined; error: Error | undefined; errorDetails: AnalyzerError | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AnalyzerResult | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Call specified app function by name. * @param params App function params. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useAppFunction({ name, data, responseType }: AppFunctionParams, options?: HookOptions): { data: T | undefined; error: Error | undefined; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: any[]) => Promise; cancel: () => void; }; /** * Gets app state * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useAppState(params: AppStateParams, options?: HookOptions): { data: AppState | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * List app states * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. * */ export declare function useAppStates(params: AppStatesParams, options?: HookOptions): { data: AppStates | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Create a new document. */ export declare function useCreateDocument(): { execute: (params: CreateDocumentBodyParams) => Promise; data: DocumentMetaData | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Create a new permissions. */ export declare function useCreatePermissionsV2(): { execute: (params: CreatePermissionsParamsV2) => Promise; data: AppSettingsAccessorPermissions | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | AppSettingsAccessorPermissions | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Create a new setting. * * @deprecated Use V2 instead. */ export declare function useCreateSettings(): { execute: (params: CreateSettingsParams) => Promise; data: void | AppSettingsObjectResponse | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isSuccess: false | void | AppSettingsObjectResponse | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Create a new setting. */ export declare function useCreateSettingsV2(): { execute: (params: CreateSettingsParamsV2) => Promise; data: void | AppSettingsObjectResponse_2 | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | AppSettingsObjectResponse_2 | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete the accessor permissions */ export declare function useDeleteAccessorPermissionsV2(): { execute: (params: Omit<{ objectId: string; accessorType: "user" | "group"; accessorId: string; adminAccess?: boolean | undefined; abortSignal?: AbortSignal_2 | undefined; }, "abortSignal">) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete the all-users permissions */ export declare function useDeleteAllUsersPermissionsV2(): { execute: (params: Omit<{ objectId: string; adminAccess?: boolean | undefined; abortSignal?: AbortSignal_2 | undefined; }, "abortSignal">) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Deletes app state */ export declare function useDeleteAppState(): { execute: (params: DeleteAppStateParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete all app states */ export declare function useDeleteAppStates(): { execute: () => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete the document */ export declare function useDeleteDocument(): { execute: (params: DeleteDocumentsParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete the setting * * @deprecated Use V2 instead. */ export declare function useDeleteSettings(): { execute: (params: Omit<{ objectId: string; optimisticLockingVersion: string; abortSignal?: AbortSignal_2 | undefined; }, "abortSignal">) => Promise; data: void | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete the setting */ export declare function useDeleteSettingsV2(): { execute: (params: Omit<{ objectId: string; optimisticLockingVersion: string; adminAccess?: boolean | undefined; abortSignal?: AbortSignal_2 | undefined; }, "abortSignal">) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete user app state */ export declare function useDeleteUserAppState(): { execute: (params: DeleteUserAppStateParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Delete all user app states */ export declare function useDeleteUserAppStates(): { execute: () => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Retrieve metadata and content for documents. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useDocument(params: DocumentParams, options?: HookOptions): { data: GetDocumentResponse | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Retrieve document metadata. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useDocumentMetaData(params: DocumentMetaDataParams, options?: HookOptions): { data: DocumentMetaData | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Download document content * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useDownloadDocument(params: DownloadDocumentParams, options?: HookOptions): { data: Binary | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * React hook for executing DQL (Dynatrace Query Language) queries against Grail. * * Use this hook to run DQL queries in React components and manage query state with less boilerplate. * It returns query data, loading and error state, and functions to cancel or rerun the query. * * - By default, queries that are in-flight are **cancelled when the browser tab * loses focus**. Set `runInBackground: true` to keep them running. * - Results are cached for 60 seconds by default (`staleTime`). Calling `refetch` * while data is still fresh returns the cached result; use `forceRefetch` to * bypass the cache. * - The hook automatically retries on HTTP 429 (Too Many Requests) responses * using the `retryAfterSeconds` header when available, falling back to exponential * back-off. * - When `enablePreview` is set on the query params, intermediate partial results * are exposed via `data` while the query is still running. * * @template T - The shape of each record returned by the query. Defaults to * `ResultRecord` from `@dynatrace-sdk/client-query`. * * @param {string | DqlQueryParams} query - A DQL query string, or a {@link DqlQueryParams} object for full * control over execution parameters (timezone, timeframe, locale, etc.). * Parameters provided here are merged with any values from a parent * {@link DqlQueryParamsProvider}, with per-call values taking precedence. * * @param {UseDqlOptions} [options={staleTime: 60000, pollRate: 1000}] - Optional configuration for the hook behavior. * * @returns {UseDqlResult} Returns the query result, loading and error state, progress information, and functions to cancel or rerun the query. * * @example * Basic usage * ```tsx * function HostList() { * const { data, isLoading, error } = useDql( * 'fetch dt.entity.host | fields entity.name, state' * ); * * if (isLoading) return Loading...; * if (error) return Error: {error.message}; * * return ( *
    * {data?.records.map((host) => ( *
  • {host['entity.name']}
  • * ))} *
* ); * } * ``` * * @example * Typed records * ```tsx * interface MyRecord { * state: string; * } * * const { data } = useDql( * 'fetch dt.entity.host | fields state' * ); * // data?.records is typed as MyRecord[] * ``` * @example * Advanced query parameters * ```tsx * const result = useDql({ * query: 'fetch logs | sort timestamp desc | limit 100', * defaultTimeframeStart: 'now()-2h', * defaultTimeframeEnd: 'now()', * timezone: 'Europe/Berlin', * locale: 'en_US', * enablePreview: true, * }); * ``` * * @example * Shared query parameters via context * ```tsx * * * * * ``` * * @example * Cancellation and refetching * ```tsx * const { cancel, refetch, forceRefetch } = useDql('fetch logs'); * * // Cancel the in-flight query * await cancel(); * * // Refetch only if data is stale * await refetch(); * * // Force a fresh fetch regardless of stale time * await forceRefetch(); * ``` * * @example * Tracking progress * ```tsx * const { data, state, progress } = useDql('fetch logs | summarize count()'); * * if (state === 'RUNNING') { * return ; * } * ``` */ export declare function useDql(query: string | DqlQueryParams, options?: UseDqlOptions): UseDqlResult; /** * Represents a base result from the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @ignore */ export declare interface UseDqlBaseResult { /** * Possible state of the query. */ state: QueryPollResponse['state']; /** * The progress of the query from 0 to 100. */ progress: QueryPollResponse['progress']; /** * Function to call to cancel to ongoing query */ cancel: () => Promise; /** * Function to manually refetch the query. */ refetch: (options?: RefetchOptions) => Promise>; /** * Function to manually force refetch the query. Ignores stale time. */ forceRefetch: (options?: RefetchOptions) => Promise>; /** * `true` if there's no cached data and no query attempt was finished yet. */ isPending: boolean; /** * `true` if the query has received a response with no errors and is ready to display the data. */ isSuccess: boolean; /** * `true` if the query attempt resulted in an error. */ isError: boolean; /** * `true` whenever the first fetch for a query is in-flight. */ isLoading: boolean; /** * Will be `true` if the query failed while fetching for the first time. */ isLoadingError: boolean; /** * `true` whenever the query is executing, which includes initial pending as well as background refetches. */ isFetching: boolean; /** * `true` if the query failed while refetching. */ isRefetchError: boolean; /** * `true` if the query has been fetched. */ isFetched: boolean; /** * `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. */ isStale: boolean; /** * Will be `true` if the data shown is the placeholder data. */ isPlaceholderData: boolean; /** * The last successfully resolved data for the query. */ data?: TypedQueryResult; /** * The error object for the query, if an error was thrown. */ error: Error | null; /** * @ignore * @private This is an internal prop and should be used with caution. * Returns the query key used for caching and identifying this query. */ _getQueryKey: () => QueryKey; } /** * Represents an error result from the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @extends UseDqlBaseResult * @ignore */ export declare interface UseDqlErrorResult extends UseDqlBaseResult { data?: never; /** * The error object for the query, if an error was thrown. */ error: Error; /** * `true` if the query attempt resulted in an error. */ isError: true; isSuccess: false; isLoading: false; isPending: false; } /** * Collects various bits of metadata information. */ export declare interface UseDqlGrailMetadata extends Omit { analysisTimeframe?: UseDqlTimeframe; } /** * Represents a loading state for the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @extends UseDqlBaseResult * @ignore */ export declare interface UseDqlLoadingResult extends UseDqlBaseResult { data?: TypedQueryResult; error: null; isError: false; isSuccess: false; /** * `true` whenever the first fetch for a query is in-flight. */ isLoading: true; isPending: true; } /** * Collects various bits of metadata information. */ export declare interface UseDqlMetadata extends Omit { grail?: UseDqlGrailMetadata; } /** * Options for the useDql hook. */ export declare interface UseDqlOptions { /** * The time in milliseconds after which data is considered stale. */ staleTime?: number; /** * The rate at which Grail query is polled. */ pollRate?: number; /** * Query will continuously refetch at this frequency in milliseconds. */ refetchInterval?: number; /** * Set this to `false` to disable this query from automatically running. Default: `true`. */ enabled?: boolean; /** * If set to `true`, the query will run in the background and not cancel when switching focus. Default: `false`. */ runInBackground?: boolean; /** * If set, this value will be used as the placeholder data while the query is still in the `loading` state. */ placeholderData?: TypedQueryResult; /** * If set to false, the query will not be retried on mount if it contains an error. Defaults to true. */ retryOnMount?: boolean; /** * @ignore * @private This is an internal prop and should be used with caution. * Specifies the TanStack Query client to use for caching and state management. */ _queryClient?: QueryClient; /** * @ignore * @private This is an internal prop and should be used with caution. * Custom TanStack Query key used to identify this query. */ _queryKey?: ReadonlyArray; } /** * Represents a pending state for the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @extends UseDqlBaseResult * @ignore */ export declare interface UseDqlPendingResult extends UseDqlBaseResult { data?: TypedQueryResult; error: null; isError: false; isSuccess: false; /** * `true` if there's no cached data and no query attempt was finished yet. */ isPending: true; } /** * Use this hook to execute a DQL query. * @param params Query and enrich options that will be executed. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. * @returns The state of the query, including the result and functions to refetch or cancel the query. * @deprecated Use `useDql` hook instead. */ export declare function useDqlQuery(params: QueryParams, options?: HookOptions): { data: QueryResult | undefined; error: Error | undefined; errorDetails: ErrorResponse | undefined; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: any[]) => Promise; cancel: () => void; }; /** * @ignore * @private This is an internal prop and should be used with caution. * Context storing the TanStack Query client to use for caching and state management. */ export declare const _UseDqlQueryClientContext: Context; /** * @ignore * @private This is an internal prop and should be used with caution. * Provider component for the TanStack Query client context to use with the `useDql` hook. */ export declare function _UseDqlQueryClientProvider({ children, client, }: PropsWithChildren<{ client: QueryClient; }>): FunctionComponentElement>; /** * Represents the possible results of the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @interface */ export declare type UseDqlResult = UseDqlSuccessResult | UseDqlErrorResult | UseDqlLoadingResult | UseDqlPendingResult; /** * Represents a successful result from the useDql hook. * @template [T=ResultRecord] - The type of data returned by the DQL query. * @extends UseDqlBaseResult * @ignore */ export declare interface UseDqlSuccessResult extends UseDqlBaseResult { /** * The last successfully resolved data for the query. */ data: TypedQueryResult; error: null; isError: false; /** * `true` if the query has received a response with no errors and is ready to display the data. */ isSuccess: true; isLoading: false; isPending: false; } /** * Represents a timeframe value when no date transformations are applied */ export declare interface UseDqlTimeframe { /** * The start time of the timeframe. */ start?: string; /** * The end time of the timeframe. */ end?: string; } /** * Retrieve effective settings permissions for the calling user. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. * * @deprecated Use V2 instead. */ export declare function useEffectivePermissions(params: EffectivePermissionsParams, options?: HookOptions): { data: EffectivePermissions | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isLoading: boolean; isSuccess: false | EffectivePermissions | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Retrieve effective settings permissions for the calling user. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useEffectivePermissionsV2(params: EffectivePermissionsParamsV2, options?: HookOptions): { data: EffectivePermissions_2 | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | EffectivePermissions_2 | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Fetches Grail fields from both autocomplete and DSS query sources * and exposes standard React Query status flags. * * @param options.autocompleteQueryOptions.query - DQL query string used to derive autocomplete field suggestions. * @param options.dssQueryOptions.dataObject - DSS data object to list fields from (`"logs"`, `"spans"`, `"smartscape.nodes"`, or `"metrics"`). * Both option bags also accept any {@link QueryOverrides} to control caching and retry behaviour. * @param options.select - Optional selector applied to the {@link UseGrailFieldsRaw} object once both queries succeed. * @returns {UseGrailFieldsResult} The raw query data (or the value returned by `select`), * plus React Query state flags (`isLoading`, `isError`, `isSuccess`, `errors`, `refetch`, `cancel`). * * @example * Basic usage: * ```tsx * const { data, isLoading } = useGrailFields({ * autocompleteQueryOptions: { query: 'fetch logs' }, * dssQueryOptions: { dataObject: 'logs' }, * }); * // data.autocompleteData, data.dssData * ``` * * @example * With select transform: * ```tsx * const { data } = useGrailFields({ * autocompleteQueryOptions: { query: 'fetch logs' }, * dssQueryOptions: { dataObject: 'logs' }, * select: ({ autocompleteData }) => * autocompleteData?.suggestions?.map((s) => s.suggestion ?? '') ?? [], * }); * ``` */ export declare function useGrailFields(options: UseGrailFieldsOptions): UseGrailFieldsResult; /** Options for the {@link useGrailFields} hook. */ export declare interface UseGrailFieldsOptions { /** Options for the autocomplete query, including the DQL query string and optional cache/retry overrides. */ autocompleteQueryOptions: AutocompleteQueryOptions; /** Options for the DSS query, including the target data object and optional cache/retry overrides. */ dssQueryOptions: DssQueryOptions; /** * Selector applied to the raw data object (`{ autocompleteData, dssData }`) once both queries succeed. * Use this to transform or filter the raw data before it's returned as `data`. * When omitted, `data` is the full {@link UseGrailFieldsRaw} object. */ select?: (data: UseGrailFieldsRaw) => TData; /** * @ignore * @private This is an internal prop and should be used with caution. * Specifies the TanStack Query client to use for caching and state management. */ _queryClient?: QueryClient; } /** The raw, unprocessed response data returned by the two underlying queries in {@link useGrailFields}. */ export declare interface UseGrailFieldsRaw { /** Response data from the autocomplete query. */ autocompleteData?: AutocompleteResponse; /** Response data from the DSS query. */ dssData?: QueryResult; } /** Return value of the {@link useGrailFields} hook. */ export declare interface UseGrailFieldsResult { /** The raw response data from both queries (or the value returned by `select` once both succeed), or `undefined` while loading. */ data: TData | undefined; /** Individual errors from each underlying query (`null` when that query hasn't errored). */ errors: { /** Error from the autocomplete query. */ autocomplete: Error | null; /** Error from the DSS query. */ dss: Error | null; }; /** `true` when either query is in an error state. */ isError: boolean; /** `true` when either query is still fetching for the first time. */ isLoading: boolean; /** `true` when both queries have successfully fetched. */ isSuccess: boolean; /** Re-triggers both underlying queries. */ refetch: () => Promise; /** Cancels both underlying in-flight requests by aborting their signals via React Query. */ cancel: () => Promise<[void, void]>; } /** * List all documents accessible to you. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useListDocuments(params: ListDocumentsParams | undefined, options?: HookOptions): { data: DocumentList | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Load permissions. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function usePermissionsV2(params: PermissionsParamsV2, options?: HookOptions): { data: AppSettingsAccessorPermissionsList | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AppSettingsAccessorPermissionsList | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Resolved user data returned by the `useUser` and `useUsers` hooks. * * Re-exported so consumers can type-annotate user data without * importing `@dynatrace-sdk/client-iam` directly. */ export declare type User = RestUserPublic; /** * Provides the parameters for getUserAppState */ export declare type UserAppStateParams = Omit[0], 'abortSignal'>; /** * Provides the parameters for getUserAppStates */ export declare type UserAppStatesParams = Omit[0], 'abortSignal'>; /** * Updates app state */ export declare function useSetAppState(): { execute: (params: SetAppStateParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Retrieve metadata and content for settings. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. * * @deprecated Use V2 instead. */ export declare function useSettings(params: SettingsParams, options?: HookOptions): { data: EffectiveAppSettingsValuesList | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isLoading: boolean; isSuccess: false | EffectiveAppSettingsValuesList | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Retrieve metadata and content for settings. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. * * @deprecated Use V2 instead. */ export declare function useSettingsObjects(params: SettingsObjectParams, options?: HookOptions): { data: AppSettingsObjectsList | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AppSettingsObjectsList | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Retrieve metadata and content for settings. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useSettingsObjectsV2(params: SettingsObjectParamsV2, options?: HookOptions): { data: AppSettingsObjectsList_2 | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | AppSettingsObjectsList_2 | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Retrieve metadata and content for settings. * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useSettingsV2(params: SettingsParamsV2, options?: HookOptions): { data: EffectiveAppSettingsValuesList_2 | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isLoading: boolean; isSuccess: false | EffectiveAppSettingsValuesList_2 | undefined; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Updates user app state */ export declare function useSetUserAppState(): { execute: (params: SetAppUserStateParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Transfer ownership. */ export declare function useTransferOwnershipV2(): { execute: (params: TransferOwnershipParamsV2) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Update accessor permissions. */ export declare function useUpdateAccessorPermissionsV2(): { execute: (params: UpdateAccessorPermissionsParamsV2) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Update all-users permissions. */ export declare function useUpdateAllUsersPermissionsV2(): { execute: (params: UpdateAllUsersPermissionsParamsV2) => Promise; data: void | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Update metadata and content. */ export declare function useUpdateDocument(): { execute: (params: UpdateDocumentParams) => Promise; data: UpdateDocumentMetadata | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Update document metadata */ export declare function useUpdateDocumentMetadata(): { execute: (params: UpdateDocumentMetadataParams) => Promise; data: DocumentMetaData | undefined; error: Error | undefined; errorDetails: Error_3; isError: boolean; isSuccess: boolean; isLoading: boolean; status: AsyncStateStatus; }; /** * Update metadata and content. * * @deprecated Use V2 instead. */ export declare function useUpdateSettings(): { execute: (params: UpdateSettingsParams) => Promise; data: void | undefined; error: Error | undefined; errorDetails: AppSettingsError | undefined; isError: boolean; isSuccess: false | void | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * Update metadata and content. */ export declare function useUpdateSettingsV2(): { execute: (params: UpdateSettingsParamsV2) => Promise; data: AppSettingsUpdateResponse | undefined; error: Error | undefined; errorDetails: Error_4 | undefined; isError: boolean; isSuccess: false | AppSettingsUpdateResponse | undefined; isLoading: boolean; status: AsyncStateStatus; }; /** * React hook for fetching a single user by UUID. * * Internally batches multiple concurrent `useUser` calls into a single bulk * POST request to the IAM API, deduplicating UUIDs and chunking into batches * of ≤100 to avoid silent truncation. * * @param uuid - The user UUID to fetch, or `undefined` to disable the query. * @param options - Additional options for the hook. * @returns The user data, loading state, and error information. * * @example * const { data: user, isLoading, error } = useUser('user-uuid-123'); */ export declare function useUser(uuid: string | undefined, options?: UseUserOptions): UseUserResult; /** * Get user app state * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useUserAppState(params: UserAppStateParams, options?: HookOptions): { data: UserAppState | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * List user app states * @param params Parameters for the client sdk call. * @param {HookOptions} [options={ autoFetch: true, autoFetchOnUpdate: true }] - Additional options for the react hook. */ export declare function useUserAppStates(params: UserAppStatesParams, options?: HookOptions): { data: UserAppStates | undefined; error: Error | undefined; errorDetails: Error_2; isError: boolean; isLoading: boolean; isSuccess: boolean; status: AsyncStateStatus; refetch: (...args: string[]) => Promise; cancel: () => void; }; /** * Base result shape shared by all `useUser` result states. */ export declare interface UseUserBaseResult { /** The resolved user data, if available. */ data: RestUserPublic | null | undefined; /** The error object, if an error occurred. */ error: Error | null; /** `true` if there's no cached data and no query attempt was finished yet. */ isPending: boolean; /** `true` whenever the first fetch for a query is in-flight. */ isLoading: boolean; /** `true` if the query has received a response with no errors. */ isSuccess: boolean; /** `true` if the query attempt resulted in an error. */ isError: boolean; /** `true` whenever the query is executing, including background refetches. */ isFetching: boolean; /** Function to manually refetch the user. */ refetch: () => void; } /** * Result of the `useUser` hook when an error occurred. */ export declare interface UseUserErrorResult extends UseUserBaseResult { data: undefined; error: Error; isError: true; isSuccess: false; isLoading: false; isPending: false; } /** * Result of the `useUser` hook while loading. */ export declare interface UseUserLoadingResult extends UseUserBaseResult { data: undefined; error: null; isError: false; isSuccess: false; isLoading: true; isPending: true; } /** * Options for the `useUser` and `useUsers` hooks. */ export declare interface UseUserOptions { /** * Set this to `false` to disable this query from automatically running. Default: `true`. */ enabled?: boolean; /** * The time in milliseconds after which data is considered stale. * Default: `300000` (5 minutes). */ staleTime?: number; /** * The organizational level type to use for the IAM API. * Default: `"environment"`. */ levelType?: string; /** * The organizational level ID to use for the IAM API. * By default, auto-detected via `getEnvironmentId()`. */ levelId?: string; } /** * Discriminated union of all possible `useUser` result states. */ export declare type UseUserResult = UseUserSuccessResult | UseUserErrorResult | UseUserLoadingResult; /** * React hook for fetching multiple users by their UUIDs. * * Internally batches all UUID lookups into chunked bulk POST requests * to the IAM API (≤100 UUIDs per chunk), with per-UUID caching. * * @param uuids - Array of user UUIDs to fetch. * @param options - Additional options for the hook. * @returns Aggregated result with a Map of UUID→user data and loading states. * * @example * const { data, users, isLoading } = useUsers(['uuid-1', 'uuid-2', 'uuid-3']); */ export declare function useUsers(uuids: string[], options?: UseUsersOptions): UseUsersResult; /** * Configuration for the `UseUsersProvider` context. */ export declare interface UseUsersConfig { /** Organizational level type. Default: `"environment"`. */ levelType?: string; /** Organizational level ID. Default: auto-detected via `getEnvironmentId()`. */ levelId?: string; /** * @private * Custom TanStack Query client for caching and state management. */ queryClient?: QueryClient; } /** * Options for the `useUsers` hook. */ export declare type UseUsersOptions = UseUserOptions; /** * Provider component for configuring the `useUser` and `useUsers` hooks. * * @example * * * */ export declare function UseUsersProvider(props: PropsWithChildren): ReactElement>; /** * Aggregated result of the `useUsers` hook. */ export declare interface UseUsersResult { /** Map of UUID → user data for all successfully resolved users. */ data: Map; /** Flat array of all successfully resolved users. */ users: RestUserPublic[]; /** `true` if any query is still loading for the first time. */ isLoading: boolean; /** `true` if all queries have finished successfully. */ isSuccess: boolean; /** `true` if any query resulted in an error. */ isError: boolean; /** `true` if any query is currently fetching (including background refetches). */ isFetching: boolean; /** Map of UUID → error for all failed queries. */ errors: Map; /** Function to manually refetch all users. */ refetch: () => void; } /** * Result of the `useUser` hook when the user was successfully fetched. */ export declare interface UseUserSuccessResult extends UseUserBaseResult { data: RestUserPublic | null; error: null; isSuccess: true; isError: false; isLoading: false; isPending: false; } export { }