Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function t() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [1, 2, 3],
_ref2 = _slicedToArray(_ref, 3),
a = _ref2._ES5ProxyType ? _ref2.get(2) : _ref2[2];
return a;
} // babel-plugin-transform-es2015-shorthand-properties
// https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-es2015-shorthand-properties/test/fixtures/shorthand-properties/method-plain/actual.js
value: function defaultTimeDimensionNameFor(memberName) {
var _this2 = this;
var _memberName$split3 = memberName.split('.'),
_memberName$split4 = _slicedToArray(_memberName$split3, 1),
cube = _memberName$split4[0];
if (!this.cubesMap[cube]) {
return null;
}
return Object.keys(this.cubesMap[cube].dimensions || {}).find(function (d) {
return _this2.cubesMap[cube].dimensions[d].type === 'time';
});
}
}, {
value: function resolveMember(memberName, memberType) {
var _this = this;
var _memberName$split = memberName.split('.'),
_memberName$split2 = _slicedToArray(_memberName$split, 1),
cube = _memberName$split2[0];
if (!this.cubesMap[cube]) {
return {
title: memberName,
error: "Cube not found ".concat(cube, " for path '").concat(memberName, "'")
};
}
var memberTypes = Array.isArray(memberType) ? memberType : [memberType];
var member = memberTypes.map(function (type) {
return _this.cubesMap[cube][type] && _this.cubesMap[cube][type][memberName];
}).find(function (m) {
return m;
});
return yValuesArray.map(function (_ref21) {
var _ref22 = _slicedToArray(_ref21, 2),
yValues = _ref22[0],
m = _ref22[1];
return normalizedPivotConfig.x.map(valueToObject(xValues, m)).concat(normalizedPivotConfig.y.map(valueToObject(yValues, m))).reduce(function (a, b) {
return Object.assign(a, b);
}, {});
}).reduce(function (a, b) {
return Object.assign(a, b);
}, yValuesArray.map(function (_ref16) {
var _ref17 = _slicedToArray(_ref16, 2),
yValues = _ref17[0],
m = _ref17[1];
return _defineProperty({}, _this3.axisValuesString(yValues, ', '), m && Number.parseFloat(m));
}).reduce(function (a, b) {
return Object.assign(a, b);
filters: []
});
return _objectSpread({}, newState, {
query: newQuery,
sessionGranularity: null
});
}
return newState;
}
if (newState.chartType) {
var newChartType = newState.chartType;
if ((newChartType === 'line' || newChartType === 'area') && (query.timeDimensions || []).length === 1 && !query.timeDimensions[0].granularity) {
var _query$timeDimensions = _slicedToArray(query.timeDimensions, 1),
td = _query$timeDimensions[0];
return _objectSpread({}, newState, {
query: _objectSpread({}, query, {
timeDimensions: [_objectSpread({}, td, {
granularity: defaultGranularity
})]
})
});
}
if ((newChartType === 'pie' || newChartType === 'table' || newChartType === 'number') && (query.timeDimensions || []).length === 1 && query.timeDimensions[0].granularity) {
var _query$timeDimensions2 = _slicedToArray(query.timeDimensions, 1),
_td = _query$timeDimensions2[0];
return _objectSpread({}, newState, {
var useCubeQuery = (function (query) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _useState = useState({}),
_useState2 = _slicedToArray(_useState, 1),
mutexObj = _useState2[0];
var _useState3 = useState(null),
_useState4 = _slicedToArray(_useState3, 2),
currentQuery = _useState4[0],
setCurrentQuery = _useState4[1];
var _useState5 = useState(false),
_useState6 = _slicedToArray(_useState5, 2),
isLoading = _useState6[0],
setLoading = _useState6[1];
var _useState7 = useState(null),
_useState8 = _slicedToArray(_useState7, 2),
resultSet = _useState8[0],
setResultSet = _useState8[1];
var resultPromises = Promise.all(toPairs(queries).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
name = _ref4[0],
query = _ref4[1];
return cubejsApi.load(query, {
mutexObj: _this3.mutexObj,
mutexKey: name
}).then(function (r) {
return [name, r];
});
}));
resultPromises.then(function (resultSet) {
if ((newChartType === 'line' || newChartType === 'area') && (query.timeDimensions || []).length === 1 && !query.timeDimensions[0].granularity) {
var _query$timeDimensions = _slicedToArray(query.timeDimensions, 1),
td = _query$timeDimensions[0];
return _objectSpread({}, newState, {
query: _objectSpread({}, query, {
timeDimensions: [_objectSpread({}, td, {
granularity: defaultGranularity
})]
})
});
}
if ((newChartType === 'pie' || newChartType === 'table' || newChartType === 'number') && (query.timeDimensions || []).length === 1 && query.timeDimensions[0].granularity) {
var _query$timeDimensions2 = _slicedToArray(query.timeDimensions, 1),
_td = _query$timeDimensions2[0];
return _objectSpread({}, newState, {
query: _objectSpread({}, query, {
timeDimensions: [_objectSpread({}, _td, {
granularity: undefined
})]
})
});
}
}
return newState;
}
}, {
resultPromises = Promise.all(toPairs(queries).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
name = _ref2[0],
query = _ref2[1];
return _this.cubejsApi.load(query, {
mutexObj: _this.mutexObj,
mutexKey: name
}).then(function (r) {
return [name, r];
});
}));
_context3.t0 = fromPairs;