@travetto/model-sqlite 5.0.17 → 5.0.18
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/LICENSE +1 -1
- package/package.json +8 -8
- package/src/connection.ts +2 -2
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sqlite",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.18",
|
|
4
4
|
"description": "SQLite backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"directory": "module/model-sqlite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^5.0.
|
|
30
|
-
"@travetto/context": "^5.0.
|
|
31
|
-
"@travetto/model": "^5.0.
|
|
32
|
-
"@travetto/model-query": "^5.0.
|
|
33
|
-
"@travetto/model-sql": "^5.0.
|
|
34
|
-
"@types/better-sqlite3": "^7.6.
|
|
35
|
-
"better-sqlite3": "^11.
|
|
29
|
+
"@travetto/config": "^5.0.14",
|
|
30
|
+
"@travetto/context": "^5.0.14",
|
|
31
|
+
"@travetto/model": "^5.0.15",
|
|
32
|
+
"@travetto/model-query": "^5.0.15",
|
|
33
|
+
"@travetto/model-sql": "^5.0.18",
|
|
34
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
35
|
+
"better-sqlite3": "^11.7.0"
|
|
36
36
|
},
|
|
37
37
|
"travetto": {
|
|
38
38
|
"displayName": "SQLite Model Service",
|
package/src/connection.ts
CHANGED
|
@@ -72,11 +72,11 @@ export class SqliteConnection extends Connection<Database> {
|
|
|
72
72
|
ShutdownManager.onGracefulShutdown(() => this.#pool.clear(), this);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
async execute<T = unknown>(conn: Database, query: string): Promise<{ count: number, records: T[] }> {
|
|
75
|
+
async execute<T = unknown>(conn: Database, query: string, values?: unknown[]): Promise<{ count: number, records: T[] }> {
|
|
76
76
|
return this.#withRetries(async () => {
|
|
77
77
|
console.debug('Executing query', { query });
|
|
78
78
|
try {
|
|
79
|
-
const out = await conn.prepare<unknown[], T>(query)[query.trim().startsWith('SELECT') ? 'all' : 'run']();
|
|
79
|
+
const out = await conn.prepare<unknown[], T>(query)[query.trim().startsWith('SELECT') ? 'all' : 'run'](...values ?? []);
|
|
80
80
|
if (Array.isArray(out)) {
|
|
81
81
|
const records: T[] = out.map(v => ({ ...v }));
|
|
82
82
|
return { count: out.length, records };
|