lerna: starting point

This commit is contained in:
41666 2019-04-02 23:05:19 -05:00
parent f7e2898633
commit cb0b1d2410
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
17 changed files with 730 additions and 1067 deletions

View file

@ -25,7 +25,7 @@ export default class RPCClient {
cookieHeader: string
rpc: {
[fn: string]: (...args: any[]) => Promise<mixed> | string
[fn: string]: (...args: any[]) => Promise<any>
} = {}
__rpcAvailable: Array<{
@ -42,11 +42,12 @@ export default class RPCClient {
this.dev = process.env.NODE_ENV === 'development'
}
this.rpc = new Proxy({
toJSON () {
return '{}'
}
}, { get: this.__rpcCall, has: this.__checkCall, ownKeys: this.__listCalls, delete: () => {} })
this.rpc = new Proxy({}, {
get: this.__rpcCall,
has: this.__checkCall,
ownKeys: this.__listCalls,
delete: () => {}
})
if (this.dev) {
this.updateCalls()
@ -90,7 +91,9 @@ export default class RPCClient {
}
const rsp = await rq.send(req).ok(() => true)
const body: RPCResponse = rsp.body
// console.log(body)
if (body.error === true) {
console.error(body)
throw RPCError.fromResponse(body, rsp.status)
}