@toa.io/core 0.20.0-dev.17 → 0.20.0-dev.18
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/package.json +5 -5
- package/src/call.js +8 -3
- package/src/observation.js +5 -0
- package/src/state.js +2 -2
- package/src/transition.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/core",
|
|
3
|
-
"version": "0.20.0-dev.
|
|
3
|
+
"version": "0.20.0-dev.18",
|
|
4
4
|
"description": "Toa Core",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@rsql/parser": "1.2.4",
|
|
23
|
-
"@toa.io/console": "0.20.0-dev.
|
|
24
|
-
"@toa.io/generic": "0.20.0-dev.
|
|
25
|
-
"@toa.io/yaml": "0.20.0-dev.
|
|
23
|
+
"@toa.io/console": "0.20.0-dev.18",
|
|
24
|
+
"@toa.io/generic": "0.20.0-dev.18",
|
|
25
|
+
"@toa.io/yaml": "0.20.0-dev.18",
|
|
26
26
|
"clone-deep": "4.0.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "24c2fccf1af324fc4b0e32d5e3e012786618f5bb"
|
|
29
29
|
}
|
package/src/call.js
CHANGED
|
@@ -23,11 +23,16 @@ class Call extends Connector {
|
|
|
23
23
|
|
|
24
24
|
request.authentic = true
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const reply = await this.#transmitter.request(request)
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (reply === null) return null
|
|
29
|
+
else {
|
|
30
|
+
const { exception, ...rest } = reply
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
if (exception !== undefined) throw exception
|
|
33
|
+
|
|
34
|
+
return rest
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
|
package/src/observation.js
CHANGED
package/src/state.js
CHANGED
|
@@ -41,10 +41,10 @@ class State {
|
|
|
41
41
|
if (record === null) {
|
|
42
42
|
if (this.#initialized && query.id !== undefined && query.version === undefined) return this.init(query.id)
|
|
43
43
|
else if (query.version !== undefined) throw new StatePreconditionException()
|
|
44
|
-
else throw new StateNotFoundException()
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
if (record === null) return null
|
|
47
|
+
else return this.#entity.object(record)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async objects (query) {
|
package/src/transition.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { retry } = require('@toa.io/generic')
|
|
4
4
|
|
|
5
5
|
const { Operation } = require('./operation')
|
|
6
|
-
const { StateConcurrencyException } = require('./exceptions')
|
|
6
|
+
const { StateConcurrencyException, StateNotFoundException } = require('./exceptions')
|
|
7
7
|
|
|
8
8
|
class Transition extends Operation {
|
|
9
9
|
#concurrency
|
|
@@ -22,6 +22,9 @@ class Transition extends Operation {
|
|
|
22
22
|
const { request } = store
|
|
23
23
|
|
|
24
24
|
store.scope = request.query ? await this.query(request.query) : this.scope.init()
|
|
25
|
+
|
|
26
|
+
if (store.scope === null) throw new StateNotFoundException()
|
|
27
|
+
|
|
25
28
|
store.state = store.scope.get()
|
|
26
29
|
}
|
|
27
30
|
|