Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
51
Versions
977
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/client - npm Package Compare versions

Comparing version 6.17.3-canary.4 to 6.17.3-canary.5

2

package.json
{
"name": "@sanity/client",
"version": "6.17.3-canary.4",
"version": "6.17.3-canary.5",
"description": "Client for retrieving, creating and patching data from Sanity.io",

@@ -5,0 +5,0 @@ "keywords": [

@@ -277,3 +277,3 @@ import {from, type MonoTypeOperatorFunction, Observable} from 'rxjs'

resultSourceMap: options.resultSourceMap,
lastLiveEventId,
lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId,
canUseCdn: isQuery,

@@ -280,0 +280,0 @@ signal: options.signal,

import {Observable} from 'rxjs'
import type {ObservableSanityClient, SanityClient} from '../SanityClient'
import type {Any, LiveEventError, LiveEventMessage, LiveEventRestart} from '../types'
import type {Any, LiveEventMessage, LiveEventRestart} from '../types'
import {_getDataUrl} from './dataMethods'
/**
* @internal
* @alpha
*/

@@ -16,3 +16,3 @@ export class LiveClient {

events(): Observable<LiveEventMessage | LiveEventError | LiveEventRestart> {
events(): Observable<LiveEventMessage | LiveEventRestart> {
const path = _getDataUrl(this.#client, 'live/events')

@@ -55,3 +55,5 @@ const url = new URL(this.#client.getUrl(path, false))

function unsubscribe() {
console.log('unsubscribe', {es, unsubscribed, stopped})
if (!es) return
console.log('teardown and es.close')
es.removeEventListener('error', onError)

@@ -63,2 +65,3 @@ listenFor.forEach((type: string) => es.removeEventListener(type, onMessage))

async function getEventSource() {
console.log('getEventSource inner', {stopped, unsubscribed})
const EventSourceImplementation: typeof import('@sanity/eventsource') =

@@ -72,5 +75,7 @@ typeof EventSource === 'undefined'

if (unsubscribed) {
console.log('unsubscribed, do not setup')
return
}
console.log('starting EventSource', {url, stopped, unsubscribed, EventSourceImplementation})
const evs = new EventSourceImplementation(url.toString())

@@ -83,4 +88,6 @@ evs.addEventListener('error', onError)

function open() {
console.log('open.getEventSource', {stopped, unsubscribed})
getEventSource()
.then((eventSource) => {
console.log('open.getEventSource.then', {eventSource, stopped, unsubscribed})
if (eventSource) {

@@ -97,2 +104,3 @@ es = eventSource

function stop() {
console.log('stop', {stopped, unsubscribed})
stopped = true

@@ -123,3 +131,3 @@ unsubscribe()

const evt = parseEvent(err)
return evt instanceof Error ? evt : new Error(extractErrorMessage(evt))
return evt instanceof Error ? evt : new Error(extractErrorMessage(evt), {cause: evt})
}

@@ -126,0 +134,0 @@

@@ -749,3 +749,4 @@ // deno-lint-ignore-file no-empty-interface

next?: ('next' extends keyof RequestInit ? RequestInit : never)['next']
lastLiveEventId?: string
/** @alpha */
lastLiveEventId?: string | string[] | null
}

@@ -793,3 +794,4 @@

resultSourceMap?: ContentSourceMap
syncTags?: `s1:${string}`[]
/** @alpha */
syncTags?: SyncTag[]
}

@@ -1009,15 +1011,9 @@

/** @public */
/** @alpha */
export type SyncTag = `s1:${string}`
/** @public */
export interface LiveEventError {
type: 'error'
status: number
message: string
}
/** @public */
/** @alpha */
export interface LiveEventRestart {
type: 'restart'
}
/** @public */
/** @alpha */
export interface LiveEventMessage {

@@ -1024,0 +1020,0 @@ type: 'message'

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 too big to display

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is too big to display

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