@reddb-io/cli 1.7.0 → 1.9.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/sdk",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Official embedded RedDB SDK — launches a local red binary over stdio JSON-RPC. Use @reddb-io/client for remote HTTP, gRPC, and RedWire.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -46,6 +46,35 @@ export class QueueClient {
46
46
  sql: `QUEUE PURGE ${queueIdentifier(queue)}`,
47
47
  })
48
48
  }
49
+
50
+ // Live `QUEUE READ … WAIT <ms>` helper (PRD #718 / #725). Blocks until
51
+ // a message is available for `consumer` on `queue` (optionally scoped
52
+ // to `group`), the wait budget elapses, or the server cancels.
53
+ //
54
+ // Timeout returns the same empty array as a non-waiting empty pop —
55
+ // never an exception. `waitMs` is required; there is no infinite-wait
56
+ // default. Server-side cancellation, transport cancellation, and cap
57
+ // rejection surface as RedDBErrors from the transport path.
58
+ async readWait(queue, consumer, options = {}) {
59
+ const sql = buildQueueReadWaitSql(queue, consumer, options)
60
+ const result = await this.client.call('query', { sql })
61
+ return queuePayloads(result)
62
+ }
63
+ }
64
+
65
+ function buildQueueReadWaitSql(queue, consumer, options) {
66
+ const { waitMs, group = null, count = null } = options ?? {}
67
+ if (!Number.isInteger(waitMs) || waitMs < 0) {
68
+ throw new RedDBError(
69
+ 'INVALID_QUEUE_WAIT',
70
+ 'queue readWait requires an explicit non-negative integer waitMs (no infinite wait)',
71
+ )
72
+ }
73
+ const q = queueIdentifier(queue)
74
+ const c = queueIdentifier(consumer)
75
+ const g = group != null ? ` GROUP ${queueIdentifier(group)}` : ''
76
+ const n = count != null ? queueCount(count) : ''
77
+ return `QUEUE READ ${q}${g} CONSUMER ${c}${n} WAIT ${waitMs}ms`
49
78
  }
50
79
 
51
80
  function queueIdentifier(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/cli",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "CLI launcher for RedDB. The JS/TS app driver is published as @reddb-io/sdk.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "scripts": {
38
38
  "postinstall": "node drivers/js/cli-postinstall.js",
39
- "test": "node drivers/js/test/smoke.test.mjs",
39
+ "test": "node scripts/docs-analytics-boundaries.test.mjs && node drivers/js/test/smoke.test.mjs",
40
40
  "typecheck": "cargo check --workspace --locked",
41
41
  "lint": "cargo fmt --all -- --check && cargo clippy --workspace --locked -- -D warnings",
42
42
  "build": "cargo build --workspace --locked",