@sanity/client 6.28.3-resources.1 → 6.28.3-resources.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 +9 -6
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +9 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data/dataMethods.ts +9 -10
- package/umd/sanityClient.js +9 -6
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.cjs
CHANGED
|
@@ -889,15 +889,18 @@ function _create(client, httpRequest, doc, op, options = {}) {
|
|
|
889
889
|
const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: !0, returnDocuments: !0 }, options);
|
|
890
890
|
return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
|
|
891
891
|
}
|
|
892
|
-
const
|
|
892
|
+
const isResourceDataEndpoint = (config, uri, endpoint) => {
|
|
893
893
|
if (!config["~experimental_resource"])
|
|
894
894
|
return !1;
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
))
|
|
895
|
+
const { type, id } = config["~experimental_resource"];
|
|
896
|
+
if (uri.startsWith(`/${type}/${id}/${endpoint}`))
|
|
898
897
|
return !0;
|
|
899
|
-
|
|
900
|
-
|
|
898
|
+
if (type === "dataset") {
|
|
899
|
+
const [projectId2, datasetName] = id.split(".");
|
|
900
|
+
if (uri.startsWith(`/projects/${projectId2}/datasets/${datasetName}/${endpoint}`))
|
|
901
|
+
return !0;
|
|
902
|
+
}
|
|
903
|
+
return !1;
|
|
901
904
|
}, 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);
|
|
902
905
|
function _requestObservable(client, httpRequest, options) {
|
|
903
906
|
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;
|