Make it easier for contributors to mix the text provided by GitHub
from the commit messages with the template content.
Rework the checklist to follow the style we use in loopback-next.
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
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>
Before this change, when both the PK value (`id`) and the `data` object
were provided as plain-data values (e.g. as received in a JSON request),
and the connector was using a complex PK type (e.g. `ObjectID`
in MongoDB), then `replaceById` operation was printing confusing
warnings:
WARNING: id property cannot be changed from 5d39775a59f5f541513c5e05
to 5d39775a59f5f541513c5e05 for model:Post
in 'before save' operation hook
WARNING: id property cannot be changed from 5d39775a59f5f541513c5e05
to 5d39775a59f5f541513c5e05 for model:Post
in 'loaded' operation hook
This commit fixes the problem by applying the same type coercion on the
PK value (`id`) as has been applied by the model constructor on the PK
property (`data.id`).
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
When writing tests, for performance reasons we often want to reuse
the same data-source instance for many tests suites. At the same time,
we want to keep such test suites independent and allow them to reuse
the same model name for different model classes.
Juggler does support redefinition of a model with the same name.
This change is adding a new API called that allows tests to remove all
old models before creating new ones. This API would be typically
called from a `before` hook.
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
Defer automigrate/autoupdate until we are connected, so that connection
errors can be reported back to callers.
Fix postInit handler to not report connection error to console.log
and via dataSource "error" event in case there is already an operation
queued. When this happens, we want the error to be handled by the
queued operation and reported to its caller.
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
add `beginTransaction` method to DataSource class
which calls `begin` method from the Transaction class
which in turn invokes the connector's `beginTransaction`
method if it supports transactions.
add beginTransaction method which calls begin
method from the Transaction class which in turn
calls the connector's beginTransaction method if
it supports transactions.
Co-Authored-By: Miroslav Bajtoš <mbajtoss@gmail.com>
* Fix types to describe native Promise (Miroslav Bajtoš)
* feat: after operation hook in case of errors (spurreiter)
* Fix for #1724 - Added options to attribute updates (#1725) (Bill Matson)
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>
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.
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.