@sanity/groq-store
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -55,3 +55,3 @@ import type BrowserEventSource from '@sanity/eventsource/browser' | ||
'projectId' | 'dataset' | 'token' | 'documentLimit' | 'includeTypes' | 'requestTagPrefix' | ||
> | ||
>, | ||
) => Promise<SanityDocument[]> | ||
@@ -70,3 +70,3 @@ } | ||
params: Record<string, unknown>, | ||
callback: (err: Error | undefined, result?: R) => void | ||
callback: (err: Error | undefined, result?: R) => void, | ||
) => Subscription | ||
@@ -73,0 +73,0 @@ close: () => Promise<void> |
{ | ||
"name": "@sanity/groq-store", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Stream dataset to memory for in-memory querying", | ||
@@ -80,26 +80,26 @@ "keywords": [ | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.4.4", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@sanity/client": "^6.0.0", | ||
"@sanity/pkg-utils": "^2.2.13", | ||
"@sanity/semantic-release-preset": "^4.0.1", | ||
"@types/node": "^18.15.3", | ||
"@commitlint/cli": "^17.6.7", | ||
"@commitlint/config-conventional": "^17.6.7", | ||
"@sanity/client": "^6.1.7", | ||
"@sanity/pkg-utils": "^2.3.9", | ||
"@sanity/semantic-release-preset": "^4.1.2", | ||
"@types/node": "^18.17.1", | ||
"@types/split2": "^4.0.0", | ||
"@types/throttle-debounce": "^5.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"@vitest/coverage-v8": "^0.32.2", | ||
"eslint": "^8.36.0", | ||
"eslint-config-prettier": "^8.7.0", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"@vitest/coverage-v8": "^0.33.0", | ||
"eslint": "^8.45.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-config-sanity": "^6.0.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.32.2", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-react": "^7.33.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.0", | ||
"lint-staged": "^13.2.3", | ||
"ls-engines": "^0.9.0", | ||
"prettier": "^2.8.5", | ||
"prettier-plugin-packagejson": "^2.4.3", | ||
"prettier": "^3.0.0", | ||
"prettier-plugin-packagejson": "^2.4.5", | ||
"rimraf": "^5.0.0", | ||
"typescript": "^5.0.2", | ||
"vitest": "^0.32.0", | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.33.0", | ||
"vitest-github-actions-reporter": "^0.10.0" | ||
@@ -109,3 +109,7 @@ }, | ||
"node": ">=14.18" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
} | ||
} |
@@ -82,3 +82,3 @@ # @sanity/groq-store | ||
console.log('Result:', result) | ||
} | ||
}, | ||
) | ||
@@ -85,0 +85,0 @@ |
@@ -55,3 +55,3 @@ import {SanityDocument} from '@sanity/types' | ||
throw new Error( | ||
`Error streaming dataset: Reached limit of ${documentLimit} documents. Try using the includeTypes option to reduce the amount of documents, or increase the limit.` | ||
`Error streaming dataset: Reached limit of ${documentLimit} documents. Try using the includeTypes option to reduce the amount of documents, or increase the limit.`, | ||
) | ||
@@ -58,0 +58,0 @@ } |
@@ -15,3 +15,3 @@ import {groqStore as groqStoreApi} from '../groqStore' | ||
throw new Error( | ||
'When the `token` option is used the `EventSource` option must also be provided.' | ||
'When the `token` option is used the `EventSource` option must also be provided.', | ||
) | ||
@@ -22,3 +22,3 @@ } | ||
'When the `token` option is used the `EventSource` option must also be provided. ' + | ||
'EventSource cannot be `window.EventSource`, as it does not support passing a token.' | ||
'EventSource cannot be `window.EventSource`, as it does not support passing a token.', | ||
) | ||
@@ -25,0 +25,0 @@ } |
@@ -24,3 +24,3 @@ import groq from 'groq' | ||
}, | ||
envImplementations | ||
envImplementations, | ||
) | ||
@@ -53,3 +53,3 @@ } | ||
params: Record<string, unknown>, | ||
callback: (error: Error | undefined, result?: R) => void | ||
callback: (error: Error | undefined, result?: R) => void, | ||
): Subscription { | ||
@@ -56,0 +56,0 @@ if (!config.listen) { |
@@ -20,3 +20,3 @@ import {Subscription, MutationEvent, Config, ApiError, EnvImplementations} from './types' | ||
const isNativeBrowserEventSource = ( | ||
eventSource: EventSourceInstance | ||
eventSource: EventSourceInstance, | ||
): eventSource is InstanceType<typeof globalThis.EventSource> => | ||
@@ -27,3 +27,3 @@ typeof window !== 'undefined' && | ||
const isPolyfillEventSource = ( | ||
eventSource: EventSourceInstance | ||
eventSource: EventSourceInstance, | ||
): eventSource is InstanceType<typeof BrowserEventSource | typeof NodeEventSource> => | ||
@@ -35,3 +35,3 @@ !isNativeBrowserEventSource(eventSource) | ||
type: keyof SharedEventSourceEventMap, | ||
listener: EventListener | ||
listener: EventListener, | ||
): void => { | ||
@@ -81,3 +81,3 @@ if (isPolyfillEventSource(eventSource)) { | ||
next: (event: MutationEvent) => void | ||
} | ||
}, | ||
): Subscription { | ||
@@ -98,3 +98,3 @@ const {projectId, dataset, token, includeTypes, requestTagPrefix} = config | ||
} | ||
: {query: '*', options} | ||
: {query: '*', options}, | ||
) | ||
@@ -120,3 +120,3 @@ const url = `https://${projectId}.api.sanity.io/v1/data/listen/${dataset}${searchParams}` | ||
handlers.error( | ||
new Error(data.message || data.error || `Listener returned HTTP ${data.statusCode}`) | ||
new Error(data.message || data.error || `Listener returned HTTP ${data.statusCode}`), | ||
) | ||
@@ -131,4 +131,4 @@ }) | ||
new Error( | ||
`Error establishing listener - check that the project ID and dataset are correct${hintSuffix}${errorMessage}` | ||
) | ||
`Error establishing listener - check that the project ID and dataset are correct${hintSuffix}${errorMessage}`, | ||
), | ||
) | ||
@@ -135,0 +135,0 @@ }) |
@@ -67,3 +67,3 @@ import split from 'split2' | ||
reject( | ||
new Error(`Error streaming dataset: Reached limit of ${documentLimit} documents`) | ||
new Error(`Error streaming dataset: Reached limit of ${documentLimit} documents`), | ||
) | ||
@@ -70,0 +70,0 @@ response.destroy() |
@@ -6,3 +6,3 @@ import {SanityDocument} from '@sanity/types' | ||
doc: SanityDocument | null, | ||
patch: unknown[] | ||
patch: unknown[], | ||
): SanityDocument | null { | ||
@@ -9,0 +9,0 @@ const patchDoc = {...doc} as Omit<SanityDocument, '_rev'> |
@@ -17,3 +17,3 @@ import {SanityDocument} from '@sanity/types' | ||
onNotifyUpdate: (docs: SanityDocument[]) => void, | ||
{getDocuments, EventSource}: EnvImplementations | ||
{getDocuments, EventSource}: EnvImplementations, | ||
): Subscription & {loaded: Promise<void>} { | ||
@@ -158,3 +158,3 @@ const { | ||
documents: SanityDocument[], | ||
mutations: MutationEvent[] | ||
mutations: MutationEvent[], | ||
): SanityDocument[] { | ||
@@ -161,0 +161,0 @@ // Group by document ID |
@@ -40,3 +40,3 @@ import type {SanityDocument} from '@sanity/types' | ||
'projectId' | 'dataset' | 'token' | 'documentLimit' | 'includeTypes' | 'requestTagPrefix' | ||
> | ||
>, | ||
) => Promise<SanityDocument[]> | ||
@@ -95,3 +95,3 @@ } | ||
params: Record<string, unknown>, | ||
callback: (err: Error | undefined, result?: R) => void | ||
callback: (err: Error | undefined, result?: R) => void, | ||
) => Subscription | ||
@@ -98,0 +98,0 @@ close: () => Promise<void> |
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
252645