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

@sanity/groq-store

Package Overview
Dependencies
Maintainers
35
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/groq-store - npm Package Compare versions

Comparing version 2.0.8 to 2.0.9

56

dist/index.browser.js

@@ -109,2 +109,11 @@ 'use strict';

} = config;
let stagedDocs;
let previousTrx;
let flushTimeout;
const onUpdate = docs => {
stagedDocs = void 0;
flushTimeout = void 0;
previousTrx = void 0;
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs);
};
if (!useListener) {

@@ -132,15 +141,3 @@ const loaded2 = getDocuments({

});
let stagedDocs;
let previousTrx;
let flushTimeout;
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: error => onLoadError(error)
});
return {
unsubscribe: listener.unsubscribe,
loaded
};
async function onOpen() {
const onOpen = async () => {
const initial = await getDocuments({

@@ -157,4 +154,4 @@ projectId,

onDoneLoading();
}
function onMutationReceived(msg) {
};
const onMutationReceived = msg => {
if (documents) {

@@ -166,4 +163,9 @@ applyMutation(msg);

}
}
function scheduleUpdate(docs, msg) {
};
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: error => onLoadError(error)
});
const scheduleUpdate = (docs, msg) => {
clearTimeout(flushTimeout);

@@ -178,10 +180,4 @@ if (previousTrx !== msg.transactionId && stagedDocs) {

flushTimeout = setTimeout(onUpdate, DEBOUNCE_MS, docs.slice());
}
function onUpdate(docs) {
stagedDocs = void 0;
flushTimeout = void 0;
previousTrx = void 0;
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs);
}
function applyMutation(msg) {
};
const applyMutation = msg => {
if (!msg.effects || msg.documentId.startsWith("_.")) {

@@ -192,4 +188,4 @@ return;

replaceDocument(msg.documentId, applyPatchWithoutRev(document, msg.effects.apply));
}
function replaceDocument(id, document) {
};
const replaceDocument = (id, document) => {
const current = indexedDocuments.get(id);

@@ -208,3 +204,7 @@ const docs = documents || [];

}
}
};
return {
unsubscribe: listener.unsubscribe,
loaded
};
}

@@ -211,0 +211,0 @@ function applyBufferedMutations(documents, mutations) {

@@ -115,2 +115,11 @@ 'use strict';

} = config;
let stagedDocs;
let previousTrx;
let flushTimeout;
const onUpdate = docs => {
stagedDocs = void 0;
flushTimeout = void 0;
previousTrx = void 0;
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs);
};
if (!useListener) {

@@ -138,15 +147,3 @@ const loaded2 = getDocuments({

});
let stagedDocs;
let previousTrx;
let flushTimeout;
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: error => onLoadError(error)
});
return {
unsubscribe: listener.unsubscribe,
loaded
};
async function onOpen() {
const onOpen = async () => {
const initial = await getDocuments({

@@ -163,4 +160,4 @@ projectId,

onDoneLoading();
}
function onMutationReceived(msg) {
};
const onMutationReceived = msg => {
if (documents) {

@@ -172,4 +169,9 @@ applyMutation(msg);

}
}
function scheduleUpdate(docs, msg) {
};
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: error => onLoadError(error)
});
const scheduleUpdate = (docs, msg) => {
clearTimeout(flushTimeout);

@@ -184,10 +186,4 @@ if (previousTrx !== msg.transactionId && stagedDocs) {

flushTimeout = setTimeout(onUpdate, DEBOUNCE_MS, docs.slice());
}
function onUpdate(docs) {
stagedDocs = void 0;
flushTimeout = void 0;
previousTrx = void 0;
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs);
}
function applyMutation(msg) {
};
const applyMutation = msg => {
if (!msg.effects || msg.documentId.startsWith("_.")) {

@@ -198,4 +194,4 @@ return;

replaceDocument(msg.documentId, applyPatchWithoutRev(document, msg.effects.apply));
}
function replaceDocument(id, document) {
};
const replaceDocument = (id, document) => {
const current = indexedDocuments.get(id);

@@ -214,3 +210,7 @@ const docs = documents || [];

}
}
};
return {
unsubscribe: listener.unsubscribe,
loaded
};
}

@@ -217,0 +217,0 @@ function applyBufferedMutations(documents, mutations) {

{
"name": "@sanity/groq-store",
"version": "2.0.8",
"version": "2.0.9",
"description": "Stream dataset to memory for in-memory querying",

@@ -62,3 +62,3 @@ "keywords": [

"start": "cd example && npm start",
"test": "tsdx test"
"test": "vitest"
},

@@ -69,11 +69,8 @@ "browserslist": [

],
"jest": {
"testEnvironment": "node"
},
"dependencies": {
"@sanity/types": "^3",
"eventsource": "^2",
"@sanity/types": "3",
"eventsource": "2",
"fast-deep-equal": "^3.1.3",
"groq": "^3",
"groq-js": "^1.1.8",
"groq": "3",
"groq-js": "1",
"mendoza": "^2.1.1",

@@ -87,12 +84,13 @@ "simple-get": "^4.0.1",

"@commitlint/config-conventional": "^17.4.4",
"@sanity/client": "^5.2.2",
"@sanity/pkg-utils": "^2.2.8",
"@sanity/semantic-release-preset": "^4.0.0",
"@sanity/client": "^5.3.0",
"@sanity/pkg-utils": "^2.2.13",
"@sanity/semantic-release-preset": "^4.0.1",
"@types/eventsource": "^1.1.11",
"@types/node": "^18.14.6",
"@types/node": "^18.15.3",
"@types/split2": "^3.2.1",
"@types/throttle-debounce": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"eslint": "^8.35.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@vitest/coverage-c8": "^0.29.3",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",

@@ -103,11 +101,10 @@ "eslint-config-sanity": "^6.0.0",

"husky": "^8.0.3",
"lint-staged": "^13.1.2",
"lint-staged": "^13.2.0",
"ls-engines": "^0.9.0",
"prettier": "^2.8.4",
"prettier": "^2.8.5",
"prettier-plugin-packagejson": "^2.4.3",
"rimraf": "^4.3.0",
"rollup": "^3",
"tsdx": "^0.14.1",
"tslib": "^2.5.0",
"typescript": "4.9.5"
"rimraf": "^4.4.0",
"typescript": "^5.0.2",
"vitest": "^0.29.3",
"vitest-github-actions-reporter": "^0.10.0"
},

@@ -114,0 +111,0 @@ "engines": {

@@ -28,2 +28,17 @@ import {SanityDocument} from '@sanity/types'

// We don't want to flush updates while we're in the same transaction, so a normal
// throttle/debounce wouldn't do it. We need to wait and see if the next mutation is
// within the same transaction as the previous, and if not we can flush. Of course,
// we can't wait forever, so an upper threshold of X ms should be counted as "ok to flush"
let stagedDocs: SanityDocument[] | undefined
let previousTrx: string | undefined
let flushTimeout: NodeJS.Timer | undefined
const onUpdate = (docs: SanityDocument[]) => {
stagedDocs = undefined
flushTimeout = undefined
previousTrx = undefined
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs)
}
if (!useListener) {

@@ -52,19 +67,3 @@ const loaded = getDocuments({projectId, dataset, documentLimit, token, includeTypes})

// We don't want to flush updates while we're in the same transaction, so a normal
// throttle/debounce wouldn't do it. We need to wait and see if the next mutation is
// within the same transaction as the previous, and if not we can flush. Of course,
// we can't wait forever, so an upper threshold of X ms should be counted as "ok to flush"
let stagedDocs: SanityDocument[] | undefined
let previousTrx: string | undefined
let flushTimeout: NodeJS.Timer | undefined
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: (error: Error) => onLoadError(error),
})
return {unsubscribe: listener.unsubscribe, loaded}
async function onOpen() {
const onOpen = async () => {
const initial = await getDocuments({projectId, dataset, documentLimit, token, includeTypes})

@@ -77,3 +76,3 @@ documents = applyBufferedMutations(initial, buffer)

function onMutationReceived(msg: MutationEvent) {
const onMutationReceived = (msg: MutationEvent) => {
if (documents) {

@@ -87,3 +86,9 @@ applyMutation(msg)

function scheduleUpdate(docs: SanityDocument[], msg: MutationEvent) {
const listener = listen(EventSource, config, {
next: onMutationReceived,
open: onOpen,
error: (error: Error) => onLoadError(error),
})
const scheduleUpdate = (docs: SanityDocument[], msg: MutationEvent) => {
clearTimeout(flushTimeout)

@@ -104,10 +109,3 @@

function onUpdate(docs: SanityDocument[]) {
stagedDocs = undefined
flushTimeout = undefined
previousTrx = undefined
onNotifyUpdate(overlayDrafts ? overlay(docs) : docs)
}
function applyMutation(msg: MutationEvent) {
const applyMutation = (msg: MutationEvent) => {
if (!msg.effects || msg.documentId.startsWith('_.')) {

@@ -121,3 +119,3 @@ return

function replaceDocument(id: string, document: SanityDocument | null) {
const replaceDocument = (id: string, document: SanityDocument | null) => {
const current = indexedDocuments.get(id)

@@ -141,2 +139,4 @@ const docs = documents || []

}
return {unsubscribe: listener.unsubscribe, loaded}
}

@@ -143,0 +143,0 @@

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

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