title: Knex.js return transactionScope in promise
body: <p>I've got a function setClaims which is simply setting claims for current transaction. I need to create a helper function which will check if uuid was provided, set claims and return the transaction object. Something like this:</p>
  
  <pre><code>export const useAuthTransaction = async (
    kx: Knex,
    setClaims: (tx: Knex.Transaction, uuid?: string) =&gt; Promise&lt;any&gt;,
    uuid?: string,
  ): Promise&lt;Knex.Transaction&gt; =&gt; {
    if (!uuid) {
      throw { errorCodes: [RemoveQuestionErrorCode.Unauthorized] };
    }
  
    return kx.transaction(async tx =&gt; {
      await setClaims(tx);
      return tx;
    });
  };
  </code></pre>
  
  <p>But when I try to use it in my resolver:</p>
  
  <pre><code>useAuthTransaction(kx, setClaims, claims?.uid).then(async tx =&gt;
    dataSources.questionAPI.update(tx, input));
  </code></pre>
  
  <p>it says:</p>
  
  <blockquote>
    <p>Transaction query already complete</p>
  </blockquote>
  
  <p>How do I resolve transaction context without closing it?</p>