@synatic/noql
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -43,6 +43,5 @@ const getParsedValueFromBinaryExpressionModule = require('./getParsedValueFromBinaryExpression'); | ||
if (expr.args && expr.args.value) { | ||
const args = $check.array(expr.args.value) | ||
? expr.args.value | ||
: [expr.args.value]; | ||
if ((expr.args && expr.args.value) || fn.doesNotNeedArgs) { | ||
const argsVal = expr.args ? expr.args.value : []; | ||
const args = $check.array(argsVal) ? argsVal : [argsVal]; | ||
return fn.parse( | ||
@@ -77,3 +76,3 @@ args.map((a) => makeArg(a, depth)), | ||
if (expr.type === 'function') { | ||
return makeProjectionExpressionPart(expr); | ||
return makeProjectionExpressionPart(expr, depth); | ||
} | ||
@@ -86,3 +85,5 @@ | ||
return getParsedValueFromBinaryExpressionModule.getParsedValueFromBinaryExpression( | ||
expr | ||
expr, | ||
null, | ||
depth | ||
); | ||
@@ -98,3 +99,5 @@ } | ||
if (expr.operator === '-') { | ||
return {$multiply: [-1, makeProjectionExpressionPart(expr.expr)]}; | ||
return { | ||
$multiply: [-1, makeProjectionExpressionPart(expr.expr, depth)], | ||
}; | ||
} else { | ||
@@ -101,0 +104,0 @@ throw new Error( |
@@ -202,2 +202,4 @@ import type {Document, Sort} from 'mongodb'; | ||
jsonSchemaReturnType: JSONSchemaTypeName | SchemaFn; | ||
/** Specifies if this function is allowed to run without parentheses. E.g. current_date */ | ||
doesNotNeedArgs?: boolean; | ||
//TODO Rk, would be good to have a description here and auto generate docs | ||
@@ -204,0 +206,0 @@ } |
{ | ||
"name": "@synatic/noql", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Convert SQL statements to mongo queries or aggregates", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258654
6251