115 Commits

Author SHA1 Message Date
64f5f2f642 Replace Application.ts with createAppication and configureApplication 2019-08-31 11:42:12 +07:00
67e3da3246 Add ability to configure rpc services. Needs further testing 2019-08-31 09:12:10 +07:00
5b9f4b9321 Create transaction for JSONRPC middleware 2019-08-30 13:21:16 +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
22f0b15e3a Add debounce.cancel, cancel session cleanup 2019-08-27 14:54:47 +07:00
2256fbc1e8 Fix SessionStore concurrency in tests by debouncing fn 2019-08-26 20:13:35 +07:00
359c6afd08 Add test for doInNewTransaction (mysql) 2019-08-26 19:25:54 +07:00
76bf7d8d47 Add transactionId to SqlLogger 2019-08-26 19:08:35 +07:00
02d072a361 Add TransactionManager.doInNewTransaction 2019-08-26 19:07:21 +07:00
67ae8dac57 Replace unnecessary DB with IDatabase 2019-08-26 18:53:52 +07:00
291d05e2be Expose bootstrap in test.ts 2019-08-26 18:46:06 +07:00
772c3f6682 Use real cls-hooked in tests instead of NamespaceMock
https://github.com/Jeff-Lewis/cls-hooked/issues/17#issuecomment-510168720

Note: uses undocumented methods ns.enter(context) and ns.exit(context)
2019-08-26 11:14:11 +07:00
e2c8fca29b TODO: fix deadlock caused by SessionStore#cleanup 2019-08-26 09:10:27 +07:00
d8ab2decef Fix correlation id for tests 2019-08-25 23:37:27 +07:00
040af18765 Use process.env.JEST_WORKER_ID when creating username 2019-08-25 23:08:16 +07:00
1762dad4d1 Add ability to run @rondo/server tests in parallel 2019-08-25 23:07:47 +07:00
1e53f55cfa Check if date is valid before calling toISOString() 2019-08-25 22:21:34 +07:00
91ecdbba10 Move js-yaml to packages/config 2019-08-25 20:46:47 +07:00
1bbc3ed97d Extract ConfigReader to @rondo.dev/config pkg 2019-08-25 20:43:09 +07:00
9aaf8b62a9 Add @rondo.dev/logger, remove winston 2019-08-25 14:12:24 +07:00
dffad844ad Rename scope @rondo to @rondo.dev 2019-08-25 11:33:06 +07:00
79c6d1a608 Refactor scripts, add ability to load external scripts 2019-08-18 09:57:47 +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
b617069784 Add packages/services/src/services/TeamService2.ts
A few notes:

1) The context higher-order function will be tedious to define - a lot
   more typing than just an extra function argument.
2) As some methods do not require the context function, forgetting to
   call it might introduce bugs (await fn will not error out), but
   compile checks of the return value type might detect this

Possible solution is to go the GRPC way and allow only a single method
type as a parameter so all server-side method types would look like:

  async fn(param: IParam, context: Context) {}

and all client-side method types would look like:

  async fn(param: IParam) {}

However, This would deviate from the JSON-RPC standard which allows
multiple arguments to be passed in an array.

Alternatively, context could be passed as a first argument and then
filtered out:

  type Arguments<T> = T extends (context: Ctx, ...args: infer A) => infer R
    ? A
    : never

In this case, the type of Ctx would need to be known in advance. Will
have to think about this some more.
2019-08-06 19:26:11 +07:00
15d54639ab Move ILogger to @rondo/common 2019-08-04 13:15:33 +07:00
4c3570a9ce Do not extend/modify existing entities
Typeorm loads all @Entities and decorator-defined relations into a
global variable, and thus makes it impossible to override already
defined variables.

Will have to think about how to disable this behaviour in case the user
of this library does not want to use predefined variables, but for now
we will use the predefined defaults.
2019-08-02 20:17:10 +07:00
a6649def72 Add packages/server/src/database/DB.ts 2019-08-02 17:05:36 +07:00
7dd9497514 Use ttsc instead of tsc 2019-07-31 07:19:22 +08:00
a672aab11d Add ability to run app minified 2019-04-15 21:45:03 +12:00
5f662a1ac1 Make server work with browserify --node 2019-04-15 14:28:56 +12:00
dcc2fb4dc8 Log error messages during app Bootstrap.ts 2019-04-15 13:09:32 +12:00
9d282b278d Build ESM client-side modules to enable tree shaking
TypeScript compiler needs to be configured to output ES6 module by
setting --module es6 or the equivalent tsconfig.json compilerOptions
parameter.

Since tsc --build does not accept compiler options flags, we need to
duplicate some of the configuration:

- specify separate output folder for ES6 module files (new
  tsconfig.esm.json file)
- add "module" field for ES6 module (esm) output files to package.json

Hence, a script `scripts/sync-esm-config.js` was added to automate this
process.
2019-04-11 11:40:07 +08:00
e509c32f79 Add ability to load votes by id
Use createDate and updateDate as strings
2019-04-08 13:33:58 +08:00
e727687ec8 Refactor CommentActions, add skeleton for Reducer 2019-04-07 00:23:01 +08:00
bbf18ed27a Add ability to specify middleware in AsyncRouter 2019-04-06 21:32:20 +08:00
89af2f0845 Add StringUtils 2019-04-06 13:58:20 +08:00
264f5aba60 Add T prefix for all type defs 2019-04-02 16:22:38 +08:00
0630260628 Add space-within-parens rule 2019-04-02 15:09:47 +08:00
adfa7a069a Add common tslint.json configuration 2019-04-02 14:46:40 +08:00
ed047be2e3 Add valueOrError.ts 2019-03-27 16:23:47 +08:00
e76f762d23 Fix TeamService deleting all team realtions by userId 2019-03-25 13:30:21 +08:00
c83fa2d6d4 packages/client: Style TeamManager, fix error on delete 2019-03-25 13:28:09 +08:00
3f96a128a0 packages/server: Return API errors as JSON 2019-03-25 13:27:36 +08:00
c1d7077061 packages/server: Return validation errors as JSON 2019-03-25 13:19:20 +08:00
77838e8e0c packages/comments-server: Migrate to mysql/mariadb
Currently mysql2 prints a warning every time a connection is
established. This should be fixed with soon:

https://github.com/typeorm/typeorm/pull/3753
2019-03-23 21:21:50 +08:00
93b048bc10 Add correlationId to SqlLogger 2019-03-23 21:16:20 +08:00
dca5374911 Use $typeorm in buildfile 2019-03-23 17:14:08 +08:00
a628082a73 Add packages/client/src/team 2019-03-20 15:01:15 +05:00