Comparing version 1.2.0-beta.0 to 1.2.0-beta.1
{ | ||
"name": "groq-js", | ||
"version": "1.2.0-beta.0", | ||
"version": "1.2.0-beta.1", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "sanity", |
@@ -79,12 +79,13 @@ import type {ExprNode} from '../nodeTypes' | ||
const global: FunctionSet = {} | ||
// underscored to not collide with environments like jest that give variables named `global` special treatment | ||
const _global: FunctionSet = {} | ||
// eslint-disable-next-line require-await | ||
global.anywhere = async function anywhere() { | ||
_global.anywhere = async function anywhere() { | ||
throw new Error('not implemented') | ||
} | ||
global.anywhere.arity = 1 | ||
_global.anywhere.arity = 1 | ||
global.coalesce = async function coalesce(args, scope, execute) { | ||
_global.coalesce = async function coalesce(args, scope, execute) { | ||
for (const arg of args) { | ||
@@ -99,3 +100,3 @@ const value = await execute(arg, scope) | ||
global.count = async function count(args, scope, execute) { | ||
_global.count = async function count(args, scope, execute) { | ||
const inner = await execute(args[0], scope) | ||
@@ -113,5 +114,5 @@ if (!inner.isArray()) { | ||
} | ||
global.count.arity = 1 | ||
_global.count.arity = 1 | ||
global.dateTime = async function dateTime(args, scope, execute) { | ||
_global.dateTime = async function dateTime(args, scope, execute) { | ||
const val = await execute(args[0], scope) | ||
@@ -126,17 +127,17 @@ if (val.type === 'datetime') { | ||
} | ||
global.dateTime.arity = 1 | ||
_global.dateTime.arity = 1 | ||
global.defined = async function defined(args, scope, execute) { | ||
_global.defined = async function defined(args, scope, execute) { | ||
const inner = await execute(args[0], scope) | ||
return inner.type === 'null' ? FALSE_VALUE : TRUE_VALUE | ||
} | ||
global.defined.arity = 1 | ||
_global.defined.arity = 1 | ||
// eslint-disable-next-line require-await | ||
global.identity = async function identity(args, scope) { | ||
_global.identity = async function identity(args, scope) { | ||
return fromString(scope.context.identity) | ||
} | ||
global.identity.arity = 0 | ||
_global.identity.arity = 0 | ||
global.length = async function length(args, scope, execute) { | ||
_global.length = async function length(args, scope, execute) { | ||
const inner = await execute(args[0], scope) | ||
@@ -159,5 +160,5 @@ | ||
} | ||
global.length.arity = 1 | ||
_global.length.arity = 1 | ||
global.path = async function path(args, scope, execute) { | ||
_global.path = async function path(args, scope, execute) { | ||
const inner = await execute(args[0], scope) | ||
@@ -170,5 +171,5 @@ if (inner.type !== 'string') { | ||
} | ||
global.path.arity = 1 | ||
_global.path.arity = 1 | ||
global.string = async function string(args, scope, execute) { | ||
_global.string = async function string(args, scope, execute) { | ||
const value = await execute(args[0], scope) | ||
@@ -185,5 +186,5 @@ switch (value.type) { | ||
} | ||
global.string.arity = 1 | ||
_global.string.arity = 1 | ||
global.references = async function references(args, scope, execute) { | ||
_global.references = async function references(args, scope, execute) { | ||
const pathSet = new Set<string>() | ||
@@ -210,5 +211,5 @@ for (const arg of args) { | ||
} | ||
global.references.arity = (c) => c >= 1 | ||
_global.references.arity = (c) => c >= 1 | ||
global.round = async function round(args, scope, execute) { | ||
_global.round = async function round(args, scope, execute) { | ||
const value = await execute(args[0], scope) | ||
@@ -240,12 +241,12 @@ if (value.type !== 'number') { | ||
} | ||
global.round.arity = (count) => count >= 1 && count <= 2 | ||
_global.round.arity = (count) => count >= 1 && count <= 2 | ||
// eslint-disable-next-line require-await | ||
global.now = async function now(args, scope) { | ||
_global.now = async function now(args, scope) { | ||
return fromString(scope.context.timestamp.toISOString()) | ||
} | ||
global.now.arity = 0 | ||
_global.now.arity = 0 | ||
// eslint-disable-next-line require-await | ||
global.boost = async function boost() { | ||
_global.boost = async function boost() { | ||
// This should be handled by the scoring function. | ||
@@ -255,3 +256,3 @@ throw new Error('unexpected boost call') | ||
global.boost.arity = 2 | ||
_global.boost.arity = 2 | ||
@@ -303,4 +304,4 @@ const string: FunctionSet = {} | ||
global.lower = string.lower | ||
global.upper = string.upper | ||
_global.lower = string.lower | ||
_global.upper = string.upper | ||
@@ -659,3 +660,3 @@ string.startsWith = async function (args, scope, execute) { | ||
export const namespaces: NamespaceSet = { | ||
global, | ||
global: _global, | ||
string, | ||
@@ -662,0 +663,0 @@ array, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
713921
11506
2