New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/vision

Package Overview
Dependencies
Maintainers
69
Versions
1435
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/vision

Sanity plugin for running/debugging GROQ-queries against Sanity datasets

  • 3.71.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
129K
increased by15.81%
Maintainers
69
Weekly downloads
 
Created

What is @sanity/vision?

@sanity/vision is a tool for querying your Sanity content using GROQ (Graph-Relational Object Queries). It provides a powerful and flexible way to interact with your Sanity dataset directly from the Sanity Studio.

What are @sanity/vision's main functionalities?

Querying Data

This feature allows you to query your Sanity dataset using GROQ. The example code fetches all documents of type 'post' from the dataset.

const query = '*[_type == "post"]';
const params = {};
client.fetch(query, params).then(posts => {
  console.log(posts);
});

Parameterized Queries

This feature allows you to use parameters in your queries to filter data dynamically. The example code fetches all posts authored by 'John Doe'.

const query = '*[_type == "post" && author == $author]';
const params = { author: 'John Doe' };
client.fetch(query, params).then(posts => {
  console.log(posts);
});

Projection

This feature allows you to specify which fields to include in the returned documents. The example code fetches only the 'title' and 'author' fields of all 'post' documents.

const query = '*[_type == "post"]{title, author}';
const params = {};
client.fetch(query, params).then(posts => {
  console.log(posts);
});

Other packages similar to @sanity/vision

Keywords

FAQs

Package last updated on 22 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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