@restura/core 0.1.0-alpha.16 → 0.1.0-alpha.17

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.mjs CHANGED
@@ -2657,12 +2657,40 @@ var restura = new ResturaEngine();
2657
2657
  // src/restura/sql/PsqlTransaction.ts
2658
2658
  import pg4 from "pg";
2659
2659
  var { Client: Client2 } = pg4;
2660
+ var PsqlTransaction = class extends PsqlConnection {
2661
+ constructor(clientConfig) {
2662
+ super();
2663
+ this.clientConfig = clientConfig;
2664
+ this.client = new Client2(clientConfig);
2665
+ this.beginTransactionPromise = this.beginTransaction();
2666
+ }
2667
+ async beginTransaction() {
2668
+ return this.query("BEGIN");
2669
+ }
2670
+ async rollback() {
2671
+ return this.query("ROLLBACK");
2672
+ }
2673
+ async commit() {
2674
+ return this.query("COMMIT");
2675
+ }
2676
+ async release() {
2677
+ return this.client.end();
2678
+ }
2679
+ async query(query, values) {
2680
+ await this.client.connect();
2681
+ await this.beginTransactionPromise;
2682
+ return this.client.query(query, values);
2683
+ }
2684
+ };
2660
2685
  export {
2661
2686
  HtmlStatusCodes,
2687
+ PsqlConnection,
2662
2688
  PsqlPool,
2689
+ PsqlTransaction,
2663
2690
  RsError,
2664
2691
  SQL,
2665
2692
  escapeColumnName,
2693
+ eventManager_default as eventManager,
2666
2694
  insertObjectQuery,
2667
2695
  isValueNumber2 as isValueNumber,
2668
2696
  logger,