[ldapjs] created initial stubs for Server, createServer, and related objects/functions (#35125)

* created initial stub for Server and related objects/functions

* correct ts-compile for pre-typescript 3.1 versions
This commit is contained in:
Michael
2019-05-06 01:13:36 -07:00
committed by Wesley Wigham
parent 4d830a5c95
commit 941c6fa41a
+105 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for ldapjs 1.0
// Type definitions for ldapjs
// Project: http://ldapjs.org
// Definitions by: Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans>, Pablo Moleri <https://github.com/pmoleri>
// Definitions by: Charles Villemure <https://github.com/cvillemure>, Peter Kooijmans <https://github.com/peterkooijmans>, Pablo Moleri <https://github.com/pmoleri>, Michael Scott-Nelson <https://github.com/mscottnelson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -250,6 +250,107 @@ export interface Client extends EventEmitter {
export function createClient(options?: ClientOptions): Client;
export function createServer(options?: ServerOptions): Server;
/**
* @param log You can optionally pass in a bunyan instance the client will use to acquire a logger.
* @param certificate A PEM-encoded X.509 certificate; will cause this server to run in TLS mode.
* @param key A PEM-encoded private key that corresponds to certificate for SSL.
*/
export interface ServerOptions {
log?: any;
certificate?: any;
key?: any;
}
export interface Server extends EventEmitter {
/**
* Set this property to reject connections when the server's connection count gets high.
*/
maxConnections: number;
/**
* The number of concurrent connections on the server. (getter only)
*/
connections(): number;
/**
* Returns the fully qualified URL this server is listening on. For example: ldaps://10.1.2.3:1636. If you haven't yet called listen, it will always return ldap://localhost:389.
*/
url: string;
/**
* Port and Host
* Begin accepting connections on the specified port and host. If the host is omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY).
* This function is asynchronous. The last parameter callback will be called when the server has been bound.
*/
listen(port: number): void;
listen(port: number, callback: any): void;
listen(port: number, host: string): void;
listen(port: number, host: string, callback: any): void;
/**
* Unix Domain Socket
* Start a UNIX socket server listening for connections on the given path.
* This function is asynchronous. The last parameter callback will be called when the server has been bound.
*/
listen(path: string): void;
listen(path: string, callback: any): void;
/**
* File descriptor
* Start a server listening for connections on the given file descriptor.
* This file descriptor must have already had the bind(2) and listen(2) system calls invoked on it. Additionally, it must be set non-blocking; try fcntl(fd, F_SETFL, O_NONBLOCK).
*/
listenFD(fileDescriptor: any): void;
bind(mount: string, ...cbHandlers: any[]): void;
add(mount: string, ...cbHandlers: any[]): void;
search(ditHook: string, ...cbHandlers: any[]): void;
modify(ditHook: string, ...cbHandlers: any[]): void;
del(ditHook: string, ...cbHandlers: any[]): void;
compare(ditHook: string, ...cbHandlers: any[]): void;
modifyDN(ditHook: string, ...cbHandlers: any[]): void;
exop(arbitraryHook: string, ...cbHandlers: any[]): void;
unbind(...cbHandlers: any[]): void;
}
export class SearchRequest {
baseObject: string;
scope: "base"|"one"|"sub";
derefAliases: number;
sizeLimit: number;
timeLimit: number;
typesOnly: boolean;
filter: any;
attributes?: any;
}
export class InsufficientAccessRightsError {
constructor(error?: string);
}
export class InvalidCredentialsError {
constructor(error?: string);
}
export class EntryAlreadyExistsError {
constructor(error?: string);
}
export class NoSuchObjectError {
constructor(error?: string);
}
export class NoSuchAttributeError {
constructor(error?: string);
}
export class ProtocolError {
constructor(error?: string);
}
declare class Filter {
matches(obj: any): boolean;
type: string;
@@ -383,3 +484,5 @@ export class SearchEntry extends LDAPMessage {
*/
readonly raw: SearchEntryRaw;
}
export function parseDN(dn: string): any;