bruce-models 4.0.7 → 4.0.9

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.
@@ -259,9 +259,6 @@
259
259
  }
260
260
  }
261
261
 
262
- // TODO: Currently checks for CSV vs json specifically,
263
- // Need to see if our api is generally good at setting content-type headers.
264
- // Make it less specific to CSV.
265
262
  function parseResult(data) {
266
263
  var _a, _b;
267
264
  return __awaiter(this, void 0, void 0, function* () {
@@ -278,13 +275,28 @@
278
275
  else if (encoding === "iso-8859-1") {
279
276
  encoding = "utf-8";
280
277
  }
281
- const text = yield (encoding && encoding !== "utf-8"
278
+ let text = yield (encoding && encoding !== "utf-8"
282
279
  ? new TextDecoder(encoding).decode(yield data.arrayBuffer())
283
280
  : data.text());
284
281
  if (!(text === null || text === void 0 ? void 0 : text.trim())) {
285
282
  return null;
286
283
  }
287
- return (type === null || type === void 0 ? void 0 : type.includes("text/csv")) ? text : JSON.parse(text);
284
+ if (!type) {
285
+ type = "";
286
+ }
287
+ if (type == "application/octet-stream" || type == "model/gltf-binary") {
288
+ return new Blob([text]);
289
+ }
290
+ else if (type.includes("text/csv")) {
291
+ return text;
292
+ }
293
+ if (text && typeof text == "string") {
294
+ text = text.trim();
295
+ }
296
+ if (text && text.startsWith("{") && text.endsWith("}")) {
297
+ return JSON.parse(text);
298
+ }
299
+ return text;
288
300
  });
289
301
  }
290
302
  /**
@@ -11647,7 +11659,7 @@
11647
11659
  })(exports.DataSource || (exports.DataSource = {}));
11648
11660
 
11649
11661
  // This is updated with the package.json version on build.
11650
- const VERSION = "4.0.7";
11662
+ const VERSION = "4.0.9";
11651
11663
 
11652
11664
  exports.VERSION = VERSION;
11653
11665
  exports.AbstractApi = AbstractApi;