Gathering detailed insights and metrics for @sanity/groq-store
Gathering detailed insights and metrics for @sanity/groq-store
Gathering detailed insights and metrics for @sanity/groq-store
Gathering detailed insights and metrics for @sanity/groq-store
npm install @sanity/groq-store
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
45 Stars
303 Commits
6 Forks
15 Watching
10 Branches
31 Contributors
Updated on 22 Aug 2024
Minified
Minified + Gzipped
TypeScript (95.18%)
HTML (1.71%)
CSS (1.52%)
JavaScript (1.29%)
Shell (0.29%)
Cumulative downloads
Total Downloads
Last day
-3.5%
4,864
Compared to previous day
Last week
6.1%
27,672
Compared to previous week
Last month
1.3%
120,130
Compared to previous month
Last year
3%
2,334,852
Compared to previous year
9
26
In-memory GROQ store. Streams all available documents from Sanity into an in-memory database and allows you to query them there.
1npm i @sanity/groq-store
1import {groqStore, groq} from '@sanity/groq-store'
2// import SanityEventSource from '@sanity/eventsource'
3
4const store = groqStore({
5 projectId: 'abc123',
6 dataset: 'blog',
7
8 // Keep dataset up to date with remote changes. Default: false
9 listen: true,
10
11 // "Replaces" published documents with drafts, if available.
12 // Note that document IDs will not reflect draft status, currently
13 overlayDrafts: true,
14
15 // Optional token, if you want to receive drafts, or read data from private datasets
16 // NOTE: Needs custom EventSource to work in browsers
17 token: 'someAuthToken',
18
19 // Optional limit on number of documents, to prevent using too much memory unexpectedly
20 // Throws on the first operation (query, retrieval, subscription) if reaching this limit.
21 documentLimit: 10000,
22
23 // Optional EventSource. Necessary to authorize using token in the browser, since
24 // the native window.EventSource does not accept headers.
25 // EventSource: SanityEventSource,
26
27 // Optional allow list filter for document types. You can use this to limit the amount of documents by declaring the types you want to sync. Note that since you're fetching a subset of your dataset, queries that works against your Content Lake might not work against the local groq-store.
28 // You can quickly list all your types using this query: `array::unique(*[]._type)`
29 includeTypes: ['post', 'page', 'product', 'sanity.imageAsset'],
30})
31
32store.query(groq`*[_type == "author"]`).then((docs) => {
33 console.log(docs)
34})
35
36store.getDocument('grrm').then((grrm) => {
37 console.log(grrm)
38})
39
40store.getDocuments(['grrm', 'jrrt']).then(([grrm, jrrt]) => {
41 console.log(grrm, jrrt)
42})
43
44const sub = store.subscribe(
45 groq`*[_type == $type][] {name}`, // Query
46 {type: 'author'}, // Params
47 (err, result) => {
48 if (err) {
49 console.error('Oh no, an error:', err)
50 return
51 }
52
53 console.log('Result:', result)
54 },
55)
56
57// Later, to close subscription:
58sub.unsubscribe()
59
60// Later, to close listener:
61store.close()
MIT © Sanity.io
Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".
Version will be automatically bumped based on conventional commits since the last release.
Semantic release will only release on configured branches, so it is safe to run release on any branch.
Note: commits with chore:
will be ignored. If you want updated dependencies to trigger
a new version, use fix(deps):
instead.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
packaging workflow detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More