@sanity/client 6.28.3-resources.0 → 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 +13 -11
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +13 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/package.json +6 -25
- package/src/data/dataMethods.ts +22 -25
- package/umd/sanityClient.js +13 -11
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.cjs
CHANGED
|
@@ -889,17 +889,19 @@ 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
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
892
|
+
const isResourceDataEndpoint = (config, uri, endpoint) => {
|
|
893
|
+
if (!config["~experimental_resource"])
|
|
894
|
+
return !1;
|
|
895
|
+
const { type, id } = config["~experimental_resource"];
|
|
896
|
+
if (uri.startsWith(`/${type}/${id}/${endpoint}`))
|
|
897
|
+
return !0;
|
|
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;
|
|
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);
|
|
903
905
|
function _requestObservable(client, httpRequest, options) {
|
|
904
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;
|
|
905
907
|
let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
|