@reddb-io/sdk 1.43.21 → 1.44.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
@@ -240,9 +240,14 @@ other `QUERY_ERROR` propagates on the first attempt.
240
240
 
241
241
  | URI | Mode |
242
242
  |----------------------------|--------------------------------------|
243
- | `memory://` | Ephemeral, in-memory database |
243
+ | `memory://` | Private RAM-backed database |
244
+ | `tmp://` | Private temporary `.rdb` removed on normal close |
244
245
  | `file:///absolute/path` | Embedded engine, persisted to disk |
245
246
 
247
+ Use `tmp://` for the temporary-file behavior previously used by `memory://`.
248
+ Set `REDDB_MEMORY_BUDGET` to configure the engine's memory budget, for example `256MiB`.
249
+ The SDK and the native addon or `red` executable must come from the same release.
250
+
246
251
  Remote URIs such as `http://...`, `red://...`, and `grpc://...` are rejected
247
252
  with `EMBEDDED_ONLY`. Use `@reddb-io/client` for those transports.
248
253
 
package/index.d.ts CHANGED
@@ -570,7 +570,8 @@ export class RedDB {
570
570
  * Connect to a RedDB instance.
571
571
  *
572
572
  * Accepted URI schemes:
573
- * - `memory://` — ephemeral in-memory database
573
+ * - `memory://` — ephemeral RAM-backed database
574
+ * - `tmp://` — ephemeral file-backed database
574
575
  * - `file:///absolute/path` — embedded, persisted to disk
575
576
  *
576
577
  * Remote URI schemes throw `EMBEDDED_ONLY`; use @reddb-io/client.
@@ -608,7 +609,7 @@ export interface ParsedUri {
608
609
  originalUri: string
609
610
  }
610
611
 
611
- /** Parse any URI (red://, memory://, file://, grpc://, http(s)://) into a normalised shape. */
612
+ /** Parse any URI (red://, memory://, tmp://, file://, grpc://, http(s)://) into a normalised shape. */
612
613
  export function parseUri(uri: string): ParsedUri
613
614
 
614
615
  /** Derive the HTTP `/auth/login` URL from a parsed URI. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/sdk",
3
- "version": "1.43.21",
3
+ "version": "1.44.0",
4
4
  "description": "Official embedded RedDB SDK — launches a local red binary over stdio JSON-RPC. The binary arrives as a per-platform optionalDependency — no install script. Use @reddb-io/client for remote HTTP, gRPC, and RedWire.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -43,11 +43,11 @@
43
43
  "url": "https://github.com/reddb-io/reddb/issues"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@reddb-io/red-linux-x64": "1.43.21",
47
- "@reddb-io/red-linux-x64-musl": "1.43.21",
48
- "@reddb-io/red-linux-arm64": "1.43.21",
49
- "@reddb-io/red-linux-arm64-musl": "1.43.21",
50
- "@reddb-io/red-win32-x64": "1.43.21"
46
+ "@reddb-io/red-linux-x64": "1.44.0",
47
+ "@reddb-io/red-linux-x64-musl": "1.44.0",
48
+ "@reddb-io/red-linux-arm64": "1.44.0",
49
+ "@reddb-io/red-linux-arm64-musl": "1.44.0",
50
+ "@reddb-io/red-win32-x64": "1.44.0"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "node --test test/ask.test.mjs test/cache.test.mjs test/db-helpers.test.mjs test/embedded-only.test.mjs test/helpers.test.mjs test/insert-ids.test.mjs test/kv.test.mjs test/params.test.mjs test/platform-binary.test.mjs test/native-engine.test.mjs test/queue.test.mjs test/redwire.params.test.mjs test/transaction.test.mjs test/url.test.mjs && node test/smoke.test.mjs && node test/conformance.test.mjs && node test/readme-examples.test.mjs"
package/src/index.js CHANGED
@@ -277,8 +277,9 @@ function normalizeResult(value) {
277
277
  }
278
278
 
279
279
  function embeddedArgs(parsed) {
280
+ if (parsed.path === 'tmp://') return ['rpc', '--stdio', '--temporary']
280
281
  if (parsed.path) return ['rpc', '--stdio', '--path', parsed.path]
281
- return ['rpc', '--stdio']
282
+ return ['rpc', '--stdio', '--memory']
282
283
  }
283
284
 
284
285
  /**
package/src/url.js CHANGED
@@ -140,6 +140,9 @@ export function parseLegacyUrl(uri) {
140
140
  if (uri === 'memory://' || uri === 'memory:') {
141
141
  return { kind: 'embedded', originalUri: uri }
142
142
  }
143
+ if (uri === 'tmp://' || uri === 'tmp:') {
144
+ return { kind: 'embedded', path: 'tmp://', originalUri: uri }
145
+ }
143
146
  if (uri.startsWith('file://')) {
144
147
  const path = uri.slice('file://'.length)
145
148
  if (!path) {
@@ -203,7 +206,7 @@ export function parseLegacyUrl(uri) {
203
206
  }
204
207
  throw new RedDBError(
205
208
  'UNSUPPORTED_SCHEME',
206
- `unsupported URI: '${uri}'. Use 'red://...' or one of memory://, file://, grpc://, http(s)://`,
209
+ `unsupported URI: '${uri}'. Use 'red://...' or one of memory://, tmp://, file://, grpc://, http(s)://`,
207
210
  )
208
211
  }
209
212