Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

groq-js

Package Overview
Dependencies
Maintainers
55
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

groq-js - npm Package Compare versions

Comparing version 1.10.1-canary.0 to 1.11.0

4

package.json
{
"name": "groq-js",
"version": "1.10.1-canary.0",
"version": "1.11.0",
"keywords": [

@@ -82,3 +82,3 @@ "sanity",

"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"ndjson": "^2.0.0",

@@ -85,0 +85,0 @@ "prettier": "^3.3.2",

@@ -429,2 +429,34 @@ import type {ExprNode} from '../nodeTypes'

// eslint-disable-next-line require-await
sanity['versionOf'] = async function (args, scope, execute) {
if (!scope.source.isArray()) return NULL_VALUE
const value = await execute(args[0], scope)
if (value.type !== 'string') return NULL_VALUE
const baseId = value.data
// All the document are a version of the given ID if:
// 1. Document ID is of the ford bundleId.documentGroupId
// 2. And, they have a field called _version which is an object.
const versionIds: string[] = []
for await (const value of scope.source) {
if (getType(value) === 'object') {
const val = await value.get()
if (
val &&
'_id' in val &&
val._id.split('.').length === 2 &&
val._id.endsWith(`.${baseId}`) &&
'_version' in val &&
typeof val._version === 'object'
) {
versionIds.push(val._id)
}
}
}
return fromJS(versionIds)
}
sanity['versionOf'].arity = 1
export type GroqPipeFunction = (

@@ -431,0 +463,0 @@ base: Value,

@@ -0,1 +1,2 @@

/* eslint-disable max-statements */
import type {FuncCallNode} from '../nodeTypes'

@@ -299,2 +300,11 @@ import {Scope} from './scope'

}
case 'sanity.versionOf': {
const typeNode = walk({node: node.args[0], scope})
return mapConcrete(typeNode, scope, (typeNode) => {
if (typeNode.type !== 'string') {
return {type: 'null'}
}
return {type: 'array', of: {type: 'string'}}
})
}
default: {

@@ -301,0 +311,0 @@ return {type: 'unknown'}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc