@plyaz/types 1.27.5 → 1.27.7

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,3 +1,4 @@
1
1
  export * from './enums';
2
2
  export * from './schemas';
3
3
  export * from './types';
4
+ export * from "./auth-events";
@@ -246,7 +246,73 @@ var AUTH_ERROR_CODES = {
246
246
  ACCOUNT_LOCKED: "AUTH_ACCOUNT_LOCKED",
247
247
  ACCOUNT_SUSPENDED: "AUTH_ACCOUNT_SUSPENDED"
248
248
  };
249
+ var ERROR_CODE_TO_HTTP_STATUS = {
250
+ [AUTH_ERROR_CODES.INVALID_CREDENTIALS]: 401,
251
+ [AUTH_ERROR_CODES.TOKEN_EXPIRED]: 401,
252
+ [AUTH_ERROR_CODES.TOKEN_INVALID]: 401,
253
+ [AUTH_ERROR_CODES.TOKEN_REVOKED]: 401,
254
+ [AUTH_ERROR_CODES.SESSION_EXPIRED]: 401,
255
+ [AUTH_ERROR_CODES.MFA_REQUIRED]: 401,
256
+ [AUTH_ERROR_CODES.MFA_INVALID]: 401,
257
+ [AUTH_ERROR_CODES.INSUFFICIENT_PERMISSIONS]: 403,
258
+ [AUTH_ERROR_CODES.ROLE_REQUIRED]: 403,
259
+ [AUTH_ERROR_CODES.WALLET_SIGNATURE_INVALID]: 401,
260
+ [AUTH_ERROR_CODES.NONCE_EXPIRED]: 401,
261
+ [AUTH_ERROR_CODES.NONCE_ALREADY_USED]: 401,
262
+ [AUTH_ERROR_CODES.ACCOUNT_LOCKED]: 423,
263
+ [AUTH_ERROR_CODES.ACCOUNT_SUSPENDED]: 423
264
+ };
265
+ var ERROR_CODE_DESCRIPTIONS = {
266
+ [AUTH_ERROR_CODES.INVALID_CREDENTIALS]: "errors.auth.invalid_credentials",
267
+ [AUTH_ERROR_CODES.TOKEN_EXPIRED]: "errors.auth.token_expired",
268
+ [AUTH_ERROR_CODES.TOKEN_INVALID]: "errors.auth.token_invalid",
269
+ [AUTH_ERROR_CODES.TOKEN_REVOKED]: "errors.auth.token_revoked",
270
+ [AUTH_ERROR_CODES.SESSION_EXPIRED]: "errors.auth.session_expired",
271
+ [AUTH_ERROR_CODES.MFA_REQUIRED]: "errors.auth.mfa_required",
272
+ [AUTH_ERROR_CODES.MFA_INVALID]: "errors.auth.mfa_invalid",
273
+ [AUTH_ERROR_CODES.INSUFFICIENT_PERMISSIONS]: "errors.auth.insufficient_permissions",
274
+ [AUTH_ERROR_CODES.ROLE_REQUIRED]: "errors.auth.role_required",
275
+ [AUTH_ERROR_CODES.WALLET_SIGNATURE_INVALID]: "errors.auth.wallet_signature_invalid",
276
+ [AUTH_ERROR_CODES.NONCE_EXPIRED]: "errors.auth.nonce_expired",
277
+ [AUTH_ERROR_CODES.NONCE_ALREADY_USED]: "errors.auth.nonce_already_used",
278
+ [AUTH_ERROR_CODES.ACCOUNT_LOCKED]: "errors.auth.account_locked",
279
+ [AUTH_ERROR_CODES.ACCOUNT_SUSPENDED]: "errors.auth.account_suspended"
280
+ };
281
+
282
+ // src/auth/auth-events.ts
283
+ var AUTH_EVENTS = {
284
+ /** User successfully authenticated */
285
+ USER_AUTHENTICATED: "auth.user.authenticated",
286
+ /** User signed up (new account created) */
287
+ USER_SIGNED_UP: "auth.user.signed_up",
288
+ /** User logged out */
289
+ USER_LOGGED_OUT: "auth.user.logged_out",
290
+ /** Authentication attempt failed */
291
+ AUTHENTICATION_FAILED: "auth.authentication.failed",
292
+ /** Session created */
293
+ SESSION_CREATED: "auth.session.created",
294
+ /** Session expired */
295
+ SESSION_EXPIRED: "auth.session.expired",
296
+ /** Session refreshed */
297
+ SESSION_REFRESHED: "auth.session.refreshed",
298
+ /** Session invalidated (logout) */
299
+ SESSION_INVALIDATED: "auth.session.invalidated",
300
+ /** Account linked to user */
301
+ ACCOUNT_LINKED: "auth.account.linked",
302
+ /** Account unlinked from user */
303
+ ACCOUNT_UNLINKED: "auth.account.unlinked",
304
+ /** Role assigned to user */
305
+ ROLE_ASSIGNED: "auth.rbac.role_assigned",
306
+ /** Role revoked from user */
307
+ ROLE_REVOKED: "auth.rbac.role_revoked",
308
+ /** Suspicious login attempt detected */
309
+ SUSPICIOUS_LOGIN_ATTEMPT: "auth.security.suspicious_login",
310
+ /** Password changed */
311
+ PASSWORD_CHANGED: "auth.password.changed",
312
+ /** Password reset requested */
313
+ PASSWORD_RESET_REQUESTED: "auth.password.reset_requested"
314
+ };
249
315
 
250
- export { AUTH_ERROR_CODES, AUTH_ERROR_DEFINITIONS, AUTH_PROVIDER, AUTH_PROVIDER_TYPE, ContactUsFormSchema, SignupFormSchema, TOKEN_TYPE, USER_ROLE, USER_ROLE_STATUS, USER_STATUS };
316
+ export { AUTH_ERROR_CODES, AUTH_ERROR_DEFINITIONS, AUTH_EVENTS, AUTH_PROVIDER, AUTH_PROVIDER_TYPE, ContactUsFormSchema, ERROR_CODE_DESCRIPTIONS, ERROR_CODE_TO_HTTP_STATUS, SignupFormSchema, TOKEN_TYPE, USER_ROLE, USER_ROLE_STATUS, USER_STATUS };
251
317
  //# sourceMappingURL=index.js.map
252
318
  //# sourceMappingURL=index.js.map