Commit Graph

8 Commits

Author SHA1 Message Date
shimks 1e59918c11 Add EventEmitter type info to DataSource type 2018-07-25 15:13:54 -04:00
Raymond Feng 535b000195 fix: update TypeScript declaration for KV 2018-07-16 10:11:54 -07:00
Miroslav Bajtoš 6f3675b13c
fixup! address code review comments 2018-06-29 08:35:22 +02:00
Miroslav Bajtoš 548379ca2a
Fix type definitions for PersistedModel API
Callback's first argument is an optional Error now. Was: required `any`.

PersistedModel methods return `PersistedModel` now. Before this change,
methods were returning `PersistedData` (`PersistedModel | AnyObject`).
The problem with `AnyObject` is that it does not contain any
`PersistedModel` instance data and cannot be assigned to functions
expecting `Partial<PersistedModel>`. As a result, consumers of this API
were forced to either cast the result to `PersistedModel` (which feels
wrong) or deal with the `AnyObject` case (which never happen at
runtime).

Fix definition of `ModelData<T>` to `T | Partial<T>`. Before this
change, `ModelData` allowed any values not related to the actual
model at all, for example arrays.
2018-06-28 13:09:47 +02:00
Raymond Feng 5a66f9ad72 Fix datasource state management
Use case:
1. Configure a datasource with lazyConnect = true
2. Do NOT start the DB
3. Start the app
4. Send first request and it fails to connnect to the DB
5. Start the DB
5. Requests are now served correctly
2018-05-22 10:46:45 -07:00
Raymond Feng d31c43bc09 Remove node ref 2018-05-11 09:09:31 -07:00
Raymond Feng 63f8b3b323 Fix typescript definitions to be compatible with LB4 2018-05-10 10:19:15 -07:00
Raymond Feng 77a2c9ab3b Add typescript type definitions 2018-05-09 12:47:27 -07:00