Commit Graph

3012 Commits

Author SHA1 Message Date
jannyHou fc8bf0ac1e 3.36.1
* chore: add test for atomic upsertWithWhere (#1864) (#1871) (Janny)
2020-11-27 00:38:16 -05:00
Janny 7058c52265
chore: add test for atomic upsertWithWhere (#1864) (#1871)
Introduce the new property atomicUpsertWithWhere for
connector that implement specific method.
See https://github.com/strongloop/loopback-connector-mongodb/pull/563
for mongodb implementation.

Signed-off-by: Matteo Padovano <mrbatista@users.noreply.github.com>

Co-authored-by: Matteo Padovano <mrbatista@users.noreply.github.com>
2020-11-24 09:53:21 -05:00
Raymond Feng e89429af8b 3.36.0
* Fix value equality test to avoid toString (Raymond Feng)
 * chore: update typescript (#1872) (Janny)
2020-11-02 10:37:32 -08:00
Raymond Feng d0ac37a727
Merge pull request #1875 from strongloop/3.x-backport-1874
Fix value equality test to avoid toString
2020-11-02 10:34:58 -08:00
Raymond Feng 3d71ea1571 Fix value equality test to avoid toString
- The where statement can be something like {toString: 'not a function'}
- Avoid object string comparison

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
2020-11-02 09:42:32 -08:00
Janny bebfd7d2bd
chore: update typescript (#1872)
Signed-off-by: jannyHou <juehou@ca.ibm.com>
2020-10-19 11:29:42 -04:00
Diana Lau ace629d3b3 3.35.0
* feat: added persistDefaultValues (#1815) (Hage Yaapa)
2019-12-17 10:57:53 -05:00
Hage Yaapa 9979efd040 feat: added persistDefaultValues (#1815)
Ignores value if it matches default value.
2019-12-17 10:53:29 -05:00
Diana Lau db2a59ef7d 3.34.0
* feat: applyDefaultOnWrites in nested properties (Hage Yaapa)
 * return failed promise on error (cherry-picked) (Dimitris Xalatsis)
2019-12-12 11:07:56 -05:00
Hage Yaapa f9a5c44dba feat: applyDefaultOnWrites in nested properties
Adds support for `applyDefaultOnWrites` in nested properties.
2019-12-12 20:25:29 +05:30
Miroslav Bajtoš bcd663b75f
Merge pull request #1800 from mitsos1os/backport-1790
Return rejected promise on error
2019-12-05 16:23:05 +01:00
Dimitris Xalatsis 315545daa0 return failed promise on error (cherry-picked) 2019-11-29 18:12:49 +02:00
Diana Lau 6ed60653eb 3.33.2
* backport #1782 to 3.x (#1785) (Dimitris Halatsis)
2019-10-28 10:49:50 -04:00
Dimitris Halatsis b925e8ccf0 backport #1782 to 3.x (#1785) 2019-10-28 10:42:13 -04:00
Diana Lau 6dc0abc2fb 3.33.1
* chore: reduce identifier length (Hage Yaapa)
2019-09-05 09:52:21 -04:00
Hage Yaapa 516499dbeb chore: reduce identifier length
Existing identifier length exceeds Oracle DB's limit.
2019-09-04 21:48:34 +05:30
Diana Lau 81348308e7 3.33.0
* feat: add applyDefaultOnWrites property (Hage Yaapa)
2019-08-19 12:11:26 -04:00
Hage Yaapa 020d3179aa feat: add applyDefaultOnWrites property
Adds the ability to ignore writing default values to the database.
2019-08-19 14:10:20 +05:30
Diana Lau eac0d6af87 3.32.0
* fix: prevent max listeners warning (Nora)
 * drop support for Node.js 6 (Nora)
2019-08-13 14:49:27 -04:00
Nora 2680778841
Merge pull request #1772 from strongloop/getMaxListeners
fix: prevent max listeners warning
2019-08-13 14:29:19 -04:00
Nora f6117c2c47 fix: prevent max listeners warning
If establishing a database connection is slow
and database migration runs and there are many
models, sql operations are queued up and this
leads to the node.js max emitters exceeded
warning.

A default value for max emitters has now
been introduced, and it can also be configured
in datasources.json.

Co-authored-by: Dominique Emond <dremond@ca.ibm.com>
2019-08-13 10:45:48 -04:00
Nora 6fb745cdd4
Merge pull request #1773 from strongloop/drop-node-6
drop support for Node.js 6
2019-08-13 10:44:55 -04:00
Nora 15ae05b10a drop support for Node.js 6 2019-08-13 08:33:53 -04:00
Diana Lau 507621c370 3.31.1
* Fix for #1724 - Added options to attribute updates (#1725) (#1748) (Bill Matson)
 * Fix "access" hook for unoptimized "near" queries (Miroslav Bajtoš)
 * Test "near" queries executed in memory (Miroslav Bajtoš)
 * Fix DateString ctor to accept DateString instances (Miroslav Bajtoš)
2019-05-31 15:08:47 -04:00
Bill Matson 16936e0146 Fix for #1724 - Added options to attribute updates (#1725) (#1748)
* Fix for #1724 - Added options to attribute updates

* Fix for #1724 - Added unit tests for options
2019-05-31 15:06:57 -04:00
Miroslav Bajtoš 5e3e1198d6
Merge pull request #1742 from strongloop/fix/hooks-with-near-queries-3x
Fix implementation of Operation Hooks for "near" (geo) queries
2019-05-14 16:17:58 +02:00
Miroslav Bajtoš c4ff74a723
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:21:28 +02:00
Miroslav Bajtoš 7f35e0ff2c
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:19:48 +02:00
Miroslav Bajtoš 548f3018a9
Merge pull request #1741 from strongloop/fix/datestring-ctor-3x
Fix DateString ctor to accept DateString instances
2019-05-13 16:32:37 +02:00
Miroslav Bajtoš f4cbcc5f97
Fix DateString ctor to accept DateString instances
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-05-13 16:08:20 +02:00
biniam 72d1bf6cde 3.31.0
* fix: allow coercion of nested properties (biniam)
 * Add support for Node.js 12.x (Miroslav Bajtoš)
 * chore: remove kv-extreme-scale from downstream (#1722) (Diana Lau)
2019-05-03 19:13:14 -04:00
Biniam Admikew 4f31db1b64
Merge pull request #1726 from strongloop/fix/nested-property-coercion
fix: allow coercion of nested properties

Handle model definitions with nested property
definitions for coercion of primitive values.
2019-05-03 19:08:04 -04:00
biniam 4924241028 fix: allow coercion of nested properties
Handle model definitions with nested property
definitions for coercion of primitive values.
2019-05-03 18:38:44 -04:00
Miroslav Bajtoš e27efd9ea5
Merge pull request #1729 from strongloop/chore/add-node-12-3x
Add support for Node.js 12.x [3.x]
2019-05-02 12:58:36 +02:00
Miroslav Bajtoš 70b3d219ab
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-30 09:14:37 +02:00
Diana Lau a4e69353e9
chore: remove kv-extreme-scale from downstream (#1722) 2019-04-18 12:13:03 -04:00
biniam b7ea7458e3 3.30.0
* fix: coerce primitive properties on update (biniam)
 * fix: coerce date array properties (biniam)
 * fix: add index for couchdb tests (#1720) (Janny)
2019-04-18 10:54:22 -04:00
Biniam Admikew 730918f23d
Merge pull request #1719 from strongloop/fix/primitive-datatypes-coercion-3x
Fix primitive datatypes coercion [3.x]

Make sure we coerce Date values properly when creating new
model instances. Also make sure we use the coerced data values
for model instance for update operation.
2019-04-18 10:44:46 -04:00
biniam df4366eb31 fix: coerce primitive properties on update
Make sure we use the coerced data values for
model instance for update operation.
2019-04-18 10:12:10 -04:00
biniam f2113d2c70 fix: coerce date array properties
Make sure we coerce Date values properly when creating new
model instances.
2019-04-18 10:09:50 -04:00
Janny f21e770016
fix: add index for couchdb tests (#1720) 2019-04-17 15:16:06 -04:00
Miroslav Bajtoš 9095f32859
3.29.2
* fix: normalize include with boolean or number (spurreiter)
2019-04-15 12:51:50 +02:00
Miroslav Bajtoš 22f8babf4a
Merge pull request #1717 from strongloop/fix/include-crash-3x
fix: normalize include with boolean or number
2019-04-12 17:49:12 +02:00
spurreiter d67aeb18b0
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-12 17:05:41 +02:00
jannyHou 127b45bf59 3.29.1
* fix: ignore git file 3.x (#1713) (Janny)
2019-04-10 10:53:15 -04:00
Janny 983a75f561
fix: ignore git file 3.x (#1713) 2019-04-10 10:52:01 -04:00
Miroslav Bajtoš e4a605d436
3.29.0
* Do not apply default values on data from database (Miroslav Bajtoš)
 * feat: support array within array in 3.x (Hage Yaapa)
 * feat: Support "type" key in sub-properties in 3.x (Hage Yaapa)
 * fix: use existing field in exclude test (biniam)
 * eslint: manually fix remaining problems (Miroslav Bajtoš)
 * eslint: autofix linting errors (Miroslav Bajtoš)
 * eslint: upgrade eslint-config-loobpack to latest (Miroslav Bajtoš)
2019-04-09 18:18:55 +02:00
Miroslav Bajtoš b8e08b759b
Merge pull request #1705 from strongloop/fix/default-value-in-response-3x
Do not apply default values on data from database
2019-04-09 15:29:51 +02:00
Miroslav Bajtoš fd03302f08
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 introducing a new model-level setting called
`applyDefaultsOnReads`, which is enabled by default for backwards
compatibility.

When this setting is set to `false`, operations like `find` and
`findOrCreate` will NOT apply default property values on data returned
by the database (connector).

Please note that most of the other CRUD methods did not apply default
values on database data as long as the connector provided native
implementation of the operation, that aspect is not changing.

Also note that default values are applied only on properties with
`undefined` values. The value `null` does not trigger application of
default values. This is important because SQL connectors return
`null` for properties with no value set.
2019-04-09 13:03:37 +02:00
Hage Yaapa 2f093ce254
Merge pull request #1701 from strongloop/3x/list-format
feat: support array within array in 3.x
2019-03-19 19:06:14 +05:30