@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.cjs
CHANGED
|
@@ -737,15 +737,18 @@ function _create(client, httpRequest, doc, op, options = {}) {
|
|
|
737
737
|
const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: !0, returnDocuments: !0 }, options);
|
|
738
738
|
return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
|
|
739
739
|
}
|
|
740
|
-
const
|
|
740
|
+
const isResourceDataEndpoint = (config2, uri, endpoint) => {
|
|
741
741
|
if (!config2["~experimental_resource"])
|
|
742
742
|
return !1;
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
))
|
|
743
|
+
const { type, id } = config2["~experimental_resource"];
|
|
744
|
+
if (uri.startsWith(`/${type}/${id}/${endpoint}`))
|
|
746
745
|
return !0;
|
|
747
|
-
|
|
748
|
-
|
|
746
|
+
if (type === "dataset") {
|
|
747
|
+
const [projectId, datasetName] = id.split(".");
|
|
748
|
+
if (uri.startsWith(`/projects/${projectId}/datasets/${datasetName}/${endpoint}`))
|
|
749
|
+
return !0;
|
|
750
|
+
}
|
|
751
|
+
return !1;
|
|
749
752
|
}, isQuery = (config2, uri) => uri.startsWith("/data/query/") || isResourceDataEndpoint(config2, uri, "query"), isMutate = (config2, uri) => uri.startsWith("/data/mutate/") || isResourceDataEndpoint(config2, uri, "mutate"), isDoc = (config2, uri) => uri.startsWith("/data/doc/") || isResourceDataEndpoint(config2, uri, "doc"), isListener = (config2, uri) => uri.startsWith("/data/listen/") || isResourceDataEndpoint(config2, uri, "listen"), isHistory = (config2, uri) => uri.startsWith("/data/history/") || isResourceDataEndpoint(config2, uri, "history"), isData = (config2, uri) => uri.startsWith("/data/") || isQuery(config2, uri) || isMutate(config2, uri) || isDoc(config2, uri) || isListener(config2, uri) || isHistory(config2, uri);
|
|
750
753
|
function _requestObservable(client, httpRequest, options) {
|
|
751
754
|
const uri = options.url || options.uri, config$1 = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isData(config$1, uri) : options.canUseCdn;
|
|
@@ -1553,7 +1556,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1553
1556
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1554
1557
|
};
|
|
1555
1558
|
}
|
|
1556
|
-
var name = "@sanity/client", version = "6.28.3-resources.
|
|
1559
|
+
var name = "@sanity/client", version = "6.28.3-resources.2";
|
|
1557
1560
|
const middleware = [
|
|
1558
1561
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1559
1562
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|