bruce-models 2.5.1 → 2.5.2
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/bruce-models.es5.js +17 -36
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +17 -35
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +14 -35
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -0
- package/package.json +3 -3
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3122,45 +3122,24 @@
|
|
|
3122
3122
|
// Need to see if our api is generally good at setting content-type headers.
|
|
3123
3123
|
// Make it less specific to CSV.
|
|
3124
3124
|
function parseResult(data) {
|
|
3125
|
+
var _a, _b;
|
|
3125
3126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3126
|
-
if (data.status
|
|
3127
|
-
let type = data.headers.get("Content-Type");
|
|
3128
|
-
if (type) {
|
|
3129
|
-
type = type.trim().toLowerCase();
|
|
3130
|
-
}
|
|
3131
|
-
let encoding = "";
|
|
3132
|
-
const charset = type ? type.split(";").find((x) => x.startsWith("charset=")) : "";
|
|
3133
|
-
if (charset && charset.includes("=")) {
|
|
3134
|
-
encoding = charset.split("=")[1];
|
|
3135
|
-
encoding = encoding.toLowerCase();
|
|
3136
|
-
}
|
|
3137
|
-
// Our API has a very specific utf-16 encoding.
|
|
3138
|
-
if (encoding == "utf-16") {
|
|
3139
|
-
encoding = exports.Api.EEncoding.UTF16;
|
|
3140
|
-
}
|
|
3141
|
-
if (!encoding || encoding == "utf-8") {
|
|
3142
|
-
const text = yield data.text();
|
|
3143
|
-
if (!text || !text.trim()) {
|
|
3144
|
-
return null;
|
|
3145
|
-
}
|
|
3146
|
-
if (type && type.includes("text/csv")) {
|
|
3147
|
-
return text;
|
|
3148
|
-
}
|
|
3149
|
-
return JSON.parse(text);
|
|
3150
|
-
}
|
|
3151
|
-
else {
|
|
3152
|
-
const buffer = yield data.arrayBuffer();
|
|
3153
|
-
const text = new TextDecoder(encoding).decode(buffer);
|
|
3154
|
-
if (type && type.includes("text/csv")) {
|
|
3155
|
-
return text;
|
|
3156
|
-
}
|
|
3157
|
-
return JSON.parse(text);
|
|
3158
|
-
}
|
|
3159
|
-
}
|
|
3160
|
-
else {
|
|
3127
|
+
if (data.status !== 200) {
|
|
3161
3128
|
const error = yield data.json();
|
|
3162
3129
|
throw (error);
|
|
3163
3130
|
}
|
|
3131
|
+
let type = (_a = data.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
|
|
3132
|
+
let encoding = (_b = type === null || type === void 0 ? void 0 : type.split(";").find((x) => x.startsWith("charset="))) === null || _b === void 0 ? void 0 : _b.split("=")[1].toLowerCase();
|
|
3133
|
+
if (encoding === "utf-16") {
|
|
3134
|
+
encoding = exports.Api.EEncoding.UTF16;
|
|
3135
|
+
}
|
|
3136
|
+
const text = yield (encoding && encoding !== "utf-8"
|
|
3137
|
+
? new TextDecoder(encoding).decode(yield data.arrayBuffer())
|
|
3138
|
+
: data.text());
|
|
3139
|
+
if (!(text === null || text === void 0 ? void 0 : text.trim())) {
|
|
3140
|
+
return null;
|
|
3141
|
+
}
|
|
3142
|
+
return (type === null || type === void 0 ? void 0 : type.includes("text/csv")) ? text : JSON.parse(text);
|
|
3164
3143
|
});
|
|
3165
3144
|
}
|
|
3166
3145
|
/**
|
|
@@ -11374,6 +11353,9 @@
|
|
|
11374
11353
|
Plugin.GetLoadUrl = GetLoadUrl;
|
|
11375
11354
|
})(exports.Plugin || (exports.Plugin = {}));
|
|
11376
11355
|
|
|
11356
|
+
const VERSION$1 = "2.5.2";
|
|
11357
|
+
|
|
11358
|
+
exports.VERSION = VERSION$1;
|
|
11377
11359
|
exports.AbstractApi = AbstractApi;
|
|
11378
11360
|
exports.ApiGetters = ApiGetters;
|
|
11379
11361
|
exports.BruceEvent = BruceEvent;
|