ldap-ts-client
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -29,10 +29,13 @@ import ldap, { SearchOptions, Control, SearchEntryObject } from "ldapjs"; | ||
/** @return a connected ldap client that is useful for use flexibility of [ldap.js](http://ldapjs.org/) directly. */ | ||
bind: () => Promise<ldap.Client>; | ||
unbind: () => void; | ||
bind(): Promise<ldap.Client>; | ||
unbind(): Promise<unknown>; | ||
private connect; | ||
/** @description raw search to provided full flexibility */ | ||
query({ options, controls, base }: QueryFnInput): Promise<ldap.SearchEntry[]>; | ||
/** @description raw search returns just attributes */ | ||
/** @description raw search returns just attributes | ||
* | ||
* // TODO: add Generic type for return data | ||
*/ | ||
queryAttributes({ options, controls, base, }: QueryFnInput): Promise<SearchEntryObject[]>; | ||
} | ||
export {}; |
@@ -14,20 +14,2 @@ "use strict"; | ||
}; | ||
/** @return a connected ldap client that is useful for use flexibility of [ldap.js](http://ldapjs.org/) directly. */ | ||
this.bind = async () => { | ||
var _a; | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("bind()"); | ||
return new Promise((resolve, reject) => { | ||
this.client.bind(this.config.bindDN, this.config.secret, (err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(this.client); | ||
}); | ||
}); | ||
}; | ||
this.unbind = () => { | ||
var _a; | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("unbind()"); | ||
this.client.unbind(); | ||
}; | ||
this.config = config; | ||
@@ -38,2 +20,27 @@ this.baseDN = config.baseDN; | ||
} | ||
/** @return a connected ldap client that is useful for use flexibility of [ldap.js](http://ldapjs.org/) directly. */ | ||
async bind() { | ||
var _a; | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("bind()"); | ||
return new Promise((resolve, reject) => { | ||
this.client.bind(this.config.bindDN, this.config.secret, (err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(this.client); | ||
}); | ||
}); | ||
} | ||
async unbind() { | ||
var _a; | ||
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace("unbind()"); | ||
return new Promise((resolve, reject) => { | ||
this.client.unbind((err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
async connect() { | ||
@@ -60,3 +67,6 @@ var _a; | ||
} | ||
/** @description raw search returns just attributes */ | ||
/** @description raw search returns just attributes | ||
* | ||
* // TODO: add Generic type for return data | ||
*/ | ||
async queryAttributes({ options, controls, base, }) { | ||
@@ -63,0 +73,0 @@ var _a; |
{ | ||
"name": "ldap-ts-client", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Type-safe LDAP client written in typescript", | ||
@@ -21,3 +21,3 @@ "repository": { | ||
"prepublishOnly": "npm run tsc", | ||
"prod": "node --unhandled-rejections=strict dist/index.js", | ||
"prod": "node --unhandled-rejections=strict dist/app.js", | ||
"dev": "nodemon --watch dist --exec \"npm run prod\"", | ||
@@ -24,0 +24,0 @@ "start": "npm-run-all -p dev tsc:watch" |
@@ -46,3 +46,3 @@ import ldap, { SearchOptions, Control, SearchEntryObject } from "ldapjs"; | ||
/** @return a connected ldap client that is useful for use flexibility of [ldap.js](http://ldapjs.org/) directly. */ | ||
public bind = async (): Promise<ldap.Client> => { | ||
public async bind(): Promise<ldap.Client> { | ||
this.logger?.trace("bind()"); | ||
@@ -58,9 +58,17 @@ return new Promise((resolve, reject) => { | ||
}); | ||
}; | ||
} | ||
public unbind = () => { | ||
public async unbind() { | ||
this.logger?.trace("unbind()"); | ||
this.client.unbind(); | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this.client.unbind((err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
private async connect() { | ||
@@ -88,3 +96,6 @@ this.logger?.trace("connect()"); | ||
/** @description raw search returns just attributes */ | ||
/** @description raw search returns just attributes | ||
* | ||
* // TODO: add Generic type for return data | ||
*/ | ||
public async queryAttributes({ | ||
@@ -91,0 +102,0 @@ options, |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances 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
31725
31
526
4