Skip to content

Commit

Permalink
Merge branch '0.8.x' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
emacsway committed May 26, 2018
2 parents 3638a75 + a5e2dbb commit c66d02c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 51 deletions.
36 changes: 0 additions & 36 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -930,42 +930,6 @@ Contributing
Please, use `Dojo Style Guide <https://dojotoolkit.org/reference-guide/1.10/developer/styleguide.html>`_ and `Dojo contributing workflow <https://github.com/dojo/meta/blob/master/CONTRIBUTING.md>`_.


Alternatives, related and useful links
======================================

- `Dojo2 Stores <https://github.com/dojo/stores>`_ - \
Excellent implementation of `Repository`_ pattern in paradigm of `Reactive Programming`_ for non-relational data.
- `Dstore <http://dstorejs.io/>`_ - \
yet another excellent implementation of `Repository`_ pattern.
- `Dojo1 Store <https://dojotoolkit.org/reference-guide/1.10/dojo/store.html>`_ - \
Dojo1 implementation of `Repository`_ pattern.
- `JS-Data <http://www.js-data.io/>`_ - \
Object-Relational Mapping (ORM) written by JavaScript for relational data. Does not support composite relations.
- `9 JavaScript Libraries for Working with Local Storage <https://www.sitepoint.com/9-javascript-libraries-working-with-local-storage/>`_ - \
article with interesting comments.
- `Kinvey Data Store <http://devcenter.kinvey.com/angular/guides/datastore>`_ - \
implementation of `Repository`_ pattern by MBaaS Kinvey, `source code <https://github.com/Kinvey/js-sdk/tree/master/src/datastore/src>`__
- `Pocket.js <https://github.com/vincentracine/pocketjs>`_ - \
a wrapper for the window.localStorage. It provides helpful methods which utilise MongoDB's proven syntax and provides a powerful lightweight abstraction from the complexity of managing and querying local storage.
- `ZangoDB <https://erikolson186.github.io/zangodb/>`_ is a MongoDB-like interface for HTML5 IndexedDB that supports most of the familiar filtering, projection, sorting, updating and aggregation features of MongoDB, for usage in the web browser (`source code <https://github.com/erikolson186/zangodb>`__).
- `JsStore <http://jsstore.net/>`_ is Sql Like IndexedDb Wrapper. It provides simple api to store, retrieve, delete, remove, and for other advanced Database functionalities (`source code <https://github.com/ujjwalguptaofficial/JsStore>`__).

- `Normalizr <https://github.com/paularmstrong/normalizr>`_ - \
Normalizes (decomposes) nested JSON according to a schema.
- `Denormalizr <https://github.com/gpbl/denormalizr>`_ - \
Denormalize data normalized with normalizr.
- `RxJS <https://github.com/Reactive-Extensions/RxJS>`_ - \
The Reactive Extensions for JavaScript.

Examples of the simplest implementations of the Repository pattern by JavaScript in the project `todomvc.com <http://todomvc.com/>`_:

- Angular2+: https://github.com/tastejs/todomvc/blob/master/examples/angular2/app/services/store.ts
- Angular2+: https://github.com/tastejs/todomvc/blob/master/examples/angular2_es2015/app/services/todo-store.service.js
- AngularJS: https://github.com/tastejs/todomvc/blob/master/examples/angularjs/js/services/todoStorage.js
- React: https://github.com/tastejs/todomvc/blob/master/examples/react/js/todoModel.js
- React+Alt: https://github.com/tastejs/todomvc/blob/master/examples/react-alt/js/stores/todoStore.js


.. _Coupling: http://wiki.c2.com/?CouplingAndCohesion
.. _Cohesion: http://wiki.c2.com/?CouplingAndCohesion
.. _DDD: https://en.wikipedia.org/wiki/Domain-driven_design
Expand Down
36 changes: 21 additions & 15 deletions store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,15 +1308,20 @@ function namespace(root) {
};


function toFullFeaturedQuery(query) {
if ('$query' in query) {
return query;
}
// Don't clone query into itself if you want to keep all references to the root.
// We have to keep all references to the same logical level.
// A component of the query can be changeable by event.
// See emulatedRelation._emulateRelation() for more info.
return {'$query': query};
}


function AbstractQueryWalker(queryEngine, query) {
if (!('$query' in query)) {
// Don't clone query into itself if you want to keep all references to the root.
// We have to keep all references to the same logical level.
// A component of the query can be changeable by event.
// See emulatedRelation._emulateRelation() for more info.
query = {'$query': query};
}
this._query = query;
this._query = toFullFeaturedQuery(query);
this._promises = [];
this._queryEngine = queryEngine;
}
Expand Down Expand Up @@ -2943,14 +2948,15 @@ function namespace(root) {
},
delete: function(store, obj, onCommit, onRollback, onPending, onAutocommit) {
var index = this._findDirty(obj);
if (index !== -1 && this._dirtyObjectList[index].cancelable()) {
if (index !== -1) {
this._dirtyObjectList.splice(index, 1);
return Promise.resolve(obj);
} else {
var dirty = new DeleteDirty(store, obj, onCommit, onRollback, onPending, onAutocommit);
this._dirtyObjectList.push(dirty);
return dirty.pending();
if (this._dirtyObjectList[index].cancelable()) {
return Promise.resolve(obj);
}
}
var dirty = new DeleteDirty(store, obj, onCommit, onRollback, onPending, onAutocommit);
this._dirtyObjectList.push(dirty);
return dirty.pending();
},
_findDirty: function(obj) {
for (var i = 0; i < this._dirtyObjectList.length; i++) {
Expand Down Expand Up @@ -3772,4 +3778,4 @@ if (typeof define === 'function' && define.amd) {
} else {
root.store = namespace(root);
}
}());
}());

0 comments on commit c66d02c

Please sign in to comment.