2021-10-11 00:21:57 +00:00
|
|
|
import { stub } from 'eltro'
|
2021-07-03 13:56:53 +00:00
|
|
|
import Client from './helper.client.mjs'
|
|
|
|
import defaults from '../api/defaults.mjs'
|
2021-10-11 00:21:57 +00:00
|
|
|
import serv from '../api/server.mjs'
|
|
|
|
|
|
|
|
serv.log = {
|
|
|
|
log: stub(),
|
|
|
|
warn: stub(),
|
|
|
|
info: stub(),
|
|
|
|
error: stub(),
|
|
|
|
}
|
|
|
|
|
|
|
|
export const server = serv
|
2017-12-09 21:51:18 +00:00
|
|
|
|
2021-07-03 13:56:53 +00:00
|
|
|
export function createClient() {
|
|
|
|
return new Client()
|
|
|
|
}
|
2017-12-10 09:45:38 +00:00
|
|
|
|
2021-10-11 00:21:57 +00:00
|
|
|
export function resetLog() {
|
|
|
|
serv.log.log.reset()
|
|
|
|
serv.log.info.reset()
|
|
|
|
serv.log.warn.reset()
|
|
|
|
serv.log.error.reset()
|
|
|
|
}
|
|
|
|
|
2017-12-10 09:45:38 +00:00
|
|
|
export function createContext(opts) {
|
|
|
|
return defaults(opts, {
|
2021-10-11 00:21:57 +00:00
|
|
|
query: new Map(),
|
2017-12-10 09:45:38 +00:00
|
|
|
req: { },
|
|
|
|
res: { },
|
2021-10-11 00:21:57 +00:00
|
|
|
log: {
|
|
|
|
log: stub(),
|
|
|
|
warn: stub(),
|
|
|
|
info: stub(),
|
|
|
|
error: stub(),
|
|
|
|
},
|
2017-12-10 09:45:38 +00:00
|
|
|
})
|
|
|
|
}
|