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.2-beta.1 to 6.20.2-beta.2

2

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

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

import type {Middleware, RequestOptions} from 'get-it'
const DEFAULT_NUM_SHARD_BUCKETS = 3
const UNSHARDED_URL_RE = /^https:\/\/([a-z0-9]+)\.api\.(sanity\..*)/
const SHARDED_URL_RE = /^https:\/\/[a-z0-9]+\.api\.s(\d+)\.sanity\.(.*)/
const SHARDED_URL_RE = /^https:\/\/[a-z0-9]+\.api\.r(\d+)\.sanity\.(.*)/

@@ -17,3 +18,3 @@ /**

export function getDomainSharder(initialBuckets?: number[]) {
const buckets: number[] = initialBuckets || new Array(10).fill(0, 0)
const buckets: number[] = initialBuckets || new Array(DEFAULT_NUM_SHARD_BUCKETS).fill(0, 0)

@@ -46,3 +47,4 @@ function incrementBucketForUrl(url: string) {

return `https://${projectId}.api.s${bucket}.${rest}`
// We start buckets at 1, not zero - so add 1 to the bucket index
return `https://${projectId}.api.r${bucket + 1}.${rest}`
}

@@ -52,3 +54,6 @@

const [isMatch, shard] = url.match(SHARDED_URL_RE) || []
return isMatch ? parseInt(shard, 10) : null
// We start buckets at 1, not zero, but buckets are zero-indexed.
// Substract one from the shard number in the URL to get the correct bucket index
return isMatch ? parseInt(shard, 10) - 1 : null
}

@@ -55,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 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 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