@zeit/cosmosdb-query
Advanced tools
Comparing version 0.0.3 to 0.0.4
// | ||
const builtinFunctions = require("./builtin-functions"); | ||
@@ -19,3 +20,3 @@ module.exports = ( | ||
// $FlowFixMe | ||
return execute(collection, params); | ||
return execute(builtinFunctions, collection, params); | ||
}; |
@@ -19,2 +19,9 @@ // | ||
const definitions = { | ||
array_constant(ctx, { elements }) { | ||
return { | ||
type: "ArrayExpression", | ||
elements: elements.map(v => transform(ctx, v)) | ||
}; | ||
}, | ||
boolean_constant(ctx, { value }) { | ||
@@ -164,2 +171,13 @@ return { | ||
object_constant(ctx, { properties }) { | ||
return { | ||
type: 'ObjectExpression', | ||
properties: properties.map(({ key, value }) => ({ | ||
type: 'ObjectProperty', | ||
key: transform(ctx, key), | ||
value: transform(ctx, value) | ||
})) | ||
} | ||
}, | ||
object_property_list(ctx, { properties }) { | ||
@@ -195,6 +213,6 @@ return { | ||
scalar_array_expression(ctx, { values }) { | ||
scalar_array_expression(ctx, { elements }) { | ||
return { | ||
type: "ArrayExpression", | ||
elements: values.map(v => transform(ctx, v)) | ||
elements: elements.map(v => transform(ctx, v)) | ||
}; | ||
@@ -235,2 +253,17 @@ }, | ||
scalar_function_expression(ctx, { name, arguments: args, udf }) { | ||
return { | ||
type: 'CallExpression', | ||
callee: { | ||
type: "MemberExpression", | ||
object: { | ||
type: "Identifier", | ||
name: udf ? "udf" : "$b" | ||
}, | ||
property: transform(ctx, name) | ||
}, | ||
arguments: args.map((a) => transform(ctx, a)) | ||
} | ||
}, | ||
scalar_member_expression(ctx, { object, property, computed }) { | ||
@@ -302,6 +335,13 @@ return { | ||
params: [ | ||
// built-int functions | ||
{ | ||
type: "Identifier", | ||
name: "$b" | ||
}, | ||
// document array (collection) | ||
{ | ||
type: "Identifier", | ||
name | ||
}, | ||
// parameters | ||
{ | ||
@@ -316,3 +356,3 @@ type: "Identifier", | ||
select_specification(ctx, { "*": all, properties }) { | ||
select_specification(ctx, { "*": all, properties, value }) { | ||
if (all) { | ||
@@ -322,3 +362,3 @@ return ctx.ast; | ||
if (properties) { | ||
if (properties || value) { | ||
return { | ||
@@ -338,3 +378,3 @@ type: "CallExpression", | ||
params: ctx.document ? [ctx.document] : [], | ||
body: transform(ctx, properties) | ||
body: transform(ctx, properties || value) | ||
} | ||
@@ -341,0 +381,0 @@ ] |
{ | ||
"name": "@zeit/cosmosdb-query", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "UNLICENSED", | ||
@@ -20,4 +20,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/generator": "7.0.0-rc.3", | ||
"@babel/traverse": "7.0.0-rc.3" | ||
"@babel/generator": "7.0.0", | ||
"@babel/traverse": "7.0.0" | ||
}, | ||
@@ -27,4 +27,4 @@ "devDependencies": { | ||
"@zeit/git-hooks": "0.1.4", | ||
"babel-eslint": "8.2.6", | ||
"eslint": "5.4.0", | ||
"babel-eslint": "9.0.0", | ||
"eslint": "5.5.0", | ||
"eslint-config-airbnb": "17.1.0", | ||
@@ -36,3 +36,3 @@ "eslint-config-prettier": "3.0.1", | ||
"eslint-plugin-react": "7.11.1", | ||
"flow-bin": "0.79.1", | ||
"flow-bin": "0.80.0", | ||
"flow-remove-types": "1.2.3", | ||
@@ -39,0 +39,0 @@ "pegjs": "0.10.0", |
@@ -30,9 +30,6 @@ # cosmosdb-query | ||
- TOP operator | ||
- VALUE keyword | ||
- JOIN keyword | ||
- IN keyword | ||
- Built-in functions | ||
- Object constant | ||
- Array constant | ||
- Some Built-in functions (See [src/builtin-functions.js](https://github.com/zeit/cosmosdb-query/blob/master/src/builtin-functions.js) for supported functions) | ||
- Coalesce operator | ||
- User-defined functions |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
173548
8
6040
35
1
+ Added@babel/code-frame@7.25.7(transitive)
+ Added@babel/generator@7.0.0(transitive)
+ Added@babel/helper-function-name@7.24.7(transitive)
+ Added@babel/helper-split-export-declaration@7.24.7(transitive)
+ Added@babel/helper-string-parser@7.25.7(transitive)
+ Added@babel/helper-validator-identifier@7.25.7(transitive)
+ Added@babel/highlight@7.25.7(transitive)
+ Added@babel/parser@7.25.8(transitive)
+ Added@babel/template@7.25.7(transitive)
+ Added@babel/traverse@7.0.0(transitive)
+ Added@babel/types@7.25.8(transitive)
+ Addedpicocolors@1.1.1(transitive)
- Removed@babel/code-frame@7.0.0-rc.3(transitive)
- Removed@babel/generator@7.0.0-rc.3(transitive)
- Removed@babel/helper-function-name@7.0.0-rc.3(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-rc.3(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-rc.3(transitive)
- Removed@babel/highlight@7.0.0-rc.3(transitive)
- Removed@babel/parser@7.0.0-rc.3(transitive)
- Removed@babel/template@7.0.0-rc.3(transitive)
- Removed@babel/traverse@7.0.0-rc.3(transitive)
- Removed@babel/types@7.0.0-rc.3(transitive)
- Removedesutils@2.0.3(transitive)
Updated@babel/generator@7.0.0
Updated@babel/traverse@7.0.0