* Improve error handling in replication (Miroslav Bajtoš)
* Add `loopback.runInContext` (Miroslav Bajtoš)
* Fix style issues (Raymond Feng)
* Document the new third callback arg of replicate() (Miroslav Bajtoš)
* Fix API doc for updateAll/deleteAll (Miroslav Bajtoš)
* Import subset of underscore.string scripts only (Miroslav Bajtoš)
* Use `ctx.instance` provided by "after delete" hook (Miroslav Bajtoš)
* Add conflict resolution API (Miroslav Bajtoš)
* Detect 3rd-party changes made during replication (Miroslav Bajtoš)
* Ability to pass in custom verification token generator This commit adds the ability for the developer to use a custom token generator function for the user.verify(...) method. By default, the system will still use the crypto.randomBytes() method if no option is provided. (jakerella)
* Remove unnecessary delay in tests. (Miroslav Bajtoš)
* Update README.md (Simon Ho)
* Remove duplicate cb func from getRoles and other doc cleanup (crandmck)
* Enhance the token middleware to support current user literal (Raymond Feng)
* Handling owner being a relation/function (Benjamin Boudreau)
* Run replication tests in the browser too (Miroslav Bajtoš)
* Add replication tests for conflict resolution (Miroslav Bajtoš)
* Fix an assertion broke by recent chai upgrade. (Miroslav Bajtoš)
* Static ACL support array of properties now (ulion)
* Add more integration tests for replication (Miroslav Bajtoš)
* Prevent more kinds of false replication conflicts (Miroslav Bajtoš)
* Upgrade deps (Raymond Feng)
* Fix "Issues" link in readme (Simon Ho)
* Add more debug logs to replication (Miroslav Bajtoš)
* Fixes#1158. (Jason Sturges)
* Checkpoint: start with seq=1 instead of seq=0 (Miroslav Bajtoš)
* Return new checkpoints in callback of replicate() (Miroslav Bajtoš)
* Create a remote checkpoint during replication too (Miroslav Bajtoš)
* Replication: fix checkpoint-related race condition (Miroslav Bajtoš)
* Support different "since" for source and target (Miroslav Bajtoš)
Deprecate `Change.handleError`, it was used inconsistenly for a subset
of possible errors only. Rework all `Change` methods to always report
all errors to the caller via the callback.
Rework `PersistedModel` to report change-tracking errors via the
existing method `PersistedModel.handleChangeError`. This method
can be customized on a per-model basis to provide different error
handling.
The default implementation emits `error` event on the model class,
users can attach an event listener that can provide a custom error
handler.
NOTE: Unhandled `error` events crash the application by default.
Refactor the core implementation of current context from
server/middleware/context.js into server/current-context.js.
Expose new public API:
- loopback.runInContext
- loopback.createContext
Use the recently added context property `ctx.instance` to improve
the accuracy of the algorithm detecting whether a single or
multiple models were deleted.
Modify `Change.diff()` to include current data revision in each
delta reported back. The current data revision is stored in
`delta.prev`.
Modify `PersistedModel.bulkUpdate()` to check that the current data
revision matches `delta.prev` and report a conflict if a third party
has modified the database under our hands.
Fix `Change` implementation and tests so that they are no longer
attempting to create instances with duplicate ids.
(This used to work because the memory connector was silently
converting such requests to updateOrCreate/findOrCreate.)
This commit adds the ability for the developer to use a custom token generator function for the user.verify(...) method. By default, the system will still use the crypto.randomBytes() method if no option is provided.
Add tests covering typical replication scenarios that happen
in the setup where multiple clients are synchronizing changes
against a single server (database).
Rework the Change model to merge changes made within the same
Checkpoint.
Rework `replicate()` to run multiple iteration until there were no
changes replicated. This ensures that the target model is left in
a clean state with no pending changes associated with the latest
(current) checkpoint.
* Replace deprecated hooks with Operation hooks (Miroslav Bajtoš)
* test: don't warn about running deprecated paths (Miroslav Bajtoš)
* karma conf: prevent timeouts on Travis CI (Miroslav Bajtoš)
* Pass options from User.login to createAccessToken (Raymond Feng)
* Config option to disable legacy explorer routes Setting legacyExplorer to false in the loopback config will disable the routes /routes and /models made available in loopback.rest. The deprecate module has been added to the project with a reference added for the legacyExplorer option as it is no longer required by loopback-explorer. Tests added to validate functionality of disabled and enabled legacy explorer routes. (Ron Edgecomb)
* test: setup GUID for all models tracking changes (Miroslav Bajtoš)
* Change tracking requires a string id set to GUID (Miroslav Bajtoš)
Extend `PersistedModel.replicate` to pass the newly created checkpoints
as the third callback argument.
The typical usage of these values is to pass them as the `since`
argument of the next `replicate()` call.
global.since = -1;
function sync(cb) {
LocalModel.replicate(
since,
RemoteModel,
function(err, conflicts, cps)
if (err) return cb(err);
if (!conflicts.length) {
since = cps;
return cb();
}
// resolve conflicts and try again
});
}