@live-change/dao 0.5.22 → 0.8.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.
- package/LICENSE.md +1 -1
- package/index.js +68 -48
- package/lib/ConnectionMonitorPingReceiver.js +1 -1
- package/lib/ConnectionMonitorPinger.js +1 -1
- package/lib/Dao.js +7 -7
- package/lib/DaoCache.js +2 -2
- package/lib/DaoPrerenderCache.js +4 -3
- package/lib/DaoProxy.js +3 -3
- package/lib/EventEmitter.js +1 -1
- package/lib/ExtendedObservableList.js +2 -2
- package/lib/InboxReader.js +1 -1
- package/lib/LoopbackConnection.js +4 -3
- package/lib/Observable.js +3 -2
- package/lib/ObservableError.js +2 -2
- package/lib/ObservableList.js +2 -2
- package/lib/ObservablePromiseProxy.js +6 -5
- package/lib/ObservableProxy.js +4 -3
- package/lib/ObservableValue.js +2 -2
- package/lib/Path.js +1 -1
- package/lib/ReactiveConnection.js +5 -4
- package/lib/ReactiveServer.js +4 -4
- package/lib/ReactiveServerConnection.js +11 -12
- package/lib/RemoteDataSource.js +1 -1
- package/lib/SimpleDao.js +6 -5
- package/lib/TimeSynchronization.js +1 -1
- package/lib/collectPointers.js +1 -1
- package/lib/utils.js +2 -4
- package/package.json +6 -6
- package/tests/clicks-list.js +4 -4
- package/tests/connection-monitors.js +4 -4
- package/tests/failed-dao-factory.js +6 -5
- package/tests/get-more.js +4 -4
- package/tests/insta-error.js +4 -4
- package/tests/loopback-connection.js +4 -4
- package/tests/malformed-packets.js +4 -4
- package/tests/observe-more.js +4 -4
- package/tests/path.js +3 -3
- package/tests/pointers-collector.js +2 -2
- package/tests/promised-error.js +4 -4
- package/tests/promised-time-value.js +4 -4
- package/tests/request-resend.js +4 -4
- package/tests/testServerDao.js +6 -7
- package/tests/time-sync.js +4 -4
- package/tests/time-value.js +4 -4
- package/browser.js +0 -81
package/LICENSE.md
CHANGED
package/index.js
CHANGED
|
@@ -1,70 +1,90 @@
|
|
|
1
|
-
|
|
1
|
+
import Dao from "./lib/Dao.js"
|
|
2
|
+
let rd = Dao
|
|
3
|
+
rd.Dao = Dao
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
import Observable from "./lib/Observable.js"
|
|
6
|
+
rd.Observable = Observable
|
|
7
|
+
export { Observable }
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
import ObservableValue from "./lib/ObservableValue.js"
|
|
10
|
+
rd.ObservableValue = ObservableValue
|
|
11
|
+
export { ObservableValue }
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
import ObservableList from "./lib/ObservableList.js"
|
|
14
|
+
rd.ObservableList = ObservableList
|
|
15
|
+
export { ObservableList }
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
import ExtendedObservableList from "./lib/ExtendedObservableList.js"
|
|
18
|
+
rd.ExtendedObservableList = ExtendedObservableList
|
|
19
|
+
export { ExtendedObservableList }
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
import DaoPrerenderCache from "./lib/DaoPrerenderCache.js"
|
|
22
|
+
const ReactiveCache = DaoPrerenderCache // backward compatibility
|
|
23
|
+
rd.ReactiveCache = DaoPrerenderCache // backward compatibility
|
|
24
|
+
rd.DaoPrerenderCache = DaoPrerenderCache
|
|
25
|
+
export { ReactiveCache, DaoPrerenderCache }
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
import DaoProxy from "./lib/DaoProxy.js"
|
|
28
|
+
const ReactiveDaoProxy = DaoProxy // backward compatibility
|
|
29
|
+
rd.ReactiveDaoProxy = DaoProxy // backward compatibility
|
|
30
|
+
rd.DaoProxy = DaoProxy
|
|
31
|
+
export { ReactiveDaoProxy, DaoProxy }
|
|
19
32
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
import DaoCache from "./lib/DaoCache.js"
|
|
34
|
+
rd.DaoCache = DaoCache
|
|
35
|
+
export { DaoCache }
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
import InboxReader from "./lib/InboxReader.js"
|
|
38
|
+
rd.InboxReader = InboxReader
|
|
39
|
+
export { InboxReader }
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
import ReactiveConnection from "./lib/ReactiveConnection.js"
|
|
42
|
+
rd.ReactiveConnection = ReactiveConnection
|
|
43
|
+
export { ReactiveConnection }
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
import LoopbackConnection from "./lib/LoopbackConnection.js"
|
|
46
|
+
rd.LoopbackConnection = LoopbackConnection
|
|
47
|
+
export { LoopbackConnection }
|
|
32
48
|
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
import SimpleDao from "./lib/SimpleDao.js"
|
|
50
|
+
rd.SimpleDao = SimpleDao
|
|
51
|
+
export { SimpleDao }
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
import ObservableError from "./lib/ObservableError.js"
|
|
54
|
+
rd.ObservableError = ObservableError
|
|
55
|
+
export { ObservableError }
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
import ObservableProxy from "./lib/ObservableProxy.js"
|
|
58
|
+
rd.ObservableProxy = ObservableProxy
|
|
59
|
+
export { ObservableProxy }
|
|
41
60
|
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
import ObservablePromiseProxy from "./lib/ObservablePromiseProxy.js"
|
|
62
|
+
rd.ObservablePromiseProxy = ObservablePromiseProxy
|
|
63
|
+
export { ObservablePromiseProxy }
|
|
44
64
|
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
import ConnectionMonitorPinger from "./lib/ConnectionMonitorPinger.js"
|
|
66
|
+
rd.ConnectionMonitorPinger = ConnectionMonitorPinger
|
|
67
|
+
export { ConnectionMonitorPinger }
|
|
47
68
|
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
import ConnectionMonitorPingReceiver from "./lib/ConnectionMonitorPingReceiver.js"
|
|
70
|
+
rd.ConnectionMonitorPingReceiver = ConnectionMonitorPingReceiver
|
|
71
|
+
export { ConnectionMonitorPingReceiver }
|
|
50
72
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
import TimeSynchronization from "./lib/TimeSynchronization.js"
|
|
74
|
+
rd.TimeSynchronization = TimeSynchronization
|
|
75
|
+
export { TimeSynchronization }
|
|
54
76
|
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
import collectPointers from "./lib/collectPointers.js"
|
|
78
|
+
rd.collectPointers = collectPointers
|
|
79
|
+
export { collectPointers }
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
import ReactiveServer from "./lib/ReactiveServer.js"
|
|
82
|
+
rd.ReactiveServer = ReactiveServer
|
|
83
|
+
export { ReactiveServer }
|
|
60
84
|
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
import Path from "./lib/Path.js"
|
|
86
|
+
rd.Path = Path
|
|
87
|
+
export { Path }
|
|
63
88
|
|
|
64
|
-
const collectPointers = require("./lib/collectPointers.js")
|
|
65
|
-
Dao.collectPointers = collectPointers
|
|
66
|
-
|
|
67
|
-
Dao.global = Dao
|
|
68
|
-
|
|
69
|
-
module.exports = Dao
|
|
70
89
|
|
|
90
|
+
export default rd
|
package/lib/Dao.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import EventEmitter from "./EventEmitter.js"
|
|
2
|
+
import RemoteDataSource from "./RemoteDataSource.js"
|
|
3
|
+
import ReactiveConnection from "./ReactiveConnection.js"
|
|
4
|
+
import ObservableList from "./ObservableList.js"
|
|
5
|
+
import Debug from "debug"
|
|
6
|
+
const debug = Debug('dao')
|
|
6
7
|
|
|
7
8
|
function isConstructor(f) {
|
|
8
9
|
try {
|
|
@@ -113,5 +114,4 @@ class Dao extends EventEmitter {
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
module.exports.default = Dao
|
|
117
|
+
export default Dao
|
package/lib/DaoCache.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import EventEmitter from "./EventEmitter.js"
|
|
2
2
|
|
|
3
3
|
class CacheState {
|
|
4
4
|
constructor(cache, what, settings) {
|
|
@@ -272,4 +272,4 @@ class DaoCache extends EventEmitter {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
export default DaoCache
|
package/lib/DaoPrerenderCache.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
import Debug from 'debug'
|
|
2
|
+
const debug = Debug('reactive-dao:cache')
|
|
3
|
+
import ObservableValue from "./ObservableValue.js"
|
|
3
4
|
|
|
4
5
|
class DaoPrerenderCache {
|
|
5
6
|
|
|
@@ -151,4 +152,4 @@ class DaoPrerenderCache {
|
|
|
151
152
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
export default DaoPrerenderCache
|
package/lib/DaoProxy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import EventEmitter from "./EventEmitter.js"
|
|
2
|
+
import ObservableProxy from "./ObservableProxy.js"
|
|
3
3
|
|
|
4
4
|
class DaoProxy extends EventEmitter {
|
|
5
5
|
constructor(dao) {
|
|
@@ -94,4 +94,4 @@ class DaoProxy extends EventEmitter {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
export default DaoProxy
|
package/lib/EventEmitter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ObservableList from "./ObservableList.js"
|
|
2
2
|
|
|
3
3
|
class ExtendedObservableList extends ObservableList {
|
|
4
4
|
constructor(observableList, elementActivator, elementDispose, valueActivator = observableList.valueActivator) {
|
|
@@ -222,4 +222,4 @@ class ExtendedObservableList extends ObservableList {
|
|
|
222
222
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
export default ExtendedObservableList
|
package/lib/InboxReader.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Connection from "./ReactiveConnection.js"
|
|
2
|
+
import Debug from "debug"
|
|
3
|
+
const debug = Debug("reactive-dao:loopback-connection")
|
|
3
4
|
|
|
4
5
|
class LoopbackConnection extends Connection {
|
|
5
6
|
constructor(credentials, server, settings) {
|
|
@@ -86,4 +87,4 @@ class LoopbackConnection extends Connection {
|
|
|
86
87
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
export default LoopbackConnection
|
package/lib/Observable.js
CHANGED
package/lib/ObservableError.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Observable from "./Observable.js"
|
|
2
2
|
|
|
3
3
|
class ObservableError extends Observable {
|
|
4
4
|
constructor(error) {
|
|
@@ -17,4 +17,4 @@ class ObservableError extends Observable {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
export default ObservableError
|
package/lib/ObservableList.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Observable from "./Observable.js"
|
|
2
2
|
|
|
3
3
|
class ObservableList extends Observable {
|
|
4
4
|
constructor(list, _what, _dispose, valueActivator) {
|
|
@@ -300,4 +300,4 @@ class ObservableList extends Observable {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
export default ObservableList
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Observable from "./Observable.js"
|
|
2
|
+
import ObservableValue from "./ObservableValue.js"
|
|
3
|
+
import ObservableError from "./ObservableError.js"
|
|
4
|
+
import Debug from "debug"
|
|
5
|
+
const debug = Debug('dao')
|
|
5
6
|
|
|
6
7
|
class ObservablePromiseProxy extends Observable {
|
|
7
8
|
constructor(promise, errorMapper = v => v) {
|
|
@@ -58,4 +59,4 @@ class ObservablePromiseProxy extends Observable {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
export default ObservablePromiseProxy
|
package/lib/ObservableProxy.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
import Debug from "debug"
|
|
2
|
+
const debug = Debug('dao')
|
|
3
|
+
import Observable from "./Observable.js"
|
|
3
4
|
|
|
4
5
|
class ObservableProxy extends Observable {
|
|
5
6
|
constructor(observable) {
|
|
@@ -136,4 +137,4 @@ class ObservableProxy extends Observable {
|
|
|
136
137
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
export default ObservableProxy
|
package/lib/ObservableValue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Observable from "./Observable.js"
|
|
2
2
|
|
|
3
3
|
class ObservableValue extends Observable {
|
|
4
4
|
constructor(value) {
|
|
@@ -167,4 +167,4 @@ class ObservableValue extends Observable {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
export default ObservableValue
|
package/lib/Path.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
1
|
+
import EventEmitter from "./EventEmitter.js"
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
const debug = Debug('dao')
|
|
4
|
+
import * as utils from './utils.js'
|
|
4
5
|
|
|
5
6
|
let lastUid = 0
|
|
6
7
|
|
|
@@ -455,4 +456,4 @@ class Connection extends EventEmitter {
|
|
|
455
456
|
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
|
|
459
|
+
export default Connection
|
package/lib/ReactiveServer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const debug =
|
|
1
|
+
import ReactiveServerConnection from './ReactiveServerConnection.js'
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
const debug = Debug('dao')
|
|
4
4
|
|
|
5
5
|
class ReactiveServer {
|
|
6
6
|
constructor(daoFactory, settings) {
|
|
@@ -21,4 +21,4 @@ class ReactiveServer {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
export default ReactiveServer
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
import EventEmitter from './EventEmitter.js'
|
|
2
|
+
import ObservableList from "./ObservableList.js"
|
|
3
|
+
import * as utils from './utils.js'
|
|
4
|
+
import collectPointers from './collectPointers.js'
|
|
5
|
+
import Debug from 'debug'
|
|
6
|
+
const debug = Debug("reactive-dao")
|
|
7
|
+
const debugPot = Debug("reactive-dao:pot")
|
|
7
8
|
|
|
8
9
|
class PushObservableTrigger {
|
|
9
10
|
constructor(po, what, more) {
|
|
@@ -597,11 +598,10 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
597
598
|
const pointers = collectPointers(source, schema, (dep) => {
|
|
598
599
|
const key = JSON.stringify(dep)
|
|
599
600
|
const value = resultsMap.get(key)
|
|
600
|
-
if(typeof value != 'undefined') return value
|
|
601
|
+
if(typeof value != 'undefined') return value.data
|
|
601
602
|
moreDeps.push(dep)
|
|
602
603
|
return undefined
|
|
603
604
|
})
|
|
604
|
-
//console.log("S PTRS", JSON.stringify(pointers, null, ' '))
|
|
605
605
|
if(moreDeps.length == 0) return Promise.resolve(pointers)
|
|
606
606
|
return Promise.all(moreDeps.map(dep => {
|
|
607
607
|
const result = fetch({ what: dep }).catch(error => {
|
|
@@ -611,7 +611,6 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
611
611
|
})
|
|
612
612
|
return result
|
|
613
613
|
})).then(gotSomeDeps => fetchDeps(source, schema))
|
|
614
|
-
|
|
615
614
|
}
|
|
616
615
|
function fetchMore(result, more) {
|
|
617
616
|
return Promise.all(
|
|
@@ -749,12 +748,12 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
749
748
|
this.dao = this.daoPromise
|
|
750
749
|
this.daoPromise = null
|
|
751
750
|
} else {
|
|
752
|
-
this.daoPromise.
|
|
751
|
+
this.daoPromise.then(dd => {
|
|
753
752
|
if(!dd) return this.handleDaoFactoryError("dao not defined")
|
|
754
753
|
this.dao = dd
|
|
755
754
|
this.daoPromise = null
|
|
756
755
|
for(const message of this.daoGenerationQueue) this.handleAuthorizedMessage(message)
|
|
757
|
-
})
|
|
756
|
+
}).catch(error => this.handleDaoFactoryError(error))
|
|
758
757
|
}
|
|
759
758
|
}
|
|
760
759
|
|
|
@@ -791,4 +790,4 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
791
790
|
|
|
792
791
|
}
|
|
793
792
|
|
|
794
|
-
|
|
793
|
+
export default ReactiveServerConnection
|
package/lib/RemoteDataSource.js
CHANGED
package/lib/SimpleDao.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ObservableValue from "./ObservableValue.js"
|
|
2
|
+
import ObservablePromiseProxy from "./ObservablePromiseProxy.js"
|
|
3
|
+
import ObservableError from "./ObservableError.js"
|
|
4
|
+
import Debug from "debug"
|
|
5
|
+
const debug = Debug("reactive-dao")
|
|
5
6
|
|
|
6
7
|
const errorMapper = e => ''+(e.stack || e.message || (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
7
8
|
|
|
@@ -48,4 +49,4 @@ class SimpleDao {
|
|
|
48
49
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
export default SimpleDao
|
package/lib/collectPointers.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function errorToJSON(error) {
|
|
1
|
+
export function errorToJSON(error) {
|
|
2
2
|
if(typeof error == 'object') {
|
|
3
3
|
let obj = {}
|
|
4
4
|
Object.getOwnPropertyNames(error).forEach(function (key) {
|
|
@@ -9,8 +9,6 @@ function errorToJSON(error) {
|
|
|
9
9
|
return error
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
module.exports.errorToJSON = errorToJSON
|
|
13
|
-
|
|
14
12
|
function nextTickMicrotask(handler, ...args) {
|
|
15
13
|
queueMicrotask(() => handler(...args))
|
|
16
14
|
}
|
|
@@ -23,4 +21,4 @@ function nextTickPromise(handler, ...args) {
|
|
|
23
21
|
const supportMicrotask = typeof queueMicrotask !== 'undefined'
|
|
24
22
|
const supportNextTick = typeof process !== 'undefined' && process.nextTick
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
export const nextTick = supportNextTick ? process.nextTick : (supportMicrotask ? nextTickMicrotask : nextTickPromise)
|
package/package.json
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"description": "live data access object",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"supports-color": "^9.4.0",
|
|
21
|
+
"tape": "^5.7.4"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
23
|
+
"type": "module",
|
|
24
24
|
"license": "BSD-3-Clause",
|
|
25
25
|
"main": "index.js",
|
|
26
26
|
"browsernpm ": "browser.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"name": "@live-change/dao",
|
|
34
34
|
"readme": "README.md",
|
|
35
35
|
"scripts": {
|
|
36
|
-
"test": "NODE_ENV=test
|
|
36
|
+
"test": "NODE_ENV=test tape tests/*"
|
|
37
37
|
},
|
|
38
|
-
"version": "0.
|
|
39
|
-
"gitHead": "
|
|
38
|
+
"version": "0.8.4",
|
|
39
|
+
"gitHead": "cdc66924576866cd3b476e5a0e8956de54c6d8d9"
|
|
40
40
|
}
|
package/tests/clicks-list.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("click list", (t) => {
|
|
7
7
|
t.plan(4)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("connection monitors", (t) => {
|
|
7
7
|
t.plan(5)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time value", (t) => {
|
|
7
7
|
t.plan(2)
|
|
@@ -15,8 +15,8 @@ test("time value", (t) => {
|
|
|
15
15
|
client = new LoopbackConnection({ sessionId }, server, {
|
|
16
16
|
delay: 50
|
|
17
17
|
})
|
|
18
|
-
client.initialize()
|
|
19
18
|
client.once('authenticationError', (err) => t.pass("authentication failed!"))
|
|
19
|
+
client.initialize()
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
t.test('create connection with dao factory throwing exception', (t) => {
|
|
@@ -26,6 +26,7 @@ test("time value", (t) => {
|
|
|
26
26
|
delay: 50
|
|
27
27
|
})
|
|
28
28
|
client.once('authenticationError', (err) => t.pass("authentication failed!"))
|
|
29
|
+
client.initialize()
|
|
29
30
|
})
|
|
30
31
|
|
|
31
32
|
})
|
package/tests/get-more.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("get more", (t) => {
|
|
7
7
|
t.plan(5)
|
package/tests/insta-error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time value", (t) => {
|
|
7
7
|
t.plan(3)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("loopback connection", (t) => {
|
|
7
7
|
t.plan(4)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
let sessionId = ""+Math.random()
|
|
7
7
|
|
package/tests/observe-more.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("observe more", (t) => {
|
|
7
7
|
t.plan(6)
|
package/tests/path.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import { Path } from "../index.js"
|
|
4
4
|
|
|
5
5
|
const users = (params) => new Path(['users', params])
|
|
6
6
|
const user = (params) => new Path(['user', params])
|
package/tests/promised-error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time value", (t) => {
|
|
7
7
|
t.plan(3)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time value", (t) => {
|
|
7
7
|
t.plan(4)
|
package/tests/request-resend.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("request resend", (t) => {
|
|
7
7
|
t.plan(7)
|
package/tests/testServerDao.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import ReactiveDao from "../index.js"
|
|
2
2
|
|
|
3
3
|
let timeObservable = new ReactiveDao.ObservableValue(Date.now())
|
|
4
4
|
let clicksObservable = new ReactiveDao.ObservableList([])
|
|
5
5
|
|
|
6
|
-
class ObservableCounter extends ReactiveDao.ObservableValue {
|
|
6
|
+
export class ObservableCounter extends ReactiveDao.ObservableValue {
|
|
7
7
|
constructor(v) {
|
|
8
8
|
super(v)
|
|
9
9
|
}
|
|
@@ -278,16 +278,15 @@ function generator(credentials) {
|
|
|
278
278
|
})
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
export const instant = generator
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
export const promised = (credentials) => new Promise((resolve, reject) => {
|
|
284
284
|
setTimeout(() => resolve(generator(credentials)), 50)
|
|
285
285
|
})
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
export const failedPromise = (credentials) => new Promise((resolve, reject) => {
|
|
288
288
|
setTimeout(() => reject("error"))
|
|
289
289
|
})
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
export const failed = (credentials) => { throw new Error("error") }
|
|
292
292
|
|
|
293
|
-
module.exports.ObservableCounter = ObservableCounter
|
package/tests/time-sync.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time synchronization", (t) => {
|
|
7
7
|
t.plan(6)
|
package/tests/time-value.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'tape'
|
|
2
|
+
import * as testServerDao from './testServerDao.js'
|
|
3
|
+
import ReactiveDao from "../index.js"
|
|
4
|
+
import LoopbackConnection from '../lib/LoopbackConnection.js'
|
|
5
5
|
|
|
6
6
|
test("time value", (t) => {
|
|
7
7
|
t.plan(4)
|
package/browser.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import Dao from "./lib/Dao.js"
|
|
2
|
-
let rd = Dao
|
|
3
|
-
rd.Dao = Dao
|
|
4
|
-
|
|
5
|
-
import Observable from "./lib/Observable.js"
|
|
6
|
-
rd.Observable = Observable
|
|
7
|
-
export { Observable }
|
|
8
|
-
|
|
9
|
-
import ObservableValue from "./lib/ObservableValue.js"
|
|
10
|
-
rd.ObservableValue = ObservableValue
|
|
11
|
-
export { ObservableValue }
|
|
12
|
-
|
|
13
|
-
import ObservableList from "./lib/ObservableList.js"
|
|
14
|
-
rd.ObservableList = ObservableList
|
|
15
|
-
export { ObservableList }
|
|
16
|
-
|
|
17
|
-
import ExtendedObservableList from "./lib/ExtendedObservableList.js"
|
|
18
|
-
rd.ExtendedObservableList = ExtendedObservableList
|
|
19
|
-
export { ExtendedObservableList }
|
|
20
|
-
|
|
21
|
-
import DaoPrerenderCache from "./lib/DaoPrerenderCache.js"
|
|
22
|
-
const ReactiveCache = DaoPrerenderCache // backward compatibility
|
|
23
|
-
rd.ReactiveCache = DaoPrerenderCache // backward compatibility
|
|
24
|
-
rd.DaoPrerenderCache = DaoPrerenderCache
|
|
25
|
-
export { ReactiveCache, DaoPrerenderCache }
|
|
26
|
-
|
|
27
|
-
import DaoProxy from "./lib/DaoProxy.js"
|
|
28
|
-
const ReactiveDaoProxy = DaoProxy // backward compatibility
|
|
29
|
-
rd.ReactiveDaoProxy = DaoProxy // backward compatibility
|
|
30
|
-
rd.DaoProxy = DaoProxy
|
|
31
|
-
export { ReactiveDaoProxy, DaoProxy }
|
|
32
|
-
|
|
33
|
-
import DaoCache from "./lib/DaoCache.js"
|
|
34
|
-
rd.DaoCache = DaoCache
|
|
35
|
-
export { DaoCache }
|
|
36
|
-
|
|
37
|
-
import InboxReader from "./lib/InboxReader.js"
|
|
38
|
-
rd.InboxReader = InboxReader
|
|
39
|
-
export { InboxReader }
|
|
40
|
-
|
|
41
|
-
import ReactiveConnection from "./lib/ReactiveConnection.js"
|
|
42
|
-
rd.ReactiveConnection = ReactiveConnection
|
|
43
|
-
export { ReactiveConnection }
|
|
44
|
-
|
|
45
|
-
import LoopbackConnection from "./lib/LoopbackConnection.js"
|
|
46
|
-
rd.LoopbackConnection = LoopbackConnection
|
|
47
|
-
export { LoopbackConnection }
|
|
48
|
-
|
|
49
|
-
import SimpleDao from "./lib/SimpleDao.js"
|
|
50
|
-
rd.SimpleDao = SimpleDao
|
|
51
|
-
export { SimpleDao }
|
|
52
|
-
|
|
53
|
-
import ObservableError from "./lib/ObservableError.js"
|
|
54
|
-
rd.ObservableError = ObservableError
|
|
55
|
-
export { ObservableError }
|
|
56
|
-
|
|
57
|
-
import ObservableProxy from "./lib/ObservableProxy.js"
|
|
58
|
-
rd.ObservableProxy = ObservableProxy
|
|
59
|
-
export { ObservableProxy }
|
|
60
|
-
|
|
61
|
-
import ObservablePromiseProxy from "./lib/ObservablePromiseProxy.js"
|
|
62
|
-
rd.ObservablePromiseProxy = ObservablePromiseProxy
|
|
63
|
-
export { ObservablePromiseProxy }
|
|
64
|
-
|
|
65
|
-
import ConnectionMonitorPinger from "./lib/ConnectionMonitorPinger.js"
|
|
66
|
-
rd.ConnectionMonitorPinger = ConnectionMonitorPinger
|
|
67
|
-
export { ConnectionMonitorPinger }
|
|
68
|
-
|
|
69
|
-
import ConnectionMonitorPingReceiver from "./lib/ConnectionMonitorPingReceiver.js"
|
|
70
|
-
rd.ConnectionMonitorPingReceiver = ConnectionMonitorPingReceiver
|
|
71
|
-
export { ConnectionMonitorPingReceiver }
|
|
72
|
-
|
|
73
|
-
import TimeSynchronization from "./lib/TimeSynchronization.js"
|
|
74
|
-
rd.TimeSynchronization = TimeSynchronization
|
|
75
|
-
export { TimeSynchronization }
|
|
76
|
-
|
|
77
|
-
import collectPointers from "./lib/collectPointers.js"
|
|
78
|
-
rd.collectPointers = collectPointers
|
|
79
|
-
export { collectPointers }
|
|
80
|
-
|
|
81
|
-
export default rd
|