@nulvless/nulvless-js 0.1.2 → 0.1.5

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.cts CHANGED
@@ -1,3 +1,10 @@
1
+ type SdkErrorCode = 'no_session' | 'request_timeout' | 'network_error' | 'invalid_path' | 'unknown_error';
2
+ type GatewayErrorCode = 'rate_limit_exceeded' | 'service_not_enabled' | 'service_unavailable' | 'project_not_ready' | 'project_paused' | 'project_unavailable' | 'bad_gateway' | 'upstream_timeout' | 'idle_timeout' | 'deadline_exceeded' | 'internal_error';
3
+ type AuthErrorCode = 'unauthorized' | 'not_allowed' | 'unavailable' | 'invalid_credentials' | 'mfa_required' | 'refresh_token_not_found' | 'refresh_token_already_used' | 'refresh_token_not_issued_here' | 'registration_closed' | 'user_not_confirmed' | 'user_already_confirmed' | 'user_banned' | 'user_already_banned' | 'user_not_banned' | 'user_missing_email' | 'user_missing_phone' | 'email_already_exists' | 'phone_already_exists' | 'username_already_exists' | 'password_weak' | 'password_leaked' | 'captcha_required' | 'captcha_verification_failed' | 'protected_action_denied' | 'action_verification_failed' | 'forbidden_resource_access' | 'forbidden_access_waiting_accept' | 'forbidden_special_role_required' | 'cannot_leave_owner_access' | 'permission_already_granted' | 'bad_oauth_state' | 'bad_oauth_callback' | 'redirect_uri_mismatch' | 'provider_unavailable' | 'provider_unsupported_method' | 'oauth_email_missing' | 'oauth_email_not_verified' | 'oauth_account_link_required' | 'rate_limit_exceeded';
4
+ type CommsErrorCode = 'unauthorized_platform' | 'rate_limit_exceeded';
5
+ type EdgeFunctionErrorCode = 'function_not_found' | 'function_unavailable' | 'boot_failed' | 'execution_timeout' | 'cpu_time_limit_exceeded' | 'memory_limit_exceeded' | 'resource_unavailable' | 'internal_server_error';
6
+ type ErrorCode = SdkErrorCode | GatewayErrorCode | AuthErrorCode | CommsErrorCode | (string & {});
7
+
1
8
  /**
2
9
  * Storage adapter interface used by the SDK to persist session tokens.
3
10
  *
@@ -18,7 +25,7 @@ interface Phone {
18
25
  number: string;
19
26
  }
20
27
  interface NulvlessError {
21
- code: string;
28
+ code: ErrorCode;
22
29
  message: string | string[];
23
30
  status_code: number;
24
31
  }
@@ -2133,9 +2140,9 @@ declare class NulvlessServerClient {
2133
2140
  * }
2134
2141
  */
2135
2142
  declare class NulvlessException extends Error {
2136
- readonly code: string;
2143
+ readonly code: ErrorCode;
2137
2144
  readonly status_code: number;
2138
- constructor(message: string | string[], code: string, status_code: number);
2145
+ constructor(message: string | string[], code: ErrorCode, status_code: number);
2139
2146
  }
2140
2147
 
2141
2148
  /** Persists in `localStorage`. Data survives page reloads and browser restarts. */
@@ -2324,4 +2331,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
2324
2331
  */
2325
2332
  declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
2326
2333
 
2327
- export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type ConfirmationType, type CreateRoleParams, type CreateTemplateParams, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type PlatformInfo, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
2334
+ export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type PlatformInfo, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ type SdkErrorCode = 'no_session' | 'request_timeout' | 'network_error' | 'invalid_path' | 'unknown_error';
2
+ type GatewayErrorCode = 'rate_limit_exceeded' | 'service_not_enabled' | 'service_unavailable' | 'project_not_ready' | 'project_paused' | 'project_unavailable' | 'bad_gateway' | 'upstream_timeout' | 'idle_timeout' | 'deadline_exceeded' | 'internal_error';
3
+ type AuthErrorCode = 'unauthorized' | 'not_allowed' | 'unavailable' | 'invalid_credentials' | 'mfa_required' | 'refresh_token_not_found' | 'refresh_token_already_used' | 'refresh_token_not_issued_here' | 'registration_closed' | 'user_not_confirmed' | 'user_already_confirmed' | 'user_banned' | 'user_already_banned' | 'user_not_banned' | 'user_missing_email' | 'user_missing_phone' | 'email_already_exists' | 'phone_already_exists' | 'username_already_exists' | 'password_weak' | 'password_leaked' | 'captcha_required' | 'captcha_verification_failed' | 'protected_action_denied' | 'action_verification_failed' | 'forbidden_resource_access' | 'forbidden_access_waiting_accept' | 'forbidden_special_role_required' | 'cannot_leave_owner_access' | 'permission_already_granted' | 'bad_oauth_state' | 'bad_oauth_callback' | 'redirect_uri_mismatch' | 'provider_unavailable' | 'provider_unsupported_method' | 'oauth_email_missing' | 'oauth_email_not_verified' | 'oauth_account_link_required' | 'rate_limit_exceeded';
4
+ type CommsErrorCode = 'unauthorized_platform' | 'rate_limit_exceeded';
5
+ type EdgeFunctionErrorCode = 'function_not_found' | 'function_unavailable' | 'boot_failed' | 'execution_timeout' | 'cpu_time_limit_exceeded' | 'memory_limit_exceeded' | 'resource_unavailable' | 'internal_server_error';
6
+ type ErrorCode = SdkErrorCode | GatewayErrorCode | AuthErrorCode | CommsErrorCode | (string & {});
7
+
1
8
  /**
2
9
  * Storage adapter interface used by the SDK to persist session tokens.
3
10
  *
@@ -18,7 +25,7 @@ interface Phone {
18
25
  number: string;
19
26
  }
20
27
  interface NulvlessError {
21
- code: string;
28
+ code: ErrorCode;
22
29
  message: string | string[];
23
30
  status_code: number;
24
31
  }
@@ -2133,9 +2140,9 @@ declare class NulvlessServerClient {
2133
2140
  * }
2134
2141
  */
2135
2142
  declare class NulvlessException extends Error {
2136
- readonly code: string;
2143
+ readonly code: ErrorCode;
2137
2144
  readonly status_code: number;
2138
- constructor(message: string | string[], code: string, status_code: number);
2145
+ constructor(message: string | string[], code: ErrorCode, status_code: number);
2139
2146
  }
2140
2147
 
2141
2148
  /** Persists in `localStorage`. Data survives page reloads and browser restarts. */
@@ -2324,4 +2331,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
2324
2331
  */
2325
2332
  declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
2326
2333
 
2327
- export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type ConfirmationType, type CreateRoleParams, type CreateTemplateParams, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type PlatformInfo, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
2334
+ export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type PlatformInfo, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
package/dist/index.mjs CHANGED
@@ -2457,7 +2457,7 @@ var NulvlessServerClient = class {
2457
2457
  constructor(baseUrl, privateKey, options) {
2458
2458
  const base = baseUrl.replace(/\/+$/, "");
2459
2459
  this.auth = new AuthServerClient(new HttpClient({ baseUrl: `${base}/auth`, apiKey: privateKey, ...options }));
2460
- this.comms = new CommsClient(new HttpClient({ baseUrl: `${base}/notifications`, apiKey: privateKey, ...options }));
2460
+ this.comms = new CommsClient(new HttpClient({ baseUrl: `${base}/comms`, apiKey: privateKey, ...options }));
2461
2461
  }
2462
2462
  };
2463
2463