@privy-io/api-base 1.4.0 → 1.4.1-beta-20241122173757
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 +7 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +18 -19
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,13 @@ declare enum PrivyErrorCode {
|
|
|
81
81
|
USER_DOES_NOT_EXIST = "user_does_not_exist",
|
|
82
82
|
ACCOUNT_TRANSFER_REQUIRED = "account_transfer_required",
|
|
83
83
|
/** The user has not consented to delegated actions for this wallet */
|
|
84
|
-
USER_HAS_NOT_DELEGATED_WALLET = "user_has_not_delegated_wallet"
|
|
84
|
+
USER_HAS_NOT_DELEGATED_WALLET = "user_has_not_delegated_wallet",
|
|
85
|
+
/** This feature is not enabled on the app */
|
|
86
|
+
FEATURE_NOT_ENABLED = "feature_not_enabled",
|
|
87
|
+
/** Wallet has insufficent funds for transaction */
|
|
88
|
+
INSUFFICIENT_FUNDS = "insufficient_funds",
|
|
89
|
+
/** Transaction broadcast failure */
|
|
90
|
+
TRANSACTION_BROADCAST_FAILURE = "transaction_broadcast_failure"
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
type ApiErrorType = {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var N=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(t,s)=>{for(var e in s)N(t,e,{get:s[e],enumerable:!0})},x=(t,s,e,A)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of d(s))!g.call(t,a)&&a!==e&&N(t,a,{get:()=>s[a],enumerable:!(A=E(s,a))||A.enumerable});return t};var U=t=>x(N({},"__esModule",{value:!0}),t);var h={};m(h,{APIError:()=>f,AccountTransferRequiredError:()=>L,AllowlistRejectedError:()=>o,ForbiddenError:()=>u,HttpError:()=>n,InternalServerError:()=>R,InvalidInputError:()=>l,LegacyInvalidInputError:()=>T,NotFoundError:()=>p,PrivyErrorCode:()=>c,RequestTimeoutError:()=>D,TooManyRequestsError:()=>S,UnauthorizedError:()=>I,UnsupportedMediaType:()=>O});module.exports=U(h);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_PLUS_EMAIL="disallowed_plus_email",_.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",_.USER_HAS_NOT_DELEGATED_WALLET="user_has_not_delegated_wallet",_.FEATURE_NOT_ENABLED="feature_not_enabled",_.INSUFFICIENT_FUNDS="insufficient_funds",_.TRANSACTION_BROADCAST_FAILURE="transaction_broadcast_failure",_))(c||{});var n=class extends Error{status;code;responseData;constructor(s,e,A,a){super(e),this.code=A,this.status=s,this.responseData=a}toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},l=class extends n{constructor(s,e){super(400,s,e||"invalid_data")}},I=class extends n{constructor(s,e){super(401,s,e)}},o=class extends I{constructor(s){super(s||"User is not allowed to login to this app.","allowlist_rejected")}},u=class extends n{constructor(s,e){super(403,s,e)}},p=class extends n{constructor(s){super(404,s)}},D=class extends n{constructor(s,e){super(408,s,e)}},O=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 f=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_PLUS_EMAIL="disallowed_plus_email",_.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",_.USER_HAS_NOT_DELEGATED_WALLET="user_has_not_delegated_wallet",_))(a||{});var e=class extends Error{status;code;responseData;constructor(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_PLUS_EMAIL="disallowed_plus_email",_.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",_.USER_HAS_NOT_DELEGATED_WALLET="user_has_not_delegated_wallet",_.FEATURE_NOT_ENABLED="feature_not_enabled",_.INSUFFICIENT_FUNDS="insufficient_funds",_.TRANSACTION_BROADCAST_FAILURE="transaction_broadcast_failure",_))(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}]`:""}`}},A=class extends e{constructor(s,t){super(400,s,t||"invalid_data")}},i=class extends e{constructor(s,t){super(401,s,t)}},I=class extends i{constructor(s){super(s||"User is not allowed to login to this app.","allowlist_rejected")}},N=class extends e{constructor(s,t){super(403,s,t)}},l=class extends e{constructor(s){super(404,s)}},o=class extends e{constructor(s,t){super(408,s,t)}},u=class extends e{constructor(s){super(415,s)}},p=class extends e{constructor(s,t){super(422,s,t)}},D=class extends e{constructor(s){super(429,s||"Too many requests. Please wait to try again.","too_many_requests")}},O=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 V=c.object({error:c.string(),cause:c.string().optional(),code:c.nativeEnum(a).optional()});export{V as APIError,T as AccountTransferRequiredError,I as AllowlistRejectedError,N as ForbiddenError,e as HttpError,O as InternalServerError,A as InvalidInputError,p as LegacyInvalidInputError,l as NotFoundError,a as PrivyErrorCode,o as RequestTimeoutError,D as TooManyRequestsError,i as UnauthorizedError,u as UnsupportedMediaType};
|
package/package.json
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/api-base",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"engines": {
|
|
5
|
-
"npm": ">=8.0.0",
|
|
6
|
-
"node": ">=18.0.0"
|
|
7
|
-
},
|
|
8
|
-
"main": "./dist/index.js",
|
|
9
|
-
"module": "./dist/index.mjs",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"typings": "./dist/index",
|
|
3
|
+
"version": "1.4.1-beta-20241122173757",
|
|
12
4
|
"exports": {
|
|
13
5
|
".": {
|
|
14
6
|
"require": "./dist/index.js",
|
|
@@ -31,30 +23,37 @@
|
|
|
31
23
|
"types": "./dist/index.d.ts"
|
|
32
24
|
}
|
|
33
25
|
},
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.mjs",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"typings": "./dist/index",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/**/*",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
34
35
|
"scripts": {
|
|
35
36
|
"build": "npx tsup --clean --minify",
|
|
36
|
-
"clean": "rm -rf dist .turbo",
|
|
37
37
|
"check-types": "npx tsc --noEmit",
|
|
38
|
+
"clean": "rm -rf dist .turbo",
|
|
38
39
|
"dev": "npx tsup --watch",
|
|
39
|
-
"lint": "eslint ./**/*.ts",
|
|
40
40
|
"format": "eslint ./**/*.ts --fix",
|
|
41
|
-
"
|
|
42
|
-
"test
|
|
41
|
+
"lint": "eslint ./**/*.ts",
|
|
42
|
+
"test": "jest --testMatch \"**/test/**/*.test.ts\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"zod": "^3.21.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@privy-io/tsconfig": "*",
|
|
49
48
|
"@privy-io/eslint-config-custom": "*",
|
|
49
|
+
"@privy-io/tsconfig": "*",
|
|
50
50
|
"tsup": "^6.2.3",
|
|
51
51
|
"typescript": "~5.5.3"
|
|
52
52
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
],
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0",
|
|
55
|
+
"npm": ">=8.0.0"
|
|
56
|
+
},
|
|
58
57
|
"publishConfig": {
|
|
59
58
|
"access": "public"
|
|
60
59
|
}
|