@sanity/client 6.1.5 → 6.1.7
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 +14 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +14 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/config.ts +18 -1
- package/src/data/dataMethods.ts +4 -1
- package/umd/sanityClient.js +14 -1
- package/umd/sanityClient.min.js +3 -3
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var getIt = require('get-it');
|
|
|
8
8
|
var rxjs = require('rxjs');
|
|
9
9
|
var operators = require('rxjs/operators');
|
|
10
10
|
var name = "@sanity/client";
|
|
11
|
-
var version = "6.1.
|
|
11
|
+
var version = "6.1.7";
|
|
12
12
|
const middleware = [middleware$1.debug({
|
|
13
13
|
verbose: true,
|
|
14
14
|
namespace: "sanity:client"
|
|
@@ -885,7 +885,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
885
885
|
...options.query
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
-
if (["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
888
|
+
if (["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
889
889
|
if (config.resultSourceMap) {
|
|
890
890
|
options.query = {
|
|
891
891
|
resultSourceMap: true,
|
|
@@ -1097,6 +1097,16 @@ const validateApiVersion = function validateApiVersion2(apiVersion) {
|
|
|
1097
1097
|
throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`");
|
|
1098
1098
|
}
|
|
1099
1099
|
};
|
|
1100
|
+
const validateApiPerspective = function validateApiPerspective2(perspective) {
|
|
1101
|
+
switch (perspective) {
|
|
1102
|
+
case "previewDrafts":
|
|
1103
|
+
case "published":
|
|
1104
|
+
case "raw":
|
|
1105
|
+
return;
|
|
1106
|
+
default:
|
|
1107
|
+
throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`");
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1100
1110
|
const initConfig = (config, prevConfig) => {
|
|
1101
1111
|
const specifiedConfig = Object.assign({}, prevConfig, config);
|
|
1102
1112
|
if (!specifiedConfig.apiVersion) {
|
|
@@ -1111,6 +1121,9 @@ const initConfig = (config, prevConfig) => {
|
|
|
1111
1121
|
if (projectBased && !newConfig.projectId) {
|
|
1112
1122
|
throw new Error("Configuration must contain `projectId`");
|
|
1113
1123
|
}
|
|
1124
|
+
if (typeof newConfig.perspective === "string") {
|
|
1125
|
+
validateApiPerspective(newConfig.perspective);
|
|
1126
|
+
}
|
|
1114
1127
|
if ("encodeSourceMapAtPath" in newConfig || "encodeSourceMap" in newConfig || "studioUrl" in newConfig || "logger" in newConfig) {
|
|
1115
1128
|
throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");
|
|
1116
1129
|
}
|