@zerodensity/realityhub-api 1.21.0 → 1.22.0

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.
@@ -12,6 +12,7 @@ const { EventEmitter } = require('node:events');
12
12
  * @property {*} data
13
13
  * @property {string|null} [error]
14
14
  * @property {boolean} [stale]
15
+ * @property {string} [status] `disabled` when the host intentionally stops source traffic.
15
16
  *
16
17
  * @typedef {Object} Subscription
17
18
  * @property {function(): void} stop
@@ -34,6 +35,7 @@ const { EventEmitter } = require('node:events');
34
35
  * @property {function(Object|null): Promise<Snapshot>} setState
35
36
  * @property {function(Function): void} schedule Queue background work after the current handler/startup.
36
37
  * @property {Object} data Named query bindings configured on the field.
38
+ * @property {boolean} data.enabled Whether bound query traffic is enabled for this field.
37
39
  * @property {function(string, Object=): Promise<DataSnapshot>} data.request
38
40
  * @property {function(string, Object, Function, Function=): Subscription} data.subscribe Legacy direct callbacks.
39
41
  * @property {function(string, Object, Function, Function=): Watch} data.watch Await callbacks in the handler queue.
@@ -173,6 +175,7 @@ function createBackendRuntime({ snapshot: initial, context = {}, request, emit }
173
175
  enqueue(operation).catch(report);
174
176
  },
175
177
  data: {
178
+ enabled: context.dataSourceEnabled !== false,
176
179
  request: (query, parameters = {}) => request('data.request', { query, parameters }),
177
180
  subscribe,
178
181
  watch,
@@ -11,6 +11,7 @@ const copy = (value) => JSON.parse(JSON.stringify(value));
11
11
  * @property {Object} context
12
12
  * @property {boolean} backend
13
13
  * @property {boolean} paused
14
+ * @property {boolean} dataSourceEnabled
14
15
  * @property {'connecting'|'connected'|'disconnected'|'closed'|'error'} connection
15
16
  * @property {string|null} error
16
17
  *
@@ -58,6 +59,7 @@ function createClient({ window: target = window, timeoutMs = 15000 } = {}) {
58
59
  context: {},
59
60
  backend: Boolean(backend),
60
61
  paused: false,
62
+ dataSourceEnabled: true,
61
63
  connection: 'connecting',
62
64
  error: null,
63
65
  };
@@ -176,6 +178,7 @@ function createClient({ window: target = window, timeoutMs = 15000 } = {}) {
176
178
  readOnly: Boolean(message.readOnly),
177
179
  context: message.context || {},
178
180
  paused: Boolean(message.paused),
181
+ dataSourceEnabled: message.dataSourceEnabled !== false,
179
182
  connection: backend ? backendConnection : 'connected',
180
183
  ...(!backend ? { state: message.state || null, value: message.value === undefined ? null : message.value } : {}),
181
184
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodensity/realityhub-api",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "RealityHub API Javascript Implementation",
5
5
  "main": "src/index.js",
6
6
  "repository": {