@strapi/database 4.19.0 → 4.20.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.mjs CHANGED
@@ -3794,9 +3794,15 @@ class ReadableStrapiQuery extends Readable {
3794
3794
  }
3795
3795
  const storage = new AsyncLocalStorage();
3796
3796
  const transactionCtx = {
3797
- async run(store, cb) {
3797
+ async run(trx, cb) {
3798
+ const store = storage.getStore();
3798
3799
  return storage.run(
3799
- { trx: store, commitCallbacks: [], rollbackCallbacks: [] },
3800
+ {
3801
+ trx,
3802
+ // Fill with existing callbacks if nesting transactions
3803
+ commitCallbacks: store?.commitCallbacks || [],
3804
+ rollbackCallbacks: store?.rollbackCallbacks || []
3805
+ },
3800
3806
  cb
3801
3807
  );
3802
3808
  },