@reddb-io/client 1.2.5 → 1.4.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.
package/README.md CHANGED
@@ -148,3 +148,30 @@ await connect('red://user:pass@host:5050')
148
148
  ## License
149
149
 
150
150
  MIT.
151
+
152
+ <!-- contract-matrix:begin -->
153
+ ## Public-surface support
154
+
155
+ > Generated from [`docs/conformance/public-surface-contract-matrix.json`](/docs/conformance/public-surface-contract-matrix.json) by `scripts/gen-docs-from-matrix.mjs`. Do not edit between the markers by hand — run `node scripts/gen-docs-from-matrix.mjs --write`. The matrix is the source of truth; this block can never claim more than it, and CI (`docs-matrix`) fails on drift.
156
+ >
157
+ > Driver-helper (SDK Helper Spec v1.0) support for every public promise. A helper not marked supported here is not promised by this driver.
158
+
159
+ | Promise | driver_helpers |
160
+ | --- | --- |
161
+ | **PSC-001** — RedDB is one multi-model database (tables, graph, KV, timeseries, probabilistic, vector, queue, documents) backed by a single file. | ✅ supported |
162
+ | **PSC-002** — MATCH supports node, edge, label, property, and LIMIT projections. | ✅ supported |
163
+ | **PSC-003** — GRAPH algorithms accept semantic identifiers, limits, ordering, and return stable rich rows. | ❌ unsupported |
164
+ | **PSC-004** — INSERT creates rows, documents, and native timeseries points. | ✅ supported |
165
+ | **PSC-005** — HLL/SKETCH/FILTER expose write and read commands for cardinality, frequency, and membership. | ⚠️ partial |
166
+ | **PSC-006** — Timeseries stores timestamped metrics with tags and supports query/readback. | ⚠️ partial |
167
+ | **PSC-007** — Documents are first-class: create, read, update, delete, and SQL analytics over JSON. | ✅ supported |
168
+ | **PSC-008** — KV helpers expose get/put/delete; get of a missing key returns null, delete reports affected. | ✅ supported |
169
+ | **PSC-009** — Queue helpers expose create/push/peek/pop/len/purge with FIFO semantics; empty pop is not an error. | ✅ supported |
170
+ | **PSC-010** — Transactions are imperative (begin/commit/rollback) plus a run(callback) form; empty SQL rejects with INVALID_ARGUMENT. | ✅ supported |
171
+ | **PSC-011** — SQL aggregate, projection, expression, and mutation behaviour matches ordinary SQL expectations where advertised. | ✅ supported |
172
+ | **PSC-012** — Server transports expose the same query contract as embedded (HTTP, RedWire, gRPC parity). | ✅ supported |
173
+ | **PSC-013** — Official drivers implement the SDK Helper Spec v1.0 conformance suite (all 22 §12 case IDs). | ✅ supported |
174
+ | **PSC-014** — ASK / SEARCH semantic surfaces return ranked results with stable shape. | ⚠️ partial |
175
+
176
+ _Status legend: ✅ supported · ⚠️ partial (known gaps) · ❌ unsupported._
177
+ <!-- contract-matrix:end -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/client",
3
- "version": "1.2.5",
3
+ "version": "1.4.0",
4
4
  "description": "Thin remote-only RedDB driver. Downloads the `red_client` binary on install. Speaks RedWire/gRPC/HTTP. Embedded URIs (memory://, file://, red:///path) are rejected — use @reddb-io/sdk for those.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/documents.js CHANGED
@@ -40,7 +40,10 @@ export class DocumentClient {
40
40
  validateObject(patch, 'documents.patch patch')
41
41
  const entries = Object.entries(patch)
42
42
  if (entries.length === 0) {
43
- return this.get(collection, rid)
43
+ throw new RedDBError(
44
+ 'INVALID_ARGUMENT',
45
+ 'documents.patch patch must be a non-empty object',
46
+ )
44
47
  }
45
48
  for (const [field] of entries) {
46
49
  if (field.includes('/')) {
@@ -66,7 +69,8 @@ export class DocumentClient {
66
69
 
67
70
  async delete(collection, rid) {
68
71
  const result = await this.db.delete(collection, rid)
69
- return { affected: result.affected ?? 0 }
72
+ const affected = result.affected ?? 0
73
+ return { affected, deleted: affected > 0 }
70
74
  }
71
75
 
72
76
  async ensureCollection(collection) {