@devbro/neko-sql 0.1.31 → 0.1.34
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 +65 -5
- package/dist/{Blueprint-D3WHeqRS.d.mts → Blueprint-g4SmS1bH.d.mts} +6 -0
- package/dist/Blueprint.d.mts +1 -1
- package/dist/Connection.d.mts +1 -1
- package/dist/Expression.d.mts +1 -1
- package/dist/Migration.d.mts +1 -1
- package/dist/Query.d.mts +1 -1
- package/dist/Query.mjs +3 -1
- package/dist/Query.mjs.map +1 -1
- package/dist/QueryGrammar.d.mts +1 -1
- package/dist/QueryGrammar.mjs +8 -0
- package/dist/QueryGrammar.mjs.map +1 -1
- package/dist/Schema.d.mts +1 -1
- package/dist/SchemaGrammar.d.mts +1 -1
- package/dist/databases/index.d.mts +9 -1
- package/dist/databases/index.mjs +2 -0
- package/dist/databases/index.mjs.map +1 -1
- package/dist/databases/mysql/MysqlConnection.d.mts +41 -0
- package/dist/databases/mysql/MysqlConnection.mjs +208 -0
- package/dist/databases/mysql/MysqlConnection.mjs.map +1 -0
- package/dist/databases/mysql/MysqlQueryGrammar.d.mts +13 -0
- package/dist/databases/mysql/MysqlQueryGrammar.mjs +18 -0
- package/dist/databases/mysql/MysqlQueryGrammar.mjs.map +1 -0
- package/dist/databases/mysql/MysqlSchemaGrammar.d.mts +8 -0
- package/dist/databases/mysql/MysqlSchemaGrammar.mjs +58 -0
- package/dist/databases/mysql/MysqlSchemaGrammar.mjs.map +1 -0
- package/dist/databases/mysql/index.d.mts +6 -0
- package/dist/databases/mysql/index.mjs +4 -0
- package/dist/databases/mysql/index.mjs.map +1 -0
- package/dist/databases/postgresql/PostgresqlConnection.d.mts +2 -2
- package/dist/databases/postgresql/PostgresqlConnection.mjs +27 -11
- package/dist/databases/postgresql/PostgresqlConnection.mjs.map +1 -1
- package/dist/databases/postgresql/PostgresqlQueryGrammar.d.mts +1 -1
- package/dist/databases/postgresql/PostgresqlSchemaGrammar.d.mts +1 -1
- package/dist/databases/postgresql/index.d.mts +1 -1
- package/dist/databases/sqlite/SqliteConnection.d.mts +132 -0
- package/dist/databases/sqlite/SqliteConnection.mjs +242 -0
- package/dist/databases/sqlite/SqliteConnection.mjs.map +1 -0
- package/dist/databases/sqlite/SqliteQueryGrammar.d.mts +17 -0
- package/dist/databases/sqlite/SqliteQueryGrammar.mjs +40 -0
- package/dist/databases/sqlite/SqliteQueryGrammar.mjs.map +1 -0
- package/dist/databases/sqlite/SqliteSchemaGrammar.d.mts +8 -0
- package/dist/databases/sqlite/SqliteSchemaGrammar.mjs +58 -0
- package/dist/databases/sqlite/SqliteSchemaGrammar.mjs.map +1 -0
- package/dist/databases/sqlite/index.d.mts +6 -0
- package/dist/databases/sqlite/index.mjs +4 -0
- package/dist/databases/sqlite/index.mjs.map +1 -0
- package/dist/index.d.mts +9 -1
- package/dist/index.js +642 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { QueryGrammar } from "../../QueryGrammar.mjs";
|
|
4
|
+
class MysqlQueryGrammar extends QueryGrammar {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "MysqlQueryGrammar");
|
|
7
|
+
}
|
|
8
|
+
compileInsertGetId(query, data, options = { primaryKey: ["id"] }) {
|
|
9
|
+
return super.compileInsert(query, data);
|
|
10
|
+
}
|
|
11
|
+
postProcessGetInsertId(result) {
|
|
12
|
+
return [{ id: result.insertId }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
MysqlQueryGrammar
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=MysqlQueryGrammar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/databases/mysql/MysqlQueryGrammar.mts"],"sourcesContent":["import { Query } from '../../Query.mjs';\nimport { QueryGrammar } from '../../QueryGrammar.mjs';\nimport { CompiledSql } from '../../types.mjs';\n\nexport class MysqlQueryGrammar extends QueryGrammar {\n compileInsertGetId(\n query: Query,\n data: Record<string, any>,\n options: { primaryKey: string[] } = { primaryKey: ['id'] }\n ): CompiledSql {\n return super.compileInsert(query, data);\n }\n\n postProcessGetInsertId(result: any) {\n return [{id: result.insertId}];\n }\n}\n"],"mappings":";;AACA,SAAS,oBAAoB;AAGtB,MAAM,0BAA0B,aAAa;AAAA,EAJpD,OAIoD;AAAA;AAAA;AAAA,EAClD,mBACE,OACA,MACA,UAAoC,EAAE,YAAY,CAAC,IAAI,EAAE,GAC5C;AACb,WAAO,MAAM,cAAc,OAAO,IAAI;AAAA,EACxC;AAAA,EAEA,uBAAuB,QAAa;AAClC,WAAO,CAAC,EAAC,IAAI,OAAO,SAAQ,CAAC;AAAA,EAC/B;AACF;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { SchemaGrammar } from "../../SchemaGrammar.mjs";
|
|
4
|
+
class MysqlSchemaGrammar extends SchemaGrammar {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "MysqlSchemaGrammar");
|
|
7
|
+
}
|
|
8
|
+
compileColumn(column) {
|
|
9
|
+
const rc = [`${column.columnName}`];
|
|
10
|
+
if (column.properties.type === "string") {
|
|
11
|
+
rc.push("varchar(" + column.properties.length + ")");
|
|
12
|
+
} else if (column.properties.type === "char") {
|
|
13
|
+
rc.push("char");
|
|
14
|
+
} else if (column.properties.type === "boolean") {
|
|
15
|
+
rc.push("boolean");
|
|
16
|
+
} else if (column.properties.type === "integer") {
|
|
17
|
+
rc.push("integer");
|
|
18
|
+
} else if (column.properties.type === "text") {
|
|
19
|
+
rc.push("text");
|
|
20
|
+
} else if (column.properties.type === "timestamp") {
|
|
21
|
+
rc.push("TIMESTAMP");
|
|
22
|
+
} else if (column.properties.type === "timestampz") {
|
|
23
|
+
rc.push("TIMESTAMP");
|
|
24
|
+
} else if (column.properties.type === "serial") {
|
|
25
|
+
rc.push("INT AUTO_INCREMENT");
|
|
26
|
+
} else if (column.properties.type === "float") {
|
|
27
|
+
rc.push("float");
|
|
28
|
+
} else if (column.properties.type === "double") {
|
|
29
|
+
rc.push("double precision");
|
|
30
|
+
} else if (column.properties.type === "date") {
|
|
31
|
+
rc.push("date");
|
|
32
|
+
} else if (column.properties.type === "json") {
|
|
33
|
+
rc.push("json");
|
|
34
|
+
} else if (column.properties.type === "jsonb") {
|
|
35
|
+
rc.push("jsonb");
|
|
36
|
+
} else if (column.properties.type === "raw") {
|
|
37
|
+
return column.columnName;
|
|
38
|
+
} else {
|
|
39
|
+
throw new Error("Unknown column type: " + column.properties.type);
|
|
40
|
+
}
|
|
41
|
+
if (column.properties.nullable) {
|
|
42
|
+
rc.push("null");
|
|
43
|
+
} else {
|
|
44
|
+
rc.push("NOT NULL");
|
|
45
|
+
}
|
|
46
|
+
if (column.properties.unique) {
|
|
47
|
+
rc.push("unique");
|
|
48
|
+
}
|
|
49
|
+
if (column.properties.default !== null) {
|
|
50
|
+
rc.push("default " + this.escape(column.properties.default));
|
|
51
|
+
}
|
|
52
|
+
return rc.join(" ");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
MysqlSchemaGrammar
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=MysqlSchemaGrammar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/databases/mysql/MysqlSchemaGrammar.mts"],"sourcesContent":["import { SchemaGrammar } from '../../SchemaGrammar.mjs';\nimport { Column } from '../../Blueprint.mjs';\n\nexport class MysqlSchemaGrammar extends SchemaGrammar {\n compileColumn(column: Column): string {\n const rc = [`${column.columnName}`];\n\n if (column.properties.type === 'string') {\n rc.push('varchar(' + column.properties.length + ')');\n } else if (column.properties.type === 'char') {\n rc.push('char');\n } else if (column.properties.type === 'boolean') {\n rc.push('boolean');\n } else if (column.properties.type === 'integer') {\n rc.push('integer');\n } else if (column.properties.type === 'text') {\n rc.push('text');\n } else if (column.properties.type === 'timestamp') {\n rc.push('TIMESTAMP');\n } else if (column.properties.type === 'timestampz') {\n rc.push('TIMESTAMP');\n } else if (column.properties.type === 'serial') {\n rc.push('INT AUTO_INCREMENT');\n } else if (column.properties.type === 'float') {\n rc.push('float');\n } else if (column.properties.type === 'double') {\n rc.push('double precision');\n } else if (column.properties.type === 'date') {\n rc.push('date');\n } else if (column.properties.type === 'json') {\n rc.push('json');\n } else if (column.properties.type === 'jsonb') {\n rc.push('jsonb');\n } else if (column.properties.type === 'raw') {\n return column.columnName;\n } else {\n throw new Error('Unknown column type: ' + column.properties.type);\n }\n\n if (column.properties.nullable) {\n rc.push('null');\n } else {\n rc.push('NOT NULL');\n }\n\n if (column.properties.unique) {\n rc.push('unique');\n }\n\n if (column.properties.default !== null) {\n rc.push('default ' + this.escape(column.properties.default));\n }\n\n return rc.join(' ');\n }\n}\n"],"mappings":";;AAAA,SAAS,qBAAqB;AAGvB,MAAM,2BAA2B,cAAc;AAAA,EAHtD,OAGsD;AAAA;AAAA;AAAA,EACnD,cAAc,QAAwB;AACrC,UAAM,KAAK,CAAC,GAAG,OAAO,UAAU,EAAE;AAElC,QAAI,OAAO,WAAW,SAAS,UAAU;AACvC,SAAG,KAAK,aAAa,OAAO,WAAW,SAAS,GAAG;AAAA,IACrD,WAAW,OAAO,WAAW,SAAS,QAAQ;AAC5C,SAAG,KAAK,MAAM;AAAA,IAChB,WAAW,OAAO,WAAW,SAAS,WAAW;AAC/C,SAAG,KAAK,SAAS;AAAA,IACnB,WAAW,OAAO,WAAW,SAAS,WAAW;AAC/C,SAAG,KAAK,SAAS;AAAA,IACnB,WAAW,OAAO,WAAW,SAAS,QAAQ;AAC5C,SAAG,KAAK,MAAM;AAAA,IAChB,WAAW,OAAO,WAAW,SAAS,aAAa;AACjD,SAAG,KAAK,WAAW;AAAA,IACrB,WAAW,OAAO,WAAW,SAAS,cAAc;AAClD,SAAG,KAAK,WAAW;AAAA,IACrB,WAAW,OAAO,WAAW,SAAS,UAAU;AAC9C,SAAG,KAAK,oBAAoB;AAAA,IAC9B,WAAW,OAAO,WAAW,SAAS,SAAS;AAC7C,SAAG,KAAK,OAAO;AAAA,IACjB,WAAW,OAAO,WAAW,SAAS,UAAU;AAC9C,SAAG,KAAK,kBAAkB;AAAA,IAC5B,WAAW,OAAO,WAAW,SAAS,QAAQ;AAC5C,SAAG,KAAK,MAAM;AAAA,IAChB,WAAW,OAAO,WAAW,SAAS,QAAQ;AAC5C,SAAG,KAAK,MAAM;AAAA,IAChB,WAAW,OAAO,WAAW,SAAS,SAAS;AAC7C,SAAG,KAAK,OAAO;AAAA,IACjB,WAAW,OAAO,WAAW,SAAS,OAAO;AAC3C,aAAO,OAAO;AAAA,IAChB,OAAO;AACL,YAAM,IAAI,MAAM,0BAA0B,OAAO,WAAW,IAAI;AAAA,IAClE;AAEA,QAAI,OAAO,WAAW,UAAU;AAC9B,SAAG,KAAK,MAAM;AAAA,IAChB,OAAO;AACL,SAAG,KAAK,UAAU;AAAA,IACpB;AAEA,QAAI,OAAO,WAAW,QAAQ;AAC5B,SAAG,KAAK,QAAQ;AAAA,IAClB;AAEA,QAAI,OAAO,WAAW,YAAY,MAAM;AACtC,SAAG,KAAK,aAAa,KAAK,OAAO,OAAO,WAAW,OAAO,CAAC;AAAA,IAC7D;AAEA,WAAO,GAAG,KAAK,GAAG;AAAA,EACpB;AACF;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MysqlConnection } from './MysqlConnection.mjs';
|
|
2
|
+
export { MysqlQueryGrammar } from './MysqlQueryGrammar.mjs';
|
|
3
|
+
export { MysqlSchemaGrammar } from './MysqlSchemaGrammar.mjs';
|
|
4
|
+
import '../../Blueprint-g4SmS1bH.mjs';
|
|
5
|
+
import '@devbro/neko-helper';
|
|
6
|
+
import 'mysql2/promise';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/databases/mysql/index.mts"],"sourcesContent":["export * from './MysqlConnection.mjs';\nexport * from './MysqlQueryGrammar.mjs';\nexport * from './MysqlSchemaGrammar.mjs';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { b as Connection, c as connection_events, m as CompiledSql, d as Query, S as Schema } from '../../Blueprint-g4SmS1bH.mjs';
|
|
2
|
+
import { PoolClient, Pool, PoolConfig } from 'pg';
|
|
1
3
|
import { PostgresqlQueryGrammar } from './PostgresqlQueryGrammar.mjs';
|
|
2
4
|
import { PostgresqlSchemaGrammar } from './PostgresqlSchemaGrammar.mjs';
|
|
3
|
-
import { b as Connection, c as connection_events, m as CompiledSql, d as Query, S as Schema } from '../../Blueprint-D3WHeqRS.mjs';
|
|
4
|
-
import { PoolClient, Pool, PoolConfig } from 'pg';
|
|
5
5
|
import '@devbro/neko-helper';
|
|
6
6
|
|
|
7
7
|
declare class PostgresqlConnection extends Connection {
|
|
@@ -44,7 +44,8 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
async connect() {
|
|
47
|
-
this.eventManager.emit("connect")
|
|
47
|
+
this.eventManager.emit("connect").catch(() => {
|
|
48
|
+
});
|
|
48
49
|
this.connection = await PostgresqlConnection.pool.connect();
|
|
49
50
|
return true;
|
|
50
51
|
}
|
|
@@ -57,7 +58,8 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
57
58
|
if (sql.parts && sql.parts.length > 0) {
|
|
58
59
|
sql2 = sql.parts.map((v) => v === "?" ? "$" + counter++ : v).join(" ");
|
|
59
60
|
}
|
|
60
|
-
this.eventManager.emit("query", { sql: sql2, bindings: sql.bindings })
|
|
61
|
+
this.eventManager.emit("query", { sql: sql2, bindings: sql.bindings }).catch(() => {
|
|
62
|
+
});
|
|
61
63
|
if (!this.isConnected()) {
|
|
62
64
|
await this.connect();
|
|
63
65
|
}
|
|
@@ -73,7 +75,8 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
73
75
|
}
|
|
74
76
|
await this.connection?.release();
|
|
75
77
|
this.connection = void 0;
|
|
76
|
-
this.eventManager.emit("disconnect")
|
|
78
|
+
this.eventManager.emit("disconnect").catch(() => {
|
|
79
|
+
});
|
|
77
80
|
return true;
|
|
78
81
|
}
|
|
79
82
|
getQuery() {
|
|
@@ -97,9 +100,8 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
97
100
|
async rollback() {
|
|
98
101
|
await this.runQuery({ sql: "ROLLBACK", bindings: [], parts: ["ROLLBACK"] });
|
|
99
102
|
}
|
|
100
|
-
static
|
|
101
|
-
PostgresqlConnection.pool.end();
|
|
102
|
-
return;
|
|
103
|
+
static destroy() {
|
|
104
|
+
return PostgresqlConnection.pool.end();
|
|
103
105
|
}
|
|
104
106
|
isConnected() {
|
|
105
107
|
return this.connection !== void 0;
|
|
@@ -134,9 +136,11 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
134
136
|
}
|
|
135
137
|
async createDatabase(name) {
|
|
136
138
|
if (this.isConnected()) {
|
|
137
|
-
|
|
139
|
+
const safeName2 = this.validateAndEscapeIdentifier(name);
|
|
140
|
+
await this.runQuery(`CREATE DATABASE ${safeName2}`);
|
|
141
|
+
return;
|
|
138
142
|
}
|
|
139
|
-
|
|
143
|
+
const conn = new Client({
|
|
140
144
|
...PostgresqlConnection.pool.options,
|
|
141
145
|
database: "postgres"
|
|
142
146
|
});
|
|
@@ -147,9 +151,11 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
147
151
|
}
|
|
148
152
|
async dropDatabase(name) {
|
|
149
153
|
if (this.isConnected()) {
|
|
150
|
-
|
|
154
|
+
const safeName2 = this.validateAndEscapeIdentifier(name);
|
|
155
|
+
await this.runQuery(`DROP DATABASE ${safeName2}`);
|
|
156
|
+
return;
|
|
151
157
|
}
|
|
152
|
-
|
|
158
|
+
const conn = new Client({
|
|
153
159
|
...PostgresqlConnection.pool.options,
|
|
154
160
|
database: "postgres"
|
|
155
161
|
// connect to default 'postgres' database to drop others
|
|
@@ -170,7 +176,17 @@ class PostgresqlConnection extends ConnectionAbs {
|
|
|
170
176
|
}
|
|
171
177
|
async existsDatabase(name) {
|
|
172
178
|
if (!this.isConnected()) {
|
|
173
|
-
|
|
179
|
+
const conn = new Client({
|
|
180
|
+
...PostgresqlConnection.pool.options,
|
|
181
|
+
database: "postgres"
|
|
182
|
+
});
|
|
183
|
+
await conn.connect();
|
|
184
|
+
const safeName = this.validateAndEscapeIdentifier(name);
|
|
185
|
+
const result2 = await conn.query("SELECT 1 FROM pg_database WHERE datname = $1", [
|
|
186
|
+
safeName
|
|
187
|
+
]);
|
|
188
|
+
await conn.end();
|
|
189
|
+
return result2.rows.length > 0;
|
|
174
190
|
}
|
|
175
191
|
const result = await this.connection.query("SELECT 1 FROM pg_database WHERE datname = $1", [
|
|
176
192
|
name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/databases/postgresql/PostgresqlConnection.mts"],"sourcesContent":["import { connection_events, Connection as ConnectionAbs } from '../../Connection.mjs';\nimport { Client, PoolClient, PoolConfig } from 'pg';\nimport { Pool } from 'pg';\nimport { CompiledSql } from '../../types.mjs';\nimport { Query } from '../../Query.mjs';\nimport { PostgresqlQueryGrammar } from './PostgresqlQueryGrammar.mjs';\nimport { Schema } from '../../Schema.mjs';\nimport { PostgresqlSchemaGrammar } from './PostgresqlSchemaGrammar.mjs';\nimport Cursor from 'pg-cursor';\nimport { EventManager } from '@devbro/neko-helper';\n\nexport class PostgresqlConnection extends ConnectionAbs {\n private eventManager = new EventManager();\n\n on(event: connection_events, listener: (...args: any[]) => void): this {\n this.eventManager.on(event, listener);\n return this;\n }\n off(event: connection_events, listener: (...args: any[]) => void): this {\n this.eventManager.off(event, listener);\n return this;\n }\n emit(event: connection_events, ...args: any[]): Promise<boolean> {\n return this.eventManager.emit(event, ...args);\n }\n\n connection: PoolClient | undefined;\n static pool: Pool;\n\n static defaults: PoolConfig = {\n port: 5432,\n ssl: false,\n max: 20,\n idleTimeoutMillis: 1, // wait X milli seconds before closing an idle/released connection\n connectionTimeoutMillis: 30000, // wait up to 30 seconds to obtain a new connection\n maxUses: 7500,\n };\n\n constructor(params: PoolConfig) {\n super();\n if (!PostgresqlConnection.pool) {\n PostgresqlConnection.pool = new Pool({ ...PostgresqlConnection.defaults, ...params });\n }\n }\n async connect(): Promise<boolean> {\n this.eventManager.emit('connect');\n this.connection = await PostgresqlConnection.pool.connect();\n return true;\n }\n async runQuery(sql: CompiledSql | string): Promise<any> {\n if( typeof sql === 'string') {\n sql = { sql: sql, bindings: [], parts: [sql] };\n }\n let counter = 1;\n let sql2 = sql.sql;\n if (sql.parts && sql.parts.length > 0) {\n sql2 = sql.parts.map((v) => (v === '?' ? '$' + counter++ : v)).join(' ');\n }\n\n this.eventManager.emit('query', { sql: sql2, bindings: sql.bindings });\n\n if (!this.isConnected()) {\n await this.connect();\n }\n const result = await this.connection!.query(sql2, sql.bindings);\n return result?.rows;\n }\n\n async runCursor(sql: CompiledSql): Promise<any> {\n return this.connection?.query(new Cursor(sql.sql, sql.bindings));\n }\n\n async disconnect(): Promise<boolean> {\n if (this.connection === undefined) {\n return true;\n }\n await this.connection?.release();\n this.connection = undefined;\n this.eventManager.emit('disconnect');\n return true;\n }\n\n getQuery(): Query {\n return new Query(this, new PostgresqlQueryGrammar());\n }\n\n getSchema(): Schema {\n return new Schema(this, new PostgresqlSchemaGrammar());\n }\n\n getQueryGrammar(): PostgresqlQueryGrammar {\n return new PostgresqlQueryGrammar();\n }\n getSchemaGrammar(): PostgresqlSchemaGrammar {\n return new PostgresqlSchemaGrammar();\n }\n\n async beginTransaction(): Promise<void> {\n await this.runQuery({ sql: 'BEGIN', bindings: [], parts: ['BEGIN'] });\n }\n\n async commit(): Promise<void> {\n await this.runQuery({ sql: 'COMMIT', bindings: [], parts: ['COMMIT'] });\n }\n\n async rollback(): Promise<void> {\n await this.runQuery({ sql: 'ROLLBACK', bindings: [], parts: ['ROLLBACK'] });\n }\n\n static async destroy(): Promise<void> {\n PostgresqlConnection.pool.end();\n return;\n }\n\n isConnected(): boolean {\n return this.connection !== undefined;\n }\n\n /**\n * Validates and escapes a PostgreSQL identifier (database name, table name, etc.)\n * Uses a whitelist approach to ensure only safe characters are allowed\n */\n private validateAndEscapeIdentifier(name: string): string {\n // PostgreSQL identifiers can contain: letters, digits, underscores, and dollar signs\n // They must start with a letter or underscore\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_$]*$/;\n\n if (!validIdentifierPattern.test(name)) {\n throw new Error(\n `Invalid identifier: \"${name}\". Identifiers must start with a letter or underscore and contain only letters, digits, underscores, and dollar signs.`\n );\n }\n\n // PostgreSQL reserved keywords that should be quoted\n const reservedKeywords = new Set([\n 'user',\n 'table',\n 'database',\n 'order',\n 'group',\n 'select',\n 'insert',\n 'update',\n 'delete',\n ]);\n\n // Quote the identifier if it's a reserved keyword or contains uppercase letters\n if (reservedKeywords.has(name.toLowerCase()) || name !== name.toLowerCase()) {\n // Escape any double quotes in the name\n const escapedName = name.replace(/\"/g, '\"\"');\n return `\"${escapedName}\"`;\n }\n\n return name;\n }\n\n async createDatabase(name: string): Promise<void> {\n if (this.isConnected()) {\n throw new Error('Cannot create database while connected.');\n }\n\n let conn = new Client({\n ...PostgresqlConnection.pool.options,\n database: 'postgres',\n });\n await conn.connect();\n const safeName = this.validateAndEscapeIdentifier(name);\n await conn.query(`CREATE DATABASE ${safeName}`);\n await conn.end();\n }\n\n async dropDatabase(name: string): Promise<void> {\n if (this.isConnected()) {\n throw new Error('Cannot drop database while connected.');\n }\n\n let conn = new Client({\n ...PostgresqlConnection.pool.options,\n database: 'postgres', // connect to default 'postgres' database to drop others\n });\n await conn.connect();\n const safeName = this.validateAndEscapeIdentifier(name);\n await conn.query(`DROP DATABASE ${safeName}`);\n await conn.end();\n }\n\n async listDatabases(): Promise<string[]> {\n if (!this.isConnected()) {\n await this.connect();\n }\n const result = await this.connection!.query(\n 'SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname'\n );\n return result.rows.map((row: any) => row.datname);\n }\n\n async existsDatabase(name: string): Promise<boolean> {\n if (!this.isConnected()) {\n await this.connect();\n }\n const result = await this.connection!.query('SELECT 1 FROM pg_database WHERE datname = $1', [\n name,\n ]);\n return result.rows.length > 0;\n }\n}\n"],"mappings":";;AAAA,SAA4B,cAAc,qBAAqB;AAC/D,SAAS,cAAsC;AAC/C,SAAS,YAAY;AAErB,SAAS,aAAa;AACtB,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,+BAA+B;AACxC,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAEtB,MAAM,6BAA6B,cAAc;AAAA,EAXxD,OAWwD;AAAA;AAAA;AAAA,EAC9C,eAAe,IAAI,aAAa;AAAA,EAExC,GAAG,OAA0B,UAA0C;AACrE,SAAK,aAAa,GAAG,OAAO,QAAQ;AACpC,WAAO;AAAA,EACT;AAAA,EACA,IAAI,OAA0B,UAA0C;AACtE,SAAK,aAAa,IAAI,OAAO,QAAQ;AACrC,WAAO;AAAA,EACT;AAAA,EACA,KAAK,UAA6B,MAA+B;AAC/D,WAAO,KAAK,aAAa,KAAK,OAAO,GAAG,IAAI;AAAA,EAC9C;AAAA,EAEA;AAAA,EACA,OAAO;AAAA,EAEP,OAAO,WAAuB;AAAA,IAC5B,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,mBAAmB;AAAA;AAAA,IACnB,yBAAyB;AAAA;AAAA,IACzB,SAAS;AAAA,EACX;AAAA,EAEA,YAAY,QAAoB;AAC9B,UAAM;AACN,QAAI,CAAC,qBAAqB,MAAM;AAC9B,2BAAqB,OAAO,IAAI,KAAK,EA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AAAA,IAC3D;AAEA,QAAI,OAAO,IAAI,OAAO;AAAA,MACpB,GAAG,qBAAqB,KAAK;AAAA,MAC7B,UAAU;AAAA,IACZ,CAAC;AACD,UAAM,KAAK,QAAQ;AACnB,UAAM,WAAW,KAAK,4BAA4B,IAAI;AACtD,UAAM,KAAK,MAAM,mBAAmB,QAAQ,EAAE;AAC9C,UAAM,KAAK,IAAI;AAAA,EACjB;AAAA,EAEA,MAAM,aAAa,MAA6B;AAC9C,QAAI,KAAK,YAAY,GAAG;AACtB,YAAM,IAAI,MAAM,uCAAuC;AAAA,IACzD;AAEA,QAAI,OAAO,IAAI,OAAO;AAAA,MACpB,GAAG,qBAAqB,KAAK;AAAA,MAC7B,UAAU;AAAA;AAAA,IACZ,CAAC;AACD,UAAM,KAAK,QAAQ;AACnB,UAAM,WAAW,KAAK,4BAA4B,IAAI;AACtD,UAAM,KAAK,MAAM,iBAAiB,QAAQ,EAAE;AAC5C,UAAM,KAAK,IAAI;AAAA,EACjB;AAAA,EAEA,MAAM,gBAAmC;AACvC,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,YAAM,KAAK,QAAQ;AAAA,IACrB;AACA,UAAM,SAAS,MAAM,KAAK,WAAY;AAAA,MACpC;AAAA,IACF;AACA,WAAO,OAAO,KAAK,IAAI,CAAC,QAAa,IAAI,OAAO;AAAA,EAClD;AAAA,EAEA,MAAM,eAAe,MAAgC;AACnD,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,YAAM,KAAK,QAAQ;AAAA,IACrB;AACA,UAAM,SAAS,MAAM,KAAK,WAAY,MAAM,gDAAgD;AAAA,MAC1F;AAAA,IACF,CAAC;AACD,WAAO,OAAO,KAAK,SAAS;AAAA,EAC9B;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/databases/postgresql/PostgresqlConnection.mts"],"sourcesContent":["import { connection_events, Connection as ConnectionAbs } from '../../Connection.mjs';\nimport { Client, PoolClient, PoolConfig } from 'pg';\nimport { Pool } from 'pg';\nimport { CompiledSql } from '../../types.mjs';\nimport { Query } from '../../Query.mjs';\nimport { PostgresqlQueryGrammar } from './PostgresqlQueryGrammar.mjs';\nimport { Schema } from '../../Schema.mjs';\nimport { PostgresqlSchemaGrammar } from './PostgresqlSchemaGrammar.mjs';\nimport Cursor from 'pg-cursor';\nimport { EventManager } from '@devbro/neko-helper';\n\nexport class PostgresqlConnection extends ConnectionAbs {\n private eventManager = new EventManager();\n\n on(event: connection_events, listener: (...args: any[]) => void): this {\n this.eventManager.on(event, listener);\n return this;\n }\n off(event: connection_events, listener: (...args: any[]) => void): this {\n this.eventManager.off(event, listener);\n return this;\n }\n emit(event: connection_events, ...args: any[]): Promise<boolean> {\n return this.eventManager.emit(event, ...args);\n }\n\n connection: PoolClient | undefined;\n static pool: Pool;\n\n static defaults: PoolConfig = {\n port: 5432,\n ssl: false,\n max: 20,\n idleTimeoutMillis: 1, // wait X milli seconds before closing an idle/released connection\n connectionTimeoutMillis: 30000, // wait up to 30 seconds to obtain a new connection\n maxUses: 7500,\n };\n\n constructor(params: PoolConfig) {\n super();\n if (!PostgresqlConnection.pool) {\n PostgresqlConnection.pool = new Pool({ ...PostgresqlConnection.defaults, ...params });\n }\n }\n async connect(): Promise<boolean> {\n this.eventManager.emit('connect').catch(() => {});\n this.connection = await PostgresqlConnection.pool.connect();\n return true;\n }\n async runQuery(sql: CompiledSql | string): Promise<any> {\n if (typeof sql === 'string') {\n sql = { sql: sql, bindings: [], parts: [sql] };\n }\n let counter = 1;\n let sql2 = sql.sql;\n if (sql.parts && sql.parts.length > 0) {\n sql2 = sql.parts.map((v) => (v === '?' ? '$' + counter++ : v)).join(' ');\n }\n\n this.eventManager.emit('query', { sql: sql2, bindings: sql.bindings }).catch(() => {});\n\n if (!this.isConnected()) {\n await this.connect();\n }\n const result = await this.connection!.query(sql2, sql.bindings);\n return result?.rows;\n }\n\n async runCursor(sql: CompiledSql): Promise<any> {\n return this.connection?.query(new Cursor(sql.sql, sql.bindings));\n }\n\n async disconnect(): Promise<boolean> {\n if (this.connection === undefined) {\n return true;\n }\n await this.connection?.release();\n this.connection = undefined;\n this.eventManager.emit('disconnect').catch(() => {});\n return true;\n }\n\n getQuery(): Query {\n return new Query(this, new PostgresqlQueryGrammar());\n }\n\n getSchema(): Schema {\n return new Schema(this, new PostgresqlSchemaGrammar());\n }\n\n getQueryGrammar(): PostgresqlQueryGrammar {\n return new PostgresqlQueryGrammar();\n }\n getSchemaGrammar(): PostgresqlSchemaGrammar {\n return new PostgresqlSchemaGrammar();\n }\n\n async beginTransaction(): Promise<void> {\n await this.runQuery({ sql: 'BEGIN', bindings: [], parts: ['BEGIN'] });\n }\n\n async commit(): Promise<void> {\n await this.runQuery({ sql: 'COMMIT', bindings: [], parts: ['COMMIT'] });\n }\n\n async rollback(): Promise<void> {\n await this.runQuery({ sql: 'ROLLBACK', bindings: [], parts: ['ROLLBACK'] });\n }\n\n static destroy(): Promise<void> {\n return PostgresqlConnection.pool.end();\n }\n\n isConnected(): boolean {\n return this.connection !== undefined;\n }\n\n /**\n * Validates and escapes a PostgreSQL identifier (database name, table name, etc.)\n * Uses a whitelist approach to ensure only safe characters are allowed\n */\n private validateAndEscapeIdentifier(name: string): string {\n // PostgreSQL identifiers can contain: letters, digits, underscores, and dollar signs\n // They must start with a letter or underscore\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_$]*$/;\n\n if (!validIdentifierPattern.test(name)) {\n throw new Error(\n `Invalid identifier: \"${name}\". Identifiers must start with a letter or underscore and contain only letters, digits, underscores, and dollar signs.`\n );\n }\n\n // PostgreSQL reserved keywords that should be quoted\n const reservedKeywords = new Set([\n 'user',\n 'table',\n 'database',\n 'order',\n 'group',\n 'select',\n 'insert',\n 'update',\n 'delete',\n ]);\n\n // Quote the identifier if it's a reserved keyword or contains uppercase letters\n if (reservedKeywords.has(name.toLowerCase()) || name !== name.toLowerCase()) {\n // Escape any double quotes in the name\n const escapedName = name.replace(/\"/g, '\"\"');\n return `\"${escapedName}\"`;\n }\n\n return name;\n }\n\n async createDatabase(name: string): Promise<void> {\n if (this.isConnected()) {\n const safeName = this.validateAndEscapeIdentifier(name);\n await this.runQuery(`CREATE DATABASE ${safeName}`);\n return;\n }\n\n const conn = new Client({\n ...PostgresqlConnection.pool.options,\n database: 'postgres',\n });\n await conn.connect();\n const safeName = this.validateAndEscapeIdentifier(name);\n await conn.query(`CREATE DATABASE ${safeName}`);\n await conn.end();\n }\n\n async dropDatabase(name: string): Promise<void> {\n if (this.isConnected()) {\n const safeName = this.validateAndEscapeIdentifier(name);\n await this.runQuery(`DROP DATABASE ${safeName}`);\n return;\n }\n\n const conn = new Client({\n ...PostgresqlConnection.pool.options,\n database: 'postgres', // connect to default 'postgres' database to drop others\n });\n await conn.connect();\n const safeName = this.validateAndEscapeIdentifier(name);\n await conn.query(`DROP DATABASE ${safeName}`);\n await conn.end();\n }\n\n async listDatabases(): Promise<string[]> {\n if (!this.isConnected()) {\n await this.connect();\n }\n const result = await this.connection!.query(\n 'SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname'\n );\n return result.rows.map((row: any) => row.datname);\n }\n\n async existsDatabase(name: string): Promise<boolean> {\n if (!this.isConnected()) {\n const conn = new Client({\n ...PostgresqlConnection.pool.options,\n database: 'postgres',\n });\n await conn.connect();\n const safeName = this.validateAndEscapeIdentifier(name);\n const result = await conn.query('SELECT 1 FROM pg_database WHERE datname = $1', [\n safeName,\n ]);\n await conn.end();\n return result.rows.length > 0;\n }\n\n const result = await this.connection!.query('SELECT 1 FROM pg_database WHERE datname = $1', [\n name,\n ]);\n return result.rows.length > 0;\n }\n}\n"],"mappings":";;AAAA,SAA4B,cAAc,qBAAqB;AAC/D,SAAS,cAAsC;AAC/C,SAAS,YAAY;AAErB,SAAS,aAAa;AACtB,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,+BAA+B;AACxC,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAEtB,MAAM,6BAA6B,cAAc;AAAA,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M,OAAO,IAAI,OAAO;AAAA,MACtB,GAAG,qBAAqB,KAAK;AAAA,MAC7B,UAAU;AAAA;AAAA,IACZ,CAAC;AACD,UAAM,KAAK,QAAQ;AACnB,UAAM,WAAW,KAAK,4BAA4B,IAAI;AACtD,UAAM,KAAK,MAAM,iBAAiB,QAAQ,EAAE;AAC5C,UAAM,KAAK,IAAI;AAAA,EACjB;AAAA,EAEA,MAAM,gBAAmC;AACvC,QAAI,CAAC,KAAK,YAAY,GAAG;AACvB,YAAM,KAAK,QAAQ;AAAA,IACrB;AACA,UAAM,SAAS,MAAM,KAAK,WAAY;AAAA,MACpC;AAAA,IACF;AACA,WAAO,OAAO,KAAK,IAAI,CAAC,QAAa,IAAI,OAAO;AAAA,EAClD;AAAA,EAEA,MAAM,eAAe,MAAgC;AACnD,QAAI,CAAC,KAAK,YAAY,GAAG;AACrB,YAAM,OAAO,IAAI,OAAO;AAAA,QACtB,GAAG,qBAAqB,KAAK;AAAA,QAC7B,UAAU;AAAA,MACZ,CAAC;AACD,YAAM,KAAK,QAAQ;AACnB,YAAM,WAAW,KAAK,4BAA4B,IAAI;AACtD,YAAMC,UAAS,MAAM,KAAK,MAAM,gDAAgD;AAAA,QAC9E;AAAA,MACF,CAAC;AACD,YAAM,KAAK,IAAI;AACf,aAAOA,QAAO,KAAK,SAAS;AAAA,IAChC;AAEA,UAAM,SAAS,MAAM,KAAK,WAAY,MAAM,gDAAgD;AAAA,MAC1F;AAAA,IACF,CAAC;AACD,WAAO,OAAO,KAAK,SAAS;AAAA,EAC9B;AACF;","names":["safeName","result"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as QueryGrammar, d as Query, m as CompiledSql, P as Parameter } from '../../Blueprint-
|
|
1
|
+
import { e as QueryGrammar, d as Query, m as CompiledSql, P as Parameter } from '../../Blueprint-g4SmS1bH.mjs';
|
|
2
2
|
import '@devbro/neko-helper';
|
|
3
3
|
|
|
4
4
|
declare class PostgresqlQueryGrammar extends QueryGrammar {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PostgresqlConnection } from './PostgresqlConnection.mjs';
|
|
2
2
|
export { PostgresqlQueryGrammar } from './PostgresqlQueryGrammar.mjs';
|
|
3
3
|
export { PostgresqlSchemaGrammar } from './PostgresqlSchemaGrammar.mjs';
|
|
4
|
-
import '../../Blueprint-
|
|
4
|
+
import '../../Blueprint-g4SmS1bH.mjs';
|
|
5
5
|
import '@devbro/neko-helper';
|
|
6
6
|
import 'pg';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { b as Connection, c as connection_events, m as CompiledSql, d as Query, S as Schema } from '../../Blueprint-g4SmS1bH.mjs';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
import { SqliteQueryGrammar } from './SqliteQueryGrammar.mjs';
|
|
4
|
+
import { SqliteSchemaGrammar } from './SqliteSchemaGrammar.mjs';
|
|
5
|
+
import '@devbro/neko-helper';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for SQLite database connection
|
|
9
|
+
*/
|
|
10
|
+
interface SqliteConfig {
|
|
11
|
+
/** Path to the SQLite database file */
|
|
12
|
+
filename: string;
|
|
13
|
+
/** Open the database in read-only mode (default: false) */
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
/** Throw an error if the database file doesn't exist (default: false) */
|
|
16
|
+
fileMustExist?: boolean;
|
|
17
|
+
/** Timeout in milliseconds for database operations (default: 5000) */
|
|
18
|
+
timeout?: number;
|
|
19
|
+
/** Optional verbose logging function for debugging SQL statements */
|
|
20
|
+
verbose?: (message?: unknown, ...additionalArgs: unknown[]) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SQLite database connection implementation
|
|
24
|
+
*
|
|
25
|
+
* Provides a connection to SQLite databases using better-sqlite3.
|
|
26
|
+
* Supports transactions, queries, schema operations, and database management.
|
|
27
|
+
*/
|
|
28
|
+
declare class SqliteConnection extends Connection {
|
|
29
|
+
private eventManager;
|
|
30
|
+
on(event: connection_events, listener: (...args: any[]) => void): this;
|
|
31
|
+
off(event: connection_events, listener: (...args: any[]) => void): this;
|
|
32
|
+
emit(event: connection_events, ...args: any[]): Promise<boolean>;
|
|
33
|
+
connection: Database.Database | undefined;
|
|
34
|
+
private config;
|
|
35
|
+
/** Default configuration values for SQLite connections */
|
|
36
|
+
static defaults: Partial<SqliteConfig>;
|
|
37
|
+
constructor(params: SqliteConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Establishes a connection to the SQLite database
|
|
40
|
+
* Creates or opens the database file specified in the configuration
|
|
41
|
+
*/
|
|
42
|
+
connect(): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Executes a SQL query against the database
|
|
45
|
+
* Automatically detects SELECT queries and queries with RETURNING clauses
|
|
46
|
+
*
|
|
47
|
+
* @param sql - Compiled SQL or raw SQL string to execute
|
|
48
|
+
* @returns Query results (rows for SELECT, run info for INSERT/UPDATE/DELETE)
|
|
49
|
+
*/
|
|
50
|
+
runQuery(sql: CompiledSql | string): Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes a query and returns an iterator for streaming results
|
|
53
|
+
* Useful for large result sets to avoid loading all rows into memory
|
|
54
|
+
*
|
|
55
|
+
* @param sql - Compiled SQL to execute
|
|
56
|
+
* @returns Iterator over query results
|
|
57
|
+
*/
|
|
58
|
+
runCursor(sql: CompiledSql): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Closes the database connection
|
|
61
|
+
*/
|
|
62
|
+
disconnect(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new query builder instance for this connection
|
|
65
|
+
*/
|
|
66
|
+
getQuery(): Query;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new schema builder instance for this connection
|
|
69
|
+
*/
|
|
70
|
+
getSchema(): Schema;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the query grammar for building SQL statements
|
|
73
|
+
*/
|
|
74
|
+
getQueryGrammar(): SqliteQueryGrammar;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the schema grammar for building DDL statements
|
|
77
|
+
*/
|
|
78
|
+
getSchemaGrammar(): SqliteSchemaGrammar;
|
|
79
|
+
/**
|
|
80
|
+
* Starts a new database transaction
|
|
81
|
+
*/
|
|
82
|
+
beginTransaction(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Commits the current transaction
|
|
85
|
+
*/
|
|
86
|
+
commit(): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Rolls back the current transaction
|
|
89
|
+
*/
|
|
90
|
+
rollback(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Checks if the database connection is active
|
|
93
|
+
*/
|
|
94
|
+
isConnected(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Validates and escapes a SQLite identifier (database name, table name, etc.)
|
|
97
|
+
* Uses a whitelist approach to ensure only safe characters are allowed
|
|
98
|
+
*
|
|
99
|
+
* @param name - The identifier to validate and escape
|
|
100
|
+
* @returns The escaped identifier, quoted if it's a reserved keyword
|
|
101
|
+
* @throws Error if the identifier contains invalid characters
|
|
102
|
+
*/
|
|
103
|
+
private validateAndEscapeIdentifier;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new SQLite database file
|
|
106
|
+
*
|
|
107
|
+
* @param name - Name or path of the database file to create
|
|
108
|
+
*/
|
|
109
|
+
createDatabase(name: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Deletes a SQLite database file
|
|
112
|
+
*
|
|
113
|
+
* @param name - Name or path of the database file to delete
|
|
114
|
+
*/
|
|
115
|
+
dropDatabase(name: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Lists available databases
|
|
118
|
+
* For SQLite, this returns the current database filename
|
|
119
|
+
*
|
|
120
|
+
* @returns Array containing the current database filename
|
|
121
|
+
*/
|
|
122
|
+
listDatabases(): Promise<string[]>;
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a database file exists
|
|
125
|
+
*
|
|
126
|
+
* @param name - Name or path of the database file to check
|
|
127
|
+
* @returns True if the database file exists, false otherwise
|
|
128
|
+
*/
|
|
129
|
+
existsDatabase(name: string): Promise<boolean>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { type SqliteConfig, SqliteConnection };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Connection as ConnectionAbs } from "../../Connection.mjs";
|
|
4
|
+
import Database from "better-sqlite3";
|
|
5
|
+
import { Query } from "../../Query.mjs";
|
|
6
|
+
import { SqliteQueryGrammar } from "./SqliteQueryGrammar.mjs";
|
|
7
|
+
import { Schema } from "../../Schema.mjs";
|
|
8
|
+
import { SqliteSchemaGrammar } from "./SqliteSchemaGrammar.mjs";
|
|
9
|
+
import { EventManager } from "@devbro/neko-helper";
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
class SqliteConnection extends ConnectionAbs {
|
|
12
|
+
static {
|
|
13
|
+
__name(this, "SqliteConnection");
|
|
14
|
+
}
|
|
15
|
+
eventManager = new EventManager();
|
|
16
|
+
on(event, listener) {
|
|
17
|
+
this.eventManager.on(event, listener);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
off(event, listener) {
|
|
21
|
+
this.eventManager.off(event, listener);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
emit(event, ...args) {
|
|
25
|
+
return this.eventManager.emit(event, ...args);
|
|
26
|
+
}
|
|
27
|
+
connection;
|
|
28
|
+
config;
|
|
29
|
+
/** Default configuration values for SQLite connections */
|
|
30
|
+
static defaults = {
|
|
31
|
+
readonly: false,
|
|
32
|
+
fileMustExist: false,
|
|
33
|
+
timeout: 5e3
|
|
34
|
+
};
|
|
35
|
+
constructor(params) {
|
|
36
|
+
super();
|
|
37
|
+
this.config = { ...SqliteConnection.defaults, ...params };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Establishes a connection to the SQLite database
|
|
41
|
+
* Creates or opens the database file specified in the configuration
|
|
42
|
+
*/
|
|
43
|
+
async connect() {
|
|
44
|
+
this.eventManager.emit("connect").catch(() => {
|
|
45
|
+
});
|
|
46
|
+
this.connection = new Database(this.config.filename, {
|
|
47
|
+
readonly: this.config.readonly,
|
|
48
|
+
fileMustExist: this.config.fileMustExist,
|
|
49
|
+
timeout: this.config.timeout,
|
|
50
|
+
verbose: this.config.verbose
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Executes a SQL query against the database
|
|
56
|
+
* Automatically detects SELECT queries and queries with RETURNING clauses
|
|
57
|
+
*
|
|
58
|
+
* @param sql - Compiled SQL or raw SQL string to execute
|
|
59
|
+
* @returns Query results (rows for SELECT, run info for INSERT/UPDATE/DELETE)
|
|
60
|
+
*/
|
|
61
|
+
async runQuery(sql) {
|
|
62
|
+
if (typeof sql === "string") {
|
|
63
|
+
sql = { sql, bindings: [], parts: [sql] };
|
|
64
|
+
}
|
|
65
|
+
this.eventManager.emit("query", { sql: sql.sql, bindings: sql.bindings }).catch(() => {
|
|
66
|
+
});
|
|
67
|
+
if (!this.isConnected()) {
|
|
68
|
+
await this.connect();
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const stmt = this.connection.prepare(sql.sql);
|
|
72
|
+
const sqlUpper = sql.sql.trim().toUpperCase();
|
|
73
|
+
if (sqlUpper.startsWith("SELECT") || sqlUpper.includes("RETURNING")) {
|
|
74
|
+
return stmt.all(...sql.bindings);
|
|
75
|
+
} else {
|
|
76
|
+
const result = stmt.run(...sql.bindings);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
this.eventManager.emit("error", error).catch(() => {
|
|
81
|
+
});
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Executes a query and returns an iterator for streaming results
|
|
87
|
+
* Useful for large result sets to avoid loading all rows into memory
|
|
88
|
+
*
|
|
89
|
+
* @param sql - Compiled SQL to execute
|
|
90
|
+
* @returns Iterator over query results
|
|
91
|
+
*/
|
|
92
|
+
async runCursor(sql) {
|
|
93
|
+
if (!this.isConnected()) {
|
|
94
|
+
await this.connect();
|
|
95
|
+
}
|
|
96
|
+
const stmt = this.connection.prepare(sql.sql);
|
|
97
|
+
return stmt.iterate(...sql.bindings);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Closes the database connection
|
|
101
|
+
*/
|
|
102
|
+
async disconnect() {
|
|
103
|
+
if (this.connection === void 0) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
this.connection.close();
|
|
107
|
+
this.connection = void 0;
|
|
108
|
+
this.eventManager.emit("disconnect").catch(() => {
|
|
109
|
+
});
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Creates a new query builder instance for this connection
|
|
114
|
+
*/
|
|
115
|
+
getQuery() {
|
|
116
|
+
return new Query(this, new SqliteQueryGrammar());
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new schema builder instance for this connection
|
|
120
|
+
*/
|
|
121
|
+
getSchema() {
|
|
122
|
+
return new Schema(this, new SqliteSchemaGrammar());
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Gets the query grammar for building SQL statements
|
|
126
|
+
*/
|
|
127
|
+
getQueryGrammar() {
|
|
128
|
+
return new SqliteQueryGrammar();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets the schema grammar for building DDL statements
|
|
132
|
+
*/
|
|
133
|
+
getSchemaGrammar() {
|
|
134
|
+
return new SqliteSchemaGrammar();
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Starts a new database transaction
|
|
138
|
+
*/
|
|
139
|
+
async beginTransaction() {
|
|
140
|
+
await this.runQuery({
|
|
141
|
+
sql: "BEGIN TRANSACTION",
|
|
142
|
+
bindings: [],
|
|
143
|
+
parts: ["BEGIN", "TRANSACTION"]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Commits the current transaction
|
|
148
|
+
*/
|
|
149
|
+
async commit() {
|
|
150
|
+
await this.runQuery({ sql: "COMMIT", bindings: [], parts: ["COMMIT"] });
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Rolls back the current transaction
|
|
154
|
+
*/
|
|
155
|
+
async rollback() {
|
|
156
|
+
await this.runQuery({ sql: "ROLLBACK", bindings: [], parts: ["ROLLBACK"] });
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Checks if the database connection is active
|
|
160
|
+
*/
|
|
161
|
+
isConnected() {
|
|
162
|
+
return this.connection !== void 0 && this.connection.open;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Validates and escapes a SQLite identifier (database name, table name, etc.)
|
|
166
|
+
* Uses a whitelist approach to ensure only safe characters are allowed
|
|
167
|
+
*
|
|
168
|
+
* @param name - The identifier to validate and escape
|
|
169
|
+
* @returns The escaped identifier, quoted if it's a reserved keyword
|
|
170
|
+
* @throws Error if the identifier contains invalid characters
|
|
171
|
+
*/
|
|
172
|
+
validateAndEscapeIdentifier(name) {
|
|
173
|
+
const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
174
|
+
if (!validIdentifierPattern.test(name)) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Invalid identifier: "${name}". Identifiers must start with a letter or underscore and contain only letters, digits, and underscores.`
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
const reservedKeywords = /* @__PURE__ */ new Set([
|
|
180
|
+
"table",
|
|
181
|
+
"database",
|
|
182
|
+
"order",
|
|
183
|
+
"group",
|
|
184
|
+
"select",
|
|
185
|
+
"insert",
|
|
186
|
+
"update",
|
|
187
|
+
"delete",
|
|
188
|
+
"index",
|
|
189
|
+
"from",
|
|
190
|
+
"where"
|
|
191
|
+
]);
|
|
192
|
+
if (reservedKeywords.has(name.toLowerCase())) {
|
|
193
|
+
const escapedName = name.replace(/"/g, '""');
|
|
194
|
+
return `"${escapedName}"`;
|
|
195
|
+
}
|
|
196
|
+
return name;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Creates a new SQLite database file
|
|
200
|
+
*
|
|
201
|
+
* @param name - Name or path of the database file to create
|
|
202
|
+
*/
|
|
203
|
+
async createDatabase(name) {
|
|
204
|
+
const dbPath = name.endsWith(".db") ? name : `${name}.db`;
|
|
205
|
+
const tempDb = new Database(dbPath);
|
|
206
|
+
tempDb.close();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Deletes a SQLite database file
|
|
210
|
+
*
|
|
211
|
+
* @param name - Name or path of the database file to delete
|
|
212
|
+
*/
|
|
213
|
+
async dropDatabase(name) {
|
|
214
|
+
const dbPath = name.endsWith(".db") ? name : `${name}.db`;
|
|
215
|
+
if (fs.existsSync(dbPath)) {
|
|
216
|
+
fs.unlinkSync(dbPath);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Lists available databases
|
|
221
|
+
* For SQLite, this returns the current database filename
|
|
222
|
+
*
|
|
223
|
+
* @returns Array containing the current database filename
|
|
224
|
+
*/
|
|
225
|
+
async listDatabases() {
|
|
226
|
+
return [this.config.filename];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Checks if a database file exists
|
|
230
|
+
*
|
|
231
|
+
* @param name - Name or path of the database file to check
|
|
232
|
+
* @returns True if the database file exists, false otherwise
|
|
233
|
+
*/
|
|
234
|
+
async existsDatabase(name) {
|
|
235
|
+
const dbPath = name.endsWith(".db") ? name : `${name}.db`;
|
|
236
|
+
return fs.existsSync(dbPath);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
export {
|
|
240
|
+
SqliteConnection
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=SqliteConnection.mjs.map
|