Commit Graph

3200 Commits

Author SHA1 Message Date
Miroslav Bajtoš 5fcad43aab
Merge pull request #1749 from strongloop/fix/typings
Fix types to describe native Promise
2019-06-13 15:37:40 +02:00
Miroslav Bajtoš df4d89279a
Fix types to describe native Promise
In version 4.0.0, we switched from Bluebird to native Promises.

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-06-13 15:24:01 +02:00
Miroslav Bajtoš acb667b73d
Merge pull request #1694 from spurreiter/operation-hook-error
feat: call after operation hook in case of errors
2019-06-01 11:33:53 +02:00
spurreiter 5b44c08f7a feat: after operation hook in case of errors
fix: move error into context

review: add debug statement; rename fns

fix: call next instead of ctx.end
2019-05-31 17:12:42 +02:00
Bill Matson 04523260c2 Fix for #1724 - Added options to attribute updates (#1725)
* Fix for #1724 - Added options to attribute updates

* Fix for #1724 - Added unit tests for options
2019-05-27 09:49:46 -04:00
Miroslav Bajtoš a5ba7408ff
4.7.1
* Fix "access" hook for unoptimized "near" queries (Miroslav Bajtoš)
 * Fix "loaded" hook for unoptimized "near" queries (Miroslav Bajtoš)
 * Test "near" queries executed in memory (Miroslav Bajtoš)
 * Fix DateString ctor to accept DateString instances (Miroslav Bajtoš)
 * datasource: copy settings object in constructor (Miroslav Bajtoš)
 * chore: update copyrights years (#1737) (Agnes Lin)
 * chore: update LTS status (#1734) (Diana Lau)
2019-05-14 09:48:27 +02:00
Miroslav Bajtoš 413f31631e
Merge pull request #1739 from strongloop/fix/hooks-with-near-queries
Fix implementation of Operation Hooks for "near" (geo) queries
2019-05-14 09:26:16 +02:00
Miroslav Bajtoš aa20180c4f
Fix "access" hook for unoptimized "near" queries
Before this change, when an "access" hook modified the "query" object,
the "near" condition from the original "query" object were still
applied. As a result, the query can end up being more restrictive and
return only a subset of models that should have matched the conditions.

With this change in place, after "access" hook observers are invoked,
we update the "near" condition using the "query" object provided by
hook observers.

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-05-14 09:17:54 +02:00
Miroslav Bajtoš 344441d48d
Fix "loaded" hook for unoptimized "near" queries
Before this change, two "loaded" events were emitted for every model
instance found. This commit fixes the problem and restores the intended
behavior.

The bug was probably introduced by 5e0c73bec7.
2019-05-14 09:17:54 +02:00
Miroslav Bajtoš caf9d09274
Test "near" queries executed in memory
Rework setup of the Operation Hooks test suite for memory connector
so that the "unoptimized" variant disables not only atomic CRUD
operations, but also geo queries.

This way we can test both "near" querying implementations:
 - When the connectors supports "near" queries natively.
 - When "near" queries are executed at LoopBack side in-memory.
2019-05-14 09:14:10 +02:00
Miroslav Bajtoš 853a41641b
Merge pull request #1740 from strongloop/fix/datestring-ctor
Fix DateString constructor to accept DateString instances
2019-05-13 16:07:40 +02:00
Miroslav Bajtoš 5369cf3d54
Fix DateString ctor to accept DateString instances
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-05-13 15:21:00 +02:00
Miroslav Bajtoš 91ab3e9162
Merge pull request #1738 from strongloop/fix/modification-of-datasource-config
datasource: copy settings object in constructor
2019-05-10 16:01:39 +02:00
Miroslav Bajtoš ef0257e338
datasource: copy settings object in constructor
Fix DataSource constructor to create a shallow copy of the settings
object provided by the caller. This prevents surprising behavior
where changes made to `ds.settings` were picked up by the provided
config object, as observed e.g. in tests of our MongoDB connector.
2019-05-10 14:56:02 +02:00
Agnes Lin de4718d5b8 chore: update copyrights years (#1737) 2019-05-08 11:45:37 -04:00
Diana Lau 98eb783a80
chore: update LTS status (#1734) 2019-05-06 13:27:52 -04:00
biniam 2aa4d20394 4.7.0
* fix: allow coercion of nested properties (biniam)
2019-05-03 19:15:10 -04:00
Biniam Admikew 0b871d1de1
Merge pull request #1727 from strongloop/fix/nested-property-coercion-4x
fix: allow coercion of nested properties

Handle model definitions with nested property
definitions for coercion of primitive values.
2019-05-03 19:08:53 -04:00
biniam 9c94b9344b fix: allow coercion of nested properties
Handle model definitions with nested property
definitions for coercion of primitive values.
2019-05-03 18:45:39 -04:00
Miroslav Bajtoš 3fba79e725
4.6.4
* Fix tests for empty/default values to pass on SQL (Miroslav Bajtoš)
 * Update nyc to 14.0.0 (Miroslav Bajtoš)
 * test: define models in before hooks (biniam)
 * Update `should` to `13.2.3` (Miroslav Bajtoš)
 * Update `mocha` to `6.1.4` (Miroslav Bajtoš)
2019-05-03 09:04:42 +02:00
Miroslav Bajtoš 78c4bfbc2d
Merge pull request #1733 from strongloop/fix/postgresql
Fix tests for empty vs. default values to pass on SQL
2019-05-03 09:04:08 +02:00
Miroslav Bajtoš b0e3de1083
Fix tests for empty/default values to pass on SQL 2019-05-03 08:57:48 +02:00
Miroslav Bajtoš 08e8725ba5
Merge pull request #1732 from strongloop/update-nyc
Update nyc to 14.0.0
2019-05-02 13:24:58 +02:00
Miroslav Bajtoš 837c74d08e
Update nyc to 14.0.0 2019-05-02 13:01:10 +02:00
Biniam Admikew 6677c58cff
Merge pull request #1721 from strongloop/fix/failing-tests
test: define models properly
2019-04-30 11:50:10 -04:00
biniam eff6458a2a test: define models in before hooks
Re-work tests from #1702 based on the failures observed in #1719
and cherry-pick those commits back to master using ES6 syntax.
2019-04-30 11:15:23 -04:00
Miroslav Bajtoš 0bba44ee29
Merge pull request #1730 from strongloop/update-deps
Update `mocha` and `should` to latest
2019-04-30 12:10:34 +02:00
Miroslav Bajtoš 76673a8ed8
Update `should` to `13.2.3` 2019-04-30 11:44:08 +02:00
Miroslav Bajtoš 511c4763d3
Update `mocha` to `6.1.4` 2019-04-30 11:44:00 +02:00
Miroslav Bajtoš 88312422d8
4.6.3
* Add support for Node.js 12.x (Miroslav Bajtoš)
 * fix: coerce primitive properties on update (biniam)
 * fix: coerce date array properties (biniam)
 * fix: normalize include with boolean or number (spurreiter)
2019-04-30 10:52:46 +02:00
Miroslav Bajtoš 6793be20ca
Merge pull request #1728 from strongloop/chore/add-node-12
Add support for Node.js 12.x
2019-04-30 09:09:37 +02:00
Miroslav Bajtoš 5c3405eceb
Add support for Node.js 12.x
- Fix code to pass all tests on Node.js 12
- Add Node.js 12 to the list of Travis CI platforms
2019-04-29 09:46:57 +02:00
Biniam Admikew 47addd943a
Merge pull request #1702 from strongloop/fix/nested-property-resolution
fix: primitive data type coercion
2019-04-16 12:00:24 -04:00
biniam 48af738ec4 fix: coerce primitive properties on update 2019-04-16 10:51:44 -04:00
biniam 1534392c62 fix: coerce date array properties 2019-04-16 10:50:54 -04:00
Miroslav Bajtoš fe83f3cfd1
Merge pull request #1581 from spurreiter/include-crashes
fix: normalize include with boolean or number
2019-04-12 17:05:02 +02:00
jannyHou b3945fcd33 4.6.2
* chore: update CODEOWNERS (#1712) (Diana Lau)
 * fix: ignore git file (#1714) (Janny)
 * remove kv-extreme-scale ctor from downstream test (#1710) (Diana Lau)
2019-04-10 11:59:45 -04:00
Diana Lau 11f9c1f23a
chore: update CODEOWNERS (#1712) 2019-04-10 11:07:55 -04:00
Janny b4d89fc7c5
fix: ignore git file (#1714) 2019-04-10 10:51:21 -04:00
Diana Lau 7288277e87
remove kv-extreme-scale ctor from downstream test (#1710) 2019-04-10 10:20:38 -04:00
Miroslav Bajtoš 095fe62fa6
4.6.1
* Improve tests for empty vs. default values (Miroslav Bajtoš)
 * Do not apply default values on data from database (Miroslav Bajtoš)
 * Update datasource-connector.md (#1703) (Jam Risser)
 * feat: support array within array (Hage Yaapa)
 * fix: update lodash (#1696) (Janny)
2019-04-09 18:20:02 +02:00
Miroslav Bajtoš a8d0d78913
Merge pull request #1707 from strongloop/test/fix-default-values
Improve tests for empty vs. default values
2019-04-09 18:12:40 +02:00
Miroslav Bajtoš 7d69bdab70
Improve tests for empty vs. default values 2019-04-09 15:54:52 +02:00
spurreiter 55b10a43c4 fix: normalize include with boolean or number
- On include = true or include = 1 the lib crashes with
  "TypeError: includes.forEach is not a function".
- checking for boolean and number type and return empty array.
- fix: include symbol and function in normalization
- fix: review changes; adding debug stmt + early exit for tests
2019-04-05 19:02:57 +02:00
Miroslav Bajtoš 84eee5a69e
Merge pull request #1704 from strongloop/fix/default-value-in-response
fix: do not apply default values on data from database
2019-04-04 10:10:23 +02:00
Miroslav Bajtoš e45292de08
Do not apply default values on data from database
Before this change, when a property was configured with a default value
at LoopBack side and the database was returned a record with a missing
value for such property, then we would supply use the configured
default.

This behavior is problematic for reasons explained in #1692.

In this commit, we are fixing DAO operations like `find` and
`findOrCreate` so that they do NOT apply default property values on
data returned by the database (connector).

Please note that most of the other CRUD methods were already not
applying default values on database data as long as the connector
provided native implementation of the operation.
2019-04-04 09:47:31 +02:00
Jam Risser ff5a3fa8bf Update datasource-connector.md (#1703)
Corrected typo in docs
2019-03-28 16:34:35 -04:00
Hage Yaapa 3f9448f5d2
Merge pull request #1699 from strongloop/fix/list-format
feat: support array within array
2019-03-19 19:06:08 +05:30
Hage Yaapa 80d8fcd8b1 feat: support array within array 2019-03-07 15:58:26 +05:30
Janny 5a7c0326ab
fix: update lodash (#1696) 2019-03-01 14:29:56 -05:00