Commit Graph

211 Commits

Author SHA1 Message Date
Amir Jafarian 4ce5b5d3a0 Support for globalization 2016-07-28 15:20:18 -04:00
gunjpan 8076be2db1 Remove DataSource.registerType()
Result of compat flag cleanup.
- Current implementation has a wrapper
DataSource.registerType() for
ModelBuilder.registerType(). This removes
the wrapper to encourage use of original
method
2016-06-28 14:45:42 -04:00
Ritchie Martori 293a22fd31 Update datasource.js
Return a real `Error` message for the default `ping()` method.
2016-06-02 14:02:06 -07:00
Raymond Feng daaf5e381a Merge branch 'discover-hang' of https://github.com/TorchlightSoftware/loopback-datasource-juggler into TorchlightSoftware-discover-hang
# Conflicts:
#	lib/datasource.js
#	test/discovery.test.js
2016-04-05 16:18:25 -07:00
Miroslav Bajtoš 27c6279d6c fix remaining eslint issues 2016-04-05 15:25:34 +02:00
Miroslav Bajtoš 39e04a1756 eslint --fix 2016-04-05 15:25:34 +02:00
Ryan Graham c467b43c38 Insert copyright headers 2016-04-04 18:14:03 -07:00
bitmage 57afba8c51 support custom field settings under the connector's namespace 2016-03-16 09:17:55 -07:00
gunjpan 6db59cba6f Update error message for missing connector 2016-03-15 17:01:37 -04:00
Miroslav Bajtoš 9dcf30efe9 Improve error message on connector init error 2016-02-26 14:00:24 +01:00
Candy 686ce5bae3 Fix missing connector error msg for db2, cloudant 2016-02-09 16:19:57 -05:00
bitmage b556d96148 discoverSchemas returns an error when modelName is not found,
discoverSchema forwards that error and does not hang when no columns,
no errors are returned
2016-01-22 10:41:06 -07:00
Raymond Feng 486c1de1ba Merge pull request #715 from nennad/master
foreignKey dataLength fix
2015-11-26 09:28:08 -08:00
nennad e679deb376 typo fix 2015-09-03 17:02:21 +01:00
nennad f3b0cb062e Fix foreignKey length issue
If the PK has a definition like
```
      "mysql": {
        "dataType": "CHAR",
        "dataLength":36,
        "nullable":"N"
      }
```

dataLength is ignored when the PK is used as a foreignKey in other models
2015-09-03 17:00:38 +01:00
sklyukin 483cd873e7 primaryKey to hasOne relation 2015-09-01 01:31:28 +05:00
Raymond Feng 21c0067462 Report deferred exceptions via callback 2015-08-05 11:18:38 -07:00
Pradnya Baviskar c63f3fb6cb Promisify all 'discover' methods 2015-07-24 12:07:22 +05:30
Raymond Feng 6eb18cb2f6 Make sure base property definitions are cloned
Sub models sometimes need to customize the properties from the base model.
This change allows each sub model has its own copy of the base property
definition to avoid potential conflicts across multiple sub models of the
same base.
2015-07-10 10:03:51 -07:00
Pradnya Baviskar e7430184a9 Promisify 'autoupdate' 2015-06-23 18:02:08 +05:30
Pradnya Baviskar f4f13a6626 Promisify 'automigrate' 2015-06-16 12:58:21 +05:30
Raymond Feng 506223885d Mix in observer apis to the connector 2015-05-20 15:02:44 -07:00
crandmck d19001a56e Updated JSdoc for Datasource constructor 2015-05-14 15:53:34 -07:00
Raymond Feng 1e70678fa7 Allow custom name mapping for discovered models 2015-04-22 08:42:47 -07:00
didikeke 3644b85432 fix foreign key dataType bug 2015-03-11 11:30:40 +08:00
Andrey Loukhnov e68ecb461a Create model foreign key matching type of opposite part of relation (even if it has a custom field type) 2015-02-03 13:13:00 +03:00
Rand McKinney 2270ba4db4 Update datasource.js
Small fix to JSdoc
2015-01-08 15:30:17 -08:00
Raymond Feng 6914733a41 Allow more flavors of nullable values from DB discovery 2014-12-03 15:11:27 -08:00
Raymond Feng 455743167a Fix the automigrate issue
See https://github.com/strongloop/loopback-example-relations-basic/issues/6
2014-10-16 12:04:16 -07:00
Raymond Feng fe74c8019c Tidy up model building from data sources
See https://github.com/strongloop/loopback/issues/560
2014-09-12 14:25:35 -07:00
Fabien Franzen aebf5e9e6b Enforce id (prevent user-set value), fix isNewRecord 2014-09-05 16:35:01 +02:00
Clark Wang 4b70f2498f Fix options for hasManyThrough doesn't apply
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 23:59:52 +08:00
Clark Wang d43044c766 fix polymorphicName var scope
see https://github.com/strongloop/loopback-datasource-juggler/issues/271

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-08-31 19:57:37 +08:00
Raymond Feng 32313c1df9 Make sure timeout handle is cleared 2014-08-27 09:42:16 -07:00
Raymond Feng fde5b426e4 Make sure error events are emitted by data source 2014-08-27 09:14:17 -07:00
Raymond Feng 3875c561e0 Add ping() to test connections 2014-08-20 16:31:23 -07:00
Fabien Franzen 315d5c15c6 Tiny fix: obsolete i8n require 2014-08-16 11:07:48 +02:00
Fabien Franzen ad780604e1 Properly handle LDL for polymorphic relations 2014-08-16 11:03:16 +02:00
Fabien Franzen a243d05880 Enable DL definition of embedsMany + referencesMany 2014-08-14 20:12:16 +02:00
Raymond Feng c53dc74d16 Fix a name conflict in scope metadata 2014-08-08 15:52:30 -07: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
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
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
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 ae9c7f8cac Fix the error message 2014-07-14 08:56:33 -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 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
crandmck c355c99cbd More JSDoc cleanup 2014-06-10 14:27:58 -07:00
Rand McKinney 04e1256b8b Update datasource.js
Fix small typo
2014-06-04 17:44:57 -07:00
Rand McKinney 653aab856c JSDoc improvements
Improve createModel doc, Fix some other minor issues.
2014-05-29 15:33:01 -07:00
Rand McKinney a765ea31ab Correct JSDoc for discoverModelDefinitions 2014-05-06 14:18:10 -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 1dc0c34252 Fix the connector resolver to make sure known connectors are used 2014-03-17 08:32:37 -07:00
crandmck 9c2098cd35 Updates to JSDoc comments for API doc 2014-03-12 16:28:46 -07:00
Raymond Feng d14c58775d Use debug module for logging 2014-03-04 09:42:55 -08:00
Raymond Feng 24c4381221 Allows scopes to be defined in LDL 2014-03-03 17:16:37 -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 38c7a16da2 Override existing methods when mixing in DAO methods 2014-02-19 17:10:56 -08:00
Raymond Feng 12a624d99c Rewrite the List class for typed array 2014-02-14 10:41:00 -08:00
Raymond Feng 85232f31b3 Clean up the options for model constructor 2014-02-10 22:38:59 -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 2b8c1ebaee Reformat the code 2014-01-24 09:09:53 -08:00
Raymond Feng c374cc89cd Use the primary key type for the generated foreign key 2014-01-21 09:47:32 -08: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 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 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 a953ba13de Clone shared methods so that they can be customized per model 2013-12-03 21:14:12 -08:00
Raymond Feng 8d9d73efff Add properties/methods to DataSource from ModelBuilder 2013-11-20 10:56:48 -08:00
Raymond Feng 2bcdea76f5 Fix the model attachment to data source 2013-11-19 10:49:54 -08:00
Raymond Feng 995a2139c8 Rename association to relation 2013-11-15 20:29:20 -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 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 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 dff3367f3a Fix the regression when 1st arg is the connector module 2013-10-29 13:04:23 -07:00
Raymond Feng f3011216b5 Support datasource/connector configuration using URL string 2013-10-25 16:18:02 -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 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
Raymond Feng b8f94f5777 Make sure foreign key properties are fully registered 2013-10-07 18:01:31 -07:00
Raymond Feng 2a15bb917a Fix the foreign key definition 2013-10-04 15:49:13 -07:00
Raymond Feng 1ae9478496 Fix the columnName 2013-10-03 14:49:03 -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 bf223320ea Allow connector to report failure during initialization 2013-09-12 13:32:53 -07:00
Raymond Feng 6f111f8122 Allows custom name of the id property for the memory connector 2013-08-27 22:32:01 -07:00