Commit Graph

1500 Commits

Author SHA1 Message Date
Miroslav Bajtoš 2885317634 Merge pull request #1157 from strongloop/feature/replication-improvements
Replication improvements: Checkpoint
2015-03-04 08:45:19 +01:00
Simon Ho d5b7447750 Merge pull request #1159 from jasonsturges/issue/1158
Fixes #1158.
2015-03-03 13:58:06 -08:00
Raymond Feng b7541c1a7e 2.14.0
* 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š)
2015-03-03 11:14:55 -08:00
Jason Sturges 53bf92c2cc Fixes #1158. 2015-03-03 13:14:26 -06:00
Miroslav Bajtoš 3d5c8a7443 Checkpoint: start with seq=1 instead of seq=0
Since the seq behaves in many senses like an id, it should meet
the usual expectation people have about ids. Using only truthy values
is one of them.
2015-03-03 19:37:11 +01:00
Miroslav Bajtoš 628e3a30ca Return new checkpoints in callback of replicate()
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
        });
    }
2015-03-03 19:37:11 +01:00
Miroslav Bajtoš 53ebddfa9f Create a remote checkpoint during replication too
Before this change, in the case of a one-way replication, the remote
checkpoint was never updated, thus the "diff" step had to check
all changes made through the whole history.

This commit fixes the problem by creating a new remote checkpoint
at the same time when a local checkpoint is created.

It is important to create the new checkpoint before the replication is
started to prevent a race condition where a remote change can end up
being associated with an already replicated checkpoint.
2015-03-03 19:37:11 +01:00
Miroslav Bajtoš 2dc230b7cf Replication: fix checkpoint-related race condition
Rework the "replicate()" to create a new source checkpoint as the first
step, so that any changes made in parallel will be associated with
the next checkpoint.

Before this commit, there was a race condition where a change might
end up being associated with the already-replicated checkpoint and thus
not picked up by the next replication run.
2015-03-03 19:37:11 +01:00
Miroslav Bajtoš add9304555 Merge pull request #1148 from strongloop/fix/juggler-deprecation-warnings
Replace deprecated hooks with Operation hooks
2015-03-03 18:27:59 +01:00
Miroslav Bajtoš e20cc66787 Replace deprecated hooks with Operation hooks
AccessToken.beforeCreate -> AccessToken.observe('before save')
Application.beforeCreate -> Application.observe('before save')
Checkpoint.beforeSave -> Checkpoint.observe('before save')
2015-03-03 18:06:15 +01:00
Miroslav Bajtoš 2f9cf115c3 Support different "since" for source and target
Modify `PersistedModel.replicate` to allow consumers to provide
different "since" values to be used for the local and remote changes.

Make the "since" filters consistent and include the "since" value
in the range via `gte`. Before this commit, the local query used
`gt` and the remote query used `gte`.
2015-03-03 14:40:59 +01:00
Miroslav Bajtoš f857f44cae Merge pull request #1156 from strongloop/fix/internal-deprecation-warnings
test: don't warn about running deprecated paths
2015-03-03 14:38:11 +01:00
Miroslav Bajtoš 295c1534c9 test: don't warn about running deprecated paths 2015-03-03 14:34:05 +01:00
Miroslav Bajtoš 03ad328aac Merge pull request #1153 from strongloop/fix/phantomjs-timeouts-on-travis
karma conf: prevent timeouts on Travis CI
2015-03-03 10:07:38 +01:00
Miroslav Bajtoš 19519b038b karma conf: prevent timeouts on Travis CI
Increase the timeout values to prevent DISCONNECTED errors when
running the tests on slow machines (e.g. Travis CI).
2015-03-03 09:47:49 +01:00
Miroslav Bajtoš 774c70903e Merge pull request #1135 from greaterweb/fix/issue-1134
ability to disalbe /models /routes routes
2015-03-03 09:42:42 +01:00
Raymond Feng baf372b8d7 Merge pull request #1152 from strongloop/feature/enhance-user-login
Pass options from User.login to createAccessToken
2015-03-02 16:32:55 -08:00
Raymond Feng 78550a9bc5 Pass options from User.login to createAccessToken
It will allow subclass of User to create access token based on additional
properties such as 'scope'.
2015-03-02 14:48:08 -08:00
Ron Edgecomb 1818a8fb34 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.
2015-03-02 14:12:18 -05:00
Miroslav Bajtoš d24da8c37d Merge pull request #1140 from strongloop/feature/guids-for-replicated-models
Guids for replicated models
2015-03-02 18:23:06 +01:00
Miroslav Bajtoš f21b29e34a test: setup GUID for all models tracking changes
Fix all test models that are tracking changes so that they have
a generated unique string id.

Make model names unique where possible to prevent tests reusing
the same model which causes unintented side effects.
2015-03-02 18:16:18 +01:00
Miroslav Bajtoš 610767b6c8 Change tracking requires a string id set to GUID
Print a deprecation warning when a persisted model is tracking changes
but does not have a client-generated unique string id property (GUID).
2015-03-02 18:16:18 +01:00
Raymond Feng 19a3fe64e4 2.13.0
* Add a workaround to avoid conflicts with NewRelic (Raymond Feng)

 * Fix "User.confirm" to always call afterRemote hook (Pradnya Baviskar)

 * Skip hashing password if it's already hashed (Raymond Feng)

 * travis.yml: drop 0.11, add 0.12 and iojs (Miroslav Bajtoš)

 * Add docs for settings per #1069 (crandmck)

 * Fix change detection & tracking (Miroslav Bajtoš)

 * Minor doc fix (Ritchie Martori)

 * Upgrade jscs to ~1.11 via grunt-jscs ^1.5 (Miroslav Bajtoš)

 * Remove redundant dev-dep serve-favicon (Miroslav Bajtoš)

 * Fix test broken by recent juggler changes (Miroslav Bajtoš)

 * Fix coding style issue (Raymond Feng)

 * Remove trailing spaces (Raymond Feng)

 * Fix for issue 1099. (zane)

 * Fix API docs per #1041 (crandmck)

 * Fix API docs to add proper callback doc per #1041 (crandmck)

 * Fix #1080 - domain memory leak. (Samuel Reed)

 * Document user settings (Ritchie Martori)

 * Add wiki references to readme (Simon Ho)
2015-02-25 10:24:31 -08:00
Raymond Feng ce57fdd139 Merge pull request #1131 from strongloop/feature/workaround-new-relic
Add a workaround to avoid conflicts with NewRelic
2015-02-25 10:21:37 -08:00
Raymond Feng 9a0267e87a Add a workaround to avoid conflicts with NewRelic 2015-02-25 09:47:18 -08:00
Miroslav Bajtoš 3c43eccac7 Merge pull request #1120 from PradnyaBaviskar/lb-issue-416
Fix "User.confirm" to always call afterRemote hook

Close #1120
2015-02-25 14:26:07 +01:00
Pradnya Baviskar 8766d4a68d Fix "User.confirm" to always call afterRemote hook
Make the "redirect" parameter optional. When the parameter is not
specified, the server responds with an empty response (204). This allows
API clients to call the method without the need to handle redirects
and HTML responses.

Even when the "redirect" parameter is included, the builtin afterRemote
hook still calls next(), so that user-provided afterRemote hooks
are executed too.
2015-02-25 14:20:47 +01:00
Miroslav Bajtoš 3dc259b911 Merge pull request #1127 from strongloop/fix/travis-config
travis.yml: drop 0.11, add 0.12 and iojs
2015-02-25 13:46:30 +01:00
Raymond Feng 51d6548d98 Merge pull request #1132 from strongloop/feature/fix-user-perf
Skip hashing password if it's already hashed
2015-02-24 17:27:06 -08:00
Raymond Feng 13e618bff2 Skip hashing password if it's already hashed
See https://github.com/strongloop/loopback-datasource-juggler/issues/471
2015-02-24 16:36:51 -08:00
Miroslav Bajtoš 0de2dd4fb7 travis.yml: drop 0.11, add 0.12 and iojs 2015-02-24 08:25:13 +01:00
Miroslav Bajtoš 3d977f3e68 Merge pull request #1116 from strongloop/fix/change-detection
Fix change detection & tracking
2015-02-24 08:24:27 +01:00
crandmck a82b33ec5c Add docs for settings per #1069 2015-02-23 13:13:52 -08:00
Miroslav Bajtoš 702ecc6f72 Fix change detection & tracking
Add unit-tests to verify that all DAO methods correctly create change
records.

Rework the change detection to use the new operation hooks, this fixes
the bugs where operations like "updateOrCreate" did not update change
records.
2015-02-20 19:28:33 +01:00
Ritchie Martori c7bead4107 Minor doc fix 2015-02-20 09:16:09 -08:00
Miroslav Bajtoš 6276773c0b Merge pull request #1114 from strongloop/feature/upgrade-jscs
Upgrade jscs to ~1.11 via grunt-jscs ^1.5
2015-02-20 17:04:32 +01:00
Miroslav Bajtoš c2236c393b Upgrade jscs to ~1.11 via grunt-jscs ^1.5 2015-02-20 15:31:15 +01:00
Miroslav Bajtoš c0bea0bd3a Merge pull request #1113 from strongloop/fix/remove-redundant-deps
Remove redundant dev-dep serve-favicon
2015-02-20 13:40:34 +01:00
Miroslav Bajtoš 921759838d Remove redundant dev-dep serve-favicon
`serve-favicon` is already a regular dependency.
2015-02-20 13:28:35 +01:00
Miroslav Bajtoš d6761be40c Merge pull request #1112 from strongloop/fix/failing-test
Fix test broken by recent juggler changes
2015-02-20 13:23:38 +01:00
Miroslav Bajtoš c925e669f7 Fix test broken by recent juggler changes
The patch strongloop/loopback-datasource-juggler#436 changed the way
how `Model.extend` works, which broke one loopback test relying on the
old behaviour.

This commit fixes the failing test. The test is checking now that
the model base was not changed, instead of checking that the base
is undefined.
2015-02-20 13:08:39 +01:00
Raymond Feng a19f39396f Fix coding style issue 2015-02-18 15:25:46 -08:00
Raymond Feng 4afcfaa32f Merge pull request #1102 from zanemcca/fix/issue1099
Fix for issue 1099.
2015-02-18 09:21:10 -08:00
Raymond Feng e9dd12ab95 Merge pull request #1104 from strongloop/feature/remove-trailing-spaces
Remove trailing spaces
2015-02-18 09:14:15 -08:00
Raymond Feng fb88d98870 Remove trailing spaces 2015-02-18 09:13:47 -08:00
zane 39560b9ce6 Fix for issue 1099.
Signed-off-by: zane <zane.mccaig@mail.mcgill.ca>
2015-02-18 11:05:53 -04:00
crandmck ea35a2f48d Fix API docs per #1041 2015-02-10 15:18:34 -08:00
crandmck 538e9f0c62 Fix API docs to add proper callback doc per #1041 2015-02-10 15:13:55 -08:00
Raymond Feng 9816999864 Merge pull request #1083 from STRML/fixDomainLeak
Fix #1080 - domain memory leak.
2015-02-09 17:37:42 -08:00
Samuel Reed 42431d6e1e Fix #1080 - domain memory leak.
Domains are created per request rather than creating a single
domain for all requests. This kills the memory leak, as a single
domain would keep a reference to every single req and res, causing
rapid heap growth.
2015-02-10 08:28:20 +07:00