UNPKG

@sassoftware/vi-api

Version:
77 lines (76 loc) 2.93 kB
export interface QueryBuilderItem { booleanValue?: boolean | string; boost?: number; dateTimeValue?: string | Date; dateValue?: string | Date; exclude?: boolean; field?: string; fromDateTimeValue?: string | Date; fromDateValue?: string | Date; fromNumericValue?: number; numericValue?: number; operator?: string; phonetic?: boolean; previousField?: string; proximity?: number; rangeValidationError?: boolean; referenceValue?: string; relationshipField?: boolean; relationshipTypeValue?: string; relativeDateDatetimeNumericValue?: number; relativeDateDatetimeUnitsValue?: string; stringValidationError?: boolean; synonym?: boolean; textValue?: string; toDateTimeValue?: string | Date; toDateValue?: string | Date; toNumericValue?: number; userGroupValue?: Array<{ id: string; type: string; }>; } export interface QueryBuilderEntityModel { entity: string; queries: QueryBuilderItem[]; singleChildSearch?: boolean; } export interface QueryBuilderModel { manualQueryString?: string; model: QueryBuilderEntityModel[]; } export interface QueryBuilderResult { queryString: string; queryModel: QueryBuilderModel; } /** * This API relates to SAS Visual Investigator's search functionality. * * Accessed from the window at `window.sas.vi.search`. * * @example window.sas.vi.search.openQueryBuilderDialog("Dialog Title"); * @category API */ export interface SearchApi { /** * @method * @description Opens the query builder dialog box allowing the user to create a new query or edit an existing one passed in via the * query model parameter. * @param dialogTitle {string} Title of the dialog. * @param [submitButtonText] {string} Text for the dialog box submit button. * @param [queryModel] {QueryBuilderModel} An existing query model that can be used to initially populate the query builder. * @param [enforceObjectType] {string} If enforceObjectType is set, the user cannot choose which entity to query. It is pre-set to the specified entity. * @param [restrictObjectTypes] {Array<string>} If restrictObjectTypes is set, then the entity dropdown is filtered to show only the entities in this list. * @returns A Promise containing the result of the dialog box. * @example * const searchApi: SearchApi = window.sas.vi.search; * const dialogTitle = 'Intelligence Search' * const submitButtonText = 'Submit' * const objectType = 'intel' * * searchApi.openQueryBuilderDialog(dialogTitle, submitButtonText, undefined, objectType).then( (query) => { * // Perform query action * }) */ openQueryBuilderDialog(dialogTitle: string, submitButtonText?: string, queryModel?: QueryBuilderModel, enforceObjectType?: string, restrictObjectTypes?: string[]): Promise<QueryBuilderResult>; }