@toa.io/core 1.0.0-alpha.31 → 1.0.0-alpha.33
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/observation.js +0 -8
- package/src/operation.js +12 -1
- package/src/state.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.33",
|
|
4
4
|
"description": "Toa Core",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@rsql/parser": "1.2.4",
|
|
24
|
-
"@toa.io/console": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
26
|
-
"@toa.io/yaml": "1.0.0-alpha.
|
|
24
|
+
"@toa.io/console": "1.0.0-alpha.33",
|
|
25
|
+
"@toa.io/generic": "1.0.0-alpha.33",
|
|
26
|
+
"@toa.io/yaml": "1.0.0-alpha.33",
|
|
27
27
|
"error-value": "0.3.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"clone-deep": "4.0.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "ef81cea49d8f8b3b248adaba62d4548bbeb39f80"
|
|
33
33
|
}
|
package/src/observation.js
CHANGED
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
const { Operation } = require('./operation')
|
|
4
4
|
|
|
5
5
|
class Observation extends Operation {
|
|
6
|
-
async acquire (store) {
|
|
7
|
-
const scope = await this.query(store.request.query)
|
|
8
|
-
const state = scope === null ? null : scope.get()
|
|
9
|
-
|
|
10
|
-
store.scope = scope
|
|
11
|
-
store.state = state
|
|
12
|
-
}
|
|
13
|
-
|
|
14
6
|
async run (store) {
|
|
15
7
|
if (store.scope === null) store.reply = null
|
|
16
8
|
else await super.run(store)
|
package/src/operation.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { Connector } = require('./connector')
|
|
4
4
|
const { SystemException } = require('./exceptions')
|
|
5
|
+
const { Entity } = require('./entities/entity')
|
|
6
|
+
const { Readable } = require('node:stream')
|
|
5
7
|
|
|
6
8
|
class Operation extends Connector {
|
|
7
9
|
scope
|
|
@@ -47,7 +49,16 @@ class Operation extends Connector {
|
|
|
47
49
|
return store.reply
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
async acquire () {
|
|
52
|
+
async acquire (store) {
|
|
53
|
+
if (this.#scope === 'none')
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
const scope = await this.query(store.request.query)
|
|
57
|
+
const raw = scope === null || scope instanceof Readable
|
|
58
|
+
|
|
59
|
+
store.scope = scope
|
|
60
|
+
store.state = raw ? scope : scope.get()
|
|
61
|
+
}
|
|
51
62
|
|
|
52
63
|
async run (store) {
|
|
53
64
|
const { request, state } = store
|