Jürg Lehni
0ce1fa9f87
Add a better way to handle transactions
2017-09-06 07:10:57 +02:00
Rashmi Hunt
6c6df15286
Flag id as updateOnly when forceId is in effect ( #1453 )
...
* updateOnly, forceId changes
* support getUpdateOnlyProperties
* fixup! fix updateOrCreate in forceId mode
The contract of `updateOrCreate` is expecting a full object instance
to be passed to the callback.
The current implementation was creating an empty instance and
calling updateAttributes under the hood. As a result, the callback
was called with the attributes being updated only.
In order to preserve existing behaviour, we have to always build
a full initial instance by calling `findById`.
See the following discussion for more context:
https://github.com/strongloop/loopback-datasource-juggler/issues/966
* fixup! fix tests of upsert validation
* move forceId to model-builder
* remove TODO comment
* revert refactoring and test fixes
* Remove duplicate test
* change testcase names
* change to ModeClass.settingse
* forceId setup from datasource to model-builder
* fix inheritance of auto-generated forceId
* Fixed failing tests for auto change
* fixed a comment
2017-08-22 13:09:45 -07:00
loay
01b4c4a3a7
Catch err using Callback
2017-08-16 17:00:41 -04:00
Raymond Feng
03753b6fe2
Fix undefined properties in where
...
https://github.com/strongloop/loopback/issues/2364
2017-08-03 14:09:21 -04:00
ssh24
80f015c2d2
Honor backwards compatability with validate update
2017-08-03 11:50:44 -04:00
ssh24
9cd0108fc6
Fix update validation callback
2017-08-02 14:55:47 -04:00
ssh24
b1a0cb8c3b
Validate updateAll
2017-08-02 13:24:21 -04:00
loay
b1b2d5df0c
Catch errors using cb
2017-07-24 14:08:58 -04:00
ssh24
ba1901b2a0
Fix updateAttributes cb
...
Allow pass through of the new data from the connector
Specifically for cloudant since updateAttributes changes the _rev
2017-05-29 15:32:32 -04:00
Raymond Feng
5a0b0270f3
Return promise for batch create
2017-05-19 16:16:52 -07:00
ssh24
54f67dc3b0
Use correct data on replace callback
...
Previously, it would just pass the old data
Pass the new data as cloudant updates the _rev property on CRUD
2017-05-18 17:03:21 -04:00
Loay
87dd44dd59
Fix assertion errors
2017-05-04 10:38:06 -04:00
Loay
f1d10b47ce
Fix forceId bug for updateOrCreate
2017-04-18 13:14:35 -04:00
Joshua Chaitin-Pollak
bb3812fbfb
Allow `after save` hook to see count of records changed ( #1231 )
...
* `after save` hook allows count of records changed
* Fix PR linter
2017-04-06 12:02:34 -04:00
Jonathan Sheely
21b08af7a3
Added notify flag for create and upsert ( #1277 )
...
* Added notify flag for create and upsert
* Code styling
* More code styling
* Added unit test for notify
* Fix PR linter
2017-04-05 13:23:26 -04:00
Mikhail
68b93e1074
Disallow regexp string in arrays for coerce ( #1279 )
...
Disallow regexp arrays for coerce
2017-03-22 20:29:01 -04:00
Diana Lau
eb2cb315e6
FindOrCreate missing error callback
2017-03-20 10:32:09 -04:00
Dimitris
6f8ecfdf5c
Fixes #1230 coerceArray converts empty Objects ( #1269 )
2017-03-20 10:05:11 -04:00
Kevin Delisle
248aaf0541
dao: catch errors on Model creation in find
2017-03-16 17:26:53 -04:00
Kevin Delisle
a6c5802940
dao: catch sync errors on setAttributes
...
Wrap inst.setAttributes in try-catch to prevent synchronous errors
from crashing the application.
2017-03-16 17:26:53 -04:00
Loay
46318d2094
Update error message
2017-03-16 11:02:08 -04:00
Rémi Bèges
9afaa9a66e
Fix id update error message formatting
...
Error is raised when trying to update an id property while forceId
is set to true
2017-02-15 18:26:32 +01:00
Miroslav Bajtoš
d809260799
Upgrade eslint-config, fix new violations
2017-02-01 12:45:56 +01:00
Matteo Padovano
733ad1a024
Refactor logic of options.allowExtendedOperators
...
Implement logic to allowExtendedOperators options
per request, per Model and Datasource.
2017-01-30 00:05:56 +01:00
Loay
44a5a7ad81
Fix forceId validation error
2017-01-26 16:52:19 -05:00
Heath Morrison
2377792c22
Coerce array-like objects into arrays
...
The query-string parser used by express
https://github.com/ljharb/qs#parsing-arrays
limits the size of arrays that are created from query strings to 20
items. Arrays larger than that are converted to objects using numeric
indices.
This commit fixes the coercion algorithm used by queries to
treat number-indexed objects as arrays. We still maintain a strict
understanding of an "array-like object" to limit the opportunity for
subtle bugs. In particular, the presence of non-index keys is an
indication that the object was not intended to be interpreted as
an array.
2017-01-10 14:46:41 +01:00
Miroslav Bajtoš
454bf93aaf
Upgrade eslint-config to 7.x
...
Also upgrade eslint itself to 3.x.
2017-01-06 13:33:54 +01:00
Miroslav Bajtoš
779cf6a370
Honour allowExtendedOperators in "DAO.find"
...
Modify the coercion of filter.where to hounour "allowExtendedOperators"
and don't coerce property values of type object (extended operators).
2016-12-06 10:28:40 +01:00
Amir Jafarian
54d0f5b53d
Add support for `loaded` hook
...
* Add support for loaded hook for DAO.find with near filter
2016-10-28 11:46:46 -04:00
Heath Morrison
266e9f5a9a
Continue _coerce after logical operators
2016-10-25 23:09:46 +03:00
Nick Duffy
a23076d3a8
Add ilike and nilike operators
...
Closes #633
2016-10-12 18:31:31 -06:00
Amir Jafarian
e42b1327aa
Fix JSDoc issue
2016-10-11 12:15:35 -04:00
Amirali Jafarian
66f27b9b83
Merge pull request #1094 from strongloop/newInstance_loade_updateAttributes
...
Add 'isNewInstance' for updateAttributes
2016-09-21 09:23:57 -04:00
Amir Jafarian
fec7742a69
Add 'isNewInstance' for updateAttributes
...
* Add 'isNewInstance' to loaded hook for updateAttributes
2016-09-19 16:56:15 -04:00
David Cheung
805db78e19
Strict mode now always return validationError
...
- Deprecation of strict:validate and strict:throw
- When strict mode is enabled, it will now always
return validation error (previous strict:validate)
2016-09-19 10:27:24 -04:00
Amir Jafarian
2830062259
Disable `strict` for a few files
...
*Disable `strict` for a few files to disappear warnings
2016-08-26 09:54:31 -04:00
Amir Jafarian
aa6d28268b
Auto-update by eslint --fix
2016-08-22 15:12:25 -04:00
Sonali Samantaray
37541dd178
upsertWithWhere feature support in juggler DAO
2016-08-16 18:06:01 +05:30
Amir-61
1e57d4f316
Merge pull request #1034 from strongloop/err_connector_not_implements_replaceById
...
Return error if the connector does not implement
2016-08-09 14:01:58 -04:00
Amir Jafarian
327c785347
Return error if the connector does not implement
...
* Return error if the connector does not implement `replaceById`
2016-08-09 10:37:15 -04:00
Amir Jafarian
d181fd0671
Fixup globalization
2016-08-08 15:34:41 -04:00
Richard Pringle
0b62dd94ea
Disallow bulk updateOrCreate.
2016-08-05 11:54:06 +02:00
Amir Jafarian
f2f9b4a6f8
Use g.f instead of utils.format
2016-08-03 10:47:40 -04:00
Amir Jafarian
4ce5b5d3a0
Support for globalization
2016-07-28 15:20:18 -04:00
Miroslav Bajtoš
699e0587d1
Ensure stable order of items in DAO.find()
...
When post-processing result of find operation, use "async.map"
instead of "async.each + array.push" to ensure the order of items
is preserved.
2016-07-13 14:55:49 +02:00
RobinBiondi
fbe58f7cf8
give options to validators #984
2016-06-24 14:44:43 -07:00
Amir Jafarian
7a8803cb38
Give warning if PK is changed in hooks
...
* Give warning if PK is changed in `before save` and `loaded`
operation hooks for replaceById
2016-06-08 11:56:19 -04:00
Candy
3daca1e960
Remove model events
2016-06-08 10:27:05 -04:00
Amir Jafarian
cae44f0458
Fix error message
...
*Fix error message when PK is changed in `replaceById`
2016-06-01 16:16:35 -04:00
Amir Jafarian
82546fdf47
Retun err for UPSERT if the connector returns err
2016-05-31 22:17:23 -04:00