@wxn0brp/db-storage-sqlite 0.120.1 → 0.120.2-alpha.0

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.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { ValtheraClass } from "@wxn0brp/db-core";
1
+ import { Id, ValtheraClass } from "@wxn0brp/db-core";
2
2
  import { ActionsBase } from "@wxn0brp/db-core/base/actions";
3
3
  import { Data } from "@wxn0brp/db-core/types/data";
4
4
  import { VQueryT } from "@wxn0brp/db-core/types/query";
5
+ import { TransactionHandle } from "@wxn0brp/db-core/types/transaction";
5
6
  import { AffinityMap, SupportedDB, VStatement } from "./types.js";
6
7
  export declare class SQLiteValthera extends ActionsBase {
7
8
  db: SupportedDB;
@@ -34,6 +35,9 @@ export declare class SQLiteValthera extends ActionsBase {
34
35
  removeCollection(collection: string): Promise<boolean>;
35
36
  issetCollection(collection: string): Promise<boolean>;
36
37
  ensureCollection(collection: string): Promise<boolean>;
38
+ beginTransaction(id: Id): Promise<TransactionHandle>;
39
+ commitTransaction(handle: TransactionHandle): Promise<void>;
40
+ rollbackTransaction(handle: TransactionHandle): Promise<void>;
37
41
  }
38
42
  export declare function createSQLiteValthera<T extends Record<string, Data> = {}>(sqlDB: SupportedDB): ValtheraClass & { [K in keyof T]: import("@wxn0brp/db-core/helpers/collection").Collection<T[K]>; };
39
43
  export declare const DYNAMIC: {
package/dist/index.js CHANGED
@@ -185,6 +185,21 @@ export class SQLiteValthera extends ActionsBase {
185
185
  }
186
186
  return true;
187
187
  }
188
+ async beginTransaction(id) {
189
+ const stmt = await this._prepare("BEGIN");
190
+ await execStmt(stmt, "run");
191
+ return {
192
+ id,
193
+ };
194
+ }
195
+ async commitTransaction(handle) {
196
+ const stmt = await this._prepare("COMMIT");
197
+ await execStmt(stmt, "run");
198
+ }
199
+ async rollbackTransaction(handle) {
200
+ const stmt = await this._prepare("ROLLBACK");
201
+ await execStmt(stmt, "run");
202
+ }
188
203
  }
189
204
  export function createSQLiteValthera(sqlDB) {
190
205
  const adapter = new SQLiteValthera(sqlDB);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.120.1";
1
+ export declare const version = "0.120.2-alpha.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.120.1";
1
+ export const version = "0.120.2-alpha.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-sqlite",
3
- "version": "0.120.1",
3
+ "version": "0.120.2-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "A pure SQLite storage adapter for the ValtheraDB database library",
@@ -19,7 +19,7 @@
19
19
  "sqlite"
20
20
  ],
21
21
  "dependencies": {
22
- "@wxn0brp/db-core": "^0.12.2"
22
+ "@wxn0brp/db-core": "^0.12.4-alpha.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/better-sqlite3": "^9.6.0",