How to resolve Node.js Promise in N-Api Addon C

Answer to the following stack overflow post is explaining this scenario too. In that answer the resolve/reject of the deferred promise is being done in CompleteMyPromise1() function.

How to create async function using NAPI that return Promises