summaryrefslogtreecommitdiff
path: root/lib/dojo/store
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-08-14 18:59:10 +0400
committerAndrew Dolgov <[email protected]>2012-08-14 18:59:18 +0400
commit1354d17270961fff662d40f90521223f8fd0d73b (patch)
treee9266be71587e47c800303446e968a6d3565e2cf /lib/dojo/store
parentd04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff)
update dojo to 1.7.3
Diffstat (limited to 'lib/dojo/store')
-rw-r--r--lib/dojo/store/Cache.js148
-rw-r--r--lib/dojo/store/Cache.js.uncompressed.js148
-rw-r--r--lib/dojo/store/DataStore.js138
-rw-r--r--lib/dojo/store/DataStore.js.uncompressed.js170
-rw-r--r--lib/dojo/store/JsonRest.js142
-rw-r--r--lib/dojo/store/JsonRest.js.uncompressed.js155
-rw-r--r--lib/dojo/store/Memory.js160
-rw-r--r--lib/dojo/store/Memory.js.uncompressed.js161
-rw-r--r--lib/dojo/store/Observable.js169
-rw-r--r--lib/dojo/store/Observable.js.uncompressed.js175
-rw-r--r--lib/dojo/store/api/Store.js300
-rw-r--r--lib/dojo/store/api/Store.js.uncompressed.js297
-rw-r--r--lib/dojo/store/util/QueryResults.js63
-rw-r--r--lib/dojo/store/util/QueryResults.js.uncompressed.js64
-rw-r--r--lib/dojo/store/util/SimpleQueryEngine.js112
-rw-r--r--lib/dojo/store/util/SimpleQueryEngine.js.uncompressed.js108
16 files changed, 1294 insertions, 1216 deletions
diff --git a/lib/dojo/store/Cache.js b/lib/dojo/store/Cache.js
index d08d17099..3ca7e050e 100644
--- a/lib/dojo/store/Cache.js
+++ b/lib/dojo/store/Cache.js
@@ -4,149 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.Cache"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.Cache"] = true;
-dojo.provide("dojo.store.Cache");
-
-dojo.getObject("store", true, dojo);
-
-/*=====
-dojo.declare("dojo.store.__CacheArgs", null, {
- constructor: function(){
- // summary:
- // These are additional options for how caching is handled.
- // isLoaded: Function?
- // This is a function that will be called for each item in a query response to determine
- // if it is cacheable. If isLoaded returns true, the item will be cached, otherwise it
- // will not be cached. If isLoaded is not provided, all items will be cached.
- this.isLoaded = isLoaded;
- }
-});
-=====*/
-dojo.store.Cache = function(masterStore, cachingStore, /*dojo.store.__CacheArgs*/ options){
- // summary:
- // The Cache store wrapper takes a master store and a caching store,
- // caches data from the master into the caching store for faster
- // lookup. Normally one would use a memory store for the caching
- // store and a server store like JsonRest for the master store.
- // masterStore:
- // This is the authoritative store, all uncached requests or non-safe requests will
- // be made against this store.
- // cachingStore:
- // This is the caching store that will be used to store responses for quick access.
- // Typically this should be a local store.
- // options:
- // These are additional options for how caching is handled.
- options = options || {};
- return dojo.delegate(masterStore, {
- query: function(query, directives){
- var results = masterStore.query(query, directives);
- results.forEach(function(object){
- if(!options.isLoaded || options.isLoaded(object)){
- cachingStore.put(object);
- }
- });
- return results;
- },
- // look for a queryEngine in either store
- queryEngine: masterStore.queryEngine || cachingStore.queryEngine,
- get: function(id, directives){
- return dojo.when(cachingStore.get(id), function(result){
- return result || dojo.when(masterStore.get(id, directives), function(result){
- if(result){
- cachingStore.put(result, {id: id});
- }
- return result;
- });
- });
- },
- add: function(object, directives){
- return dojo.when(masterStore.add(object, directives), function(result){
- // now put result in cache
- return cachingStore.add(typeof result == "object" ? result : object, directives);
- });
- },
- put: function(object, directives){
- // first remove from the cache, so it is empty until we get a response from the master store
- cachingStore.remove((directives && directives.id) || this.getIdentity(object));
- return dojo.when(masterStore.put(object, directives), function(result){
- // now put result in cache
- return cachingStore.put(typeof result == "object" ? result : object, directives);
- });
- },
- remove: function(id, directives){
- return dojo.when(masterStore.remove(id, directives), function(result){
- return cachingStore.remove(id, directives);
- });
- },
- evict: function(id){
- return cachingStore.remove(id);
- }
- });
-};
-/*=====
-dojo.declare("dojo.store.Cache", null, {
- // example:
- // | var master = new dojo.store.Memory(data);
- // | var cacher = new dojo.store.Memory();
- // | var store = new dojo.store.Cache(master, cacher);
- //
- query: function(query, directives){
- // summary:
- // Query the underlying master store and cache any results.
- // query: Object|String
- // The object or string containing query information. Dependent on the query engine used.
- // directives: dojo.store.util.SimpleQueryEngine.__queryOptions?
- // An optional keyword arguments object with additional parameters describing the query.
- // returns: dojo.store.util.QueryResults
- // A QueryResults object that can be used to iterate over.
- },
- get: function(id, directives){
- // summary:
- // Get the object with the specific id.
- // id: Number
- // The identifier for the object in question.
- // directives: dojo.store.__GetOptions?
- // Any additional parameters needed to describe how the get should be performed.
- // returns: dojo.store.util.QueryResults
- // A QueryResults object.
- },
- add: function(object, directives){
- // summary:
- // Add the given object to the store.
- // object: Object
- // The object to add to the store.
- // directives: dojo.store.__AddOptions?
- // Any additional parameters needed to describe how the add should be performed.
- // returns: Number
- // The new id for the object.
- },
- put: function(object, directives){
- // summary:
- // Put the object into the store (similar to an HTTP PUT).
- // object: Object
- // The object to put to the store.
- // directives: dojo.store.__PutOptions?
- // Any additional parameters needed to describe how the put should be performed.
- // returns: Number
- // The new id for the object.
- },
- remove: function(id, directives){
- // summary:
- // Remove the object with the specific id.
- // id: Number
- // The identifier for the object in question.
- // directives: dojo.store.__RemoveOptions?
- // Any additional parameters needed to describe how the remove should be performed.
- },
- evict: function(id){
- // summary:
- // Remove the object with the given id from the underlying caching store.
- // id: Number
- // The identifier for the object in question.
- }
-});
-=====*/
-
-}
+//>>built
+define("dojo/store/Cache",["../_base/lang","../_base/Deferred"],function(_1,_2){var _3=_1.getObject("dojo.store",true);_3.Cache=function(_4,_5,_6){_6=_6||{};return _1.delegate(_4,{query:function(_7,_8){var _9=_4.query(_7,_8);_9.forEach(function(_a){if(!_6.isLoaded||_6.isLoaded(_a)){_5.put(_a);}});return _9;},queryEngine:_4.queryEngine||_5.queryEngine,get:function(id,_b){return _2.when(_5.get(id),function(_c){return _c||_2.when(_4.get(id,_b),function(_d){if(_d){_5.put(_d,{id:id});}return _d;});});},add:function(_e,_f){return _2.when(_4.add(_e,_f),function(_10){return _5.add(typeof _10=="object"?_10:_e,_f);});},put:function(_11,_12){_5.remove((_12&&_12.id)||this.getIdentity(_11));return _2.when(_4.put(_11,_12),function(_13){return _5.put(typeof _13=="object"?_13:_11,_12);});},remove:function(id,_14){return _2.when(_4.remove(id,_14),function(_15){return _5.remove(id,_14);});},evict:function(id){return _5.remove(id);}});};return _3.Cache;}); \ No newline at end of file
diff --git a/lib/dojo/store/Cache.js.uncompressed.js b/lib/dojo/store/Cache.js.uncompressed.js
new file mode 100644
index 000000000..d6951deb3
--- /dev/null
+++ b/lib/dojo/store/Cache.js.uncompressed.js
@@ -0,0 +1,148 @@
+define("dojo/store/Cache", ["../_base/lang","../_base/Deferred"
+],function(lang, Deferred) {
+ // module:
+ // dojo/store/Cache
+ // summary:
+ // TODOC
+
+var store = lang.getObject("dojo.store", true);
+
+/*=====
+dojo.declare("dojo.store.__CacheArgs", null, {
+ constructor: function(){
+ // summary:
+ // These are additional options for how caching is handled.
+ // isLoaded: Function?
+ // This is a function that will be called for each item in a query response to determine
+ // if it is cacheable. If isLoaded returns true, the item will be cached, otherwise it
+ // will not be cached. If isLoaded is not provided, all items will be cached.
+ this.isLoaded = isLoaded;
+ }
+});
+=====*/
+store.Cache = function(masterStore, cachingStore, /*dojo.store.__CacheArgs*/ options){
+ // summary:
+ // The Cache store wrapper takes a master store and a caching store,
+ // caches data from the master into the caching store for faster
+ // lookup. Normally one would use a memory store for the caching
+ // store and a server store like JsonRest for the master store.
+ // masterStore:
+ // This is the authoritative store, all uncached requests or non-safe requests will
+ // be made against this store.
+ // cachingStore:
+ // This is the caching store that will be used to store responses for quick access.
+ // Typically this should be a local store.
+ // options:
+ // These are additional options for how caching is handled.
+ options = options || {};
+ return lang.delegate(masterStore, {
+ query: function(query, directives){
+ var results = masterStore.query(query, directives);
+ results.forEach(function(object){
+ if(!options.isLoaded || options.isLoaded(object)){
+ cachingStore.put(object);
+ }
+ });
+ return results;
+ },
+ // look for a queryEngine in either store
+ queryEngine: masterStore.queryEngine || cachingStore.queryEngine,
+ get: function(id, directives){
+ return Deferred.when(cachingStore.get(id), function(result){
+ return result || Deferred.when(masterStore.get(id, directives), function(result){
+ if(result){
+ cachingStore.put(result, {id: id});
+ }
+ return result;
+ });
+ });
+ },
+ add: function(object, directives){
+ return Deferred.when(masterStore.add(object, directives), function(result){
+ // now put result in cache
+ return cachingStore.add(typeof result == "object" ? result : object, directives);
+ });
+ },
+ put: function(object, directives){
+ // first remove from the cache, so it is empty until we get a response from the master store
+ cachingStore.remove((directives && directives.id) || this.getIdentity(object));
+ return Deferred.when(masterStore.put(object, directives), function(result){
+ // now put result in cache
+ return cachingStore.put(typeof result == "object" ? result : object, directives);
+ });
+ },
+ remove: function(id, directives){
+ return Deferred.when(masterStore.remove(id, directives), function(result){
+ return cachingStore.remove(id, directives);
+ });
+ },
+ evict: function(id){
+ return cachingStore.remove(id);
+ }
+ });
+};
+/*=====
+dojo.declare("dojo.store.Cache", null, {
+ // example:
+ // | var master = new dojo.store.Memory(data);
+ // | var cacher = new dojo.store.Memory();
+ // | var store = new dojo.store.Cache(master, cacher);
+ //
+ query: function(query, directives){
+ // summary:
+ // Query the underlying master store and cache any results.
+ // query: Object|String
+ // The object or string containing query information. Dependent on the query engine used.
+ // directives: dojo.store.util.SimpleQueryEngine.__queryOptions?
+ // An optional keyword arguments object with additional parameters describing the query.
+ // returns: dojo.store.util.QueryResults
+ // A QueryResults object that can be used to iterate over.
+ },
+ get: function(id, directives){
+ // summary:
+ // Get the object with the specific id.
+ // id: Number
+ // The identifier for the object in question.
+ // directives: dojo.store.__GetOptions?
+ // Any additional parameters needed to describe how the get should be performed.
+ // returns: dojo.store.util.QueryResults
+ // A QueryResults object.
+ },
+ add: function(object, directives){
+ // summary:
+ // Add the given object to the store.
+ // object: Object
+ // The object to add to the store.
+ // directives: dojo.store.__AddOptions?
+ // Any additional parameters needed to describe how the add should be performed.
+ // returns: Number
+ // The new id for the object.
+ },
+ put: function(object, directives){
+ // summary:
+ // Put the object into the store (similar to an HTTP PUT).
+ // object: Object
+ // The object to put to the store.
+ // directives: dojo.store.__PutOptions?
+ // Any additional parameters needed to describe how the put should be performed.
+ // returns: Number
+ // The new id for the object.
+ },
+ remove: function(id, directives){
+ // summary:
+ // Remove the object with the specific id.
+ // id: Number
+ // The identifier for the object in question.
+ // directives: dojo.store.__RemoveOptions?
+ // Any additional parameters needed to describe how the remove should be performed.
+ },
+ evict: function(id){
+ // summary:
+ // Remove the object with the given id from the underlying caching store.
+ // id: Number
+ // The identifier for the object in question.
+ }
+});
+=====*/
+return store.Cache;
+});
diff --git a/lib/dojo/store/DataStore.js b/lib/dojo/store/DataStore.js
index 99c81fd5d..e65eb0e60 100644
--- a/lib/dojo/store/DataStore.js
+++ b/lib/dojo/store/DataStore.js
@@ -4,139 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.DataStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.DataStore"] = true;
-dojo.provide("dojo.store.DataStore");
-dojo.require("dojo.store.util.QueryResults");
-
-
-dojo.declare("dojo.store.DataStore", null, {
- target: "",
- constructor: function(options){
- // summary:
- // This is an adapter for using Dojo Data stores with an object store consumer.
- // You can provide a Dojo data store and use this adapter to interact with it through
- // the Dojo object store API
- // options: Object?
- // This provides any configuration information that will be mixed into the store,
- // including a reference to the Dojo data store under the property "store".
- dojo.mixin(this, options);
- },
- _objectConverter: function(callback){
- var store = this.store;
- return function(item){
- var object = {};
- var attributes = store.getAttributes(item);
- for(var i = 0; i < attributes.length; i++){
- object[attributes[i]] = store.getValue(item, attributes[i]);
- }
- return callback(object);
- };
- },
- get: function(id, options){
- // summary:
- // Retrieves an object by it's identity. This will trigger a fetchItemByIdentity
- // id: Object?
- // The identity to use to lookup the object
- var returnedObject, returnedError;
- var deferred = new dojo.Deferred();
- this.store.fetchItemByIdentity({
- identity: id,
- onItem: this._objectConverter(function(object){
- deferred.resolve(returnedObject = object);
- }),
- onError: function(error){
- deferred.reject(returnedError = error);
- }
- });
- if(returnedObject){
- // if it was returned synchronously
- return returnedObject;
- }
- if(returnedError){
- throw returnedError;
- }
- return deferred.promise;
- },
- put: function(object, options){
- // summary:
- // Stores an object by its identity.
- // object: Object
- // The object to store.
- // options: Object?
- // Additional metadata for storing the data. Includes a reference to an id
- // that the object may be stored with (i.e. { id: "foo" }).
- var id = options && typeof options.id != "undefined" || this.getIdentity(object);
- var store = this.store;
- if(typeof id == "undefined"){
- store.newItem(object);
- }else{
- store.fetchItemByIdentity({
- identity: id,
- onItem: function(item){
- if(item){
- for(var i in object){
- if(store.getValue(item, i) != object[i]){
- store.setValue(item, i, object[i]);
- }
- }
- }else{
- store.newItem(object);
- }
- }
- });
- }
- },
- remove: function(id){
- // summary:
- // Deletes an object by its identity.
- // id: Object
- // The identity to use to delete the object
- var store = this.store;
- this.store.fetchItemByIdentity({
- identity: id,
- onItem: function(item){
- store.deleteItem(item);
- }
- });
- },
- query: function(query, options){
- // summary:
- // Queries the store for objects.
- // query: Object
- // The query to use for retrieving objects from the store
- // options: Object?
- // Optional options object as used by the underlying dojo.data Store.
- // returns: dojo.store.util.QueryResults
- // A query results object that can be used to iterate over results.
- var returnedObject, returnedError;
- var deferred = new dojo.Deferred();
- deferred.total = new dojo.Deferred();
- var converter = this._objectConverter(function(object){return object;});
- this.store.fetch(dojo.mixin({
- query: query,
- onBegin: function(count){
- deferred.total.resolve(count);
- },
- onComplete: function(results){
- deferred.resolve(dojo.map(results, converter));
- },
- onError: function(error){
- deferred.reject(error);
- }
- }, options));
- return dojo.store.util.QueryResults(deferred);
- },
- getIdentity: function(object){
- // summary:
- // Fetch the identity for the given object.
- // object: Object
- // The data object to get the identity from.
- // returns: Number
- // The id of the given object.
- return object[this.idProperty || this.store.getIdentityAttributes()[0]];
- }
-});
-
-}
+//>>built
+define("dojo/store/DataStore",["../_base/lang","../_base/declare","../_base/Deferred","../_base/array","./util/QueryResults"],function(_1,_2,_3,_4,_5){return _2("dojo.store.DataStore",null,{target:"",constructor:function(_6){_1.mixin(this,_6);if(!"idProperty" in _6){var _7;try{_7=this.store.getIdentityAttributes();}catch(e){}this.idProperty=(!_7||!idAttributes[0])||this.idProperty;}var _8=this.store.getFeatures();if(!_8["dojo.data.api.Read"]){this.get=null;}if(!_8["dojo.data.api.Identity"]){this.getIdentity=null;}if(!_8["dojo.data.api.Write"]){this.put=this.add=null;}},idProperty:"id",store:null,_objectConverter:function(_9){var _a=this.store;var _b=this.idProperty;return function(_c){var _d={};var _e=_a.getAttributes(_c);for(var i=0;i<_e.length;i++){_d[_e[i]]=_a.getValue(_c,_e[i]);}if(!(_b in _d)){_d[_b]=_a.getIdentity(_c);}return _9(_d);};},get:function(id,_f){var _10,_11;var _12=new _3();this.store.fetchItemByIdentity({identity:id,onItem:this._objectConverter(function(_13){_12.resolve(_10=_13);}),onError:function(_14){_12.reject(_11=_14);}});if(_10){return _10;}if(_11){throw _11;}return _12.promise;},put:function(_15,_16){var id=_16&&typeof _16.id!="undefined"||this.getIdentity(_15);var _17=this.store;var _18=this.idProperty;if(typeof id=="undefined"){_17.newItem(_15);}else{_17.fetchItemByIdentity({identity:id,onItem:function(_19){if(_19){for(var i in _15){if(i!=_18&&_17.getValue(_19,i)!=_15[i]){_17.setValue(_19,i,_15[i]);}}}else{_17.newItem(_15);}}});}},remove:function(id){var _1a=this.store;this.store.fetchItemByIdentity({identity:id,onItem:function(_1b){_1a.deleteItem(_1b);}});},query:function(_1c,_1d){var _1e;var _1f=new _3(function(){_1e.abort&&_1e.abort();});_1f.total=new _3();var _20=this._objectConverter(function(_21){return _21;});_1e=this.store.fetch(_1.mixin({query:_1c,onBegin:function(_22){_1f.total.resolve(_22);},onComplete:function(_23){_1f.resolve(_4.map(_23,_20));},onError:function(_24){_1f.reject(_24);}},_1d));return _5(_1f);},getIdentity:function(_25){return _25[this.idProperty];}});}); \ No newline at end of file
diff --git a/lib/dojo/store/DataStore.js.uncompressed.js b/lib/dojo/store/DataStore.js.uncompressed.js
new file mode 100644
index 000000000..e2a96e316
--- /dev/null
+++ b/lib/dojo/store/DataStore.js.uncompressed.js
@@ -0,0 +1,170 @@
+define("dojo/store/DataStore", ["../_base/lang", "../_base/declare", "../_base/Deferred", "../_base/array", "./util/QueryResults"
+], function(lang,declare,Deferred,array,QueryResults) {
+ // module:
+ // dojo/store/DataStore
+ // summary:
+ // TODOC
+
+
+return declare("dojo.store.DataStore", null, {
+ target: "",
+ constructor: function(options){
+ // summary:
+ // This is an adapter for using Dojo Data stores with an object store consumer.
+ // You can provide a Dojo data store and use this adapter to interact with it through
+ // the Dojo object store API
+ // options: Object?
+ // This provides any configuration information that will be mixed into the store,
+ // including a reference to the Dojo data store under the property "store".
+ lang.mixin(this, options);
+ if(!"idProperty" in options){
+ var idAttribute;
+ try{
+ idAttribute = this.store.getIdentityAttributes();
+ }catch(e){
+ // some store are not requiring an item instance to give us the ID attributes
+ // but some other do and throw errors in that case.
+ }
+ // if no idAttribute we have implicit id
+ this.idProperty = (!idAttribute || !idAttributes[0]) || this.idProperty;
+ }
+ var features = this.store.getFeatures();
+ // check the feature set and null out any methods that shouldn't be available
+ if(!features["dojo.data.api.Read"]){
+ this.get = null;
+ }
+ if(!features["dojo.data.api.Identity"]){
+ this.getIdentity = null;
+ }
+ if(!features["dojo.data.api.Write"]){
+ this.put = this.add = null;
+ }
+ },
+ // idProperty: String
+ // The object property to use to store the identity of the store items.
+ idProperty: "id",
+ // store:
+ // The object store to convert to a data store
+ store: null,
+ _objectConverter: function(callback){
+ var store = this.store;
+ var idProperty = this.idProperty;
+ return function(item){
+ var object = {};
+ var attributes = store.getAttributes(item);
+ for(var i = 0; i < attributes.length; i++){
+ object[attributes[i]] = store.getValue(item, attributes[i]);
+ }
+ if(!(idProperty in object)){
+ object[idProperty] = store.getIdentity(item);
+ }
+ return callback(object);
+ };
+ },
+ get: function(id, options){
+ // summary:
+ // Retrieves an object by it's identity. This will trigger a fetchItemByIdentity
+ // id: Object?
+ // The identity to use to lookup the object
+ var returnedObject, returnedError;
+ var deferred = new Deferred();
+ this.store.fetchItemByIdentity({
+ identity: id,
+ onItem: this._objectConverter(function(object){
+ deferred.resolve(returnedObject = object);
+ }),
+ onError: function(error){
+ deferred.reject(returnedError = error);
+ }
+ });
+ if(returnedObject){
+ // if it was returned synchronously
+ return returnedObject;
+ }
+ if(returnedError){
+ throw returnedError;
+ }
+ return deferred.promise;
+ },
+ put: function(object, options){
+ // summary:
+ // Stores an object by its identity.
+ // object: Object
+ // The object to store.
+ // options: Object?
+ // Additional metadata for storing the data. Includes a reference to an id
+ // that the object may be stored with (i.e. { id: "foo" }).
+ var id = options && typeof options.id != "undefined" || this.getIdentity(object);
+ var store = this.store;
+ var idProperty = this.idProperty;
+ if(typeof id == "undefined"){
+ store.newItem(object);
+ }else{
+ store.fetchItemByIdentity({
+ identity: id,
+ onItem: function(item){
+ if(item){
+ for(var i in object){
+ if(i != idProperty && // don't copy id properties since they are immutable and should be omitted for implicit ids
+ store.getValue(item, i) != object[i]){
+ store.setValue(item, i, object[i]);
+ }
+ }
+ }else{
+ store.newItem(object);
+ }
+ }
+ });
+ }
+ },
+ remove: function(id){
+ // summary:
+ // Deletes an object by its identity.
+ // id: Object
+ // The identity to use to delete the object
+ var store = this.store;
+ this.store.fetchItemByIdentity({
+ identity: id,
+ onItem: function(item){
+ store.deleteItem(item);
+ }
+ });
+ },
+ query: function(query, options){
+ // summary:
+ // Queries the store for objects.
+ // query: Object
+ // The query to use for retrieving objects from the store
+ // options: Object?
+ // Optional options object as used by the underlying dojo.data Store.
+ // returns: dojo.store.util.QueryResults
+ // A query results object that can be used to iterate over results.
+ var fetchHandle;
+ var deferred = new Deferred(function(){ fetchHandle.abort && fetchHandle.abort(); });
+ deferred.total = new Deferred();
+ var converter = this._objectConverter(function(object){return object;});
+ fetchHandle = this.store.fetch(lang.mixin({
+ query: query,
+ onBegin: function(count){
+ deferred.total.resolve(count);
+ },
+ onComplete: function(results){
+ deferred.resolve(array.map(results, converter));
+ },
+ onError: function(error){
+ deferred.reject(error);
+ }
+ }, options));
+ return QueryResults(deferred);
+ },
+ getIdentity: function(object){
+ // summary:
+ // Fetch the identity for the given object.
+ // object: Object
+ // The data object to get the identity from.
+ // returns: Number
+ // The id of the given object.
+ return object[this.idProperty];
+ }
+});
+});
diff --git a/lib/dojo/store/JsonRest.js b/lib/dojo/store/JsonRest.js
index 5f9254c3e..dc00d973f 100644
--- a/lib/dojo/store/JsonRest.js
+++ b/lib/dojo/store/JsonRest.js
@@ -4,143 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.JsonRest"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.JsonRest"] = true;
-dojo.provide("dojo.store.JsonRest");
-dojo.require("dojo.store.util.QueryResults");
-
-
-dojo.declare("dojo.store.JsonRest", null, {
- constructor: function(/*dojo.store.JsonRest*/ options){
- // summary:
- // This is a basic store for RESTful communicating with a server through JSON
- // formatted data.
- // options:
- // This provides any configuration information that will be mixed into the store
- dojo.mixin(this, options);
- },
- // target: String
- // The target base URL to use for all requests to the server. This string will be
- // prepended to the id to generate the URL (relative or absolute) for requests
- // sent to the server
- target: "",
- // idProperty: String
- // Indicates the property to use as the identity property. The values of this
- // property should be unique.
- idProperty: "id",
-
- get: function(id, options){
- // summary:
- // Retrieves an object by its identity. This will trigger a GET request to the server using
- // the url `this.target + id`.
- // id: Number
- // The identity to use to lookup the object
- // returns: Object
- // The object in the store that matches the given id.
- var headers = options || {};
- headers.Accept = "application/javascript, application/json";
- return dojo.xhrGet({
- url:this.target + id,
- handleAs: "json",
- headers: headers
- });
- },
- getIdentity: function(object){
- // summary:
- // Returns an object's identity
- // object: Object
- // The object to get the identity from
- // returns: Number
- return object[this.idProperty];
- },
- put: function(object, options){
- // summary:
- // Stores an object. This will trigger a PUT request to the server
- // if the object has an id, otherwise it will trigger a POST request.
- // object: Object
- // The object to store.
- // options: dojo.store.api.Store.PutDirectives?
- // Additional metadata for storing the data. Includes an "id"
- // property if a specific id is to be used.
- // returns: Number
- options = options || {};
- var id = ("id" in options) ? options.id : this.getIdentity(object);
- var hasId = typeof id != "undefined";
- return dojo.xhr(hasId && !options.incremental ? "PUT" : "POST", {
- url: hasId ? this.target + id : this.target,
- postData: dojo.toJson(object),
- handleAs: "json",
- headers:{
- "Content-Type": "application/json",
- "If-Match": options.overwrite === true ? "*" : null,
- "If-None-Match": options.overwrite === false ? "*" : null
- }
- });
- },
- add: function(object, options){
- // summary:
- // Adds an object. This will trigger a PUT request to the server
- // if the object has an id, otherwise it will trigger a POST request.
- // object: Object
- // The object to store.
- // options: dojo.store.api.Store.PutDirectives?
- // Additional metadata for storing the data. Includes an "id"
- // property if a specific id is to be used.
- options = options || {};
- options.overwrite = false;
- return this.put(object, options);
- },
- remove: function(id){
- // summary:
- // Deletes an object by its identity. This will trigger a DELETE request to the server.
- // id: Number
- // The identity to use to delete the object
- return dojo.xhrDelete({
- url:this.target + id
- });
- },
- query: function(query, options){
- // summary:
- // Queries the store for objects. This will trigger a GET request to the server, with the
- // query added as a query string.
- // query: Object
- // The query to use for retrieving objects from the store.
- // options: dojo.store.api.Store.QueryOptions?
- // The optional arguments to apply to the resultset.
- // returns: dojo.store.api.Store.QueryResults
- // The results of the query, extended with iterative methods.
- var headers = {Accept: "application/javascript, application/json"};
- options = options || {};
-
- if(options.start >= 0 || options.count >= 0){
- headers.Range = "items=" + (options.start || '0') + '-' +
- (("count" in options && options.count != Infinity) ?
- (options.count + (options.start || 0) - 1) : '');
- }
- if(dojo.isObject(query)){
- query = dojo.objectToQuery(query);
- query = query ? "?" + query: "";
- }
- if(options && options.sort){
- query += (query ? "&" : "?") + "sort(";
- for(var i = 0; i<options.sort.length; i++){
- var sort = options.sort[i];
- query += (i > 0 ? "," : "") + (sort.descending ? '-' : '+') + encodeURIComponent(sort.attribute);
- }
- query += ")";
- }
- var results = dojo.xhrGet({
- url: this.target + (query || ""),
- handleAs: "json",
- headers: headers
- });
- results.total = results.then(function(){
- var range = results.ioArgs.xhr.getResponseHeader("Content-Range");
- return range && (range=range.match(/\/(.*)/)) && +range[1];
- });
- return dojo.store.util.QueryResults(results);
- }
-});
-
-}
+//>>built
+define("dojo/store/JsonRest",["../_base/xhr","../json","../_base/declare","./util/QueryResults"],function(_1,_2,_3,_4){return _3("dojo.store.JsonRest",null,{constructor:function(_5){_3.safeMixin(this,_5);},target:"",idProperty:"id",get:function(id,_6){var _7=_6||{};_7.Accept=this.accepts;return _1("GET",{url:this.target+id,handleAs:"json",headers:_7});},accepts:"application/javascript, application/json",getIdentity:function(_8){return _8[this.idProperty];},put:function(_9,_a){_a=_a||{};var id=("id" in _a)?_a.id:this.getIdentity(_9);var _b=typeof id!="undefined";return _1(_b&&!_a.incremental?"PUT":"POST",{url:_b?this.target+id:this.target,postData:_2.stringify(_9),handleAs:"json",headers:{"Content-Type":"application/json",Accept:this.accepts,"If-Match":_a.overwrite===true?"*":null,"If-None-Match":_a.overwrite===false?"*":null}});},add:function(_c,_d){_d=_d||{};_d.overwrite=false;return this.put(_c,_d);},remove:function(id){return _1("DELETE",{url:this.target+id});},query:function(_e,_f){var _10={Accept:this.accepts};_f=_f||{};if(_f.start>=0||_f.count>=0){_10.Range="items="+(_f.start||"0")+"-"+(("count" in _f&&_f.count!=Infinity)?(_f.count+(_f.start||0)-1):"");}if(_e&&typeof _e=="object"){_e=_1.objectToQuery(_e);_e=_e?"?"+_e:"";}if(_f&&_f.sort){var _11=this.sortParam;_e+=(_e?"&":"?")+(_11?_11+"=":"sort(");for(var i=0;i<_f.sort.length;i++){var _12=_f.sort[i];_e+=(i>0?",":"")+(_12.descending?"-":"+")+encodeURIComponent(_12.attribute);}if(!_11){_e+=")";}}var _13=_1("GET",{url:this.target+(_e||""),handleAs:"json",headers:_10});_13.total=_13.then(function(){var _14=_13.ioArgs.xhr.getResponseHeader("Content-Range");return _14&&(_14=_14.match(/\/(.*)/))&&+_14[1];});return _4(_13);}});}); \ No newline at end of file
diff --git a/lib/dojo/store/JsonRest.js.uncompressed.js b/lib/dojo/store/JsonRest.js.uncompressed.js
new file mode 100644
index 000000000..a395f907f
--- /dev/null
+++ b/lib/dojo/store/JsonRest.js.uncompressed.js
@@ -0,0 +1,155 @@
+define("dojo/store/JsonRest", ["../_base/xhr", "../json", "../_base/declare", "./util/QueryResults"
+], function(xhr, JSON, declare, QueryResults) {
+ // module:
+ // dojo/store/JsonRest
+ // summary:
+ // The module defines a JSON/REST based object store
+
+return declare("dojo.store.JsonRest", null, {
+ // summary:
+ // This is a basic store for RESTful communicating with a server through JSON
+ // formatted data. It implements dojo.store.api.Store.
+
+ constructor: function(/*dojo.store.JsonRest*/ options){
+ // summary:
+ // This is a basic store for RESTful communicating with a server through JSON
+ // formatted data.
+ // options:
+ // This provides any configuration information that will be mixed into the store
+ declare.safeMixin(this, options);
+ },
+ // target: String
+ // The target base URL to use for all requests to the server. This string will be
+ // prepended to the id to generate the URL (relative or absolute) for requests
+ // sent to the server
+ target: "",
+ // idProperty: String
+ // Indicates the property to use as the identity property. The values of this
+ // property should be unique.
+ idProperty: "id",
+ // sortParam: String
+ // The query parameter to used for holding sort information. If this is omitted, than
+ // the sort information is included in a functional query token to avoid colliding
+ // with the set of name/value pairs.
+
+ get: function(id, options){
+ // summary:
+ // Retrieves an object by its identity. This will trigger a GET request to the server using
+ // the url `this.target + id`.
+ // id: Number
+ // The identity to use to lookup the object
+ // returns: Object
+ // The object in the store that matches the given id.
+ var headers = options || {};
+ headers.Accept = this.accepts;
+ return xhr("GET", {
+ url:this.target + id,
+ handleAs: "json",
+ headers: headers
+ });
+ },
+ // accepts: String
+ // Defines the Accept header to use on HTTP requests
+ accepts: "application/javascript, application/json",
+ getIdentity: function(object){
+ // summary:
+ // Returns an object's identity
+ // object: Object
+ // The object to get the identity from
+ // returns: Number
+ return object[this.idProperty];
+ },
+ put: function(object, options){
+ // summary:
+ // Stores an object. This will trigger a PUT request to the server
+ // if the object has an id, otherwise it will trigger a POST request.
+ // object: Object
+ // The object to store.
+ // options: dojo.store.api.Store.PutDirectives?
+ // Additional metadata for storing the data. Includes an "id"
+ // property if a specific id is to be used.
+ // returns: Number
+ options = options || {};
+ var id = ("id" in options) ? options.id : this.getIdentity(object);
+ var hasId = typeof id != "undefined";
+ return xhr(hasId && !options.incremental ? "PUT" : "POST", {
+ url: hasId ? this.target + id : this.target,
+ postData: JSON.stringify(object),
+ handleAs: "json",
+ headers:{
+ "Content-Type": "application/json",
+ Accept: this.accepts,
+ "If-Match": options.overwrite === true ? "*" : null,
+ "If-None-Match": options.overwrite === false ? "*" : null
+ }
+ });
+ },
+ add: function(object, options){
+ // summary:
+ // Adds an object. This will trigger a PUT request to the server
+ // if the object has an id, otherwise it will trigger a POST request.
+ // object: Object
+ // The object to store.
+ // options: dojo.store.api.Store.PutDirectives?
+ // Additional metadata for storing the data. Includes an "id"
+ // property if a specific id is to be used.
+ options = options || {};
+ options.overwrite = false;
+ return this.put(object, options);
+ },
+ remove: function(id){
+ // summary:
+ // Deletes an object by its identity. This will trigger a DELETE request to the server.
+ // id: Number
+ // The identity to use to delete the object
+ return xhr("DELETE",{
+ url:this.target + id
+ });
+ },
+ query: function(query, options){
+ // summary:
+ // Queries the store for objects. This will trigger a GET request to the server, with the
+ // query added as a query string.
+ // query: Object
+ // The query to use for retrieving objects from the store.
+ // options: dojo.store.api.Store.QueryOptions?
+ // The optional arguments to apply to the resultset.
+ // returns: dojo.store.api.Store.QueryResults
+ // The results of the query, extended with iterative methods.
+ var headers = {Accept: this.accepts};
+ options = options || {};
+
+ if(options.start >= 0 || options.count >= 0){
+ headers.Range = "items=" + (options.start || '0') + '-' +
+ (("count" in options && options.count != Infinity) ?
+ (options.count + (options.start || 0) - 1) : '');
+ }
+ if(query && typeof query == "object"){
+ query = xhr.objectToQuery(query);
+ query = query ? "?" + query: "";
+ }
+ if(options && options.sort){
+ var sortParam = this.sortParam;
+ query += (query ? "&" : "?") + (sortParam ? sortParam + '=' : "sort(");
+ for(var i = 0; i<options.sort.length; i++){
+ var sort = options.sort[i];
+ query += (i > 0 ? "," : "") + (sort.descending ? '-' : '+') + encodeURIComponent(sort.attribute);
+ }
+ if(!sortParam){
+ query += ")";
+ }
+ }
+ var results = xhr("GET", {
+ url: this.target + (query || ""),
+ handleAs: "json",
+ headers: headers
+ });
+ results.total = results.then(function(){
+ var range = results.ioArgs.xhr.getResponseHeader("Content-Range");
+ return range && (range=range.match(/\/(.*)/)) && +range[1];
+ });
+ return QueryResults(results);
+ }
+});
+
+}); \ No newline at end of file
diff --git a/lib/dojo/store/Memory.js b/lib/dojo/store/Memory.js
index b9001cdaf..9d1b17a98 100644
--- a/lib/dojo/store/Memory.js
+++ b/lib/dojo/store/Memory.js
@@ -4,161 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.Memory"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.Memory"] = true;
-dojo.provide("dojo.store.Memory");
-dojo.require("dojo.store.util.QueryResults");
-dojo.require("dojo.store.util.SimpleQueryEngine");
-
-
-dojo.declare("dojo.store.Memory", null, {
- // summary:
- // This is a basic in-memory object store. It implements dojo.store.api.Store.
- constructor: function(/*dojo.store.Memory*/ options){
- // summary:
- // Creates a memory object store.
- // options:
- // This provides any configuration information that will be mixed into the store.
- // This should generally include the data property to provide the starting set of data.
- this.index = {};
- dojo.mixin(this, options);
- this.setData(this.data || []);
- },
- // data: Array
- // The array of all the objects in the memory store
- data:null,
-
- // idProperty: String
- // Indicates the property to use as the identity property. The values of this
- // property should be unique.
- idProperty: "id",
-
- // index: Object
- // An index of data by id
- index:null,
-
- // queryEngine: Function
- // Defines the query engine to use for querying the data store
- queryEngine: dojo.store.util.SimpleQueryEngine,
- get: function(id){
- // summary:
- // Retrieves an object by its identity
- // id: Number
- // The identity to use to lookup the object
- // returns: Object
- // The object in the store that matches the given id.
- return this.index[id];
- },
- getIdentity: function(object){
- // summary:
- // Returns an object's identity
- // object: Object
- // The object to get the identity from
- // returns: Number
- return object[this.idProperty];
- },
- put: function(object, options){
- // summary:
- // Stores an object
- // object: Object
- // The object to store.
- // options: dojo.store.api.Store.PutDirectives??
- // Additional metadata for storing the data. Includes an "id"
- // property if a specific id is to be used.
- // returns: Number
- var id = options && options.id || object[this.idProperty] || Math.random();
- this.index[id] = object;
- var data = this.data,
- idProperty = this.idProperty;
- for(var i = 0, l = data.length; i < l; i++){
- if(data[i][idProperty] == id){
- data[i] = object;
- return id;
- }
- }
- this.data.push(object);
- return id;
- },
- add: function(object, options){
- // summary:
- // Creates an object, throws an error if the object already exists
- // object: Object
- // The object to store.
- // options: dojo.store.api.Store.PutDirectives??
- // Additional metadata for storing the data. Includes an "id"
- // property if a specific id is to be used.
- // returns: Number
- if(this.index[options && options.id || object[this.idProperty]]){
- throw new Error("Object already exists");
- }
- return this.put(object, options);
- },
- remove: function(id){
- // summary:
- // Deletes an object by its identity
- // id: Number
- // The identity to use to delete the object
- delete this.index[id];
- var data = this.data,
- idProperty = this.idProperty;
- for(var i = 0, l = data.length; i < l; i++){
- if(data[i][idProperty] == id){
- data.splice(i, 1);
- return;
- }
- }
- },
- query: function(query, options){
- // summary:
- // Queries the store for objects.
- // query: Object
- // The query to use for retrieving objects from the store.
- // options: dojo.store.api.Store.QueryOptions?
- // The optional arguments to apply to the resultset.
- // returns: dojo.store.api.Store.QueryResults
- // The results of the query, extended with iterative methods.
- //
- // example:
- // Given the following store:
- //
- // | var store = new dojo.store.Memory({
- // | data: [
- // | {id: 1, name: "one", prime: false },
- // | {id: 2, name: "two", even: true, prime: true},
- // | {id: 3, name: "three", prime: true},
- // | {id: 4, name: "four", even: true, prime: false},
- // | {id: 5, name: "five", prime: true}
- // | ]
- // | });
- //
- // ...find all items where "prime" is true:
- //
- // | var results = store.query({ prime: true });
- //
- // ...or find all items where "even" is true:
- //
- // | var results = store.query({ even: true });
- return dojo.store.util.QueryResults(this.queryEngine(query, options)(this.data));
- },
- setData: function(data){
- // summary:
- // Sets the given data as the source for this store, and indexes it
- // data: Object[]
- // An array of objects to use as the source of data.
- if(data.items){
- // just for convenience with the data format IFRS expects
- this.idProperty = data.identifier;
- data = this.data = data.items;
- }else{
- this.data = data;
- }
-
- for(var i = 0, l = data.length; i < l; i++){
- var object = data[i];
- this.index[object[this.idProperty]] = object;
- }
- }
-});
-
-}
+//>>built
+define("dojo/store/Memory",["../_base/declare","./util/QueryResults","./util/SimpleQueryEngine"],function(_1,_2,_3){return _1("dojo.store.Memory",null,{constructor:function(_4){for(var i in _4){this[i]=_4[i];}this.setData(this.data||[]);},data:null,idProperty:"id",index:null,queryEngine:_3,get:function(id){return this.data[this.index[id]];},getIdentity:function(_5){return _5[this.idProperty];},put:function(_6,_7){var _8=this.data,_9=this.index,_a=this.idProperty;var id=(_7&&"id" in _7)?_7.id:_a in _6?_6[_a]:Math.random();if(id in _9){if(_7&&_7.overwrite===false){throw new Error("Object already exists");}_8[_9[id]]=_6;}else{_9[id]=_8.push(_6)-1;}return id;},add:function(_b,_c){(_c=_c||{}).overwrite=false;return this.put(_b,_c);},remove:function(id){var _d=this.index;var _e=this.data;if(id in _d){_e.splice(_d[id],1);this.setData(_e);return true;}},query:function(_f,_10){return _2(this.queryEngine(_f,_10)(this.data));},setData:function(_11){if(_11.items){this.idProperty=_11.identifier;_11=this.data=_11.items;}else{this.data=_11;}this.index={};for(var i=0,l=_11.length;i<l;i++){this.index[_11[i][this.idProperty]]=i;}}});}); \ No newline at end of file
diff --git a/lib/dojo/store/Memory.js.uncompressed.js b/lib/dojo/store/Memory.js.uncompressed.js
new file mode 100644
index 000000000..ecea859b9
--- /dev/null
+++ b/lib/dojo/store/Memory.js.uncompressed.js
@@ -0,0 +1,161 @@
+define("dojo/store/Memory", ["../_base/declare", "./util/QueryResults", "./util/SimpleQueryEngine"], function(declare, QueryResults, SimpleQueryEngine) {
+ // module:
+ // dojo/store/Memory
+ // summary:
+ // The module defines an in-memory object store.
+
+
+return declare("dojo.store.Memory", null, {
+ // summary:
+ // This is a basic in-memory object store. It implements dojo.store.api.Store.
+ constructor: function(/*dojo.store.Memory*/ options){
+ // summary:
+ // Creates a memory object store.
+ // options:
+ // This provides any configuration information that will be mixed into the store.
+ // This should generally include the data property to provide the starting set of data.
+ for(var i in options){
+ this[i] = options[i];
+ }
+ this.setData(this.data || []);
+ },
+ // data: Array
+ // The array of all the objects in the memory store
+ data:null,
+
+ // idProperty: String
+ // Indicates the property to use as the identity property. The values of this
+ // property should be unique.
+ idProperty: "id",
+
+ // index: Object
+ // An index of data indices into the data array by id
+ index:null,
+
+ // queryEngine: Function
+ // Defines the query engine to use for querying the data store
+ queryEngine: SimpleQueryEngine,
+ get: function(id){
+ // summary:
+ // Retrieves an object by its identity
+ // id: Number
+ // The identity to use to lookup the object
+ // returns: Object
+ // The object in the store that matches the given id.
+ return this.data[this.index[id]];
+ },
+ getIdentity: function(object){
+ // summary:
+ // Returns an object's identity
+ // object: Object
+ // The object to get the identity from
+ // returns: Number
+ return object[this.idProperty];
+ },
+ put: function(object, options){
+ // summary:
+ // Stores an object
+ // object: Object
+ // The object to store.
+ // options: dojo.store.api.Store.PutDirectives??
+ // Additional metadata for storing the data. Includes an "id"
+ // property if a specific id is to be used.
+ // returns: Number
+ var data = this.data,
+ index = this.index,
+ idProperty = this.idProperty;
+ var id = (options && "id" in options) ? options.id : idProperty in object ? object[idProperty] : Math.random();
+ if(id in index){
+ // object exists
+ if(options && options.overwrite === false){
+ throw new Error("Object already exists");
+ }
+ // replace the entry in data
+ data[index[id]] = object;
+ }else{
+ // add the new object
+ index[id] = data.push(object) - 1;
+ }
+ return id;
+ },
+ add: function(object, options){
+ // summary:
+ // Creates an object, throws an error if the object already exists
+ // object: Object
+ // The object to store.
+ // options: dojo.store.api.Store.PutDirectives??
+ // Additional metadata for storing the data. Includes an "id"
+ // property if a specific id is to be used.
+ // returns: Number
+ (options = options || {}).overwrite = false;
+ // call put with overwrite being false
+ return this.put(object, options);
+ },
+ remove: function(id){
+ // summary:
+ // Deletes an object by its identity
+ // id: Number
+ // The identity to use to delete the object
+ // returns: Boolean
+ // Returns true if an object was removed, falsy (undefined) if no object matched the id
+ var index = this.index;
+ var data = this.data;
+ if(id in index){
+ data.splice(index[id], 1);
+ // now we have to reindex
+ this.setData(data);
+ return true;
+ }
+ },
+ query: function(query, options){
+ // summary:
+ // Queries the store for objects.
+ // query: Object
+ // The query to use for retrieving objects from the store.
+ // options: dojo.store.api.Store.QueryOptions?
+ // The optional arguments to apply to the resultset.
+ // returns: dojo.store.api.Store.QueryResults
+ // The results of the query, extended with iterative methods.
+ //
+ // example:
+ // Given the following store:
+ //
+ // | var store = new dojo.store.Memory({
+ // | data: [
+ // | {id: 1, name: "one", prime: false },
+ // | {id: 2, name: "two", even: true, prime: true},
+ // | {id: 3, name: "three", prime: true},
+ // | {id: 4, name: "four", even: true, prime: false},
+ // | {id: 5, name: "five", prime: true}
+ // | ]
+ // | });
+ //
+ // ...find all items where "prime" is true:
+ //
+ // | var results = store.query({ prime: true });
+ //
+ // ...or find all items where "even" is true:
+ //
+ // | var results = store.query({ even: true });
+ return QueryResults(this.queryEngine(query, options)(this.data));
+ },
+ setData: function(data){
+ // summary:
+ // Sets the given data as the source for this store, and indexes it
+ // data: Object[]
+ // An array of objects to use as the source of data.
+ if(data.items){
+ // just for convenience with the data format IFRS expects
+ this.idProperty = data.identifier;
+ data = this.data = data.items;
+ }else{
+ this.data = data;
+ }
+ this.index = {};
+ for(var i = 0, l = data.length; i < l; i++){
+ this.index[data[i][this.idProperty]] = i;
+ }
+ }
+});
+
+});
diff --git a/lib/dojo/store/Observable.js b/lib/dojo/store/Observable.js
index f231e0321..a1d47cc57 100644
--- a/lib/dojo/store/Observable.js
+++ b/lib/dojo/store/Observable.js
@@ -4,170 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.Observable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.Observable"] = true;
-dojo.provide("dojo.store.Observable");
-
-dojo.getObject("store", true, dojo);
-
-dojo.store.Observable = function(store){
- // summary:
- // The Observable store wrapper takes a store and sets an observe method on query()
- // results that can be used to monitor results for changes.
- //
- // description:
- // Observable wraps an existing store so that notifications can be made when a query
- // is performed.
- //
- // example:
- // Create a Memory store that returns an observable query, and then log some
- // information about that query.
- //
- // | var store = dojo.store.Observable(new dojo.store.Memory({
- // | data: [
- // | {id: 1, name: "one", prime: false},
- // | {id: 2, name: "two", even: true, prime: true},
- // | {id: 3, name: "three", prime: true},
- // | {id: 4, name: "four", even: true, prime: false},
- // | {id: 5, name: "five", prime: true}
- // | ]
- // | }));
- // | var changes = [], results = store.query({ prime: true });
- // | var observer = results.observe(function(object, previousIndex, newIndex){
- // | changes.push({previousIndex:previousIndex, newIndex:newIndex, object:object});
- // | });
- //
- // See the Observable tests for more information.
-
- var queryUpdaters = [], revision = 0;
- // a Comet driven store could directly call notify to notify observers when data has
- // changed on the backend
- store.notify = function(object, existingId){
- revision++;
- var updaters = queryUpdaters.slice();
- for(var i = 0, l = updaters.length; i < l; i++){
- updaters[i](object, existingId);
- }
- };
- var originalQuery = store.query;
- store.query = function(query, options){
- options = options || {};
- var results = originalQuery.apply(this, arguments);
- if(results && results.forEach){
- var nonPagedOptions = dojo.mixin({}, options);
- delete nonPagedOptions.start;
- delete nonPagedOptions.count;
-
- var queryExecutor = store.queryEngine && store.queryEngine(query, nonPagedOptions);
- var queryRevision = revision;
- var listeners = [], queryUpdater;
- results.observe = function(listener, includeObjectUpdates){
- if(listeners.push(listener) == 1){
- // first listener was added, create the query checker and updater
- queryUpdaters.push(queryUpdater = function(changed, existingId){
- dojo.when(results, function(resultsArray){
- var atEnd = resultsArray.length != options.count;
- var i;
- if(++queryRevision != revision){
- throw new Error("Query is out of date, you must observe() the query prior to any data modifications");
- }
- var removedObject, removedFrom = -1, insertedInto = -1;
- if(existingId){
- // remove the old one
- for(i = 0, l = resultsArray.length; i < l; i++){
- var object = resultsArray[i];
- if(store.getIdentity(object) == existingId){
- removedObject = object;
- removedFrom = i;
- if(queryExecutor || !changed){// if it was changed and we don't have a queryExecutor, we shouldn't remove it because updated objects would be eliminated
- resultsArray.splice(i, 1);
- }
- break;
- }
- }
- }
- if(queryExecutor){
- // add the new one
- if(changed &&
- // if a matches function exists, use that (probably more efficient)
- (queryExecutor.matches ? queryExecutor.matches(changed) : queryExecutor([changed]).length)){
-
- if(removedFrom > -1){
- // put back in the original slot so it doesn't move unless it needs to (relying on a stable sort below)
- resultsArray.splice(removedFrom, 0, changed);
- }else{
- resultsArray.push(changed);
- }
- insertedInto = dojo.indexOf(queryExecutor(resultsArray), changed);
- if((options.start && insertedInto == 0) ||
- (!atEnd && insertedInto == resultsArray.length -1)){
- // if it is at the end of the page, assume it goes into the prev or next page
- insertedInto = -1;
- }
- }
- }else if(changed){
- // we don't have a queryEngine, so we can't provide any information
- // about where it was inserted, but we can at least indicate a new object
- insertedInto = removedFrom >= 0 ? removedFrom : (store.defaultIndex || 0);
- }
- if((removedFrom > -1 || insertedInto > -1) &&
- (includeObjectUpdates || !queryExecutor || (removedFrom != insertedInto))){
- var copyListeners = listeners.slice();
- for(i = 0;listener = copyListeners[i]; i++){
- listener(changed || removedObject, removedFrom, insertedInto);
- }
- }
- });
- });
- }
- return {
- cancel: function(){
- // remove this listener
- listeners.splice(dojo.indexOf(listeners, listener), 1);
- if(!listeners.length){
- // no more listeners, remove the query updater too
- queryUpdaters.splice(dojo.indexOf(queryUpdaters, queryUpdater), 1);
- }
- }
- };
- };
- }
- return results;
- };
- var inMethod;
- function whenFinished(method, action){
- var original = store[method];
- if(original){
- store[method] = function(value){
- if(inMethod){
- // if one method calls another (like add() calling put()) we don't want two events
- return original.apply(this, arguments);
- }
- inMethod = true;
- try{
- return dojo.when(original.apply(this, arguments), function(results){
- action((typeof results == "object" && results) || value);
- return results;
- });
- }finally{
- inMethod = false;
- }
- };
- }
- }
- // monitor for updates by listening to these methods
- whenFinished("put", function(object){
- store.notify(object, store.getIdentity(object));
- });
- whenFinished("add", function(object){
- store.notify(object);
- });
- whenFinished("remove", function(id){
- store.notify(undefined, id);
- });
-
- return store;
-};
-
-}
+//>>built
+define("dojo/store/Observable",["../_base/kernel","../_base/lang","../_base/Deferred","../_base/array"],function(_1,_2,_3,_4){var ds=_2.getObject("dojo.store",true);return ds.Observable=function(_5){var _6,_7=[],_8=0;_5.notify=function(_9,_a){_8++;var _b=_7.slice();for(var i=0,l=_b.length;i<l;i++){_b[i](_9,_a);}};var _c=_5.query;_5.query=function(_d,_e){_e=_e||{};var _f=_c.apply(this,arguments);if(_f&&_f.forEach){var _10=_2.mixin({},_e);delete _10.start;delete _10.count;var _11=_5.queryEngine&&_5.queryEngine(_d,_10);var _12=_8;var _13=[],_14;_f.observe=function(_15,_16){if(_13.push(_15)==1){_7.push(_14=function(_17,_18){_3.when(_f,function(_19){var _1a=_19.length!=_e.count;var i,l,_15;if(++_12!=_8){throw new Error("Query is out of date, you must observe() the query prior to any data modifications");}var _1b,_1c=-1,_1d=-1;if(_18!==_6){for(i=0,l=_19.length;i<l;i++){var _1e=_19[i];if(_5.getIdentity(_1e)==_18){_1b=_1e;_1c=i;if(_11||!_17){_19.splice(i,1);}break;}}}if(_11){if(_17&&(_11.matches?_11.matches(_17):_11([_17]).length)){var _1f=_1c>-1?_1c:_19.length;_19.splice(_1f,0,_17);_1d=_4.indexOf(_11(_19),_17);_19.splice(_1f,1);if((_e.start&&_1d==0)||(!_1a&&_1d==_19.length)){_1d=-1;}else{_19.splice(_1d,0,_17);}}}else{if(_17&&!_e.start){_1d=_1c>=0?_1c:(_5.defaultIndex||0);}}if((_1c>-1||_1d>-1)&&(_16||!_11||(_1c!=_1d))){var _20=_13.slice();for(i=0;_15=_20[i];i++){_15(_17||_1b,_1c,_1d);}}});});}return {cancel:function(){var _21=_4.indexOf(_13,_15);if(_21>-1){_13.splice(_21,1);if(!_13.length){_7.splice(_4.indexOf(_7,_14),1);}}}};};}return _f;};var _22;function _23(_24,_25){var _26=_5[_24];if(_26){_5[_24]=function(_27){if(_22){return _26.apply(this,arguments);}_22=true;try{var _28=_26.apply(this,arguments);_3.when(_28,function(_29){_25((typeof _29=="object"&&_29)||_27);});return _28;}finally{_22=false;}};}};_23("put",function(_2a){_5.notify(_2a,_5.getIdentity(_2a));});_23("add",function(_2b){_5.notify(_2b);});_23("remove",function(id){_5.notify(undefined,id);});return _5;};}); \ No newline at end of file
diff --git a/lib/dojo/store/Observable.js.uncompressed.js b/lib/dojo/store/Observable.js.uncompressed.js
new file mode 100644
index 000000000..62e4a8591
--- /dev/null
+++ b/lib/dojo/store/Observable.js.uncompressed.js
@@ -0,0 +1,175 @@
+define("dojo/store/Observable", ["../_base/kernel", "../_base/lang", "../_base/Deferred", "../_base/array"
+], function(kernel, lang, Deferred, array) {
+ // module:
+ // dojo/store/Observable
+ // summary:
+ // TODOC
+
+var ds = lang.getObject("dojo.store", true);
+
+return ds.Observable = function(store){
+ // summary:
+ // The Observable store wrapper takes a store and sets an observe method on query()
+ // results that can be used to monitor results for changes.
+ //
+ // description:
+ // Observable wraps an existing store so that notifications can be made when a query
+ // is performed.
+ //
+ // example:
+ // Create a Memory store that returns an observable query, and then log some
+ // information about that query.
+ //
+ // | var store = dojo.store.Observable(new dojo.store.Memory({
+ // | data: [
+ // | {id: 1, name: "one", prime: false},
+ // | {id: 2, name: "two", even: true, prime: true},
+ // | {id: 3, name: "three", prime: true},
+ // | {id: 4, name: "four", even: true, prime: false},
+ // | {id: 5, name: "five", prime: true}
+ // | ]
+ // | }));
+ // | var changes = [], results = store.query({ prime: true });
+ // | var observer = results.observe(function(object, previousIndex, newIndex){
+ // | changes.push({previousIndex:previousIndex, newIndex:newIndex, object:object});
+ // | });
+ //
+ // See the Observable tests for more information.
+
+ var undef, queryUpdaters = [], revision = 0;
+ // a Comet driven store could directly call notify to notify observers when data has
+ // changed on the backend
+ store.notify = function(object, existingId){
+ revision++;
+ var updaters = queryUpdaters.slice();
+ for(var i = 0, l = updaters.length; i < l; i++){
+ updaters[i](object, existingId);
+ }
+ };
+ var originalQuery = store.query;
+ store.query = function(query, options){
+ options = options || {};
+ var results = originalQuery.apply(this, arguments);
+ if(results && results.forEach){
+ var nonPagedOptions = lang.mixin({}, options);
+ delete nonPagedOptions.start;
+ delete nonPagedOptions.count;
+
+ var queryExecutor = store.queryEngine && store.queryEngine(query, nonPagedOptions);
+ var queryRevision = revision;
+ var listeners = [], queryUpdater;
+ results.observe = function(listener, includeObjectUpdates){
+ if(listeners.push(listener) == 1){
+ // first listener was added, create the query checker and updater
+ queryUpdaters.push(queryUpdater = function(changed, existingId){
+ Deferred.when(results, function(resultsArray){
+ var atEnd = resultsArray.length != options.count;
+ var i, l, listener;
+ if(++queryRevision != revision){
+ throw new Error("Query is out of date, you must observe() the query prior to any data modifications");
+ }
+ var removedObject, removedFrom = -1, insertedInto = -1;
+ if(existingId !== undef){
+ // remove the old one
+ for(i = 0, l = resultsArray.length; i < l; i++){
+ var object = resultsArray[i];
+ if(store.getIdentity(object) == existingId){
+ removedObject = object;
+ removedFrom = i;
+ if(queryExecutor || !changed){// if it was changed and we don't have a queryExecutor, we shouldn't remove it because updated objects would be eliminated
+ resultsArray.splice(i, 1);
+ }
+ break;
+ }
+ }
+ }
+ if(queryExecutor){
+ // add the new one
+ if(changed &&
+ // if a matches function exists, use that (probably more efficient)
+ (queryExecutor.matches ? queryExecutor.matches(changed) : queryExecutor([changed]).length)){
+
+ var firstInsertedInto = removedFrom > -1 ?
+ removedFrom : // put back in the original slot so it doesn't move unless it needs to (relying on a stable sort below)
+ resultsArray.length;
+ resultsArray.splice(firstInsertedInto, 0, changed); // add the new item
+ insertedInto = array.indexOf(queryExecutor(resultsArray), changed); // sort it
+ // we now need to push the chagne back into the original results array
+ resultsArray.splice(firstInsertedInto, 1); // remove the inserted item from the previous index
+
+ if((options.start && insertedInto == 0) ||
+ (!atEnd && insertedInto == resultsArray.length)){
+ // if it is at the end of the page, assume it goes into the prev or next page
+ insertedInto = -1;
+ }else{
+ resultsArray.splice(insertedInto, 0, changed); // and insert into the results array with the correct index
+ }
+ }
+ }else if(changed && !options.start){
+ // we don't have a queryEngine, so we can't provide any information
+ // about where it was inserted, but we can at least indicate a new object
+ insertedInto = removedFrom >= 0 ? removedFrom : (store.defaultIndex || 0);
+ }
+ if((removedFrom > -1 || insertedInto > -1) &&
+ (includeObjectUpdates || !queryExecutor || (removedFrom != insertedInto))){
+ var copyListeners = listeners.slice();
+ for(i = 0;listener = copyListeners[i]; i++){
+ listener(changed || removedObject, removedFrom, insertedInto);
+ }
+ }
+ });
+ });
+ }
+ return {
+ cancel: function(){
+ // remove this listener
+ var index = array.indexOf(listeners, listener);
+ if(index > -1){ // check to make sure we haven't already called cancel
+ listeners.splice(index, 1);
+ if(!listeners.length){
+ // no more listeners, remove the query updater too
+ queryUpdaters.splice(array.indexOf(queryUpdaters, queryUpdater), 1);
+ }
+ }
+ }
+ };
+ };
+ }
+ return results;
+ };
+ var inMethod;
+ function whenFinished(method, action){
+ var original = store[method];
+ if(original){
+ store[method] = function(value){
+ if(inMethod){
+ // if one method calls another (like add() calling put()) we don't want two events
+ return original.apply(this, arguments);
+ }
+ inMethod = true;
+ try{
+ var results = original.apply(this, arguments);
+ Deferred.when(results, function(results){
+ action((typeof results == "object" && results) || value);
+ });
+ return results;
+ }finally{
+ inMethod = false;
+ }
+ };
+ }
+ }
+ // monitor for updates by listening to these methods
+ whenFinished("put", function(object){
+ store.notify(object, store.getIdentity(object));
+ });
+ whenFinished("add", function(object){
+ store.notify(object);
+ });
+ whenFinished("remove", function(id){
+ store.notify(undefined, id);
+ });
+
+ return store;
+};
+});
diff --git a/lib/dojo/store/api/Store.js b/lib/dojo/store/api/Store.js
index ca26226d3..d4f4b0b90 100644
--- a/lib/dojo/store/api/Store.js
+++ b/lib/dojo/store/api/Store.js
@@ -4,301 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-define([], function() {
- // module:
- // dojo/store/api/Store
- // summary:
- // The module defines the Dojo object store interface.
-
-dojo.declare("dojo.store.api.Store", null, {
- // summary:
- // This is an abstract API that data provider implementations conform to.
- // This file defines methods signatures and intentionally leaves all the
- // methods unimplemented. For more information on the dojo.store APIs,
- // please visit: http://dojotoolkit.org/reference-guide/dojo/store.html
- // Every method and property is optional, and is only needed if the functionality
- // it provides is required.
- // Every method may return a promise for the specified return value if the
- // execution of the operation is asynchronous (except
- // for query() which already defines an async return value).
-
- // idProperty: String
- // If the store has a single primary key, this tndicates the property to use as the
- // identity property. The values of this property should be unique.
- idProperty: "id",
-
- // queryEngine: Function
- // If the store can be queried locally (on the client side in JS), this defines
- // the query engine to use for querying the data store.
- // This takes a query and query options and returns a function that can execute
- // the provided query on a JavaScript array. The queryEngine may be replace to
- // provide more sophisticated querying capabilities. For example:
- // | var query = store.queryEngine({foo:"bar"}, {count:10});
- // | query(someArray) -> filtered array
- // The returned query function may have a "matches" property that can be
- // used to determine if an object matches the query. For example:
- // | query.matches({id:"some-object", foo:"bar"}) -> true
- // | query.matches({id:"some-object", foo:"something else"}) -> false
- queryEngine: null,
-
- get: function(id){
- // summary:
- // Retrieves an object by its identity
- // id: Number
- // The identity to use to lookup the object
- // returns: Object
- // The object in the store that matches the given id.
- },
- getIdentity: function(object){
- // summary:
- // Returns an object's identity
- // object: Object
- // The object to get the identity from
- // returns: String|Number
- },
- put: function(object, directives){
- // summary:
- // Stores an object
- // object: Object
- // The object to store.
- // directives: dojo.store.api.Store.PutDirectives?
- // Additional directives for storing objects.
- // returns: Number|String
- },
- add: function(object, directives){
- // summary:
- // Creates an object, throws an error if the object already exists
- // object: Object
- // The object to store.
- // directives: dojo.store.api.Store.PutDirectives?
- // Additional directives for creating objects.
- // returns: Number|String
- },
- remove: function(id){
- // summary:
- // Deletes an object by its identity
- // id: Number
- // The identity to use to delete the object
- delete this.index[id];
- var data = this.data,
- idProperty = this.idProperty;
- for(var i = 0, l = data.length; i < l; i++){
- if(data[i][idProperty] == id){
- data.splice(i, 1);
- return;
- }
- }
- },
- query: function(query, options){
- // summary:
- // Queries the store for objects. This does not alter the store, but returns a
- // set of data from the store.
- // query: String|Object|Function
- // The query to use for retrieving objects from the store.
- // options: dojo.store.api.Store.QueryOptions
- // The optional arguments to apply to the resultset.
- // returns: dojo.store.api.Store.QueryResults
- // The results of the query, extended with iterative methods.
- //
- // example:
- // Given the following store:
- //
- // ...find all items where "prime" is true:
- //
- // | store.query({ prime: true }).forEach(function(object){
- // | // handle each object
- // | });
- },
- transaction: function(){
- // summary:
- // Starts a new transaction.
- // Note that a store user might not call transaction() prior to using put,
- // delete, etc. in which case these operations effectively could be thought of
- // as "auto-commit" style actions.
- // returns: dojo.store.api.Store.Transaction
- // This represents the new current transaction.
- },
- getChildren: function(parent, options){
- // summary:
- // Retrieves the children of an object.
- // parent: Object
- // The object to find the children of.
- // options: dojo.store.api.Store.QueryOptions?
- // Additional options to apply to the retrieval of the children.
- // returns: dojo.store.api.Store.QueryResults
- // A result set of the children of the parent object.
- },
- getMetadata: function(object){
- // summary:
- // Returns any metadata about the object. This may include attribution,
- // cache directives, history, or version information.
- // object: Object
- // The object to return metadata for.
- // returns: Object
- // An object containing metadata.
- }
-});
-
-dojo.store.api.Store.PutDirectives = function(id, before, parent, overwrite){
- // summary:
- // Directives passed to put() and add() handlers for guiding the update and
- // creation of stored objects.
- // id: String|Number?
- // Indicates the identity of the object if a new object is created
- // before: Object?
- // If the collection of objects in the store has a natural ordering,
- // this indicates that the created or updated object should be placed before the
- // object specified by the value of this property. A value of null indicates that the
- // object should be last.
- // parent: Object?,
- // If the store is hierarchical (with single parenting) this property indicates the
- // new parent of the created or updated object.
- // overwrite: Boolean?
- // If this is provided as a boolean it indicates that the object should or should not
- // overwrite an existing object. A value of true indicates that a new object
- // should not be created, the operation should update an existing object. A
- // value of false indicates that an existing object should not be updated, a new
- // object should be created (which is the same as an add() operation). When
- // this property is not provided, either an update or creation is acceptable.
- this.id = id;
- this.before = before;
- this.parent = parent;
- this.overwrite = overwrite;
-};
-
-dojo.store.api.Store.SortInformation = function(attribute, descending){
- // summary:
- // An object describing what attribute to sort on, and the direction of the sort.
- // attribute: String
- // The name of the attribute to sort on.
- // descending: Boolean
- // The direction of the sort. Default is false.
- this.attribute = attribute;
- this.descending = descending;
-};
-
-dojo.store.api.Store.QueryOptions = function(sort, start, count){
- // summary:
- // Optional object with additional parameters for query results.
- // sort: dojo.store.api.Store.SortInformation[]?
- // A list of attributes to sort on, as well as direction
- // For example:
- // | [{attribute:"price, descending: true}].
- // If the sort parameter is omitted, then the natural order of the store may be
- // applied if there is a natural order.
- // start: Number?
- // The first result to begin iteration on
- // count: Number?
- // The number of how many results should be returned.
- this.sort = sort;
- this.start = start;
- this.count = count;
-};
-
-dojo.declare("dojo.store.api.Store.QueryResults", null, {
- // summary:
- // This is an object returned from query() calls that provides access to the results
- // of a query. Queries may be executed asynchronously.
-
- forEach: function(callback, thisObject){
- // summary:
- // Iterates over the query results, based on
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach.
- // Note that this may executed asynchronously. The callback may be called
- // after this function returns.
- // callback:
- // Function that is called for each object in the query results
- // thisObject:
- // The object to use as |this| in the callback.
-
- },
- filter: function(callback, thisObject){
- // summary:
- // Filters the query results, based on
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter.
- // Note that this may executed asynchronously. The callback may be called
- // after this function returns.
- // callback:
- // Function that is called for each object in the query results
- // thisObject:
- // The object to use as |this| in the callback.
- // returns: dojo.store.api.Store.QueryResults
- },
- map: function(callback, thisObject){
- // summary:
- // Maps the query results, based on
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map.
- // Note that this may executed asynchronously. The callback may be called
- // after this function returns.
- // callback:
- // Function that is called for each object in the query results
- // thisObject:
- // The object to use as |this| in the callback.
- // returns: dojo.store.api.Store.QueryResults
- },
- then: function(callback, errorHandler){
- // summary:
- // This registers a callback for when the query is complete, if the query is asynchronous.
- // This is an optional method, and may not be present for synchronous queries.
- // callback:
- // This is called when the query is completed successfully, and is passed a single argument
- // that is an array representing the query results.
- // errorHandler:
- // This is called if the query failed, and is passed a single argument that is the error
- // for the failure.
- },
- observe: function(listener, includeAllUpdates){
- // summary:
- // This registers a callback for notification of when data is modified in the query results.
- // This is an optional method, and is usually provided by dojo.store.Observable.
- // listener: Function
- // The listener function is called when objects in the query results are modified
- // to affect the query result. The listener function is called with the following
- // arguments:
- // | listener(object, removedFrom, insertedInto);
- // * The object parameter indicates the object that was create, modified, or deleted.
- // * The removedFrom parameter indicates the index in the result array where
- // the object used to be. If the value is -1, then the object is an addition to
- // this result set (due to a new object being created, or changed such that it
- // is a part of the result set).
- // * The insertedInto parameter indicates the index in the result array where
- // the object should be now. If the value is -1, then the object is a removal
- // from this result set (due to an object being deleted, or changed such that it
- // is not a part of the result set).
- // includeAllUpdates:
- // This indicates whether or not to include object updates that do not affect
- // the inclusion or order of the object in the query results. By default this is false,
- // which means that if any object is updated in such a way that it remains
- // in the result set and it's position in result sets is not affected, then the listener
- // will not be fired.
-
- },
- // total: Number|Promise?
- // This property should be included in if the query options included the "count"
- // property limiting the result set. This property indicates the total number of objects
- // matching the query (as if "start" and "count" weren't present). This may be
- // a promise if the query is asynchronous.
- total: 0
-});
-
-dojo.declare("dojo.store.api.Store.Transaction", null, {
- // summary:
- // This is an object returned from transaction() calls that represents the current
- // transaction.
-
- commit: function(){
- // summary:
- // Commits the transaction. This may throw an error if it fails. Of if the operation
- // is asynchronous, it may return a promise that represents the eventual success
- // or failure of the commit.
- },
- abort: function(callback, thisObject){
- // summary:
- // Aborts the transaction. This may throw an error if it fails. Of if the operation
- // is asynchronous, it may return a promise that represents the eventual success
- // or failure of the abort.
- }
-});
-
-});
+//>>built
+define("dojo/store/api/Store",["dojo/_base/declare"],function(_1){var _2=_1("dojo.store.api.Store",null,{idProperty:"id",queryEngine:null,get:function(id){},getIdentity:function(_3){},put:function(_4,_5){},add:function(_6,_7){},remove:function(id){delete this.index[id];var _8=this.data,_9=this.idProperty;for(var i=0,l=_8.length;i<l;i++){if(_8[i][_9]==id){_8.splice(i,1);return;}}},query:function(_a,_b){},transaction:function(){},getChildren:function(_c,_d){},getMetadata:function(_e){}});_2.PutDirectives=function(id,_f,_10,_11){this.id=id;this.before=_f;this.parent=_10;this.overwrite=_11;};_2.SortInformation=function(_12,_13){this.attribute=_12;this.descending=_13;};_2.QueryOptions=function(_14,_15,_16){this.sort=_14;this.start=_15;this.count=_16;};_1("dojo.store.api.Store.QueryResults",null,{forEach:function(_17,_18){},filter:function(_19,_1a){},map:function(_1b,_1c){},then:function(_1d,_1e){},observe:function(_1f,_20){},total:0});_1("dojo.store.api.Store.Transaction",null,{commit:function(){},abort:function(_21,_22){}});return _2;}); \ No newline at end of file
diff --git a/lib/dojo/store/api/Store.js.uncompressed.js b/lib/dojo/store/api/Store.js.uncompressed.js
new file mode 100644
index 000000000..55078d771
--- /dev/null
+++ b/lib/dojo/store/api/Store.js.uncompressed.js
@@ -0,0 +1,297 @@
+define("dojo/store/api/Store", ["dojo/_base/declare"], function(declare) {
+ // module:
+ // dojo/store/api/Store
+ // summary:
+ // The module defines the Dojo object store interface.
+
+var Store = declare("dojo.store.api.Store", null, {
+ // summary:
+ // This is an abstract API that data provider implementations conform to.
+ // This file defines methods signatures and intentionally leaves all the
+ // methods unimplemented. For more information on the dojo.store APIs,
+ // please visit: http://dojotoolkit.org/reference-guide/dojo/store.html
+ // Every method and property is optional, and is only needed if the functionality
+ // it provides is required.
+ // Every method may return a promise for the specified return value if the
+ // execution of the operation is asynchronous (except
+ // for query() which already defines an async return value).
+
+ // idProperty: String
+ // If the store has a single primary key, this tndicates the property to use as the
+ // identity property. The values of this property should be unique.
+ idProperty: "id",
+
+ // queryEngine: Function
+ // If the store can be queried locally (on the client side in JS), this defines
+ // the query engine to use for querying the data store.
+ // This takes a query and query options and returns a function that can execute
+ // the provided query on a JavaScript array. The queryEngine may be replace to
+ // provide more sophisticated querying capabilities. For example:
+ // | var query = store.queryEngine({foo:"bar"}, {count:10});
+ // | query(someArray) -> filtered array
+ // The returned query function may have a "matches" property that can be
+ // used to determine if an object matches the query. For example:
+ // | query.matches({id:"some-object", foo:"bar"}) -> true
+ // | query.matches({id:"some-object", foo:"something else"}) -> false
+ queryEngine: null,
+
+ get: function(id){
+ // summary:
+ // Retrieves an object by its identity
+ // id: Number
+ // The identity to use to lookup the object
+ // returns: Object
+ // The object in the store that matches the given id.
+ },
+ getIdentity: function(object){
+ // summary:
+ // Returns an object's identity
+ // object: Object
+ // The object to get the identity from
+ // returns: String|Number
+ },
+ put: function(object, directives){
+ // summary:
+ // Stores an object
+ // object: Object
+ // The object to store.
+ // directives: dojo.store.api.Store.PutDirectives?
+ // Additional directives for storing objects.
+ // returns: Number|String
+ },
+ add: function(object, directives){
+ // summary:
+ // Creates an object, throws an error if the object already exists
+ // object: Object
+ // The object to store.
+ // directives: dojo.store.api.Store.PutDirectives?
+ // Additional directives for creating objects.
+ // returns: Number|String
+ },
+ remove: function(id){
+ // summary:
+ // Deletes an object by its identity
+ // id: Number
+ // The identity to use to delete the object
+ delete this.index[id];
+ var data = this.data,
+ idProperty = this.idProperty;
+ for(var i = 0, l = data.length; i < l; i++){
+ if(data[i][idProperty] == id){
+ data.splice(i, 1);
+ return;
+ }
+ }
+ },
+ query: function(query, options){
+ // summary:
+ // Queries the store for objects. This does not alter the store, but returns a
+ // set of data from the store.
+ // query: String|Object|Function
+ // The query to use for retrieving objects from the store.
+ // options: dojo.store.api.Store.QueryOptions
+ // The optional arguments to apply to the resultset.
+ // returns: dojo.store.api.Store.QueryResults
+ // The results of the query, extended with iterative methods.
+ //
+ // example:
+ // Given the following store:
+ //
+ // ...find all items where "prime" is true:
+ //
+ // | store.query({ prime: true }).forEach(function(object){
+ // | // handle each object
+ // | });
+ },
+ transaction: function(){
+ // summary:
+ // Starts a new transaction.
+ // Note that a store user might not call transaction() prior to using put,
+ // delete, etc. in which case these operations effectively could be thought of
+ // as "auto-commit" style actions.
+ // returns: dojo.store.api.Store.Transaction
+ // This represents the new current transaction.
+ },
+ getChildren: function(parent, options){
+ // summary:
+ // Retrieves the children of an object.
+ // parent: Object
+ // The object to find the children of.
+ // options: dojo.store.api.Store.QueryOptions?
+ // Additional options to apply to the retrieval of the children.
+ // returns: dojo.store.api.Store.QueryResults
+ // A result set of the children of the parent object.
+ },
+ getMetadata: function(object){
+ // summary:
+ // Returns any metadata about the object. This may include attribution,
+ // cache directives, history, or version information.
+ // object: Object
+ // The object to return metadata for.
+ // returns: Object
+ // An object containing metadata.
+ }
+});
+
+Store.PutDirectives = function(id, before, parent, overwrite){
+ // summary:
+ // Directives passed to put() and add() handlers for guiding the update and
+ // creation of stored objects.
+ // id: String|Number?
+ // Indicates the identity of the object if a new object is created
+ // before: Object?
+ // If the collection of objects in the store has a natural ordering,
+ // this indicates that the created or updated object should be placed before the
+ // object specified by the value of this property. A value of null indicates that the
+ // object should be last.
+ // parent: Object?,
+ // If the store is hierarchical (with single parenting) this property indicates the
+ // new parent of the created or updated object.
+ // overwrite: Boolean?
+ // If this is provided as a boolean it indicates that the object should or should not
+ // overwrite an existing object. A value of true indicates that a new object
+ // should not be created, the operation should update an existing object. A
+ // value of false indicates that an existing object should not be updated, a new
+ // object should be created (which is the same as an add() operation). When
+ // this property is not provided, either an update or creation is acceptable.
+ this.id = id;
+ this.before = before;
+ this.parent = parent;
+ this.overwrite = overwrite;
+};
+
+Store.SortInformation = function(attribute, descending){
+ // summary:
+ // An object describing what attribute to sort on, and the direction of the sort.
+ // attribute: String
+ // The name of the attribute to sort on.
+ // descending: Boolean
+ // The direction of the sort. Default is false.
+ this.attribute = attribute;
+ this.descending = descending;
+};
+
+Store.QueryOptions = function(sort, start, count){
+ // summary:
+ // Optional object with additional parameters for query results.
+ // sort: dojo.store.api.Store.SortInformation[]?
+ // A list of attributes to sort on, as well as direction
+ // For example:
+ // | [{attribute:"price, descending: true}].
+ // If the sort parameter is omitted, then the natural order of the store may be
+ // applied if there is a natural order.
+ // start: Number?
+ // The first result to begin iteration on
+ // count: Number?
+ // The number of how many results should be returned.
+ this.sort = sort;
+ this.start = start;
+ this.count = count;
+};
+
+declare("dojo.store.api.Store.QueryResults", null, {
+ // summary:
+ // This is an object returned from query() calls that provides access to the results
+ // of a query. Queries may be executed asynchronously.
+
+ forEach: function(callback, thisObject){
+ // summary:
+ // Iterates over the query results, based on
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach.
+ // Note that this may executed asynchronously. The callback may be called
+ // after this function returns.
+ // callback:
+ // Function that is called for each object in the query results
+ // thisObject:
+ // The object to use as |this| in the callback.
+
+ },
+ filter: function(callback, thisObject){
+ // summary:
+ // Filters the query results, based on
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter.
+ // Note that this may executed asynchronously. The callback may be called
+ // after this function returns.
+ // callback:
+ // Function that is called for each object in the query results
+ // thisObject:
+ // The object to use as |this| in the callback.
+ // returns: dojo.store.api.Store.QueryResults
+ },
+ map: function(callback, thisObject){
+ // summary:
+ // Maps the query results, based on
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map.
+ // Note that this may executed asynchronously. The callback may be called
+ // after this function returns.
+ // callback:
+ // Function that is called for each object in the query results
+ // thisObject:
+ // The object to use as |this| in the callback.
+ // returns: dojo.store.api.Store.QueryResults
+ },
+ then: function(callback, errorHandler){
+ // summary:
+ // This registers a callback for when the query is complete, if the query is asynchronous.
+ // This is an optional method, and may not be present for synchronous queries.
+ // callback:
+ // This is called when the query is completed successfully, and is passed a single argument
+ // that is an array representing the query results.
+ // errorHandler:
+ // This is called if the query failed, and is passed a single argument that is the error
+ // for the failure.
+ },
+ observe: function(listener, includeAllUpdates){
+ // summary:
+ // This registers a callback for notification of when data is modified in the query results.
+ // This is an optional method, and is usually provided by dojo.store.Observable.
+ // listener: Function
+ // The listener function is called when objects in the query results are modified
+ // to affect the query result. The listener function is called with the following
+ // arguments:
+ // | listener(object, removedFrom, insertedInto);
+ // * The object parameter indicates the object that was create, modified, or deleted.
+ // * The removedFrom parameter indicates the index in the result array where
+ // the object used to be. If the value is -1, then the object is an addition to
+ // this result set (due to a new object being created, or changed such that it
+ // is a part of the result set).
+ // * The insertedInto parameter indicates the index in the result array where
+ // the object should be now. If the value is -1, then the object is a removal
+ // from this result set (due to an object being deleted, or changed such that it
+ // is not a part of the result set).
+ // includeAllUpdates:
+ // This indicates whether or not to include object updates that do not affect
+ // the inclusion or order of the object in the query results. By default this is false,
+ // which means that if any object is updated in such a way that it remains
+ // in the result set and it's position in result sets is not affected, then the listener
+ // will not be fired.
+
+ },
+ // total: Number|Promise?
+ // This property should be included in if the query options included the "count"
+ // property limiting the result set. This property indicates the total number of objects
+ // matching the query (as if "start" and "count" weren't present). This may be
+ // a promise if the query is asynchronous.
+ total: 0
+});
+
+declare("dojo.store.api.Store.Transaction", null, {
+ // summary:
+ // This is an object returned from transaction() calls that represents the current
+ // transaction.
+
+ commit: function(){
+ // summary:
+ // Commits the transaction. This may throw an error if it fails. Of if the operation
+ // is asynchronous, it may return a promise that represents the eventual success
+ // or failure of the commit.
+ },
+ abort: function(callback, thisObject){
+ // summary:
+ // Aborts the transaction. This may throw an error if it fails. Of if the operation
+ // is asynchronous, it may return a promise that represents the eventual success
+ // or failure of the abort.
+ }
+});
+return Store;
+});
diff --git a/lib/dojo/store/util/QueryResults.js b/lib/dojo/store/util/QueryResults.js
index a237d1dce..fc164ec6b 100644
--- a/lib/dojo/store/util/QueryResults.js
+++ b/lib/dojo/store/util/QueryResults.js
@@ -4,64 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.util.QueryResults"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.util.QueryResults"] = true;
-dojo.provide("dojo.store.util.QueryResults");
-
-dojo.getObject("store.util", true, dojo);
-
-dojo.store.util.QueryResults = function(results){
- // summary:
- // A function that wraps the results of a store query with additional
- // methods.
- //
- // description:
- // QueryResults is a basic wrapper that allows for array-like iteration
- // over any kind of returned data from a query. While the simplest store
- // will return a plain array of data, other stores may return deferreds or
- // promises; this wrapper makes sure that *all* results can be treated
- // the same.
- //
- // Additional methods include `forEach`, `filter` and `map`.
- //
- // returns: Object
- // An array-like object that can be used for iterating over.
- //
- // example:
- // Query a store and iterate over the results.
- //
- // | store.query({ prime: true }).forEach(function(item){
- // | // do something
- // | });
-
- if(!results){
- return results;
- }
- // if it is a promise it may be frozen
- if(results.then){
- results = dojo.delegate(results);
- }
- function addIterativeMethod(method){
- if(!results[method]){
- results[method] = function(){
- var args = arguments;
- return dojo.when(results, function(results){
- Array.prototype.unshift.call(args, results);
- return dojo.store.util.QueryResults(dojo[method].apply(dojo, args));
- });
- };
- }
- }
- addIterativeMethod("forEach");
- addIterativeMethod("filter");
- addIterativeMethod("map");
- if(!results.total){
- results.total = dojo.when(results, function(results){
- return results.length;
- });
- }
- return results;
-};
-
-}
+//>>built
+define("dojo/store/util/QueryResults",["../../_base/array","../../_base/lang","../../_base/Deferred"],function(_1,_2,_3){var _4=_2.getObject("dojo.store.util",true);_4.QueryResults=function(_5){if(!_5){return _5;}if(_5.then){_5=_2.delegate(_5);}function _6(_7){if(!_5[_7]){_5[_7]=function(){var _8=arguments;return _3.when(_5,function(_9){Array.prototype.unshift.call(_8,_9);return _4.QueryResults(_1[_7].apply(_1,_8));});};}};_6("forEach");_6("filter");_6("map");if(!_5.total){_5.total=_3.when(_5,function(_a){return _a.length;});}return _5;};return _4.QueryResults;}); \ No newline at end of file
diff --git a/lib/dojo/store/util/QueryResults.js.uncompressed.js b/lib/dojo/store/util/QueryResults.js.uncompressed.js
new file mode 100644
index 000000000..cd9e1969a
--- /dev/null
+++ b/lib/dojo/store/util/QueryResults.js.uncompressed.js
@@ -0,0 +1,64 @@
+define("dojo/store/util/QueryResults", ["../../_base/array", "../../_base/lang", "../../_base/Deferred"
+], function(array, lang, Deferred) {
+ // module:
+ // dojo/store/util/QueryResults
+ // summary:
+ // The module defines a query results wrapper
+
+var util = lang.getObject("dojo.store.util", true);
+
+util.QueryResults = function(results){
+ // summary:
+ // A function that wraps the results of a store query with additional
+ // methods.
+ //
+ // description:
+ // QueryResults is a basic wrapper that allows for array-like iteration
+ // over any kind of returned data from a query. While the simplest store
+ // will return a plain array of data, other stores may return deferreds or
+ // promises; this wrapper makes sure that *all* results can be treated
+ // the same.
+ //
+ // Additional methods include `forEach`, `filter` and `map`.
+ //
+ // returns: Object
+ // An array-like object that can be used for iterating over.
+ //
+ // example:
+ // Query a store and iterate over the results.
+ //
+ // | store.query({ prime: true }).forEach(function(item){
+ // | // do something
+ // | });
+
+ if(!results){
+ return results;
+ }
+ // if it is a promise it may be frozen
+ if(results.then){
+ results = lang.delegate(results);
+ }
+ function addIterativeMethod(method){
+ if(!results[method]){
+ results[method] = function(){
+ var args = arguments;
+ return Deferred.when(results, function(results){
+ Array.prototype.unshift.call(args, results);
+ return util.QueryResults(array[method].apply(array, args));
+ });
+ };
+ }
+ }
+ addIterativeMethod("forEach");
+ addIterativeMethod("filter");
+ addIterativeMethod("map");
+ if(!results.total){
+ results.total = Deferred.when(results, function(results){
+ return results.length;
+ });
+ }
+ return results;
+};
+
+return util.QueryResults;
+});
diff --git a/lib/dojo/store/util/SimpleQueryEngine.js b/lib/dojo/store/util/SimpleQueryEngine.js
index 4b29f20cb..aa398f6e7 100644
--- a/lib/dojo/store/util/SimpleQueryEngine.js
+++ b/lib/dojo/store/util/SimpleQueryEngine.js
@@ -4,113 +4,5 @@
see: http://dojotoolkit.org/license for details
*/
-
-if(!dojo._hasResource["dojo.store.util.SimpleQueryEngine"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.store.util.SimpleQueryEngine"] = true;
-dojo.provide("dojo.store.util.SimpleQueryEngine");
-
-dojo.getObject("store.util", true, dojo);
-
-dojo.store.util.SimpleQueryEngine = function(query, options){
- // summary:
- // Simple query engine that matches using filter functions, named filter
- // functions or objects by name-value on a query object hash
- //
- // description:
- // The SimpleQueryEngine provides a way of getting a QueryResults through
- // the use of a simple object hash as a filter. The hash will be used to
- // match properties on data objects with the corresponding value given. In
- // other words, only exact matches will be returned.
- //
- // This function can be used as a template for more complex query engines;
- // for example, an engine can be created that accepts an object hash that
- // contains filtering functions, or a string that gets evaluated, etc.
- //
- // When creating a new dojo.store, simply set the store's queryEngine
- // field as a reference to this function.
- //
- // query: Object
- // An object hash with fields that may match fields of items in the store.
- // Values in the hash will be compared by normal == operator, but regular expressions
- // or any object that provides a test() method are also supported and can be
- // used to match strings by more complex expressions
- // (and then the regex's or object's test() method will be used to match values).
- //
- // options: dojo.store.util.SimpleQueryEngine.__queryOptions?
- // An object that contains optional information such as sort, start, and count.
- //
- // returns: Function
- // A function that caches the passed query under the field "matches". See any
- // of the "query" methods on dojo.stores.
- //
- // example:
- // Define a store with a reference to this engine, and set up a query method.
- //
- // | var myStore = function(options){
- // | // ...more properties here
- // | this.queryEngine = dojo.store.util.SimpleQueryEngine;
- // | // define our query method
- // | this.query = function(query, options){
- // | return dojo.store.util.QueryResults(this.queryEngine(query, options)(this.data));
- // | };
- // | };
-
- // create our matching query function
- switch(typeof query){
- default:
- throw new Error("Can not query with a " + typeof query);
- case "object": case "undefined":
- var queryObject = query;
- query = function(object){
- for(var key in queryObject){
- var required = queryObject[key];
- if(required && required.test){
- if(!required.test(object[key])){
- return false;
- }
- }else if(required != object[key]){
- return false;
- }
- }
- return true;
- };
- break;
- case "string":
- // named query
- if(!this[query]){
- throw new Error("No filter function " + query + " was found in store");
- }
- query = this[query];
- // fall through
- case "function":
- // fall through
- }
- function execute(array){
- // execute the whole query, first we filter
- var results = dojo.filter(array, query);
- // next we sort
- if(options && options.sort){
- results.sort(function(a, b){
- for(var sort, i=0; sort = options.sort[i]; i++){
- var aValue = a[sort.attribute];
- var bValue = b[sort.attribute];
- if (aValue != bValue) {
- return !!sort.descending == aValue > bValue ? -1 : 1;
- }
- }
- return 0;
- });
- }
- // now we paginate
- if(options && (options.start || options.count)){
- var total = results.length;
- results = results.slice(options.start || 0, (options.start || 0) + (options.count || Infinity));
- results.total = total;
- }
- return results;
- }
- execute.matches = query;
- return execute;
-};
-
-}
+//>>built
+define("dojo/store/util/SimpleQueryEngine",["../../_base/array"],function(_1){return function(_2,_3){switch(typeof _2){default:throw new Error("Can not query with a "+typeof _2);case "object":case "undefined":var _4=_2;_2=function(_5){for(var _6 in _4){var _7=_4[_6];if(_7&&_7.test){if(!_7.test(_5[_6])){return false;}}else{if(_7!=_5[_6]){return false;}}}return true;};break;case "string":if(!this[_2]){throw new Error("No filter function "+_2+" was found in store");}_2=this[_2];case "function":}function _8(_9){var _a=_1.filter(_9,_2);if(_3&&_3.sort){_a.sort(function(a,b){for(var _b,i=0;_b=_3.sort[i];i++){var _c=a[_b.attribute];var _d=b[_b.attribute];if(_c!=_d){return !!_b.descending==_c>_d?-1:1;}}return 0;});}if(_3&&(_3.start||_3.count)){var _e=_a.length;_a=_a.slice(_3.start||0,(_3.start||0)+(_3.count||Infinity));_a.total=_e;}return _a;};_8.matches=_2;return _8;};}); \ No newline at end of file
diff --git a/lib/dojo/store/util/SimpleQueryEngine.js.uncompressed.js b/lib/dojo/store/util/SimpleQueryEngine.js.uncompressed.js
new file mode 100644
index 000000000..4f241e6f1
--- /dev/null
+++ b/lib/dojo/store/util/SimpleQueryEngine.js.uncompressed.js
@@ -0,0 +1,108 @@
+define("dojo/store/util/SimpleQueryEngine", ["../../_base/array"], function(arrayUtil) {
+ // module:
+ // dojo/store/util/SimpleQueryEngine
+ // summary:
+ // The module defines a simple filtering query engine for object stores.
+
+return function(query, options){
+ // summary:
+ // Simple query engine that matches using filter functions, named filter
+ // functions or objects by name-value on a query object hash
+ //
+ // description:
+ // The SimpleQueryEngine provides a way of getting a QueryResults through
+ // the use of a simple object hash as a filter. The hash will be used to
+ // match properties on data objects with the corresponding value given. In
+ // other words, only exact matches will be returned.
+ //
+ // This function can be used as a template for more complex query engines;
+ // for example, an engine can be created that accepts an object hash that
+ // contains filtering functions, or a string that gets evaluated, etc.
+ //
+ // When creating a new dojo.store, simply set the store's queryEngine
+ // field as a reference to this function.
+ //
+ // query: Object
+ // An object hash with fields that may match fields of items in the store.
+ // Values in the hash will be compared by normal == operator, but regular expressions
+ // or any object that provides a test() method are also supported and can be
+ // used to match strings by more complex expressions
+ // (and then the regex's or object's test() method will be used to match values).
+ //
+ // options: dojo.store.util.SimpleQueryEngine.__queryOptions?
+ // An object that contains optional information such as sort, start, and count.
+ //
+ // returns: Function
+ // A function that caches the passed query under the field "matches". See any
+ // of the "query" methods on dojo.stores.
+ //
+ // example:
+ // Define a store with a reference to this engine, and set up a query method.
+ //
+ // | var myStore = function(options){
+ // | // ...more properties here
+ // | this.queryEngine = dojo.store.util.SimpleQueryEngine;
+ // | // define our query method
+ // | this.query = function(query, options){
+ // | return dojo.store.util.QueryResults(this.queryEngine(query, options)(this.data));
+ // | };
+ // | };
+
+ // create our matching query function
+ switch(typeof query){
+ default:
+ throw new Error("Can not query with a " + typeof query);
+ case "object": case "undefined":
+ var queryObject = query;
+ query = function(object){
+ for(var key in queryObject){
+ var required = queryObject[key];
+ if(required && required.test){
+ if(!required.test(object[key])){
+ return false;
+ }
+ }else if(required != object[key]){
+ return false;
+ }
+ }
+ return true;
+ };
+ break;
+ case "string":
+ // named query
+ if(!this[query]){
+ throw new Error("No filter function " + query + " was found in store");
+ }
+ query = this[query];
+ // fall through
+ case "function":
+ // fall through
+ }
+ function execute(array){
+ // execute the whole query, first we filter
+ var results = arrayUtil.filter(array, query);
+ // next we sort
+ if(options && options.sort){
+ results.sort(function(a, b){
+ for(var sort, i=0; sort = options.sort[i]; i++){
+ var aValue = a[sort.attribute];
+ var bValue = b[sort.attribute];
+ if (aValue != bValue) {
+ return !!sort.descending == aValue > bValue ? -1 : 1;
+ }
+ }
+ return 0;
+ });
+ }
+ // now we paginate
+ if(options && (options.start || options.count)){
+ var total = results.length;
+ results = results.slice(options.start || 0, (options.start || 0) + (options.count || Infinity));
+ results.total = total;
+ }
+ return results;
+ }
+ execute.matches = query;
+ return execute;
+};
+});