@live-change/db-server 0.4.84 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/Server.js +8 -6
  2. package/package.json +13 -19
package/lib/Server.js CHANGED
@@ -17,6 +17,8 @@ const ReactiveDao = require("@live-change/dao")
17
17
 
18
18
  const Database = require('@live-change/db').Database
19
19
 
20
+ const debug = require('debug')('db-server')
21
+
20
22
  class DatabaseStore {
21
23
  constructor(path, backend, options) {
22
24
  this.path = path
@@ -224,7 +226,7 @@ class Server {
224
226
  const dbPath = this.config.temporary ? 'memory' : path.resolve(this.config.dbRoot, dbName+'.db')
225
227
  let dbStore = this.databaseStores.get(dbName)
226
228
  if(!dbStore) {
227
- console.log("CREATE DB", dbPath, dbConfig.storage)
229
+ debug("CREATE DB", dbPath, dbConfig.storage)
228
230
  dbStore = new DatabaseStore(dbPath, this.backend, dbConfig.storage)
229
231
  this.databaseStores.set(dbName, dbStore)
230
232
  }
@@ -266,20 +268,20 @@ class Server {
266
268
  getHttp() {
267
269
  if(!this.http) {
268
270
  const app = express()
269
- const sockJsServer = sockjs.createServer({});
271
+ const sockJsServer = sockjs.createServer({ prefix: '/api/sockjs' })
270
272
  sockJsServer.on('connection', (conn) => {
271
- console.log("SOCKJS connection")
273
+ debug("SOCKJS connection")
272
274
  this.apiServer.handleConnection(conn)
273
275
  })
274
276
  const server = http.createServer(app)
275
277
  let wsServer = new WebSocketServer({ httpServer: server, autoAcceptConnections: false })
276
278
  wsServer.on("request",(request) => {
277
- console.log("WS URI", request.httpRequest.url, "FROM", request.remoteAddress)
278
- if(request.httpRequest.url != "/api/ws") return request.reject();
279
+ debug("WS URI", request.httpRequest.url, "FROM", request.remoteAddress)
280
+ if(request.httpRequest.url != "/api/ws") return request.reject()
279
281
  let serverConnection = new ReactiveDaoWebsocketServer(request)
280
282
  this.apiServer.handleConnection(serverConnection)
281
283
  })
282
- sockJsServer.installHandlers(server, { prefix: '/api/sockjs' })
284
+ sockJsServer.attach(server)
283
285
  this.http = {
284
286
  app,
285
287
  sockJsServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db-server",
3
- "version": "0.4.84",
3
+ "version": "0.5.4",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/live-change/db-server.git"
15
+ "url": "git+https://github.com/live-change/live-change-db.git"
16
16
  },
17
17
  "author": {
18
18
  "email": "m8@em8.pl",
@@ -21,29 +21,23 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "bugs": {
24
- "url": "https://github.com/live-change/db-server/issues"
24
+ "url": "https://github.com/live-change/live-change-db/issues"
25
25
  },
26
- "homepage": "https://github.com/live-change/db-server",
26
+ "homepage": "https://github.com/live-change/live-change-db",
27
27
  "devDependencies": {
28
- "encoding-down": "^7.0.0",
29
- "level-rocksdb": "^4.0.0",
30
- "leveldown": "^6.0.0",
31
- "levelup": "^5.0.1",
32
- "memdown": "^6.0.0",
33
- "node-lmdb": "^0.8.0",
34
- "subleveldown": "^5.0.1",
35
28
  "tape": "^5.2.2"
36
29
  },
37
30
  "dependencies": {
38
31
  "@live-change/dao": "^0.3.12",
39
32
  "@live-change/dao-sockjs": "^0.2.1",
40
33
  "@live-change/dao-websocket": "^0.3.2",
41
- "@live-change/db": "^0.3.64",
42
- "@live-change/db-client": "^0.4.71",
43
- "@live-change/db-store-level": "^0.1.15",
44
- "@live-change/db-store-lmdb": "^0.1.22",
45
- "@live-change/db-store-observable-db": "^0.1.3",
46
- "@live-change/db-store-rbtree": "^0.1.2",
34
+ "@live-change/db": "^0.5.4",
35
+ "@live-change/db-client": "^0.5.4",
36
+ "@live-change/db-store-level": "^0.5.4",
37
+ "@live-change/db-store-lmdb": "^0.5.4",
38
+ "@live-change/db-store-observable-db": "^0.5.4",
39
+ "@live-change/db-store-rbtree": "^0.5.4",
40
+ "@live-change/sockjs": "^0.4.0-rc.1",
47
41
  "express": "^4.17.1",
48
42
  "line-reader": "^0.4.0",
49
43
  "node-interval-tree": "^1.3.3",
@@ -51,8 +45,8 @@
51
45
  "rimraf": "^3.0.2",
52
46
  "rimraf-promise": "^2.0.0",
53
47
  "segfault-handler": "^1.3.0",
54
- "sockjs": "^0.3.21",
55
48
  "websocket": "^1.0.34",
56
49
  "yargs": "^17.0.1"
57
- }
50
+ },
51
+ "gitHead": "0dfd0cb953fad982630808934326d00abea2c2b4"
58
52
  }