Christian Enevoldsen
d39f539413
adds support for protected properties.
2015-01-20 20:58:52 +01:00
Clark Wang
83c3a17f87
support embeds data for belongsTo relation
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2015-01-19 22:56:09 +08:00
Miroslav Bajtoš
2e98c51571
Fix detection of `util.inspect` version
...
Improve the detection to work in browser too. This fixes a regression
introduced in e4fc3878
.
2015-01-15 08:45:52 +01:00
Miroslav Bajtoš
e4fc38788f
Fix Model.prototype.inspect
...
Return the raw object data when running on Node v0.11.14+
That way all `inspect` options are always preserved.
When running on older version:
- Honour the depth argument passed to the custom `inspect` function.
- Disable color output, becase there is now way how to detect whether
colors were enabled or disabled by the top-level caller.
2015-01-12 17:12:18 +01:00
Fabien Franzen
4e20128945
Tiny fix: default __persisted to false
2014-10-19 18:52:18 +02:00
Fabien Franzen
e7a108efdb
Don't apply defaults when fields are specified
2014-10-19 18:47:27 +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
fafe51833b
More fixes/tests
2014-09-05 17:09:23 +02:00
Fabien Franzen
aebf5e9e6b
Enforce id (prevent user-set value), fix isNewRecord
2014-09-05 16:35:01 +02:00
Fabien Franzen
86ea107550
Validations configuration as object
...
Previously validations were appended to an array when configured. The
format was cumbersome, and led to issues. This refactors the
configuration into an object, as a property of the Model.
Note that if no validations have been configured, this property is
currently `undefined`.
2014-08-26 17:51:01 +02:00
Raymond Feng
fcd8ed984c
Make sure falsy value is kept for properties not predefined
2014-08-21 13:47:09 -07:00
Fabien Franzen
3f0380296a
Fix side-effects of PR #237 - see #242
2014-08-21 10:44:55 +02:00
Fabien Franzen
faed0510c1
Coerce embedded model types
2014-08-20 08:58:07 -07: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
Raymond Feng
f671c9c726
Clean up the mixin processing
2014-08-08 01:20:57 -07:00
Fabien Franzen
35776311fd
Unified plugins into mixins
...
Mixin types: module function, module object, LDL json object.
2014-08-06 13:26:47 +02:00
Fabien Franzen
1a4e8863ef
Basic plugin architecture
...
Similar to http://mongoosejs.com/docs/plugins.html
Next, loopback-boot should be updated to support loading plugins from
dirs.
2014-08-05 16:16:10 +02:00
Raymond Feng
3edee5c4c5
Work around for Date default
...
See https://github.com/strongloop/loopback-connector-postgresql/issues/15
2014-06-21 12:53:06 -07:00
Raymond Feng
888d15ce1c
Optimize model instantiation and conversion
2014-06-18 22:13:52 -07:00
Raymond Feng
97b1501c1f
Keep undefined/null values for the array type
...
This allows connectors to distinguish between empty array and
undefined/null. For example, mongodb will not override existing array
properties if the value is undefined.
2014-05-27 21:59:21 -07:00
Ritchie Martori
2922eb63b7
Merge
2014-05-14 13:33:46 -07:00
Ritchie Martori
0866a55cb2
Do not .toObject if already Object
2014-05-14 13:31:15 -07:00
Raymond Feng
3f410cae21
Add test cases for updateOrCreate/save and fix related issues
2014-05-09 15:27:45 -07:00
Raymond Feng
8b128b566d
Make sure ObjectID type is not parsed as object
2014-05-08 15:46:14 -07:00
Ritchie Martori
aea5836569
Add hidden property support
2014-04-11 11:39:57 -07:00
Raymond Feng
cc5975486d
Simplify the inclusion processing
2014-03-17 08:40:40 -07:00
crandmck
9c2098cd35
Updates to JSDoc comments for API doc
2014-03-12 16:28:46 -07:00
Raymond Feng
85232f31b3
Clean up the options for model constructor
2014-02-10 22:38:59 -08:00
Raymond Feng
1961fbeefe
Enhance the assertions
2014-02-03 20:52:01 -08:00
Raymond Feng
ee5b351398
Make sure own properties are copied by toObject for non-strict mode
...
See https://github.com/strongloop/loopback/issues/162
2014-01-30 11:51:34 -08: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
Ritchie Martori
597a775e4c
Add model.getDataSource() method
2013-10-31 11:46:12 -07:00
Raymond Feng
0bfc362b18
Use for-in loop to support properties from the super class
2013-10-06 21:27:02 -07:00
Raymond Feng
24d87976e8
Merge branch 'master' into juggler-tidyup
...
Conflicts:
lib/model.js
2013-10-04 14:32:51 -07:00
Raymond Feng
1ae9478496
Fix the columnName
2013-10-03 14:49:03 -07:00
Raymond Feng
1963ea9fb1
Use ModelDefinition to access model name/properties/settings
2013-10-02 15:18:50 -07:00
Raymond Feng
fad6ee5e1d
Refactor/cleanup the data source juggler implementation
...
- Add a ModelDefinition class to encapsulate the model schema handling
- Add a Connector class as the base class for connector implementations
- Optimize attachTo and mixin
- Rename some properties/methods
2013-10-01 22:14:21 -07:00
Raymond Feng
1575c87caf
Make sure schemaless property value is honored over __data
2013-09-18 16:34:52 -07:00
Raymond Feng
038f30cb95
Fix the conflicts between MongoDB _id & juggler's internal prefix
2013-08-30 16:59:17 -07:00
Raymond Feng
c2eb1f55f0
Fix the property population for schemaless models
2013-08-28 21:49:05 -07:00
Raymond Feng
59841a04a8
Set strict to false by default for non-relational data sources
2013-08-26 13:38:24 -07:00
Raymond Feng
57c181c8b9
Bring up json object introspection to build models
2013-07-26 13:06:43 -07:00
Raymond Feng
9b422752a6
Allows non-strict mode to accept unknown properties
2013-07-24 22:58:57 -07:00
Raymond Feng
752aedb80d
Rename adapters to connectors
2013-07-23 14:40:44 -07:00
Raymond Feng
6af4b1ba2f
More renames: schema -> dataSource, adapter -> connector
2013-07-23 11:16:43 -07:00
Raymond Feng
8e01e17bdb
Add support for nesting objects with an array
2013-07-12 18:59:43 -07:00
Ritchie Martori
7684fe2946
Change default create method from save to create for remoting
2013-07-02 20:28:00 -07:00
Ritchie Martori
522291bf08
Add support for extending models
2013-07-01 16:49:43 -07:00
Ritchie Martori
6cb53e5001
Add in memory geo filtering.
2013-06-25 20:31:00 -07:00
Raymond Feng
36c22ab972
Adjust the mixins
2013-06-05 14:34:05 -07:00
Raymond Feng
465a963d2d
Adding more tests
2013-05-28 13:50:59 -07:00
Raymond Feng
dd8512bc1f
Refactor more functions into mixins
2013-05-27 22:20:43 -07:00
Ritchie
a690f8d8df
Add data source attach example
2013-05-23 17:29:03 -07:00
Ritchie
1dee840de5
Add ability to attach data source to an existing model
2013-05-23 16:38:14 -07:00
Raymond Feng
184c190223
Bring up the schema loading from json docs
2013-05-20 16:05:59 -07:00
Raymond Feng
7caaeb2623
Fix the datasource.define
2013-05-17 14:41:04 -07:00
Raymond Feng
630b991d1d
Refactor the CRUD operations to DataAccessObject
2013-05-17 08:49:57 -07:00
Anatoliy Chakkaev
ba75af1490
Only save schema props
2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev
83027f9ead
Accept related objects when creating instance #247
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev
eecbd32d07
Allow null properties for headless models
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev
c9e97744dd
Many-to-many relation
...
- hasMany {through: Class}
- hasAndBelongsToMany
- some specs in relations.test.js
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev
136ea91fbf
Organize model.js
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev
c4d4b68413
Datatypes casting
2013-05-13 22:04:28 -07:00
Raymond Feng
ad1b2ad7e9
Only call the orginal method once
2013-04-16 22:25:31 -07:00
Raymond Feng
3613f6e22f
Set up the connected handler before connect
2013-04-15 16:05:17 -07:00
Anatoliy Chakkaev
4943feb230
Merge transactions
2013-04-05 02:13:14 +04:00
Anatoliy Chakkaev
43d1cbd39e
Merge
2013-04-05 02:12:34 +04:00
Anatoliy Chakkaev
3a355851b6
ValidationError instead Error
2013-04-04 19:31:07 +04:00
Anatoliy Chakkaev
704bc965bd
Find on hasMany scope method
2013-04-04 00:46:41 +04:00
Anatoliy Chakkaev
b0a1ed3bed
Fix validation issue
2013-04-01 20:08:22 +04:00
Anatoliy Chakkaev
cf5ed5b877
Transactions
2013-04-01 17:49:12 +04:00
Anatoliy Chakkaev
6d1e47ceaf
Schemas switching
2013-03-31 16:35:26 +04:00
Anatoliy Chakkaev
76c7fbd6ec
Merge branch 'http' of github.com:NiKnight/jugglingdb
2013-03-31 14:08:38 +04:00
Anatoliy Chakkaev
0776c51994
Batch create
2013-03-31 13:40:37 +04:00
Scott Nonnenberg
2ba862f5af
afterDestroy not called on adapter error
...
Similar to afterCreate and afterUpdate, we don't want to run the afterXXXX handlers if the delete failed according to the adapter.
2013-03-30 17:18:47 -07:00
Anatoliy Chakkaev
2f048e79c0
Return instance of object when create
2013-03-30 21:06:09 +04:00
Anatoliy Chakkaev
1f29064b3d
Rewrite save and create for correct hooks order
...
Validation should be called first, and then all other actions
to allow modify data after validation (for example hash
password after validating length.
Issue #242
2013-03-28 15:26:51 +04:00
Anatoliy Chakkaev
2749a1f7e0
Fixes in belongsTo relation definition syntax
2013-03-27 04:48:26 +04:00
Anatoliy Chakkaev
de28603460
Added short syntax for belongsTo
2013-03-27 00:48:14 +04:00
Anatoliy Chakkaev
f76b56d2fe
Another way to define belongsTo
2013-03-26 04:39:47 +04:00
Anatoliy Chakkaev
16c826bd4f
Rename files
2013-03-25 01:35:08 +04:00