@harperfast/rocksdb-js 1.4.2 → 1.5.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 +26 -1
- package/dist/index.cjs +59 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.mjs +59 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -1146,6 +1146,48 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
1146
1146
|
* ```
|
|
1147
1147
|
*/
|
|
1148
1148
|
static config(options: RocksDatabaseConfig): void;
|
|
1149
|
+
/**
|
|
1150
|
+
* Registers a process-wide event listener. Internal events emitted by the
|
|
1151
|
+
* native binding use namespaced keys (e.g. `'transactionLog:warning'`).
|
|
1152
|
+
*
|
|
1153
|
+
* Listeners are not tied to any specific database — they fire for every
|
|
1154
|
+
* matching event emitted in this process.
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* ```typescript
|
|
1158
|
+
* RocksDatabase.on('transactionLog:warning', (warning) => {
|
|
1159
|
+
* console.warn(warning);
|
|
1160
|
+
* });
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1163
|
+
static on(event: string, callback: (...args: any[]) => void): void;
|
|
1164
|
+
/**
|
|
1165
|
+
* Alias for {@link RocksDatabase.on}, mirroring the Node `EventEmitter` API.
|
|
1166
|
+
*/
|
|
1167
|
+
static addListener(event: string, callback: (...args: any[]) => void): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Removes a previously-registered process-wide event listener. The
|
|
1170
|
+
* callback identity must match the one passed to {@link RocksDatabase.on}.
|
|
1171
|
+
*
|
|
1172
|
+
* @returns `true` if a matching listener was removed.
|
|
1173
|
+
*/
|
|
1174
|
+
static off(event: string, callback: (...args: any[]) => void): boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Alias for {@link RocksDatabase.off}, mirroring the Node `EventEmitter` API.
|
|
1177
|
+
*/
|
|
1178
|
+
static removeListener(event: string, callback: (...args: any[]) => void): boolean;
|
|
1179
|
+
/**
|
|
1180
|
+
* Returns the number of process-wide listeners registered for the given event.
|
|
1181
|
+
*/
|
|
1182
|
+
static listenerCount(event: string): number;
|
|
1183
|
+
/**
|
|
1184
|
+
* Emits a process-wide event. Mostly intended for tests and as a peer to
|
|
1185
|
+
* {@link RocksDatabase.on} — native code should call `emitGlobalEvent` in
|
|
1186
|
+
* `napi/global_events.h` directly rather than round-tripping through JS.
|
|
1187
|
+
*
|
|
1188
|
+
* @returns `true` if there was at least one listener.
|
|
1189
|
+
*/
|
|
1190
|
+
static notify(event: string, ...args: any[]): boolean;
|
|
1149
1191
|
destroy(): void;
|
|
1150
1192
|
drop(): Promise<void>;
|
|
1151
1193
|
dropSync(): void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1146,6 +1146,48 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
1146
1146
|
* ```
|
|
1147
1147
|
*/
|
|
1148
1148
|
static config(options: RocksDatabaseConfig): void;
|
|
1149
|
+
/**
|
|
1150
|
+
* Registers a process-wide event listener. Internal events emitted by the
|
|
1151
|
+
* native binding use namespaced keys (e.g. `'transactionLog:warning'`).
|
|
1152
|
+
*
|
|
1153
|
+
* Listeners are not tied to any specific database — they fire for every
|
|
1154
|
+
* matching event emitted in this process.
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* ```typescript
|
|
1158
|
+
* RocksDatabase.on('transactionLog:warning', (warning) => {
|
|
1159
|
+
* console.warn(warning);
|
|
1160
|
+
* });
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1163
|
+
static on(event: string, callback: (...args: any[]) => void): void;
|
|
1164
|
+
/**
|
|
1165
|
+
* Alias for {@link RocksDatabase.on}, mirroring the Node `EventEmitter` API.
|
|
1166
|
+
*/
|
|
1167
|
+
static addListener(event: string, callback: (...args: any[]) => void): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Removes a previously-registered process-wide event listener. The
|
|
1170
|
+
* callback identity must match the one passed to {@link RocksDatabase.on}.
|
|
1171
|
+
*
|
|
1172
|
+
* @returns `true` if a matching listener was removed.
|
|
1173
|
+
*/
|
|
1174
|
+
static off(event: string, callback: (...args: any[]) => void): boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Alias for {@link RocksDatabase.off}, mirroring the Node `EventEmitter` API.
|
|
1177
|
+
*/
|
|
1178
|
+
static removeListener(event: string, callback: (...args: any[]) => void): boolean;
|
|
1179
|
+
/**
|
|
1180
|
+
* Returns the number of process-wide listeners registered for the given event.
|
|
1181
|
+
*/
|
|
1182
|
+
static listenerCount(event: string): number;
|
|
1183
|
+
/**
|
|
1184
|
+
* Emits a process-wide event. Mostly intended for tests and as a peer to
|
|
1185
|
+
* {@link RocksDatabase.on} — native code should call `emitGlobalEvent` in
|
|
1186
|
+
* `napi/global_events.h` directly rather than round-tripping through JS.
|
|
1187
|
+
*
|
|
1188
|
+
* @returns `true` if there was at least one listener.
|
|
1189
|
+
*/
|
|
1190
|
+
static notify(event: string, ...args: any[]): boolean;
|
|
1149
1191
|
destroy(): void;
|
|
1150
1192
|
drop(): Promise<void>;
|
|
1151
1193
|
dropSync(): void;
|
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,10 @@ function locateBinding() {
|
|
|
55
55
|
}
|
|
56
56
|
const binding = req(locateBinding());
|
|
57
57
|
const config = binding.config;
|
|
58
|
+
const addGlobalListener = binding.addListener;
|
|
59
|
+
const removeGlobalListener = binding.removeListener;
|
|
60
|
+
const globalListenerCount = binding.listenerCount;
|
|
61
|
+
const globalNotify = binding.notify;
|
|
58
62
|
const constants = binding.constants;
|
|
59
63
|
const NativeDatabase = binding.Database;
|
|
60
64
|
const NativeIterator = binding.Iterator;
|
|
@@ -1361,6 +1365,60 @@ var RocksDatabase = class RocksDatabase extends DBI {
|
|
|
1361
1365
|
static config(options) {
|
|
1362
1366
|
config(options);
|
|
1363
1367
|
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Registers a process-wide event listener. Internal events emitted by the
|
|
1370
|
+
* native binding use namespaced keys (e.g. `'transactionLog:warning'`).
|
|
1371
|
+
*
|
|
1372
|
+
* Listeners are not tied to any specific database — they fire for every
|
|
1373
|
+
* matching event emitted in this process.
|
|
1374
|
+
*
|
|
1375
|
+
* @example
|
|
1376
|
+
* ```typescript
|
|
1377
|
+
* RocksDatabase.on('transactionLog:warning', (warning) => {
|
|
1378
|
+
* console.warn(warning);
|
|
1379
|
+
* });
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
static on(event, callback) {
|
|
1383
|
+
addGlobalListener(event, callback);
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Alias for {@link RocksDatabase.on}, mirroring the Node `EventEmitter` API.
|
|
1387
|
+
*/
|
|
1388
|
+
static addListener(event, callback) {
|
|
1389
|
+
addGlobalListener(event, callback);
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* Removes a previously-registered process-wide event listener. The
|
|
1393
|
+
* callback identity must match the one passed to {@link RocksDatabase.on}.
|
|
1394
|
+
*
|
|
1395
|
+
* @returns `true` if a matching listener was removed.
|
|
1396
|
+
*/
|
|
1397
|
+
static off(event, callback) {
|
|
1398
|
+
return removeGlobalListener(event, callback);
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Alias for {@link RocksDatabase.off}, mirroring the Node `EventEmitter` API.
|
|
1402
|
+
*/
|
|
1403
|
+
static removeListener(event, callback) {
|
|
1404
|
+
return removeGlobalListener(event, callback);
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Returns the number of process-wide listeners registered for the given event.
|
|
1408
|
+
*/
|
|
1409
|
+
static listenerCount(event) {
|
|
1410
|
+
return globalListenerCount(event);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Emits a process-wide event. Mostly intended for tests and as a peer to
|
|
1414
|
+
* {@link RocksDatabase.on} — native code should call `emitGlobalEvent` in
|
|
1415
|
+
* `napi/global_events.h` directly rather than round-tripping through JS.
|
|
1416
|
+
*
|
|
1417
|
+
* @returns `true` if there was at least one listener.
|
|
1418
|
+
*/
|
|
1419
|
+
static notify(event, ...args) {
|
|
1420
|
+
return globalNotify(event, args);
|
|
1421
|
+
}
|
|
1364
1422
|
destroy() {
|
|
1365
1423
|
this.store.db.destroy();
|
|
1366
1424
|
}
|
|
@@ -2107,7 +2165,7 @@ function loadLastPosition(transactionLog, readUncommitted) {
|
|
|
2107
2165
|
//#region src/index.ts
|
|
2108
2166
|
const versions = {
|
|
2109
2167
|
rocksdb: version,
|
|
2110
|
-
"rocksdb-js": "1.
|
|
2168
|
+
"rocksdb-js": "1.5.0"
|
|
2111
2169
|
};
|
|
2112
2170
|
|
|
2113
2171
|
//#endregion
|