@@ -45,20 +45,21 @@ module.exports =
45
45
/* 0 */
46
46
/***/ function ( module , exports , __webpack_require__ ) {
47
47
48
- var _slicedToArray = ( function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ 'return' ] ) _i [ 'return' ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( 'Invalid attempt to destructure non-iterable instance' ) ; } } ; } ) ( ) ;
48
+ 'use strict' ;
49
49
50
- 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 ; } ; } ) ( ) ;
50
+ var _slicedToArray = ( function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; } } ; } ) ( ) ;
51
51
52
- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } }
52
+ 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 ; } ; } ) ( ) ;
53
+
54
+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
53
55
54
56
function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
55
57
56
58
var knex = __webpack_require__ ( 1 ) ;
57
59
var JSData = __webpack_require__ ( 2 ) ;
58
- var map = __webpack_require__ ( 3 ) ;
59
- var underscore = __webpack_require__ ( 4 ) ;
60
- var unique = __webpack_require__ ( 5 ) ;
61
- var toString = __webpack_require__ ( 6 ) ;
60
+ var underscore = __webpack_require__ ( 3 ) ;
61
+ var unique = __webpack_require__ ( 4 ) ;
62
+ var toString = __webpack_require__ ( 5 ) ;
62
63
var DSUtils = JSData . DSUtils ;
63
64
64
65
var reserved = [ 'orderBy' , 'sort' , 'limit' , 'offset' , 'skip' , 'where' ] ;
@@ -78,9 +79,9 @@ module.exports =
78
79
var relationDef = resourceConfig . getResource ( relationName ) ;
79
80
80
81
var containedName = null ;
81
- if ( DSUtils . contains ( options [ ' with' ] , relationName ) ) {
82
+ if ( DSUtils . contains ( options . with , relationName ) ) {
82
83
containedName = relationName ;
83
- } else if ( DSUtils . contains ( options [ ' with' ] , def . localField ) ) {
84
+ } else if ( DSUtils . contains ( options . with , def . localField ) ) {
84
85
containedName = def . localField ;
85
86
} else {
86
87
return ;
@@ -89,7 +90,7 @@ module.exports =
89
90
var __options = DSUtils . deepMixIn ( { } , options . orig ? options . orig ( ) : options ) ;
90
91
91
92
// Filter to only properties under current relation
92
- __options [ ' with' ] = options [ ' with' ] . filter ( function ( relation ) {
93
+ __options . with = options . with . filter ( function ( relation ) {
93
94
return relation !== containedName && relation . indexOf ( containedName ) === 0 && relation . length >= containedName . length && relation [ containedName . length ] === '.' ;
94
95
} ) . map ( function ( relation ) {
95
96
return relation . substr ( containedName . length + 1 ) ;
@@ -102,7 +103,7 @@ module.exports =
102
103
if ( instance ) {
103
104
foreignKeyFilter = { '==' : instance [ resourceConfig . idAttribute ] } ;
104
105
} else {
105
- foreignKeyFilter = { 'in' : map ( items , function ( item ) {
106
+ foreignKeyFilter = { 'in' : items . map ( function ( item ) {
106
107
return item [ resourceConfig . idAttribute ] ;
107
108
} ) } ;
108
109
}
@@ -178,7 +179,7 @@ module.exports =
178
179
} else {
179
180
task = _this . findAll ( resourceConfig . getResource ( relationName ) , {
180
181
where : _defineProperty ( { } , relationDef . idAttribute , {
181
- 'in' : DSUtils . filter ( map ( items , function ( item ) {
182
+ 'in' : DSUtils . filter ( items . map ( function ( item ) {
182
183
return DSUtils . get ( item , def . localKey ) ;
183
184
} ) , function ( x ) {
184
185
return x ;
@@ -225,7 +226,7 @@ module.exports =
225
226
226
227
var instance = undefined ;
227
228
options = options || { } ;
228
- options [ ' with' ] = options [ ' with' ] || [ ] ;
229
+ options . with = options . with || [ ] ;
229
230
var query = options && options . transaction || this . query ;
230
231
return query . select ( '*' ) . from ( getTable ( resourceConfig ) ) . where ( resourceConfig . idAttribute , toString ( id ) ) . then ( function ( rows ) {
231
232
if ( ! rows . length ) {
@@ -245,7 +246,7 @@ module.exports =
245
246
246
247
var items = null ;
247
248
options = options || { } ;
248
- options [ ' with' ] = options [ ' with' ] || [ ] ;
249
+ options . with = options . with || [ ] ;
249
250
return this . filterQuery ( resourceConfig , params , options ) . then ( function ( _items ) {
250
251
items = _items ;
251
252
return loadWithRelations . call ( _this3 , _items , resourceConfig , options ) ;
@@ -288,7 +289,7 @@ module.exports =
288
289
289
290
attrs = DSUtils . removeCircular ( DSUtils . omit ( attrs , resourceConfig . relationFields || [ ] ) ) ;
290
291
return this . filterQuery ( resourceConfig , params , options ) . then ( function ( items ) {
291
- return map ( items , function ( item ) {
292
+ return items . map ( function ( item ) {
292
293
return item [ resourceConfig . idAttribute ] ;
293
294
} ) ;
294
295
} ) . then ( function ( ids ) {
@@ -369,21 +370,21 @@ module.exports =
369
370
370
371
var relationPath = [ ] ;
371
372
372
- var _loop = function ( ) {
373
+ var _loop = function _loop ( ) {
373
374
var relationName = parts . shift ( ) ;
374
375
var relationResourceConfig = resourceConfig . getResource ( relationName ) ;
375
376
relationPath . push ( relationName ) ;
376
377
377
378
if ( ! joinedTables . some ( function ( t ) {
378
379
return t === relationPath . join ( '.' ) ;
379
380
} ) ) {
380
- var _localResourceConfig$relationList$filter = localResourceConfig . relationList . filter ( function ( r ) {
381
+ var _localResourceConfig$ = localResourceConfig . relationList . filter ( function ( r ) {
381
382
return r . relation === relationName ;
382
383
} ) ;
383
384
384
- var _localResourceConfig$relationList$filter2 = _slicedToArray ( _localResourceConfig$relationList$filter , 1 ) ;
385
+ var _localResourceConfig$2 = _slicedToArray ( _localResourceConfig$ , 1 ) ;
385
386
386
- var relation = _localResourceConfig$relationList$filter2 [ 0 ] ;
387
+ var relation = _localResourceConfig$2 [ 0 ] ;
387
388
388
389
if ( relation ) {
389
390
var _table = getTable ( localResourceConfig ) ;
@@ -501,24 +502,18 @@ module.exports =
501
502
502
503
/***/ } ,
503
504
/* 3 */
504
- /***/ function ( module , exports ) {
505
-
506
- module . exports = require ( "mout/array/map" ) ;
507
-
508
- /***/ } ,
509
- /* 4 */
510
505
/***/ function ( module , exports ) {
511
506
512
507
module . exports = require ( "mout/string/underscore" ) ;
513
508
514
509
/***/ } ,
515
- /* 5 */
510
+ /* 4 */
516
511
/***/ function ( module , exports ) {
517
512
518
513
module . exports = require ( "mout/array/unique" ) ;
519
514
520
515
/***/ } ,
521
- /* 6 */
516
+ /* 5 */
522
517
/***/ function ( module , exports ) {
523
518
524
519
module . exports = require ( "mout/lang/toString" ) ;
0 commit comments