Commit Graph

1500 Commits

Author SHA1 Message Date
Miroslav Bajtoš 5a51c7f0fa Merge pull request #1271 from strongloop/refactor/core-models
Refactor Model and PersistedModel registration
2015-04-03 09:40:21 +02:00
Miroslav Bajtoš c72c134d80 Refactor Model and PersistedModel registration
Modify the files to export a model factory function accepting
a `registry` argument. This is a preparation step for per-application
models - see #1212.
2015-04-03 09:26:19 +02:00
Raymond Feng 72d547971a Merge branch 'fabien-fix/embeds-one-remoting' 2015-04-02 08:45:30 -07:00
Raymond Feng 64ccb785c2 Fix the style issue 2015-04-02 08:45:04 -07:00
Raymond Feng 9af828efd4 Merge branch 'fix/embeds-one-remoting' of https://github.com/fabien/loopback into fabien-fix/embeds-one-remoting 2015-04-02 08:41:49 -07:00
Miroslav Bajtoš cdbdc4b55d Merge pull request #1269 from strongloop/fix/replication-checkpoints
Add missing error handlers to checkpoints()
2015-04-02 14:21:46 +02:00
Miroslav Bajtoš 8493ede19e Add missing error handlers to checkpoints() 2015-04-02 14:14:32 +02:00
Rand McKinney 8a1fe0b744 Fix where param format 2015-04-01 11:29:35 -07:00
Miroslav Bajtoš 3ef7dedfa4 2.15.0
* 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š)
2015-04-01 18:50:18 +02:00
Miroslav Bajtoš 4a81d06018 Merge pull request #1251 from strongloop/feature/improve-replication-error-logging
Improve error handling in replication
2015-03-30 11:16:54 +02:00
Miroslav Bajtoš 63e2f4b134 Improve error handling in replication
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.
2015-03-30 11:07:53 +02:00
Miroslav Bajtoš 6640f8a082 Merge pull request #1254 from strongloop/feature/run-in-context
Add `loopback.runInContext`
2015-03-27 19:15:22 +01:00
Miroslav Bajtoš 2aa09ba574 Add `loopback.runInContext`
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
2015-03-27 19:12:17 +01:00
Raymond Feng 548cb6ef94 Fix style issues 2015-03-27 08:59:11 -07:00
Miroslav Bajtoš ade5d5ea21 Merge pull request #1246 from strongloop/fix/browser-bundle-size
Import subset of underscore.string scripts only
2015-03-27 08:51:59 +01:00
Miroslav Bajtoš e69eba6560 Merge pull request #1252 from strongloop/fix/updateall-deleteall-jsdoc
Improve API docs
2015-03-26 19:20:31 +01:00
Miroslav Bajtoš 2ca621e597 Document the new third callback arg of replicate() 2015-03-26 19:10:00 +01:00
Miroslav Bajtoš caf53f72c1 Fix API doc for updateAll/deleteAll
Based on changes made in
  https://github.com/strongloop/loopback/issues/1167
  https://github.com/strongloop/loopback-datasource-juggler/pull/540
2015-03-26 19:06:56 +01:00
Miroslav Bajtoš 7528cbb712 Import subset of underscore.string scripts only
Require individual methods like `classify` instead of the whole module.
This reduces the size of the browser bundle from ~27kb down to ~2kb.
2015-03-25 14:02:16 +01:00
Miroslav Bajtoš 4a8c3be8f4 Merge pull request #1233 from strongloop/feature/conflict-resolution-api
Add conflict resolution API
2015-03-24 12:08:25 +01:00
Miroslav Bajtoš df770455eb Merge pull request #1238 from strongloop/fix/change-tracking-on-delete
Use `ctx.instance` provided by "after delete" hook
2015-03-24 11:06:55 +01:00
Miroslav Bajtoš cadb5e4524 Use `ctx.instance` provided by "after delete" hook
Use the recently added context property `ctx.instance` to improve
the accuracy of the algorithm detecting whether a single or
multiple models were deleted.
2015-03-23 11:49:47 +01:00
Fabien Franzen 93aefc36f5 Test embedsOne CRUD methods 2015-03-21 17:21:49 +01:00
Miroslav Bajtoš 65c14c1779 Add conflict resolution API
New methods:
  conflict.resolveUsingSource(cb)
  conflict.resolveUsingTarget(cb)
  conflict.resolveManually(data, cb)
2015-03-20 17:47:07 +01:00
Miroslav Bajtoš 911d8323b4 Merge pull request #1205 from strongloop/feature/custom-verify-token-generator
Add ability to pass in custom verification token generator
2015-03-20 08:56:59 +01:00
Miroslav Bajtoš 7454462526 Merge pull request #1214 from strongloop/fix/bulkUpdate-race-condition
Detect 3rd-party changes made during replication
2015-03-20 08:30:31 +01:00
Miroslav Bajtoš 87940a4b58 Detect 3rd-party changes made during replication
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.)
2015-03-20 08:19:59 +01:00
jakerella 713001913e 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.
2015-03-19 16:56:38 -04:00
Miroslav Bajtoš 91f59e1ccd Remove unnecessary delay in tests. 2015-03-19 08:00:37 +01:00
Simon Ho 3de9594bf4 Update README.md 2015-03-16 10:12:13 -07:00
crandmck 1cabd74308 Remove duplicate cb func from getRoles and other doc cleanup 2015-03-12 11:15:36 -07:00
Raymond Feng 131633f50d Merge pull request #1169 from strongloop/feature/allow-current-user-literal
Allow 'me' literal to represent the current user in url
2015-03-12 10:20:39 -07:00
Raymond Feng 6ad61d6c00 Enhance the token middleware to support current user literal 2015-03-12 08:28:15 -07:00
Raymond Feng 8bfa3ba8d7 Merge pull request #1201 from seriousben/strengthen_owner_role_check
Handling owner being a relation/function
2015-03-11 09:03:19 -07:00
Benjamin Boudreau 2d08e656b8 Handling owner being a relation/function 2015-03-11 10:25:40 -04:00
Miroslav Bajtoš b08861a1b1 Merge pull request #1187 from strongloop/feature/replication-conflict-tests
Add replication tests for conflict resolution; run replication tests in the browser too
2015-03-06 18:23:40 +01:00
Miroslav Bajtoš 59ae90bb97 Run replication tests in the browser too 2015-03-06 14:50:16 +01:00
Miroslav Bajtoš 8f41ac4b35 Add replication tests for conflict resolution 2015-03-06 14:50:16 +01:00
Miroslav Bajtoš 4b02fe12d9 Merge pull request #1184 from strongloop/fix/chai-assertions
Fix an assertion broke by recent chai upgrade.
2015-03-06 11:30:51 +01:00
Miroslav Bajtoš f57086d5f2 Fix an assertion broke by recent chai upgrade. 2015-03-06 11:22:30 +01:00
Miroslav Bajtoš e59493ec40 Merge pull request #1176 from strongloop/feature/more-replication-improvements
Prevent more kinds of false replication conflicts
2015-03-06 07:27:16 +01:00
Raymond Feng 14731165b7 Merge pull request #1174 from ulion/static_acl_multiple_properties
Static ACL support array of properties now
2015-03-05 14:35:53 -08:00
ulion 9f705139f8 Static ACL support array of properties now 2015-03-06 06:24:09 +08:00
Raymond Feng 77e4a47c3c Merge pull request #1172 from strongloop/feature/upgrade-deps
Upgrade deps
2015-03-05 08:29:32 -08:00
Miroslav Bajtoš c2e1b12644 Add more integration tests for replication
Add tests covering typical replication scenarios that happen
in the setup where multiple clients are synchronizing changes
against a single server (database).
2015-03-05 14:55:55 +01:00
Miroslav Bajtoš 76d9244448 Prevent more kinds of false replication conflicts
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.
2015-03-05 14:15:02 +01:00
Raymond Feng 2ce1d14a0e Upgrade deps 2015-03-04 16:30:03 -08:00
Simon Ho 84c65de38a Merge pull request #1160 from strongloop/fix/issues-link-in-readme
Fix "Issues" link in readme
2015-03-04 13:59:02 -08:00
Simon Ho ca11445ac3 Fix "Issues" link in readme 2015-03-04 12:14:35 -08:00
Miroslav Bajtoš b381c5df7e Add more debug logs to replication 2015-03-04 15:00:53 +01:00