Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/util

Package Overview
Dependencies
Maintainers
55
Versions
1356
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/util - npm Package Compare versions

Comparing version 3.52.5-canary.18 to 3.53.0

35

lib/concurrency-limiter.esm.js

@@ -1,16 +0,27 @@

var __defProp = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
class ConcurrencyLimiter {
constructor(max) {
this.max = max, __publicField(this, "current", 0), __publicField(this, "resolvers", []), __publicField(this, "ready", () => this.max === 1 / 0 ? Promise.resolve() : this.current < this.max ? (this.current++, Promise.resolve()) : new Promise((resolve) => {
this.resolvers.push(resolve);
})), __publicField(this, "release", () => {
if (this.max === 1 / 0) return;
const nextResolver = this.resolvers.shift();
if (nextResolver) {
nextResolver();
return;
}
this.current = Math.max(0, this.current - 1);
});
this.max = max;
}
current = 0;
resolvers = [];
/**
* Indicates when a slot for a new operation is ready.
* If under the limit, it resolves immediately; otherwise, it waits until a slot is free.
*/
ready = () => this.max === 1 / 0 ? Promise.resolve() : this.current < this.max ? (this.current++, Promise.resolve()) : new Promise((resolve) => {
this.resolvers.push(resolve);
});
/**
* Releases a slot, decrementing the current count of operations if nothing is in the queue.
* If there are operations waiting, it allows the next one in the queue to proceed.
*/
release = () => {
if (this.max === 1 / 0) return;
const nextResolver = this.resolvers.shift();
if (nextResolver) {
nextResolver();
return;
}
this.current = Math.max(0, this.current - 1);
};
}

@@ -17,0 +28,0 @@ export {

"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var __defProp = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
class ConcurrencyLimiter {
constructor(max) {
this.max = max, __publicField(this, "current", 0), __publicField(this, "resolvers", []), __publicField(this, "ready", () => this.max === 1 / 0 ? Promise.resolve() : this.current < this.max ? (this.current++, Promise.resolve()) : new Promise((resolve) => {
this.resolvers.push(resolve);
})), __publicField(this, "release", () => {
if (this.max === 1 / 0) return;
const nextResolver = this.resolvers.shift();
if (nextResolver) {
nextResolver();
return;
}
this.current = Math.max(0, this.current - 1);
});
this.max = max;
}
current = 0;
resolvers = [];
/**
* Indicates when a slot for a new operation is ready.
* If under the limit, it resolves immediately; otherwise, it waits until a slot is free.
*/
ready = () => this.max === 1 / 0 ? Promise.resolve() : this.current < this.max ? (this.current++, Promise.resolve()) : new Promise((resolve) => {
this.resolvers.push(resolve);
});
/**
* Releases a slot, decrementing the current count of operations if nothing is in the queue.
* If there are operations waiting, it allows the next one in the queue to proceed.
*/
release = () => {
if (this.max === 1 / 0) return;
const nextResolver = this.resolvers.shift();
if (nextResolver) {
nextResolver();
return;
}
this.current = Math.max(0, this.current - 1);
};
}
exports.ConcurrencyLimiter = ConcurrencyLimiter;
//# sourceMappingURL=concurrency-limiter.js.map

@@ -103,3 +103,3 @@ import { isIndexSegment, isKeySegment, isIndexTuple } from "@sanity/types";

const item = value[next];
return [typeof (item == null ? void 0 : item._key) == "string" ? { _key: item._key } : next, ..._resolveKeyedPath(item, rest)];
return [typeof item?._key == "string" ? { _key: item._key } : next, ..._resolveKeyedPath(item, rest)];
}

@@ -106,0 +106,0 @@ const nextVal = get(value, [next]);

@@ -105,3 +105,3 @@ "use strict";

const item = value[next];
return [typeof (item == null ? void 0 : item._key) == "string" ? { _key: item._key } : next, ..._resolveKeyedPath(item, rest)];
return [typeof item?._key == "string" ? { _key: item._key } : next, ..._resolveKeyedPath(item, rest)];
}

@@ -108,0 +108,0 @@ const nextVal = get(value, [next]);

{
"name": "@sanity/util",
"version": "3.52.5-canary.18+3b2329cf64",
"version": "3.53.0",
"description": "Utilities shared across projects of Sanity",

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

"@sanity/client": "^6.21.1",
"@sanity/types": "3.52.5-canary.18+3b2329cf64",
"@sanity/types": "3.53.0",
"get-random-values-esm": "1.0.2",

@@ -133,3 +133,3 @@ "moment": "^2.29.4",

"@jest/globals": "^29.7.0",
"@repo/package.config": "3.52.4",
"@repo/package.config": "3.53.0",
"@types/moment": "^2.13.0",

@@ -141,3 +141,3 @@ "rimraf": "^3.0.2"

},
"gitHead": "3b2329cf640954f308676a4b02f3fda701c65587"
"gitHead": "d60dc6d2ae67d56ae680ebfffee2c66599924b4d"
}

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

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