// Type definitions for LDAPjs 0.7.1
// Project: https://www.npmjs.com/package/ldapjs
// Definitions by: Zorbing <https://github.com/Zorbing>
/* =================== USAGE ===================
import * as ldapjs from "ldapjs";
=============================================== */
/// <reference path="../../typings/node/node.d.ts" />
declare module "ldapjs"
{
interface IControl {}
interface IChange {}
interface IChangeObject {
modification;
operation?;
type?;
}
interface ICallback {
(...args: any[]): any;
}
interface ICreateClientOptions {
// timeout for connecting to server in milliseconds
connectTimeout?: number | string;
log?;
maxConnections?: number;
socketPath?: string;
timeout?: number | string;
// options see: https://nodejs.org/api/tls.html#tls_tls_connect_port_host_options_callback
tlsOptions?/*: tls.ConnectionOptions*/;
url?: string;
}
export function createClient(options: ICreateClientOptions): LDAPClient;
export function createServer(options?)/*: LDAPServer*/;
export var Server;
export var Attribute;
export var Change;
export var PersistentSearchCache;
export var RDN;
export var dn: DN;
export var persistentSearch;
export var filters;
export var parseURL;
export var url;
export var GUID_FORMAT_N;
export var GUID_FORMAT_D;
export var GUID_FORMAT_B;
export var GUID_FORMAT_P;
export var GUID_FORMAT_X;
interface IUrl extends URL {
attributes?: string[];
DN?;
extensions?: string;
filter?: string;
port: number;
scope?: string;
secure: boolean;
}
interface ISearchOptions
{
// One of base, one, or sub. Defaults to base.
scope?: string;
// A string version of an LDAP filter (see below), or a programatically constructed Filter object. Defaults to (objectclass=*).
filter?: string | Filter;
// attributes to select and return (if these are set, the server will return only these attributes). Defaults to the empty set, which means all attributes.
attributes?;
// boolean on whether you want the server to only return the names of the attributes, and not their values. Borderline useless. Defaults to false.
attrsOnly?: boolean;
// the maximum number of entries to return. Defaults to 0 (unlimited).
sizeLimit?: number;
// the maximum amount of time the server should take in responding, in seconds. Defaults to 10. Lots of servers will ignore this.
timeLimit?: number;
}
/**
* Client
*/
export class LDAPClient {
connectTimeout: number;
host: string;
log;
port: number | boolean;
secure: boolean;
tlsOptions;
socketPath: string;
timeout: number;
url: IUrl;
socket/*: Socket | ClearTextStream*/;
abandon(messageID: number, callback: ICallback);
abandon(messageID: number, controls: IControl | IControl[], callback: ICallback);
add(name: string, entry: Object | Object[], callback: ICallback);
add(name: string, entry: Object | Object[], controls, callback);
bind(name: string | DN, credentials: string, callback: ICallback);
bind(name: string | DN, credentials: string, controls: IControl | IControl[], callback: ICallback);
compare(name: string, attr: string, value: string, callback: ICallback);
compare(name: string, attr: string, value: string, controls: IControl | IControl[], callback: ICallback);
del(name: string, callback: ICallback);
del(name: string, controls: IControl | IControl[], callback: ICallback);
exop(name: string, callback: ICallback);
exop(name: string, value: string | Buffer, controls: IControl | IControl[], callback: ICallback);
modify(name: string, change: IChange | IChange[] | Object | Object[], callback: ICallback);
modify(name: string, change: IChange | IChange[] | Object | Object[], controls: IControl | IControl[], callback: ICallback);
modifyDN(name: string, newName: string, callback: ICallback);
modifyDN(name: string, newName: string, controls: IControl | IControl[], callback: ICallback);
search(base: string | DN, callback: ICallback);
search(base: string | DN, controls: IControl | IControl[], callback: ICallback);
search(base: string | DN, options: string | ISearchOptions, callback: ICallback);
search(base: string | DN, options: string | ISearchOptions, controls: IControl | IControl[], callback: ICallback);
unbind(callback?: ICallback);
}
/**
* TODO: EventEmitter
*/
/**
* Parses the given distinguished names and returns an instance of the DN class
*/
export function parseDN(dn: string): DN;
export class DN
{
childOf(dn: string | DN): boolean;
parentOf(dn: string | DN): boolean;
equals(dn: string | DN): boolean;
parent(): DN;
toString(): string;
}
/**
* Abstract filter class
*/
class Filter
{
// possible values are:
// equal, present, substring, ge, le, and, or, not; (not implemented types: approx, ext)
type: string;
matches(entry: any): boolean;
}
/**
* Parses the given filter string and returns an instance of one Filter class
*/
export function parseFilter(filter: string): Filter;
export class EqualityFilter extends Filter
{
constructor(config: {
attribute: string;
value: string;
});
}
export class PresenceFilter extends Filter
{
constructor(config: {
attribute: string;
});
}
export class SubstringFilter extends Filter
{
constructor(config: {
attribute?: string;
initial: string;
any: string[];
final: string;
});
}
export class GreaterThanEqualsFilter extends Filter
{
constructor(config: {
attribute: string;
value: string;
});
}
export class LessThanEqualsFilter extends Filter
{
constructor(config: {
attribute: string;
value: string;
});
}
export class AndFilter extends Filter
{
constructor(config: {
filters: Filter[];
});
}
export class OrFilter extends Filter
{
constructor(config: {
filters: Filter[];
});
}
export class NotFilter extends Filter
{
constructor(config: {
filter: Filter;
});
}
/**
* Abstact error class
*/
class LDAPError
{
stack;
code: number;
name: string;
message: string;
}
export class OperationsError extends LDAPError
{
constructor(message: string);
}
export class ProtocolError extends LDAPError
{
constructor(message: string);
}
export class TimeLimitExceededError extends LDAPError
{
constructor(message: string);
}
export class SizeLimitExceededError extends LDAPError
{
constructor(message: string);
}
export class CompareFalseError extends LDAPError
{
constructor(message: string);
}
export class CompareTrueError extends LDAPError
{
constructor(message: string);
}
export class AuthMethodNotSupportedError extends LDAPError
{
constructor(message: string);
}
export class StrongAuthRequiredError extends LDAPError
{
constructor(message: string);
}
export class ReferralError extends LDAPError
{
constructor(message: string);
}
export class AdminLimitExceededError extends LDAPError
{
constructor(message: string);
}
export class UnavailableCriticalExtensionError extends LDAPError
{
constructor(message: string);
}
export class ConfidentialityRequiredError extends LDAPError
{
constructor(message: string);
}
export class SaslBindInProgressError extends LDAPError
{
constructor(message: string);
}
export class NoSuchAttributeError extends LDAPError
{
constructor(message: string);
}
export class UndefinedAttributeTypeError extends LDAPError
{
constructor(message: string);
}
export class InappropriateMatchingError extends LDAPError
{
constructor(message: string);
}
export class ConstraintViolationError extends LDAPError
{
constructor(message: string);
}
export class AttributeOrValueExistsError extends LDAPError
{
constructor(message: string);
}
export class InvalidAttriubteSyntaxError extends LDAPError
{
constructor(message: string);
}
export class NoSuchObjectError extends LDAPError
{
constructor(message: string);
}
export class AliasProblemError extends LDAPError
{
constructor(message: string);
}
export class InvalidDnSyntaxError extends LDAPError
{
constructor(message: string);
}
export class AliasDerefProblemError extends LDAPError
{
constructor(message: string);
}
export class InappropriateAuthenticationError extends LDAPError
{
constructor(message: string);
}
export class InvalidCredentialsError extends LDAPError
{
constructor(message: string);
}
export class InsufficientAccessRightsError extends LDAPError
{
constructor(message: string);
}
export class BusyError extends LDAPError
{
constructor(message: string);
}
export class UnavailableError extends LDAPError
{
constructor(message: string);
}
export class UnwillingToPerformError extends LDAPError
{
constructor(message: string);
}
export class LoopDetectError extends LDAPError
{
constructor(message: string);
}
export class NamingViolationError extends LDAPError
{
constructor(message: string);
}
export class ObjectclassViolationError extends LDAPError
{
constructor(message: string);
}
export class NotAllowedOnNonLeafError extends LDAPError
{
constructor(message: string);
}
export class NotAllowedOnRdnError extends LDAPError
{
constructor(message: string);
}
export class EntryAlreadyExistsError extends LDAPError
{
constructor(message: string);
}
export class ObjectclassModsProhibitedError extends LDAPError
{
constructor(message: string);
}
export class AffectsMultipleDsasError extends LDAPError
{
constructor(message: string);
}
export class OtherError extends LDAPError
{
constructor(message: string);
}
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎