para-client-js 1.41.6 → 1.41.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.mjs
CHANGED
|
@@ -670,23 +670,24 @@ var ParaClient = class {
|
|
|
670
670
|
var rawJSON = isUndefined(returnRawJSON) ? true : returnRawJSON;
|
|
671
671
|
return req.then(function(res) {
|
|
672
672
|
var code = res.status;
|
|
673
|
-
if (code === 200 || code === 201 || code === 304)
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
673
|
+
if (code === 200 || code === 201 || code === 304) {
|
|
674
|
+
if (rawJSON) {
|
|
675
|
+
var result;
|
|
676
|
+
try {
|
|
677
|
+
if (!isEmpty(res.body) || res.text === "{ }" || res.text === "{}") result = res.body;
|
|
678
|
+
else result = res.text;
|
|
679
|
+
} catch (exc) {
|
|
680
|
+
result = res.text;
|
|
681
|
+
}
|
|
682
|
+
callback(result);
|
|
683
|
+
return resolve(result);
|
|
684
|
+
} else {
|
|
685
|
+
var obj = new ParaObject();
|
|
686
|
+
obj.setFields(res.body);
|
|
687
|
+
callback(obj);
|
|
688
|
+
return resolve(obj);
|
|
680
689
|
}
|
|
681
|
-
|
|
682
|
-
return resolve(result);
|
|
683
|
-
} else {
|
|
684
|
-
var obj = new ParaObject();
|
|
685
|
-
obj.setFields(res.body);
|
|
686
|
-
callback(obj);
|
|
687
|
-
return resolve(obj);
|
|
688
|
-
}
|
|
689
|
-
else if (code !== 404 || code !== 304 || code !== 204) {
|
|
690
|
+
} else if (code !== 404 || code !== 304 || code !== 204) {
|
|
690
691
|
var error = res.body || /* @__PURE__ */ new Error("ParaClient request failed.");
|
|
691
692
|
if (error && error["code"]) err((error["message"] ? error["message"] : "error") + " - " + error["code"]);
|
|
692
693
|
else err(code + " - " + res.text);
|
|
@@ -2084,10 +2085,12 @@ function checkParaObjects(obj) {
|
|
|
2084
2085
|
if (obj && isArray(obj) && !isEmpty(obj)) assert(obj[0] instanceof ParaObject, "Parameter must be an array of ParaObjects.");
|
|
2085
2086
|
}
|
|
2086
2087
|
function checkPager(obj, fn) {
|
|
2087
|
-
if (obj)
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2088
|
+
if (obj) {
|
|
2089
|
+
if (isFunction(obj)) return obj;
|
|
2090
|
+
else {
|
|
2091
|
+
assert(obj instanceof Pager, "Parameter must be a Pager object.");
|
|
2092
|
+
return fn || noop;
|
|
2093
|
+
}
|
|
2091
2094
|
}
|
|
2092
2095
|
return noop;
|
|
2093
2096
|
}
|