@dbcube/core 5.2.3 → 5.2.5
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/bin.cjs +2 -3
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +2 -3
- package/dist/bin.js.map +1 -1
- package/dist/index.cjs +150 -357
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +36 -33
- package/dist/index.d.ts +36 -33
- package/dist/index.js +166 -373
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -233,35 +233,6 @@ export declare class Binary {
|
|
|
233
233
|
private static findVersionedBinary;
|
|
234
234
|
static get(): Promise<BinaryType$1>;
|
|
235
235
|
}
|
|
236
|
-
export interface SqliteResult {
|
|
237
|
-
status: "success" | "error";
|
|
238
|
-
message: string;
|
|
239
|
-
data: any | null;
|
|
240
|
-
}
|
|
241
|
-
export interface RunResult {
|
|
242
|
-
changes: number;
|
|
243
|
-
lastID: number;
|
|
244
|
-
}
|
|
245
|
-
declare class SqliteExecutor {
|
|
246
|
-
private binaryPath;
|
|
247
|
-
private dbPath;
|
|
248
|
-
constructor(dbPath: string);
|
|
249
|
-
private findVersionedBinary;
|
|
250
|
-
private getBinaryPath;
|
|
251
|
-
private executeBinary;
|
|
252
|
-
connect(): Promise<boolean>;
|
|
253
|
-
exists(): Promise<boolean>;
|
|
254
|
-
query(sql: string, params?: any[]): Promise<SqliteResult>;
|
|
255
|
-
queryMultiple(sql: string): Promise<SqliteResult>;
|
|
256
|
-
prepare(sql: string): {
|
|
257
|
-
all: (...params: any[]) => Promise<any[]>;
|
|
258
|
-
run: (...params: any[]) => Promise<RunResult>;
|
|
259
|
-
};
|
|
260
|
-
prepareSync(sql: string): {
|
|
261
|
-
all: (...params: any[]) => any;
|
|
262
|
-
run: (...params: any[]) => any;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
236
|
export interface DatabaseConfig {
|
|
266
237
|
name?: string;
|
|
267
238
|
HOST?: string;
|
|
@@ -280,11 +251,17 @@ export interface ParametrizedQueryResult {
|
|
|
280
251
|
parameters: any[];
|
|
281
252
|
}
|
|
282
253
|
declare class SQLite {
|
|
283
|
-
private
|
|
284
|
-
private
|
|
254
|
+
private database;
|
|
255
|
+
private engine;
|
|
285
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;
|
|
286
263
|
ifExist(): Promise<Boolean>;
|
|
287
|
-
connect(): Promise<
|
|
264
|
+
connect(): Promise<QueryEngine>;
|
|
288
265
|
disconnect(): Promise<void>;
|
|
289
266
|
query(sqlQuery: string): Promise<QueryResult>;
|
|
290
267
|
queryWithParameters(sqlQuery: string, params?: any[]): Promise<QueryResult>;
|
|
@@ -513,5 +490,31 @@ export declare class TableProcessor {
|
|
|
513
490
|
export declare class TriggerProcessor {
|
|
514
491
|
static getTriggers(name: string): Promise<any[]>;
|
|
515
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Cargador de variables de entorno propio de DBCube.
|
|
495
|
+
*
|
|
496
|
+
* Evita que el usuario tenga que instalar `dotenv` y escribir
|
|
497
|
+
* `require("dotenv").config()` al inicio de su dbcube.config.js. DBCube carga
|
|
498
|
+
* el `.env` del proyecto automáticamente ANTES de evaluar la configuración.
|
|
499
|
+
*
|
|
500
|
+
* Estrategia:
|
|
501
|
+
* 1. `process.loadEnvFile()` — nativo de Node 20.6+ (cero dependencias).
|
|
502
|
+
* 2. Fallback: parser propio mínimo (KEY=VALUE, comillas, comentarios, export).
|
|
503
|
+
*
|
|
504
|
+
* No sobrescribe variables ya presentes en process.env (las del shell mandan).
|
|
505
|
+
*/
|
|
506
|
+
export declare class EnvLoader {
|
|
507
|
+
/**
|
|
508
|
+
* Carga el archivo .env indicado (o ./.env del cwd) en process.env.
|
|
509
|
+
* Silencioso si el archivo no existe. Devuelve true si cargó algo.
|
|
510
|
+
*/
|
|
511
|
+
static load(envPath?: string): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Parser mínimo de formato .env. Soporta:
|
|
514
|
+
* KEY=value · KEY="value con espacios" · KEY='literal' · export KEY=value
|
|
515
|
+
* comentarios con # · líneas en blanco · \n \t en comillas dobles.
|
|
516
|
+
*/
|
|
517
|
+
static parse(content: string): Record<string, string>;
|
|
518
|
+
}
|
|
516
519
|
|
|
517
520
|
export {};
|
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;
|
|
@@ -233,35 +233,6 @@ export declare class Binary {
|
|
|
233
233
|
private static findVersionedBinary;
|
|
234
234
|
static get(): Promise<BinaryType$1>;
|
|
235
235
|
}
|
|
236
|
-
export interface SqliteResult {
|
|
237
|
-
status: "success" | "error";
|
|
238
|
-
message: string;
|
|
239
|
-
data: any | null;
|
|
240
|
-
}
|
|
241
|
-
export interface RunResult {
|
|
242
|
-
changes: number;
|
|
243
|
-
lastID: number;
|
|
244
|
-
}
|
|
245
|
-
declare class SqliteExecutor {
|
|
246
|
-
private binaryPath;
|
|
247
|
-
private dbPath;
|
|
248
|
-
constructor(dbPath: string);
|
|
249
|
-
private findVersionedBinary;
|
|
250
|
-
private getBinaryPath;
|
|
251
|
-
private executeBinary;
|
|
252
|
-
connect(): Promise<boolean>;
|
|
253
|
-
exists(): Promise<boolean>;
|
|
254
|
-
query(sql: string, params?: any[]): Promise<SqliteResult>;
|
|
255
|
-
queryMultiple(sql: string): Promise<SqliteResult>;
|
|
256
|
-
prepare(sql: string): {
|
|
257
|
-
all: (...params: any[]) => Promise<any[]>;
|
|
258
|
-
run: (...params: any[]) => Promise<RunResult>;
|
|
259
|
-
};
|
|
260
|
-
prepareSync(sql: string): {
|
|
261
|
-
all: (...params: any[]) => any;
|
|
262
|
-
run: (...params: any[]) => any;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
236
|
export interface DatabaseConfig {
|
|
266
237
|
name?: string;
|
|
267
238
|
HOST?: string;
|
|
@@ -280,11 +251,17 @@ export interface ParametrizedQueryResult {
|
|
|
280
251
|
parameters: any[];
|
|
281
252
|
}
|
|
282
253
|
declare class SQLite {
|
|
283
|
-
private
|
|
284
|
-
private
|
|
254
|
+
private database;
|
|
255
|
+
private engine;
|
|
285
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;
|
|
286
263
|
ifExist(): Promise<Boolean>;
|
|
287
|
-
connect(): Promise<
|
|
264
|
+
connect(): Promise<QueryEngine>;
|
|
288
265
|
disconnect(): Promise<void>;
|
|
289
266
|
query(sqlQuery: string): Promise<QueryResult>;
|
|
290
267
|
queryWithParameters(sqlQuery: string, params?: any[]): Promise<QueryResult>;
|
|
@@ -513,5 +490,31 @@ export declare class TableProcessor {
|
|
|
513
490
|
export declare class TriggerProcessor {
|
|
514
491
|
static getTriggers(name: string): Promise<any[]>;
|
|
515
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Cargador de variables de entorno propio de DBCube.
|
|
495
|
+
*
|
|
496
|
+
* Evita que el usuario tenga que instalar `dotenv` y escribir
|
|
497
|
+
* `require("dotenv").config()` al inicio de su dbcube.config.js. DBCube carga
|
|
498
|
+
* el `.env` del proyecto automáticamente ANTES de evaluar la configuración.
|
|
499
|
+
*
|
|
500
|
+
* Estrategia:
|
|
501
|
+
* 1. `process.loadEnvFile()` — nativo de Node 20.6+ (cero dependencias).
|
|
502
|
+
* 2. Fallback: parser propio mínimo (KEY=VALUE, comillas, comentarios, export).
|
|
503
|
+
*
|
|
504
|
+
* No sobrescribe variables ya presentes en process.env (las del shell mandan).
|
|
505
|
+
*/
|
|
506
|
+
export declare class EnvLoader {
|
|
507
|
+
/**
|
|
508
|
+
* Carga el archivo .env indicado (o ./.env del cwd) en process.env.
|
|
509
|
+
* Silencioso si el archivo no existe. Devuelve true si cargó algo.
|
|
510
|
+
*/
|
|
511
|
+
static load(envPath?: string): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Parser mínimo de formato .env. Soporta:
|
|
514
|
+
* KEY=value · KEY="value con espacios" · KEY='literal' · export KEY=value
|
|
515
|
+
* comentarios con # · líneas en blanco · \n \t en comillas dobles.
|
|
516
|
+
*/
|
|
517
|
+
static parse(content: string): Record<string, string>;
|
|
518
|
+
}
|
|
516
519
|
|
|
517
520
|
export {};
|