Commit Graph

1480 Commits

Author SHA1 Message Date
Raymond Feng f671c9c726 Clean up the mixin processing 2014-08-08 01:20:57 -07:00
Raymond Feng 55ff28206f Merge branch 'feature/plugins' of github.com:fabien/loopback-datasource-juggler into fabien-feature/plugins 2014-08-07 22:51:25 -07:00
Laurent 71398518ff Fix bug when using multiple include keys 2014-08-06 20:40:24 +02: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 455ee9ec63 Fix typo: loadPlugin(s) 2014-08-05 16:28:17 +02:00
Fabien Franzen f1f692a8a5 Minor touch-ups 2014-08-05 16:26:34 +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 d07b716ae8 Merge pull request #200 from strongloop/feature/emit-events-during-attach
Emit dataAccessConfigured events during attach
2014-08-04 15:27:11 -07:00
Fabien Franzen 93aea7eb66 Changed options.path to option.http.path 2014-08-04 19:45:47 +02:00
Fabien Franzen 81a822524d Removed normalization (see strong-remoting) 2014-08-04 12:17:06 +02:00
Raymond Feng b9d9ab0fb3 Emit dataAccessConfigured events during attach
See discussions at https://github.com/strongloop/loopback/issues/410
2014-08-01 08:22:33 -07:00
Fabien Franzen ef65ffee48 Changed normalization api - enabled hasOne remoting 2014-08-01 11:24:41 +02:00
Fabien Franzen 71bf0f8240 Customize/Normalize class-level remoting http path 2014-08-01 09:38:25 +02:00
Raymond Feng 6239d8fde5 Merge branch 'patch-4' of github.com:lchenay/loopback-datasource-juggler into lchenay-patch-4 2014-07-30 21:34:41 -07:00
Jaka Hudoklin d896a0982e fix datasources to support new model parameters
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-31 01:06:52 +02:00
Fabien Franzen 090c738bb5 Correctly handle remoting of scope methods 2014-07-30 17:30:21 +02:00
Fabien Franzen af0ca5b108 Handle remoting of custom scope methods 2014-07-30 16:46:05 +02:00
Fabien Franzen e38c92af87 ReferencesMany fixes after LB integration tests 2014-07-30 15:01:55 +02:00
Fabien Franzen 5cee6a4b79 Fixed embedsMany after LB integration 2014-07-30 13:22:20 +02:00
Raymond Feng 7a9b64f1bf Fix the test failure for mongodb 2014-07-29 22:19:52 -07:00
Fabien Franzen e888b8cff9 Allow custom scopeMethods option (obj/fn) for relation scopes 2014-07-29 22:59:44 +02:00
Fabien Franzen 06f2b32c21 Renamed EmbedsMany 'reference' option to 'belongsTo' 2014-07-29 21:56:59 +02:00
Fabien Franzen 1782b439f1 Implemented referencesMany 2014-07-29 21:46:12 +02:00
Fabien Franzen 60fd39d311 Added option: reference to enable embedsMany add/remove 2014-07-29 17:43:30 +02:00
Fabien Franzen b18384459a Implemented findByIds 2014-07-29 15:01:47 +02:00
Fabien Franzen 13cee9502c Tests for polymorphic embedsMany 2014-07-29 13:57:49 +02:00
Fabien Franzen da303b72a5 Implemented more complex scenaro: embedsMany + relations
The test case will denormalize data into the embedded object,
and re-use the actual related object id as its own id.
2014-07-29 12:02:52 +02:00
Fabien Franzen 6ed7a0a5f2 Convenience embedsMany accessors: at(idx), get(id), set(id, data) 2014-07-29 10:51:33 +02:00
Raymond Feng cb43114ab7 Fix test cases 2014-07-28 16:15:37 -07:00
Raymond Feng 1b44a6d779 Merge branch 'feature/embed-hasmany' of github.com:fabien/loopback-datasource-juggler into fabien-feature/embed-hasmany 2014-07-28 14:51:16 -07:00
Raymond Feng 75403ef929 Merge branch 'feature/polymorphic-rel' of github.com:fabien/loopback-datasource-juggler into fabien-feature/polymorphic-rel
Fix test cases
2014-07-28 14:22:45 -07:00
Raymond Feng 8bc11ca51e Increase the max number of model listeners
See https://github.com/strongloop/loopback/issues/404
2014-07-28 13:02:00 -07:00
Raymond Feng 5221d12305 Remove unused data 2014-07-28 09:36:04 -07:00
Laurent Chenay aaf037fc51 Do not overwrite inclusion but scope them. Needed in relation hasManyThrought 2014-07-28 15:20:04 +02:00
Laurent Chenay 04a56e2ea6 Fix HEAD on relation hasMany 2014-07-28 11:36:32 +02:00
Fabien Franzen 309105c4ad Updated remaining relations to use polymorphicParams 2014-07-28 11:12:20 +02:00
Fabien Franzen 7ddfbb6409 polymorphics can now be declared using object 2014-07-28 10:44:26 +02:00
Fabien Franzen 4e76c2a77f typeTo => discriminator 2014-07-28 10:18:42 +02:00
Fabien Franzen e1ecb4b95f Require unique ids for embedded items 2014-07-27 17:30:10 +02:00
Fabien Franzen 43e11af942 Test build of embedsMany 2014-07-27 17:16:25 +02:00
Fabien Franzen cd2cc68905 Minor fix 2014-07-27 16:56:30 +02:00
Fabien Franzen 1487a592c1 Added validation for embedded items (optional) 2014-07-27 16:54:01 +02:00
Fabien Franzen 59a957b538 Implemented embedsMany relation 2014-07-27 16:30:45 +02:00
Raymond Feng 1a989041ed Fix a regression where undefined id should not match any record 2014-07-27 00:38:50 -07:00
Fabien Franzen 5a5aa3f14d Minor tweaks; pass-through properties/scope for hasAndBelongsToMany 2014-07-26 21:32:24 +02:00
Fabien Franzen 5e30ec8637 Implemented polymorphic hasMany through inverse
Added option invert: true to enable inverse polymorphic hasMany
relations.

Fixed missing fk1 in query of HasManyThrough.prototype.exists.
2014-07-26 21:11:25 +02:00
Fabien Franzen d1896553fd More hasAndBelongsToMany tests 2014-07-26 17:20:25 +02:00
Fabien Franzen 9f94ec9bde Minor cleanup 2014-07-26 15:23:40 +02:00
Fabien Franzen 00dfe563eb Implemented polymorphic hasOne
Signed-off-by: Fabien Franzen <info@atelierfabien.be>
2014-07-26 15:20:46 +02:00
Fabien Franzen 295e6fc1f1 Implemented polymorphic hasAndBelongsToMany 2014-07-26 14:54:54 +02:00
Fabien Franzen 9b97e1ae77 Implemented polymorphic hasMany 2014-07-26 12:47:55 +02:00
Miroslav Bajtoš ebd0bc62ee datasource: support connectors without `getTypes`
Asking connectors to provide `getTypes` function is a breaking
change, connectors working with loopback 1.3 no longer works
in newer versions.
2014-07-25 11:32:40 +02:00
Miroslav Bajtoš cd4dba79dc relation: add `scope._target` for `hasOne`
Add `_target` property to the scope method created by `hasOne`
relationship. The `_target` property is used by loopback-sdk-angular.
2014-07-24 20:22:11 +02:00
Fabien Franzen 973c96268f Fix scoped destroyAll: only use 'where', not full 'filter' args 2014-07-24 15:55:00 +02:00
Fabien Franzen 687eb9888b Added test for belongsTo scope/properties
Note: its seems that keyFrom and keyTo were mistakingly reversed in
BelongsTo.prototype.create, please double check. The added test cases
now pass with pk/fk switched.
2014-07-23 11:10:44 +02:00
Fabien Franzen bc4076f35e Implement scope/properties for BelongsTo (+ fix foreign key matching) 2014-07-22 22:09:29 +02:00
Raymond Feng 61d315cb28 Merge pull request #180 from strongloop/feature/refactor-relation-remoting
Move relation remoting to loopback
2014-07-22 11:13:07 -07:00
Raymond Feng 716b27b0f0 Merge pull request #181 from offlinehacker/master
Add support for disabling relationship includes
2014-07-21 13:46:43 -07:00
Jaka Hudoklin 11679beb14 add support for disabling relationship includes
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-21 22:39:29 +02:00
Jaka Hudoklin b1a1894635 add support for relationship options
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-21 22:39:06 +02:00
Raymond Feng 8f46626c0b Expose base model class as `base` property 2014-07-21 10:21:30 -07:00
Raymond Feng ad22b025a6 Move relation remoting to loopback 2014-07-16 16:36:43 -07:00
Raymond Feng fc710ca55a Merge branch 'master' into 2.0 2014-07-15 17:09:20 -07:00
Raymond Feng ee6da650e9 Test instance or id by the model type 2014-07-15 16:09:54 -07:00
Raymond Feng dc6ada6348 Merge pull request #165 from strongloop/feature/allow-hook-skip-next
Pass callback to hooks so that next can be skipped
2014-07-15 12:53:52 -07:00
Raymond Feng efeb59178f Merge pull request #174 from fabien/fix/validations
Fix/validations
2014-07-15 12:53:33 -07:00
Raymond Feng 9325ce316b Allow before hooks to pass arguments to next() 2014-07-15 12:51:33 -07:00
Raymond Feng f3dbc6ca5f Remoting methods for hasMany through 2014-07-15 08:50:34 -07:00
Raymond Feng ae9c7f8cac Fix the error message 2014-07-14 08:56:33 -07:00
Fabien Franzen 48c4f25b09 Renamed mapping to properties 2014-07-12 00:02:16 +02:00
Fabien Franzen 61f6d49518 Fix validateUniqueness/nextTick 2014-07-11 23:55:15 +02:00
Fabien Franzen 50656b8206 Handle custom error codes
Fixes #151
2014-07-11 23:03:07 +02:00
Fabien Franzen a58dbe3a54 More validations and tests
Added validatesAbsenceOf. Handle async with if/unless prevention of
validators correctly. See: #170 #158
2014-07-11 22:56:02 +02:00
Fabien Franzen 5f1431aa05 Don't check uniqueness of blank values 2014-07-11 22:07:57 +02:00
Fabien Franzen 6aaa3f216e RelationDefinition applyScope/applyMapping
Add the ability to set static/dynamic filtering (where, order, limit,
skip, fields …) and property mapping/transfer (de-normalization) for
hasMany/hasOne.
2014-07-11 15:29:47 +02:00
Raymond Feng a37129bdff Allows default model class to be configured 2014-07-08 14:04:20 -07:00
Samuel Reed b66183f7dc DAO.prototype.exists should return 'boolean' type.
Signed-off-by: Samuel Reed <samuel.trace.reed@gmail.com>
2014-07-08 15:51:24 -05:00
Miroslav Bajtoš 0296ef113d Make sure 'deleteById' is used as the remote operation name
See strongloop/loopback#359
2014-07-03 08:17:01 +02:00
Raymond Feng f7afade229 Make sure 'upsert' is used as the remote operation name
See https://github.com/strongloop/loopback/issues/359
2014-07-02 12:20:56 -07:00
Raymond Feng e45834b454 Merge pull request #156 from strongloop/feature/fix-lb-353
Make sure type of the foreign key match the primary key
2014-06-27 10:08:54 -07:00
Raymond Feng d0e61af26f Merge pull request #157 from strongloop/feature/query-order
Normalize filter.order and enforce more checks
2014-06-27 10:01:33 -07:00
Raymond Feng e0c7619908 Normalize filter.order and enforce more checks 2014-06-26 23:40:20 -07:00
Raymond Feng 4515491318 Make sure type of the foreign key match the primary key
See https://github.com/strongloop/loopback/issues/353
2014-06-26 23:38:04 -07:00
Ritchie Martori a3ed1a575e Add "hasOne" to relationTypes 2014-06-26 14:48:27 -07:00
Miroslav Bajtoš 3572ecd12d validations: support non-V8 browsers
Call `Error.captureStackTrace()` only when it is available.

Use `this.stack = (new Error).stack` when `captureStackTrace` is not
available but the `stack` property is (Firefox).
2014-06-23 14:39:37 +02:00
Raymond Feng ce8254125f Merge branch 'master' into 2.0 2014-06-21 12:53:46 -07: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 332579ec87 Synchronize with cachedRelations 2014-06-21 11:44:33 -07:00
Raymond Feng cbee68706f Remove remoting metadata 2014-06-20 23:54:46 -07:00
Raymond Feng 44de2da21f Merge branch 'master' into 2.0 2014-06-20 23:02:37 -07:00
Raymond Feng 3f7e85101d Merge pull request #140 from strongloop/feature/refactor-relation
Feature/refactor relation
2014-06-20 20:56:44 -07:00
Raymond Feng 86073cb480 Merge pull request #144 from strongloop/feature/add-update
Feature/add update
2014-06-20 12:28:48 -07:00
Raymond Feng a1836662a7 Clean up comments 2014-06-20 12:05:32 -07:00
Raymond Feng 27f4c1b7b4 Fix the error msg 2014-06-19 15:09:19 -07:00
Raymond Feng 1833352238 More clean up for the scope processing 2014-06-19 12:00:49 -07:00
Raymond Feng 177752e144 Add more jsdocs 2014-06-19 11:13:24 -07:00
Raymond Feng 26501eaa2e Merge pull request #135 from albertoleal/ConvertNullToNotFoundError
ConvertNulltoNotFoundError when calling DataAccessObject.findOne via rest
2014-06-18 23:00:30 -07:00
Raymond Feng 7c71e1e53b Merge pull request #141 from strongloop/feature/fix-perf
Feature/fix perf
2014-06-18 22:40:00 -07:00
Raymond Feng 085a0a1681 Merge pull request #143 from strongloop/feature/lb-issue-336
Allows skip or offset
2014-06-18 22:31:47 -07:00
Raymond Feng 888d15ce1c Optimize model instantiation and conversion 2014-06-18 22:13:52 -07:00
crandmck 893768e895 Add hooks and include mixins 2014-06-18 16:42:00 -07:00
Raymond Feng b3b29d7313 Enhance the wildcard to regexp conversion 2014-06-18 12:37:49 -07:00
Raymond Feng a487eb57cd Add like/nlike support for memory connector 2014-06-17 23:19:28 -07:00
Raymond Feng ad3af82923 Add support for updating multiple instances with query 2014-06-17 16:30:02 -07:00
crandmck 4ff6e0d707 Minor JSDoc cleanup 2014-06-17 13:21:21 -07:00
crandmck 907163949e Initial JSDoc cleanup 2014-06-17 13:18:18 -07:00
Raymond Feng 4b9d98c6ce Allows skip or offset
See https://github.com/strongloop/loopback/issues/336
2014-06-17 09:07:55 -07:00
Raymond Feng e2ab9ccc93 Adding back the remoting metadata 2014-06-16 13:46:17 -07:00
Raymond Feng 046816191d Clean up scope implementation 2014-06-16 10:50:42 -07:00
Raymond Feng 2db43c58e5 Add support for hasOne 2014-06-16 01:17:37 -07:00
Raymond Feng 34c1998f04 Fix the hasMany through connection 2014-06-16 00:36:12 -07:00
Raymond Feng 1406c22a64 Refactor relation into classes 2014-06-15 15:53:58 -07:00
Raymond Feng 0c13f8c23a Merge pull request #132 from strongloop/feature/memory-connector-comparator
Feature/memory connector comparator
2014-06-13 11:46:52 -07:00
crandmck 1787f5ec4f Add properties and other doc cleanup 2014-06-11 15:47:44 -07:00
Alberto Leal 4fd3c969f9 Convert null to NotFoundError for remoting call to DataAccessObject.findOne. 2014-06-11 16:59:21 -03:00
Raymond Feng bb57fcbe11 Fix the comparison for null/boolean values 2014-06-10 16:11:50 -07:00
crandmck c355c99cbd More JSDoc cleanup 2014-06-10 14:27:58 -07:00
Raymond Feng 6e8034ff93 Fix the forEach closure 2014-06-06 09:59:57 -07:00
Raymond Feng e0d3fec743 Fix the typo 2014-06-06 09:10:47 -07:00
Raymond Feng 0191e3c2db Add more tests 2014-06-06 08:48:05 -07:00
Raymond Feng a0a9fae9c6 Enhance comparators for memory connector 2014-06-06 08:19:41 -07:00
Rand McKinney 04e1256b8b Update datasource.js
Fix small typo
2014-06-04 17:44:57 -07:00
Raymond Feng 5f3c856d2e Fix the logical operator check 2014-06-04 14:23:53 -07:00
Raymond Feng cdf9956867 Fix JS doc for private methods 2014-06-04 14:02:55 -07:00
Raymond Feng 42c1ad3dca Normalize/validate the query filter object 2014-06-02 15:57:44 -07:00
Raymond Feng 3e8284d1ee Use connector's buildWhere to implement count 2014-06-02 15:57:06 -07:00
Rand McKinney 653aab856c JSDoc improvements
Improve createModel doc, Fix some other minor issues.
2014-05-29 15:33:01 -07:00
Miroslav Bajtoš d8b4f5833a ModelBuilder: add `prototype.defineValueType`
Add a shortcut for registering a new value type.

The current implementation registers the type in the singleton registry
`ModelBuilder.schemaTypes`.

The API should allow us to to change the implementation to register
the type in the scope of ModelBuilder instance only.
2014-05-29 11:57:59 +02:00
Miroslav Bajtoš a86648ed7b Replace connector base with loopback-connector
Remove references to Connector and BaseSQL, connectors should require()
loopback-connector instead of loopback-datasource-juggler.
2014-05-29 11:57:49 +02:00
Miroslav Bajtoš 9b33d9a274 Remove unsupported connectors
- cradle
 - http
 - neo4j
 - riak
2014-05-28 19:49:07 +02: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
crandmck 83979cad7a Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst) 2014-05-27 21:59:21 -07:00
crandmck 835708d25d Copy info from api-model.md to JSDoc 2014-05-27 21:59:21 -07:00
Miroslav Bajtoš 65fa7a1c00 validations: include more details in `err.message`
Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.

Before this change, the message was pointing the reader
to `err.details`.  Most frameworks (e.g. express, mocha) log only
`err.message` but not other error properties, thus the logs were
rather unhelpful.

Example of the new error message:

    The `User` instance is not valid. Details: `name` can't be blank.
2014-05-27 21:59:21 -07:00
Raymond Feng 050353f11d 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 13:18:21 -07:00
crandmck 5937f0c0d5 Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst) 2014-05-22 15:02:57 -07:00
crandmck 00226dde0d Copy info from api-model.md to JSDoc 2014-05-21 17:50:44 -07:00
Ritchie Martori 69b0355fa7 Merge pull request #115 from strongloop/refactor/remove-remoting
Remove remoting metadata
2014-05-20 13:59:33 -07:00
Ritchie Martori 8849a4b49a !fixup Remove additional remoting 2014-05-20 13:48:23 -07:00
Ritchie Martori e724efd95f !fixup Require ._delegate for fn override 2014-05-20 13:44:25 -07:00
Ritchie Martori 072999775e Remove relation remoting 2014-05-20 12:47:14 -07:00
Miroslav Bajtoš 05410d56e1 validations: include more details in `err.message`
Modify ValidationError constructor to include the model name and
a human-readable representation of the validation errors (messages)
in the error message.

Before this change, the message was pointing the reader
to `err.details`.  Most frameworks (e.g. express, mocha) log only
`err.message` but not other error properties, thus the logs were
rather unhelpful.

Example of the new error message:

    The `User` instance is not valid. Details: `name` can't be blank.
2014-05-20 11:00:19 +02:00
Ritchie Martori dc9c9b2bd4 Remove remoting metadata 2014-05-16 12:33:17 -07:00
Raymond Feng 981185f4c0 Merge pull request #112 from strongloop/feature/logical-operator
Add support for logical operator (AND/OR)
2014-05-16 08:46:25 -07:00
Adam Schwartz 49f0e5dcee Fix typo "Unkown" => "Unknown" 2014-05-15 23:26:17 -04:00
crandmck ba3653d406 Updated JSDoc comments with content from .md file 2014-05-15 17:59:23 -07:00
Raymond Feng 8f9dc1b867 Add support for logical operator (AND/OR) 2014-05-15 08:56:00 -07:00
Miroslav Bajtoš 2a74bdc4de validations: support multi-key unique constraint
Modify the "unique" validator to accept additional property names to
narrow the space of rows searched for duplicates.

Example:

Consider `SiteUser` belongsTo `Site` via `siteId` foreign key.
Inside every site, the user email must be unique. It is allowed to
register the same email with multiple sites.

    SiteUser.validateUniquenessOf('email', { scopedTo: ['siteId'] });
2014-05-15 09:15:44 +02:00
crandmck 1db35cc926 Update JSDoc comments with content from api-model.md 2014-05-14 18:30:42 -07:00
Rand McKinney affe3cd943 Add JSDoc for lat and lng properties. 2014-05-14 16:34:24 -07:00
Ritchie Martori 2922eb63b7 Merge 2014-05-14 13:33:46 -07:00
Ritchie Martori ad752747d3 Add missing changed event 2014-05-14 13:31:15 -07:00
Ritchie Martori 6c91201f79 Local Storage 2014-05-14 13:31:15 -07:00
Ritchie Martori 0866a55cb2 Do not .toObject if already Object 2014-05-14 13:31:15 -07:00
Zack Bloom dd4089d1c7 Fix bug where invalid relations in include filters would hang the server 2014-05-13 13:59:15 -04:00
Raymond Feng 3f410cae21 Add test cases for updateOrCreate/save and fix related issues 2014-05-09 15:27:45 -07:00
Raymond Feng 0bcbe6ceae Remove undefined for the data to be saved 2014-05-09 09:59:34 -07:00
Raymond Feng 4a907b0a18 Remove the undefined property to avoid mongodb upsert overwrite 2014-05-08 15:46:39 -07:00
Raymond Feng 8b128b566d Make sure ObjectID type is not parsed as object 2014-05-08 15:46:14 -07:00
crandmck cf75f55f73 Fix JSDoc - remove newlines from function alias declarations, etc. 2014-05-07 11:24:49 -07:00
Rand McKinney a765ea31ab Correct JSDoc for discoverModelDefinitions 2014-05-06 14:18:10 -07:00
Ritchie Martori 45eadabbeb Fix remoting for IDs in URLs 2014-05-01 14:19:31 -07:00
Ritchie Martori aea5836569 Add hidden property support 2014-04-11 11:39:57 -07:00
Miroslav Bajtoš 440dfaf3a7 scope-like remotable metadata for belongsTo
Modify the methods created by `belongsTo` relation to mimick the methods
created by scopes (e.g. via `hasMany` relation).

This allows client code generators like loopback-angular to use the same
code for all relation types.
2014-04-08 10:30:57 +02:00
Raymond Feng a1f8919e13 Merge pull request #98 from strongloop/feature/fix-issue-97
Fix the method for belongsTo with correct receiver
2014-04-04 08:27:55 -07:00
Raymond Feng 68d2696248 Fix the method for belongsTo with correct receiver 2014-04-03 20:41:53 -07:00
Miroslav Bajtoš d08c6714d8 scope: improve description of shared methods
The description is used by client SDK code-generators like
loopback-angularjs.
2014-04-03 09:19:06 +02:00
Miroslav Bajtoš abf57ff497 scope: add _targetClass to scope property
Store the class of the results returned by a scope find method.
This class is different from the "targetClass" when the relations
is using a third "through" model (e.g. hasAndBelongsToMany).
2014-04-02 19:32:37 +02:00
Raymond Feng c79d0b0c33 Merge pull request #92 from strongloop/feature/fix-issue-91
Fix the base sql connector to correct escape id values
2014-03-27 14:34:46 -07:00
Raymond Feng c28546b629 Fix the base sql connector to correct escape id values
This is based on https://github.com/strongloop/loopback-datasource-juggler/pull/91
https://github.com/strongloop/loopback-datasource-juggler/issues/90
2014-03-24 14:56:52 -07:00
Raymond Feng 0e7acec591 Set the relation property correctly
See https://github.com/strongloop/loopback/issues/218
2014-03-23 21:07:04 -07:00
Raymond Feng cc5975486d Simplify the inclusion processing 2014-03-17 08:40:40 -07:00
Raymond Feng cadacc44bb Create scoped methods for belongsTo and improve docs 2014-03-17 08:40:40 -07:00
Raymond Feng 1dc0c34252 Fix the connector resolver to make sure known connectors are used 2014-03-17 08:32:37 -07:00
Raymond Feng bef90bd529 Refactor the serialize/deserialize into two functions 2014-03-17 08:32:37 -07:00
crandmck aa11aad298 Fix some small errors 2014-03-13 16:26:29 -07:00
crandmck 9c2098cd35 Updates to JSDoc comments for API doc 2014-03-12 16:28:46 -07:00
Raymond Feng 464d23891b Merge pull request #82 from strongloop/feature/ldl-scopes
Allows scopes to be defined in LDL
2014-03-04 09:50:27 -08:00
Raymond Feng d14c58775d Use debug module for logging 2014-03-04 09:42:55 -08:00
Raymond Feng ab8076d44a Merge pull request #80 from strongloop/feature/remoting-belongsTo
Make the belongsTo relation remotable
2014-03-04 08:57:57 -08:00
Raymond Feng ed7e2e2ada Fix the parameter name 2014-03-04 08:56:16 -08:00
Raymond Feng 24c4381221 Allows scopes to be defined in LDL 2014-03-03 17:16:37 -08:00
Raymond Feng 510f5ef6ac Check the Array type
See https://github.com/strongloop/loopback-connector-mongodb/issues/21
2014-03-03 15:52:49 -08:00
Raymond Feng 14745b1305 Make the belongsTo relation remotable 2014-03-03 15:03:05 -08:00
Raymond Feng 925402fdb6 Merge pull request #78 from pandaiolo/master
Fix, model builder setter will not try to cast value if already the proper type
2014-02-27 10:38:28 -08:00
Aurelien Chivot dfe1ea1655 Fix, model builder setter will not try to cast value if already the proper type 2014-02-26 21:10:15 +01:00
Raymond Feng 44a62d01af Allows unknown properties to be saved for non-strict models
See https://github.com/strongloop/loopback/issues/199
2014-02-24 18:38:45 -08:00
Ritchie Martori 8ae292539e Merge pull request #74 from strongloop/feature/dao-override
Override existing methods when mixing in DAO methods
2014-02-21 09:04:52 -08:00
Ritchie Martori dd597d2197 Refactor mixin and always redefine proxy/delegate methods 2014-02-20 17:25:07 -08:00
Ritchie Martori 38c7a16da2 Override existing methods when mixing in DAO methods 2014-02-19 17:10:56 -08:00
Raymond Feng 9192c27409 Leave the item type introspection for List 2014-02-14 11:21:30 -08:00
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
Raymond Feng ac76666b7b Set up connector from the data source 2013-07-23 13:19:35 -07:00
Raymond Feng 1970c99424 Rename dataSource() to avoid conflicts with the property 2013-07-23 12:44:04 -07:00
Raymond Feng 4df5a02676 Fix schema references 2013-07-23 12:16:12 -07:00
Raymond Feng 9b169efc8c Set up connector/adapter when postInit is not called 2013-07-23 12:05:08 -07:00
Raymond Feng 6af4b1ba2f More renames: schema -> dataSource, adapter -> connector 2013-07-23 11:16:43 -07:00
Raymond Feng 127fb32d02 Add the id arg 2013-07-22 09:57:55 -07:00
Raymond Feng b7f7f71b15 Add static deleteById 2013-07-22 09:42:09 -07:00
Raymond Feng 588b328e62 Fix the model prop lookup 2013-07-21 17:27:31 -07:00
Ritchie Martori 22db369fb8 Allow queries to filter fields 2013-07-17 09:05:37 -07:00
Ritchie Martori d4ca20c01a Add filter.fields support to dao and memory connector 2013-07-16 17:53:52 -07:00
Raymond Feng be21815e7b Rename jugglingdb to loopback-data 2013-07-16 11:59:53 -07:00
Ritchie Martori a4247ad59f Remove updateAttribute as remote method 2013-07-15 19:44:29 -07:00
Ritchie Martori 0aa0cabdd4 Fix inherit bug 2013-07-15 18:22:49 -07:00
Ritchie Martori 2de55df939 Fix extend by using util.inherits 2013-07-15 10:44:34 -07:00
Raymond Feng 12c28ce363 Fix typos 2013-07-15 10:38:54 -07:00
Raymond Feng ef671825ff Only flatten array/object for relational DBs 2013-07-12 19:10:42 -07:00
Raymond Feng 8e01e17bdb Add support for nesting objects with an array 2013-07-12 18:59:43 -07:00
Raymond Feng 09ab8356b8 Fix the array data population 2013-07-12 12:36:14 -07:00
Raymond Feng 296b258f35 Add http mapping for create/updateAttributes methods 2013-07-11 16:49:18 -07:00
Raymond Feng aa5bba3bac Fix the ref to getSchemaType 2013-07-11 16:04:28 -07:00
Raymond Feng 194f68468a Add support for nesting schema 2013-07-11 14:24:47 -07:00
Raymond Feng 049f4c0c38 Add Object type 2013-07-11 11:04:31 -07:00
Raymond Feng 12199ad779 Add support to use adapter constructor for initialization 2013-07-11 09:55:26 -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 c8bfc5802a Add event emitter methods to models. 2013-07-02 14:59:24 -07:00
Ritchie Martori 522291bf08 Add support for extending models 2013-07-01 16:49:43 -07:00
Ritchie Martori dbd5efed50 Revert adapter serialization. Remove geo point distance indicator. 2013-07-01 13:16:51 -07:00
Ritchie Martori e6a88ac254 Add properties to ModelClass during definition 2013-06-27 18:25:42 -07:00
Ritchie ce63ef9ac2 Fix global leak and incorrect var 2013-06-27 12:21:31 -07:00
Raymond Feng 64da1d441a Add alias to destroy/destroyAll 2013-06-25 21:08:34 -07:00
Raymond Feng 0ae61d3b53 Alias destroy/destroyAll 2013-06-25 20:36:08 -07:00
Ritchie Martori 6cb53e5001 Add in memory geo filtering. 2013-06-25 20:31:00 -07:00
Ritchie Martori d730aab674 Move geo filter creation into reusable module. 2013-06-24 16:38:50 -07:00
Ritchie Martori 572445de39 Rename long to lng 2013-06-24 15:32:34 -07:00
Ritchie Martori 6856ff7254 Add geo filtering for memory adapter 2013-06-24 15:21:59 -07:00
Ritchie Martori 008b406dd7 model.find => model.findById, model.all => model.find 2013-06-24 12:42:58 -07:00
Ritchie Martori ff37cc001a Fix incorrect variable name in updateAttributes 2013-06-21 15:01:40 -07:00
Ritchie Martori 0a3e642c9e Fix memory adapter updateAttributes issue.
Callback with an error if an id was not provided or if a model was not
found by that id.
2013-06-21 14:56:23 -07:00
Raymond Feng 4940187663 Fix the schema building 2013-06-21 14:15:24 -07:00
Raymond Feng 3830f0bfda Normalize the schema definition 2013-06-21 14:04:24 -07:00
Raymond Feng a6ad39ba0f Update the discover apis to take options 2013-06-20 15:51:24 -07:00
Michael Schoonmaker bc62d28b12 Removed a stray log. 2013-06-19 13:15:57 -07:00
Raymond Feng 3b731b1a12 Move the _operations={} up 2013-06-18 14:44:30 -07:00
Raymond Feng 72e8e7230f Work around the JDB test coverage tool limitation. See https://github.com/1602/semicov 2013-06-18 12:07:13 -07:00
Raymond Feng b3e98f0c6f Pass in the options 2013-06-18 11:50:13 -07:00
Ritchie 502b0512d3 Support string types when defining properties 2013-06-17 16:42:13 -07:00
Ritchie d442c40f25 Rename discoverModels to discoverModelDefinitions 2013-06-17 11:43:20 -07:00
Ritchie 25f2920e95 Handle separate settings and adapter objects 2013-06-17 07:54:51 -07:00
Ritchie 864135e0e4 Remove console log 2013-06-17 07:39:31 -07:00
Ritchie 473dd794ef Fix missing settings 2013-06-14 14:22:51 -07:00
Ritchie bf83a76eae Fix missing connector alias 2013-06-14 13:56:44 -07:00
Ritchie b78050410d Merge branch 'asteroid-0.7'
Conflicts:
	lib/datasource.js
2013-06-13 16:27:31 -07:00
Ritchie Martori 7e23393e99 Fixed memory adapter filtering + asteroid compatibility upddates 2013-06-12 15:45:31 -07:00
Raymond Feng a47bc15e64 Make sure options is present 2013-06-11 14:56:26 -07:00
Ritchie 3628bd5be8 Fix remoteEnabled bug 2013-06-11 11:11:10 -07:00
Ritchie Martori 51d4a74264 Revert "Asteroid 0.7 updates"
This reverts commit c87abafec8.
2013-06-11 09:04:37 -07:00
Ritchie Martori c87abafec8 Asteroid 0.7 updates 2013-06-11 09:03:11 -07:00
Raymond Feng 36c22ab972 Adjust the mixins 2013-06-05 14:34:05 -07:00
Ritchie Martori adf7c49c91 Allow dao.find() and exists() to take any type for id 2013-06-05 07:39:26 -07:00
Raymond Feng 24a1c76c59 Fix the receiver 2013-06-03 08:51:17 -07:00
Raymond Feng 567efc5698 Add discoverExportedForeignKeys 2013-06-02 23:00:11 -07:00
Raymond Feng a2da90867f Add sync versions of discovery 2013-06-01 23:03:25 -07:00
Raymond Feng 56af9673c1 Avoid duplicate connecting 2013-05-31 13:40:50 -07:00
Raymond Feng 9d74759f90 Improve connect/disconnect 2013-05-31 13:10:09 -07:00
Ritchie 1bb8047b57 Merge branch 'master' of github.com:strongloop/jugglingdb 2013-05-31 10:28:05 -07:00
Ritchie 5f26eba571 Add plural name to models 2013-05-31 10:27:52 -07:00
Raymond Feng 7b861c2aac Update buildModels and support associations via foreign keys 2013-05-31 10:25:11 -07:00
Raymond Feng 2d62b5ba6a Add support to discover related schemas by foreign keys 2013-05-30 23:13:04 -07:00
Raymond Feng ad14bd9dbc Add more debugging info 2013-05-30 17:23:31 -07:00
Raymond Feng 8912defe8e Enhance support for composite keys 2013-05-30 16:06:04 -07:00
Raymond Feng d9998d8294 Update column type info 2013-05-29 10:03:01 -07:00
Raymond Feng 6255da2ae0 Fix mixin 2013-05-29 07:17:07 -07:00
Raymond Feng 771bf70ec5 Add options including default 2013-05-28 15:40:16 -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 Martori 50b2036511 Update remoting signatures for dao. 2013-05-24 15:10:34 -07:00
Ritchie 0a8df17135 Merge branch 'master' of github.com:strongloop/jugglingdb 2013-05-24 08:03:11 -07:00
Ritchie ae9cb9a6f2 Add pluralized name to model and remoting method signatures 2013-05-24 08:02:58 -07:00
Raymond Feng 98690a4881 Add docs 2013-05-23 22:40:33 -07:00
Raymond Feng dea07f3a02 Rename adl to be ModelBuilder 2013-05-23 22:20:20 -07:00
Raymond Feng a014fddd8a Add more methods to map column/property names 2013-05-23 21:09:46 -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 2c2768e929 Fix the mapping 2013-05-23 10:46:01 -07:00
Raymond Feng e51bd2d360 Fix the column mapping 2013-05-22 18:04:05 -07:00
Raymond Feng 31473d3add Fix the id column name 2013-05-22 12:17:14 -07:00
Raymond Feng 5b32141e31 Start to add discoverSchema and name mapping 2013-05-22 10:41:08 -07:00
Raymond Feng aebd7de68c Fix the capitalize 2013-05-21 14:54:14 -07:00
Raymond Feng 0022edb774 Transform the names 2013-05-21 14:43:25 -07:00
Raymond Feng 88f174ee39 Add discoverSchema 2013-05-21 14:25:23 -07:00
Raymond Feng fcdd8c2bca Fix the delegation for discover 2013-05-21 12:00:16 -07:00
Raymond Feng 26230be417 Fix the discover methods 2013-05-21 11:59:16 -07:00
Raymond Feng 184c190223 Bring up the schema loading from json docs 2013-05-20 16:05:59 -07:00
Raymond Feng 347147a36b Remove schema.js 2013-05-17 17:06:40 -07:00
Raymond Feng fca91e3400 Fix the on-demand connection 2013-05-17 16:21:12 -07:00
Raymond Feng 7caaeb2623 Fix the datasource.define 2013-05-17 14:41:04 -07:00
Raymond Feng 8263a6d71b Start to refactor ADL and DataSource 2013-05-17 10:54:14 -07:00
Anatoliy Chakkaev 4c717e4335 Fail uniqueness check in case of db error 2013-05-17 09:01:29 -07:00
Raymond Feng 630b991d1d Refactor the CRUD operations to DataAccessObject 2013-05-17 08:49:57 -07:00
Raymond Feng 3d82fc10b9 Fix the discover keys 2013-05-13 22:10:10 -07:00
Raymond Feng e207628538 Add discover primary/foreign keys 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev c15ff3cad0 Safer include 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 0f040f7814 Fix Problem with DataType Text, closes #278 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 06641da2c6 Add context info to validation error 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev ba75af1490 Only save schema props 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 25db533827 Fix tick 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 8370538e4e Safe connect call 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 23004c12c1 Support define fk with class name 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 8099f7edf2 Fix find with NaN id in base-sql 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev e13149edc5 Added skip/limit to memory adapter 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev ee05ebcca6 Relations passed to belongsTo.add 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 504ae56acd Fix injection in ids 2013-05-13 22:04:28 -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 a73f53521e Fix m2m: only add fk when hasMany have no "through" 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 9facf369b1 Some tests for scope 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 5620be1d57 Add discover methods for model names and properties 2013-04-19 14:11:52 -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
Raymond Feng 589908a78f The connecting flag should be set to false initially 2013-04-15 16:00:08 -07:00
Anatoliy Chakkaev 3364102771 Do not assign enumerable schema to object #256 2013-04-07 00:21:42 +04:00
Anatoliy Chakkaev 2fd2157d28 Fix dates in memory adapter 2013-04-06 14:50:23 +04: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 029dfb6f3b Allow database.js to export function(compound) 2013-04-04 22:24:56 +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 f56cbaa150 Added map-reduce and find methods to list 2013-04-03 23:52:19 +04:00
Anatoliy Chakkaev be17763eca Return valid in case of sync validations 2013-04-01 20:13:55 +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 6449f1ca72 Fix validations 2013-03-31 13:41:02 +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 5b429e8d41 Fix memory adapter: broken upd attrs 2013-03-30 21:07:16 +04:00
Anatoliy Chakkaev 2f048e79c0 Return instance of object when create 2013-03-30 21:06:09 +04:00
Anatoliy Chakkaev 5540750626 Validation amends
- rename event
- pass data to hooks
- always call hooks (even when no validations set up)
2013-03-28 15:29:11 +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 48d78b71f6 Rename validation hooks
Name should be "beforeValidate" and "afterValidate"
to be consistent with other hook hames. This change doesnt break
backward compatibility
2013-03-28 15:23:31 +04:00
Anatoliy Chakkaev e75029ebbf Fix memory adapter and test 2013-03-27 17:10:13 +04:00
Anatoliy Chakkaev 2749a1f7e0 Fixes in belongsTo relation definition syntax 2013-03-27 04:48:26 +04:00
Anatoliy Chakkaev cba87ce339 Query testing: findOne 2013-03-27 00:50:13 +04:00
Anatoliy Chakkaev de28603460 Added short syntax for belongsTo 2013-03-27 00:48:14 +04:00
Anatoliy Chakkaev 58e2349575 Fix memory adapter to support lowercase desc order 2013-03-26 23:33:40 +04:00
Anatoliy Chakkaev d5d07d8806 Make tests importable 2013-03-26 04:41:00 +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
Anatoliy Chakkaev b59fb01b4a Upd memory adapter to work with undefined in dataset 2013-03-25 01:28:08 +04:00
Anatoliy Chakkaev 2fa07e8e1d Rename essentials 2013-03-25 01:27:36 +04:00
Anatoliy Chakkaev 5ea5da0153 Rewrite hooks API
This commit breaks compatibility, but adds consistent API and allow modify data of update
2013-03-25 01:25:10 +04:00
Anatoliy Chakkaev e0b52c6b7e Settings always set 2013-03-23 22:49:34 +04:00
Anatoliy Chakkaev a90fe8da41 Merge branch 'master' of github1602:1602/jugglingdb 2013-03-19 14:19:39 +04:00
Anatoliy Chakkaev ccffd10a58 Added filter, fix [] as type 2013-03-18 23:45:34 +04:00
Scott Nonnenberg bf3234b9f0 http adapter: pre/postProcess, fix destroy and all
preProcess() ensures that null fields are excluded from the wire. I've experienced jQuery/node/express 3.0 turning nulls into empty strings.

postProcess() ensures that Date fields are actually turned back into dates. JSON, you're annoying sometimes.

destroy() is now implemented.

all() now URL encodes any query filters provided.
2013-03-06 18:05:30 -08:00
dgsan 0503ad3295 This is the smash with blunt object fix for #215, since the more flexible #213 was rejected.
There needs to be something done so that types not in `BASE_TYPES` can be parsed without
throwing an exception and making things go nuts when they aren't JSON.

As noted this is the blunt object solution and will not cover all cases, but something needs to be done.
2013-03-05 12:02:07 -07:00
Anatoliy Chakkaev 358f7b788c FIxes in async validations (in sync case), closes 214 2013-03-01 21:13:04 +07:00
Anatoliy Chakkaev 35571dcd58 Add proper type registration 2013-02-22 01:24:20 +07:00
Anatoliy Chakkaev 56db693454 List support for non-object values 2013-02-19 16:33:09 +08:00
Anatoliy Chakkaev 4d75cb74d7 Add some array methods for List 2013-02-18 16:18:09 +08:00
Anatoliy Chakkaev a4ec751424 Eliminated global leak 2013-02-12 17:25:59 +08:00
Anatoliy Chakkaev 4eda7df7bc Described custom validations 2013-02-12 17:05:04 +08:00
Anatoliy Chakkaev 734ab8abd1 If property is array (List) need to convert it to JSON 2013-02-10 04:53:05 +08:00
dgsan cba174b4ff This fixes the apparent scope and comparison issues when calling a foreign key relation. 2013-02-01 10:15:03 -07:00
Anatoliy Chakkaev cdd328c902 Revert validatable fix 2013-01-30 23:08:52 +07:00
Anatoliy Chakkaev 9f0dfeb58a Add attr param to custom validator, closes #200 2013-01-30 22:30:31 +07:00
Anatoliy Chakkaev 5b33c2a0f1 Removed unused experimental stuff 2013-01-29 18:47:03 +07:00
Anatoliy Chakkaev 707fb01713 Make pathTo available in db/schema 2013-01-23 06:31:02 +07:00
Anatoliy Chakkaev 59e80e8454 Fix uniqueness validation (mongo ids) 2013-01-23 03:22:48 +07:00
Anatoliy Chakkaev d03dbfcb99 Throw error when model is not configured for webservice 2013-01-23 03:22:31 +07:00
Anatoliy Chakkaev cefd79dbf6 Return null when findOne could not find record, closes #128 2013-01-22 23:47:14 +07:00
Anatoliy Chakkaev 8cfa00a1b2 Work with cs-compound 2013-01-22 23:27:49 +07:00
Anatoliy Chakkaev 0f592d4bf5 Implement schema.extendModel, closes #157 2013-01-22 01:48:04 +07:00
Anatoliy Chakkaev 91fee1d565 Make memory adapter async 2013-01-22 01:21:43 +07:00
Anatoliy Chakkaev 9dbc8fa50b Implement findOrCreate, requested in #190 2013-01-22 01:21:31 +07:00
Anatoliy Chakkaev 4d47d8348d Revert hasMany change 2013-01-21 23:08:13 +07:00
Anatoliy Chakkaev 1010d5d64d Merge pull request #192 from robblovell/hasmany
Hasmany
2013-01-21 07:42:01 -08:00
Anatoliy Chakkaev d5758ec8be Added schema::model::set for railway 2013-01-21 20:29:41 +07:00
Anatoliy Chakkaev 02b7f707ff Added http (WebService) adapter 2013-01-20 23:05:45 +07:00
Anatoliy Chakkaev e9b7e89ee9 Accept adapter as first argument of Schema constructor 2013-01-19 20:50:53 +07:00
Erin Noe-Payne d4043d715f fix lost callback 2013-01-18 12:31:49 -05:00
Robb Lovell 6f9c495720 added 'all' method to hasMany in abstract-class.js to correctly support a 'many' collection. added .idea to .gitignore to ignore WebStorm projects. 2013-01-17 11:16:52 -08:00
Asp3ctus 4f7ffb903e fix typo :) 2013-01-08 15:37:58 +06:00
Asp3ctus c78a4de375 app.enable('autoupdate') option support 2013-01-08 15:34:59 +06:00
Anatoliy Chakkaev c7409be559 Fix for reading yml files 2012-12-24 22:17:23 +04:00
Anatoliy Chakkaev e8ef71c431 Only update id if it does not present in resulting dataset 2012-12-24 00:31:32 +04:00
Anatoliy Chakkaev 05a6d686aa Strict adapter checking 2012-12-21 18:26:21 +04:00
Anatoliy Chakkaev 3dc24b8f51 Merge branch 'master' of github.com:1602/jugglingdb 2012-12-21 12:56:45 +04:00
Anatoliy Chakkaev 3038eb33fd Do not throw on missing adapter, just display warning 2012-12-21 12:56:16 +04:00
Sascha Gehlich 7ec8ab55d1 updateAttributes data defaults to {} 2012-12-19 19:29:14 +01:00
Anatoliy Chakkaev 0d433c1c5d merge 2012-12-19 19:00:00 +04:00
Anatoliy Chakkaev acc0a71bde Update railwayjs name, add ability to skip tests 2012-12-19 18:57:21 +04:00
Anatoliy Chakkaev 3c4fd78014 Merge pull request #177 from saschagehlich/js_config
allow database.js config
2012-12-17 01:30:21 -08:00
Sascha Gehlich 252a067df7 allow database.js config 2012-12-17 10:25:27 +01:00
Sébastien Drouyer 519d6cf7fb Merge github.com:1602/jugglingdb 2012-12-16 23:58:53 +01:00
Sébastien Drouyer fbe04233cc added some documentation for include and all function 2012-12-16 19:44:14 +01:00
Sébastien Drouyer 6db1a003d4 cleaned some old comments 2012-12-16 19:19:53 +01:00
Anatoliy Chakkaev bc250b1bb2 Merge pull request #169 from saschagehlich/schema_wait_connect
let the adapter decide when to load the schema
2012-12-16 10:10:04 -08:00
Sébastien Drouyer 708265df22 merged + removed preprocessdata callback as it seems it isn't usefull 2012-12-16 18:58:52 +01:00
Sébastien Drouyer 175ad3141d small fix on relations 2012-12-16 18:20:39 +01:00
Sébastien Drouyer c6bddf170a added include functionnality to abstract class and mysql 2012-12-16 18:05:36 +01:00
Sascha Gehlich 53e2dcf30b add additional types stored in Schema.types to schema context 2012-12-16 14:29:53 +01:00
Sascha Gehlich ed8ff0ca36 let the adapter decide when to load the schema 2012-12-16 14:08:51 +01:00
Anatoliy Chakkaev 5208298a67 Fix broken yml config, closes #159 2012-12-15 16:05:32 +04:00
Sébastien Drouyer 24ccb0ffc2 added relations key 2012-12-14 16:28:29 +01:00
Anatoliy Chakkaev 100b5322c6 Remove sql adapters and tests 2012-12-14 19:25:32 +04:00
Anatoliy Chakkaev 91c90ef3ad Remove sqlite3 adapter 2012-12-14 17:12:13 +04:00
Anatoliy Chakkaev a62aab180d Removed nosql adapters (moved to own repos) 2012-12-14 01:50:02 +04:00
Tim Griesser fe4f19106a allow socketPath for mysql config 2012-12-12 15:16:23 -05:00
Anatoliy Chakkaev 91cde064a6 Merge branch 'master' of github.com:1602/jugglingdb 2012-12-10 17:48:55 +04:00
Anatoliy Chakkaev f929272fa3 Fix cradle+railwayjs 2012-12-10 17:48:22 +04:00
Nicholas Westlake 85535dc955 added nano adapter 2012-12-09 03:13:09 -06:00
Dominik Krejcik 035c42eb9d Log Redis connection errors instead of crashing 2012-11-29 01:33:19 +00:00
Anatoliy Chakkaev c252926f34 Docs and style in lib/list 2012-11-20 18:37:04 +07:00
Anatoliy Chakkaev b3ce33805c Namespace adapters 2012-11-14 11:29:29 +07:00
Muneeb Samuels fa50e0e5e8 when using cradle if we don't wait for the schema to be connected, the models fails to load correctly. 2012-11-10 20:14:13 +02:00
Anatoliy Chakkaev cb9f0c3d16 Better docs, no warning 2012-11-10 09:28:07 +04:00
Nathan Cartwright 596cd3d461 update mongodb adapter 2012-11-08 14:54:36 -06:00
Anatoliy Chakkaev 3731447787 Merge branch 'master' of github.com:1602/jugglingdb 2012-11-06 19:53:04 +04:00
Anatoliy Chakkaev 47d72ce14e Cast id to string before creation, fix #145 2012-11-06 19:52:37 +04:00
Anatoliy Chakkaev fb075fdd97 Merge pull request #144 from muneebs/master
update cradle.js
2012-11-05 09:09:39 -08:00
taiyoh 30e9983abf remove commentouted source 2012-11-05 22:30:57 +09:00
taiyoh 885e9188f8 fixed type check strictly 2012-11-05 22:22:47 +09:00
Anatoliy Chakkaev e10c42ed1b Fix id:null issue #98 2012-11-05 08:08:32 +04:00
Muneeb Samuels 75c96bdaa9 - fixed typo in updateOrCreate method. 2012-11-04 22:24:15 +02:00
Muneeb Samuels d248de7f9d - added views to do .all queries, it speeds up the query. 2012-11-04 22:22:00 +02:00
Muneeb Samuels 53272e6fd6 Merge remote-tracking branch 'origin/master'
Conflicts:
	lib/adapters/cradle.js
2012-11-04 21:30:42 +02:00
Muneeb Samuels a3f30a112a - fixed typo in updateOrCreate method.
- added views to do .all queries, it speeds up the query.
2012-11-04 21:30:08 +02:00
Anatoliy Chakkaev 0c24dfa035 Merge pull request #141 from sdrdis/master
Added caching in relationships (+ test cases) (enhanced)
2012-11-02 19:20:09 -07:00
Sébastien Drouyer 8f41fdf90d fixed indentation + adapted to markdown syntax 2012-11-03 02:05:27 +01:00
Sébastien Drouyer 5aa0efd818 corrected indentation issues 2012-11-03 01:56:53 +01:00
Sébastien Drouyer fe8ed86301 small sentence fixes + added usage examples in belongsTo comments 2012-11-03 01:39:35 +01:00
Sébastien Drouyer 46b7747c87 fixed and enhanced caching in getters and setters in abstract-class 2012-11-01 01:13:16 +01:00
Muneeb Samuels 6f973f9fa5 cradle adapter update
using views speeds up the query by only fetching the documents for the model being queried.
2012-10-31 01:34:39 +02:00
Muneeb Samuels 2cc1896864 using views speeds up the query by only fetching the documents for the model being queried. 2012-10-31 01:30:55 +02:00
Anatoliy Chakkaev 83695513f9 Globally published models for railway 1.0 2012-10-30 03:41:45 +04:00
Sébastien Drouyer 0633737ac7 added caching functionnality 2012-10-30 00:37:19 +01:00
Anatoliy Chakkaev e0f5f18774 Models publishing for both railway stable and unstable 2012-10-29 22:22:40 +04:00
Anatoliy Chakkaev f7aed3a814 Fix railway 1.0 support 2012-10-29 18:11:43 +04:00
Anatoliy Chakkaev 8cee0ec9b2 Merge pull request #137 from sdrdis/master
Enhanced inq and nin for mysql and postgres and added test cases
2012-10-28 18:06:54 -07:00
Anatoliy Chakkaev ae193c9064 Merge branch 'master' of github.com:1602/jugglingdb 2012-10-29 04:05:26 +04:00
Anatoliy Chakkaev c8322eea31 Fix instanceof checking 2012-10-29 04:05:05 +04:00
Anatoliy Chakkaev 8b4da9e5e9 Remove globals, read yaml 2012-10-29 03:21:51 +04:00
Sébastien Drouyer fc46de162f generalize escape on IN and NOT IN values 2012-10-27 20:48:21 +02:00
Sébastien Drouyer d5b0003350 Fixed postgres adapter for IN and NIN when values are strings and where there is 0 value 2012-10-27 20:47:25 +02:00
Sébastien Drouyer f17716272c Fixed IN and NOT IN when searching on strings 2012-10-27 20:00:40 +02:00
Sébastien Drouyer ad0ea2602f Fixed bug for IN on NOT IN - corrected
When length of values for IN and NOT IN is 0, it causes an SQL error: "IN ()" and "NOT IN ()" doesn't work in MySQL.

I corrected my first pull request :
https://github.com/1602/jugglingdb/pull/135
2012-10-24 00:28:28 +03:00
Anatoliy Chakkaev c27a624d02 Fix inheritance 2012-10-22 17:33:57 +04:00
Anatoliy Chakkaev e6be50eb81 Fix broken mysql adapter after merging pull request 2012-10-22 00:43:00 +04:00
Anatoliy Chakkaev ee6c2bff21 Merge pull request #133 from sdrdis/patch-1
Fixed bug (oversight ?) on alter table
2012-10-21 13:17:48 -07:00
Anatoliy Chakkaev c8f6d416a6 Remove unused cached relations, closes #134 2012-10-22 00:14:05 +04:00
Sébastien Drouyer d1bb0126e3 Fixed bug (oversight ?) on alter table
Fixed bug (oversight ?) on alter table : it was still model name.
2012-10-21 01:51:30 +03:00
Muneeb Samuels 0203d52728 Update lib/adapters/cradle.js
fixed an issue where if no filters were passed in, the .all query would throw an exception
2012-10-19 23:49:01 +03:00
Muneeb Samuels 03f9c24642 limit + skip
Added filter limit + filter skip for query .all
2012-10-19 01:27:02 +03:00
Anatoliy Chakkaev 4fe9759afc Fix typo, start new release preview 2012-10-16 13:12:34 +04:00
Anatoliy Chakkaev 575a29d4af Print properly formatted object 2012-10-16 03:15:29 +04:00
Anatoliy Chakkaev 96e9079977 Remove lazy collections, remove unused caching stuff, unsupport node 0.4 (travis) 2012-10-16 02:22:40 +04:00
Anatoliy Chakkaev dbb39bf43e Further optimizations: remove hasOwnProperty backward compat 2012-10-16 01:29:30 +04:00
Anatoliy Chakkaev f6d8b08631 Proper collection caching 2012-10-14 15:02:13 +04:00
Anatoliy Chakkaev f59cf0ddbf Specify collection length 2012-10-13 19:19:53 +04:00
Anatoliy Chakkaev a31a10a5ae Merge branch 'master' of github.com:1602/jugglingdb 2012-10-13 18:26:15 +04:00
Anatoliy Chakkaev 488bc68e05 Optimize collection 2012-10-13 18:25:50 +04:00
Anatoliy Chakkaev 1ec419aa42 Better performance on big datasets read 2012-10-13 17:59:25 +04:00
Mikko Lehtinen 075699ee27 Fix for redis adapter when finding records filtered with multiple attributes 2012-10-09 21:19:38 +03:00
Anatoliy Chakkaev 01b9307e1c Better safeRequire 2012-10-07 14:54:20 +04:00
clarktlaugh f3bafd7bf9 Update lib/adapters/postgres.js
fix to add quotes around key so that it works for mixed-case correctly
2012-09-29 20:35:39 -05:00
Anatoliy Chakkaev 451000806d Merge mongoose multisort 2012-09-27 11:24:20 +04:00
Anatoliy Chakkaev b6cecc4b78 Added cradle adapter 2012-09-26 09:18:43 +04:00
Anatoliy Chakkaev ab4844b009 Merge pull request #95 from dombesz/master
Bug on initializing models with empty number property on postgresql.
2012-09-25 21:19:56 -07:00
Anatoliy Chakkaev 2cbce0d843 Merge pull request #125 from nashadalam/patch-1
Mongoose Adapter Single Index support
2012-09-25 21:10:16 -07:00
Anatoliy Chakkaev 46e65b7e63 Update mysql to 2.0 2012-09-26 08:08:27 +04:00
Anatoliy Chakkaev 8cd1ec2e9e Fix redis2 indexes cleanup 2012-09-25 08:39:23 +04:00
Anatoliy Chakkaev cca1cbb3f8 Not strict equal when matching ids in embedded lists 2012-09-20 16:02:48 +04:00
Nashad Alam 45e1df09db Mongoose Adapter Single Index support-Spacing Fix 2012-09-20 14:22:36 +10:00
Nashad Alam 768ba2c677 Mongoose Adapter Single Index support 2012-09-20 14:13:07 +10:00
Matt Huggins c3dd47f448 Allow for IN, NOT IN, and != queries in postgres 2012-09-13 20:15:46 -04:00
Anatoliy Chakkaev 26905651a1 Fix standard_conforming_strings for postgres 2012-09-13 23:35:11 +04:00
Mikxail 2baabb624f Update lib/adapters/memory.js
Multiple sorting with full support asc/desc
2012-09-12 15:26:20 +04:00
Anatoliy Chakkaev ffbc9482f7 Make property configurable to pass tests 2012-09-11 23:53:19 +04:00
Anatoliy Chakkaev c8b8012e28 List API improvements 2012-09-11 23:22:55 +04:00
Anatoliy Chakkaev e0f5f45b05 List improvements 2012-09-11 20:51:31 +04:00
Anatoliy Chakkaev c3af8b2aea Fix postgres 2012-09-10 19:59:06 +04:00
Anatoliy Chakkaev b481e4c096 Merge branch 'master' of github.com:1602/jugglingdb 2012-09-10 19:57:40 +04:00
Anatoliy Chakkaev e938a814e8 Added typed lists support 2012-09-10 19:57:21 +04:00
Sam Taylor c118786cea fix global leak in postgres adapter 2012-09-09 17:00:46 +01:00
Anatoliy Chakkaev e39691763f Revert sort-only indexes 2012-09-09 19:54:33 +04:00
Anatoliy Chakkaev dee112a35c Redis sort-only indexes 2012-09-09 19:30:01 +04:00
Anatoliy Chakkaev 562856f1bd Fix in-memory adapter tests 2012-09-09 17:17:08 +04:00
Anatoliy Chakkaev a2618dd3a2 Fix typo, tune redis2 2012-09-09 16:51:53 +04:00
Anatoliy Chakkaev 44591111b6 Rewritten redis 2012-09-08 17:03:49 +04:00
Anatoliy Chakkaev 7b8321b3e4 Refactored and optimized redis adapter 2012-09-08 16:57:57 +04:00
Anatoliy Chakkaev d962a22063 Fix postgres offset feature 2012-09-04 17:33:15 +04:00
Anatoliy Chakkaev 5a65b4f1c2 Merge branch 'master' of github.com:1602/jugglingdb 2012-09-04 17:24:18 +04:00
Anatoliy Chakkaev 2aede39246 Bump 0.1.14. Fix typo in redis adapter 2012-09-04 17:23:57 +04:00
Anatoliy Chakkaev 562d06b83f Merge pull request #93 from mhuggins/pg-offset
Fix PostgreSQL query offset (issue #83)
2012-08-31 03:42:59 -07:00
Anatoliy Chakkaev 028049f8b2 Callback called only once + database selection 2012-08-28 13:59:40 +04:00
Anatoliy Chakkaev a3963485f5 Merge branch 'master' of github.com:1602/jugglingdb 2012-08-24 12:22:22 +04:00
Anatoliy Chakkaev e46716f9d2 Changed validatable inheritance, fixed issue with belongsTo #113 2012-08-24 12:22:02 +04:00
Anatoliy Chakkaev 60fad51623 Merge pull request #111 from mypark/master
fixes to make sure callback was called on the all method and to get neo4j adapter working with railway
2012-08-23 15:44:45 -07:00
Anatoliy Chakkaev 3faaa56450 More information about alter in isActual 2012-08-20 11:01:08 +04:00
Anatoliy Chakkaev cc40d15082 Fix autoupdate for mysql
;
2012-08-20 00:44:15 +04:00
Anatoliy Chakkaev 12eadb80ae Autoupdate multicolumn indexes 2012-08-19 19:40:21 +04:00
Mike P 94fb10d560 I put the delete in the wrong line, moved down.. 2012-08-18 12:42:43 -03:00
Mike P 3ca47526e5 re-adding fix to not save id as a property on update 2012-08-18 12:40:58 -03:00
Mike P df798791fa Update lib/adapters/neo4j.js
removing the change to delete the id property in the cleanup since that fails the unit test
2012-08-18 11:47:15 -03:00
Mike P 53831da913 Update lib/adapters/neo4j.js
don't save an id property on update since there is already a node id from neo4j
2012-08-18 11:24:12 -03:00
Mike P 7003a3e8c7 Update lib/abstract-class.js
make sure that callback is called when there are no records or data in the all method
2012-08-18 11:22:00 -03:00
Anatoliy Chakkaev 62d0e459c0 Single-column indexes in mysql (autoupdate) 2012-08-17 23:39:22 +04:00
Anatoliy Chakkaev 62178c26c9 Unnecessary error on mongodb authentication. Skip checking 2012-08-17 22:48:14 +04:00
Anatoliy Chakkaev d2d602117f Merge pull request #110 from imothee/mongodb-replicaset
Mongodb native driver replicaset and authentication
2012-08-16 23:33:42 -07:00
Anatoliy Chakkaev cfda58f710 Fix typo, bump version 2012-08-17 00:32:04 +04:00
Anatoliy Chakkaev d11293dc94 Provide additional info about collection 2012-08-16 14:21:46 +04:00
Anatoliy Chakkaev 7b7fa8a0ed Move to latest mongoose / fix api 2012-08-14 19:12:42 +04:00
Timothy Marks 59ba68494d Adds replica-set support to the mongodb native driver.
Adds replica set support through .rs property for replica set name and
accepts similar url for replica set definition to mongoose.js driver.
2012-08-15 00:23:23 +10:00
Timothy Marks eaa2f026b0 Adds authenticate to db.open if a username and password are set. 2012-08-14 22:31:49 +10:00
Anatoliy Chakkaev a54961923d Update postgres 2012-08-13 10:27:18 +04:00
Anatoliy Chakkaev 134799763c Merge branch 'mongodb-driver' of https://github.com/imothee/jugglingdb 2012-08-13 10:16:22 +04:00
Anatoliy Chakkaev efdc4548fc JSON in tests, Schema.JSON published 2012-08-13 10:16:01 +04:00
Timothy Marks 2fb97e2c59 Adds Replica Set Support to JugglingDB Mongoose Adapter 2012-08-11 17:06:26 +10:00
Timothy Marks a565dbbd12 Fixes issue where only id would be saved when updating an existing object for mongodb driver.
.save instead of .update was being called which would persist only a
data object with the id value to the database on doing a save of an
existing object.
2012-07-28 22:37:48 +10:00
Dombi Attila b5eaa99d5a Added stricter value checking on number. 2012-07-19 18:26:58 +03:00
Anatoliy Chakkaev 752e711bca Merge pull request #103 from Katoka/master
Modified my previous pull requests commit
2012-07-14 05:11:06 -07:00
Taner Topal 3f0a3f526b modified destroyAll 2012-07-13 15:53:22 +02:00
Jude Lam 913f9d4fc1 Added fix to the abstract-class.js file for issue #72. The fix is resolved by by5739. 2012-07-08 21:20:11 -04:00
Anatoliy Chakkaev 7a2e300181 Allow relative driver paths, adopt for node 0.8 2012-07-02 15:59:44 +04:00
Dombi Attila e4527856ad The updateAttribute callback doesn't behaves as its described. It should send the object instance alongside the error too. 2012-06-26 15:44:57 +03:00
Anatoliy Chakkaev 11fc70b89a Merge branch 'master' of github.com:1602/jugglingdb 2012-06-25 14:13:38 +04:00
Anatoliy Chakkaev 66fd977fd4 Wrap database name with quotes 2012-06-25 14:13:08 +04:00
Dombi Attila e1bd92b52a fix sql error when initializing models with empty Number property. It should return NULL when a number is empty 2012-06-19 13:13:59 +03:00
Matt Huggins f3abbf13b6 Fix PostgreSQL query offset 2012-06-10 19:10:18 -04:00
Aurélien Thieriot d333fe1d30 First version of a cradle adapter 2012-06-10 16:51:56 +02:00
Wizek 518a324912 https://groups.google.com/d/msg/railwayjs/4YWICL6EAOg/ebCxGkQ5eQcJ 2012-06-06 02:21:39 +03:00
Anatoliy Chakkaev 418cc03a27 Adopt postgres stuff 2012-06-02 22:33:29 +04:00
Anatoliy Chakkaev 40c9923053 Coverage added to gitignore 2012-05-29 15:16:24 +04:00
Jonathan Spies 75f9373ae5 added custom collection name to mongoose 2012-05-17 22:13:29 -05:00
Joseph Junker 3dcdb1e911 heavily modified sections of postgres adapter, postgres is now passing all tests 2012-05-16 14:39:43 -07:00
Jonathan Spies 3179c05b95 added multiple sort for mongoose 2012-05-13 23:28:37 -05:00
Anatoliy Chakkaev 8e312bfe61 Merge pull request #77 from bitmage/master
Postgres - Minor Fix
2012-05-05 04:27:00 -07:00
Rob Scott 5f0514a37c Fixes mysql adapter 'neq' condition. 2012-05-04 15:19:59 -03:00
bitmage 64cfb9ee01 added double quotes to field names 2012-05-03 10:28:08 -07:00
Anatoliy Chakkaev 2b67400525 Support modular railway 2012-05-03 02:15:09 +04:00
Anatoliy Chakkaev 7d748e9c02 Upsert with setters 2012-04-19 20:06:38 +04:00
Anatoliy Chakkaev 16a1c21d9c Fix sql adapters 2012-04-19 19:20:10 +04:00
Anatoliy Chakkaev 222b457b3f Setters enabled in new and create 2012-04-19 19:01:40 +04:00
Anatoliy Chakkaev 02138b8965 Merge branch 'master' of github.com:1602/jugglingdb 2012-04-19 03:21:14 +04:00
Anatoliy Chakkaev 1b83266fd6 Jslinize if blocks, not strict equal for ids on uniqueness checking 2012-04-19 03:20:44 +04:00
Henri Bergius 6a777c00ac Prevent data from leaking to global 2012-04-13 18:58:23 +02:00
Anatoliy Chakkaev 221c3d4c83 Merge branch 'master' of github.com:1602/jugglingdb 2012-04-11 23:39:35 +04:00
Anatoliy Chakkaev 881a5b49fc Fix mongoose adapter find 2012-04-11 23:39:11 +04:00
Anatoliy Chakkaev 2ce44db4ba Tune propertyChanged behavior 2012-04-11 23:31:10 +04:00
Kelvin Wong f16d0573c5 Fix 'undefined is not a function' problem at postgres adapter 2012-04-12 01:51:55 +08:00
Anatoliy Chakkaev 6c0ac6df16 Merge branch 'master' of github.com:1602/jugglingdb 2012-04-11 19:37:53 +04:00
Anatoliy Chakkaev df57805b94 Turn off caching 2012-04-11 19:36:10 +04:00
Henri Bergius d7cc8b2d51 Some safeties to URL handling 2012-04-10 16:30:55 +02:00
Henri Bergius 24e051b1e9 Enable setting up Redis with URL 2012-04-10 15:47:11 +02:00