@live-change/db-web 0.7.0 → 0.7.3
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.
- package/index.js +3 -1
- package/lib/Server.js +7 -7
- package/lib/backend.js +9 -6
- package/lib/dbDao.js +2 -2
- package/lib/storeDao.js +2 -7
- package/package.json +8 -8
package/index.js
CHANGED
package/lib/Server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ScriptContext from '@live-change/db/lib/WebScriptContext.js'
|
|
2
|
+
import * as dbDao from './dbDao.js'
|
|
3
|
+
import * as storeDao from './storeDao.js'
|
|
4
|
+
import createBackend from "./backend.js"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import ReactiveDao from "@live-change/dao"
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { Database } from '@live-change/db'
|
|
9
9
|
|
|
10
10
|
class DatabaseStore {
|
|
11
11
|
constructor(path, backends, options) {
|
|
@@ -187,4 +187,4 @@ class Server {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
export default Server
|
package/lib/backend.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import localStorageStore from '@live-change/db-store-localstorage'
|
|
2
|
+
import indexedDbStore from '@live-change/db-store-indexeddb'
|
|
3
|
+
import rbTreeStore from '@live-change/db-store-rbtree'
|
|
4
|
+
|
|
1
5
|
function createBackend(config) {
|
|
2
6
|
console.log("CREATE BACKEND", config)
|
|
3
7
|
if(config.name == 'mem' || config.name == 'memory') {
|
|
4
8
|
return {
|
|
5
|
-
Store:
|
|
9
|
+
Store: rbTreeStore,
|
|
6
10
|
createDb(path, options) {
|
|
7
11
|
const db = {}
|
|
8
12
|
db.path = path
|
|
@@ -20,12 +24,11 @@ function createBackend(config) {
|
|
|
20
24
|
closeStore(store) {
|
|
21
25
|
},
|
|
22
26
|
async deleteStore(store) {
|
|
23
|
-
await store.clear()
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
} if(config.name == 'indexeddb') {
|
|
27
30
|
return {
|
|
28
|
-
Store:
|
|
31
|
+
Store: indexedDbStore,
|
|
29
32
|
createDb(path, options) {
|
|
30
33
|
const db = {}
|
|
31
34
|
db.path = path
|
|
@@ -49,7 +52,7 @@ function createBackend(config) {
|
|
|
49
52
|
}
|
|
50
53
|
} if(config.name == 'local') {
|
|
51
54
|
return {
|
|
52
|
-
Store:
|
|
55
|
+
Store: localStorageStore,
|
|
53
56
|
createDb(path, options) {
|
|
54
57
|
const db = {}
|
|
55
58
|
db.path = path
|
|
@@ -73,7 +76,7 @@ function createBackend(config) {
|
|
|
73
76
|
}
|
|
74
77
|
} if(config.name == 'session') {
|
|
75
78
|
return {
|
|
76
|
-
Store:
|
|
79
|
+
Store: localStorageStore,
|
|
77
80
|
createDb(path, options) {
|
|
78
81
|
const db = {}
|
|
79
82
|
db.path = path
|
|
@@ -100,4 +103,4 @@ function createBackend(config) {
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
export default createBackend
|
package/lib/dbDao.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from "@live-change/dao"
|
|
2
2
|
|
|
3
3
|
function localRequests(server, scriptContext) {
|
|
4
4
|
return {
|
|
@@ -847,7 +847,7 @@ function localReads(server, scriptContext) {
|
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
|
|
850
|
-
|
|
850
|
+
export {
|
|
851
851
|
localRequests,
|
|
852
852
|
remoteRequests,
|
|
853
853
|
localReads
|
package/lib/storeDao.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function localRequests(server) {
|
|
1
|
+
export function localRequests(server) {
|
|
2
2
|
return {
|
|
3
3
|
put: (dbName, storeName, object) => {
|
|
4
4
|
const db = server.databaseStores.get(dbName)
|
|
@@ -17,7 +17,7 @@ function localRequests(server) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function localReads(server) {
|
|
20
|
+
export function localReads(server) {
|
|
21
21
|
return {
|
|
22
22
|
object: {
|
|
23
23
|
observable(dbName, storeName, id) {
|
|
@@ -53,8 +53,3 @@ function localReads(server) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
module.exports = {
|
|
58
|
-
localRequests,
|
|
59
|
-
localReads
|
|
60
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/db-web",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "michal@laszczewski.com",
|
|
6
6
|
"name": "Michał Łaszczewski",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
},
|
|
23
23
|
"description": "live data access object",
|
|
24
24
|
"readme": "README.md",
|
|
25
|
-
"directories": {},
|
|
26
25
|
"license": "MIT",
|
|
27
26
|
"main": "index.js",
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"tape": "^5.7.4"
|
|
30
29
|
},
|
|
30
|
+
"type": "module",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@live-change/dao": "0.
|
|
33
|
-
"@live-change/db": "^0.7.
|
|
34
|
-
"@live-change/db-store-indexeddb": "^0.7.
|
|
35
|
-
"@live-change/db-store-localstorage": "^0.7.
|
|
36
|
-
"@live-change/db-store-rbtree": "^0.7.
|
|
32
|
+
"@live-change/dao": "0.6.0",
|
|
33
|
+
"@live-change/db": "^0.7.3",
|
|
34
|
+
"@live-change/db-store-indexeddb": "^0.7.3",
|
|
35
|
+
"@live-change/db-store-localstorage": "^0.7.3",
|
|
36
|
+
"@live-change/db-store-rbtree": "^0.7.3",
|
|
37
37
|
"debug": "^4.3.4"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "447f57db32c3b49d53a76ea3f94d725c25ae2791"
|
|
40
40
|
}
|