forked from noppoMan/npdynamodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (30 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
var _ = require('lodash');
exports.version = require('./package.json').version;
exports.createClient = require('./lib/npdynamodb');
exports.define = require('./lib/orm/index');
exports.Migrator = require('./lib/migrate/migrator');
var QueryBuilder = require('./lib/query_builder'),
Collection = require('./lib/orm/collection'),
Model = require('./lib/orm/model')
;
[QueryBuilder, Collection, Model].forEach(function(Klass){
Klass.extend = function(protoProps, staticProps){
_.extend(Klass.prototype, protoProps || {});
_.extend(Klass, staticProps || {});
};
});
exports.plugin = function(pluginFn){
if(typeof pluginFn !== 'function') {
throw new Error('The plugin must be function.');
}
pluginFn({
QueryBuilder: QueryBuilder,
Collection: Collection,
Model: Model
});
};
/******* TODO Will be duplicated in 0.3.x *******/
exports.Collection = require('./lib/orm/collection');
exports.Model = require('./lib/orm/model');
/******* TODO Will be duplicated in 0.3.x *******/