ldap-ts-client
Advanced tools
Comparing version 0.9.1-beta9 to 0.9.1
@@ -22,27 +22,18 @@ "use strict"; | ||
var _a; | ||
console.log(`File: index.ts,`, `Line: 93 => bind`); | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("bind()"); | ||
return new Promise((resolve, reject) => { | ||
console.log(`File: index.ts,`, `Line: 97 => `); | ||
if (this.client) { | ||
console.log(`File: index.ts,`, `Line: 104 => destroy`); | ||
this.client.destroy((err) => { | ||
reject(err); | ||
}); | ||
console.log(`File: index.ts,`, `Line: 109 => destroy success!`); | ||
} | ||
const newClient = ldapjs_1.default.createClient(Object.assign(Object.assign({}, this.config), { url: this.config.ldapServerUrl, log: this.config.logger })); | ||
newClient.on("connectError", (err) => { | ||
console.log(`File: index.ts,`, `Line: 118 => `, err); | ||
this.client = ldapjs_1.default.createClient(Object.assign(Object.assign({}, this.config), { url: this.config.ldapServerUrl, log: this.config.logger })); | ||
this.client.on("connectError", (err) => { | ||
reject(err); | ||
}); | ||
console.log(`File: index.ts,`, `Line: 125 => config`, this.config); | ||
newClient.bind(this.config.user, this.config.pass, (err, result) => { | ||
this.client.bind(this.config.user, this.config.pass, (err, result) => { | ||
if (err) { | ||
console.log(`File: index.ts,`, `Line: 103 => `, err); | ||
reject(err); | ||
} | ||
console.log(`File: index.ts,`, `Line: 105 => client.connected`, newClient.connected); | ||
this.client = newClient; | ||
resolve(newClient); | ||
resolve(this.client); | ||
}); | ||
@@ -65,8 +56,7 @@ }); | ||
async connect() { | ||
var _a; | ||
console.log(`File: index.ts,`, `Line: 126 connect `); | ||
var _a, _b; | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("connect()"); | ||
// if (this.client?.connected) { | ||
// return this.client; | ||
// } | ||
if ((_b = this.client) === null || _b === void 0 ? void 0 : _b.connected) { | ||
return this.client; | ||
} | ||
const client = await this.bind(); | ||
@@ -94,3 +84,2 @@ return client; | ||
var _a; | ||
console.log(`File: index.ts,`, `Line: 166 => queryAttributes`); | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("queryAttributes()"); | ||
@@ -97,0 +86,0 @@ await this.connect(); |
{ | ||
"name": "ldap-ts-client", | ||
"version": "0.9.1-beta9", | ||
"version": "0.9.1", | ||
"description": "Type-safe LDAP client written in typescript", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -98,18 +98,11 @@ import ldap, { SearchOptions, Control, SearchEntryObject } from "ldapjs"; | ||
public async bind(): Promise<ldap.Client> { | ||
console.log(`File: index.ts,`, `Line: 93 => bind`); | ||
this.logger?.trace("bind()"); | ||
return new Promise((resolve, reject) => { | ||
console.log(`File: index.ts,`, `Line: 97 => `); | ||
if (this.client) { | ||
console.log(`File: index.ts,`, `Line: 104 => destroy`); | ||
this.client.destroy((err: any) => { | ||
reject(err); | ||
}); | ||
console.log(`File: index.ts,`, `Line: 109 => destroy success!`); | ||
} | ||
const newClient = ldap.createClient({ | ||
this.client = ldap.createClient({ | ||
...this.config, | ||
@@ -120,24 +113,12 @@ url: this.config.ldapServerUrl, | ||
newClient.on("connectError", (err) => { | ||
console.log(`File: index.ts,`, `Line: 118 => `, err); | ||
this.client.on("connectError", (err) => { | ||
reject(err); | ||
}); | ||
console.log(`File: index.ts,`, `Line: 125 => config`, this.config); | ||
newClient.bind(this.config.user, this.config.pass, (err, result) => { | ||
this.client.bind(this.config.user, this.config.pass, (err, result) => { | ||
if (err) { | ||
console.log(`File: index.ts,`, `Line: 103 => `, err); | ||
reject(err); | ||
} | ||
console.log( | ||
`File: index.ts,`, | ||
`Line: 105 => client.connected`, | ||
newClient.connected, | ||
); | ||
this.client = newClient; | ||
resolve(newClient); | ||
resolve(this.client); | ||
}); | ||
@@ -162,8 +143,6 @@ }); | ||
private async connect() { | ||
console.log(`File: index.ts,`, `Line: 126 connect `); | ||
this.logger?.trace("connect()"); | ||
// if (this.client?.connected) { | ||
// return this.client; | ||
// } | ||
if (this.client?.connected) { | ||
return this.client; | ||
} | ||
const client = await this.bind(); | ||
@@ -205,4 +184,2 @@ return client; | ||
}: QueryFnInput<T>): Promise<SearchEntryObject[]> { | ||
console.log(`File: index.ts,`, `Line: 166 => queryAttributes`); | ||
this.logger?.trace("queryAttributes()"); | ||
@@ -209,0 +186,0 @@ await this.connect(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60408
1173