@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/index.cjs CHANGED
@@ -738,13 +738,13 @@ function _create(client, httpRequest, doc, op, options = {}) {
738
738
  return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
739
739
  }
740
740
  function _resourceBase(resource) {
741
- return `/${resource.type}/${resource.id}`;
741
+ return resource.type === "projects" && "dataset" in resource ? `/projects/${resource.id}/datasets/${resource.dataset}` : `/${resource.type}/${resource.id}`;
742
742
  }
743
743
  function isDataRequestUri(uri, resource) {
744
744
  return resource ? uri.indexOf(`/${_resourceBase(resource)}/data/`) === 0 : uri.indexOf("/data/") === 0;
745
745
  }
746
746
  function isDataQueryRequestUri(uri, resource) {
747
- return resource ? uri.indexOf(`/${_resourceBase(resource)}/data/query`) === 0 : uri.indexOf("/data/query") === 0;
747
+ 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;
748
748
  }
749
749
  function _requestObservable(client, httpRequest, options) {
750
750
  const uri = options.url || options.uri, config$1 = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isDataRequestUri(uri, config$1.experimental_resource) : options.canUseCdn;
@@ -1557,7 +1557,7 @@ function defineDeprecatedCreateClient(createClient2) {
1557
1557
  return config.printNoDefaultExport(), createClient2(config$1);
1558
1558
  };
1559
1559
  }
1560
- var name = "@sanity/client", version = "6.28.0-resources-projects.0";
1560
+ var name = "@sanity/client", version = "6.28.0-resources-projects.1";
1561
1561
  const middleware = [
1562
1562
  middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
1563
1563
  middleware$1.headers({ "User-Agent": `${name} ${version}` }),