68 Commits

Author SHA1 Message Date
9f1e2ca713 Run rondo imports
package.jsons are changed because dependencies are now sorted
tsconfig.jsons are changed because all referenced monorepo packages will
be added as project references
tsconfig.esm.jsons are changed because syncEsmConfig was run
2019-10-01 23:39:05 +07:00
c0a256ad83 Remove "express-serve-static-core"
It has different type definitions for some methods used in express and
TypeScript build fails because of it.

The solution is to use @types/express-serve-static-core instead.
2019-10-01 23:22:51 +07:00
4d7224cd8f Update package.json(s)
Bug for server: supertest is included
2019-10-01 22:29:51 +07:00
0c49e52f21 Add version tag to all package.json files 2019-10-01 09:37:57 +07:00
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
173b7cf66e Remove express module dependency from jsonrpc 2019-09-25 13:46:29 +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
400d1cd213 Run eslint --fix 2019-09-16 21:04:10 +07:00
9165b96e0f Fix comments-server 2019-09-16 20:46:52 +07:00
73c27aec6a Fix packages/comments-common 2019-09-16 11:39:36 +07:00
30d1f1fcd4 Partiall upgrade packages/client 2019-09-15 18:29:55 +07:00
50d36f268f Fix linting errors in packages/jsonrpc 2019-09-15 17:14:31 +07:00
ac8f1d9ff3 Run rondo syncEsmConfig 2019-09-14 12:01:29 +07:00
195d7226e8 Rename jsonrpc types 2019-09-13 23:49:05 +07:00
9199961fdb Add jsonrpc createClientMock 2019-09-10 21:29:10 +07:00
eebe26f706 Extract redux, http-types, http-client and test-utils 2019-09-10 17:56:25 +07:00
3739f27ebe Add first test for JSONRPC service 2019-09-07 09:38:43 +07:00
0a1eabadd9 Add test for _-prefixed methods 2019-09-05 09:31:32 +07:00
c4ae271604 Move private _-prefix method check into getAllMethods 2019-09-05 09:28:48 +07:00
1aa6cae0f3 Add ability to specify jsonrpc context asynchronously 2019-09-05 09:25:38 +07:00
4814316fa7 Use @rondo.dev/comments-common instead of @rondo.dev/common 2019-08-31 10:28:41 +07:00
67e3da3246 Add ability to configure rpc services. Needs further testing 2019-08-31 09:12:10 +07:00
fbd7a2229b Do not use proxy in createLocalClient, add bulk methods 2019-08-31 08:22:17 +07:00
d2a5a35543 Revert back to context in createLocalClient 2019-08-30 17:51:14 +07:00
0222455cd7 Breaking change: JSONRPC context is always 1st argument 2019-08-30 17:12:46 +07:00
b8fb7c2eba Add warning message about JSONRPC 2019-08-30 16:26:29 +07:00
5cc20ccd8e Remove baseURL from packages/jsonrpc#createRemoteClient 2019-08-30 15:01:01 +07:00
9cc5a7affb Add ability to wrap method calls in jsonrpc 2019-08-30 13:19:13 +07:00
4ea534293b Use Object.getPrototypeOf instead of obj.__proto__ 2019-08-30 13:19:04 +07:00
05946ee342 Remove space in supertest.ts 2019-08-30 13:18:33 +07:00
2f35b65f48 Add jsonrpc services to server(s) 2019-08-30 11:02:31 +07:00
7434c9fb42 Add UserService (RPC version) 2019-08-28 18:26:26 +07:00
cd5ff9b5da Generate @rondo.dev/common entities 2019-08-28 08:08:00 +07:00
b9e043e39e Export @ensure 2019-08-27 21:15:00 +07:00
8d73ece7b9 Remove comment 2019-08-27 21:14:41 +07:00
954f94f6b0 Add test for @ensure and instance methods 2019-08-27 21:13:13 +07:00
46a0a064d0 Make @ensure work with classes 2019-08-27 21:09:39 +07:00
0c867e916e Rename v to validate 2019-08-27 20:34:05 +07:00
9262cb636e Use getMetadata instead of getOwnMetadata 2019-08-27 20:33:21 +07:00
c7ab4fe387 Add ability to validate context via @ensure 2019-08-27 16:17:05 +07:00
dffad844ad Rename scope @rondo to @rondo.dev 2019-08-25 11:33:06 +07:00
19565563cc Add Contextual<Service, Context> type
As seen in TeamService2.ts, the Contextual type will add Context as the
last argument to any method of the interface, as long as the method has
0-4 arguments.

Interfaces with more than 4 arguments cannot use this type, but they
could be converted to interfaces which use 1 argument
(object/dictionary) only.

Some long-term thinking: Maybe only methods with a single argument
should be supported, similar to the way gRPC does it.
2019-08-07 22:37:48 +07:00
cc2f5f58e2 Add ability to specify jsonrpc context as extra argument
In this case the interface does not define context, but the implementing
service may use it as an optional argument:

  interface IService {
    add(a: number, b: number): number
  }

  class Service implements IService {
    add(a: number, b: number, ctx?: IContext): number {
      return a + b + ctx!.userId
    }
  }
2019-08-06 20:10:38 +07:00
86e90d28bb Make express jsonrpc use a builder pattern 2019-08-05 21:07:46 +07:00
f3f6166aab Send 405 when GET request is not allowed 2019-08-05 21:07:46 +07:00
e2f6c5f798 Encode JSON-RPC GET request params as JSON 2019-08-05 21:07:46 +07:00
81225b77a8 Implement GET method for idempotent methods 2019-08-05 21:07:46 +07:00
7edbe354a9 Remove TODO from jsonrpc 2019-08-05 21:07:46 +07:00
15d54639ab Move ILogger to @rondo/common 2019-08-04 13:15:33 +07:00
aeb208162f Refactor express#handleError 2019-08-04 13:02:01 +07:00