Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const findTable = tablesToGo => {
if (tablesToGo.length === 0) {
deferred.reject();
return;
}
const nextTable = tablesToGo.pop();
if (typeof nextTable.subQuery !== 'undefined') {
findTable(tablesToGo);
return;
}
cancellablePromises.push(
dataCatalog
.getChildren({
sourceType: options.sourceType,
namespace: options.namespace,
compute: options.compute,
path: identifierChainToPath(nextTable.identifierChain),
cachedOnly: options && options.cachedOnly,
cancellable: options && options.cancellable,
temporaryOnly: options && options.temporaryOnly,
silenceErrors: true
})
.done(childEntries => {
let foundEntry = undefined;
childEntries.some(childEntry => {
if (identifierEquals(childEntry.name, options.identifierChain[0].name)) {
foundEntry = childEntry;
return true;
$.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
const target = path.pop();
dataCatalog
.getChildren({
sourceType: self.options.apiHelperType,
namespace: namespace,
compute: compute,
path: path
})
.done(childEntries => {
if (
childEntries.some(childEntry => {
return childEntry.name === target;
})
) {
onPathChange($el.val());
}
});
});
fetchChildren(identifierChain) {
const self = this;
const deferred = $.Deferred();
dataCatalog
.getChildren({
sourceType: self.snippet.type(),
namespace: self.snippet.namespace(),
compute: self.snippet.compute(),
temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,
path: $.map(identifierChain, identifier => {
return identifier.name;
}),
silenceErrors: true,
cachedOnly: true
})
.done(deferred.resolve)
.fail(() => {
deferred.reject([]);
});
return deferred;
const findIdentifierChainInTable = function(tablesToGo) {
const nextTable = tablesToGo.shift();
if (typeof nextTable.subQuery === 'undefined') {
dataCatalog
.getChildren({
sourceType: self.snippet.type(),
namespace: self.snippet.namespace(),
compute: self.snippet.compute(),
temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,
path: $.map(nextTable.identifierChain, identifier => {
return identifier.name;
}),
cachedOnly: true,
silenceErrors: true
})
.done(entries => {
const containsColumn = entries.some(entry => {
return sqlUtils.identifierEquals(entry.name, location.identifierChain[0].name);
});
$.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
dataCatalog
.getChildren({
sourceType: self.options.apiHelperType,
namespace: namespace,
compute: compute,
path: []
})
.done(dbEntries => {
callback(
$.map(dbEntries, entry => {
return entry.name;
})
);
});
});
};