@privy-io/api-base 1.2.3 → 1.3.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.
- package/dist/index.d.ts +28 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -76,19 +76,22 @@ declare enum PrivyErrorCode {
|
|
|
76
76
|
/** This app is not permitted to provider to target app */
|
|
77
77
|
CROSS_APP_CONNECTION_NOT_ALLOWED = "cross_app_connection_not_allowed",
|
|
78
78
|
/** There is no user with this login method */
|
|
79
|
-
USER_DOES_NOT_EXIST = "user_does_not_exist"
|
|
79
|
+
USER_DOES_NOT_EXIST = "user_does_not_exist",
|
|
80
|
+
ACCOUNT_TRANSFER_REQUIRED = "account_transfer_required"
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
type ApiErrorType = {
|
|
83
84
|
error: string;
|
|
84
85
|
cause?: string;
|
|
85
86
|
code?: PrivyErrorCode;
|
|
87
|
+
data?: Record<string, any>;
|
|
86
88
|
};
|
|
87
89
|
declare class HttpError extends Error {
|
|
88
90
|
status: number;
|
|
89
91
|
/** Unique Privy error code. The SDK/customers should be able to use this code to programmatically */
|
|
90
92
|
code?: PrivyErrorCode;
|
|
91
|
-
|
|
93
|
+
responseData?: Record<string, any>;
|
|
94
|
+
constructor(status: number, message: string, code?: PrivyErrorCode, responseData?: Record<string, any>);
|
|
92
95
|
toString(): string;
|
|
93
96
|
}
|
|
94
97
|
declare class InvalidInputError extends HttpError {
|
|
@@ -133,6 +136,28 @@ declare class TooManyRequestsError extends HttpError {
|
|
|
133
136
|
declare class InternalServerError extends HttpError {
|
|
134
137
|
constructor(message?: string);
|
|
135
138
|
}
|
|
139
|
+
declare class AccountTransferRequiredError extends HttpError {
|
|
140
|
+
data: {
|
|
141
|
+
nonce: string;
|
|
142
|
+
subject: string;
|
|
143
|
+
otherUser: {
|
|
144
|
+
embeddedWalletAddress: string | null;
|
|
145
|
+
};
|
|
146
|
+
account: {
|
|
147
|
+
displayName: string | null;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
constructor(data: {
|
|
151
|
+
nonce: string;
|
|
152
|
+
subject: string;
|
|
153
|
+
otherUser: {
|
|
154
|
+
embeddedWalletAddress: string | null;
|
|
155
|
+
};
|
|
156
|
+
account: {
|
|
157
|
+
displayName: string | null;
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
136
161
|
|
|
137
162
|
declare const APIError: z.ZodObject<{
|
|
138
163
|
error: z.ZodString;
|
|
@@ -148,4 +173,4 @@ declare const APIError: z.ZodObject<{
|
|
|
148
173
|
code?: PrivyErrorCode | undefined;
|
|
149
174
|
}>;
|
|
150
175
|
|
|
151
|
-
export { APIError, AllowlistRejectedError, ApiErrorType, ForbiddenError, HttpError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
|
|
176
|
+
export { APIError, AccountTransferRequiredError, AllowlistRejectedError, ApiErrorType, ForbiddenError, HttpError, InternalServerError, InvalidInputError, LegacyInvalidInputError, NotFoundError, PrivyErrorCode, RequestTimeoutError, TooManyRequestsError, UnauthorizedError, UnsupportedMediaType };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var A=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(t,s)=>{for(var e in s)A(t,e,{get:s[e],enumerable:!0})},x=(t,s,e,I)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of E(s))!g.call(t,a)&&a!==e&&A(t,a,{get:()=>s[a],enumerable:!(I=d(s,a))||I.enumerable});return t};var U=t=>x(A({},"__esModule",{value:!0}),t);var V={};m(V,{APIError:()=>r,AccountTransferRequiredError:()=>L,AllowlistRejectedError:()=>p,ForbiddenError:()=>l,HttpError:()=>n,InternalServerError:()=>R,InvalidInputError:()=>N,LegacyInvalidInputError:()=>T,NotFoundError:()=>u,PrivyErrorCode:()=>c,RequestTimeoutError:()=>O,TooManyRequestsError:()=>S,UnauthorizedError:()=>o,UnsupportedMediaType:()=>D});module.exports=U(V);var c=(_=>(_.OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",_.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",_.MISSING_OR_INVALID_PRIVY_CLIENT_ID="missing_or_invalid_privy_client_id",_.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",_.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",_.MISSING_OR_INVALID_MFA="missing_or_invalid_mfa",_.EXPIRED_OR_INVALID_MFA_TOKEN="expired_or_invalid_mfa_token",_.INVALID_DATA="invalid_data",_.INVALID_CREDENTIALS="invalid_credentials",_.INVALID_CAPTCHA="invalid_captcha",_.LINKED_TO_ANOTHER_USER="linked_to_another_user",_.ALLOWLIST_REJECTED="allowlist_rejected",_.CANNOT_UNLINK_EMBEDDED_WALLET="cannot_unlink_embedded_wallet",_.CANNOT_UNLINK_SOLE_ACCOUNT="cannot_unlink_sole_account",_.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",_.LINKED_ACCOUNT_NOT_FOUND="linked_account_not_found",_.TOO_MANY_REQUESTS="too_many_requests",_.INVALID_ORIGIN="invalid_origin",_.MISSING_ORIGIN="missing_origin",_.INVALID_NATIVE_APP_ID="invalid_native_app_id",_.TOKEN_ALREADY_USED="token_already_used",_.ALREADY_LOGGED_OUT="already_logged_out",_.NOT_SUPPORTED="not_supported",_.USER_UNSUBSCRIBED="user_unsubscribed",_.MAX_APPS_REACHED="max_apps_reached",_.USER_LIMIT_REACHED="max_accounts_reached",_.DEVICE_REVOKED="device_revoked",_.WALLET_PASSWORD_EXISTS="wallet_password_exists",_.OAUTH_STATE_MISMATCH="oauth_state_mismatch",_.MAX_DENYLIST_ENTRIES_REACHED="max_denylist_entries_reached",_.DISALLOWED_LOGIN_METHOD="disallowed_login_method",_.DISALLOWED_RECOVERY_METHOD="disallowed_recovery_method",_.LEGACY_DASHBOARD_LOGIN_CONFIGURATION="legacy_dashboard_login_configuration",_.CANNOT_SET_PASSWORD="cannot_set_password",_.INVALID_PKCE_PARAMETERS="invalid_pkce_parameters",_.INVALID_APP_URL_SCHEME_CONFIGURATION="invalid_app_url_scheme_configuration",_.CROSS_APP_CONNECTION_NOT_ALLOWED="cross_app_connection_not_allowed",_.USER_DOES_NOT_EXIST="user_does_not_exist",_.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",_))(c||{});var n=class extends Error{status;code;responseData;constructor(s,e,I,a){super(e),this.code=I,this.status=s,this.responseData=a}toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},N=class extends n{constructor(s,e){super(400,s,e||"invalid_data")}},o=class extends n{constructor(s,e){super(401,s,e)}},p=class extends o{constructor(s){super(s||"User is not allowed to login to this app.","allowlist_rejected")}},l=class extends n{constructor(s,e){super(403,s,e)}},u=class extends n{constructor(s){super(404,s)}},O=class extends n{constructor(s,e){super(408,s,e)}},D=class extends n{constructor(s){super(415,s)}},T=class extends n{constructor(s,e){super(422,s,e)}},S=class extends n{constructor(s){super(429,s||"Too many requests. Please wait to try again.","too_many_requests")}},R=class extends n{constructor(s){super(500,s||"Service unavailable.")}},L=class extends n{constructor(e){super(400,"Account transfer required","account_transfer_required",e);this.data=e}};var i=require("zod");var r=i.z.object({error:i.z.string(),cause:i.z.string().optional(),code:i.z.nativeEnum(c).optional()});0&&(module.exports={APIError,AccountTransferRequiredError,AllowlistRejectedError,ForbiddenError,HttpError,InternalServerError,InvalidInputError,LegacyInvalidInputError,NotFoundError,PrivyErrorCode,RequestTimeoutError,TooManyRequestsError,UnauthorizedError,UnsupportedMediaType});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=(_=>(_.OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",_.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",_.MISSING_OR_INVALID_PRIVY_CLIENT_ID="missing_or_invalid_privy_client_id",_.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",_.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",_.MISSING_OR_INVALID_MFA="missing_or_invalid_mfa",_.EXPIRED_OR_INVALID_MFA_TOKEN="expired_or_invalid_mfa_token",_.INVALID_DATA="invalid_data",_.INVALID_CREDENTIALS="invalid_credentials",_.INVALID_CAPTCHA="invalid_captcha",_.LINKED_TO_ANOTHER_USER="linked_to_another_user",_.ALLOWLIST_REJECTED="allowlist_rejected",_.CANNOT_UNLINK_EMBEDDED_WALLET="cannot_unlink_embedded_wallet",_.CANNOT_UNLINK_SOLE_ACCOUNT="cannot_unlink_sole_account",_.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",_.LINKED_ACCOUNT_NOT_FOUND="linked_account_not_found",_.TOO_MANY_REQUESTS="too_many_requests",_.INVALID_ORIGIN="invalid_origin",_.MISSING_ORIGIN="missing_origin",_.INVALID_NATIVE_APP_ID="invalid_native_app_id",_.TOKEN_ALREADY_USED="token_already_used",_.ALREADY_LOGGED_OUT="already_logged_out",_.NOT_SUPPORTED="not_supported",_.USER_UNSUBSCRIBED="user_unsubscribed",_.MAX_APPS_REACHED="max_apps_reached",_.USER_LIMIT_REACHED="max_accounts_reached",_.DEVICE_REVOKED="device_revoked",_.WALLET_PASSWORD_EXISTS="wallet_password_exists",_.OAUTH_STATE_MISMATCH="oauth_state_mismatch",_.MAX_DENYLIST_ENTRIES_REACHED="max_denylist_entries_reached",_.DISALLOWED_LOGIN_METHOD="disallowed_login_method",_.DISALLOWED_RECOVERY_METHOD="disallowed_recovery_method",_.LEGACY_DASHBOARD_LOGIN_CONFIGURATION="legacy_dashboard_login_configuration",_.CANNOT_SET_PASSWORD="cannot_set_password",_.INVALID_PKCE_PARAMETERS="invalid_pkce_parameters",_.INVALID_APP_URL_SCHEME_CONFIGURATION="invalid_app_url_scheme_configuration",_.CROSS_APP_CONNECTION_NOT_ALLOWED="cross_app_connection_not_allowed",_.USER_DOES_NOT_EXIST="user_does_not_exist",_))(a||{});var e=class extends Error{status;code;constructor(s,t,S){super(t),this.code=S,this.status=s}toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},I=class extends e{constructor(s,t){super(400,s,t||"invalid_data")}},i=class extends e{constructor(s,t){super(401,s,t)}},
|
|
1
|
+
var a=(_=>(_.OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",_.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",_.MISSING_OR_INVALID_PRIVY_CLIENT_ID="missing_or_invalid_privy_client_id",_.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",_.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",_.MISSING_OR_INVALID_MFA="missing_or_invalid_mfa",_.EXPIRED_OR_INVALID_MFA_TOKEN="expired_or_invalid_mfa_token",_.INVALID_DATA="invalid_data",_.INVALID_CREDENTIALS="invalid_credentials",_.INVALID_CAPTCHA="invalid_captcha",_.LINKED_TO_ANOTHER_USER="linked_to_another_user",_.ALLOWLIST_REJECTED="allowlist_rejected",_.CANNOT_UNLINK_EMBEDDED_WALLET="cannot_unlink_embedded_wallet",_.CANNOT_UNLINK_SOLE_ACCOUNT="cannot_unlink_sole_account",_.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",_.LINKED_ACCOUNT_NOT_FOUND="linked_account_not_found",_.TOO_MANY_REQUESTS="too_many_requests",_.INVALID_ORIGIN="invalid_origin",_.MISSING_ORIGIN="missing_origin",_.INVALID_NATIVE_APP_ID="invalid_native_app_id",_.TOKEN_ALREADY_USED="token_already_used",_.ALREADY_LOGGED_OUT="already_logged_out",_.NOT_SUPPORTED="not_supported",_.USER_UNSUBSCRIBED="user_unsubscribed",_.MAX_APPS_REACHED="max_apps_reached",_.USER_LIMIT_REACHED="max_accounts_reached",_.DEVICE_REVOKED="device_revoked",_.WALLET_PASSWORD_EXISTS="wallet_password_exists",_.OAUTH_STATE_MISMATCH="oauth_state_mismatch",_.MAX_DENYLIST_ENTRIES_REACHED="max_denylist_entries_reached",_.DISALLOWED_LOGIN_METHOD="disallowed_login_method",_.DISALLOWED_RECOVERY_METHOD="disallowed_recovery_method",_.LEGACY_DASHBOARD_LOGIN_CONFIGURATION="legacy_dashboard_login_configuration",_.CANNOT_SET_PASSWORD="cannot_set_password",_.INVALID_PKCE_PARAMETERS="invalid_pkce_parameters",_.INVALID_APP_URL_SCHEME_CONFIGURATION="invalid_app_url_scheme_configuration",_.CROSS_APP_CONNECTION_NOT_ALLOWED="cross_app_connection_not_allowed",_.USER_DOES_NOT_EXIST="user_does_not_exist",_.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",_))(a||{});var e=class extends Error{status;code;responseData;constructor(s,t,S,R){super(t),this.code=S,this.status=s,this.responseData=R}toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},I=class extends e{constructor(s,t){super(400,s,t||"invalid_data")}},i=class extends e{constructor(s,t){super(401,s,t)}},o=class extends i{constructor(s){super(s||"User is not allowed to login to this app.","allowlist_rejected")}},A=class extends e{constructor(s,t){super(403,s,t)}},N=class extends e{constructor(s){super(404,s)}},p=class extends e{constructor(s,t){super(408,s,t)}},l=class extends e{constructor(s){super(415,s)}},u=class extends e{constructor(s,t){super(422,s,t)}},O=class extends e{constructor(s){super(429,s||"Too many requests. Please wait to try again.","too_many_requests")}},D=class extends e{constructor(s){super(500,s||"Service unavailable.")}},T=class extends e{constructor(t){super(400,"Account transfer required","account_transfer_required",t);this.data=t}};import{z as c}from"zod";var h=c.object({error:c.string(),cause:c.string().optional(),code:c.nativeEnum(a).optional()});export{h as APIError,T as AccountTransferRequiredError,o as AllowlistRejectedError,A as ForbiddenError,e as HttpError,D as InternalServerError,I as InvalidInputError,u as LegacyInvalidInputError,N as NotFoundError,a as PrivyErrorCode,p as RequestTimeoutError,O as TooManyRequestsError,i as UnauthorizedError,l as UnsupportedMediaType};
|