1
1
/*!
2
2
* js-data
3
- * @version 2.2.0 - Homepage <http://www.js-data.io/>
3
+ * @version 2.2.1 - Homepage <http://www.js-data.io/>
4
4
* @author Jason Dobry <jason.dobry@gmail.com>
5
5
* @copyright (c) 2014-2015 Jason Dobry
6
6
* @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>
@@ -84,10 +84,10 @@ return /******/ (function(modules) { // webpackBootstrap
84
84
return new _datastoreIndex [ 'default' ] ( options ) ;
85
85
} ,
86
86
version : {
87
- full : '2.2.0 ' ,
87
+ full : '2.2.1 ' ,
88
88
major : parseInt ( '2' , 10 ) ,
89
89
minor : parseInt ( '2' , 10 ) ,
90
- patch : parseInt ( '0 ' , 10 ) ,
90
+ patch : parseInt ( '1 ' , 10 ) ,
91
91
alpha : true ? 'false' : false ,
92
92
beta : true ? 'false' : false
93
93
}
@@ -1195,7 +1195,7 @@ return /******/ (function(modules) { // webpackBootstrap
1195
1195
} ;
1196
1196
if ( def . type === 'belongsTo' ) {
1197
1197
prop . get = function ( ) {
1198
- return this [ localKey ] ? definition . getResource ( relationName ) . get ( this [ localKey ] ) : undefined ;
1198
+ return get ( this , localKey ) ? definition . getResource ( relationName ) . get ( get ( this , localKey ) ) : undefined ;
1199
1199
} ;
1200
1200
} else if ( def . type === 'hasMany' ) {
1201
1201
prop . get = function ( ) {
@@ -1204,15 +1204,15 @@ return /******/ (function(modules) { // webpackBootstrap
1204
1204
params [ foreignKey ] = this [ definition . idAttribute ] ;
1205
1205
return definition . getResource ( relationName ) . defaultFilter . call ( store , store . s [ relationName ] . collection , relationName , params , { allowSimpleWhere : true } ) ;
1206
1206
} else if ( localKeys ) {
1207
- var keys = this [ localKeys ] || [ ] ;
1207
+ var keys = get ( this , localKeys ) || [ ] ;
1208
1208
return definition . getResource ( relationName ) . getAll ( isArray ( keys ) ? keys : _keys ( keys ) ) ;
1209
1209
}
1210
1210
return undefined ;
1211
1211
} ;
1212
1212
} else if ( def . type === 'hasOne' ) {
1213
1213
if ( localKey ) {
1214
1214
prop . get = function ( ) {
1215
- return this [ localKey ] ? definition . getResource ( relationName ) . get ( this [ localKey ] ) : undefined ;
1215
+ return get ( this , localKey ) ? definition . getResource ( relationName ) . get ( get ( this , localKey ) ) : undefined ;
1216
1216
} ;
1217
1217
} else {
1218
1218
prop . get = function ( ) {
@@ -2769,8 +2769,8 @@ return /******/ (function(modules) { // webpackBootstrap
2769
2769
/* 13 */
2770
2770
/***/ function ( module , exports , __webpack_require__ ) {
2771
2771
2772
- var hasOwn = __webpack_require__ ( 22 ) ;
2773
- var forIn = __webpack_require__ ( 23 ) ;
2772
+ var hasOwn = __webpack_require__ ( 23 ) ;
2773
+ var forIn = __webpack_require__ ( 24 ) ;
2774
2774
2775
2775
/**
2776
2776
* Similar to Array/forEach but works over object properties and fixes Don't
@@ -2795,7 +2795,7 @@ return /******/ (function(modules) { // webpackBootstrap
2795
2795
/***/ function ( module , exports , __webpack_require__ ) {
2796
2796
2797
2797
var forOwn = __webpack_require__ ( 13 ) ;
2798
- var isPlainObject = __webpack_require__ ( 24 ) ;
2798
+ var isPlainObject = __webpack_require__ ( 22 ) ;
2799
2799
2800
2800
/**
2801
2801
* Mixes objects into the target object, recursively mixing existing child
@@ -2906,7 +2906,7 @@ return /******/ (function(modules) { // webpackBootstrap
2906
2906
/* 18 */
2907
2907
/***/ function ( module , exports , __webpack_require__ ) {
2908
2908
2909
- var namespace = __webpack_require__ ( 26 ) ;
2909
+ var namespace = __webpack_require__ ( 28 ) ;
2910
2910
2911
2911
/**
2912
2912
* set "nested" object property
@@ -2929,8 +2929,8 @@ return /******/ (function(modules) { // webpackBootstrap
2929
2929
/* 19 */
2930
2930
/***/ function ( module , exports , __webpack_require__ ) {
2931
2931
2932
- var toString = __webpack_require__ ( 27 ) ;
2933
- var camelCase = __webpack_require__ ( 28 ) ;
2932
+ var toString = __webpack_require__ ( 26 ) ;
2933
+ var camelCase = __webpack_require__ ( 27 ) ;
2934
2934
var upperCase = __webpack_require__ ( 20 ) ;
2935
2935
/**
2936
2936
* camelCase + UPPERCASE first char
@@ -2948,7 +2948,7 @@ return /******/ (function(modules) { // webpackBootstrap
2948
2948
/* 20 */
2949
2949
/***/ function ( module , exports , __webpack_require__ ) {
2950
2950
2951
- var toString = __webpack_require__ ( 27 ) ;
2951
+ var toString = __webpack_require__ ( 26 ) ;
2952
2952
/**
2953
2953
* "Safer" String.toUpperCase()
2954
2954
*/
@@ -3000,6 +3000,25 @@ return /******/ (function(modules) { // webpackBootstrap
3000
3000
3001
3001
3002
3002
3003
+ /**
3004
+ * Checks if the value is created by the `Object` constructor.
3005
+ */
3006
+ function isPlainObject ( value ) {
3007
+ return ( ! ! value && typeof value === 'object' &&
3008
+ value . constructor === Object ) ;
3009
+ }
3010
+
3011
+ module . exports = isPlainObject ;
3012
+
3013
+
3014
+
3015
+
3016
+ /***/ } ,
3017
+ /* 23 */
3018
+ /***/ function ( module , exports , __webpack_require__ ) {
3019
+
3020
+
3021
+
3003
3022
/**
3004
3023
* Safer Object.hasOwnProperty
3005
3024
*/
@@ -3013,10 +3032,10 @@ return /******/ (function(modules) { // webpackBootstrap
3013
3032
3014
3033
3015
3034
/***/ } ,
3016
- /* 23 */
3035
+ /* 24 */
3017
3036
/***/ function ( module , exports , __webpack_require__ ) {
3018
3037
3019
- var hasOwn = __webpack_require__ ( 22 ) ;
3038
+ var hasOwn = __webpack_require__ ( 23 ) ;
3020
3039
3021
3040
var _hasDontEnumBug ,
3022
3041
_dontEnums ;
@@ -3094,25 +3113,6 @@ return /******/ (function(modules) { // webpackBootstrap
3094
3113
3095
3114
3096
3115
3097
- /***/ } ,
3098
- /* 24 */
3099
- /***/ function ( module , exports , __webpack_require__ ) {
3100
-
3101
-
3102
-
3103
- /**
3104
- * Checks if the value is created by the `Object` constructor.
3105
- */
3106
- function isPlainObject ( value ) {
3107
- return ( ! ! value && typeof value === 'object' &&
3108
- value . constructor === Object ) ;
3109
- }
3110
-
3111
- module . exports = isPlainObject ;
3112
-
3113
-
3114
-
3115
-
3116
3116
/***/ } ,
3117
3117
/* 25 */
3118
3118
/***/ function ( module , exports , __webpack_require__ ) {
@@ -3144,31 +3144,6 @@ return /******/ (function(modules) { // webpackBootstrap
3144
3144
/* 26 */
3145
3145
/***/ function ( module , exports , __webpack_require__ ) {
3146
3146
3147
- var forEach = __webpack_require__ ( 8 ) ;
3148
-
3149
- /**
3150
- * Create nested object if non-existent
3151
- */
3152
- function namespace ( obj , path ) {
3153
- if ( ! path ) return obj ;
3154
- forEach ( path . split ( '.' ) , function ( key ) {
3155
- if ( ! obj [ key ] ) {
3156
- obj [ key ] = { } ;
3157
- }
3158
- obj = obj [ key ] ;
3159
- } ) ;
3160
- return obj ;
3161
- }
3162
-
3163
- module . exports = namespace ;
3164
-
3165
-
3166
-
3167
-
3168
- /***/ } ,
3169
- /* 27 */
3170
- /***/ function ( module , exports , __webpack_require__ ) {
3171
-
3172
3147
3173
3148
3174
3149
/**
@@ -3185,10 +3160,10 @@ return /******/ (function(modules) { // webpackBootstrap
3185
3160
3186
3161
3187
3162
/***/ } ,
3188
- /* 28 */
3163
+ /* 27 */
3189
3164
/***/ function ( module , exports , __webpack_require__ ) {
3190
3165
3191
- var toString = __webpack_require__ ( 27 ) ;
3166
+ var toString = __webpack_require__ ( 26 ) ;
3192
3167
var replaceAccents = __webpack_require__ ( 44 ) ;
3193
3168
var removeNonWord = __webpack_require__ ( 45 ) ;
3194
3169
var upperCase = __webpack_require__ ( 20 ) ;
@@ -3210,6 +3185,31 @@ return /******/ (function(modules) { // webpackBootstrap
3210
3185
3211
3186
3212
3187
3188
+ /***/ } ,
3189
+ /* 28 */
3190
+ /***/ function ( module , exports , __webpack_require__ ) {
3191
+
3192
+ var forEach = __webpack_require__ ( 8 ) ;
3193
+
3194
+ /**
3195
+ * Create nested object if non-existent
3196
+ */
3197
+ function namespace ( obj , path ) {
3198
+ if ( ! path ) return obj ;
3199
+ forEach ( path . split ( '.' ) , function ( key ) {
3200
+ if ( ! obj [ key ] ) {
3201
+ obj [ key ] = { } ;
3202
+ }
3203
+ obj = obj [ key ] ;
3204
+ } ) ;
3205
+ return obj ;
3206
+ }
3207
+
3208
+ module . exports = namespace ;
3209
+
3210
+
3211
+
3212
+
3213
3213
/***/ } ,
3214
3214
/* 29 */
3215
3215
/***/ function ( module , exports , __webpack_require__ ) {
@@ -3992,7 +3992,7 @@ return /******/ (function(modules) { // webpackBootstrap
3992
3992
try {
3993
3993
var injectedItem = relationDef . inject ( toInjectItem , options . orig ( ) ) ;
3994
3994
if ( def . foreignKey ) {
3995
- injectedItem [ def . foreignKey ] = attrs [ definition . idAttribute ] ;
3995
+ _utils [ 'default' ] . set ( injectedItem , def . foreignKey , attrs [ definition . idAttribute ] ) ;
3996
3996
}
3997
3997
items . push ( injectedItem ) ;
3998
3998
} catch ( err ) {
@@ -4007,7 +4007,7 @@ return /******/ (function(modules) { // webpackBootstrap
4007
4007
try {
4008
4008
var _injected = relationDef . inject ( attrs [ def . localField ] , options . orig ( ) ) ;
4009
4009
if ( def . foreignKey ) {
4010
- _injected [ def . foreignKey ] = attrs [ definition . idAttribute ] ;
4010
+ _utils [ 'default' ] . set ( _injected , def . foreignKey , attrs [ definition . idAttribute ] ) ;
4011
4011
}
4012
4012
} catch ( err ) {
4013
4013
options . errorFn ( err , 'Failed to inject ' + def . type + ' relation: "' + relationName + '"!' ) ;
@@ -4722,7 +4722,7 @@ return /******/ (function(modules) { // webpackBootstrap
4722
4722
var orig = __options . orig ( ) ;
4723
4723
if ( def . localKeys ) {
4724
4724
delete params [ def . foreignKey ] ;
4725
- var keys = instance [ def . localKeys ] || [ ] ;
4725
+ var keys = DSUtils . get ( instance , def . localKeys ) || [ ] ;
4726
4726
keys = DSUtils . _a ( keys ) ? keys : DSUtils . keys ( keys ) ;
4727
4727
params . where = _defineProperty ( { } , relationDef . idAttribute , {
4728
4728
'in' : keys
@@ -4731,15 +4731,15 @@ return /******/ (function(modules) { // webpackBootstrap
4731
4731
}
4732
4732
task = relationDef . findAll ( params , orig ) ;
4733
4733
} else if ( def . type === 'hasOne' ) {
4734
- if ( def . localKey && instance [ def . localKey ] ) {
4735
- task = relationDef . find ( instance [ def . localKey ] , __options . orig ( ) ) ;
4734
+ if ( def . localKey && DSUtils . get ( instance , def . localKey ) ) {
4735
+ task = relationDef . find ( DSUtils . get ( instance , def . localKey ) , __options . orig ( ) ) ;
4736
4736
} else if ( def . foreignKey ) {
4737
4737
task = relationDef . findAll ( params , __options . orig ( ) ) . then ( function ( hasOnes ) {
4738
4738
return hasOnes . length ? hasOnes [ 0 ] : null ;
4739
4739
} ) ;
4740
4740
}
4741
- } else if ( instance [ def . localKey ] ) {
4742
- task = relationDef . find ( instance [ def . localKey ] , __options . orig ( ) ) ;
4741
+ } else if ( DSUtils . get ( instance , def . localKey ) ) {
4742
+ task = relationDef . find ( DSUtils . get ( instance , def . localKey ) , __options . orig ( ) ) ;
4743
4743
}
4744
4744
4745
4745
if ( task ) {
@@ -5122,7 +5122,7 @@ return /******/ (function(modules) { // webpackBootstrap
5122
5122
/* 44 */
5123
5123
/***/ function ( module , exports , __webpack_require__ ) {
5124
5124
5125
- var toString = __webpack_require__ ( 27 ) ;
5125
+ var toString = __webpack_require__ ( 26 ) ;
5126
5126
/**
5127
5127
* Replaces all accented chars with regular ones
5128
5128
*/
@@ -5164,7 +5164,7 @@ return /******/ (function(modules) { // webpackBootstrap
5164
5164
/* 45 */
5165
5165
/***/ function ( module , exports , __webpack_require__ ) {
5166
5166
5167
- var toString = __webpack_require__ ( 27 ) ;
5167
+ var toString = __webpack_require__ ( 26 ) ;
5168
5168
// This pattern is generated by the _build/pattern-removeNonWord.js script
5169
5169
var PATTERN = / [ ^ \x20 \x2D 0 - 9 A - Z \x5F a - z \xC0 - \xD6 \xD8 - \xF6 \xF8 - \xFF ] / g;
5170
5170
@@ -5184,7 +5184,7 @@ return /******/ (function(modules) { // webpackBootstrap
5184
5184
/* 46 */
5185
5185
/***/ function ( module , exports , __webpack_require__ ) {
5186
5186
5187
5224
code>
- var toString = __webpack_require__ ( 27 ) ;
5187
+ var toString = __webpack_require__ ( 26 ) ;
5188
5188
/**
5189
5189
* "Safer" String.toLowerCase()
5190
5190
*/
0 commit comments