@privy-io/api-base 1.6.0 → 1.6.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.
@@ -1 +1 @@
1
- "use strict";var r=require("../constants/error-codes.js");class s extends Error{toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(r,s,e,t){super(s),this.code=e,this.status=r,this.responseData=t}}class e extends s{constructor(r,s){super(401,r,s)}}exports.AccountTransferRequiredError=class extends s{constructor(s){super(400,"Account transfer required",r.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED,s),this.data=s}},exports.AllowlistRejectedError=class extends e{constructor(s){super(s||"User is not allowed to login to this app.",r.PrivyErrorCode.ALLOWLIST_REJECTED)}},exports.ForbiddenError=class extends s{constructor(r,s){super(403,r,s)}},exports.HttpError=s,exports.InsufficientBalanceError=class extends s{constructor(s){super(400,s||"Insufficient balance.",r.PrivyErrorCode.INSUFFICIENT_FUNDS)}},exports.InternalServerError=class extends s{constructor(r){super(500,r||"Service unavailable.")}},exports.InvalidInputError=class extends s{constructor(s,e){super(400,s,e||r.PrivyErrorCode.INVALID_DATA)}},exports.LegacyInvalidInputError=class extends s{constructor(r,s){super(422,r,s)}},exports.NotFoundError=class extends s{constructor(r){super(404,r)}},exports.RequestTimeoutError=class extends s{constructor(r,s){super(408,r,s)}},exports.TooManyRequestsError=class extends s{constructor(s){super(429,s||"Too many requests. Please wait to try again.",r.PrivyErrorCode.TOO_MANY_REQUESTS)}},exports.UnauthorizedError=e,exports.UnsupportedMediaType=class extends s{constructor(r){super(415,r)}};
1
+ "use strict";var r=require("../constants/error-codes.js");class e extends Error{toString(){return`${this.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(r,e,s,t){super(e),this.status=r,this.code=s,this.name="HttpError",this.responseData=t}}class s extends e{constructor(r,e){super(401,r,e),this.name="UnauthorizedError"}}exports.AccountTransferRequiredError=class extends e{constructor(e){super(400,"Account transfer required",r.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED,e),this.data=e,this.name="AccountTransferRequiredError"}},exports.AllowlistRejectedError=class extends s{constructor(e){super(e||"User is not allowed to login to this app.",r.PrivyErrorCode.ALLOWLIST_REJECTED),this.name="AllowlistRejectedError"}},exports.ForbiddenError=class extends e{constructor(r,e){super(403,r,e),this.name="ForbiddenError"}},exports.HttpError=e,exports.InsufficientBalanceError=class extends e{constructor(e){super(400,e||"Insufficient balance.",r.PrivyErrorCode.INSUFFICIENT_FUNDS),this.name="InsufficientBalanceError"}},exports.InternalServerError=class extends e{constructor(r){super(500,r||"Service unavailable."),this.name="InternalServerError"}},exports.InvalidInputError=class extends e{constructor(e,s){super(400,e,s||r.PrivyErrorCode.INVALID_DATA),this.name="InvalidInputError"}},exports.LegacyInvalidInputError=class extends e{constructor(r,e){super(422,r,e),this.name="LegacyInvalidInputError"}},exports.NotFoundError=class extends e{constructor(r){super(404,r),this.name="NotFoundError"}},exports.PaymentFailedError=class extends e{constructor(r){super(402,r||"Payment failed.")}},exports.RequestTimeoutError=class extends e{constructor(r,e){super(408,r,e),this.name="RequestTimeoutError"}},exports.TooManyRequestsError=class extends e{constructor(e){super(429,e||"Too many requests. Please wait to try again.",r.PrivyErrorCode.TOO_MANY_REQUESTS),this.name="TooManyRequestsError"}},exports.UnauthorizedError=s,exports.UnsupportedMediaType=class extends e{constructor(r){super(415,r),this.name="UnsupportedMediaType"}};
@@ -1 +1 @@
1
- "use strict";var r=require("./api-error.js");require("../constants/error-codes.js"),exports.AccountTransferRequiredError=r.AccountTransferRequiredError,exports.AllowlistRejectedError=r.AllowlistRejectedError,exports.ForbiddenError=r.ForbiddenError,exports.HttpError=r.HttpError,exports.InsufficientBalanceError=r.InsufficientBalanceError,exports.InternalServerError=r.InternalServerError,exports.InvalidInputError=r.InvalidInputError,exports.LegacyInvalidInputError=r.LegacyInvalidInputError,exports.NotFoundError=r.NotFoundError,exports.RequestTimeoutError=r.RequestTimeoutError,exports.TooManyRequestsError=r.TooManyRequestsError,exports.UnauthorizedError=r.UnauthorizedError,exports.UnsupportedMediaType=r.UnsupportedMediaType;
1
+ "use strict";var r=require("./api-error.js");require("../constants/error-codes.js"),exports.AccountTransferRequiredError=r.AccountTransferRequiredError,exports.AllowlistRejectedError=r.AllowlistRejectedError,exports.ForbiddenError=r.ForbiddenError,exports.HttpError=r.HttpError,exports.InsufficientBalanceError=r.InsufficientBalanceError,exports.InternalServerError=r.InternalServerError,exports.InvalidInputError=r.InvalidInputError,exports.LegacyInvalidInputError=r.LegacyInvalidInputError,exports.NotFoundError=r.NotFoundError,exports.PaymentFailedError=r.PaymentFailedError,exports.RequestTimeoutError=r.RequestTimeoutError,exports.TooManyRequestsError=r.TooManyRequestsError,exports.UnauthorizedError=r.UnauthorizedError,exports.UnsupportedMediaType=r.UnsupportedMediaType;
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var r=require("./classes/api-error.js"),e=require("./constants/error-codes.js"),o=require("./schemas/error.js");require("zod"),exports.AccountTransferRequiredError=r.AccountTransferRequiredError,exports.AllowlistRejectedError=r.AllowlistRejectedError,exports.ForbiddenError=r.ForbiddenError,exports.HttpError=r.HttpError,exports.InsufficientBalanceError=r.InsufficientBalanceError,exports.InternalServerError=r.InternalServerError,exports.InvalidInputError=r.InvalidInputError,exports.LegacyInvalidInputError=r.LegacyInvalidInputError,exports.NotFoundError=r.NotFoundError,exports.RequestTimeoutError=r.RequestTimeoutError,exports.TooManyRequestsError=r.TooManyRequestsError,exports.UnauthorizedError=r.UnauthorizedError,exports.UnsupportedMediaType=r.UnsupportedMediaType,exports.PrivyErrorCode=e.PrivyErrorCode,exports.APIError=o.APIError;
1
+ "use strict";var r=require("./classes/api-error.js"),e=require("./constants/error-codes.js"),o=require("./schemas/error.js");require("zod"),exports.AccountTransferRequiredError=r.AccountTransferRequiredError,exports.AllowlistRejectedError=r.AllowlistRejectedError,exports.ForbiddenError=r.ForbiddenError,exports.HttpError=r.HttpError,exports.InsufficientBalanceError=r.InsufficientBalanceError,exports.InternalServerError=r.InternalServerError,exports.InvalidInputError=r.InvalidInputError,exports.LegacyInvalidInputError=r.LegacyInvalidInputError,exports.NotFoundError=r.NotFoundError,exports.PaymentFailedError=r.PaymentFailedError,exports.RequestTimeoutError=r.RequestTimeoutError,exports.TooManyRequestsError=r.TooManyRequestsError,exports.UnauthorizedError=r.UnauthorizedError,exports.UnsupportedMediaType=r.UnsupportedMediaType,exports.PrivyErrorCode=e.PrivyErrorCode,exports.APIError=o.APIError;
@@ -158,6 +158,9 @@ declare class TooManyRequestsError extends HttpError {
158
158
  declare class InsufficientBalanceError extends HttpError {
159
159
  constructor(message?: string);
160
160
  }
161
+ declare class PaymentFailedError extends HttpError {
162
+ constructor(message?: string);
163
+ }
161
164
  declare class InternalServerError extends HttpError {
162
165
  constructor(message?: string);
163
166
  }
@@ -202,4 +205,4 @@ declare const APIError: z.ZodObject<{
202
205
  code?: PrivyErrorCode | undefined;
203
206
  }>;
204
207
 
205
- export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
208
+ export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PaymentFailedError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
@@ -158,6 +158,9 @@ declare class TooManyRequestsError extends HttpError {
158
158
  declare class InsufficientBalanceError extends HttpError {
159
159
  constructor(message?: string);
160
160
  }
161
+ declare class PaymentFailedError extends HttpError {
162
+ constructor(message?: string);
163
+ }
161
164
  declare class InternalServerError extends HttpError {
162
165
  constructor(message?: string);
163
166
  }
@@ -202,4 +205,4 @@ declare const APIError: z.ZodObject<{
202
205
  code?: PrivyErrorCode | undefined;
203
206
  }>;
204
207
 
205
- export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
208
+ export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PaymentFailedError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
@@ -1 +1 @@
1
- import{PrivyErrorCode as s}from"../constants/error-codes.mjs";class t extends Error{toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(s,t,e,r){super(t),this.code=e,this.status=s,this.responseData=r}}class e extends t{constructor(t,e){super(400,t,e||s.INVALID_DATA)}}class r extends t{constructor(s,t){super(401,s,t)}}class c extends r{constructor(t){super(t||"User is not allowed to login to this app.",s.ALLOWLIST_REJECTED)}}class o extends t{constructor(s,t){super(403,s,t)}}class n extends t{constructor(s){super(404,s)}}class a extends t{constructor(s,t){super(408,s,t)}}class u extends t{constructor(s){super(415,s)}}class i extends t{constructor(s,t){super(422,s,t)}}class l extends t{constructor(t){super(429,t||"Too many requests. Please wait to try again.",s.TOO_MANY_REQUESTS)}}class d extends t{constructor(t){super(400,t||"Insufficient balance.",s.INSUFFICIENT_FUNDS)}}class p extends t{constructor(s){super(500,s||"Service unavailable.")}}class x extends t{constructor(t){super(400,"Account transfer required",s.ACCOUNT_TRANSFER_REQUIRED,t),this.data=t}}export{x as AccountTransferRequiredError,c as AllowlistRejectedError,o as ForbiddenError,t as HttpError,d as InsufficientBalanceError,p as InternalServerError,e as InvalidInputError,i as LegacyInvalidInputError,n as NotFoundError,a as RequestTimeoutError,l as TooManyRequestsError,r as UnauthorizedError,u as UnsupportedMediaType};
1
+ import{PrivyErrorCode as s}from"../constants/error-codes.mjs";class r extends Error{toString(){return`${this.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(s,r,e,t){super(r),this.status=s,this.code=e,this.name="HttpError",this.responseData=t}}class e extends r{constructor(r,e){super(400,r,e||s.INVALID_DATA),this.name="InvalidInputError"}}class t extends r{constructor(s,r){super(401,s,r),this.name="UnauthorizedError"}}class n extends t{constructor(r){super(r||"User is not allowed to login to this app.",s.ALLOWLIST_REJECTED),this.name="AllowlistRejectedError"}}class o extends r{constructor(s,r){super(403,s,r),this.name="ForbiddenError"}}class a extends r{constructor(s){super(404,s),this.name="NotFoundError"}}class c extends r{constructor(s,r){super(408,s,r),this.name="RequestTimeoutError"}}class u extends r{constructor(s){super(415,s),this.name="UnsupportedMediaType"}}class i extends r{constructor(s,r){super(422,s,r),this.name="LegacyInvalidInputError"}}class d extends r{constructor(r){super(429,r||"Too many requests. Please wait to try again.",s.TOO_MANY_REQUESTS),this.name="TooManyRequestsError"}}class l extends r{constructor(r){super(400,r||"Insufficient balance.",s.INSUFFICIENT_FUNDS),this.name="InsufficientBalanceError"}}class p extends r{constructor(s){super(402,s||"Payment failed.")}}class h extends r{constructor(s){super(500,s||"Service unavailable."),this.name="InternalServerError"}}class E extends r{constructor(r){super(400,"Account transfer required",s.ACCOUNT_TRANSFER_REQUIRED,r),this.data=r,this.name="AccountTransferRequiredError"}}export{E as AccountTransferRequiredError,n as AllowlistRejectedError,o as ForbiddenError,r as HttpError,l as InsufficientBalanceError,h as InternalServerError,e as InvalidInputError,i as LegacyInvalidInputError,a as NotFoundError,p as PaymentFailedError,c as RequestTimeoutError,d as TooManyRequestsError,t as UnauthorizedError,u as UnsupportedMediaType};
@@ -1 +1 @@
1
- export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,InsufficientBalanceError,InternalServerError,InvalidInputError,LegacyInvalidInputError,NotFoundError,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType}from"./api-error.mjs";import"../constants/error-codes.mjs";
1
+ export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,InsufficientBalanceError,InternalServerError,InvalidInputError,LegacyInvalidInputError,NotFoundError,PaymentFailedError,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType}from"./api-error.mjs";import"../constants/error-codes.mjs";
@@ -1 +1 @@
1
- export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,InsufficientBalanceError,InternalServerError,InvalidInputError,LegacyInvalidInputError,NotFoundError,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType}from"./classes/api-error.mjs";export{PrivyErrorCode}from"./constants/error-codes.mjs";export{APIError}from"./schemas/error.mjs";import"zod";
1
+ export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,InsufficientBalanceError,InternalServerError,InvalidInputError,LegacyInvalidInputError,NotFoundError,PaymentFailedError,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType}from"./classes/api-error.mjs";export{PrivyErrorCode}from"./constants/error-codes.mjs";export{APIError}from"./schemas/error.mjs";import"zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/api-base",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "sideEffects": false,
5
5
  "exports": {
6
6
  ".": {