@@ -4860,7 +4860,7 @@ function DSProvider() {
4860
4860
4861
4861
module . exports = DSProvider ;
4862
4862
4863
- } , { "./async_methods" :61 , "./sync_methods" :81 } ] , 68 :[ function ( require , module , exports ) {
4863
+ } , { "./async_methods" :61 , "./sync_methods" :82 } ] , 68 :[ function ( require , module , exports ) {
4864
4864
function errorPrefix ( resourceName ) {
4865
4865
return 'DS.bindAll(scope, expr, ' + resourceName + ', params[, cb]): ' ;
4866
4866
}
@@ -6127,6 +6127,65 @@ function get(resourceName, id, options) {
6127
6127
module . exports = get ;
6128
6128
6129
6129
} , { } ] , 80 :[ function ( require , module , exports ) {
6130
+ function errorPrefix ( resourceName ) {
6131
+ return 'DS.getAll(' + resourceName + '[, ids]): ' ;
6132
+ }
6133
+
6134
+ /**
6135
+ * @doc method
6136
+ * @id DS.sync methods:getAll
6137
+ * @name getAll
6138
+ * @description
6139
+ * Synchronously return all of the resource.
6140
+ *
6141
+ * ## Signature:
6142
+ * ```js
6143
+ * DS.getAll(resourceName[, ids])
6144
+ * ```
6145
+ *
6146
+ * ## Example:
6147
+ *
6148
+ * ```js
6149
+ * DS.getAll('document'); // [{ author: 'John Anderson', id: 5 }]
6150
+ * ```
6151
+ *
6152
+ * ## Throws
6153
+ *
6154
+ * - `{IllegalArgumentError}`
6155
+ * - `{NonexistentResourceError}`
6156
+ *
6157
+ * @param {string } resourceName The resource type, e.g. 'user', 'comment', etc.
6158
+ * @param {array } ids Optional list of primary keys to filter the array of results by.
6159
+ *
6160
+ * @returns {array } The items of the type specified by `resourceName`.
6161
+ */
6162
+ function getAll ( resourceName , ids ) {
6163
+ var DS = this ;
6164
+ var IA = DS . errors . IA ;
6165
+ var resource ;
6166
+ var collection = [ ] ;
6167
+
6168
+ if ( ! DS . definitions [ resourceName ] ) {
6169
+ throw new DS . errors . NER ( errorPrefix ( resourceName ) + resourceName ) ;
6170
+ } else if ( arguments . length === 2 && ! DS . utils . isArray ( ids ) ) {
6171
+ throw new IA ( errorPrefix ( resourceName , ids ) + 'ids: Must be an array!' ) ;
6172
+ }
6173
+
6174
+ resource = DS . store [ resourceName ] ;
6175
+
6176
+ if ( DS . utils . isArray ( ids ) ) {
6177
+ for ( var i = 0 ; i < ids . length ; i ++ ) {
6178
+ collection . push ( resource . index . get ( ids [ i ] ) ) ;
6179
+ }
6180
+ } else {
6181
+ collection = resource . collection . slice ( ) ;
6182
+ }
6183
+
6184
+ return collection ;
6185
+ }
6186
+
6187
+ module . exports = getAll ;
6188
+ } , { } ] , 81 :[ function ( require , module , exports ) {
6130
6189
function errorPrefix ( resourceName , id ) {
6131
6190
return 'DS.hasChanges(' + resourceName + ', ' + id + '): ' ;
6132
6191
}
@@ -6191,7 +6250,7 @@ function hasChanges(resourceName, id) {
6191
6250
6192
6251
module . exports = hasChanges ;
6193
6252
6194
- } , { } ] , 81 :[ function ( require , module , exports ) {
6253
+ } , { } ] , 82 :[ function ( require , module , exports ) {
6195
6254
module . exports = {
6196
6255
6197
6256
/**
@@ -6314,6 +6373,16 @@ module.exports = {
6314
6373
*/
6315
6374
get : require ( './get' ) ,
6316
6375
6376
+ /**
6377
+ * @doc method
6378
+ * @id DS.sync methods:getAll
6379
+ * @name getAll
6380
+ * @methodOf DS
6381
+ * @description
6382
+ * See [DS.getAll](/documentation/api/api/DS.sync methods:getAll).
6383
+ */
6384
+ getAll : require ( './getAll' ) ,
6385
+
6317
6386
/**
6318
6387
* @doc method
6319
6388
* @id DS.sync methods:hasChanges
@@ -6405,7 +6474,7 @@ module.exports = {
6405
6474
unlinkInverse : require ( './unlinkInverse' )
6406
6475
} ;
6407
6476
6408
- } , { "./bindAll" :68 , "./bindOne" :69 , "./changeHistory" :70 , "./changes" :71 , "./compute" :72 , "./createInstance" :73 , "./defineResource" :74 , "./digest" :75 , "./eject" :76 , "./ejectAll" :77 , "./filter" :78 , "./get" :79 , "./hasChanges " :80 , "./inject" :82 , "./lastModified" :83 , "./lastSaved" :84 , "./link" :85 , "./linkAll" :86 , "./linkInverse" :87 , "./previous" :88 , "./unlinkInverse" :89 } ] , 82 :[ function ( require , module , exports ) {
6477
+ } , { "./bindAll" :68 , "./bindOne" :69 , "./changeHistory" :70 , "./changes" :71 , "./compute" :72 , "./createInstance" :73 , "./defineResource" :74 , "./digest" :75 , "./eject" :76 , "./ejectAll" :77 , "./filter" :78 , "./get" :79 , "./getAll " :80 , "./hasChanges" : 81 , "./ inject" :83 , "./lastModified" :84 , "./lastSaved" :85 , "./link" :86 , "./linkAll" :87 , "./linkInverse" :88 , "./previous" :89 , "./unlinkInverse" :90 } ] , 83 :[ function ( require , module , exports ) {
6409
6478
var observe = require ( '../../../lib/observe-js/observe-js' ) ;
6410
6479
var _compute = require ( './compute' ) . _compute ;
6411
6480
@@ -6714,7 +6783,7 @@ function inject(resourceName, attrs, options) {
6714
6783
6715
6784
module . exports = inject ;
6716
6785
6717
- } , { "../../../lib/observe-js/observe-js" :1 , "./compute" :72 } ] , 83 :[ function ( require , module , exports ) {
6786
+ } , { "../../../lib/observe-js/observe-js" :1 , "./compute" :72 } ] , 84 :[ function ( require , module , exports ) {
6718
6787
function errorPrefix ( resourceName , id ) {
6719
6788
return 'DS.lastModified(' + resourceName + '[, ' + id + ']): ' ;
6720
6789
}
@@ -6773,7 +6842,7 @@ function lastModified(resourceName, id) {
6773
6842
6774
6843
module . exports = lastModified ;
6775
6844
6776
- } , { } ] , 84 :[ function ( require , module , exports ) {
6845
+ } , { } ] , 85 :[ function ( require , module , exports ) {
6777
6846
function errorPrefix ( resourceName , id ) {
6778
6847
return 'DS.lastSaved(' + resourceName + '[, ' + id + ']): ' ;
6779
6848
}
@@ -6837,7 +6906,7 @@ function lastSaved(resourceName, id) {
6837
6906
6838
6907
module . exports = lastSaved ;
6839
6908
6840
- } , { } ] , 85 :[ function ( require , module , exports ) {
6909
+ } , { } ] , 86 :[ function ( require , module , exports ) {
6841
6910
function errorPrefix ( resourceName ) {
6842
6911
return 'DS.link(' + resourceName + ', id[, relations]): ' ;
6843
6912
}
@@ -6939,7 +7008,7 @@ function link(resourceName, id, relations) {
6939
7008
6940
7009
module . exports = link ;
6941
7010
6942
- } , { } ] , 86 :[ function ( require , module , exports ) {
7011
+ } , { } ] , 87 :[ function ( require , module , exports ) {
6943
7012
function errorPrefix ( resourceName ) {
6944
7013
return 'DS.linkAll(' + resourceName + '[, params][, relations]): ' ;
6945
7014
}
@@ -7056,7 +7125,7 @@ function linkAll(resourceName, params, relations) {
7056
7125
7057
7126
module . exports = linkAll ;
7058
7127
7059
- } , { } ] , 87 :[ function ( require , module , exports ) {
7128
+ } , { } ] , 88 :[ function ( require , module , exports ) {
7060
7129
function errorPrefix ( resourceName ) {
7061
7130
return 'DS.linkInverse(' + resourceName + ', id[, relations]): ' ;
7062
7131
}
@@ -7154,7 +7223,7 @@ function linkInverse(resourceName, id, relations) {
7154
7223
7155
7224
module . exports = linkInverse ;
7156
7225
7157
- } , { } ] , 88 :[ function ( require , module , exports ) {
7226
+ } , { } ] , 89 :[ function ( require , module , exports ) {
7158
7227
function errorPrefix ( resourceName , id ) {
7159
7228
return 'DS.previous(' + resourceName + '[, ' + id + ']): ' ;
7160
7229
}
@@ -7211,7 +7280,7 @@ function previous(resourceName, id) {
7211
7280
7212
7281
module . exports = previous ;
7213
7282
7214
- } , { } ] , 89 :[ function ( require , module , exports ) {
7283
+ } , { } ] , 90 :[ function ( require , module , exports ) {
7215
7284
function errorPrefix ( resourceName ) {
7216
7285
return 'DS.unlinkInverse(' + resourceName + ', id[, relations]): ' ;
7217
7286
}
@@ -7312,7 +7381,7 @@ function unlinkInverse(resourceName, id, relations) {
7312
7381
7313
7382
module . exports = unlinkInverse ;
7314
7383
7315
- } , { } ] , 90 :[ function ( require , module , exports ) {
7384
+ } , { } ] , 91 :[ function ( require , module , exports ) {
7316
7385
/**
7317
7386
* @doc function
7318
7387
* @id errors.types:IllegalArgumentError
@@ -7445,7 +7514,7 @@ module.exports = [function () {
7445
7514
} ;
7446
7515
} ] ;
7447
7516
7448
- } , { } ] , 91 :[ function ( require , module , exports ) {
7517
+ } , { } ] , 92 :[ function ( require , module , exports ) {
7449
7518
( function ( window , angular , undefined ) {
7450
7519
'use strict' ;
7451
7520
@@ -7534,7 +7603,7 @@ module.exports = [function () {
7534
7603
7535
7604
} ) ( window , window . angular ) ;
7536
7605
7537
- } , { "./adapters/http" :54 , "./adapters/localStorage" :55 , "./datastore" :67 , "./errors" :90 , "./utils" :92 } ] , 92 :[ function ( require , module , exports ) {
7606
+ } , { "./adapters/http" :54 , "./adapters/localStorage" :55 , "./datastore" :67 , "./errors" :91 , "./utils" :93 } ] , 93 :[ function ( require , module , exports ) {
7538
7607
var DSErrors = require ( './errors' ) ;
7539
7608
7540
7609
function Events ( target ) {
@@ -7747,4 +7816,4 @@ module.exports = ['$q', function ($q) {
7747
7816
} ;
7748
7817
} ] ;
7749
7818
7750
- } , { "./errors" :90 , "mout/array/contains" :2 , "mout/array/filter" :3 , "mout/array/find" :4 , "mout/array/remove" :9 , "mout/array/slice" :10 , "mout/array/sort" :11 , "mout/array/toLookup" :12 , "mout/lang/isBoolean" :19 , "mout/lang/isEmpty" :20 , "mout/lang/isRegExp" :25 , "mout/object/deepMixIn" :31 , "mout/object/keys" :35 , "mout/object/merge" :36 , "mout/object/mixIn" :37 , "mout/object/pick" :39 , "mout/object/set" :40 , "mout/random/guid" :42 , "mout/string/makePath" :49 , "mout/string/pascalCase" :50 , "mout/string/upperCase" :53 } ] } , { } , [ 91 ] ) ;
7819
+ } , { "./errors" :91 , "mout/array/contains" :2 , "mout/array/filter" :3 , "mout/array/find" :4 , "mout/array/remove" :9 , "mout/array/slice" :10 , "mout/array/sort" :11 , "mout/array/toLookup" :12 , "mout/lang/isBoolean" :19 , "mout/lang/isEmpty" :20 , "mout/lang/isRegExp" :25 , "mout/object/deepMixIn" :31 , "mout/object/keys" :35 , "mout/object/merge" :36 , "mout/object/mixIn" :37 , "mout/object/pick" :39 , "mout/object/set" :40 , "mout/random/guid" :42 , "mout/string/makePath" :49 , "mout/string/pascalCase" :50 , "mout/string/upperCase" :53 } ] } , { } , [ 92 ] ) ;
0 commit comments