bruce-models 4.0.9 → 4.1.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.
@@ -275,6 +275,12 @@
275
275
  else if (encoding === "iso-8859-1") {
276
276
  encoding = "utf-8";
277
277
  }
278
+ if (type == "application/octet-stream" || type == "model/gltf-binary") {
279
+ if (encoding !== "utf-8") {
280
+ console.warn("Binary data is being returned with an unexpected encoding:", encoding);
281
+ }
282
+ return data.blob();
283
+ }
278
284
  let text = yield (encoding && encoding !== "utf-8"
279
285
  ? new TextDecoder(encoding).decode(yield data.arrayBuffer())
280
286
  : data.text());
@@ -284,17 +290,17 @@
284
290
  if (!type) {
285
291
  type = "";
286
292
  }
287
- if (type == "application/octet-stream" || type == "model/gltf-binary") {
288
- return new Blob([text]);
289
- }
290
- else if (type.includes("text/csv")) {
293
+ if (type.includes("text/csv")) {
291
294
  return text;
292
295
  }
293
296
  if (text && typeof text == "string") {
294
297
  text = text.trim();
295
298
  }
296
- if (text && text.startsWith("{") && text.endsWith("}")) {
297
- return JSON.parse(text);
299
+ if (text) {
300
+ if ((text.startsWith("{") && text.endsWith("}")) ||
301
+ (text.startsWith("[") && text.endsWith("]"))) {
302
+ return JSON.parse(text);
303
+ }
298
304
  }
299
305
  return text;
300
306
  });
@@ -11659,7 +11665,7 @@
11659
11665
  })(exports.DataSource || (exports.DataSource = {}));
11660
11666
 
11661
11667
  // This is updated with the package.json version on build.
11662
- const VERSION = "4.0.9";
11668
+ const VERSION = "4.1.1";
11663
11669
 
11664
11670
  exports.VERSION = VERSION;
11665
11671
  exports.AbstractApi = AbstractApi;