UNPKG

@gooddata/gooddata-js

Version:
96 lines (95 loc) 2.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getExecutionResponse(numOfDimensions) { if (numOfDimensions === void 0) { numOfDimensions = 2; } var dimension = { headers: [] }; return { dimensions: Array(numOfDimensions).fill(dimension), links: { executionResult: "/gdc/app/projects/myFakeProjectId/executionResults/123?limit=overridden&dimensions=" + numOfDimensions, }, }; } function getExecutionResult() { return { data: [ [11, 12], [51, 52], ], paging: { count: [2, 2], offset: [0, 0], total: [2, 2], }, headerItems: [ [ [ { attributeHeaderItem: { name: "A1", uri: "/gdc/md/obj/attr1", }, }, { attributeHeaderItem: { name: "A2", uri: "/gdc/md/obj/attr2", }, }, ], ], [ [ { measureHeaderItem: { name: "M1", order: 0, }, }, { measureHeaderItem: { name: "M2", order: 0, }, }, ], ], ], }; } var DummyDataSource = /** @class */ (function () { function DummyDataSource(data, resolve) { if (resolve === void 0) { resolve = true; } this.data = data; this.resolve = resolve; this.resultSpec = {}; } DummyDataSource.prototype.getData = function (resultSpec) { this.resultSpec = resultSpec; if (this.resolve) { return Promise.resolve(this.data); } return Promise.reject("DummyDataSource reject"); }; DummyDataSource.prototype.getPage = function (resultSpec, _limit, _offset) { this.resultSpec = resultSpec; if (this.resolve) { return Promise.resolve({ executionResponse: getExecutionResponse(2), executionResult: getExecutionResult(), }); } return Promise.reject("DummyDataSource reject"); }; DummyDataSource.prototype.getFingerprint = function () { return ""; }; DummyDataSource.prototype.getResultSpec = function () { return this.resultSpec; }; DummyDataSource.prototype.getAfm = function () { return {}; }; return DummyDataSource; }()); exports.DummyDataSource = DummyDataSource;