Skip to content

Commit

Permalink
resolve Promise of Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
shahrul committed Sep 29, 2023
1 parent e82d381 commit 45e6982
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions libs/executeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const executeQuery = async (query, currentQuery, opts, mergeQuery = {}) => {
if (alias) {
key = `${key}/${alias}`
}
if(currentQuery instanceof Promise) {
currentQuery = await currentQuery
}
if (value instanceof Object) {
currentQuery = await resolvePromises(currentQuery)
result = await executeQuery(value, currentQuery, { methods, config }, mergeQuery)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@syarul/requrse",
"version": "0.1.7",
"version": "0.1.8",
"description": "Lightweight driven query language",
"main": "libs/executor.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion samples/redis/redis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('dotenv').config()

const requrseRedis = require('./redis.middleware')

const redis = new Redis(`rediss://default:${process.env.REDIS_KEY}@exciting-ram-37907.upstash.io:37907`)
const redis = new Redis(`rediss://default:${process.env.REDIS_KEY}@willing-cowbird-38871.upstash.io:38871`)

const redisKey = 'books'
const memberKey = 'books_ids'
Expand Down

0 comments on commit 45e6982

Please sign in to comment.