-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.js
49 lines (36 loc) · 1.29 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
43
44
45
46
47
48
49
'use strict';
var _ = require('lodash');
// For Browser
if(typeof(window) === 'object') {
window.npdynamodb = exports;
window.DynamoDBDatatype = require('./node_modules/dynamodb-doc/lib/datatypes').DynamoDBDatatype;
window.DynamoDBFormatter = require('./node_modules/dynamodb-doc/lib/formatter').DynamoDBFormatter;
}
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 *******/