-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
34 lines (27 loc) · 990 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict'
const ModuleError = require('module-error')
const { ManyLevelHost } = require('./host')
const { ManyLevelGuest } = require('./guest')
exports.ManyLevelHost = ManyLevelHost
exports.ManyLevelGuest = ManyLevelGuest
const warned = { client: false, server: false }
exports.client = function (options) {
if (!warned.client && typeof console !== 'undefined' && typeof console.warn === 'function') {
warned.client = true
console.warn(new ModuleError(
'The client export has been replaced with ManyLevelGuest and will be removed in a future version',
{ code: 'LEVEL_LEGACY' }
))
}
return new ManyLevelGuest(options)
}
exports.server = function (db, options) {
if (!warned.server) {
warned.server = true
console.warn(new ModuleError(
'The server export has been replaced with ManyLevelHost and will be removed in a future version',
{ code: 'LEVEL_LEGACY' }
))
}
return new ManyLevelHost(db, options).createRpcStream()
}