Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
0
Versions
986
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.20.1 to 6.20.2-beta.0

src/http/domainSharding.ts

2

package.json
{
"name": "@sanity/client",
"version": "6.20.1",
"version": "6.20.2-beta.0",
"description": "Client for retrieving, creating and patching data from Sanity.io",

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

import {Observable} from 'rxjs'
import {domainSharder as sharder} from '../http/domainSharding'
import type {ObservableSanityClient, SanityClient} from '../SanityClient'

@@ -67,3 +68,7 @@ import type {Any, ListenEvent, ListenOptions, ListenParams, MutationEvent} from '../types'

const uri = `${url}${_getDataUrl(this, 'listen', qs)}`
let uri = `${url}${_getDataUrl(this, 'listen', qs)}`
if (this.config().useDomainSharding) {
uri = sharder.getShardedUrl(uri)
}
if (uri.length > MAX_URL_LENGTH) {

@@ -95,2 +100,8 @@ return new Observable((observer) => observer.error(new Error('Query too large for listener')))

// We're about to connect, and will reuse the same shard/bucket for every reconnect henceforth.
// This may seem inoptimal, but once connected we should just consider this as a "permanent"
// connection, since we'll automatically retry on failures/disconnects. Once we explicitly
// unsubsccribe, we can decrement the bucket and free up the shard.
sharder.incrementBucketForUrl(uri)
open()

@@ -192,2 +203,3 @@

unsubscribed = true
sharder.decrementBucketForUrl(uri)
}

@@ -194,0 +206,0 @@

@@ -36,2 +36,3 @@ import type {Middlewares} from 'get-it'

retryDelay: config.retryDelay,
useDomainSharding: config.useDomainSharding,
...options,

@@ -38,0 +39,0 @@ } as Any),

@@ -1,1 +0,3 @@

export default []
import {domainSharder} from './domainSharding'
export default [domainSharder.middleware]
import {agent, debug, headers} from 'get-it/middleware'
import {name, version} from '../../package.json'
import {domainSharder} from './domainSharding'
const middleware = [
domainSharder.middleware,
debug({verbose: true, namespace: 'sanity:client'}),

@@ -7,0 +10,0 @@ headers({'User-Agent': `${name} ${version}`}),

@@ -50,2 +50,10 @@ // deno-lint-ignore-file no-empty-interface

/**
* Spread the requests over a number of hostnames to work around HTTP/1.1 limitations.
* Only applicable in browsers, and for certain allowed projects.
*
* @alpha
*/
useDomainSharding?: boolean
/**
* Optional request tag prefix for all request tags

@@ -52,0 +60,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 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