Comparing version 1.2.0 to 1.3.0-pbenes-show-objects-2017-03-28T11-19-39-417Z
@@ -153,7 +153,12 @@ 'use strict'; | ||
var omittedOptions = ['filter', 'types', 'paging', 'dataSetIdentifier', 'returnAllDateDataSets', 'returnAllRelatedDateDataSets']; | ||
if (options.includeObjectsWithTags) { | ||
omittedOptions.push('exludeObjectsWithTags'); | ||
} | ||
var request = (0, _omit3.default)(_extends({}, LOAD_DATE_DATASET_DEFAULTS, REQUEST_DEFAULTS, options, getRequiredDataSets(options), { | ||
bucketItems: bucketItems | ||
}), ['filter', 'types', 'paging', 'dataSetIdentifier', 'returnAllDateDataSets', 'returnAllRelatedDateDataSets']); | ||
}), omittedOptions); | ||
return requestDateDataSets(projectId, request); | ||
} |
@@ -6,12 +6,3 @@ 'use strict'; | ||
}); | ||
exports.domain = undefined; | ||
exports.setCustomDomain = setCustomDomain; | ||
exports.getFetch = getFetch; | ||
exports.setFetch = setFetch; | ||
var _util = require('./util'); | ||
var URL_REGEXP = '(?:(https)://+|(www\\.)?)\\w[:;,\\.?\\[\\]\\w/~%&=+#-@!]*'; | ||
// TODO - fix this | ||
// Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
@@ -30,2 +21,5 @@ /** | ||
var URL_REGEXP = '(?:(https)://+|(www\\.)?)\\w[:;,\\.?\\[\\]\\w/~%&=+#-@!]*'; | ||
// TODO - fix this | ||
var domain = exports.domain = void 0; // eslint-disable-line import/no-mutable-exports | ||
@@ -58,26 +52,2 @@ | ||
exports.domain = domain = 'https://' + link[0].replace(/^https:\/\//, '').replace(/\/$/, ''); | ||
} | ||
// decide if running in nodejs and use appropriate fetch function | ||
var fetch = void 0; | ||
if ((0, _util.isNode)()) { | ||
fetch = require('fetch-cookie')(require('node-fetch')); | ||
} else { | ||
fetch = require('isomorphic-fetch'); | ||
} | ||
/** | ||
* Get fetch function | ||
* @return {function} fetch function | ||
*/ | ||
function getFetch() { | ||
return fetch; | ||
} | ||
/** | ||
* Set custom fetch function. Primarily used in tests to allow using fetchMock | ||
* @param {function} f fetch function | ||
*/ | ||
function setFetch(f) { | ||
fetch = f; | ||
} |
@@ -27,2 +27,5 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
exports.getObjects = getObjects; | ||
@@ -69,3 +72,2 @@ exports.getObjectUsing = getObjectUsing; | ||
*/ | ||
// Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
function getObjects(projectId, objectUris) { | ||
@@ -544,45 +546,51 @@ var LIMIT = 50; | ||
} else if (type === 'metric') { | ||
var entriesLinks = folderDetails.map(function (entry) { | ||
return mapBy(entry.folder.content.entries, 'link'); | ||
}); | ||
// get all metrics, subtract what we have and add rest in unsorted folder | ||
return getMetrics(projectId).then(function (metrics) { | ||
// get uris of metrics which are in some dimension folders | ||
var metricsInFolders = []; | ||
folderDetails.forEach(function (fd) { | ||
fd.folder.content.entries.forEach(function (metric) { | ||
metricsInFolders.push(metric.link); | ||
}); | ||
var _ret = function () { | ||
var entriesLinks = folderDetails.map(function (entry) { | ||
return mapBy(entry.folder.content.entries, 'link'); | ||
}); | ||
// unsortedUris now contains uris of all metrics which aren't in a folder | ||
var unsortedUris = metrics.filter(function (item) { | ||
return metricsInFolders.indexOf(item.link) === -1; | ||
}).map(function (item) { | ||
return item.link; | ||
}); | ||
// get all metrics, subtract what we have and add rest in unsorted folder | ||
return { | ||
v: getMetrics(projectId).then(function (metrics) { | ||
// get uris of metrics which are in some dimension folders | ||
var metricsInFolders = []; | ||
folderDetails.forEach(function (fd) { | ||
fd.folder.content.entries.forEach(function (metric) { | ||
metricsInFolders.push(metric.link); | ||
}); | ||
}); | ||
// unsortedUris now contains uris of all metrics which aren't in a folder | ||
var unsortedUris = metrics.filter(function (item) { | ||
return metricsInFolders.indexOf(item.link) === -1; | ||
}).map(function (item) { | ||
return item.link; | ||
}); | ||
// sadly order of parameters of concat matters! (we want unsorted last) | ||
entriesLinks.push(unsortedUris); | ||
// sadly order of parameters of concat matters! (we want unsorted last) | ||
entriesLinks.push(unsortedUris); | ||
// now get details of all metrics | ||
return Promise.all(entriesLinks.map(function (linkArray) { | ||
return getMetricItemsDetails(linkArray); | ||
})).then(function () { | ||
for (var _len6 = arguments.length, tree = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
tree[_key6] = arguments[_key6]; | ||
} | ||
// now get details of all metrics | ||
return Promise.all(entriesLinks.map(function (linkArray) { | ||
return getMetricItemsDetails(linkArray); | ||
})).then(function () { | ||
for (var _len6 = arguments.length, tree = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { | ||
tree[_key6] = arguments[_key6]; | ||
} | ||
// TODO add map to r.json | ||
// all promises resolved, i.e. details for each metric are available | ||
var structure = tree.map(function (treeItems, idx) { | ||
// if idx is not in foldes list than metric is in "Unsorted" folder | ||
return { | ||
title: foldersTitles[idx] || 'Unsorted', | ||
items: treeItems | ||
}; | ||
}); | ||
sortFolderTree(structure); | ||
return structure; | ||
}); | ||
}); | ||
// TODO add map to r.json | ||
// all promises resolved, i.e. details for each metric are available | ||
var structure = tree.map(function (treeItems, idx) { | ||
// if idx is not in foldes list than metric is in "Unsorted" folder | ||
return { | ||
title: foldersTitles[idx] || 'Unsorted', | ||
items: treeItems | ||
}; | ||
}); | ||
sortFolderTree(structure); | ||
return structure; | ||
}); | ||
}) | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} else { | ||
@@ -589,0 +597,0 @@ return Promise.reject(); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.isNode = exports.getIn = undefined; | ||
exports.getIn = undefined; | ||
@@ -36,12 +36,2 @@ var _get2 = require('lodash/get'); | ||
}; | ||
}; | ||
/** | ||
* Detect if the script is using nodejs | ||
* | ||
* @method isNode | ||
* @public | ||
*/ | ||
var isNode = exports.isNode = function isNode() { | ||
return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; | ||
}; |
@@ -40,2 +40,6 @@ 'use strict'; | ||
var _fetch = require('./utils/fetch'); | ||
var _fetch2 = _interopRequireDefault(_fetch); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -57,5 +61,5 @@ | ||
var DEFAULT_POLL_DELAY = 1000; // Copyright (C) 2007-2013, GoodData(R) Corporation. All rights reserved. | ||
// Copyright (C) 2007-2013, GoodData(R) Corporation. All rights reserved. | ||
var DEFAULT_POLL_DELAY = 1000; | ||
var tokenRequest = void 0; | ||
@@ -148,4 +152,3 @@ var commonXhrSettings = {}; | ||
var fetch = config.getFetch(); | ||
tokenRequest = fetch(url, settings).then(function (response) { | ||
tokenRequest = (0, _fetch2.default)(url, settings).then(function (response) { | ||
// tokenRequest = null; | ||
@@ -226,4 +229,3 @@ // TODO jquery compat - allow to attach unauthorized callback and call it if attached | ||
var fetch = config.getFetch(); | ||
return fetch(url, settings).then(function (response) { | ||
return (0, _fetch2.default)(url, settings).then(function (response) { | ||
// If response.status id 401 and it was a login request there is no need | ||
@@ -230,0 +232,0 @@ // to cycle back for token - login does not need token and this meand you |
{ | ||
"name": "gooddata", | ||
"version": "1.2.0", | ||
"version": "1.3.0-pbenes-show-objects-2017-03-28T11-19-39-417Z", | ||
"author": "GoodData", | ||
"description": "GoodData JavaScript SDK", | ||
"license": "SEE LICENSE IN LICENSE.txt", | ||
"main": "lib/gooddata.js", | ||
"main": "lib/gooddata-node.js", | ||
"browser": "lib/gooddata-browser.js", | ||
"files": [ | ||
@@ -17,3 +18,4 @@ "dist", | ||
"build:dist": "rm -rf dist && grunt dist", | ||
"prepublish": "npm run build" | ||
"prepublish": "npm run build", | ||
"test": "grunt test" | ||
}, | ||
@@ -20,0 +22,0 @@ "repository": { |
@@ -127,2 +127,7 @@ import { get, find, omit, cloneDeep } from 'lodash'; | ||
const omittedOptions = ['filter', 'types', 'paging', 'dataSetIdentifier', 'returnAllDateDataSets', 'returnAllRelatedDateDataSets']; | ||
if (options.includeObjectsWithTags) { | ||
omittedOptions.push('exludeObjectsWithTags'); | ||
} | ||
const request = omit({ | ||
@@ -134,5 +139,5 @@ ...LOAD_DATE_DATASET_DEFAULTS, | ||
bucketItems | ||
}, ['filter', 'types', 'paging', 'dataSetIdentifier', 'returnAllDateDataSets', 'returnAllRelatedDateDataSets']); | ||
}, omittedOptions); | ||
return requestDateDataSets(projectId, request); | ||
} |
@@ -14,4 +14,2 @@ // Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
import { isNode } from './util'; | ||
const URL_REGEXP = '(?:(https)://+|(www\\.)?)\\w[:;,\\.?\\[\\]\\w/~%&=+#-@!]*'; | ||
@@ -50,25 +48,1 @@ | ||
} | ||
// decide if running in nodejs and use appropriate fetch function | ||
let fetch; | ||
if (isNode()) { | ||
fetch = require('fetch-cookie')(require('node-fetch')); | ||
} else { | ||
fetch = require('isomorphic-fetch'); | ||
} | ||
/** | ||
* Get fetch function | ||
* @return {function} fetch function | ||
*/ | ||
export function getFetch() { | ||
return fetch; | ||
} | ||
/** | ||
* Set custom fetch function. Primarily used in tests to allow using fetchMock | ||
* @param {function} f fetch function | ||
*/ | ||
export function setFetch(f) { | ||
fetch = f; | ||
} |
@@ -21,10 +21,1 @@ // Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
export const getIn = path => object => get(object, path); | ||
/** | ||
* Detect if the script is using nodejs | ||
* | ||
* @method isNode | ||
* @public | ||
*/ | ||
export const isNode = () => | ||
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; |
@@ -12,2 +12,3 @@ // Copyright (C) 2007-2013, GoodData(R) Corporation. All rights reserved. | ||
import * as config from './config'; | ||
import fetch from './utils/fetch'; | ||
@@ -113,3 +114,2 @@ /** | ||
const fetch = config.getFetch(); | ||
tokenRequest = fetch(url, settings).then((response) => { | ||
@@ -184,3 +184,2 @@ // tokenRequest = null; | ||
const fetch = config.getFetch(); | ||
return fetch(url, settings).then((response) => { | ||
@@ -187,0 +186,0 @@ // If response.status id 401 and it was a login request there is no need |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
37
0
2
10
434285
10215
3