UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

51 lines 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var DataSource_1 = require("@gooddata/gooddata-js/lib/DataLayer/dataSources/DataSource"); /** * * Factory function to create a new instance of IDataSource, which uses executeVisualization API instead of * executeAFM API in order to calculate results for a stored visualization object. * * This functionality is experimental at the moment and is intended for GoodData internal * testing and validation. * * NOTE: counter-intuitively, AFM must be sent as well at the moment because IDataSource interface expose * the effective AFM and there are parts of SDK that rely on this (such as coloring). * * @param sdk instance of gooddata-js to use * @param projectId GD project identifier * @param reference URI of stored visualization * @param afm AFM of the stored visualization * @param filters filters to merge with filters stored in the visualization * @private * @internal */ function _experimentalDataSourceFactory(sdk, projectId, reference, afm, filters) { // We have ONE-3961 as followup to take this out of experimental mode var sdkCopy = sdk.clone(); var execFactory = function (resultSpec) { var visExecution = { visualizationExecution: { reference: reference, filters: filters, resultSpec: resultSpec, }, }; return sdkCopy.execution._executeVisualization(projectId, visExecution); }; var responseFactory = function (resultSpec) { var visExecution = { visualizationExecution: { reference: reference, filters: filters, resultSpec: resultSpec, }, }; return sdkCopy.execution._getVisExecutionResponse(projectId, visExecution); }; var resultFactory = sdkCopy.execution.getPartialExecutionResult; var dataSource = new DataSource_1.DataSource(execFactory, afm, undefined, responseFactory, resultFactory); return Promise.resolve(dataSource); } exports._experimentalDataSourceFactory = _experimentalDataSourceFactory; //# sourceMappingURL=experimentalDataSource.js.map