@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.js CHANGED
@@ -3828,9 +3828,15 @@ class ReadableStrapiQuery extends stream.Readable {
3828
3828
  }
3829
3829
  const storage = new node_async_hooks.AsyncLocalStorage();
3830
3830
  const transactionCtx = {
3831
- async run(store, cb) {
3831
+ async run(trx, cb) {
3832
+ const store = storage.getStore();
3832
3833
  return storage.run(
3833
- { trx: store, commitCallbacks: [], rollbackCallbacks: [] },
3834
+ {
3835
+ trx,
3836
+ // Fill with existing callbacks if nesting transactions
3837
+ commitCallbacks: store?.commitCallbacks || [],
3838
+ rollbackCallbacks: store?.rollbackCallbacks || []
3839
+ },
3834
3840
  cb
3835
3841
  );
3836
3842
  },