@live-change/db-server 0.5.9 → 0.5.10

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/dbDao.js +8 -8
  2. package/package.json +12 -12
package/lib/dbDao.js CHANGED
@@ -810,38 +810,38 @@ function localReads(server, scriptContext) {
810
810
  }
811
811
  },
812
812
  query: {
813
- observable: (dbName, code, params = {}) => {
813
+ observable: (dbName, code, params = {}, sourceName = 'query/query.js') => {
814
814
  if(!dbName) return new ReactiveDao.ObservableError("databaseNameRequired")
815
815
  const db = server.databases.get(dbName)
816
816
  if(!db) return new ReactiveDao.ObservableError('databaseNotFound')
817
- const queryFunction = scriptContext.run(code, 'userCode:query/query.js') /// TODO: log queries, more info here
817
+ const queryFunction = scriptContext.run(code, 'queryCode:' + sourceName) /// TODO: log queries, more info here
818
818
  return db.queryObservable(async (input, output) => {
819
819
  return queryFunction(input, output, params)
820
820
  })
821
821
  },
822
- get: async (dbName, code, params = {}) => {
822
+ get: async (dbName, code, params = {}, sourceName = 'query/query.js') => {
823
823
  if(!dbName) throw new Error("databaseNameRequired")
824
824
  const db = server.databases.get(dbName)
825
825
  if(!db) throw new Error('databaseNotFound')
826
- const queryFunction = scriptContext.run(code, 'query')
826
+ const queryFunction = scriptContext.run(code, 'queryCode:' + sourceName)
827
827
  return db.queryGet((input, output) => queryFunction(input, output, params))
828
828
  }
829
829
  },
830
830
  queryObject: {
831
- observable: (dbName, code, params = {}) => {
831
+ observable: (dbName, code, params = {}, sourceName = 'queryObject/query.js') => {
832
832
  if(!dbName) return new ReactiveDao.ObservableError("databaseNameRequired")
833
833
  const db = server.databases.get(dbName)
834
834
  if(!db) return new ReactiveDao.ObservableError('databaseNotFound')
835
- const queryFunction = scriptContext.run(code, `userCode:${dbName}/query.js`) /// TODO: log queries, more info here
835
+ const queryFunction = scriptContext.run(code, 'queryCode:' + sourceName) /// TODO: log queries, more info here
836
836
  return db.queryObjectObservable(async (input, output) => {
837
837
  return queryFunction(input, output, params)
838
838
  })
839
839
  },
840
- get: async (dbName, code, params = {}) => {
840
+ get: async (dbName, code, params = {}, sourceName = 'queryObject/query.js') => {
841
841
  if(!dbName) throw new Error("databaseNameRequired")
842
842
  const db = server.databases.get(dbName)
843
843
  if(!db) throw new Error('databaseNotFound')
844
- const queryFunction = scriptContext.run(code, `userCode:${dbName}/query.js`)
844
+ const queryFunction = scriptContext.run(code, 'queryCode:' + sourceName)
845
845
  return db.queryObjectGet((input, output) => queryFunction(input, output, params))
846
846
  }
847
847
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db-server",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,16 +28,16 @@
28
28
  "tape": "^5.3.2"
29
29
  },
30
30
  "dependencies": {
31
- "@live-change/dao": "0.4.6",
32
- "@live-change/dao-sockjs": "0.4.5",
33
- "@live-change/dao-websocket": "0.4.6",
34
- "@live-change/db": "^0.5.9",
35
- "@live-change/db-admin": "^0.5.9",
36
- "@live-change/db-client": "^0.5.9",
37
- "@live-change/db-store-level": "^0.5.9",
38
- "@live-change/db-store-lmdb": "^0.5.9",
39
- "@live-change/db-store-observable-db": "^0.5.9",
40
- "@live-change/db-store-rbtree": "^0.5.9",
31
+ "@live-change/dao": "0.4.10",
32
+ "@live-change/dao-sockjs": "0.4.8",
33
+ "@live-change/dao-websocket": "0.4.10",
34
+ "@live-change/db": "^0.5.10",
35
+ "@live-change/db-admin": "^0.5.10",
36
+ "@live-change/db-client": "^0.5.10",
37
+ "@live-change/db-store-level": "^0.5.10",
38
+ "@live-change/db-store-lmdb": "^0.5.10",
39
+ "@live-change/db-store-observable-db": "^0.5.10",
40
+ "@live-change/db-store-rbtree": "^0.5.10",
41
41
  "@live-change/sockjs": "^0.4.0-rc.1",
42
42
  "express": "^4.17.1",
43
43
  "line-reader": "^0.4.0",
@@ -49,5 +49,5 @@
49
49
  "websocket": "^1.0.34",
50
50
  "yargs": "^17.3.0"
51
51
  },
52
- "gitHead": "3e27e47bddae99c97898a119b97a13745fb03f70"
52
+ "gitHead": "6236c001558f60998b0e5bce5e97e7ebb1f50e45"
53
53
  }