@reddb-io/cli 1.22.0 → 1.23.0-rc.301

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/README.md CHANGED
@@ -1,11 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <h1>🚀 RedDB</h1>
4
-
5
- <p>
6
- <strong>The AI-first multi-model database.</strong><br>
7
- Tables · Documents · Graphs · Vectors · KV · Time-series · Queues · All in one engine. Ask it anything.
8
- </p>
3
+ <img src="docs/hero.svg" alt="RedDB — the AI-first multi-model database. Tables, documents, graphs, vectors, KV, time-series and queues in one engine. Ask it anything." width="100%" />
9
4
 
10
5
  <p>
11
6
  <a href="https://github.com/reddb-io/reddb/releases"><img src="https://img.shields.io/github/v/release/reddb-io/reddb?style=for-the-badge&color=ff2056&labelColor=0b0b0d" alt="Release"></a>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/sdk",
3
- "version": "1.22.0",
3
+ "version": "1.23.0-rc.301",
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",
@@ -14,9 +14,9 @@ export class QueueClient {
14
14
  }
15
15
 
16
16
  push(queue, value, options = {}) {
17
- const priority = options.priority != null ? ` PRIORITY ${queuePriority(options.priority)}` : ''
17
+ const suffix = queuePushOptions(options)
18
18
  return this.client.call('query', {
19
- sql: `QUEUE PUSH ${queueIdentifier(queue)} ${queueValueLiteral(value)}${priority}`,
19
+ sql: `QUEUE PUSH ${queueIdentifier(queue)} ${queueValueLiteral(value)}${suffix}`,
20
20
  })
21
21
  }
22
22
 
@@ -103,13 +103,33 @@ function queuePriority(priority) {
103
103
  return String(priority)
104
104
  }
105
105
 
106
+ function queuePushOptions(options) {
107
+ if (options.key != null && (options.delay != null || options.at != null)) {
108
+ throw new RedDBError(
109
+ 'INVALID_ARGUMENT',
110
+ 'QUEUE PUSH KEY cannot be combined with DELAY / AVAILABLE AT',
111
+ )
112
+ }
113
+ let suffix = ''
114
+ if (options.priority != null) suffix += ` PRIORITY ${queuePriority(options.priority)}`
115
+ if (options.key != null) suffix += ` KEY ${queueStringLiteral(options.key)}`
116
+ if (options.dedup != null) suffix += ` DEDUP ${queueStringLiteral(options.dedup)}`
117
+ if (options.delay != null) suffix += ` DELAY ${options.delay}`
118
+ if (options.at != null) suffix += ` AVAILABLE AT ${options.at}`
119
+ return suffix
120
+ }
121
+
106
122
  function queueValueLiteral(value) {
107
123
  if (typeof value === 'number' || typeof value === 'boolean') return String(value)
108
124
  if (value == null) return 'NULL'
109
- if (typeof value === 'string') return `'${value.replace(/'/g, "''")}'`
125
+ if (typeof value === 'string') return queueStringLiteral(value)
110
126
  return JSON.stringify(value)
111
127
  }
112
128
 
129
+ function queueStringLiteral(value) {
130
+ return `'${String(value).replace(/'/g, "''")}'`
131
+ }
132
+
113
133
  function queuePayloads(result) {
114
134
  return Array.isArray(result?.rows) ? result.rows.map((row) => row.payload) : []
115
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/cli",
3
- "version": "1.22.0",
3
+ "version": "1.23.0-rc.301",
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": {