@@ -51,48 +51,25 @@ 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 _rethinkdbdash = __webpack_require__ ( 1 ) ;
59-
60- var _rethinkdbdash2 = _interopRequireDefault ( _rethinkdbdash ) ;
61-
62- var _jsData = __webpack_require__ ( 2 ) ;
63-
64- var _jsData2 = _interopRequireDefault ( _jsData ) ;
65-
66- var _moutObjectKeys = __webpack_require__ ( 3 ) ;
67-
68- var _moutObjectKeys2 = _interopRequireDefault ( _moutObjectKeys ) ;
69-
70- var _moutLangIsEmpty = __webpack_require__ ( 4 ) ;
71-
72- var _moutLangIsEmpty2 = _interopRequireDefault ( _moutLangIsEmpty ) ;
73-
74- var _moutStringUpperCase = __webpack_require__ ( 5 ) ;
75-
76- var _moutStringUpperCase2 = _interopRequireDefault ( _moutStringUpperCase ) ;
77-
78- var _moutStringUnderscore = __webpack_require__ ( 6 ) ;
79-
80- var _moutStringUnderscore2 = _interopRequireDefault ( _moutStringUnderscore ) ;
81-
82- var _moutObjectOmit = __webpack_require__ ( 7 ) ;
83-
84- var _moutObjectOmit2 = _interopRequireDefault ( _moutObjectOmit ) ;
85-
86- var DSUtils = _jsData2 [ 'default' ] . DSUtils ;
87- var P = DSUtils . Promise ;
56+ var rethinkdbdash = __webpack_require__ ( 1 ) ;
57+ var JSData = __webpack_require__ ( 2 ) ;
58+ var DSUtils = JSData . DSUtils ;
59+ var upperCase = DSUtils . upperCase ;
8860 var contains = DSUtils . contains ;
8961 var forOwn = DSUtils . forOwn ;
62+ var isEmpty = DSUtils . isEmpty ;
63+ var keys = DSUtils . keys ;
9064 var deepMixIn = DSUtils . deepMixIn ;
9165 var forEach = DSUtils . forEach ;
9266 var isObject = DSUtils . isObject ;
9367 var isArray = DSUtils . isArray ;
9468 var isString = DSUtils . isString ;
9569 var removeCircular = DSUtils . removeCircular ;
70+ var omit = DSUtils . omit ;
71+
72+ var underscore = __webpack_require__ ( 3 ) ;
9673
9774 var Defaults = function Defaults ( ) {
9875 _classCallCheck ( this , Defaults ) ;
@@ -115,7 +92,7 @@ module.exports =
11592 options = options || { } ;
11693 this . defaults = new Defaults ( ) ;
11794 deepMixIn ( this . defaults , options ) ;
118- this . r = ( 0 , _rethinkdbdash2 [ 'default' ] ) ( this . defaults ) ;
95+ this . r = rethinkdbdash ( this . defaults ) ;
11996 this . databases = { } ;
12097 this . tables = { } ;
12198 this . indices = { } ;
@@ -124,7 +101,7 @@ module.exports =
124101 _createClass ( DSRethinkDBAdapter , [ {
125102 key : 'selectTable' ,
126103 value : function selectTable ( resourceConfig , options ) {
127- return this . r . db ( options . db || this . defaults . db ) . table ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) ;
104+ return this . r . db ( options . db || this . defaults . db ) . table ( resourceConfig . table || underscore ( resourceConfig . name ) ) ;
128105 }
129106 } , {
130107 key : 'filterSequence' ,
@@ -135,7 +112,7 @@ module.exports =
135112 params . orderBy = params . orderBy || params . sort ;
136113 params . skip = params . skip || params . offset ;
137114
138- forEach ( ( 0 , _moutObjectKeys2 [ 'default' ] ) ( params ) , function ( k ) {
115+ forEach ( keys ( params ) , function ( k ) {
139116 var v = params [ k ] ;
140117 if ( ! contains ( reserved , k ) ) {
141118 if ( isObject ( v ) ) {
@@ -151,7 +128,7 @@ module.exports =
151128
152129 var query = sequence ;
153130
154- if ( ! ( 0 , _moutLangIsEmpty2 [ 'default' ] ) ( params . where ) ) {
131+ if ( ! isEmpty ( params . where ) ) {
155132 query = query . filter ( function ( row ) {
156133 var subQuery = undefined ;
157134 forOwn ( params . where , function ( criteria , field ) {
@@ -216,7 +193,7 @@ module.exports =
216193 if ( isString ( params . orderBy [ i ] ) ) {
217194 params . orderBy [ i ] = [ params . orderBy [ i ] , 'asc' ] ;
218195 }
219- query = ( 0 , _moutStringUpperCase2 [ 'default' ] ) ( params . orderBy [ i ] [ 1 ] ) === 'DESC' ? query . orderBy ( r . desc ( params . orderBy [ i ] [ 0 ] ) ) : query . orderBy ( params . orderBy [ i ] [ 0 ] ) ;
196+ query = upperCase ( params . orderBy [ i ] [ 1 ] ) === 'DESC' ? query . orderBy ( r . desc ( params . orderBy [ i ] [ 0 ] ) ) : query . orderBy ( params . orderBy [ i ] [ 0 ] ) ;
220197 }
221198 }
222199
@@ -284,23 +261,23 @@ module.exports =
284261 var models = { } ;
285262 var merge = { } ;
286263 options = options || { } ;
287- var table = resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ;
264+ var table = resourceConfig . table || underscore ( resourceConfig . name ) ;
288265 var tasks = [ this . waitForTable ( table , options ) ] ;
289266 forEach ( resourceConfig . relationList , function ( def ) {
290267 var relationName = def . relation ;
291268 var relationDef = resourceConfig . getResource ( relationName ) ;
292269 if ( ! relationDef ) {
293- throw new _jsData2 [ 'default' ] . DSErrors . NER ( relationName ) ;
270+ throw new JSData . DSErrors . NER ( relationName ) ;
294271 } else if ( ! options [ 'with' ] || ! contains ( options [ 'with' ] , relationName ) ) {
295272 return ;
296273 }
297274 if ( def . foreignKey ) {
298- tasks . push ( _this3 . waitForIndex ( relationDef . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( relationDef . name ) , def . foreignKey , options ) ) ;
275+ tasks . push ( _this3 . waitForIndex ( relationDef . table || underscore ( relationDef . name ) , def . foreignKey , options ) ) ;
299276 } else if ( def . localKey ) {
300- tasks . push ( _this3 . waitForIndex ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , def . localKey , options ) ) ;
277+ tasks . push ( _this3 . waitForIndex ( resourceConfig . table || underscore ( resourceConfig . name ) , def . localKey , options ) ) ;
301278 }
302279 } ) ;
303- return P . all ( tasks ) . then ( function ( ) {
280+ return DSUtils . Promise . all ( tasks ) . then ( function ( ) {
304281 return _this3 . r [ 'do' ] ( _this3 . r . table ( table ) . get ( id ) , function ( doc ) {
305282 forEach ( resourceConfig . relationList , function ( def ) {
306283 var relationName = def . relation ;
@@ -309,26 +286,26 @@ module.exports =
309286 return ;
310287 }
311288 if ( ! models [ relationName ] ) {
312- throw new _jsData2 [ 'default' ] . DSErrors . NER ( relationName ) ;
289+ throw new JSData . DSErrors . NER ( relationName ) ;
313290 }
314291 var localKey = def . localKey ;
315292 var localField = def . localField ;
316293 var foreignKey = def . foreignKey ;
317294 if ( def . type === 'belongsTo' ) {
318- merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) . get ( doc ( localKey ) [ 'default' ] ( '' ) ) ;
295+ merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) . get ( doc ( localKey ) [ 'default' ] ( '' ) ) ;
319296 newModels [ localField ] = {
320297 modelName : relationName ,
321298 relation : 'belongsTo'
322299 } ;
323300 } else if ( def . type === 'hasMany' ) {
324- merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) . getAll ( id , { index : foreignKey } ) . coerceTo ( 'ARRAY' ) ;
301+ merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) . getAll ( id , { index : foreignKey } ) . coerceTo ( 'ARRAY' ) ;
325302
326303 newModels [ localField ] = {
327304 modelName : relationName ,
328305 relation : 'hasMany'
329306 } ;
330307 } else if ( def . type === 'hasOne' ) {
331- merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) ;
308+ merge [ localField ] = _this3 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) ;
332309
333310 if ( localKey ) {
334311 merge [ localField ] = merge [ localField ] . get ( localKey ) ;
@@ -343,14 +320,14 @@ module.exports =
343320 }
344321 } ) ;
345322
346- if ( ! ( 0 , _moutLangIsEmpty2 [ 'default' ] ) ( merge ) ) {
323+ if ( ! isEmpty ( merge ) ) {
347324 return doc . merge ( merge ) ;
348325 }
349326 return doc ;
350327 } ) . run ( ) ;
351328 } ) . then ( function ( item ) {
352329 if ( ! item ) {
353- return P . reject ( new Error ( 'Not Found!' ) ) ;
330+ return DSUtils . Promise . reject ( new Error ( 'Not Found!' ) ) ;
354331 } else {
355332 forOwn ( item , function ( localValue , localKey ) {
356333 if ( localKey in newModels ) {
@@ -375,7 +352,7 @@ module.exports =
375352 var _this4 = this ;
376353
377354 options = options || { } ;
378- var table = resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ;
355+ var table = resourceConfig . table || underscore ( resourceConfig . name ) ;
379356 var tasks = [ this . waitForTable ( table , options ) ] ;
380357 var models = { } ;
381358 var merge = { } ;
@@ -384,17 +361,17 @@ module.exports =
384361 var relationName = def . relation ;
385362 var relationDef = resourceConfig . getResource ( relationName ) ;
386363 if ( ! relationDef ) {
387- throw new _jsData2 [ 'default' ] . DSErrors . NER ( relationName ) ;
364+ throw new JSData . DSErrors . NER ( relationName ) ;
388365 } else if ( ! options [ 'with' ] || ! contains ( options [ 'with' ] , relationName ) ) {
389366 return ;
390367 }
391368 if ( def . foreignKey ) {
392- tasks . push ( _this4 . waitForIndex ( relationDef . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( relationDef . name ) , def . foreignKey , options ) ) ;
369+ tasks . push ( _this4 . waitForIndex ( relationDef . table || underscore ( relationDef . name ) , def . foreignKey , options ) ) ;
393370 } else if ( def . localKey ) {
394- tasks . push ( _this4 . waitForIndex ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , def . localKey , options ) ) ;
371+ tasks . push ( _this4 . waitForIndex ( resourceConfig . table || underscore ( resourceConfig . name ) , def . localKey , options ) ) ;
395372 }
396373 } ) ;
397- return P . all ( tasks ) . then ( function ( ) {
374+ return DSUtils . Promise . all ( tasks ) . then ( function ( ) {
398375 var query = _this4 . filterSequence ( _this4 . selectTable ( resourceConfig , options ) , params ) ;
399376 if ( options [ 'with' ] && options [ 'with' ] . length ) {
400377 query = query . map ( function ( doc ) {
@@ -406,26 +383,26 @@ module.exports =
406383 return ;
407384 }
408385 if ( ! models [ relationName ] ) {
409- throw new _jsData2 [ 'default' ] . DSErrors . NER ( relationName ) ;
386+ throw new JSData . DSErrors . NER ( relationName ) ;
410387 }
411388 var localKey = def . localKey ;
412389 var localField = def . localField ;
413390 var foreignKey = def . foreignKey ;
414391 if ( def . type === 'belongsTo' ) {
415- merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) . get ( doc ( localKey ) [ 'default' ] ( '' ) ) ;
392+ merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) . get ( doc ( localKey ) [ 'default' ] ( '' ) ) ;
416393 newModels [ localField ] = {
417394 modelName : relationName ,
418395 relation : 'belongsTo'
419396 } ;
420397 } else if ( def . type === 'hasMany' ) {
421- merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) . getAll ( id , { index : foreignKey } ) . coerceTo ( 'ARRAY' ) ;
398+ merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) . getAll ( id , { index : foreignKey } ) . coerceTo ( 'ARRAY' ) ;
422399
423400 newModels [ localField ] = {
424401 modelName : relationName ,
425402 relation : 'hasMany'
426403 } ;
427404 } else if ( def . type === 'hasOne' ) {
428- merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( models [ relationName ] . name ) ) ;
405+ merge [ localField ] = _this4 . r . table ( models [ relationName ] . table || underscore ( models [ relationName ] . name ) ) ;
429406
430407 if ( localKey ) {
431408 merge [ localField ] = merge [ localField ] . get ( localKey ) ;
@@ -440,7 +417,7 @@ module.exports =
440417 }
441418 } ) ;
442419
443- if ( ! ( 0 , _moutLangIsEmpty2 [ 'default' ] ) ( merge ) ) {
420+ if ( ! isEmpty ( merge ) ) {
444421 return doc . merge ( merge ) ;
445422 }
446423 return doc ;
@@ -454,10 +431,10 @@ module.exports =
454431 value : function create ( resourceConfig , attrs , options ) {
455432 var _this5 = this ;
456433
457- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
434+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
458435 options = options || { } ;
459- return this . waitForTable ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , options ) . then ( function ( ) {
460- return _this5 . r . db ( options . db || _this5 . defaults . db ) . table ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) . insert ( attrs , { returnChanges : true } ) . run ( ) ;
436+ return this . waitForTable ( resourceConfig . table || underscore ( resourceConfig . name ) , options ) . then ( function ( ) {
437+ return _this5 . r . db ( options . db || _this5 . defaults . db ) . table ( resourceConfig . table || underscore ( resourceConfig . name ) ) . insert ( attrs , { returnChanges : true } ) . run ( ) ;
461438 } ) . then ( function ( cursor ) {
462439 return cursor . changes [ 0 ] . new_val ;
463440 } ) ;
@@ -467,10 +444,10 @@ module.exports =
467444 value : function update ( resourceConfig , id , attrs , options ) {
468445 var _this6 = this ;
469446
470- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
447+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
471448 options = options || { } ;
472- return this . waitForTable ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , options ) . then ( function ( ) {
473- return _this6 . r . db ( options . db || _this6 . defaults . db ) . table ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) . get ( id ) . update ( attrs , { returnChanges : true } ) . run ( ) ;
449+ return this . waitForTable ( resourceConfig . table || underscore ( resourceConfig . name ) , options ) . then ( function ( ) {
450+ return _this6 . r . db ( options . db || _this6 . defaults . db ) . table ( resourceConfig . table || underscore ( resourceConfig . name ) ) . get ( id ) . update ( attrs , { returnChanges : true } ) . run ( ) ;
474451 } ) . then ( function ( cursor ) {
475452 return cursor . changes [ 0 ] . new_val ;
476453 } ) ;
@@ -480,10 +457,10 @@ module.exports =
480457 value : function updateAll ( resourceConfig , attrs , params , options ) {
481458 var _this7 = this ;
482459
483- attrs = removeCircular ( ( 0 , _moutObjectOmit2 [ 'default' ] ) ( attrs , resourceConfig . relationFields || [ ] ) ) ;
460+ attrs = removeCircular ( omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
484461 options = options || { } ;
485462 params = params || { } ;
486- return this . waitForTable ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , options ) . then ( function ( ) {
463+ return this . waitForTable ( resourceConfig . table || underscore ( resourceConfig . name ) , options ) . then ( function ( ) {
487464 return _this7 . filterSequence ( _this7 . selectTable ( resourceConfig , options ) , params ) . update ( attrs , { returnChanges : true } ) . run ( ) ;
488465 } ) . then ( function ( cursor ) {
489466 var items = [ ] ;
@@ -499,8 +476,8 @@ module.exports =
499476 var _this8 = this ;
500477
501478 options = options || { } ;
502- return this . waitForTable ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , options ) . then ( function ( ) {
503- return _this8 . r . db ( options . db || _this8 . defaults . db ) . table ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) ) . get ( id ) [ 'delete' ] ( ) . run ( ) ;
479+ return this . waitForTable ( resourceConfig . table || underscore ( resourceConfig . name ) , options ) . then ( function ( ) {
480+ return _this8 . r . db ( options . db || _this8 . defaults . db ) . table ( resourceConfig . table || underscore ( resourceConfig . name ) ) . get ( id ) [ 'delete' ] ( ) . run ( ) ;
504481 } ) . then ( function ( ) {
505482 return undefined ;
506483 } ) ;
@@ -512,7 +489,7 @@ module.exports =
512489
513490 options = options || { } ;
514491 params = params || { } ;
515- return this . waitForTable ( resourceConfig . table || ( 0 , _moutStringUnderscore2 [ 'default' ] ) ( resourceConfig . name ) , options ) . then ( function ( ) {
492+ return this . waitForTable ( resourceConfig . table || underscore ( resourceConfig . name ) , options ) . then ( function ( ) {
516493 return _this9 . filterSequence ( _this9 . selectTable ( resourceConfig , options ) , params ) [ 'delete' ] ( ) . run ( ) ;
517494 } ) . then ( function ( ) {
518495 return undefined ;
@@ -540,33 +517,9 @@ module.exports =
540517
541518/***/ } ,
542519/* 3 */
543- /***/ function ( module , exports , __webpack_require__ ) {
544-
545- module . exports = require ( "mout/object/keys" ) ;
546-
547- /***/ } ,
548- /* 4 */
549- /***/ function ( module , exports , __webpack_require__ ) {
550-
551- module . exports = require ( "mout/lang/isEmpty" ) ;
552-
553- /***/ } ,
554- /* 5 */
555- /***/ function ( module , exports , __webpack_require__ ) {
556-
557- module . exports = require ( "mout/string/upperCase" ) ;
558-
559- /***/ } ,
560- /* 6 */
561520/***/ function ( module , exports , __webpack_require__ ) {
562521
563522 module . exports = require ( "mout/string/underscore" ) ;
564523
565- /***/ } ,
566- /* 7 */
567- /***/ function ( module , exports , __webpack_require__ ) {
568-
569- module . exports = require ( "mout/object/omit" ) ;
570-
571524/***/ }
572525/******/ ] ) ;
0 commit comments