import type { FieldActions, EventAction } from '@splunk/visualization-context/EventsContext'; import type { SearchData } from '@splunk/dashboard-types'; import { HighlightedSourceMap } from '../common/interfaces'; type SpecialParameters = { '@offset'?: string; '@sid'?: string; '@namespace'?: string; '@field_name'?: string; '@field_value'?: string; }; export type TokenReplacementMap = { specialParameters: SpecialParameters; fields: Record; }; export declare const EMPTY_DATASOURCE: { primary: { requestParams: { offset: number; count: number; }; data: { fields: any[]; columns: any[]; }; meta: { totalCount: number; }; }; }; export declare const convertToPayloadFormat: (obj: any, initialValue?: {}) => {}; export declare const getFieldSummaryMapping: (columns: any, fields: any) => FieldData; /** * Helper to merge event actions into one array of event actions. * @method mergeEventActions * @param {EventAction[]} eventActions1 * @param {EventAction[]} eventActions2 * @returns {EventAction[]} merged event actions */ export declare const mergeEventActions: (eventActions1: EventAction[], eventActions2: EventAction[]) => EventAction[]; /** * Helper to merge field actions. If same key exists in both field actions, * combine each array of actions under one key. * * Actions under the `default` key should be merged into actions under the `*` key. * Although the `default` key is supported to indicate actions that apply to all fields, * we are working towards deprecating the `default` key in favour of the `*` key. * As of 5.0.0, the react-events-viewer only supports the `*` key to indicate common field actions. * @method mergeFieldActions * @param {FieldActions} fieldActions1 * @param {FieldActions} fieldActions2 * @returns {FieldActions} merged field actions */ export declare const mergeFieldActions: (fieldActions1: FieldActions, fieldActions2: FieldActions) => FieldActions; /** * Helper to replace all tokens from the tokenReplacementMap in text with their corresponding values. * Special parameters will only be escaped if allowSpecialParametersEscape is true. * Field values will only be escaped if allowFieldValuesEscape is true, and the field does not begin with `!`. * https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Prevent-field-value-escape * * @method replaceTokens * @param {string} text * @param {TokenReplacementMap} tokenReplacementMap * @param {boolean} allowSpecialParametersEscape * @param {boolean} allowFieldValuesEscape * @returns {string} text with replaced tokens */ export declare const replaceTokens: ({ text, tokenReplacementMap, allowSpecialParametersEscape, allowFieldValuesEscape, }: { text: string; tokenReplacementMap: TokenReplacementMap; allowSpecialParametersEscape: boolean; allowFieldValuesEscape: boolean; }) => string; /** * Generate a token replacement map taking into account Special Parameters and field replacements. */ export declare const generateTokenReplacementMap: ({ dataSources, rowIndex, pageNumber, field, value, event, }: { dataSources?: Record; rowIndex?: number; pageNumber?: number; field?: string; value?: string; event?: { [fieldName: string]: any; }; }) => TokenReplacementMap; export interface TimeInterval { earliest?: number; latest?: number | 'now'; } export declare const getEpochTime: (time: string) => number; /** * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks a predefined control in the Time Controls Popover * (Before this time/After this time/At this time). If `Before this time` is selected, the time window only includes `latest`, as there is * no `earliest` start time, and adds a 0.001 increment is order to capture all events at `time`. If `After this time` is selected, the * window is from `time` to `now`. If `At this time` is selected, the window starts at `time` (in epoch time) and ends at `time` plus 0.001 * in order to include all events at `time`. * @method getPredefinedTimeInterval * @param {string} time * @param {('before'|'after'|'at')} when * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time */ export declare const getPredefinedTimeInterval: ({ time, when, }: { time: string; when: "before" | "after" | "at"; }) => TimeInterval; /** * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks `Apply` in the Time Controls Popover. * If the `plusminus` type is selected, the window expands either way with the `time` as a midpoint, and amount and interval length * dependent on `rangeAmount` and `rangeUnit`. `plus` indicates starting at `time` and `minus` indicates ending at `time`. * To match sXML behavior, the time interval is converted to epoch time and 0.001 is added to the `latest` time to ensure the * time window is inclusive of the end time. * @method getCustomTimeInterval * @param {string} time * @param {string} rangeType * @param {string} rangeAmount * @param {string} rangeUnit * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time */ export declare const getCustomTimeInterval: ({ time, rangeType, rangeAmount, rangeUnit, }: { time: string; rangeType: string; rangeAmount: string; rangeUnit: string; }) => TimeInterval; /** * Helper to truncate strings to a maximum length. * The string is broken up into the leading characters, followed by ellipsis and the trailing characters. * @method truncateString * @param {string} stringToTruncate * @returns {string} truncated string */ export declare const truncateString: (stringToTruncate: string) => string; export type HighlightValuesByFieldMap = Record; export declare const convertToHighlightValuesByFieldMap: (highlighted: HighlightedSourceMap) => HighlightValuesByFieldMap; export declare const combineHighlighted: (highlightedSource: HighlightedSourceMap, highlightValuesByField: HighlightValuesByFieldMap) => HighlightValuesByFieldMap; export {}; //# sourceMappingURL=EventUtils.d.ts.map