@moonbase.sh/storefront-api 0.2.40 → 0.2.41

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.cjs CHANGED
@@ -648,16 +648,18 @@ var MoonbaseApi = class {
648
648
  });
649
649
  if (response.status >= 400)
650
650
  await handleResponseProblem(response);
651
+ let json;
651
652
  try {
653
+ json = await response.json();
652
654
  return {
653
- data: schema instanceof import_zod10.ZodNull ? null : schema.parse(await response.json()),
655
+ data: schema instanceof import_zod10.ZodNull ? null : schema.parse(json),
654
656
  headers: Object.fromEntries(response.headers.entries()),
655
657
  status: response.status
656
658
  };
657
659
  } catch (err) {
658
660
  console.warn("Could not parse response", {
659
661
  status: response.status,
660
- content: await response.text(),
662
+ content: json || (response.bodyUsed ? "unknown" : await response.text()),
661
663
  headers: Object.fromEntries(response.headers.entries()),
662
664
  userAgent: window && window.navigator && window.navigator.userAgent,
663
665
  err
package/dist/index.js CHANGED
@@ -606,16 +606,18 @@ var MoonbaseApi = class {
606
606
  });
607
607
  if (response.status >= 400)
608
608
  await handleResponseProblem(response);
609
+ let json;
609
610
  try {
611
+ json = await response.json();
610
612
  return {
611
- data: schema instanceof ZodNull ? null : schema.parse(await response.json()),
613
+ data: schema instanceof ZodNull ? null : schema.parse(json),
612
614
  headers: Object.fromEntries(response.headers.entries()),
613
615
  status: response.status
614
616
  };
615
617
  } catch (err) {
616
618
  console.warn("Could not parse response", {
617
619
  status: response.status,
618
- content: await response.text(),
620
+ content: json || (response.bodyUsed ? "unknown" : await response.text()),
619
621
  headers: Object.fromEntries(response.headers.entries()),
620
622
  userAgent: window && window.navigator && window.navigator.userAgent,
621
623
  err
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "0.2.40",
4
+ "version": "0.2.41",
5
5
  "description": "Package to let you build storefronts with Moonbase.sh as payment and delivery provider",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",