@dbcube/core 5.1.13 → 5.1.15
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/dist/index.cjs +337 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +332 -58
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -11,8 +11,27 @@ export declare class Engine {
|
|
|
11
11
|
private arguments;
|
|
12
12
|
private binary;
|
|
13
13
|
private timeout;
|
|
14
|
+
private daemonFailed;
|
|
14
15
|
constructor(name: string, timeout?: number);
|
|
15
16
|
initializeBinary(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a connected DaemonClient for this database, or null when
|
|
19
|
+
* daemon mode is disabled/unavailable (then callers use spawn mode).
|
|
20
|
+
*/
|
|
21
|
+
private getDaemon;
|
|
22
|
+
/**
|
|
23
|
+
* Executes a DML plan. Uses the persistent daemon (sub-millisecond
|
|
24
|
+
* overhead) when available; falls back to one-shot spawn otherwise.
|
|
25
|
+
*/
|
|
26
|
+
executeDml(dml: object, txId?: string): Promise<ResponseEngine>;
|
|
27
|
+
/**
|
|
28
|
+
* Executes raw SQL (or a MongoDB command document) with bound parameters.
|
|
29
|
+
*/
|
|
30
|
+
rawQuery(query: string, params?: any[], txId?: string): Promise<ResponseEngine>;
|
|
31
|
+
/** Starts a transaction (daemon mode only). Returns the transaction id. */
|
|
32
|
+
beginTransaction(): Promise<string>;
|
|
33
|
+
commitTransaction(txId: string): Promise<void>;
|
|
34
|
+
rollbackTransaction(txId: string): Promise<void>;
|
|
16
35
|
setArguments(): any[];
|
|
17
36
|
setConfig(name: string): {
|
|
18
37
|
[x: string]: any;
|
|
@@ -202,6 +221,57 @@ export declare class Config {
|
|
|
202
221
|
*/
|
|
203
222
|
getAllDatabases(): Record<string, DatabaseConfig$1>;
|
|
204
223
|
}
|
|
224
|
+
export interface DaemonResponse {
|
|
225
|
+
status: number;
|
|
226
|
+
message: string;
|
|
227
|
+
data: any;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* TCP client for the query-engine daemon (server mode).
|
|
231
|
+
*
|
|
232
|
+
* Instead of spawning a new engine process per query (30-80ms overhead),
|
|
233
|
+
* the daemon keeps the engine alive with warm connection pools and serves
|
|
234
|
+
* requests over a local TCP socket in <1ms. One daemon per database name.
|
|
235
|
+
*/
|
|
236
|
+
export declare class DaemonClient {
|
|
237
|
+
private static registry;
|
|
238
|
+
private name;
|
|
239
|
+
private binaryPath;
|
|
240
|
+
private engineArgs;
|
|
241
|
+
private socket;
|
|
242
|
+
private buffer;
|
|
243
|
+
private pending;
|
|
244
|
+
private starting;
|
|
245
|
+
private requestTimeout;
|
|
246
|
+
private constructor();
|
|
247
|
+
static get(name: string, binaryPath: string, engineArgs: string[]): DaemonClient;
|
|
248
|
+
static isEnabled(): boolean;
|
|
249
|
+
private portfilePath;
|
|
250
|
+
/**
|
|
251
|
+
* Ensures a usable daemon connection. Returns false when the daemon
|
|
252
|
+
* can't be used (old binary, startup failure) so callers fall back
|
|
253
|
+
* to one-shot spawn mode.
|
|
254
|
+
*/
|
|
255
|
+
ensure(): Promise<boolean>;
|
|
256
|
+
private connectOrStart;
|
|
257
|
+
private readPortfile;
|
|
258
|
+
private spawnDaemon;
|
|
259
|
+
private tryConnect;
|
|
260
|
+
private attach;
|
|
261
|
+
private detach;
|
|
262
|
+
private onData;
|
|
263
|
+
/**
|
|
264
|
+
* Sends a request to the daemon. Responses arrive in FIFO order on the
|
|
265
|
+
* single socket, so pending requests resolve in send order.
|
|
266
|
+
*/
|
|
267
|
+
send(payload: Record<string, any>): Promise<DaemonResponse>;
|
|
268
|
+
execute(dml: object, txId?: string): Promise<DaemonResponse>;
|
|
269
|
+
raw(query: string, params?: any[], txId?: string): Promise<DaemonResponse>;
|
|
270
|
+
begin(): Promise<string>;
|
|
271
|
+
commit(txId: string): Promise<void>;
|
|
272
|
+
rollback(txId: string): Promise<void>;
|
|
273
|
+
shutdown(): Promise<void>;
|
|
274
|
+
}
|
|
205
275
|
export interface InterceptOptions {
|
|
206
276
|
interceptLog?: boolean;
|
|
207
277
|
interceptError?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,27 @@ export declare class Engine {
|
|
|
11
11
|
private arguments;
|
|
12
12
|
private binary;
|
|
13
13
|
private timeout;
|
|
14
|
+
private daemonFailed;
|
|
14
15
|
constructor(name: string, timeout?: number);
|
|
15
16
|
initializeBinary(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a connected DaemonClient for this database, or null when
|
|
19
|
+
* daemon mode is disabled/unavailable (then callers use spawn mode).
|
|
20
|
+
*/
|
|
21
|
+
private getDaemon;
|
|
22
|
+
/**
|
|
23
|
+
* Executes a DML plan. Uses the persistent daemon (sub-millisecond
|
|
24
|
+
* overhead) when available; falls back to one-shot spawn otherwise.
|
|
25
|
+
*/
|
|
26
|
+
executeDml(dml: object, txId?: string): Promise<ResponseEngine>;
|
|
27
|
+
/**
|
|
28
|
+
* Executes raw SQL (or a MongoDB command document) with bound parameters.
|
|
29
|
+
*/
|
|
30
|
+
rawQuery(query: string, params?: any[], txId?: string): Promise<ResponseEngine>;
|
|
31
|
+
/** Starts a transaction (daemon mode only). Returns the transaction id. */
|
|
32
|
+
beginTransaction(): Promise<string>;
|
|
33
|
+
commitTransaction(txId: string): Promise<void>;
|
|
34
|
+
rollbackTransaction(txId: string): Promise<void>;
|
|
16
35
|
setArguments(): any[];
|
|
17
36
|
setConfig(name: string): {
|
|
18
37
|
[x: string]: any;
|
|
@@ -202,6 +221,57 @@ export declare class Config {
|
|
|
202
221
|
*/
|
|
203
222
|
getAllDatabases(): Record<string, DatabaseConfig$1>;
|
|
204
223
|
}
|
|
224
|
+
export interface DaemonResponse {
|
|
225
|
+
status: number;
|
|
226
|
+
message: string;
|
|
227
|
+
data: any;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* TCP client for the query-engine daemon (server mode).
|
|
231
|
+
*
|
|
232
|
+
* Instead of spawning a new engine process per query (30-80ms overhead),
|
|
233
|
+
* the daemon keeps the engine alive with warm connection pools and serves
|
|
234
|
+
* requests over a local TCP socket in <1ms. One daemon per database name.
|
|
235
|
+
*/
|
|
236
|
+
export declare class DaemonClient {
|
|
237
|
+
private static registry;
|
|
238
|
+
private name;
|
|
239
|
+
private binaryPath;
|
|
240
|
+
private engineArgs;
|
|
241
|
+
private socket;
|
|
242
|
+
private buffer;
|
|
243
|
+
private pending;
|
|
244
|
+
private starting;
|
|
245
|
+
private requestTimeout;
|
|
246
|
+
private constructor();
|
|
247
|
+
static get(name: string, binaryPath: string, engineArgs: string[]): DaemonClient;
|
|
248
|
+
static isEnabled(): boolean;
|
|
249
|
+
private portfilePath;
|
|
250
|
+
/**
|
|
251
|
+
* Ensures a usable daemon connection. Returns false when the daemon
|
|
252
|
+
* can't be used (old binary, startup failure) so callers fall back
|
|
253
|
+
* to one-shot spawn mode.
|
|
254
|
+
*/
|
|
255
|
+
ensure(): Promise<boolean>;
|
|
256
|
+
private connectOrStart;
|
|
257
|
+
private readPortfile;
|
|
258
|
+
private spawnDaemon;
|
|
259
|
+
private tryConnect;
|
|
260
|
+
private attach;
|
|
261
|
+
private detach;
|
|
262
|
+
private onData;
|
|
263
|
+
/**
|
|
264
|
+
* Sends a request to the daemon. Responses arrive in FIFO order on the
|
|
265
|
+
* single socket, so pending requests resolve in send order.
|
|
266
|
+
*/
|
|
267
|
+
send(payload: Record<string, any>): Promise<DaemonResponse>;
|
|
268
|
+
execute(dml: object, txId?: string): Promise<DaemonResponse>;
|
|
269
|
+
raw(query: string, params?: any[], txId?: string): Promise<DaemonResponse>;
|
|
270
|
+
begin(): Promise<string>;
|
|
271
|
+
commit(txId: string): Promise<void>;
|
|
272
|
+
rollback(txId: string): Promise<void>;
|
|
273
|
+
shutdown(): Promise<void>;
|
|
274
|
+
}
|
|
205
275
|
export interface InterceptOptions {
|
|
206
276
|
interceptLog?: boolean;
|
|
207
277
|
interceptError?: boolean;
|