UNPKG

@sassoftware/vi-api

Version:
174 lines (173 loc) 9.06 kB
import { MapBoundedBoxFilter, MapBoundedPolygonFilter, MapRadiusFilter, MapShapeFilter, QueryMode, SearchRepresentation, SearchResponse, SummaryVisualizationResponse } from "../../svi-sand"; import { CreateRelationshipDialogModel, CreateRelationshipDialogResultModel, ObjectIdentifier, SearchOrCreateAndLinkDialogBase } from "../../object/object-api"; import { QueryBuilderModel, SearchApi } from "../search-api"; export declare enum SearchVisualization { Summary = "summary", Map = "map", Table = "table" } export declare enum Visualization { Summary = "summary", Map = "map", Table = "table", Timeline = "timeline", Network = "networkDiagram" } export type MapFilter = MapBoundedPolygonFilter | MapRadiusFilter | MapBoundedBoxFilter | MapShapeFilter; export interface SearchQuery { additionalModes?: string[]; queryText: string; visualizationName?: Visualization; } export interface NetworkData { nodes: Array<{ type: string; id: string; }>; links: Array<{ source: string; target: string; id: string; type: string; }>; options: { showLinkLabels?: boolean; showNodeAnnotation?: boolean; showNodeLabels?: boolean; showTimeline?: boolean; showTransactionDetails?: boolean; showTransactionLinks?: boolean; }; numNodes: number; } export interface SearchAndCreateDialogModel extends CreateRelationshipDialogModel<SearchAndCreateResponse> { } export interface SearchDialogModel extends SearchOrCreateAndLinkDialogBase<SearchDialogResponse> { canCreate?: boolean; } export interface SearchDialogResponse { selectedItem?: SearchObject; } export interface SearchObject extends ObjectIdentifier { title?: string; typeLabel?: string; uniqueKey?: string; } export interface SearchAndCreateRelateToModel extends CreateRelationshipDialogResultModel { relateToTargetId?: string; relateToTargetType?: string; } export interface SearchAndCreateResponse { relateToModel?: SearchAndCreateRelateToModel; } /** * {@link SearchApi} extension pertains to functionality related to SAS Visual Investigator's search capabilities. * These additional methods are available only in the SAS Visual Investigator Investigate and Search interface. * * Accessed from the window at `window.sas.vi.search`. * * @extends SearchApi * @example window.sas.vi.search.navigateSearch("query text", "map"); * @category API */ export interface ClientSearchApi extends SearchApi { /** * @method * @description Performs a search against the svi-sand service. * @param query {SearchRepresentation} Query to send to the service. * @returns A Promise containing the search response. */ performSearch(query: SearchRepresentation): Promise<SearchResponse>; /** * @method * @description Performs a search against the svi-sand service and navigates the user to the Search Results page. * @param queryText {string} Text used to form the query. * @param visualizationName {"summary" | "map" | "table"} Visualization to query for and then display to the user. * @param [mapFilters] {MapFilter[]} The map filter object to include with the search query. This can consist of MapBoundedPolygonFilter, MapRadiusFilter, MapBoundedBoxFilter or MapShapeFilter. * @param [queryMode] {"standard" | "phonetic" | "synonym"} Used to perform phonetic and synonym searches. Default: "standard". */ navigateSearch(queryText: string, visualizationName: SearchVisualization, mapFilters?: MapFilter[], queryMode?: QueryMode[]): Promise<void>; /** * @method * @description Gets the current search query if one exists. Otherwise undefined. */ getCurrentSearchQuery(): SearchQuery | undefined; /** * @method * @description Converts a query model generated by the query builder to a string. * @param queryModel {QueryBuilderModel} Query builder model. * @returns A Promise containing the string representation of the query. */ createQueryStringFromModel(queryModel: QueryBuilderModel): Promise<string>; /** * @method * @description Gets the query builder model for the given ID. If no ID is given, it returns the query model for SEARCH. * @param [id] {string} ID of the model to get. Defaults to SEARCH. * @returns A query builder model. */ getQueryBuilderModel(id?: string): QueryBuilderModel | undefined; /** * @method * @description Sets the query builder model for the given ID. If no ID is given, it sets the query model for SEARCH. * When stored, the query model is used to initially populate a Query Builder opened with the given ID. * @param queryModel {QueryBuilderModel} A query builder model. * @param [id] {string} ID of the model to set. Default: SEARCH. */ setQueryBuilderModel(queryModel: QueryBuilderModel, id?: string): void; /** * @method * @description Opens the "Add Objects to Workspace" dialog box and then performs the action after a document and workspace have been selected. * @param visualizationName {Visualization} Visualization to display after the objects have been added. * @param objects {ObjectIdentifier[]} Objects to add to the workspace. * @param [currentObject] {ObjectIdentifier} The document the user is currently viewing. This is used as a visual aid in the dialog box. * @param [networkData] {NetworkData} Network visualization data to be copied to the workspace. */ openAddObjectsToWorkspaceDialog(visualizationName: Visualization, objects: ObjectIdentifier[], currentObject?: ObjectIdentifier, networkData?: NetworkData): Promise<void>; /** * @method * @description Adds an image to the Insights selected in the "Add image to Insights" dialog. * @param imageData {Uint8Array} Image to add. * @param contentType {string} This is used in the content-type header when the file is uploaded. For example 'image/png'. * @param [height] {string} Height of the Insights cell. * @param [width] {string} Width of the Insights cell. */ openAddImageToInsightsDialog(imageData: Uint8Array, contentType: string, height?: string, width?: string): Promise<void>; /** * @method * @description Creates a new workspace in the target object, populating it with an initial set of objects. * Allows the creation of new objects assuming create mode is supported for the object type. * @param objectsToAdd {ObjectIdentifier[]} Objects to add to the workspace. * @param targetObjectType {string} Object type where the workspace is created. * @param [targetObjectId] {string} Object to add to the workspace. If undefined, a new object is created. * @param [visualization] {"summary" | "map" | "table" | "timeline" | "networkDiagram"} Visualization to initially display in the new workspace. * @param [workspaceName] {string} Name of the new workspace. * @param [networkData] {NetworkData} Network visualization data to be copied to the new workspace. */ addToNewWorkspace(objectsToAdd: ObjectIdentifier[], targetObjectType: string, targetObjectId?: string, visualization?: Visualization, workspaceName?: string, networkData?: NetworkData): Promise<void>; /** * @method * @description Launches a wizard allowing users to search, before creating an object/relationship. * The relationship wizard is determined by the relateToParentLabel or relateToParentName defined in the wizardValues parameter. * @param wizardValues {SearchAndCreateDialogModel} Object containing entity and relationship data. * @returns A Promise which resolves when the dialog box is closed. */ openSearchAndCreateDialog(wizardValues: SearchAndCreateDialogModel): Promise<SearchAndCreateDialogModel>; /** * @method * @description Launches a wizard allowing users to search, before creating an object/relationship. * The relationship wizard is determined by the relateToParentLabel or relateToParentName defined in the wizardValues parameter. * @param wizardValues {SearchDialogModel} Object containing entity and relationship data. * @returns A Promise which resolves when the dialog box is closed. */ openSearchAndCreateDialog(wizardValues: SearchDialogModel): Promise<SearchDialogModel>; /** * @method * @description Gets the selected items within the search result or specified workspace. * @param selectionId {string} The selection ID for the currently selected objects. Default: "SEARCH". * @param maxItems {number} The maximum number of items to get in the selection. Default: 50. * @param textAnalytics {boolean} Boolean value to determine whether the current visualization is Text Analytics. Default: false. */ getSelectedItems(selectionId: string, maxItems: number, textAnalytics: boolean): Promise<{ [index: string]: SummaryVisualizationResponse; } | undefined>; }