ad-promise
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -58,2 +58,3 @@ | ||
}, err => { | ||
console.log(err); | ||
reject(err); | ||
@@ -60,0 +61,0 @@ }); |
@@ -28,4 +28,3 @@ var _ = require('underscore'); | ||
var users = []; | ||
var groups = []; | ||
let result = []; | ||
@@ -35,3 +34,3 @@ self.findGroup(_.defaults({}, _.omit(opts || {}, 'attributes'), { | ||
}), | ||
groupName, function (err, group) { | ||
groupName, async function (err, group) { | ||
if (err) { | ||
@@ -76,20 +75,27 @@ if (callback) callback(err); | ||
const allChunksDone = []; | ||
// Chunks represent the cn for each user; | ||
for (index in chunks){ | ||
let thisChunkDone; | ||
allChunksDone.push(new Promise((resolve, reject) => {thisChunkDone = resolve;})); | ||
chunkItem(chunks[index], opts, self).then(members => { | ||
result = result.concat(members); | ||
thisChunkDone(); | ||
}, err => { | ||
if(callback){ | ||
callback(null, members); | ||
} | ||
resolve(members); | ||
return; | ||
}, err => { | ||
if(callback){ | ||
callback(err); | ||
} | ||
reject(err); | ||
return reject(err); | ||
}); | ||
} | ||
await Promise.all(allChunksDone).then(data => { | ||
console.log('Returning members for group ' + groupName); | ||
if(callback){ | ||
callback(null, result); | ||
} | ||
return resolve(result); | ||
}, err => { | ||
return reject(err); | ||
}); | ||
}); | ||
@@ -96,0 +102,0 @@ }); |
{ | ||
"author": "Relief Melone (relief.melone@gmail.com)", | ||
"name": "ad-promise", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "This is a fork of the gheeres node-activedirectory. This is still a work in progress and not stable. The goal to use promises instead of the async library which is causing some problems in the current version of node-activedirectory", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"bunyan": ">= 1.3.5", | ||
"bunyan": "^2.0.2", | ||
"ldapjs": ">= 0.7.1", | ||
@@ -25,0 +25,0 @@ "underscore": ">= 1.4.3" |
@@ -24,3 +24,2 @@ AD-Promise for Node | ||
* [underscore] - a utility-belt library for JavaScript that provides a lot of the functional programming support | ||
* [async] - Async utilities for node and the browser | ||
* [ldapjs] - A pure JavaScript, from-scratch framework for implementing LDAP clients and servers in Node.js | ||
@@ -27,0 +26,0 @@ * [bunyan](https://github.com/trentm/node-bunyan) - A simple and fast JSON logging module for node.js services |
202495
73
3945
755
Updatedbunyan@^2.0.2