@sanity/util
Advanced tools
Comparing version 3.52.5-canary.18 to 3.53.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2094
0
0
176025
+ Added@sanity/types@3.53.0(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@18.3.12(transitive)
+ Addedcsstype@3.1.3(transitive)
Updated@sanity/types@3.53.0