From 292ef148d58169edd6a4cb20df4cc28fbdc70761 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 25 Oct 2017 11:22:38 +0200 Subject: [PATCH] adapt changes for the new 12.34.10 Qlik Engine release add documentation Signed-off-by: Konrad Mattheis --- types/qlik-engineapi/index.d.ts | 481 ++++++++++++++++++++++++++++++-- 1 file changed, 464 insertions(+), 17 deletions(-) diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 57066c4e94..fa7d79db05 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -1,5 +1,5 @@ -// Type definitions for qlik-engineapi 12.20 -// Project: http://help.qlik.com/en-US/sense-developer/June2017/Subsystems/EngineAPI/Content/introducing-engine-API.htm +// Type definitions for qlik-engineapi 12.34 +// Project: http://help.qlik.com/en-US/sense-developer/September2017/Subsystems/EngineAPI/Content/introducing-engine-API.htm // Definitions by: Konrad Mattheis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,6 +10,20 @@ declare namespace EngineAPI { type FieldAttributesType = "U" | "A" | "I" | "R" | "F" | "M" | "D" | "T" | "TS" | "IV"; type FileDataFormatType = "CSV" | "FIX" | "DIF" | "EXCEL_BIFF" | "EXCEL_OOXML" | "HTML" | "XML" | "QVX" | "JSON" | "KML"; type TableRecordKeyType = "NOT_KEY" | "ANY_KEY" | "PRIMARY_KEY" | "PERFECT_KEY"; + + /** + * One of: + * - Cleared: In this mode, the first step is to clear any current selections in the app. + * The second step is to search for one or more terms in the values of the app. + * - LockedFieldsOnly: In this mode, the search applies only to the values associated with + * the selections made in locked fields, ignoring selections in any unlocked field. + * If no locked fields, the behavior is identical to the Cleared context. + * You cannot make any new selections in a locked field. You can get search hits for + * the associated values of a locked field but you cannot get the search hits for the non associative values. + * - CurrentSelections: In this mode, the current selections are kept (if any). Search for one or more terms in the values of the app. + * New selections are made on top of the current selections. If no selections were made before the search, + * this mode is identical to the Cleared context. + */ type ContextType = "Cleared" | "LockedFieldsOnly" | "CurrentSelections"; type SearchObjectsGroupType = "DatasetType" | "GenericObjectsType"; type SearchObjectsItemType = "0" | "1"; @@ -27,19 +41,114 @@ declare namespace EngineAPI { type OtherLimitModeType = "OTHER_GE_LIMIT" | "OTHER_LE_LIMIT" | "OTHER_GT_LIMIT" | "OTHER_LT_LIMIT"; type OtherSortModeType = "OTHER_SORT_DEFAULT" | "OTHER_SORT_DESCENDING" | "OTHER_SORT_ASCENDING"; type TotalModeType = "TOTAL_OFF" | "TOTAL_EXPR"; + type BnfType = "S" | "E"; + /** + * One of: + * - N for NOT_META + * - D for META_DOC_NAME + * - R for META_RET_TYPE + */ type MTType = "N" | "D" | "R"; + + /** + * One of: + * - CONNECT_DEFAULT: used internally + * - CONNECT_64 + * - CONNECT_32 + */ type MachineModeType = "CONNECT_DEFAULT" | "CONNECT_64" | "CONNECT_32"; + + /** + * One of: + * - IT_SCRIPTLINE; the engine returns the statement that will be executed next. + * - IT_MSGBOX; the engine returns a script execution error message. This type can only be returned if the parameter qInteractOnError was set to true when calling the ConfigureReload method. + * - IT_BREAK; the engine breaks and waits for a response on what to do next. + * - IT_END; the engine has finished to execute all statements in the script. + */ type InteractionType = "IT_SCRIPTLINE" | "IT_MSGBOX" | "IT_BREAK" | "IT_END"; + type ErrorDataCodeType = "0" | "1" | "2"; + + /** + * One of: + * - ALL for FUNC_GROUP_ALL, + * - U for FUNC_GROUP_UNKNOWN, + * - NONE for FUNC_GROUP_NONE, + * - AGGR for FUNC_GROUP_AGGR, + * - NUM for FUNC_GROUP_NUMERIC, + * - RNG for FUNC_GROUP_RANGE, + * - EXP for FUNC_GROUP_EXPONENTIAL_AND_LOGARITHMIC, + * - TRIG for FUNC_GROUP_TRIGONOMETRIC_AND_HYPERBOLIC, + * - FIN for FUNC_GROUP_FINANCIAL, + * - MATH for FUNC_GROUP_MATH_CONSTANT_AND_PARAM_FREE, + * - COUNT for FUNC_GROUP_COUNTER, + * - STR for FUNC_GROUP_STRING, + * - MAPP for FUNC_GROUP_MAPPING, + * - RCRD for FUNC_GROUP_INTER_RECORD, + * - CND for FUNC_GROUP_CONDITIONAL, + * - LOG for FUNC_GROUP_LOGICAL, + * - NULL for FUNC_GROUP_NULL, + * - SYS for FUNC_GROUP_SYSTEM, + * - FILE for FUNC_GROUP_FILE, + * - TBL for FUNC_GROUP_TABLE, + * - DATE for FUNC_GROUP_DATE_AND_TIME, + * - NUMI for FUNC_GROUP_NUMBER_INTERPRET, + * - FRMT for FUNC_GROUP_FORMATTING, + * - CLR for FUNC_GROUP_COLOR, + * - RNK for FUNC_GROUP_RANKING + * - GEO for FUNC_GROUP_GEO + * - EXT for FUNC_GROUP_EXTERNAL + */ type FunctionGroupType = "ALL" | "U" | "NONE" | "AGGR" | "NUM" | "RNG" | "EXP" | "TRIG" | "FIN" | "MATH" | "COUNT" | "STR" | "MAPP" | "RCRD" | "CND" | "LOG" | "NULL" | "SYS" | "FILE" | "TBL" | "DATE" | "NUMI" | "FRMT" | "CLR" | "RNK" | "GEO" | "EXT"; + type DimensionType = "D" | "N" | "T"; - type NxHypercubeMode = "P" | "K" | "S" | string; + + /** + * One of: + * - S for DATA_MODE_STRAIGHT; straight table representation + * - P for DATA_MODE_PIVOT; pivot table representation + * - K for DATA_MODE_PIVOT_STACK; stacked table representation + * - T for DATA_MODE_TREE; tree representation + */ + type NxHypercubeMode = "S" | "P" | "K" | "T"; + + /** + * One of: + * - NX_FREQUENCY_NONE + * - NX_FREQUENCY_VALUE + * - NX_FREQUENCY_PERCENT. The percentage is between 0 and 100. + * - NX_FREQUENCY_RELATIVE. Same as percent except that the relative value is between 0 and 1. + */ type FrequencyModeType = "NX_FREQUENCY_NONE" | "NX_FREQUENCY_VALUE" | "NX_FREQUENCY_PERCENT" | "NX_FREQUENCY_RELATIVE"; + type TypeSortDirection = "1" | "-1" | "0"; + + /** + * Type of the drive. Can be: + * - REMOVABLE + * - FIXED + * - NETWORK + * - CD_ROM + * - RAM + * - UNKNOWN_TYPE + */ type DriveType = "REMOVABLE" | "FIXED" | "NETWORK" | "CD_ROM" | "RAM" | "UNKNOWN_TYPE"; + /** + * One of: + * - V for NX_DIM_CELL_VALUE. Applies to values in the data matrix. + * - E for NX_DIM_CELL_EMPTY. Applies to empty cells in the top and left dimensions. + * - G for NX_DIM_CELL_GENERATED. Applies to generated nodes that are inserted into the returned tree when there is no actual value (qAllValues in NxPageTreeNode set to true). + * - N for NX_DIM_CELL_NORMAL. Applies to left and top dimensions cells. + * - T for NX_DIM_CELL_TOTAL. Applies to cells marked with Total. + * - P for NX_DIM_CELL_PSEUDO. Applies to pseudo dimensions. + * - R for NX_DIM_CELL_ROOT. Applies to root node. + * - U for NX_DIM_CELL_NULL. Applies to Null values in the data matrix. + */ + type NxTreeNodeType = "V" | "E" | "G" | "N" | "T" | "P" | "R" | "U"; + /** * NxRange... */ @@ -420,6 +529,9 @@ declare namespace EngineAPI { */ qThou: string; + /** + * + */ qSAFEARRAY: any[]; } @@ -1033,7 +1145,7 @@ declare namespace EngineAPI { /** * String that marks the beginning of the comment line. - * Example: # or // + * Example: �#� or �//� * The engine ignores the commented lines during the data load. * This property is only used for delimited files. */ @@ -2132,11 +2244,11 @@ declare namespace EngineAPI { * For example, if the user requests SearchObjects with SearchObjectOptions.qAttributes = [], * then the outputted qAttributes will be empty. * - * Otherwise, if SearchObjectOptions.qAttributes = [qProperty], - * SearchGroupItemMatch.qAttributes = [qProperty, qMetaDef/title] + * Otherwise, if SearchObjectOptions.qAttributes = [�qProperty�], + * SearchGroupItemMatch.qAttributes = [�qProperty�, qMetaDef/title�] * if the match has been found in the title of the item. * - * For dimension values, the returned qProperty will be *. + * For dimension values, the returned �qProperty� will be �*�. */ qAttributes: ISearchAttribute[]; @@ -2314,8 +2426,7 @@ declare namespace EngineAPI { * @param qExpr - Expression value. It is not possible to use all aggregation functions. * For example, you cannot add a field on the fly with an expression that uses the Sum or Count aggregation functions. * @returns - true or false - */ - addFieldFromExpression(qName: string, qExpr: string): Promise; + */ addFieldFromExpression(qName: string, qExpr: string): Promise; /** * Applies a bookmark. @@ -2332,7 +2443,7 @@ declare namespace EngineAPI { /** * Loads the last logical operation (if any). - * @returns - "{}" + * @returns" */ back(): Promise; @@ -2675,10 +2786,18 @@ declare namespace EngineAPI { * Evaluates an expression as a dual. * Script-defined variables cannot be removed using the DestroyVariableById method or the DestroyVariableByName method. * @param qExpression - Expression to evaluate. - * @returns - return a Promise width a FieldValue + * @returns - return a Promise with a FieldValue */ evaluateEx(qExpression: string): Promise; + /** + * Export an Qlik QVF with a reduced datamodel + * @param qOptions - qBookmarkId - bookmark to export + * qExpires - download expires in [s] + * @returns - return a Promise with the qDownloadInfo + */ + exportReducedData(qOptions?: { qBookmarkId?: string, qExpires?: number}): Promise<{ qDownloadInfo: any }>; + /** * Retrieves any fields that belong to the same archipelago as the specified field and * that match at least one of the specified tags. @@ -2937,6 +3056,12 @@ declare namespace EngineAPI { */ getLibraryContent(qName: string): Promise; + /** + * Returns the lineage of the datamodel. + * @returns - return a Promise of qLineage. + */ + getLineage(): Promise<{ qLineage: Array<{ qDiscriminator: string }> }>; + /** * Retrieves locale information. * @returns - return a Promise of LocaleInfo. @@ -3050,6 +3175,7 @@ declare namespace EngineAPI { * - the list of key fields * * @param qWindowSize - Defines the size of the window that is used to display the results. + * @param qNullSize - (no infos in help) * @param qCellHeight - Height of a cell in a table in pixels. * @param qSyntheticMode One of: * - true for internal table viewer @@ -3134,6 +3260,22 @@ declare namespace EngineAPI { */ lockAll(qStateName: string): Promise; + /** + * migrateDerivedFields. + * + * Note: from shema file + * @returns - A promise of a Qlik engine reply. + */ + migrateDerivedFields(): Promise; + + /** + * migrateDerivedFields. + * + * Note: from shema file + * @returns - A promise of a Qlik engine reply. + */ + migrateVariables(): Promise; + /** * Updates a connection. * @@ -3202,6 +3344,14 @@ declare namespace EngineAPI { */ saveObjects(): Promise; + /** + * Scramble a field in the qlik datamodel. + * + * @param qFieldName - Fieldname + * @returns - A promise of a Qlik engine reply. + */ + scramble(qFieldName: string): Promise; + /** * Returns the search matches for one or more search terms. * The search results depend on the search context. @@ -3220,8 +3370,8 @@ declare namespace EngineAPI { /** * Returns the generic objects corresponding to one or more search terms. The search is performed within the title, * subtitle, footnote and type. In addition, associated dimension values are also searched in. For example, - * if the country Japan is selected and the object contains the dimension City, the object will appear in the - * results for Osaka but not for Johannesburg. The generic objects with the following types will never appear + * if the country �Japan� is selected and the object contains the dimension City, the object will appear in the + * results for �Osaka� but not for �Johannesburg�. The generic objects with the following types will never appear * in the results: slideitem, sheet, story, slide, masterobject, snapshot, LoadModel, appprops and searchhistory. * @param qOptions - Information about the search fields and the search context. * @param qTerms - List of terms to search for. @@ -3359,7 +3509,6 @@ declare namespace EngineAPI { * Undoes the previous operation. * * Note: The operation is successful if qSuccess is set to true. - * @param qScript - Script content * @returns - A promise true or false */ undo(): Promise; @@ -3785,6 +3934,17 @@ declare namespace EngineAPI { */ applyPatches(qPatches: INxPatch[]): Promise; + /** + * Get the selected values in the bookmark for a specific field. + * + * Note: from shema file + * @param qField - Name of the field + * @param qGetExcludedValues - Get Excluded Values + * @param qDataPage - Start and End of DataPage + * @returns - A promise of Array of FieldValues. + */ + getFieldValues(qField: string, qGetExcludedValues: boolean, qDataPage: {"qStartIndex": number, "qEndIndex": number}): Promise<{qFieldValues: IFieldValue[]}>; + /** * Returns: * @@ -4781,13 +4941,134 @@ declare namespace EngineAPI { * Row index to select * Indexing starts from 0. * If the cell's type is: - * D, the index is based on the data matrix. - * T, the index is based on the top dimensions indexes - * L, the index is based on the data matrix + * - D, the index is based on the data matrix. + * - T, the index is based on the top dimensions indexes + * - L, the index is based on the data matrix */ qRow: number; } + interface INxTreeDataOption { + /** + * Maximum number of nodes in the tree. If this limit is exceeded, no nodes are returned. All nodes are counted. + */ + MaxNbrOfNodes: number; + + /** + * Defines areas of the tree to be fetched. Areas must be defined left to right. + */ + TreeNodes: INxPageTreeNode[]; + + /** + * Filters out complete dimensions from the fetched tree. + */ + TreeLevels: INxPageTreeLevel; + } + + interface INxPageTreeNode { + /** + * The area of the tree to be fetched. If no area is defined on a dimension, all existing nodes are included. + */ + qArea: IRect; + + /** + * When set to true, generated nodes (based on current selection) will be inserted into the returned tree even when + * there is no actual value. For example, suppose you are looking for hybrid car sales at all car dealerships. + * Normally, only dealerships where hybrid cars are sold would be part of the returned tree but with qAllValues set to true, + * all available dealerships will be included regardless if they sold any hybrid cars or not. + */ + qAllValues: boolean; + } + + interface INxPageTreeLevel { + /** + * The first dimension that is to be part of the tree, counted from the left. + * For example, if qLeft is equal to 1, omit nodes from the first dimension in the current sort order. + */ + qLeft: number; + + /** + * Number of dimensions to include in the tree. + */ + qDepth: number; + } + + interface INxTreeNode { + /** + * The text version of the value, if available. + */ + qText: string; + + /** + * Element number + */ + qElemNo: number; + + /** + * Row index in the data matrix. + * The indexing starts from 0. + */ + qRow: number; + + /** + * A generated number applicable to this page only. Used so that children can easily identify who their parents are. + */ + qNodeNr: number; + + /** + * The qNodeNr of this node's parent for the current page. + */ + qParentNode: number; + + /** + * Type of the cell. + */ + qType: NxTreeNodeType; + + /** + * The measures for this node. + */ + qValues: INxTreeValue; + + /** + * The children of this node in the tree structure. + */ + qNodes: INxTreeNode; + + /** + * Attribute expression values. + */ + qAttrExps?: INxAttributeExpressionValues; + + /** + * Attribute dimension values. + */ + qAttrDims?: INxAttributeDimValues; + } + + interface INxTreeValue { + /** + * The text version of the value, if available. + */ + qText: string; + + /** + * Value of the cell. + * Is set to NaN, if the value is not a number. + */ + qValue: number; + + /** + * Attribute expression values. + */ + qAttrExps?: INxAttributeExpressionValues; + + /** + * Attribute dimension values. + */ + qAttrDims?: INxAttributeDimValues; + } + /** * ImplementOn... */ @@ -5276,6 +5557,15 @@ declare namespace EngineAPI { */ getHyperCubeStackData(qPath: string, qPages: INxPage[], qMaxNbrCells?: number): Promise; + /** + * Retrieves the values of a stacked pivot table. It is possible to retrieve specific pages of data. + * @param qPath - Path to the definition of the object to be selected. + * For example, /qHyperCubeDef. + * @param qNodeOptions - Specifies all the paging filters needed to define the tree to be fetched. + * @returns - A data set Array of NxTreeNode. + */ + getHyperCubeTreeData(qPath: string, qNodeOptions: INxTreeDataOption[]): Promise; + /** * Returns the type and identifier of the object. * @returns - A Promise of NxInfo. @@ -5716,6 +6006,49 @@ declare namespace EngineAPI { qActiveExpression: number; } + interface IGenericDerivedFieldProperties extends IGenericProperties { + } + + interface IGenericDerivedFields extends IImplementOn { + /** + * Shows the properties of an object. + * Returns the identifier and the definition of the derived field. + * + * @returns - A Promise IGenericDerivedFieldProperties + */ + getProperties(): Promise; + + /** + * @returns qInfo + */ + getInfo(): Promise; + + /** + * @returns qData + */ + getDerivedFieldData(): Promise; + + /** + * @returns qField + */ + getDerivedField(qId: string): Promise; + + /** + * @returns qListData + */ + getListData(): Promise; + + /** + * @returns qFields + */ + getDerivedFields(): Promise; + + /** + * @returns qGroups + */ + getDerivedGroups(): Promise; + } + /** * This class describes all the methods that apply at measure level. * The handle member in the JSON request for all methods listed in this section is the handle of the measure. @@ -6545,6 +6878,46 @@ declare namespace EngineAPI { qSignature: string; } + interface IQOptions { + qBookmarkId: string; + + qExpires: number; + } + + interface IQDownloadInfo { + } + + interface IQVersion { + qVersion: { + qComponentVersion: string; + }; + } + + interface IQConfig { + qFeatures: { + qIsDesktop: boolean; + qSSOEnabled: boolean; + }; + + qServices: Array<{ + /** + * Name of the Service + */ + qName: string; + /** + * URL of the Service + */ + qUrl: string; + }>; + + qSystemProperties: { + /** + * Path Separator for the OS + */ + qPathSeparator: string; + }; + } + /** * This class describes all the methods that apply at global level. * The handle member in the JSON request for all methods listed in this section is -1. @@ -6557,6 +6930,15 @@ declare namespace EngineAPI { */ abortAll(): Promise; + /** + * Aborts a specific request + * @param qRequestId - Identifier of the request to stop. + */ + abortRequest(qRequestId: number): Promise; + + /** + * + */ allowCreateApp(): Promise; /** @@ -6690,6 +7072,12 @@ declare namespace EngineAPI { */ deleteApp(qAppId: string): Promise; + /** + * Get the current EngineVersion + * @returns - qVersion + */ + engineVersion(): Promise; + /** * Exports an app from the Qlik Sense repository to the file system. * @@ -6706,6 +7094,14 @@ declare namespace EngineAPI { */ exportApp(qTargetPath: string, qSrcAppId: string, qIds: string[]): Promise; + /** + * Reduce an app in the memory to the current selection of a specified bookmark + * and make it as http download available. + * @params - optional qOptions + * @returns - A Promise of qDownloadInfo + */ + exportReducedData(qOptions?: IQOptions): Promise; + /** * Returns the handle of the current app. * @@ -6779,6 +7175,12 @@ declare namespace EngineAPI { */ getBaseBNFHash(qBnfType: BnfType): Promise<{ qBnfHash: string }>; + /** + * Get a Config Object + * @returns A Promise qConfig + */ + getConfiguration(): Promise; + /** * List the custom connectors available in the system. * @param qReloadList Sets if the list of custom connectors should be reloaded or not. @@ -6867,6 +7269,12 @@ declare namespace EngineAPI { */ getLogicalDriveStrings(): Promise; + /** + * Gets the MyDocumenstFolder Path in the system. + * @returns A Promise of the MyDocumenstFolder Path + */ + getMyDocumentsFolder(): Promise<{ qFolder: string; }>; + /** * Returns the list of the ODBC connectors that are installed in the system. * @returns A Promise Array of OdbcDsn @@ -6914,6 +7322,27 @@ declare namespace EngineAPI { */ getUniqueID(): Promise; + /** + * Import an App + * @param qAppId - new AppId + * @param qSrcPath - source path + * @param qIds - ??? + * Note: from shema file + * Note: This operation is possible only in Qlik Sense Enterprise. + */ + importApp(qAppId: string, qSrcPath: string, qIds: string[]): Promise; + + /** + * Import an App Extended + * @param qAppId - new AppId + * @param qSrcPath - source path + * @param qIds - ??? + * @param qExcludeConnections - true to exclude the embedded connection from import + * Note: from shema file + * Note: This operation is possible only in Qlik Sense Enterprise. + */ + importAppEx(qAppId: string, qSrcPath: string, qIds: string[], qExcludeConnections: boolean): Promise; + /** * Informs the engine that a user interaction (which was earlier requested by the engine) * was performed and indicates the engine what to do next. @@ -6992,6 +7421,15 @@ declare namespace EngineAPI { */ productVersion(): Promise; + /** + * Publish an App to a Stream + * @param qStreamId - Id of the stream there it should published + * @param qName - new name + * Note: from shema file + * Note: This operation is possible only in Qlik Sense Enterprise. + */ + publishApp(qStreamId: string, qName: string): Promise; + /** * Returns the Qlik product name. */ @@ -7707,8 +8145,14 @@ declare namespace EngineAPI { */ qAttributeDimensions?: INxAttrDimDef[]; + /** + * + */ qIncludeElemValue?: boolean; // ?Nicht in Doku + /** + * + */ qShowTotal?: boolean; // ?Nicht in Doku } @@ -7775,6 +8219,9 @@ declare namespace EngineAPI { */ qExpression?: IValueExpr; + /** + * + */ qSortByGreyness?: TypeSortDirection; // ?Nicht in Doku }