@sanity/client 6.20.2-beta.1 → 6.20.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +4 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/http/domainSharding.ts +9 -4
- package/umd/sanityClient.js +4 -4
- package/umd/sanityClient.min.js +1 -1
package/dist/index.js
CHANGED
|
@@ -856,9 +856,9 @@ function optionsFromFile(opts, file) {
|
|
|
856
856
|
opts
|
|
857
857
|
);
|
|
858
858
|
}
|
|
859
|
-
const UNSHARDED_URL_RE = /^https:\/\/([a-z0-9]+)\.api\.(sanity\..*)/, SHARDED_URL_RE = /^https:\/\/[a-z0-9]+\.api\.
|
|
859
|
+
const UNSHARDED_URL_RE = /^https:\/\/([a-z0-9]+)\.api\.(sanity\..*)/, SHARDED_URL_RE = /^https:\/\/[a-z0-9]+\.api\.r(\d+)\.sanity\.(.*)/, domainSharder = getDomainSharder();
|
|
860
860
|
function getDomainSharder(initialBuckets) {
|
|
861
|
-
const buckets = new Array(
|
|
861
|
+
const buckets = new Array(3).fill(0, 0);
|
|
862
862
|
function incrementBucketForUrl(url) {
|
|
863
863
|
const shard = getShardFromUrl(url);
|
|
864
864
|
shard !== null && buckets[shard]++;
|
|
@@ -875,11 +875,11 @@ function getDomainSharder(initialBuckets) {
|
|
|
875
875
|
(smallest, count, index) => count < buckets[smallest] ? index : smallest,
|
|
876
876
|
0
|
|
877
877
|
);
|
|
878
|
-
return `https://${projectId2}.api.
|
|
878
|
+
return `https://${projectId2}.api.r${bucket + 1}.${rest}`;
|
|
879
879
|
}
|
|
880
880
|
function getShardFromUrl(url) {
|
|
881
881
|
const [isMatch, shard] = url.match(SHARDED_URL_RE) || [];
|
|
882
|
-
return isMatch ? parseInt(shard, 10) : null;
|
|
882
|
+
return isMatch ? parseInt(shard, 10) - 1 : null;
|
|
883
883
|
}
|
|
884
884
|
return {
|
|
885
885
|
middleware: {
|
|
@@ -1581,7 +1581,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1581
1581
|
return printNoDefaultExport(), createClient2(config);
|
|
1582
1582
|
};
|
|
1583
1583
|
}
|
|
1584
|
-
var name = "@sanity/client", version = "6.20.2-beta.
|
|
1584
|
+
var name = "@sanity/client", version = "6.20.2-beta.2";
|
|
1585
1585
|
const middleware = [
|
|
1586
1586
|
domainSharder.middleware,
|
|
1587
1587
|
debug({ verbose: !0, namespace: "sanity:client" }),
|