@sanity/client 6.28.3-resources.0 → 6.28.3-resources.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.browser.cjs +10 -11
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +10 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +11 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/package.json +6 -25
- package/src/data/dataMethods.ts +23 -25
- package/umd/sanityClient.js +10 -11
- package/umd/sanityClient.min.js +2 -2
package/dist/index.cjs
CHANGED
|
@@ -737,17 +737,16 @@ 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
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
), isData = (config2, uri) => uri.startsWith("/data/") || isQuery(config2, uri) || isMutate(config2, uri) || isDoc(config2, uri) || isListener(config2, uri) || isHistory(config2, uri);
|
|
740
|
+
const resourceDatasetRegex = /^\/projects\/([^/]+)\/datasets\/([^/]+)\/([^/^?]+)\/?/, isResourceDataEndpoint = (config2, uri, endpoint) => {
|
|
741
|
+
if (!config2["~experimental_resource"])
|
|
742
|
+
return !1;
|
|
743
|
+
if (uri.startsWith(
|
|
744
|
+
`/${config2["~experimental_resource"].type}/${config2["~experimental_resource"].id}/${endpoint}`
|
|
745
|
+
))
|
|
746
|
+
return !0;
|
|
747
|
+
const match = uri.match(resourceDatasetRegex);
|
|
748
|
+
return match ? match[3] === endpoint : !1;
|
|
749
|
+
}, 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);
|
|
751
750
|
function _requestObservable(client, httpRequest, options) {
|
|
752
751
|
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;
|
|
753
752
|
let useCdn = (options.useCdn ?? config$1.useCdn) && canUseCdn;
|
|
@@ -1554,7 +1553,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1554
1553
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1555
1554
|
};
|
|
1556
1555
|
}
|
|
1557
|
-
var name = "@sanity/client", version = "6.28.3-resources.
|
|
1556
|
+
var name = "@sanity/client", version = "6.28.3-resources.1";
|
|
1558
1557
|
const middleware = [
|
|
1559
1558
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1560
1559
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|