pqb 0.18.26 → 0.18.27

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
@@ -7657,22 +7657,42 @@ const queryMethodByReturnType = {
7657
7657
  rowCount: "arrays",
7658
7658
  void: "arrays"
7659
7659
  };
7660
- let queryError = void 0;
7661
7660
  class Then {
7662
- get then() {
7661
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7662
+ catch(fn) {
7663
+ return this.then(void 0, fn);
7664
+ }
7665
+ }
7666
+ let queryError = void 0;
7667
+ let getThen;
7668
+ if (process.versions.bun) {
7669
+ getThen = function() {
7670
+ queryError = new Error();
7671
+ if (!this.internal)
7672
+ return maybeWrappedThen;
7673
+ const trx = this.internal.transactionStorage.getStore();
7674
+ if (!trx)
7675
+ return maybeWrappedThen;
7676
+ return (resolve, reject) => {
7677
+ return this.internal.transactionStorage.run(trx, () => {
7678
+ return maybeWrappedThen.call(this, resolve, reject);
7679
+ });
7680
+ };
7681
+ };
7682
+ } else {
7683
+ getThen = function() {
7663
7684
  queryError = new Error();
7664
7685
  return maybeWrappedThen;
7665
- }
7666
- set then(value) {
7686
+ };
7687
+ }
7688
+ Object.defineProperty(Then.prototype, "then", {
7689
+ get: getThen,
7690
+ set(value) {
7667
7691
  Object.defineProperty(this, "then", {
7668
7692
  value
7669
7693
  });
7670
7694
  }
7671
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7672
- catch(fn) {
7673
- return this.then(void 0, fn);
7674
- }
7675
- }
7695
+ });
7676
7696
  const handleResult = (q, returnType, result, isSubQuery) => {
7677
7697
  return parseResult(q, q.q.parsers, returnType, result, isSubQuery);
7678
7698
  };