@toa.io/core 0.20.0-dev.16 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/core",
3
- "version": "0.20.0-dev.16",
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.16",
24
- "@toa.io/generic": "0.20.0-dev.16",
25
- "@toa.io/yaml": "0.20.0-dev.16",
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": "ea33b54b708fe3f97949143c72c5e1d6606fd5ec"
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 { exception, ...reply } = await this.#transmitter.request(request)
26
+ const reply = await this.#transmitter.request(request)
27
27
 
28
- if (exception) throw exception
28
+ if (reply === null) return null
29
+ else {
30
+ const { exception, ...rest } = reply
29
31
 
30
- return reply
32
+ if (exception !== undefined) throw exception
33
+
34
+ return rest
35
+ }
31
36
  }
32
37
  }
33
38
 
@@ -14,6 +14,11 @@ class Observation extends Operation {
14
14
  store.scope = scope
15
15
  store.state = state
16
16
  }
17
+
18
+ async run (store) {
19
+ if (store.scope === null) store.reply = null
20
+ else await super.run(store)
21
+ }
17
22
  }
18
23
 
19
24
  exports.Observation = Observation
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
- return this.#entity.object(record)
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