@supernova-studio/client 0.54.33 → 0.54.34

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.mjs CHANGED
@@ -3666,20 +3666,7 @@ var HANDLE_MIN_LENGTH = 2;
3666
3666
  var HANDLE_MAX_LENGTH = 64;
3667
3667
  var CreateWorkspaceInput = z120.object({
3668
3668
  name: z120.string().min(WORKSPACE_NAME_MIN_LENGTH).max(WORKSPACE_NAME_MAX_LENGTH).trim(),
3669
- product: ProductCodeSchema,
3670
- priceId: z120.string(),
3671
- billingEmail: z120.string().email().optional(),
3672
- handle: z120.string().regex(slugRegex).min(HANDLE_MIN_LENGTH).max(HANDLE_MAX_LENGTH).refine((value) => value?.length > 0).optional(),
3673
- invites: UserInvites.optional(),
3674
- promoCode: z120.string().optional(),
3675
- status: InternalStatusSchema.optional(),
3676
- planInterval: BillingIntervalSchema.optional(),
3677
- seats: z120.number().optional(),
3678
- seatLimit: z120.number().optional(),
3679
- card: CardSchema.optional(),
3680
- sso: SsoProvider.optional(),
3681
- npmRegistrySettings: NpmRegistryConfig.optional(),
3682
- ipWhitelist: WorkspaceIpSettings.optional()
3669
+ handle: z120.string().regex(slugRegex).min(HANDLE_MIN_LENGTH).max(HANDLE_MAX_LENGTH).refine((value) => value?.length > 0).optional()
3683
3670
  });
3684
3671
  var WorkspaceInvitation = z121.object({
3685
3672
  id: z121.string(),
@@ -6607,17 +6594,39 @@ var WorkspacesEndpoint = class {
6607
6594
 
6608
6595
  // src/api/transport/request-executor-error.ts
6609
6596
  var RequestExecutorError = class _RequestExecutorError extends Error {
6610
- constructor(type, message, cause) {
6597
+ constructor(type, message, errorCode, cause) {
6611
6598
  super(`${type}: ${message}`, { cause });
6612
6599
  __publicField(this, "type");
6600
+ __publicField(this, "errorCode");
6613
6601
  this.type = type;
6602
+ this.errorCode = errorCode;
6603
+ }
6604
+ static tryParseErrorCode(body) {
6605
+ try {
6606
+ const errorObj = JSON.parse(body);
6607
+ if (errorObj && typeof errorObj.errorCode === "string") {
6608
+ return errorObj.errorCode;
6609
+ }
6610
+ return null;
6611
+ } catch (e) {
6612
+ return null;
6613
+ }
6614
6614
  }
6615
6615
  static serverError(endpoint, status, bodyText) {
6616
- return new _RequestExecutorError("ServerError", `Endpoint ${endpoint} returned ${status}
6617
- ${bodyText}`);
6616
+ return new _RequestExecutorError(
6617
+ "ServerError",
6618
+ `Endpoint ${endpoint} returned ${status}
6619
+ ${bodyText}`,
6620
+ this.tryParseErrorCode(bodyText)
6621
+ );
6618
6622
  }
6619
6623
  static responseParsingError(endpoint, cause) {
6620
- return new _RequestExecutorError("ResponseParsingError", `Endpoint ${endpoint} returned incompatible JSON`, cause);
6624
+ return new _RequestExecutorError(
6625
+ "ResponseParsingError",
6626
+ `Endpoint ${endpoint} returned incompatible JSON`,
6627
+ void 0,
6628
+ cause
6629
+ );
6621
6630
  }
6622
6631
  };
6623
6632