node-ldapjs/lib/index.js

85 lines
1.8 KiB
JavaScript
Raw Normal View History

2011-08-04 20:32:01 +00:00
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
var logger = require('./logger')
2012-02-18 08:54:22 +00:00
var client = require('./client')
var Attribute = require('./attribute')
var Change = require('./change')
var Protocol = require('./protocol')
var Server = require('./server')
var controls = require('./controls')
var persistentSearch = require('./persistent_search')
var dn = require('./dn')
var errors = require('./errors')
var filters = require('./filters')
var messages = require('./messages')
var url = require('./url')
2011-08-04 20:32:01 +00:00
const hasOwnProperty = (target, val) => Object.prototype.hasOwnProperty.call(target, val)
2011-08-04 20:32:01 +00:00
/// --- API
2011-08-04 20:32:01 +00:00
module.exports = {
2015-10-28 02:52:43 +00:00
Client: client.Client,
createClient: client.createClient,
2011-08-04 20:32:01 +00:00
Server: Server,
2012-02-24 00:02:52 +00:00
createServer: function (options) {
if (options === undefined) { options = {} }
2012-02-18 08:54:22 +00:00
if (typeof (options) !== 'object') { throw new TypeError('options (object) required') }
2012-02-18 08:54:22 +00:00
if (!options.log) {
options.log = logger
2012-02-18 08:54:22 +00:00
}
return new Server(options)
},
2011-08-04 20:32:01 +00:00
2011-08-19 22:08:23 +00:00
Attribute: Attribute,
Change: Change,
dn: dn,
2011-08-04 20:32:01 +00:00
DN: dn.DN,
RDN: dn.RDN,
2011-08-04 20:32:01 +00:00
parseDN: dn.parse,
persistentSearch: persistentSearch,
PersistentSearchCache: persistentSearch.PersistentSearchCache,
2011-08-04 20:32:01 +00:00
filters: filters,
parseFilter: filters.parseString,
url: url,
parseURL: url.parse
}
2011-08-04 20:32:01 +00:00
/// --- Export all the childrenz
2011-08-04 20:32:01 +00:00
var k
2011-08-04 20:32:01 +00:00
for (k in Protocol) {
if (hasOwnProperty(Protocol, k)) { module.exports[k] = Protocol[k] }
2011-08-04 20:32:01 +00:00
}
for (k in messages) {
if (hasOwnProperty(messages, k)) { module.exports[k] = messages[k] }
2011-08-04 20:32:01 +00:00
}
2011-12-09 21:59:17 +00:00
for (k in controls) {
if (hasOwnProperty(controls, k)) { module.exports[k] = controls[k] }
2011-12-09 21:59:17 +00:00
}
2011-08-04 20:32:01 +00:00
for (k in filters) {
if (hasOwnProperty(filters, k)) {
if (k !== 'parse' && k !== 'parseString') { module.exports[k] = filters[k] }
2011-08-04 20:32:01 +00:00
}
}
for (k in errors) {
if (hasOwnProperty(errors, k)) {
module.exports[k] = errors[k]
2011-08-04 20:32:01 +00:00
}
}