All files / src types.ts

100% Statements 97/97
100% Branches 14/14
100% Functions 7/7
100% Lines 97/97

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185                            5x 5x 5x 5x                                                           5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x                           5x   5x 5x 5x 5x 5x 5x 5x 5x 5x     5x 5x 5x             5x 5x 5x 5x               5x 5x 5x 5x               5x 5x 5x 5x 5x 5x 5x 5x               5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x    
/**
 * Copyright (c) 2020
 *
 * TypeScript type definitions for ThoughtSpot Embed UI SDK
 *
 * @summary Type definitions for Embed SDK
 * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
 */
 
/**
 * The authentication mechanism to be followed
 * for the embedded app
 */
// eslint-disable-next-line no-shadow
export enum AuthType {
    None = 'None',
    SSO = 'SSO',
    AuthServer = 'AuthServer',
}
 
export type DOMSelector = string | HTMLElement;
 
/**
 * The configuration object for embedding, specifying
 * the ThoughtSpot host or IP address, the authentication
 * mechanism and the authentication endpoint if a trusted
 * auth server is being used
 */
export interface EmbedConfig {
    thoughtSpotHost: string;
    authType: AuthType;
    authEndpoint?: string;
}
 
export type MessagePayload = { type: string; data: any };
export type MessageCallback = (payload: MessagePayload) => void;
 
export type GenericCallbackFn = (...args: any[]) => any;
 
export type QueryParams = {
    [key: string]: string;
};
 
/**
 * A map of the supported runtime filter operations
 */
// eslint-disable-next-line no-shadow
export enum RuntimeFilterOp {
    EQ = 'EQ', // equals
    NE = 'NE', // does not equal
    LT = 'LT', // less than
    LE = 'LE', // less than or equal to
    GT = 'GT', // greater than
    GE = 'GE', // greater than or equal to
    CONTAINS = 'CONTAINS', // contains
    BEGINS_WITH = 'BEGINS_WITH', // begins with
    ENDS_WITH = 'ENDS_WITH', // ends with
    BW_INC_MAX = 'BW_INC_MAX', // between inclusive of higher value
    BW_INC_MIN = 'BW_INC_MIN', // between inclusive of lower value
    BW_INC = 'BW_INC', // between inclusive
    BW = 'BW', // between non-inclusive
    IN = 'IN', // is included in this list of values
}
 
export interface RuntimeFilter {
    columnName: string;
    operator: RuntimeFilterOp;
    values: (number | boolean | string)[];
}
 
/**
 * Supported message types for communication between
 * the host app and the embedded app
 */
// eslint-disable-next-line no-shadow
export enum EventType {
    // Events emitted by TS app
    RenderInit = 'renderInit',
    Init = 'init',
    Load = 'load',
    Data = 'data',
    FiltersChanged = 'filtersChanged',
    QueryChanged = 'queryChanged',
    Drilldown = 'drillDown',
    DataSourceSelected = 'dataSourceSelected',
    CustomAction = 'customAction',
 
    // Triggerable events
    Search = 'search',
    Filter = 'filter',
    Reload = 'reload',
}
 
/**
 * Message types supported by the v1 of the ThoughtSpot app
 */
// eslint-disable-next-line no-shadow
export enum EventTypeV1 {
    Alert = 'alert',
    Data = 'data',
    AuthExpire = 'authExpire',
}
 
/**
 * The different visual modes that the data sources panel within
 * search could appear in, i.e., hidden, collapsed or expanded
 */
// eslint-disable-next-line no-shadow
export enum DataSourceVisualMode {
    Hidden = 'hide',
    Collapsed = 'collapse',
    Expanded = 'expand',
}
 
/**
 * The query params passed down to the embedded ThoughtSpot app
 * containing configuration and/or visual info
 */
// eslint-disable-next-line no-shadow
export enum Param {
    DataSources = 'dataSources',
    DataSourceMode = 'dataSourceMode',
    DisableActions = 'disableAction',
    DisableActionReason = 'disableHint',
    SearchQuery = 'searchQuery',
    HideActions = 'hideAction',
    EnableVizTransformations = 'enableVizTransform',
}
 
/**
 * The list of actions that can be performed on visual ThoughtSpot
 * entities, i.e., answers and pinboards
 */
// eslint-disable-next-line no-shadow
export enum Action {
    Save = 'save',
    Update = 'update',
    SaveUntitled = 'saveUntitled',
    SaveAsView = 'saveAsView',
    MakeACopy = 'makeACopy',
    EditACopy = 'editACopy',
    CopyLink = 'embedDocument',
    PinboardSnapshot = 'pinboardSnapshot',
    ResetLayout = 'resetLayout',
    Schedule = 'schedule',
    SchedulesList = 'schedule-list',
    Share = 'share',
    AddFilter = 'addFilter',
    ConfigureFilter = 'configureFilter',
    AddFormula = 'addFormula',
    SearchOnTop = 'searchOnTop',
    SpotIQAnalyze = 'spotIQAnalyze',
    ExplainInsight = 'explainInsight',
    SpotIQFollow = 'spotIQFollow',
    ShareViz = 'shareViz',
    ReplaySearch = 'replaySearch',
    ShowUnderlyingData = 'showUnderlyingData',
    Download = 'download',
    DownloadAsPdf = 'downloadAsPdf',
    DownloadAsCsv = 'downloadAsCSV',
    DownloadAsXlsx = 'downloadAsXLSX',
    DownloadTrace = 'downloadTrace',
    ExportTSL = 'exportTSL',
    ImportTSL = 'importTSL',
    UpdateTSL = 'updateTSL',
    EditTSL = 'editTSL',
    Presentation = 'present',
    ToggleSize = 'toggleSize',
    Edit = 'edit',
    EditTitle = 'editTitle',
    Remove = 'delete',
    Ungroup = 'ungroup',
    Describe = 'describe',
    Relate = 'relate',
    CustomizeHeadlines = 'customizeHeadlines',
    PinboardInfo = 'pinboardInfo',
    SendAnswerFeedback = 'sendFeedback',
    CustomAction = 'customAction',
    DownloadEmbraceQueries = 'downloadEmbraceQueries',
    Pin = 'pin',
    AnalysisInfo = 'analysisInfo',
    Subscription = 'subscription',
    Explore = 'explore',
}