@push.rocks/smartdb 2.7.1 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartdb",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "private": false,
5
5
  "description": "A MongoDB-compatible embedded database server with wire protocol support, backed by a high-performance Rust engine.",
6
6
  "exports": {
package/readme.md CHANGED
@@ -290,10 +290,12 @@ await client.connect();
290
290
 
291
291
  TLS is available for TCP listeners. `getConnectionUri()` includes `?tls=true` when TLS is enabled; pass the trusted CA to the MongoDB driver with `tlsCAFile`, `ca`, or `secureContext`.
292
292
 
293
- Authentication verifies SCRAM credentials, denies unauthenticated commands, and enforces command-level built-in roles for supported operations.
293
+ Authentication verifies SCRAM credentials, denies unauthenticated commands, and enforces command-level built-in roles for supported operations. `connectionStatus` reports the authenticated users and roles for the current socket.
294
294
 
295
295
  Supported built-in role names are `root`, `read`, `readWrite`, `dbAdmin`, `userAdmin`, `clusterMonitor`, plus `readAnyDatabase`, `readWriteAnyDatabase`, `dbAdminAnyDatabase`, and `userAdminAnyDatabase`. When `usersPath` is set, SmartDB persists SCRAM credential material atomically and does not store plaintext passwords.
296
296
 
297
+ Single-node transactions are supported through official MongoDB driver sessions. Writes with `startTransaction` and `autocommit: false` are buffered per logical session, reads inside the transaction see the buffered overlay, `commitTransaction` applies the write set with conflict checks, and `abortTransaction` discards it.
298
+
297
299
  Basic user management commands are available for authenticated users with `root` or `userAdmin` privileges:
298
300
 
299
301
  ```typescript
@@ -317,7 +319,7 @@ await client.db('admin').command({ usersInfo: 'reader' });
317
319
  | `port` | `number` | Configured port (TCP mode) |
318
320
  | `host` | `string` | Configured host (TCP mode) |
319
321
  | `socketPath` | `string \| undefined` | Socket path (socket mode) |
320
- | `getMetrics()` | `Promise<ISmartDbMetrics>` | Server metrics (db/collection counts, uptime) |
322
+ | `getMetrics()` | `Promise<ISmartDbMetrics>` | Server metrics (db/collection counts, sessions, transactions, auth, uptime) |
321
323
  | `getOpLog(params?)` | `Promise<IOpLogResult>` | Query oplog entries with optional filters |
322
324
  | `getOpLogStats()` | `Promise<IOpLogStats>` | Aggregate oplog statistics |
323
325
  | `revertToSeq(seq, dryRun?)` | `Promise<IRevertResult>` | Revert to a specific oplog sequence |
@@ -531,7 +533,7 @@ const names = await collection.distinct('name');
531
533
  | **Aggregation** | `aggregate`, `count`, `distinct` |
532
534
  | **Indexes** | `createIndexes`, `dropIndexes`, `listIndexes` |
533
535
  | **Sessions** | `startSession`, `endSessions` |
534
- | **Transactions** | `commitTransaction`, `abortTransaction` |
536
+ | **Transactions** | `startTransaction`, `commitTransaction`, `abortTransaction` through driver sessions |
535
537
  | **Admin** | `ping`, `listDatabases`, `listCollections`, `drop`, `dropDatabase`, `create`, `serverStatus`, `buildInfo`, `dbStats`, `collStats`, `connectionStatus`, `currentOp`, `renameCollection` |
536
538
 
537
539
  Compatible with wire protocol versions 0–21 (driver versions 3.6 through 7.0).
@@ -540,7 +542,7 @@ Compatible with wire protocol versions 0–21 (driver versions 3.6 through 7.0).
540
542
 
541
543
  ## Rust Crate Architecture 🦀
542
544
 
543
- The Rust engine is organized as a Cargo workspace with 8 focused crates:
545
+ The Rust engine is organized as a Cargo workspace with 9 focused crates:
544
546
 
545
547
  | Crate | Purpose |
546
548
  |---|---|
@@ -551,6 +553,7 @@ The Rust engine is organized as a Cargo workspace with 8 focused crates:
551
553
  | `rustdb-storage` | Storage backends (memory, file), OpLog with point-in-time replay |
552
554
  | `rustdb-index` | B-tree/hash indexes, query planner (IXSCAN/COLLSCAN) |
553
555
  | `rustdb-txn` | Transaction + session management with snapshot isolation |
556
+ | `rustdb-auth` | SCRAM-SHA-256 credential handling, user metadata persistence, RBAC checks |
554
557
  | `rustdb-commands` | 40+ command handlers wiring everything together |
555
558
 
556
559
  Cross-compiled for `linux_amd64` and `linux_arm64` via [@git.zone/tsrust](https://www.npmjs.com/package/@git.zone/tsrust).
@@ -563,6 +566,7 @@ The Bitcask-style file storage engine includes several reliability features:
563
566
  - **CRC32 checksums** — every record is integrity-checked on read
564
567
  - **Automatic compaction** — dead records are reclaimed when they exceed 50% of file size, runs on startup and after every write
565
568
  - **Hint file staleness detection** — the hint file records the data file size at write time; if data.rdb changed since (e.g. crash after a delete), the engine falls back to a full scan to ensure tombstones are not lost
569
+ - **Torn-tail repair** — startup scans `data.rdb` to the last valid record, truncates invalid trailing bytes, and preserves all verified records after interrupted writes
566
570
  - **Stale socket cleanup** — orphaned `/tmp/smartdb-*.sock` files from crashed instances are automatically cleaned up on startup
567
571
 
568
572
  ### Data Integrity CLI 🔍
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartdb',
6
- version: '2.7.1',
6
+ version: '2.8.0',
7
7
  description: 'A MongoDB-compatible embedded database server with wire protocol support, backed by a high-performance Rust engine.'
8
8
  }
@@ -76,6 +76,10 @@ export interface ISmartDbMetrics {
76
76
  collections: number;
77
77
  oplogEntries: number;
78
78
  oplogCurrentSeq: number;
79
+ sessions: number;
80
+ activeTransactions: number;
81
+ authEnabled: boolean;
82
+ authUsers: number;
79
83
  uptimeSeconds: number;
80
84
  }
81
85