@privy-io/api-base 1.5.1 → 1.6.0

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.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 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 +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.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.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.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.RequestTimeoutError=r.RequestTimeoutError,exports.TooManyRequestsError=r.TooManyRequestsError,exports.UnauthorizedError=r.UnauthorizedError,exports.UnsupportedMediaType=r.UnsupportedMediaType,exports.PrivyErrorCode=e.PrivyErrorCode,exports.APIError=o.APIError;
@@ -155,6 +155,9 @@ declare class LegacyInvalidInputError extends HttpError {
155
155
  declare class TooManyRequestsError extends HttpError {
156
156
  constructor(message?: string);
157
157
  }
158
+ declare class InsufficientBalanceError extends HttpError {
159
+ constructor(message?: string);
160
+ }
158
161
  declare class InternalServerError extends HttpError {
159
162
  constructor(message?: string);
160
163
  }
@@ -199,4 +202,4 @@ declare const APIError: z.ZodObject<{
199
202
  code?: PrivyErrorCode | undefined;
200
203
  }>;
201
204
 
202
- export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
205
+ export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
@@ -155,6 +155,9 @@ declare class LegacyInvalidInputError extends HttpError {
155
155
  declare class TooManyRequestsError extends HttpError {
156
156
  constructor(message?: string);
157
157
  }
158
+ declare class InsufficientBalanceError extends HttpError {
159
+ constructor(message?: string);
160
+ }
158
161
  declare class InternalServerError extends HttpError {
159
162
  constructor(message?: string);
160
163
  }
@@ -199,4 +202,4 @@ declare const APIError: z.ZodObject<{
199
202
  code?: PrivyErrorCode | undefined;
200
203
  }>;
201
204
 
202
- export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
205
+ export { APIError, AccountTransferRequiredError, AllowlistRejectedError, type ApiErrorType, ForbiddenError, HttpError, InsufficientBalanceError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, 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(s){super(500,s||"Service unavailable.")}}class p extends t{constructor(t){super(400,"Account transfer required",s.ACCOUNT_TRANSFER_REQUIRED,t),this.data=t}}export{p as AccountTransferRequiredError,c as AllowlistRejectedError,o as ForbiddenError,t as HttpError,d 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 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 +1 @@
1
- export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,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,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType}from"./api-error.mjs";import"../constants/error-codes.mjs";
@@ -1 +1 @@
1
- export{AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,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,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.5.1",
3
+ "version": "1.6.0",
4
4
  "sideEffects": false,
5
5
  "exports": {
6
6
  ".": {
@@ -24,11 +24,12 @@
24
24
  "README.md"
25
25
  ],
26
26
  "scripts": {
27
- "build": "rollup --config rollup.types.mjs && rollup --config rollup.build.mjs",
27
+ "build:types": "rollup --config rollup.types.mjs",
28
+ "build:code": "rollup --config rollup.build.mjs",
28
29
  "check-types": "tsc --noEmit",
29
- "clean": "rm -rf dist .turbo",
30
- "d//": "To parallelize types and code build output rollup recommends running multiple instances",
31
- "dev": "concurrently --prefix=none \"rollup --config rollup.types.mjs --watch\" \"rollup --config rollup.dev.mjs --watch\"",
30
+ "clean": "rm -rf dist .turbo .swc",
31
+ "dev:code": "rollup --config rollup.dev.mjs --watch",
32
+ "dev:types": "rollup --config rollup.types.mjs --watch",
32
33
  "format": "eslint src --fix",
33
34
  "lint": "eslint src",
34
35
  "test": "jest"
@@ -53,10 +54,6 @@
53
54
  "rollup-plugin-dts": "^6.1.1",
54
55
  "typescript": "~5.5.3"
55
56
  },
56
- "engines": {
57
- "node": ">=18.0.0",
58
- "npm": ">=8.0.0"
59
- },
60
57
  "publishConfig": {
61
58
  "access": "public"
62
59
  }