title: Can we Chain awaited Promise just like Prisma library?
body: <p>I am looking for possible solutions to chain promises just like shown below.</p>
  
  <pre class="lang-js prettyprint-override"><code>const getDetailsFromDb = await prisma.someTableNames().field()
  </code></pre>
  
  <p>Because the only possible way I know is as follows:</p>
  
  <pre class="lang-js prettyprint-override"><code>const SomethingToBeChained = function() {
     // where every method of object attached
     // to this instance should return this itself
     // so other properties attached to it can be accecd.
     return this
  }
  SomethingToBeChained.prototype = {
     methodOne: function () { ...do something...; return this }
     methodTwo: function () { ...do something...; return this }
  }
  
  // now one can do following.
  SomethingToBeChained.methodOne().methodTwo()
  </code></pre>
  
  <p>But prisma client can do both how? Can anyone explain me how this works behind the scene of the <code>prisma</code> client. How does its structure achieve to call await and chain objects same time?</p>
  
  <p>Only possible way I know ?</p>
  
  <pre class="lang-js prettyprint-override"><code>const somethingAwaited = (await SomethingToBeChainedIsPromise().wantToChainSomethingButCant()) &lt;--- Ugly
  const wantThis = await SomethingToBeChainedIsPromise().wantToChainSomethingButCant()
  </code></pre>