@dbcube/core 5.2.2 → 5.2.4

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.d.mts CHANGED
@@ -129,7 +129,7 @@ export declare class QueryEngine {
129
129
  private timeout;
130
130
  private connectionId;
131
131
  private tcpPort;
132
- constructor(name: string, timeout?: number);
132
+ constructor(name: string, timeout?: number, explicitConfig?: any);
133
133
  private generatePort;
134
134
  private findAvailablePort;
135
135
  private isPortAvailable;
@@ -141,28 +141,39 @@ export declare class QueryEngine {
141
141
  getConfig(): any;
142
142
  run(binary: string, args: string[]): Promise<ResponseEngine>;
143
143
  private argsToCommand;
144
+ /** El motor embebido (FFI) es el camino por defecto cuando la librería
145
+ * nativa está disponible; el daemon TCP queda como fallback y como modo
146
+ * multi-proceso explícito. */
147
+ private useEmbedded;
144
148
  /**
145
- * Executes a DML plan over the persistent TCP server.
149
+ * Executes a DML plan. Embedded engine when available (in-process FFI,
150
+ * no network hop); persistent TCP daemon otherwise.
146
151
  * Pass txId to run it inside an active transaction.
147
152
  */
148
153
  executeDml(dml: object, txId?: string): Promise<ResponseEngine>;
149
154
  /**
150
- * Executes raw SQL (or a MongoDB command document) with bound parameters
151
- * over the persistent TCP server.
155
+ * Atomic batch: N write plans inside one transaction with a single
156
+ * engine round-trip. Falls back to begin/ops/commit over the daemon
157
+ * when the embedded engine is not available.
158
+ */
159
+ executeBatch(ops: object[]): Promise<ResponseEngine>;
160
+ /**
161
+ * Executes raw SQL (or a MongoDB command document) with bound parameters.
152
162
  */
153
163
  rawQuery(query: string, params?: any[], txId?: string): Promise<ResponseEngine>;
154
- /** Starts a server-side transaction and returns its id. */
164
+ /** Starts a transaction and returns its id. */
155
165
  beginTransaction(): Promise<string>;
156
166
  commitTransaction(txId: string): Promise<void>;
157
167
  rollbackTransaction(txId: string): Promise<void>;
158
168
  private executeWithTcpServer;
169
+ private poolFor;
170
+ private acquireSocket;
171
+ private releaseSocket;
159
172
  private waitForServerReady;
160
173
  private isServerResponding;
161
174
  private sleep;
162
175
  private getCachedDML;
163
176
  private startTcpServer;
164
- private sendTcpRequestFast;
165
- private processQueue;
166
177
  private createNewConnection;
167
178
  private executeOnConnection;
168
179
  private createProcess;
@@ -222,35 +233,6 @@ export declare class Binary {
222
233
  private static findVersionedBinary;
223
234
  static get(): Promise<BinaryType$1>;
224
235
  }
225
- export interface SqliteResult {
226
- status: "success" | "error";
227
- message: string;
228
- data: any | null;
229
- }
230
- export interface RunResult {
231
- changes: number;
232
- lastID: number;
233
- }
234
- declare class SqliteExecutor {
235
- private binaryPath;
236
- private dbPath;
237
- constructor(dbPath: string);
238
- private findVersionedBinary;
239
- private getBinaryPath;
240
- private executeBinary;
241
- connect(): Promise<boolean>;
242
- exists(): Promise<boolean>;
243
- query(sql: string, params?: any[]): Promise<SqliteResult>;
244
- queryMultiple(sql: string): Promise<SqliteResult>;
245
- prepare(sql: string): {
246
- all: (...params: any[]) => Promise<any[]>;
247
- run: (...params: any[]) => Promise<RunResult>;
248
- };
249
- prepareSync(sql: string): {
250
- all: (...params: any[]) => any;
251
- run: (...params: any[]) => any;
252
- };
253
- }
254
236
  export interface DatabaseConfig {
255
237
  name?: string;
256
238
  HOST?: string;
@@ -269,11 +251,17 @@ export interface ParametrizedQueryResult {
269
251
  parameters: any[];
270
252
  }
271
253
  declare class SQLite {
272
- private executor;
273
- private database?;
254
+ private database;
255
+ private engine;
274
256
  constructor(config: DatabaseConfig);
257
+ /** Ruta del archivo SQLite interno (.dbcube/<database>.db). */
258
+ private dbFilePath;
259
+ /** QueryEngine sqlite apuntando al archivo interno, con config explícito
260
+ * (no vive en dbcube.config.js). La ruta relativa `.dbcube/<db>` deja que
261
+ * QueryEngine le añada `.db` → `.dbcube/<db>.db`, relativo al CWD. */
262
+ private getEngine;
275
263
  ifExist(): Promise<Boolean>;
276
- connect(): Promise<SqliteExecutor>;
264
+ connect(): Promise<QueryEngine>;
277
265
  disconnect(): Promise<void>;
278
266
  query(sqlQuery: string): Promise<QueryResult>;
279
267
  queryWithParameters(sqlQuery: string, params?: any[]): Promise<QueryResult>;
package/dist/index.d.ts CHANGED
@@ -129,7 +129,7 @@ export declare class QueryEngine {
129
129
  private timeout;
130
130
  private connectionId;
131
131
  private tcpPort;
132
- constructor(name: string, timeout?: number);
132
+ constructor(name: string, timeout?: number, explicitConfig?: any);
133
133
  private generatePort;
134
134
  private findAvailablePort;
135
135
  private isPortAvailable;
@@ -141,28 +141,39 @@ export declare class QueryEngine {
141
141
  getConfig(): any;
142
142
  run(binary: string, args: string[]): Promise<ResponseEngine>;
143
143
  private argsToCommand;
144
+ /** El motor embebido (FFI) es el camino por defecto cuando la librería
145
+ * nativa está disponible; el daemon TCP queda como fallback y como modo
146
+ * multi-proceso explícito. */
147
+ private useEmbedded;
144
148
  /**
145
- * Executes a DML plan over the persistent TCP server.
149
+ * Executes a DML plan. Embedded engine when available (in-process FFI,
150
+ * no network hop); persistent TCP daemon otherwise.
146
151
  * Pass txId to run it inside an active transaction.
147
152
  */
148
153
  executeDml(dml: object, txId?: string): Promise<ResponseEngine>;
149
154
  /**
150
- * Executes raw SQL (or a MongoDB command document) with bound parameters
151
- * over the persistent TCP server.
155
+ * Atomic batch: N write plans inside one transaction with a single
156
+ * engine round-trip. Falls back to begin/ops/commit over the daemon
157
+ * when the embedded engine is not available.
158
+ */
159
+ executeBatch(ops: object[]): Promise<ResponseEngine>;
160
+ /**
161
+ * Executes raw SQL (or a MongoDB command document) with bound parameters.
152
162
  */
153
163
  rawQuery(query: string, params?: any[], txId?: string): Promise<ResponseEngine>;
154
- /** Starts a server-side transaction and returns its id. */
164
+ /** Starts a transaction and returns its id. */
155
165
  beginTransaction(): Promise<string>;
156
166
  commitTransaction(txId: string): Promise<void>;
157
167
  rollbackTransaction(txId: string): Promise<void>;
158
168
  private executeWithTcpServer;
169
+ private poolFor;
170
+ private acquireSocket;
171
+ private releaseSocket;
159
172
  private waitForServerReady;
160
173
  private isServerResponding;
161
174
  private sleep;
162
175
  private getCachedDML;
163
176
  private startTcpServer;
164
- private sendTcpRequestFast;
165
- private processQueue;
166
177
  private createNewConnection;
167
178
  private executeOnConnection;
168
179
  private createProcess;
@@ -222,35 +233,6 @@ export declare class Binary {
222
233
  private static findVersionedBinary;
223
234
  static get(): Promise<BinaryType$1>;
224
235
  }
225
- export interface SqliteResult {
226
- status: "success" | "error";
227
- message: string;
228
- data: any | null;
229
- }
230
- export interface RunResult {
231
- changes: number;
232
- lastID: number;
233
- }
234
- declare class SqliteExecutor {
235
- private binaryPath;
236
- private dbPath;
237
- constructor(dbPath: string);
238
- private findVersionedBinary;
239
- private getBinaryPath;
240
- private executeBinary;
241
- connect(): Promise<boolean>;
242
- exists(): Promise<boolean>;
243
- query(sql: string, params?: any[]): Promise<SqliteResult>;
244
- queryMultiple(sql: string): Promise<SqliteResult>;
245
- prepare(sql: string): {
246
- all: (...params: any[]) => Promise<any[]>;
247
- run: (...params: any[]) => Promise<RunResult>;
248
- };
249
- prepareSync(sql: string): {
250
- all: (...params: any[]) => any;
251
- run: (...params: any[]) => any;
252
- };
253
- }
254
236
  export interface DatabaseConfig {
255
237
  name?: string;
256
238
  HOST?: string;
@@ -269,11 +251,17 @@ export interface ParametrizedQueryResult {
269
251
  parameters: any[];
270
252
  }
271
253
  declare class SQLite {
272
- private executor;
273
- private database?;
254
+ private database;
255
+ private engine;
274
256
  constructor(config: DatabaseConfig);
257
+ /** Ruta del archivo SQLite interno (.dbcube/<database>.db). */
258
+ private dbFilePath;
259
+ /** QueryEngine sqlite apuntando al archivo interno, con config explícito
260
+ * (no vive en dbcube.config.js). La ruta relativa `.dbcube/<db>` deja que
261
+ * QueryEngine le añada `.db` → `.dbcube/<db>.db`, relativo al CWD. */
262
+ private getEngine;
275
263
  ifExist(): Promise<Boolean>;
276
- connect(): Promise<SqliteExecutor>;
264
+ connect(): Promise<QueryEngine>;
277
265
  disconnect(): Promise<void>;
278
266
  query(sqlQuery: string): Promise<QueryResult>;
279
267
  queryWithParameters(sqlQuery: string, params?: any[]): Promise<QueryResult>;