@moonbase.sh/storefront-api 0.1.93 → 0.1.94

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
@@ -35,6 +35,7 @@ __export(src_exports, {
35
35
  ActivationStatus: () => ActivationStatus,
36
36
  LicenseStatus: () => LicenseStatus,
37
37
  MoonbaseClient: () => MoonbaseClient,
38
+ MoonbaseError: () => MoonbaseError,
38
39
  NotAuthenticatedError: () => NotAuthenticatedError,
39
40
  NotAuthorizedError: () => NotAuthorizedError,
40
41
  NotFoundError: () => NotFoundError,
@@ -236,6 +237,16 @@ var NotFoundError = class extends Error {
236
237
  this.name = "NotFoundError";
237
238
  }
238
239
  };
240
+ var MoonbaseError = class extends Error {
241
+ constructor(title, detail, status) {
242
+ super();
243
+ this.title = title;
244
+ this.detail = detail;
245
+ this.status = status;
246
+ this.name = "MoonbaseError";
247
+ this.message = detail != null ? detail : title;
248
+ }
249
+ };
239
250
 
240
251
  // src/utils/problemHandler.ts
241
252
  var problemDetailsSchema = import_zod6.z.object({
@@ -258,11 +269,7 @@ async function handleResponseProblem(response) {
258
269
  } catch (e) {
259
270
  throw new Error("An unknown problem occurred");
260
271
  }
261
- if (problemDetails.detail)
262
- throw new Error(problemDetails.detail);
263
- if (problemDetails.title)
264
- throw new Error(problemDetails.title);
265
- throw new Error("An unknown problem occurred");
272
+ throw new MoonbaseError(problemDetails.title, problemDetails.detail, problemDetails.status);
266
273
  }
267
274
 
268
275
  // src/identity/schemas.ts
@@ -752,6 +759,7 @@ var MoonbaseClient = class {
752
759
  ActivationStatus,
753
760
  LicenseStatus,
754
761
  MoonbaseClient,
762
+ MoonbaseError,
755
763
  NotAuthenticatedError,
756
764
  NotAuthorizedError,
757
765
  NotFoundError,
package/dist/index.d.cts CHANGED
@@ -13099,6 +13099,12 @@ declare class NotAuthenticatedError extends Error {
13099
13099
  declare class NotFoundError extends Error {
13100
13100
  constructor();
13101
13101
  }
13102
+ declare class MoonbaseError extends Error {
13103
+ readonly title: string;
13104
+ readonly detail: string | undefined;
13105
+ readonly status: number;
13106
+ constructor(title: string, detail: string | undefined, status: number);
13107
+ }
13102
13108
 
13103
13109
  interface MoonbaseConfiguration {
13104
13110
  endpoint: string;
@@ -13116,4 +13122,4 @@ declare class MoonbaseClient {
13116
13122
  orders: OrderEndpoints;
13117
13123
  }
13118
13124
 
13119
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type Download, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type User, type Voucher };
13125
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type Download, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type User, type Voucher };
package/dist/index.d.ts CHANGED
@@ -13099,6 +13099,12 @@ declare class NotAuthenticatedError extends Error {
13099
13099
  declare class NotFoundError extends Error {
13100
13100
  constructor();
13101
13101
  }
13102
+ declare class MoonbaseError extends Error {
13103
+ readonly title: string;
13104
+ readonly detail: string | undefined;
13105
+ readonly status: number;
13106
+ constructor(title: string, detail: string | undefined, status: number);
13107
+ }
13102
13108
 
13103
13109
  interface MoonbaseConfiguration {
13104
13110
  endpoint: string;
@@ -13116,4 +13122,4 @@ declare class MoonbaseClient {
13116
13122
  orders: OrderEndpoints;
13117
13123
  }
13118
13124
 
13119
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type Download, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type User, type Voucher };
13125
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type Download, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type User, type Voucher };
package/dist/index.js CHANGED
@@ -191,6 +191,16 @@ var NotFoundError = class extends Error {
191
191
  this.name = "NotFoundError";
192
192
  }
193
193
  };
194
+ var MoonbaseError = class extends Error {
195
+ constructor(title, detail, status) {
196
+ super();
197
+ this.title = title;
198
+ this.detail = detail;
199
+ this.status = status;
200
+ this.name = "MoonbaseError";
201
+ this.message = detail != null ? detail : title;
202
+ }
203
+ };
194
204
 
195
205
  // src/utils/problemHandler.ts
196
206
  var problemDetailsSchema = z6.object({
@@ -213,11 +223,7 @@ async function handleResponseProblem(response) {
213
223
  } catch (e) {
214
224
  throw new Error("An unknown problem occurred");
215
225
  }
216
- if (problemDetails.detail)
217
- throw new Error(problemDetails.detail);
218
- if (problemDetails.title)
219
- throw new Error(problemDetails.title);
220
- throw new Error("An unknown problem occurred");
226
+ throw new MoonbaseError(problemDetails.title, problemDetails.detail, problemDetails.status);
221
227
  }
222
228
 
223
229
  // src/identity/schemas.ts
@@ -706,6 +712,7 @@ export {
706
712
  ActivationStatus,
707
713
  LicenseStatus,
708
714
  MoonbaseClient,
715
+ MoonbaseError,
709
716
  NotAuthenticatedError,
710
717
  NotAuthorizedError,
711
718
  NotFoundError,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "0.1.93",
4
+ "version": "0.1.94",
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",