@toa.io/core 1.0.0-alpha.32 → 1.0.0-alpha.34

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": "1.0.0-alpha.32",
3
+ "version": "1.0.0-alpha.34",
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.32",
25
- "@toa.io/generic": "1.0.0-alpha.32",
26
- "@toa.io/yaml": "1.0.0-alpha.32",
24
+ "@toa.io/console": "1.0.0-alpha.34",
25
+ "@toa.io/generic": "1.0.0-alpha.34",
26
+ "@toa.io/yaml": "1.0.0-alpha.34",
27
27
  "error-value": "0.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "clone-deep": "4.0.1"
31
31
  },
32
- "gitHead": "93ceb53797363abb77eb9c550db77e906691d42a"
32
+ "gitHead": "caf71c04ebd589ff54a25f533b975484aaf9a254"
33
33
  }
@@ -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
package/src/state.js CHANGED
@@ -46,6 +46,10 @@ class State {
46
46
  return this.#entity.objects(recordset)
47
47
  }
48
48
 
49
+ async stream (query) {
50
+ return this.#storage.stream(query)
51
+ }
52
+
49
53
  changeset (query) {
50
54
  return this.#entity.changeset(query)
51
55
  }