gooddata
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -677,2 +677,3 @@ 'use strict'; | ||
* - restrictiveDefinition {String} | ||
* - afm {Object} | ||
* @return {Object} ValidElements response with: | ||
@@ -688,9 +689,28 @@ * - items {Array} elements | ||
var queryParams = (0, _util.queryString)(query); | ||
var pickedOptions = (0, _lodash.pick)(options, ['uris', 'complement', 'includeTotalCountWithoutFilters', 'restrictiveDefinition']); | ||
var afm = options.afm; | ||
var requestBody = (0, _lodash.pick)(options, ['uris', 'complement', 'includeTotalCountWithoutFilters', 'restrictiveDefinition']); | ||
return (0, _xhr.post)(('/gdc/md/' + projectId + '/obj/' + id + '/validElements' + queryParams).replace(/\?$/, ''), { | ||
data: JSON.stringify({ | ||
validElementsRequest: requestBody | ||
}) | ||
}).then(_xhr.parseJSON); | ||
var getRequestBodyWithReportDefinition = function getRequestBodyWithReportDefinition() { | ||
return (0, _xhr.post)('/gdc/app/projects/' + projectId + '/executeAfm/debug', { | ||
body: { | ||
execution: { | ||
afm: afm | ||
} | ||
} | ||
}).then(_xhr.parseJSON).then(function (reportDefinitionResult) { | ||
return _extends({}, pickedOptions, { | ||
restrictiveDefinitionContent: reportDefinitionResult.reportDefinition.content | ||
}); | ||
}); | ||
}; | ||
var getOptions = afm ? getRequestBodyWithReportDefinition : function () { | ||
return Promise.resolve(pickedOptions); | ||
}; | ||
return getOptions().then(function (requestBody) { | ||
return (0, _xhr.post)(('/gdc/md/' + projectId + '/obj/' + id + '/validElements' + queryParams).replace(/\?$/, ''), { | ||
data: JSON.stringify({ validElementsRequest: requestBody }) | ||
}).then(_xhr.parseJSON); | ||
}); | ||
} | ||
@@ -697,0 +717,0 @@ |
{ | ||
"name": "gooddata", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"author": "GoodData", | ||
@@ -5,0 +5,0 @@ "description": "GoodData JavaScript SDK", |
@@ -585,2 +585,3 @@ // Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
* - restrictiveDefinition {String} | ||
* - afm {Object} | ||
* @return {Object} ValidElements response with: | ||
@@ -594,9 +595,31 @@ * - items {Array} elements | ||
const queryParams = queryString(query); | ||
const pickedOptions = pick(options, [ | ||
'uris', 'complement', 'includeTotalCountWithoutFilters', 'restrictiveDefinition' | ||
]); | ||
const { afm } = options; | ||
const requestBody = pick(options, ['uris', 'complement', 'includeTotalCountWithoutFilters', 'restrictiveDefinition']); | ||
return post(`/gdc/md/${projectId}/obj/${id}/validElements${queryParams}`.replace(/\?$/, ''), { | ||
data: JSON.stringify({ | ||
validElementsRequest: requestBody | ||
}) | ||
}).then(parseJSON); | ||
const getRequestBodyWithReportDefinition = | ||
() => post( | ||
`/gdc/app/projects/${projectId}/executeAfm/debug`, { | ||
body: { | ||
execution: { | ||
afm | ||
} | ||
} | ||
} | ||
) | ||
.then(parseJSON) | ||
.then(reportDefinitionResult => ({ | ||
...pickedOptions, | ||
restrictiveDefinitionContent: reportDefinitionResult.reportDefinition.content | ||
})); | ||
const getOptions = afm ? getRequestBodyWithReportDefinition : () => Promise.resolve(pickedOptions); | ||
return getOptions() | ||
.then(requestBody => post( | ||
`/gdc/md/${projectId}/obj/${id}/validElements${queryParams}`.replace(/\?$/, ''), { | ||
data: JSON.stringify({ validElementsRequest: requestBody }) | ||
} | ||
) | ||
.then(parseJSON)); | ||
} | ||
@@ -603,0 +626,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1150341
26997