Raymond Feng
12a624d99c
Rewrite the List class for typed array
2014-02-14 10:41:00 -08:00
Raymond Feng
7e45a1fda1
Fix the include with array value
2014-02-14 10:40:45 -08:00
Raymond Feng
061b274055
Merge branch 'partial-fix-for-58' of github.com:arlaneenalra/loopback-datasource-juggler
2014-02-12 21:55:53 -08:00
Raymond Feng
dbd97eb423
Merge pull request #68 from strongloop/feature/fix-lb-162
...
Make sure own properties are copied by toObject for non-strict mode
2014-02-11 14:29:21 -08:00
Raymond Feng
85232f31b3
Clean up the options for model constructor
2014-02-10 22:38:59 -08:00
arlaneenalra
5252d0e805
Move new var into thunk.
...
There really was no reason for it to be in the
outer context.
2014-02-05 22:21:27 -06:00
arlaneenalra
abd46961da
Use type converted data when writing back to database.
...
This allows foreignKey types and other custom types
to be converted into natvie values before writing them
to the database.
2014-02-04 23:10:42 -06:00
Raymond Feng
1961fbeefe
Enhance the assertions
2014-02-03 20:52:01 -08:00
Ritchie Martori
61a54da418
Merge pull request #65 from strongloop/feature/change-hook
...
Add change / delete events
2014-01-30 13:54:47 -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
da571c0c23
Use String[] for types and add test for supported types
2014-01-29 17:19:07 -08:00
Raymond Feng
cf200a2e27
Add getType/getDefaultIdType from connectors
2014-01-29 17:19:07 -08:00
Raymond Feng
e65d21dcdb
Merge pull request #67 from strongloop/feature/memory-persistence
...
Add an option for the memory connector to persist model instances
2014-01-29 17:18:00 -08:00
Raymond Feng
130dcdb582
Fix the write closure to use the correct task info
2014-01-29 13:41:42 -08:00
Raymond Feng
6b535f5d1c
Add a file option for the memeory connector to persist data
2014-01-29 12:04:09 -08:00
Ritchie Martori
e909749455
Add tests for change / delete events
2014-01-29 11:03:04 -08:00
Raymond Feng
c008c4d30a
Add more comments
2014-01-28 23:01:11 -08:00
Raymond Feng
2a57a909f0
Clean up lookupModel
2014-01-28 18:00:12 -08:00
Raymond Feng
43637a690d
Handle hasMany.though
2014-01-28 17:59:59 -08:00
Ritchie Martori
bef1bc1ca4
Add change / delete events
2014-01-28 13:51:45 -08:00
Raymond Feng
93c18163c8
Make sure __cachedRelations is not enumerable
2014-01-28 09:57:23 -08:00
Raymond Feng
1339250c8f
Promote the included relations as properties
2014-01-27 15:56:04 -08:00
Raymond Feng
2b8c1ebaee
Reformat the code
2014-01-24 09:09:53 -08:00
Raymond Feng
58a06272c3
Merge pull request #61 from strongloop/feature/fix-foreign-key
...
Use the primary key type for the generated foreign key
2014-01-24 08:31:02 -08:00
Raymond Feng
c374cc89cd
Use the primary key type for the generated foreign key
2014-01-21 09:47:32 -08:00
Miroslav Bajtoš
dbb7c6d9ae
Fill ModelClass.http.path
...
Set the HTTP route to `'/' + pluralModelName` so that we don't have
to duplicate this bit of logic in strong-remoting and other places.
2014-01-21 16:31:11 +01:00
Raymond Feng
2a50388894
Make the code testable following the review comments
2014-01-13 11:06:02 -08:00
Raymond Feng
acd02bf482
Allows the full module name for connectors
2014-01-09 17:03:37 -08:00
Raymond Feng
d9d9d82141
Add more comments
2013-12-20 17:49:14 -08:00
Raymond Feng
f1773857bb
Fix the remote delegation
2013-12-20 17:28:21 -08:00
Raymond Feng
1f965bfedb
Fix the remoting method with the current receiver (this)
2013-12-20 14:47:41 -08:00
Raymond Feng
e1ec152c78
Add models to LDL options
...
1. Use 'models' to specify the dependencies to other models
2. The 'models' property is an object, such as:
{
Model1: 'Model1',
Model2: Model2
}
3. The model classes will be injected into the newly defined class as
static properties using the keys from the models option.
2013-12-18 16:13:41 -08:00
Raymond Feng
aabe5fb1c4
Fix a bug in merging ACLs
2013-12-16 17:14:56 -08:00
Raymond Feng
3d9061aa69
Make the identation consistent for now
2013-12-16 08:40:06 -08:00
Raymond Feng
1b9edbcfcb
Fix a regression in mongodb connector
2013-12-15 22:51:47 -08:00
Raymond Feng
8d1d6f4466
Add more comments
2013-12-15 21:43:21 -08:00
Raymond Feng
9890af119e
Check for null & undefined values
2013-12-14 09:54:28 -08:00
Raymond Feng
fab504b5d9
Fix the coercion issue related to GeoPoint near
2013-12-14 09:49:11 -08:00
Raymond Feng
bf592413e1
Dedupe the alias methods during mixin
...
To prevent the same method from showing up multiple times in API explorer,
for example, Model.deleteById, Model.removeById
2013-12-13 16:45:31 -08:00
Ritchie Martori
749a494e53
Always call inherits to ensure prototypes are setup
2013-12-13 11:27:29 -08:00
Raymond Feng
441596b870
Merge pull request #47 from strongloop/feature/query-coercing
...
Coerce query values of where clause based on property types
2013-12-10 10:09:42 -08:00
Raymond Feng
29405976fb
Merge settings for base and sub models
2013-12-06 15:52:39 -08:00
Raymond Feng
2e4ed3f057
Merge pull request #48 from strongloop/feature/fix-discovery
...
Attach models to the data source
2013-12-05 15:40:43 -08:00
Raymond Feng
e5824356ca
Fix belongsTo relation
2013-12-04 21:38:40 -08:00
Raymond Feng
8360576c40
Attach models to the data source
2013-12-04 15:24:53 -08:00
Raymond Feng
52d2c8425f
Make all methods proxied for DAO
2013-12-04 13:44:25 -08:00
Raymond Feng
abe6d2bb22
Add more tests to address the PR comments
2013-12-04 10:00:33 -08:00
Raymond Feng
ed6d8839ba
Add a test case
2013-12-03 21:27:46 -08:00
Raymond Feng
a953ba13de
Clone shared methods so that they can be customized per model
2013-12-03 21:14:12 -08:00
Miroslav Bajtos
b5e0035d73
Improve properties of ValidationError
...
- change `statusCode` from 400 to 422
- nest `context` and `codes` inside `details`
- add `details.messages`
- reword the main error message
Remove the call to Error's constructor from ValidationError constructor,
because it's a no-op - Error's constructor creates a new
instance when called via `.call()`.
2013-12-02 21:35:47 +01:00
Raymond Feng
2df0c4b21d
Coerce types for values of where clause
2013-11-29 14:45:50 -08:00
Miroslav Bajtos
f7c48c0d72
REST call of DataAccessObject.findById returns 404
...
Modify the remoting configuration of `DataAccessObject.findById()`
and add a `rest.before` handler that converts `null` to 404 error.
The change is covered by a test in loopback project.
2013-11-21 19:05:52 +01:00
Raymond Feng
8d9d73efff
Add properties/methods to DataSource from ModelBuilder
2013-11-20 10:56:48 -08:00
Raymond Feng
a53eac5307
Merge pull request #42 from strongloop/feature/fix-ds-attach
...
Fix the model attachment to data source
2013-11-19 10:56:55 -08:00
Raymond Feng
2bcdea76f5
Fix the model attachment to data source
2013-11-19 10:49:54 -08:00
Raymond Feng
05eae4aa3e
Replace all with find to make it consistent
2013-11-18 11:39:07 -08:00
Raymond Feng
995a2139c8
Rename association to relation
2013-11-15 20:29:20 -08:00
Raymond Feng
7f6398f4c5
Fix the reference to modelBuilder/dataSource
2013-11-15 13:54:15 -08:00
Raymond Feng
b5e0f14249
Separate the modelBuilder ref from dataSource
2013-11-15 11:12:33 -08:00
Raymond Feng
526d126e41
Fix the relation lazy setup
2013-11-11 22:06:43 -08:00
Raymond Feng
275bb6ffac
Stop overwriting the static methods
2013-11-11 22:05:50 -08:00
Raymond Feng
ec7f79e935
Ensure the model is attached to DataSource for relations
2013-11-09 22:16:32 -08:00
Raymond Feng
7aa2eefec4
Remove inheritence from DataSource to ModelBuilder
2013-11-08 17:13:00 -08:00
Raymond Feng
0b899b0542
Allow settings.base to specify the base model
2013-11-07 17:11:17 -08:00
Raymond Feng
580ce14f0d
Extract the relation types
2013-11-07 13:30:54 -08:00
Raymond Feng
566da386ae
Refactor the relation handling and enable it with attach
2013-11-07 13:09:09 -08:00
Raymond Feng
34107a6a26
Redefine the existing class if it's resolved
2013-11-06 14:00:22 -08:00
Raymond Feng
68cf633795
Add support for hasMany-through and more tests
2013-11-05 09:29:24 -08:00
Raymond Feng
4fbec288c4
Enable deferred type/relation resolutions
2013-11-04 22:53:02 -08:00
Ritchie Martori
65bb5c8ead
Merge pull request #33 from strongloop/get-datasource
...
Remove model.dataSource property / Add model.getDataSource() method
2013-10-31 14:50:56 -07:00
Ritchie Martori
597a775e4c
Add model.getDataSource() method
2013-10-31 11:46:12 -07: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
dff3367f3a
Fix the regression when 1st arg is the connector module
2013-10-29 13:04:23 -07:00
Raymond Feng
37ced0111e
Merge pull request #30 from strongloop/ds-url
...
Support datasource/connector configuration using URL string
2013-10-28 10:58:45 -07:00
Raymond Feng
24e93248d1
Merge pull request #29 from strongloop/scope-remoting
...
Create remote functions for predefined scopes/relations
2013-10-27 12:59:57 -07:00
Raymond Feng
8ad0194a51
Add a relation example following Ruby on Rails active records
2013-10-27 12:55:01 -07:00
Raymond Feng
2ae0fd8804
Honor the model plural name
2013-10-25 16:25:05 -07:00
Raymond Feng
f3011216b5
Support datasource/connector configuration using URL string
2013-10-25 16:18:02 -07:00
Raymond Feng
c3d7fd0f1c
Create remote functions for predefined scopes/relations
2013-10-24 20:37:43 -07:00
Raymond Feng
fc2a53562e
Check undefined/null data
2013-10-24 18:43:55 -07:00
Raymond Feng
8a615324d0
Merge pull request #25 from strongloop/ds-attach
...
Fixes for data source juggler
2013-10-23 11:28:14 -07:00
Raymond Feng
32dbe9cb21
Move resolveType to ModelBuilder
2013-10-17 14:23:29 -07:00
Ritchie Martori
fcb35cc3eb
Fix prototype mixin bug
2013-10-11 18:37:45 -07:00
Raymond Feng
dd936b15a2
Make sure model definition is built when attaching to a DS
2013-10-11 16:35:17 -07:00
Raymond Feng
9ec9f654c7
Remove undefined values from the query object
2013-10-11 11:50:00 -07:00
Raymond Feng
aed3fb0e06
Log more information for the connection failure
2013-10-11 11:48:12 -07:00
Raymond Feng
64f57a2297
Handle connection errors
2013-10-10 22:47:26 -07:00
Ritchie Martori
95c14fa97d
Fix EventEmitter mixin
2013-10-08 15:48:17 -07:00
Raymond Feng
b8f94f5777
Make sure foreign key properties are fully registered
2013-10-07 18:01:31 -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
931636eda4
Allow the id(s) to be redefined by subclass
2013-10-06 21:13:52 -07:00
Raymond Feng
294ebc1ccf
Allow to reference a model as type by name
2013-10-05 11:13:10 -07:00
Raymond Feng
2f575482c0
Code clean up
2013-10-05 10:53:13 -07:00
Raymond Feng
7f170a0542
Add more tests and fix toJSON
2013-10-04 21:21:12 -07:00
Raymond Feng
2a15bb917a
Fix the foreign key definition
2013-10-04 15:49:13 -07:00
Raymond Feng
409d256e47
Add settings property back to the model class
2013-10-04 15:48:39 -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
04bda5c138
Set name and settings
2013-10-04 12:54:14 -07:00
Raymond Feng
ee426b63fc
Reset _ids for rebuild
2013-10-04 12:41:01 -07:00
Raymond Feng
1ae9478496
Fix the columnName
2013-10-03 14:49:03 -07:00
Raymond Feng
d0cdbd84ea
Use super_ to call the base class
2013-10-03 09:14:24 -07:00
Raymond Feng
691743493c
Fix copy of model definitions
2013-10-02 17:20:54 -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
92cd7d15a6
Add a ModelDefinition class
2013-09-20 22:22:49 -07:00
Raymond Feng
1575c87caf
Make sure schemaless property value is honored over __data
2013-09-18 16:34:52 -07:00
Raymond Feng
bf223320ea
Allow connector to report failure during initialization
2013-09-12 13:32:53 -07:00
Raymond Feng
f4d62e54e6
Add error stack trace for ValidationError
...
The issue was initially reported by SLA-370.
2013-09-09 10:12:12 -07:00
Raymond Feng
21e6fddf1a
Check the filter param to make sure we have a default value
...
sls-sample-app is failing if we hit http://localhost:3000/locations/findOne
In this case, a undefined param is passed in.
The fix now sets it to {} if the value is undefined/null
2013-09-06 13:42:12 -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
bfcd850dfe
Merge pull request #8 from strongloop/id-fix
...
Allows custom name of the id property for the memory connector
2013-08-30 10:59:50 -07:00
Raymond Feng
84a40cc1c6
Merge pull request #7 from strongloop/SLA-422
...
Mark id arguments to be required
2013-08-30 10:49:16 -07:00
Raymond Feng
f71dc8fe39
Set default value
2013-08-28 21:53:55 -07:00
Raymond Feng
c2eb1f55f0
Fix the property population for schemaless models
2013-08-28 21:49:05 -07:00
Raymond Feng
0866f33cec
Check the existence of id
2013-08-28 21:39:59 -07:00
Raymond Feng
6f111f8122
Allows custom name of the id property for the memory connector
2013-08-27 22:32:01 -07:00
Raymond Feng
cb00aad473
Mark id arguments to be required
2013-08-27 22:03:59 -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
ecc142b4d2
Disable remoting for reload
2013-08-26 10:54:26 -07:00
Raymond Feng
be15eabc36
Merge pull request #5 from strongloop/memory-connector-ids
...
Track the greatest id to prevent records from being overriden
2013-08-26 10:52:13 -07:00
Raymond Feng
7234c9822c
Add descriptions for remote method paramters
2013-08-23 17:04:08 -07:00
Raymond Feng
43a5398792
Fix the remote method descriptions
2013-08-23 14:08:47 -07:00
Raymond Feng
bede7ab499
Track the greatest id to prevent records from being overriden
2013-08-22 16:44:02 -07:00
Raymond Feng
6407098126
Update descriptions to use data source
2013-08-22 13:30:13 -07:00
Raymond Feng
a1e4457794
Refactor the shared method declaration and add descriptions
2013-08-22 12:24:02 -07:00
Raymond Feng
cf07563414
Fix the message
2013-08-20 16:14:27 -07:00
Raymond Feng
0fd167a41d
Use DEBUG or NODE_DEBUG env to override the debug flag
2013-08-18 23:11:32 -07:00
Raymond Feng
9482d3c7de
Fix the where option for delete
2013-08-18 10:58:53 -07:00
Raymond Feng
705a1fc2c9
Update the remote methods
2013-08-16 16:44:31 -07:00
Ritchie Martori
d5ab26509a
Merge pull request #1 from strongloop/id-fix
...
Fix the id references to allow custom name other than 'id'
2013-08-16 14:46:50 -07:00
Raymond Feng
29c95a4ec7
Remove the deletion of property type as the instane is shared by the base model class
2013-08-15 16:50:50 -07:00
Raymond Feng
281cc38017
Fix the id references to allow custom name other than 'id'
2013-08-14 23:14:44 -07:00
Raymond Feng
8aec0a3b47
Add missing declaration
2013-08-14 17:32:38 -07:00
Raymond Feng
6c0f2483b3
Update jsdocs
2013-08-13 09:37:27 -07:00
Raymond Feng
2e20df2dd3
Add docs.json and jsdocs
2013-08-09 15:16:32 -07:00
Raymond Feng
d3bf5c20ac
Add an optional models argument to automigrate/autoupdate
2013-08-08 08:30:26 -07:00
Raymond Feng
0a5c0ff77d
Refactor introspection to ModelBuilder
2013-08-07 14:51:32 -07:00
Raymond Feng
f3443959a1
Rename 'loopback-data' to 'loopback-datasource-juggler'
2013-07-30 14:10:03 -07:00
Raymond Feng
7ce6cfc9ab
Allows connector property to be a string
2013-07-30 10:52:30 -07:00
Ritchie Martori
08505d1e78
Add required validation
2013-07-28 13:17:12 -07:00
Raymond Feng
57c181c8b9
Bring up json object introspection to build models
2013-07-26 13:06:43 -07:00
Raymond Feng
0e4162af2a
Fix the constructor
2013-07-25 22:39:16 -07:00
Raymond Feng
1109f671da
Add precision/scale for sync discovery
2013-07-25 15:20:19 -07:00
Raymond Feng
dcada03c43
Add precision/scale
2013-07-25 15:06:00 -07:00
Raymond Feng
630aad2071
Refactor types out
2013-07-25 07:48:31 -07:00
Raymond Feng
adb724e3b2
Fix the ref to dataSource
2013-07-24 22:58:57 -07:00
Raymond Feng
9b422752a6
Allows non-strict mode to accept unknown properties
2013-07-24 22:58:57 -07:00
Raymond Feng
96787ad25f
Fix id references
2013-07-24 22:58:57 -07:00
Ritchie
5bf2d1ff23
Add root true to remote methods
2013-07-24 17:21:35 -07:00
Raymond Feng
752aedb80d
Rename adapters to connectors
2013-07-23 14:40:44 -07:00