Commit Graph

55 Commits

Author SHA1 Message Date
Miroslav Bajtoš 481ad566d2
eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
Raymond Feng 4a6ea992fb Use options from request for settings 2018-11-15 08:23:23 -08:00
Raymond Feng 41d5f20fff Allow configuration of maxDepthOfQuery
https://github.com/strongloop/loopback-datasource-juggler/issues/1651
2018-10-31 09:12:43 -07:00
Raymond Feng 828fa3bcb6 Check composite keys containing hidden props 2018-10-29 13:11:50 -07:00
Raymond Feng 63f0fe20ed Ren handleUndefined to normalizeUndefinedInQuery 2018-10-26 09:23:10 -07:00
Raymond Feng 89bb3079bd Report circular or deep query objects 2018-10-26 09:23:01 -07:00
Raymond Feng 71f2e54de5 Hide offending properties from the error object 2018-10-26 09:19:36 -07:00
Raymond Feng 71f1259e72 Prevent hidden/protected props from being searched
- report errors if where contains hidden properties
- report errors if incldue scope contains hidden or protected properties
2018-10-26 09:18:25 -07:00
Miroslav Bajtoš 7d50f6130b
Upgrade eslint-config-loopback + fix formatting
The new version of our config enabled function-paren-newline rule,
this commit fixes the codebase to use more consistent handling
of newlines when calling functions.
2018-07-16 08:46:25 +02:00
Miroslav Bajtoš d2ee73b9d3
Update eslint + config to latest 2018-06-12 09:13:32 +02:00
Miroslav Bajtoš f8479253fa
Polyfill Number.isFinite() to support PhantomJS 2018-04-17 10:08:39 +02:00
Peter Bouda 6bd9fca080 Fix bug in utils uniq function (#1526)
The uniq function does currently not work when the database is mongodb.
In the case of mongodb, the function will receive an array of bson
object of bson type ObjectID. The indexOf function will return a
different index, even if the mongodb ID is the same, as it is wrapped
in the ObjectID. This commit first transforms any ObjectID in the array
to a string representation. We can then use indexOf to check for
uniqueness.
2017-12-04 15:39:58 -05:00
Jürg Lehni 4c9e91423f
Rename getAsync() methods to find() and get()
Keep getAsync() around for backward compatibility, but deprecate it
2017-07-20 14:48:29 +02:00
Tetsuo Seto c07f46000d Support include rework for C* connector
- Remove supportNonPrimaryKeyIN
- Add C* Uuid in build call
- Implement smartMerge in scope.js
2017-05-12 22:43:21 -07:00
ebarault 79068d142b configurable model merge
The PR superseeds the existing deepMerge algorithm used to merge
settings of parent and child models with a new algorithm that allows
to specify the way each setting is merged or mixed-in.

This configuration of this algorithm uses a merge policy specification.
The `getMergePolicy()` helper of BaseModelClass can be used to ease
model merge configuration.

Next is presented the expected merge behaviour for each option.
NOTE: This applies to top-level settings properties

- Any
  - `{replace: true}` (default): child replaces the value from parent
  - assignin `null` on child setting deletes the inherited setting

- Arrays
  - `{replace: false}`: unique elements of parent and child cumulate
  - `{rank: true}` adds the model inheritance rank to array
    elements of type Object {} as internal property `__rank`

- Object {}:
  - `{replace: false}`: deep merges parent and child objects
  - `{patch: true}`: child replaces inner properties from parent

The recommended merge policy is returned by getMergePolicy()
when calling the method with option `{configureModelMerge: true}`.

The legacy built-in merge policy is returned by `getMergePolicy()`
when avoiding option `configureModelMerge`.
NOTE: it also delivers ACLs ranking in addition to the legacy
behaviour as well as fixes for settings `description` and `relations`

`getMergePolicy()` can be customized using model's setting
`configureModelMerge` as follows:
```
{
  // ..
  options: {
    configureModelMerge: {
      // merge options
    }
  }
  // ..
}
```

`getMergePolicy()` method can also be extended programmatically as
follows:
```
myModel.getMergePolicy = function(options) {
  const origin = myModel.base.getMergePolicy(options);
  return Object.assign({}, origin, {
    // new/overriding options
  });
};
```
2017-05-10 02:33:45 +02:00
Dimitris 2bfc769c4d Using a filter with exclusion of a non existent property, removes an existing one (#1257)
* #fixes 1256

* Added missing check for returned error

* Fixed test to check proper fields in each doc
2017-03-20 19:18:48 -04:00
Miroslav Bajtoš d809260799 Upgrade eslint-config, fix new violations 2017-02-01 12:45:56 +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
jannyHou 6c8e806bc8 Apply hasManyThrough filter on target model 2016-12-01 10:08:27 -05:00
Amir Jafarian aec678d252 Fix manually 2016-08-22 19:20:12 -04:00
Amir Jafarian aa6d28268b Auto-update by eslint --fix 2016-08-22 15:12:25 -04:00
Amir Jafarian 4ce5b5d3a0 Support for globalization 2016-07-28 15:20:18 -04:00
Miroslav Bajtoš 27c6279d6c fix remaining eslint issues 2016-04-05 15:25:34 +02:00
Miroslav Bajtoš 39e04a1756 eslint --fix 2016-04-05 15:25:34 +02:00
Ryan Graham c467b43c38 Insert copyright headers 2016-04-04 18:14:03 -07:00
Jue Hou 853ca03491 Use bluebird in utils.js
Replace `global.Promise` with `bluebird`
2016-01-07 15:27:33 -05:00
Ryan Schumacher 94c3f9a432 Ability to define normalization of undefined query
Add datasource and model setting `normalizeUndefinedInQuery`
to determine how it will handle undefined values. Options:

- nullify : converts undefined to null
- throw : throw an error on undefined value
- ignore : strip the key where undefined value is found

The default operation is to strip the key.
2015-10-07 09:26:09 -07:00
Laurent Villeneuve bdf703fb45 Use idEquals when comparing ids in relation definitions 2015-08-18 10:22:36 -04:00
Raymond Feng f5270c39c5 Refactor idEquals to utils 2015-08-17 12:49:38 -07:00
Simon Ho b2b5a0d920 Merge pull request #665 from strongloop/add-regex-support
Add support for RegExp operator
2015-07-28 15:22:02 -07:00
Simon Ho b8f1598723 Add support for regex operator 2015-07-27 15:11:53 -07:00
Raymond Feng 5dc4042300 Fix object merge 2015-07-10 13:54:29 -07:00
Raymond Feng 493d98f66b Dedupe ids args of inq for include 2015-05-29 10:50:37 -07:00
Raymond Feng 966bb56c31 Enhance fieldsToArray to consider strict mode 2015-05-19 22:32:03 -07:00
ningsuhen 9a7f13ff0f Add support for merging include filters 2015-04-25 01:59:39 +05:30
Miroslav Bajtoš 76ebdcb91b ModelBaseClass: promise mode for notifyObserversOf
Support both promise and callback styles in
ModelBaseClass.notifyObserversOf.

When there is no callback supplied, the method returns a promise that
is resolved (or rejected) with the result.
2015-02-17 18:19:21 +01:00
Fabien Franzen ca0b3399c8 Implement include scopes 2014-10-10 12:28:39 +02:00
Fabien Franzen ad55681d69 Properly reset Memory connector cache on automigrate 2014-10-09 18:13:58 +02:00
Fabien Franzen 610866bd7c Extract mergeQuery and setScopeValuesFromWhere
Related to #274 - in preparation of default scope
2014-10-09 18:13:40 +02:00
Fabien Franzen a446551a59 Fix relations for RDBMS connectors (mysql, postgresql)
- fix tests (explicit model/property definitions)
- fix include vs. RDBMS model strictness
2014-08-20 14:03:38 +02:00
Fabien Franzen 3e300c1f35 Add strict flag to sortObjectsByIds
When true, any object not in the ids will be discarded and a subset
will be returned.
2014-08-15 19:47:12 +02:00
Fabien Franzen 9f1c5d9c37 Moved DataAccessObject.sortByIds to utils.js 2014-08-15 19:39:58 +02:00
Raymond Feng 93c18163c8 Make sure __cachedRelations is not enumerable 2014-01-28 09:57:23 -08:00
Raymond Feng 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Raymond Feng aabe5fb1c4 Fix a bug in merging ACLs 2013-12-16 17:14:56 -08:00
Raymond Feng 29405976fb Merge settings for base and sub models 2013-12-06 15:52:39 -08:00
Raymond Feng d0055d8591 Fix removeUndefined to bypass non-plain objects
traverse.map() transform custom objects such as Date or ObjectID into
plain objects and it breaks the BSON serialization
2013-10-29 22:16:43 -07:00
Raymond Feng f3011216b5 Support datasource/connector configuration using URL string 2013-10-25 16:18:02 -07:00
Raymond Feng 9ec9f654c7 Remove undefined values from the query object 2013-10-11 11:50:00 -07:00
Raymond Feng f3443959a1 Rename 'loopback-data' to 'loopback-datasource-juggler' 2013-07-30 14:10:03 -07:00