@sanity/client 6.28.0-resources-projects.0 → 6.28.0-resources-projects.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/_chunks-cjs/config.cjs +5 -1
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +5 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +7 -3
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +7 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +3 -1
- package/src/data/dataMethods.ts +10 -1
- package/umd/sanityClient.js +7 -3
- package/umd/sanityClient.min.js +2 -2
package/dist/index.js
CHANGED
|
@@ -721,13 +721,13 @@ function _create(client, httpRequest, doc, op, options = {}) {
|
|
|
721
721
|
return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
|
|
722
722
|
}
|
|
723
723
|
function _resourceBase(resource) {
|
|
724
|
-
return `/${resource.type}/${resource.id}`;
|
|
724
|
+
return resource.type === "projects" && "dataset" in resource ? `/projects/${resource.id}/datasets/${resource.dataset}` : `/${resource.type}/${resource.id}`;
|
|
725
725
|
}
|
|
726
726
|
function isDataRequestUri(uri, resource) {
|
|
727
727
|
return resource ? uri.indexOf(`/${_resourceBase(resource)}/data/`) === 0 : uri.indexOf("/data/") === 0;
|
|
728
728
|
}
|
|
729
729
|
function isDataQueryRequestUri(uri, resource) {
|
|
730
|
-
return resource ? uri.indexOf(`/${_resourceBase(resource)}/data/query`) === 0 : uri.indexOf("/data/query") === 0;
|
|
730
|
+
return resource && resource.type !== "projects" ? uri.indexOf(`/${_resourceBase(resource)}/data/query`) === 0 : resource && resource.type === "projects" && "dataset" in resource ? uri.indexOf(`/projects/${resource.id}/datasets/${resource.dataset}/query`) === 0 : uri.indexOf("/data/query") === 0;
|
|
731
731
|
}
|
|
732
732
|
function _requestObservable(client, httpRequest, options) {
|
|
733
733
|
const uri = options.url || options.uri, config = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isDataRequestUri(uri, config.experimental_resource) : options.canUseCdn;
|
|
@@ -1540,7 +1540,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1540
1540
|
return printNoDefaultExport(), createClient2(config);
|
|
1541
1541
|
};
|
|
1542
1542
|
}
|
|
1543
|
-
var name = "@sanity/client", version = "6.28.0-resources-projects.
|
|
1543
|
+
var name = "@sanity/client", version = "6.28.0-resources-projects.1";
|
|
1544
1544
|
const middleware = [
|
|
1545
1545
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1546
1546
|
headers({ "User-Agent": `${name} ${version}` }),
|