@@ -51,39 +51,19 @@ module.exports =
5151
5252 var _createClass = ( function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( 'value' in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ) ( ) ;
5353
54- function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { 'default' : obj } ; }
55-
5654 function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } }
5755
58- var _mongodb = __webpack_require__ ( 2 ) ;
59-
60- var _bson = __webpack_require__ ( 3 ) ;
61-
62- var _jsData = __webpack_require__ ( 4 ) ;
63-
64- var _jsData2 = _interopRequireDefault ( _jsData ) ;
65-
66- var _moutStringUnderscore = __webpack_require__ ( 5 ) ;
67-
68- var _moutStringUnderscore2 = _interopRequireDefault ( _moutStringUnderscore ) ;
69-
70- var _moutObjectKeys = __webpack_require__ ( 1 ) ;
71-
72- var _moutObjectKeys2 = _interopRequireDefault ( _moutObjectKeys ) ;
73-
74- var _moutObjectOmit = __webpack_require__ ( 6 ) ;
75-
76- var _moutObjectOmit2 = _interopRequireDefault ( _moutObjectOmit ) ;
77-
78- var _moutArrayMap = __webpack_require__ ( 7 ) ;
79-
80- var _moutArrayMap2 = _interopRequireDefault ( _moutArrayMap ) ;
81-
82- var _moutLangIsEmpty = __webpack_require__ ( 8 ) ;
83-
84- var _moutLangIsEmpty2 = _interopRequireDefault ( _moutLangIsEmpty ) ;
85-
86- var DSUtils = _jsData2 [ 'default' ] . DSUtils ;
56+ var mongodb = __webpack_require__ ( 1 ) ;
57+ var MongoClient = mongodb . MongoClient ;
58+ var bson = __webpack_require__ ( 2 ) ;
59+ var ObjectID = bson . ObjectID ;
60+ var JSData = __webpack_require__ ( 3 ) ;
61+ var underscore = __webpack_require__ ( 4 ) ;
62+ var map = __webpack_require__ ( 5 ) ;
63+ var DSUtils = JSData . DSUtils ;
64+ var keys = DSUtils . keys ;
65+ var omit = DSUtils . omit ;
66+ var isEmpty = DSUtils . isEmpty ;
8767 var deepMixIn = DSUtils . deepMixIn ;
8868 var forEach = DSUtils . forEach ;
8969 var contains = DSUtils . contains ;
@@ -111,7 +91,7 @@ module.exports =
11191 this . defaults = new Defaults ( ) ;
11292 deepMixIn ( this . defaults , uri ) ;
11393 this . client = new DSUtils . Promise ( function ( resolve , reject ) {
114- _mongodb . MongoClient . connect ( uri . uri , function ( err , db ) {
94+ MongoClient . connect ( uri . uri , function ( err , db ) {
11595 return err ? reject ( err ) : resolve ( db ) ;
11696 } ) ;
11797 } ) ;
@@ -128,7 +108,7 @@ module.exports =
128108 params = params || { } ;
129109 params . where = params . where || { } ;
130110
131- forEach ( ( 0 , _moutObjectKeys2 [ 'default' ] ) ( params ) , function ( k ) {
111+ forEach ( keys ( params ) , function ( k ) {
132112 var v = params [ k ] ;
133113 if ( ! contains ( reserved , k ) ) {
134114 if ( isObject ( v ) ) {
@@ -144,7 +124,7 @@ module.exports =
144124
145125 var query = { } ;
146126
147- if ( ! ( 0 , _moutLangIsEmpty2 [ 'default' ] ) ( params . where ) ) {
127+ if ( ! isEmpty ( params . where ) ) {
148128 forOwn ( params . where , function ( criteria , field ) {
149129 if ( ! isObject ( criteria ) ) {
150130 params . where [ field ] = {
@@ -303,11 +283,11 @@ module.exports =
303283 return new DSUtils . Promise ( function ( resolve , reject ) {
304284 var params = { } ;
305285 params [ resourceConfig . idAttribute ] = id ;
306- if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && _bson . ObjectID . isValid ( id ) ) {
307- params [ resourceConfig . idAttribute ] = _bson . ObjectID . createFromHexString ( id ) ;
286+ if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && ObjectID . isValid ( id ) ) {
287+ params [ resourceConfig . idAttribute ] = ObjectID . createFromHexString ( id ) ;
308288 }
309289 options . fields = options . fields || { } ;
310- client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) . findOne ( params , options , function ( err , r ) {
290+ client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) . findOne ( params , options , function ( err , r ) {
311291 if ( err ) {
312292 reject ( err ) ;
313293 } else if ( ! r ) {
@@ -330,7 +310,7 @@ module.exports =
330310 return this . getClient ( ) . then ( function ( client ) {
331311 return new DSUtils . Promise ( function ( resolve , reject ) {
332312 options . fields = options . fields || { } ;
333- client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) . find ( query , options ) . toArray ( function ( err , r ) {
313+ client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) . find ( query , options ) . toArray ( function ( err , r ) {
334314 if ( err ) {
335315 reject ( err ) ;
336316 } else {
@@ -346,10 +326,10 @@ module.exports =
346326 var _this3 = this ;
347327
348328 options = this . origify ( options ) ;
349- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
329+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
350330 return this . getClient ( ) . then ( function ( client ) {
351331 return new DSUtils . Promise ( function ( resolve , reject ) {
352- var collection = client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
332+ var collection = client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
353333 var method = collection . insertOne ? DSUtils . isArray ( attrs ) ? 'insertMany' : 'insertOne' : 'insert' ;
354334 collection [ method ] ( attrs , options , function ( err , r ) {
355335 if ( err ) {
@@ -368,18 +348,18 @@ module.exports =
368348 value : function update ( resourceConfig , id , attrs , options ) {
369349 var _this4 = this ;
370350
371- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
351+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
372352 options = this . origify ( options ) ;
373353 return this . find ( resourceConfig , id , options ) . then ( function ( ) {
374354 return _this4 . getClient ( ) ;
375355 } ) . then ( function ( client ) {
376356 return new DSUtils . Promise ( function ( resolve , reject ) {
377357 var params = { } ;
378358 params [ resourceConfig . idAttribute ] = id ;
379- if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && _bson . ObjectID . isValid ( id ) ) {
380- params [ resourceConfig . idAttribute ] = _bson . ObjectID . createFromHexString ( id ) ;
359+ if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && ObjectID . isValid ( id ) ) {
360+ params [ resourceConfig . idAttribute ] = ObjectID . createFromHexString ( id ) ;
381361 }
382- var collection = client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
362+ var collection = client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
383363 collection [ collection . updateOne ? 'updateOne' : 'update' ] ( params , { $set : attrs } , options , function ( err ) {
384364 if ( err ) {
385365 reject ( err ) ;
@@ -398,7 +378,7 @@ module.exports =
398378 var _this5 = this ;
399379
400380 var ids = [ ] ;
401- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
381+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
402382 options = this . origify ( options ? copy ( options ) : { } ) ;
403383 var _options = copy ( options ) ;
404384 _options . multi = true ;
@@ -407,15 +387,15 @@ module.exports =
407387 queryOptions . $set = attrs ;
408388 var query = _this5 . getQuery ( resourceConfig , params ) ;
409389 return _this5 . findAll ( resourceConfig , params , options ) . then ( function ( items ) {
410- ids = ( 0 , _moutArrayMap2 [ 'default' ] ) ( items , function ( item ) {
390+ ids = map ( items , function ( item ) {
411391 var id = item [ resourceConfig . idAttribute ] ;
412- if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && _bson . ObjectID . isValid ( id ) ) {
413- return _bson . ObjectID . createFromHexString ( id ) ;
392+ if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && ObjectID . isValid ( id ) ) {
393+ return ObjectID . createFromHexString ( id ) ;
414394 }
415395 return id ;
416396 } ) ;
417397 return new DSUtils . Promise ( function ( resolve , reject ) {
418- var collection = client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
398+ var collection = client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
419399 collection [ collection . updateMany ? 'updateMany' : 'update' ] ( query , queryOptions , _options , function ( err ) {
420400 if ( err ) {
421401 reject ( err ) ;
@@ -441,10 +421,10 @@ module.exports =
441421 return new DSUtils . Promise ( function ( resolve , reject ) {
442422 var params = { } ;
443423 params [ resourceConfig . idAttribute ] = id ;
444- if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && _bson . ObjectID . isValid ( id ) ) {
445- params [ resourceConfig . idAttribute ] = _bson . ObjectID . createFromHexString ( id ) ;
424+ if ( resourceConfig . idAttribute === '_id' && typeof id === 'string' && ObjectID . isValid ( id ) ) {
425+ params [ resourceConfig . idAttribute ] = ObjectID . createFromHexString ( id ) ;
446426 }
447- var collection = client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
427+ var collection = client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
448428 collection [ collection . deleteOne ? 'deleteOne' : 'remove' ] ( params , options , function ( err ) {
449429 if ( err ) {
450430 reject ( err ) ;
@@ -465,7 +445,7 @@ module.exports =
465445 deepMixIn ( options , _this6 . getQueryOptions ( resourceConfig , params ) ) ;
466446 var query = _this6 . getQuery ( resourceConfig , params ) ;
467447 return new DSUtils . Promise ( function ( resolve , reject ) {
468- var collection = client . collection ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
448+ var collection = client . collection ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
469449 collection [ collection . deleteMany ? 'deleteMany' : 'remove' ] ( query , options , function ( err ) {
470450 if ( err ) {
471451 reject ( err ) ;
@@ -486,51 +466,33 @@ module.exports =
486466
487467/***/ } ,
488468/* 1 */
489- /***/ function ( module , exports , __webpack_require__ ) {
490-
491- module . exports = require ( "mout/object/keys" ) ;
492-
493- /***/ } ,
494- /* 2 */
495- /***/ function ( module , exports , __webpack_require__ ) {
469+ /***/ function ( module , exports ) {
496470
497471 module . exports = require ( "mongodb" ) ;
498472
499473/***/ } ,
500- /* 3 */
501- /***/ function ( module , exports , __webpack_require__ ) {
474+ /* 2 */
475+ /***/ function ( module , exports ) {
502476
503477 module . exports = require ( "bson" ) ;
504478
505479/***/ } ,
506- /* 4 */
507- /***/ function ( module , exports , __webpack_require__ ) {
480+ /* 3 */
481+ /***/ function ( module , exports ) {
508482
509483 module . exports = require ( "js-data" ) ;
510484
511485/***/ } ,
512- /* 5 */
513- /***/ function ( module , exports , __webpack_require__ ) {
486+ /* 4 */
487+ /***/ function ( module , exports ) {
514488
515489 module . exports = require ( "mout/string/underscore" ) ;
516490
517491/***/ } ,
518- /* 6 */
519- /***/ function ( module , exports , __webpack_require__ ) {
520-
521- module . exports = require ( "mout/object/omit" ) ;
522-
523- /***/ } ,
524- /* 7 */
525- /***/ function ( module , exports , __webpack_require__ ) {
492+ /* 5 */
493+ /***/ function ( module , exports ) {
526494
527495 module . exports = require ( "mout/array/map" ) ;
528496
529- /***/ } ,
530- /* 8 */
531- /***/ function ( module , exports , __webpack_require__ ) {
532-
533- module . exports = require ( "mout/lang/isEmpty" ) ;
534-
535497/***/ }
536498/******/ ] ) ;
0 commit comments