2011-08-04 20:32:01 +00:00
|
|
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
|
|
|
|
|
|
|
var Client = require('./client');
|
2011-08-06 20:44:26 +00:00
|
|
|
var Attribute = require('./attribute');
|
|
|
|
var Change = require('./change');
|
|
|
|
var Control = require('./control');
|
|
|
|
var Protocol = require('./protocol');
|
|
|
|
var Server = require('./server');
|
|
|
|
|
2011-08-04 20:32:01 +00:00
|
|
|
var dn = require('./dn');
|
|
|
|
var errors = require('./errors');
|
|
|
|
var filters = require('./filters');
|
|
|
|
var logStub = require('./log_stub');
|
2011-08-06 20:44:26 +00:00
|
|
|
var messages = require('./messages');
|
2011-08-08 15:29:01 +00:00
|
|
|
var schema = require('./schema');
|
2011-08-04 20:32:01 +00:00
|
|
|
var url = require('./url');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Hack a few things we need (i.e., "monkey patch" the prototype)
|
|
|
|
|
|
|
|
if (!String.prototype.startsWith) {
|
|
|
|
String.prototype.startsWith = function(str) {
|
|
|
|
var re = new RegExp('^' + str);
|
|
|
|
return re.test(this);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.endsWith) {
|
|
|
|
String.prototype.endsWith = function(str) {
|
|
|
|
var re = new RegExp(str + '$');
|
|
|
|
return re.test(this);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///--- API
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
Client: Client,
|
|
|
|
createClient: function(options) {
|
|
|
|
if (typeof(options) !== 'object')
|
|
|
|
throw new TypeError('options (object) required');
|
|
|
|
|
|
|
|
return new Client(options);
|
|
|
|
},
|
|
|
|
|
2011-08-06 20:44:26 +00:00
|
|
|
Server: Server,
|
|
|
|
createServer: function(options) {
|
|
|
|
return new Server(options);
|
|
|
|
},
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2011-08-19 22:08:23 +00:00
|
|
|
Attribute: Attribute,
|
|
|
|
Change: Change,
|
|
|
|
Control: Control,
|
|
|
|
|
2011-08-04 20:32:01 +00:00
|
|
|
DN: dn.DN,
|
2011-08-10 17:57:58 +00:00
|
|
|
RDN: dn.RDN,
|
2011-08-04 20:32:01 +00:00
|
|
|
parseDN: dn.parse,
|
2011-08-19 22:08:23 +00:00
|
|
|
dn: dn,
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
filters: filters,
|
|
|
|
parseFilter: filters.parseString,
|
|
|
|
|
|
|
|
log4js: logStub,
|
2011-08-19 22:08:23 +00:00
|
|
|
parseURL: url.parse,
|
|
|
|
|
|
|
|
loadSchema: schema.load,
|
|
|
|
createSchemaAddHandler: schema.createAddHandler,
|
2011-08-22 17:48:45 +00:00
|
|
|
createSchemaModifyHandler: schema.createModifyHandler,
|
|
|
|
createSchemaSearchHandler: schema.createSearchHandler
|
2011-08-04 20:32:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///--- Export all the childrenz
|
|
|
|
|
|
|
|
var k;
|
|
|
|
|
|
|
|
for (k in Protocol) {
|
|
|
|
if (Protocol.hasOwnProperty(k))
|
|
|
|
module.exports[k] = Protocol[k];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k in messages) {
|
|
|
|
if (messages.hasOwnProperty(k))
|
|
|
|
module.exports[k] = messages[k];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k in filters) {
|
|
|
|
if (filters.hasOwnProperty(k)) {
|
|
|
|
if (k !== 'parse' && k !== 'parseString')
|
|
|
|
module.exports[k] = filters[k];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k in errors) {
|
|
|
|
if (errors.hasOwnProperty(k)) {
|
|
|
|
module.exports[k] = errors[k];
|
|
|
|
}
|
|
|
|
}
|