@sanity/client 6.28.3-resources.0 → 6.28.3-resources.1
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 +10 -11
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +10 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +11 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/package.json +6 -25
- package/src/data/dataMethods.ts +23 -25
- package/umd/sanityClient.js +10 -11
- package/umd/sanityClient.min.js +2 -2
package/dist/index.js
CHANGED
|
@@ -720,17 +720,16 @@ function _create(client, httpRequest, doc, op, options = {}) {
|
|
|
720
720
|
const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: !0, returnDocuments: !0 }, options);
|
|
721
721
|
return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
|
|
722
722
|
}
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
), isData = (config, uri) => uri.startsWith("/data/") || isQuery(config, uri) || isMutate(config, uri) || isDoc(config, uri) || isListener(config, uri) || isHistory(config, uri);
|
|
723
|
+
const resourceDatasetRegex = /^\/projects\/([^/]+)\/datasets\/([^/]+)\/([^/^?]+)\/?/, isResourceDataEndpoint = (config, uri, endpoint) => {
|
|
724
|
+
if (!config["~experimental_resource"])
|
|
725
|
+
return !1;
|
|
726
|
+
if (uri.startsWith(
|
|
727
|
+
`/${config["~experimental_resource"].type}/${config["~experimental_resource"].id}/${endpoint}`
|
|
728
|
+
))
|
|
729
|
+
return !0;
|
|
730
|
+
const match = uri.match(resourceDatasetRegex);
|
|
731
|
+
return match ? match[3] === endpoint : !1;
|
|
732
|
+
}, isQuery = (config, uri) => uri.startsWith("/data/query/") || isResourceDataEndpoint(config, uri, "query"), isMutate = (config, uri) => uri.startsWith("/data/mutate/") || isResourceDataEndpoint(config, uri, "mutate"), isDoc = (config, uri) => uri.startsWith("/data/doc/") || isResourceDataEndpoint(config, uri, "doc"), isListener = (config, uri) => uri.startsWith("/data/listen/") || isResourceDataEndpoint(config, uri, "listen"), isHistory = (config, uri) => uri.startsWith("/data/history/") || isResourceDataEndpoint(config, uri, "history"), isData = (config, uri) => uri.startsWith("/data/") || isQuery(config, uri) || isMutate(config, uri) || isDoc(config, uri) || isListener(config, uri) || isHistory(config, uri);
|
|
734
733
|
function _requestObservable(client, httpRequest, options) {
|
|
735
734
|
const uri = options.url || options.uri, config = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isData(config, uri) : options.canUseCdn;
|
|
736
735
|
let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
|
|
@@ -1537,7 +1536,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1537
1536
|
return printNoDefaultExport(), createClient2(config);
|
|
1538
1537
|
};
|
|
1539
1538
|
}
|
|
1540
|
-
var name = "@sanity/client", version = "6.28.3-resources.
|
|
1539
|
+
var name = "@sanity/client", version = "6.28.3-resources.1";
|
|
1541
1540
|
const middleware = [
|
|
1542
1541
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1543
1542
|
headers({ "User-Agent": `${name} ${version}` }),
|