🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@harperfast/rocksdb-js

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harperfast/rocksdb-js - npm Package Compare versions

Comparing version
0.1.2
to
0.1.3
+16
-8
dist/index.cjs

@@ -1,2 +0,3 @@

//#region rolldown:runtime
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region \0rolldown/runtime.js
var __create = Object.create;

@@ -82,4 +83,5 @@ var __defProp = Object.defineProperty;

const TransactionLog = binding.TransactionLog;
const registryStatus = binding.registryStatus;
const shutdown = binding.shutdown;
const version = binding.version;
const shutdown = binding.shutdown;

@@ -1103,3 +1105,2 @@ //#endregion

clear() {
if (!this.store.db.opened) return Promise.reject(/* @__PURE__ */ new Error("Database not open"));
if (this.store.encoder?.structures !== void 0) this.store.encoder.structures = [];

@@ -1120,5 +1121,4 @@ return new Promise((resolve, reject) => {

clearSync() {
if (!this.store.db.opened) throw new Error("Database not open");
if (this.store.encoder?.structures !== void 0) this.store.encoder.structures = [];
return this.store.db.clearSync();
this.store.db.clearSync();
}

@@ -1150,4 +1150,6 @@ /**

}
destroy() {
this.store.db.destroy();
}
async drop() {
if (!this.store.db.opened) return Promise.reject(/* @__PURE__ */ new Error("Database not open"));
return new Promise((resolve, reject) => {

@@ -1158,3 +1160,2 @@ this.store.db.drop(resolve, reject);

dropSync() {
if (!this.store.db.opened) throw new Error("Database not open");
return this.store.db.dropSync();

@@ -1418,2 +1419,8 @@ }

/**
* The status of the database.
*/
get status() {
return this.store.isOpen() ? "open" : "closed";
}
/**
* Executes all operations in the callback as a single transaction.

@@ -1807,3 +1814,3 @@ *

rocksdb: version,
"rocksdb-js": "0.1.2"
"rocksdb-js": "0.1.3"
};

@@ -1819,4 +1826,5 @@

exports.parseTransactionLog = parseTransactionLog;
exports.registryStatus = registryStatus;
exports.shutdown = shutdown;
exports.versions = versions;
//# sourceMappingURL=index.cjs.map

@@ -430,2 +430,3 @@ import { ExtendedIterable } from "@harperfast/extended-iterable";

close(): void;
destroy(): void;
drop(resolve: ResolveCallback<void>, reject: RejectCallback): void;

@@ -463,2 +464,13 @@ dropSync(): void;

};
type RegistryStatusDB = {
path: string;
refCount: number;
columnFamilies: string[];
transactions: number;
closables: number;
locks: number;
userSharedBuffers: number;
listenerCallbacks: number;
};
type RegistryStatus = RegistryStatusDB[];
declare const constants: {

@@ -475,2 +487,3 @@ TRANSACTION_LOG_TOKEN: number;

declare const TransactionLog: TransactionLog;
declare const registryStatus: () => RegistryStatus;
declare const shutdown: () => void;

@@ -899,2 +912,3 @@ //#endregion

static config(options: RocksDatabaseConfig): void;
destroy(): void;
drop(): Promise<void>;

@@ -1048,2 +1062,6 @@ dropSync(): void;

/**
* The status of the database.
*/
get status(): "open" | "closed";
/**
* Executes all operations in the callback as a single transaction.

@@ -1161,3 +1179,3 @@ *

//#endregion
export { type Context, DBIterator, type IteratorOptions, type Key, RocksDatabase, type RocksDatabaseOptions, Store, Transaction, type TransactionEntry, TransactionLog, constants, parseTransactionLog, shutdown, versions };
export { type Context, DBIterator, type IteratorOptions, type Key, RocksDatabase, type RocksDatabaseOptions, Store, Transaction, type TransactionEntry, TransactionLog, constants, parseTransactionLog, registryStatus, shutdown, versions };
//# sourceMappingURL=index.d.cts.map

@@ -430,2 +430,3 @@ import { ExtendedIterable } from "@harperfast/extended-iterable";

close(): void;
destroy(): void;
drop(resolve: ResolveCallback<void>, reject: RejectCallback): void;

@@ -463,2 +464,13 @@ dropSync(): void;

};
type RegistryStatusDB = {
path: string;
refCount: number;
columnFamilies: string[];
transactions: number;
closables: number;
locks: number;
userSharedBuffers: number;
listenerCallbacks: number;
};
type RegistryStatus = RegistryStatusDB[];
declare const constants: {

@@ -475,2 +487,3 @@ TRANSACTION_LOG_TOKEN: number;

declare const TransactionLog: TransactionLog;
declare const registryStatus: () => RegistryStatus;
declare const shutdown: () => void;

@@ -899,2 +912,3 @@ //#endregion

static config(options: RocksDatabaseConfig): void;
destroy(): void;
drop(): Promise<void>;

@@ -1048,2 +1062,6 @@ dropSync(): void;

/**
* The status of the database.
*/
get status(): "open" | "closed";
/**
* Executes all operations in the callback as a single transaction.

@@ -1161,3 +1179,3 @@ *

//#endregion
export { type Context, DBIterator, type IteratorOptions, type Key, RocksDatabase, type RocksDatabaseOptions, Store, Transaction, type TransactionEntry, TransactionLog, constants, parseTransactionLog, shutdown, versions };
export { type Context, DBIterator, type IteratorOptions, type Key, RocksDatabase, type RocksDatabaseOptions, Store, Transaction, type TransactionEntry, TransactionLog, constants, parseTransactionLog, registryStatus, shutdown, versions };
//# sourceMappingURL=index.d.mts.map

@@ -10,3 +10,3 @@ import { createRequire } from "node:module";

//#region rolldown:runtime
//#region \0rolldown/runtime.js
var __require = /* @__PURE__ */ createRequire(import.meta.url);

@@ -59,4 +59,5 @@

const TransactionLog = binding.TransactionLog;
const registryStatus = binding.registryStatus;
const shutdown = binding.shutdown;
const version = binding.version;
const shutdown = binding.shutdown;

@@ -1080,3 +1081,2 @@ //#endregion

clear() {
if (!this.store.db.opened) return Promise.reject(/* @__PURE__ */ new Error("Database not open"));
if (this.store.encoder?.structures !== void 0) this.store.encoder.structures = [];

@@ -1097,5 +1097,4 @@ return new Promise((resolve, reject) => {

clearSync() {
if (!this.store.db.opened) throw new Error("Database not open");
if (this.store.encoder?.structures !== void 0) this.store.encoder.structures = [];
return this.store.db.clearSync();
this.store.db.clearSync();
}

@@ -1127,4 +1126,6 @@ /**

}
destroy() {
this.store.db.destroy();
}
async drop() {
if (!this.store.db.opened) return Promise.reject(/* @__PURE__ */ new Error("Database not open"));
return new Promise((resolve, reject) => {

@@ -1135,3 +1136,2 @@ this.store.db.drop(resolve, reject);

dropSync() {
if (!this.store.db.opened) throw new Error("Database not open");
return this.store.db.dropSync();

@@ -1395,2 +1395,8 @@ }

/**
* The status of the database.
*/
get status() {
return this.store.isOpen() ? "open" : "closed";
}
/**
* Executes all operations in the callback as a single transaction.

@@ -1784,7 +1790,7 @@ *

rocksdb: version,
"rocksdb-js": "0.1.2"
"rocksdb-js": "0.1.3"
};
//#endregion
export { DBIterator, RocksDatabase, Store, Transaction, TransactionLog, constants, parseTransactionLog, shutdown, versions };
export { DBIterator, RocksDatabase, Store, Transaction, TransactionLog, constants, parseTransactionLog, registryStatus, shutdown, versions };
//# sourceMappingURL=index.mjs.map
{
"name": "@harperfast/rocksdb-js",
"version": "0.1.2",
"version": "0.1.3",
"description": "RocksDB binding for Node.js",

@@ -27,3 +27,3 @@ "license": "Apache-2.0",

"@rollup/plugin-replace": "6.0.3",
"@types/node": "25.1.0",
"@types/node": "25.2.0",
"@vitest/coverage-v8": "4.0.18",

@@ -33,9 +33,9 @@ "cross-env": "10.1.0",

"dprint": "0.51.1",
"lefthook": "2.0.16",
"lefthook": "2.1.0",
"lmdb": "3.5.1",
"node-gyp": "12.2.0",
"oxlint": "1.42.0",
"oxlint": "1.43.0",
"prebuildify": "6.0.1",
"semver": "7.7.3",
"tsdown": "0.20.1",
"tsdown": "0.20.2",
"tslib": "2.8.1",

@@ -50,3 +50,3 @@ "tsx": "4.21.0",

"rocksdb": {
"version": "10.9.1"
"version": "10.10.1"
},

@@ -65,10 +65,10 @@ "homepage": "https://github.com/HarperFast/rocksdb-js",

"optionalDependencies": {
"@harperfast/rocksdb-js-darwin-arm64": "0.1.2",
"@harperfast/rocksdb-js-darwin-x64": "0.1.2",
"@harperfast/rocksdb-js-linux-arm64-glibc": "0.1.2",
"@harperfast/rocksdb-js-linux-x64-glibc": "0.1.2",
"@harperfast/rocksdb-js-linux-arm64-musl": "0.1.2",
"@harperfast/rocksdb-js-linux-x64-musl": "0.1.2",
"@harperfast/rocksdb-js-win32-arm64": "0.1.2",
"@harperfast/rocksdb-js-win32-x64": "0.1.2"
"@harperfast/rocksdb-js-darwin-arm64": "0.1.3",
"@harperfast/rocksdb-js-darwin-x64": "0.1.3",
"@harperfast/rocksdb-js-linux-arm64-glibc": "0.1.3",
"@harperfast/rocksdb-js-linux-x64-glibc": "0.1.3",
"@harperfast/rocksdb-js-linux-arm64-musl": "0.1.3",
"@harperfast/rocksdb-js-linux-x64-musl": "0.1.3",
"@harperfast/rocksdb-js-win32-arm64": "0.1.3",
"@harperfast/rocksdb-js-win32-x64": "0.1.3"
},

@@ -86,3 +86,3 @@ "scripts": {

"clean": "node-gyp clean",
"coverage": "tsx scripts/coverage/main.ts",
"coverage": "tsx scripts/coverage/main.ts --no-file-parallelism",
"format": "dprint check",

@@ -93,8 +93,8 @@ "format:fix": "dprint fmt",

"rebuild:debug": "node-gyp rebuild --coverage --debug --verbose",
"test": "cross-env CI=1 node --expose-gc ./node_modules/vitest/vitest.mjs --reporter=verbose",
"test:bun": "cross-env CI=1 bun --bun --config=bunfig.toml ./node_modules/vitest/vitest.mjs --reporter=verbose",
"test:deno": "cross-env CI=1 deno run --allow-all --sloppy-imports ./node_modules/vitest/vitest.mjs",
"test:stress": "cross-env CI=1 node --expose-gc ./node_modules/vitest/vitest.mjs --reporter=verbose --config=vitest-stress.config.ts",
"test": "cross-env CI=1 node --expose-gc ./node_modules/vitest/vitest.mjs --reporter=verbose --no-file-parallelism",
"test:bun": "cross-env CI=1 bun --bun --config=bunfig.toml ./node_modules/vitest/vitest.mjs --reporter=verbose --no-file-parallelism",
"test:deno": "cross-env CI=1 deno run --allow-all --sloppy-imports ./node_modules/vitest/vitest.mjs --no-file-parallelism",
"test:stress": "cross-env CI=1 node --expose-gc ./node_modules/vitest/vitest.mjs --reporter=verbose --config=vitest-stress.config.ts --no-file-parallelism",
"type-check": "tsc --noEmit"
}
}

@@ -94,2 +94,22 @@ # rocksdb-js

### `db.isOpen(): boolean`
Returns `true` if the database is open, otherwise false.
```typescript
console.log(db.isOpen()); // true or false
```
### `db.name: string`
Returns the database column family's name.
```typescript
const db = new RocksDatabase('path/to/db');
console.log(db.name); // 'default'
const db2 = new RocksDatabase('path/to/db', { name: 'users' });
console.log(db.name); // 'users'
```
### `db.open(): RocksDatabase`

@@ -112,12 +132,8 @@

### `db.name: string`
### `db.status: 'opened' | 'closed'`
Returns the database column family's name.
Returns a string `'opened'` or `'closed'` indicating if the database is opened or closed.
```typescript
const db = new RocksDatabase('path/to/db');
console.log(db.name); // 'default'
const db2 = new RocksDatabase('path/to/db', { name: 'users' });
console.log(db.name); // 'users'
console.log(db.status);
```

@@ -161,2 +177,12 @@

### `db.destroy(): void`
Completely removes a database based on the `db` instance's path including all data, column families,
and files on disk.
```typescript
db.destroy();
console.log(fs.existsSync(db.path)); // false
```
### `db.drop(): Promise<void>`

@@ -853,2 +879,20 @@

### `registryStatus(): RegistryStatus`
Returns an array containing that status of all active RocksDB instances.
- `path: string` The database path.
- `refCount: number` The number of JavaScript database instances plus the registry's reference.
- `columnFamiles: string[]` A list of the database's column families.
- `transactions: number` The count of active transactions.
- `closables: number` The count of active database, transactions, and iterators.
- `locks: number` The count of active locks.
- `userSharedBuffers: number` The count of active user shared buffers.
- `listenerCallbacks: number` The count of in-flight callbacks.
```typescript
import { registryStatus } from '@harperfast/rocksdb-js';
console.log(registryStatus());
```
### `shutdown(): void`

@@ -865,2 +909,11 @@

### `versions: { 'rocksdb': string; 'rocksdb-js': string }`
Returns the `rocksdb-js` and RocksDB version.
```typescript
import { versions } from '@harperfast/rocksdb-js';
console.log(versions); // { "rocksdb": "10.10.1", "rocksdb-js": "0.1.2" }
```
## Custom Store

@@ -867,0 +920,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display