19 Commits

Author SHA1 Message Date
a8d603dd59 Refactor store to accept state as part of params
The old code was returning a fn because TypeScript could not figure out
generic type parameters when params was an object like:

    interface Params<State> {
      a: Reducer<State>
      b: Partial<State>
    }

    function test<State>(params: Params<State>) {
      // ...
    }
2019-09-26 23:52:46 +07:00
c10d5cf115 Fix a bug with Promise.catch() in PromiseMiddleware
The pending action will be modified and a newly created promise handler
will be returned.

This has (suddenly?) caused errors in tests because the catch() handlers defined in tests would be called before the one defined in PromiseMiddleware:

    const p = new Promise(...)

    const {payload} = store.dispatch({
      payload: new Promise(...),
      type: '...',
    })

    try {
      await payload
    } catch (err) {
      // this handler would be invoked before the catch handler in
      // PromiseMiddleware
    }

since the PromiseMiddleware adds a then-callback, followed by a
catch-callback.
2019-09-17 00:08:49 +07:00
50d36f268f Fix linting errors in packages/jsonrpc 2019-09-15 17:14:31 +07:00
195d7226e8 Rename jsonrpc types 2019-09-13 23:49:05 +07:00
eebe26f706 Extract redux, http-types, http-client and test-utils 2019-09-10 17:56:25 +07:00
0222455cd7 Breaking change: JSONRPC context is always 1st argument 2019-08-30 17:12:46 +07:00
5cc20ccd8e Remove baseURL from packages/jsonrpc#createRemoteClient 2019-08-30 15:01:01 +07:00
dffad844ad Rename scope @rondo to @rondo.dev 2019-08-25 11:33:06 +07:00
86e90d28bb Make express jsonrpc use a builder pattern 2019-08-05 21:07:46 +07:00
15d54639ab Move ILogger to @rondo/common 2019-08-04 13:15:33 +07:00
c273c1b914 Extract jsonrpc functionality into a separate file 2019-08-04 10:08:06 +07:00
9aba9000b7 Rename createReduxClient to createActions 2019-08-01 20:01:30 +07:00
daf32de431 Add test for missing method 2019-08-01 19:55:30 +07:00
2b0ccfb984 Update createReducer API for jsonrpc 2019-08-01 19:40:26 +07:00
4faedc23ce WIP: Add ability to define reducer handlers 2019-08-01 19:03:10 +07:00
82ec4c321a Add & test createReducer 2019-08-01 16:35:40 +07:00
dca9691d7d Add ability to easily create redux middleware for async actions 2019-08-01 15:51:59 +07:00
fa27dda530 Add ability to infer jsonrpc redux action types 2019-08-01 13:57:51 +07:00
166981fe3b Move jsonrpc back to single package 2019-08-01 12:26:23 +07:00