@travetto/model-sqlite 5.0.17 → 5.0.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ArcSine Technologies
3
+ Copyright (c) 2020 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-sqlite",
3
- "version": "5.0.17",
3
+ "version": "5.0.19",
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.13",
30
- "@travetto/context": "^5.0.13",
31
- "@travetto/model": "^5.0.14",
32
- "@travetto/model-query": "^5.0.14",
33
- "@travetto/model-sql": "^5.0.17",
34
- "@types/better-sqlite3": "^7.6.11",
35
- "better-sqlite3": "^11.5.0"
29
+ "@travetto/config": "^5.0.15",
30
+ "@travetto/context": "^5.0.15",
31
+ "@travetto/model": "^5.0.16",
32
+ "@travetto/model-query": "^5.0.16",
33
+ "@travetto/model-sql": "^5.0.19",
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 };