import type { BindingType } from './DashboardJSON'; import type { JSONCols } from './Data'; export type JobStatus = 'queued' | 'parsing' | 'running' | 'pause' | 'finalizing' | 'failed' | 'stopped' | 'done' | 'canceled' | 'refreshing'; export type DSStatusEnum = { [P in Uppercase]: Lowercase

; }; export interface SearchCountsInfo { total: number; running: number; completed: number; realTimeRunning: number; } export interface DataSourceMeta { isRealTimeSearch?: boolean; lastUpdated?: string; percentComplete?: number; sid?: string; statusMessage?: string; status?: JobStatus; totalCount?: number; search?: string; checkRiskyCommand?: boolean; completeSearchQuery?: string; missedTokens?: string[]; serverLog?: { level?: string; message?: string; }[]; isSPl2Search?: boolean; [key: string]: unknown; } export type Status = JobStatus; export type Meta = DataSourceMeta; export interface RequestParams { count?: number; offset?: number; search?: string; sort?: { [field: string]: 'none' | 'desc' | 'asc'; }; source?: 'results_preview' | 'results' | 'events' | 'summary' | 'timeline'; requireTotalCount?: boolean; progress?: boolean; field?: string; format?: string; show_metadata?: boolean; segmentation?: 'full' | 'none' | 'inner' | 'outer'; output_mode?: 'json' | 'json_cols'; view?: string; namespace?: string; [key: string]: unknown; } export type DeriveRequestParamsFn = (itemOptions: Record, config: { featureFlags: Record; [key: string]: unknown; }) => RequestParams; export type ErrorLevel = 'info' | 'warning' | 'error'; export interface SearchError { level?: ErrorLevel; message: string; } export interface SearchData { error?: SearchError; data?: JSONCols; meta?: DataSourceMeta; requestParams?: RequestParams; } export type RefreshFunction = (options?: { checkRiskyCommand?: boolean; }) => Promise; export type OnDataCallback = ({ requestParams, data, meta, }: SearchData) => void; export interface ErrorPayload { level: ErrorLevel; message: string; meta?: DataSourceMeta; } export type OnCancelCallback = (consumerId: string) => void; export type OnCompleteCallback = (consumerId: string) => void; export type OnErrorCallback = ({ level, message, meta }: ErrorPayload) => void; export type OnPauseCallback = (consumerId: string) => void; export type OnStartCallback = (consumerId: string) => void; export type OnResumeCallback = (consumerId: string) => void; export type OnFinalizeCallback = (consumerId: string) => void; /** * Search control enums supported by UDF. * * An additional custom enum value `togglePause` is provided and will toggle a search * between `pause` and `resume` without the caller needing to know the current job status */ export type SearchControlAction = 'togglePause' | 'pause' | 'resume' | 'finalize'; export type SearchControlFunction = (action: SearchControlAction) => Promise; export type LastSubscriptionState = SearchData | ErrorPayload | Record; export interface DataSourceSubscription { cancel: () => void; updateRequestParams: (newRequestParams: RequestParams) => void; refresh: RefreshFunction; control: SearchControlFunction; getPauseStatus: () => boolean; supportsControlActions: (action?: SearchControlAction) => boolean; getInitialCallbacks: () => { onData: OnDataCallback; onError: OnErrorCallback; }; getLastState: () => LastSubscriptionState; } export interface CancelSearchArgs { subscription: DataSourceSubscription; } export interface GetRequestParamsArgs { consumerId: string; dataSourceId: string; } export interface CreateSearchArgs { consumerId: string; dataSourceId: string; initialRequestParams?: RequestParams; onError: OnErrorCallback; onData: OnDataCallback; } export interface UpdateSearchArgs { consumerId: string; dataSourceId: string; subscription: S; initialRequestParams?: RequestParams; } export interface ISearchModule { getRequestParams?: (args: GetRequestParamsArgs) => RequestParams | undefined; cancel: (args: CancelSearchArgs) => void; create: (args: CreateSearchArgs) => Promise; update: (args: UpdateSearchArgs) => Promise; } export interface DataContract { initialRequestParams?: Record; requiredDataSources?: BindingType[]; optionalDataSources?: BindingType[]; } export interface SavedSearchMetadata { app?: string; author?: string; earliestTime?: string | number; isScheduled?: boolean; latestTime?: string | number; nextScheduledTime?: string; savedSearchQuery?: string; sharing?: unknown; updated?: unknown; alertType?: string; alertTrack?: unknown; actions?: string; savedSearchType?: 'alert' | 'report'; } export interface SPL2ViewMetadata { namespace?: string; name?: string; createdBy?: string; updatedAt?: string; updatedBy?: string; displayName?: string; earliestTime?: string; latestTime?: string; isScheduled?: false; } //# sourceMappingURL=Search.d.ts.map