@types/ldapjs
Advanced tools
Comparing version 1.0.3 to 1.0.4
// Type definitions for ldapjs 1.0 | ||
// Project: http://ldapjs.org | ||
// Definitions by: Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans> | ||
// Definitions by: Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans>, Pablo Moleri <https://github.com/pmoleri> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -78,4 +78,15 @@ | ||
export type SearchReference = any; | ||
export interface SearchCallbackResponse extends EventEmitter { | ||
on(event: "searchEntry", listener: (entry: SearchEntry) => void): this; | ||
on(event: "searchReference", listener: (referral: SearchReference) => void): this; | ||
on(event: "page", listener: (res: LDAPResult, cb: (...args: any[]) => void) => void): this; | ||
on(event: "error", listener: (err: Error) => void): this; | ||
on(event: "end", listener: (res: LDAPResult | null) => void): this; | ||
on(event: string | symbol, listener: (...args: any[]) => void): this; | ||
} | ||
export interface SearchCallBack { | ||
(error: Error, result: EventEmitter): void; | ||
(error: Error | null, result: SearchCallbackResponse): void; | ||
} | ||
@@ -195,3 +206,3 @@ | ||
* Note that this method is 'special' in that the callback 'res' param will | ||
* have two important events on it, namely 'entry' and 'end' that you can hook | ||
* have two important events on it, namely 'searchEntry' and 'end' that you can hook | ||
* to. The former will emit a SearchEntry object for each record that comes | ||
@@ -286,1 +297,92 @@ * back, and the latter will emit a normal LDAPResult object. | ||
} | ||
export interface AttributeJson { | ||
type: string; | ||
vals: string[]; | ||
} | ||
export class Attribute { | ||
private type: string; | ||
readonly buffers: Buffer[]; | ||
/** | ||
* Array of string values, binaries are represented in base64. | ||
* get: When reading it always returns an array of strings. | ||
* set: When assigning it accepts either an array or a single value. | ||
* `Buffer`s are assigned directly, any other value is converted to string and loaded into a `Buffer`. | ||
*/ | ||
vals: string | string[]; | ||
readonly json: AttributeJson; | ||
/** Stringified json property */ | ||
toString(): string; | ||
static isAttribute(object: any): object is Attribute; | ||
static compare(a: Attribute, b: Attribute): number; | ||
} | ||
interface LDAPMessageJsonObject { | ||
messageID: number; | ||
protocolOp: string | undefined; | ||
controls: Control[]; | ||
[k: string]: any; | ||
} | ||
export abstract class LDAPMessage { | ||
messageID: number; | ||
protocolOp: string | undefined; | ||
controls: Control[]; | ||
log: any; | ||
readonly id: number; | ||
readonly dn: string; | ||
readonly type: string; | ||
/** A plain object with main properties */ | ||
readonly json: LDAPMessageJsonObject; | ||
/** Stringified json property */ | ||
toString(): string; | ||
parse(ber: Buffer): boolean; | ||
toBer(): Buffer; | ||
} | ||
export class LDAPResult extends LDAPMessage { | ||
readonly type: "LDAPResult"; | ||
/** Result status 0 = success */ | ||
status: number; | ||
matchedDN: string; | ||
errorMessage: string; | ||
referrals: string[]; | ||
connection: any; | ||
} | ||
export interface SearchEntryObject { | ||
dn: string; | ||
controls: Control[]; | ||
[p: string]: string | string[]; | ||
} | ||
export interface SearchEntryRaw { | ||
dn: string; | ||
controls: Control[]; | ||
[p: string]: string | Buffer | Buffer[]; | ||
} | ||
export class SearchEntry extends LDAPMessage { | ||
readonly type: "SearchEntry"; | ||
objectName: string | null; | ||
attributes: Attribute[]; | ||
readonly json: LDAPMessageJsonObject & { objectName: string, attributes: AttributeJson[]}; | ||
/** | ||
* Retrieve an object with `dn`, `controls` and every `Atttribute` as a property with their value(s) | ||
*/ | ||
readonly object: SearchEntryObject; | ||
/** | ||
* Retrieve an object with `dn`, `controls` and every `Atttribute` as a property, using raw `Buffer`(s) as attribute values. | ||
*/ | ||
readonly raw: SearchEntryRaw; | ||
} |
{ | ||
"name": "@types/ldapjs", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "TypeScript definitions for ldapjs", | ||
@@ -16,16 +16,22 @@ "license": "MIT", | ||
"githubUsername": "peterkooijmans" | ||
}, | ||
{ | ||
"name": "Pablo Moleri", | ||
"url": "https://github.com/pmoleri", | ||
"githubUsername": "pmoleri" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/ldapjs" | ||
}, | ||
"scripts": {}, | ||
"dependencies": { | ||
"@types/events": "*", | ||
"@types/node": "*" | ||
}, | ||
"typesPublisherContentHash": "14209c285b7d98fac101e8a80d2ce7c023fa64f26ebc4141bf54e42a98d67cef", | ||
"typesPublisherContentHash": "a4e8cbb08aa80141e252ca5f7c22a8a9b1f62b54956aacd90fe3ff87e90f4849", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -5,13 +5,13 @@ # Installation | ||
# Summary | ||
This package contains type definitions for ldapjs (http://ldapjs.org). | ||
This package contains type definitions for ldapjs ( http://ldapjs.org ). | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ldapjs | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ldapjs | ||
Additional Details | ||
* Last updated: Sat, 10 Feb 2018 21:44:46 GMT | ||
* Dependencies: events, node | ||
* Last updated: Fri, 12 Apr 2019 22:57:45 GMT | ||
* Dependencies: @types/node | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans>. | ||
These definitions were written by Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans>, Pablo Moleri <https://github.com/pmoleri>. |
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
15225
1
328
- Removed@types/events@*
- Removed@types/events@3.0.3(transitive)