Commit Graph

2921 Commits

Author SHA1 Message Date
rashmihunt 52f8fb3416 handle excludeBaseProperties 2017-05-10 12:03:42 -07:00
Kevin Delisle d375d61519 Merge pull request #1289 from strongloop/fix/preventRelationsMerge
review model settings merge/inheritance policy (util/mergeSettings() ) : relations, acls, ...
2017-05-10 12:56:23 -04: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
Loay e3ce44a286 Merge pull request #818 from fullcube/fullcube/validatesUniquenessOf-case-insensitive
Fullcube/validates uniqueness of case insensitive
2017-05-05 10:41:42 -04:00
Loay b39ee050f3 Merge pull request #1363 from strongloop/fix-1304
Fix error assertion
2017-05-04 11:18:19 -04:00
Loay 87dd44dd59 Fix assertion errors 2017-05-04 10:38:06 -04:00
Loay c80daae5a1 Merge pull request #1366 from strongloop/api-ModelBase
Update ModelBaseClass api docs
2017-05-03 22:31:56 -04:00
Loay 84b55d8160 Update modelbaseclass api docs 2017-05-03 21:03:36 -04:00
Kevin Delisle 6b43378396 3.6.1
* docs: add DateString definition (Kevin Delisle)
2017-05-02 18:55:44 -04:00
Kevin Delisle 53fd8d79f8 Merge pull request #1365 from strongloop/docs/datestring
docs: add DateString definition
2017-05-02 18:55:12 -04:00
Kevin Delisle 0e955b0f35 docs: add DateString definition 2017-05-02 18:51:56 -04:00
Kevin Delisle 6bbad5e9a9 3.6.0
* create sequence for nosql id (#1354) (Janny)
 * Fix order of query results (Loay)
 * Add DateString type (Kevin Delisle)
 * datatype.test: use predefined date (Kevin Delisle)
 * Update api documents (Loay)
 * Datasource documentation tune-up (Kevin Delisle)
 * Added unit tests specific to DateType where null (#1349) (Andrew McDonnell)
 * Fix/geo null (#1334) (paulussup)
 * replace exception thrown for invalid dates (Diana Lau)
 * Revert PR #1326 (#1336) (Sakib Hasan)
 * Make lib peerDepend on loopback-connector (#1326) (Russ Tyndall)
 * Add test case using updateAttributes (Loay)
 * Fix forceId bug for updateOrCreate (Loay)
 * Fix typo in description (jannyHou)
 * Fix relations test case (loay)
2017-05-02 18:34:11 -04:00
Kevin Delisle 156b638518 Merge pull request #1356 from strongloop/datetype-allow-strings
Add DateString type
2017-05-02 14:48:50 -04:00
Janny 5d10c72664 create sequence for nosql id (#1354)
* create sequence for nosql id
2017-05-02 13:35:57 -04:00
Bram Borggreve c3629633de
Add caseInsensitive opt to validatesUniquenessOf 2017-05-01 17:26:16 -05:00
Kevin Delisle 6342a0387f Merge pull request #1364 from strongloop/query-order
Fix order of query results
2017-05-01 17:21:00 -04:00
Loay 6cfdcc0128 Fix order of query results 2017-05-01 16:10:55 -04:00
Kevin Delisle 5e80837424 Add DateString type
New type that preserves string input as a string, but ensures that
the string is a valid Date.

Additionally, provides a .toDate function to provide the Date
object representation of the string.
2017-05-01 12:28:59 -04:00
Kevin Delisle 97f243f347 Merge pull request #1360 from strongloop/datatype-test/use-predefined-date
datatype.test: use predefined date
2017-04-28 16:42:10 -04:00
Kevin Delisle 8e97385a8f datatype.test: use predefined date
Some databases are storing the value in UTC (not ISO) format,
and truncating the values. Even though this is technically
unavoidable, it does fail strict string equality.
2017-04-28 15:40:19 -04:00
Loay f8046637ac Merge pull request #1358 from strongloop/api-doc-2
Update api documents
2017-04-27 23:11:57 -04:00
Loay ef61c8618a Update api documents 2017-04-27 16:28:43 -04:00
Loay bf7ea4caed Merge pull request #1333 from strongloop/api-doc-refactor
Datasource documentation tune-up
2017-04-25 16:28:54 -04:00
Kevin Delisle f7fe187120 Datasource documentation tune-up 2017-04-25 15:51:42 -04:00
Andrew McDonnell 238175b4bd Added unit tests specific to DateType where null (#1349)
* Added unit test for DateType where null

* BDD for connectors w/o null support
2017-04-25 13:05:55 -04:00
paulussup e9ff88f453 Fix/geo null (#1334)
* fix check for null

* add tests

* fix for early return

* Allow check for null and non-existent value

Some connectors uses a non existent prop instead of allowing null
Modified test case to look if null exists or the prop is non existent

* Check for null value with geo near query

* Apply requested changes

* change test to two users and simplify

* check error first

* Fix simple query test case with null value

* BDD for connectors w//o null support
2017-04-24 19:28:11 -04:00
Diana Lau ee254a1812 Merge pull request #1339 from strongloop/invalid-dates
replace exception thrown for invalid dates
2017-04-21 20:13:45 +00:00
Diana Lau a488a71dbd replace exception thrown for invalid dates 2017-04-21 15:57:11 -04:00
Sakib Hasan bcc5b559a3 Revert PR #1326 (#1336)
Make lib peerDepend on loopback-connector (#1326)

This reverts commit 67e8f3708a.
2017-04-19 14:14:50 -04:00
Russ Tyndall 67e8f3708a Make lib peerDepend on loopback-connector (#1326) 2017-04-18 16:11:18 -04:00
Loay 3aef34e552 Merge pull request #1304 from strongloop/upsert-forceid
Fix forceId bug for updateOrCreate
2017-04-18 15:07:29 -04:00
Loay 3c19beacbb Add test case using updateAttributes 2017-04-18 13:50:57 -04:00
Loay f1d10b47ce Fix forceId bug for updateOrCreate 2017-04-18 13:14:35 -04:00
Janny ddbb568154 Merge pull request #1312 from strongloop/fix/typo
Fix typo in description
2017-04-18 10:30:21 -04:00
jannyHou 7010986643 Fix typo in description 2017-04-17 21:18:25 -04:00
Loay 2f18a83006 Merge pull request #1325 from strongloop/embedsMany-relations
Alter relations test case
2017-04-17 16:41:42 -04:00
Candy 432a2e15db 3.5.0
* Add instructions for running the tests (#1330) (Andrew McDonnell)
 * handle deep geo-near queries (#1314) (Eric Barault)
 * Unskip test case (Loay)
 * Make tests work for other connectors as well as C* (Tetsuo Seto)
 * Remove debugger statement (Tetsuo Seto)
 * Fixup test support for Cassandra connector (Tetsuo Seto)
 * Add test support for Cassandra connector (Tetsuo Seto)
 * package: use loopback-connector@^4.0.0 (Kevin Delisle)
 * Revert "handle deep geo-near queries (#1216)" (Sakib Hasan)
 * Revert "Allow `after save` hook to see count of records changed (#1231)" (Sakib Hasan)
 * Allow `after save` hook to see count of records changed (#1231) (Joshua Chaitin-Pollak)
 * handle deep geo-near queries (#1216) (Corentin H)
 * Fix model def column name method (#1224) (destillat)
 * Added notify flag for create and upsert (#1277) (Jonathan Sheely)
 * Custom Table Names on rels (#1303) (Waldemar Zahn)
 * Support multiple fk relations (#1308) (Sakib Hasan)
 * #1261 Property name "constructor" is not allowed in 'Model' data (#1284) (Thaer Abbas)
2017-04-17 16:22:13 -04:00
Andrew McDonnell 85bec7fddb Add instructions for running the tests (#1330) 2017-04-17 11:14:00 -04:00
loay 1cdb431ae2 Fix relations test case 2017-04-14 03:35:46 -04:00
Eric Barault 64f64caaff handle deep geo-near queries (#1314)
* handle deep geo-near queries (#1216)

    
a dedicated mongKey is added in geo.nearFilter for mongoDB
fixes geo min distance tests as filter now expects an array

* Fix for string geoPoints

* Add geo point handle for ibmdb connectors

* Handle geo-point type for cassandra connector
2017-04-13 17:05:05 -04:00
Loay 8865659a8a Merge pull request #1309 from strongloop/skipped-test
Unskip test case
2017-04-13 14:14:54 -04:00
Loay 9dc5430652 Unskip test case 2017-04-12 12:54:30 -04:00
Tetsuo Seto 7285e4834a Merge pull request #1323 from strongloop/add-cassandra-tests
Make tests work for other connectors as well as C*
2017-04-12 09:32:37 -07:00
Tetsuo Seto c1598584d8 Make tests work for other connectors as well as C*
Adjust getSchema calls
Compare ids as strings
Run tests when explicitly set to true
2017-04-12 09:11:42 -07:00
Tetsuo Seto 100a7ea91c Merge pull request #1319 from strongloop/remove-debug-code
Remove debugger statement
2017-04-07 15:17:58 -07:00
Tetsuo Seto 696e4cfa80 Remove debugger statement 2017-04-07 15:05:15 -07:00
Tetsuo Seto 14d966d159 Merge pull request #1318 from strongloop/fixup-for-cass
Fixup test support for Cassandra connector
2017-04-07 14:31:25 -07:00
Tetsuo Seto 0f9100f185 Fixup test support for Cassandra connector 2017-04-07 14:11:33 -07:00
Tetsuo Seto bff4ea7fd5 Merge pull request #1310 from strongloop/add-cass-tests
Add test support for Cassandra connector
2017-04-07 11:26:48 -07:00
Tetsuo Seto ead1fb2965 Add test support for Cassandra connector 2017-04-07 11:10:47 -07:00