@mudrichenkoevgeny/shared-foundation 0.0.47 → 0.0.49

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.
Files changed (5) hide show
  1. package/README.md +4 -1
  2. package/index.d.ts +1083 -52
  3. package/index.js +1311 -17
  4. package/index.mjs +1311 -17
  5. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ export type Instant = number;
4
+
3
5
  export type PermissionCode = string & { readonly __brand: 'PermissionCode' };
4
6
  export function toPermissionCodeOrNull(value: string | null | undefined): PermissionCode | null;
5
7
  export function toPermissionCodeOrThrow(value: string): PermissionCode;
@@ -30,6 +32,36 @@
30
32
  export function toClientDeviceIdOrThrow(value: string): ClientDeviceId;
31
33
  export const clientDeviceIdSchema: z.ZodType<ClientDeviceId>;
32
34
 
35
+ export type DecryptedString = string & { readonly __brand: 'DecryptedString' };
36
+ export function toDecryptedStringOrNull(value: string | null | undefined): DecryptedString | null;
37
+ export function toDecryptedStringOrThrow(value: string): DecryptedString;
38
+ export const decryptedStringSchema: z.ZodType<DecryptedString>;
39
+
40
+ export type EncryptedString = string & { readonly __brand: 'EncryptedString' };
41
+ export function toEncryptedStringOrNull(value: string | null | undefined): EncryptedString | null;
42
+ export function toEncryptedStringOrThrow(value: string): EncryptedString;
43
+ export const encryptedStringSchema: z.ZodType<EncryptedString>;
44
+
45
+ export type PasswordHash = string & { readonly __brand: 'PasswordHash' };
46
+ export function toPasswordHashOrNull(value: string | null | undefined): PasswordHash | null;
47
+ export function toPasswordHashOrThrow(value: string): PasswordHash;
48
+ export const passwordHashSchema: z.ZodType<PasswordHash>;
49
+
50
+ export type AccessToken = string & { readonly __brand: 'AccessToken' };
51
+ export function toAccessTokenOrNull(value: string | null | undefined): AccessToken | null;
52
+ export function toAccessTokenOrThrow(value: string): AccessToken;
53
+ export const accessTokenSchema: z.ZodType<AccessToken>;
54
+
55
+ export type RefreshToken = string & { readonly __brand: 'RefreshToken' };
56
+ export function toRefreshTokenOrNull(value: string | null | undefined): RefreshToken | null;
57
+ export function toRefreshTokenOrThrow(value: string): RefreshToken;
58
+ export const refreshTokenSchema: z.ZodType<RefreshToken>;
59
+
60
+ export type RefreshTokenHash = string & { readonly __brand: 'RefreshTokenHash' };
61
+ export function toRefreshTokenHashOrNull(value: string | null | undefined): RefreshTokenHash | null;
62
+ export function toRefreshTokenHashOrThrow(value: string): RefreshTokenHash;
63
+ export const refreshTokenHashSchema: z.ZodType<RefreshTokenHash>;
64
+
33
65
  export declare const ManagementRoutes: {
34
66
  readonly BASE_MANAGEMENT_ROUTE: "/management";
35
67
  };
@@ -80,6 +112,14 @@ readonly LOGIN_BY_TOTP: "/management/auth/login/totp";
80
112
  readonly LOGIN_BY_TOTP_RECOVERY_CODE: "/management/auth/login/totp-recovery-code";
81
113
  };
82
114
 
115
+ export declare const OpenRefreshTokenRoutes: {
116
+ readonly REFRESH_TOKEN: "/auth/refresh";
117
+ };
118
+
119
+ export declare const SelfManagementRefreshTokenRoutes: {
120
+ readonly REFRESH_TOKEN: "/management/auth/refresh";
121
+ };
122
+
83
123
  export declare const OpenRegisterRoutes: {
84
124
  readonly REGISTER_BY_EMAIL_ROUTE: "/auth/register/email";
85
125
  readonly REGISTER_BY_EMAIL: "/auth/register/email";
@@ -228,6 +268,336 @@ readonly UPDATE_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings";
228
268
  readonly RESET_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings/reset";
229
269
  };
230
270
 
271
+ export declare const OpenAuthSettingsRoutes: {
272
+ readonly GET_OPEN_AUTH_SETTINGS: "/auth/settings";
273
+ };
274
+
275
+ export declare const OpenUserConfigurationRoutes: {
276
+ readonly GET_CONFIGURATION: "user-configuration";
277
+ };
278
+
279
+ export declare const ManagementUserConfigurationRoutes: {
280
+ readonly GET_CONFIGURATION: "/management/user-configuration";
281
+ };
282
+
283
+ export declare const CommonApiFields: {
284
+ readonly ITEMS: "items";
285
+ readonly TOTAL_COUNT: "total_count";
286
+ readonly TOTAL_PAGES: "total_pages";
287
+ readonly ID: "id";
288
+ readonly CREATED_AT: "created_at";
289
+ readonly UPDATED_AT: "updated_at";
290
+ readonly CODE: "code";
291
+ readonly MESSAGE: "message";
292
+ readonly ARGS: "args";
293
+ readonly TYPE: "type";
294
+ readonly PAYLOAD: "payload";
295
+ readonly METADATA: "metadata";
296
+ readonly TIMESTAMP: "timestamp";
297
+ readonly CLIENT_TYPE: "client_type";
298
+ readonly CLIENT_DEVICE_INFO: "client_device_info";
299
+ readonly CLIENT_INFO: "client_info";
300
+ readonly USER_AGENT: "user_agent";
301
+ readonly IP_ADDRESS: "ip_address";
302
+ readonly MASKED_IP_ADDRESS: "masked_ip_address";
303
+ readonly LANGUAGE: "language";
304
+ readonly DEVICE_ID: "device_id";
305
+ readonly DEVICE_NAME: "device_name";
306
+ readonly APP_VERSION: "app_version";
307
+ readonly OPERATION_SYSTEM_VERSION: "operation_system_version";
308
+ readonly API_VERSION: "api_version";
309
+ readonly IS_SENSITIVE_VALUES_MASKED: "is_sensitive_values_masked";
310
+ };
311
+
312
+ export declare const SecurityApiFields: {
313
+ readonly RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_OPEN_USER: "recent_authentication_validity_seconds_for_open_user";
314
+ readonly RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_MANAGEMENT_USER: "recent_authentication_validity_seconds_for_management_user";
315
+ readonly MFA_TOKEN: "mfa_token";
316
+ readonly TOTP_CODE: "totp_code";
317
+ readonly TOTP_SECRET_KEY: "totp_secret_key";
318
+ readonly TOTP_OTP_AUTH_URL: "totp_otp_auth_url";
319
+ readonly TOTP_RECOVERY_CODES: "totp_recovery_codes";
320
+ readonly OPEN_PASSWORD_POLICY: "open_password_policy";
321
+ readonly MANAGEMENT_PASSWORD_POLICY: "management_password_policy";
322
+ readonly MIN_LENGTH: "min_length";
323
+ readonly REQUIRE_LETTER: "require_letter";
324
+ readonly REQUIRE_UPPER_CASE: "require_upper_case";
325
+ readonly REQUIRE_LOWER_CASE: "require_lower_case";
326
+ readonly REQUIRE_DIGIT: "require_digit";
327
+ readonly REQUIRE_SPECIAL_CHAR: "require_special_char";
328
+ readonly COMMON_PASSWORDS: "common_passwords";
329
+ readonly OTP_CONFIRMATION: "otp_confirmation";
330
+ readonly RETRY_AFTER_SECONDS: "retry_after_seconds";
331
+ readonly NUMBER_OF_SYMBOLS: "number_of_symbols";
332
+ readonly EXPIRATION_SECONDS: "expiration_seconds";
333
+ readonly MAX_REQUESTS_PER_PERIOD: "max_requests_per_period";
334
+ readonly RATE_LIMIT_PERIOD_SECONDS: "rate_limit_period_seconds";
335
+ readonly REFRESH_TOKEN_ROTATION_GRACE_PERIOD_SECONDS: "refresh_token_rotation_grace_period_seconds";
336
+ readonly ACCOUNT_LOCKOUT_POLICY: "account_lockout_policy";
337
+ readonly ACCOUNT_LOCKOUT_CHECK_INTERVAL_SECONDS: "account_lockout_check_interval_seconds";
338
+ readonly MAX_FAILED_PASSWORD_ATTEMPTS: "max_failed_password_attempts";
339
+ readonly MAX_FAILED_OTP_ATTEMPTS: "max_failed_otp_attempts";
340
+ readonly MAX_FAILED_TOTP_ATTEMPTS: "max_failed_totp_attempts";
341
+ readonly FAILED_ATTEMPTS_WINDOW_SECONDS: "failed_attempts_window_seconds";
342
+ readonly LOCKOUT_DURATION_SECONDS: "lockout_duration_seconds";
343
+ readonly INDEFINITE_LOCKOUT_THRESHOLD: "indefinite_lockout_threshold";
344
+ readonly IS_SELF_SERVICE_UNLOCK_ENABLED: "is_self_service_unlock_enabled";
345
+ readonly OPEN_IP_RESTRICTION_POLICY: "open_ip_restriction_policy";
346
+ readonly MANAGEMENT_IP_RESTRICTION_POLICY: "management_ip_restriction_policy";
347
+ readonly IS_BLACKLIST_ENABLED: "is_blacklist_enabled";
348
+ readonly BLACKLIST: "blacklist";
349
+ readonly IS_WHITELIST_ENABLED: "is_whitelist_enabled";
350
+ readonly WHITELIST: "whitelist";
351
+ };
352
+
353
+ export declare const GlobalSettingsApiFields: {
354
+ readonly PRIVACY_POLICY_URL: "privacy_policy_url";
355
+ readonly TERMS_OF_SERVICE_URL: "terms_of_service_url";
356
+ readonly CONTACT_SUPPORT_EMAIL: "contact_support_email";
357
+ readonly IS_TRACING_ENABLED: "is_tracing_enabled";
358
+ readonly IS_METRICS_ENABLED: "is_metrics_enabled";
359
+ readonly IS_VERBOSE_LOGGING_ENABLED: "is_verbose_logging_enabled";
360
+ readonly MIN_SUPPORTED_APP_VERSIONS: "min_supported_app_versions";
361
+ };
362
+
363
+ export declare const UserApiFields: {
364
+ readonly EXTERNAL_PROVIDER_TOKEN: "external_provider_token";
365
+ readonly TOKEN_TYPE: "token_type";
366
+ readonly SESSION_ID: "session_id";
367
+ readonly ACCESS_TOKEN: "access_token";
368
+ readonly REFRESH_TOKEN: "refresh_token";
369
+ readonly SESSION_TOKEN: "session_token";
370
+ readonly EXPIRES_AT: "expires_at";
371
+ readonly EMAIL: "email";
372
+ readonly PHONE_NUMBER: "phone_number";
373
+ readonly PASSWORD: "password";
374
+ readonly OLD_PASSWORD: "old_password";
375
+ readonly NEW_PASSWORD: "new_password";
376
+ readonly CONFIRMATION_CODE: "confirmation_code";
377
+ readonly AUTH_PROVIDER: "auth_provider";
378
+ readonly USER: "user";
379
+ readonly USER_ID: "user_id";
380
+ readonly ROLE: "role";
381
+ readonly USER_ROLE: "user_role";
382
+ readonly ACCOUNT_STATUS: "account_status";
383
+ readonly ACCOUNT_STATUS_ON_RESTORE: "account_status_on_restore";
384
+ readonly AUTHORITY_LEVEL: "authority_level";
385
+ readonly PERMISSION_CODES: "permission_codes";
386
+ readonly IS_TOTP_ENABLED: "is_totp_enabled";
387
+ readonly LAST_LOGIN_AT: "last_login_at";
388
+ readonly LAST_ACTIVE_AT: "last_active_at";
389
+ readonly SCHEDULED_PERMANENT_DELETION_AT: "scheduled_permanent_deletion_at";
390
+ readonly ACCOUNT_LOCKOUT_TYPE: "account_lockout_type";
391
+ readonly TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until";
392
+ readonly IDENTIFIER: "identifier";
393
+ readonly EXTERNAL_PROVIDER_EMAIL: "external_provider_email";
394
+ readonly USER_AUTH_PROVIDER: "user_auth_provider";
395
+ readonly IDENTIFIER_ID: "identifier_id";
396
+ readonly DISPLAY_NAME: "display_name";
397
+ readonly IDENTIFIER_DISPLAY_NAME: "identifier_display_name";
398
+ readonly IDENTIFIER_AUTH_PROVIDER: "identifier_auth_provider";
399
+ readonly LAST_ACCESSED_AT: "last_accessed_at";
400
+ readonly LAST_REAUTHENTICATED_AT: "last_reauthenticated_at";
401
+ readonly DELETED_SESSION_IDS: "deleted_session_ids";
402
+ readonly DELETED_IDENTIFIER_IDS: "deleted_identifier_ids";
403
+ readonly MAX_TOTAL_IDENTIFIERS: "max_total_identifiers";
404
+ readonly MAX_EMAIL_IDENTIFIERS: "max_email_identifiers";
405
+ readonly MAX_PHONE_IDENTIFIERS: "max_phone_identifiers";
406
+ readonly MAX_IDENTIFIERS_PER_EXTERNAL_PROVIDER: "max_identifiers_per_external_provider";
407
+ readonly MAX_ACTIVE_SESSIONS_FOR_OPEN_USER: "max_active_sessions_for_open_user";
408
+ readonly MAX_ACTIVE_SESSIONS_FOR_MANAGEMENT_USER: "max_active_sessions_for_management_user";
409
+ readonly AVAILABLE_AUTH_PROVIDERS: "available_auth_providers";
410
+ readonly ACCESS_TOKEN_VALIDITY_SECONDS: "access_token_validity_seconds";
411
+ readonly REFRESH_TOKEN_VALIDITY_SECONDS: "refresh_token_validity_seconds";
412
+ readonly ACCOUNT_DELETION_GRACE_PERIOD_SECONDS: "account_deletion_grace_period_seconds";
413
+ readonly ACCOUNT_DELETION_CHECK_INTERVAL_SECONDS: "account_deletion_check_interval_seconds";
414
+ readonly IS_REGISTRATION_ENABLED: "is_registration_enabled";
415
+ readonly EMAIL_RESTRICTION_POLICY: "email_restriction_policy";
416
+ readonly OPEN_EMAIL_RESTRICTION_POLICY: "open_email_restriction_policy";
417
+ readonly MANAGEMENT_EMAIL_RESTRICTION_POLICY: "management_email_restriction_policy";
418
+ readonly PRIMARY: "primary";
419
+ readonly SECONDARY: "secondary";
420
+ readonly OPEN_GLOBAL_SETTINGS: "open_global_settings";
421
+ readonly MANAGEMENT_GLOBAL_SETTINGS: "management_global_settings";
422
+ readonly OPEN_SECURITY_SETTINGS: "open_security_settings";
423
+ readonly MANAGEMENT_SECURITY_SETTINGS: "management_security_settings";
424
+ readonly OPEN_AUTH_SETTINGS: "open_auth_settings";
425
+ readonly MANAGEMENT_AUTH_SETTINGS: "management_auth_settings";
426
+ };
427
+
428
+ export declare const AuditEventFields: {
429
+ readonly ACTOR_ID: "actor_id";
430
+ readonly ACTOR_TYPE: "actor_type";
431
+ readonly ACTOR_USER_ROLE: "actor_user_role";
432
+ readonly ACTION: "action";
433
+ readonly RESOURCE: "resource";
434
+ readonly RESOURCE_ID: "resource_id";
435
+ readonly STATUS: "status";
436
+ readonly METADATA_KEY: "key";
437
+ readonly METADATA_VALUE: "value";
438
+ readonly METADATA_VALUE_SENSITIVITY: "value_sensitivity";
439
+ };
440
+
441
+ export declare const CommonHttpHeaders: {
442
+ readonly TRACE_HEADER_NAME: "X-Trace-Id";
443
+ readonly CLIENT_TYPE_HEADER_NAME: "X-Client-Type";
444
+ readonly DEVICE_ID_HEADER_NAME: "X-Device-Id";
445
+ readonly DEVICE_NAME_HEADER_NAME: "X-Device-Name";
446
+ readonly APP_VERSION_HEADER_NAME: "X-App-Version";
447
+ readonly OPERATION_SYSTEM_VERSION_HEADER_NAME: "X-OS-Version";
448
+ readonly API_VERSION_HEADER_NAME: "X-Api-Version";
449
+ };
450
+
451
+ export declare const CommonWebSocketCloseReasons: {
452
+ readonly NORMAL: "Normal";
453
+ readonly SERVER_RESTART: "Server restart";
454
+ readonly INTERNAL_SERVER_ERROR: "Internal server error";
455
+ };
456
+
457
+ export declare const CommonWebSocketEventTypes: {
458
+ readonly PING: "PING";
459
+ readonly PONG: "PONG";
460
+ readonly INITIALIZE: "INITIALIZE";
461
+ readonly INITIALIZED_SUCCESS: "INITIALIZED_SUCCESS";
462
+ };
463
+
464
+ export declare const SecurityWebSocketEventTypes: {
465
+ readonly OPEN_SECURITY_SETTINGS_UPDATED: "OPEN_SECURITY_SETTINGS_UPDATED";
466
+ readonly MANAGEMENT_SECURITY_SETTINGS_UPDATED: "MANAGEMENT_SECURITY_SETTINGS_UPDATED";
467
+ };
468
+
469
+ export declare const SettingsWebSocketEventTypes: {
470
+ readonly OPEN_GLOBAL_SETTINGS_UPDATED: "OPEN_GLOBAL_SETTINGS_UPDATED";
471
+ readonly MANAGEMENT_GLOBAL_SETTINGS_UPDATED: "MANAGEMENT_GLOBAL_SETTINGS_UPDATED";
472
+ };
473
+
474
+ export declare const UserWebSocketCloseReasons: {
475
+ readonly AUTH_FAILED: "Auth failed";
476
+ readonly SESSION_EXPIRED: "Session expired";
477
+ readonly SESSION_DELETED: "Session deleted";
478
+ readonly USER_BANNED: "User banned";
479
+ };
480
+
481
+ export declare const UserWebSocketEventTypes: {
482
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
483
+ readonly OPEN_AUTH_SETTINGS_UPDATED: "OPEN_AUTH_SETTINGS_UPDATED";
484
+ readonly MANAGEMENT_AUTH_SETTINGS_UPDATED: "MANAGEMENT_AUTH_SETTINGS_UPDATED";
485
+ readonly USER_UPDATED: "USER_UPDATED";
486
+ readonly SESSION_DELETED: "SESSION_DELETED";
487
+ };
488
+
489
+ export declare const UserApiPaths: {
490
+ readonly USER_ID: "user_id";
491
+ readonly SESSION_ID: "session_id";
492
+ readonly USER_IDENTIFIER_ID: "user_identifier_id";
493
+ };
494
+
495
+ export declare const UserApiQueryParams: {
496
+ readonly ACCESS_TOKEN: "token";
497
+ };
498
+
499
+ export declare const UserAuthSpec: {
500
+ readonly TOKEN_TYPE_BEARER: "Bearer";
501
+ };
502
+
503
+ export declare const AuditApiPaths: {
504
+ readonly EVENT_ID: "event_id";
505
+ };
506
+
507
+ export declare const UserRoleDefaultAuthorityLevel: {
508
+
509
+ };
510
+
511
+ export declare const SecurityAuditMetadataDeniedReasonValues: {
512
+ readonly RATE_LIMIT: "rate_limit";
513
+ readonly PASSWORD_TOO_WEAK: "password_too_weak";
514
+ readonly MFA_TOKEN_EXPIRED: "mfa_token_expired";
515
+ readonly TOTP_ALREADY_ENABLED: "totp_already_enabled";
516
+ readonly TOTP_NOT_ENABLED: "totp_not_enabled";
517
+ readonly RECOVERY_CODE_ALREADY_USED: "recovery_code_already_used";
518
+ readonly MFA_REQUIRED: "mfa_required";
519
+ };
520
+
521
+ export declare const UserAuditMetadataDeniedReasonValues: {
522
+ readonly USER_READ_ONLY: "user_read_only";
523
+ readonly USER_BANNED: "user_banned";
524
+ readonly USER_LOCKED: "user_locked";
525
+ readonly USER_SECURITY_HOLD: "user_security_hold";
526
+ readonly USER_PENDING_DELETION: "user_pending_deletion";
527
+ readonly USER_NOT_FOUND: "user_not_found";
528
+ readonly USER_ROLE_NOT_ALLOWED: "user_role_not_allowed";
529
+ readonly USER_MISSING_PERMISSIONS: "user_missing_permissions";
530
+ readonly USER_INSUFFICIENT_AUTHORITY_LEVEL: "user_insufficient_authority_level";
531
+ readonly USER_ILLEGAL_ACCOUNT_STATUS: "user_illegal_account_status";
532
+ readonly USER_FORBIDDEN: "user_forbidden";
533
+ readonly USER_IDENTIFIER_LIMIT_REACHED: "user_identifier_limit_reached";
534
+ readonly TOTAL_USER_IDENTIFIERS_LIMIT_REACHED: "total_user_identifier_limit_reached";
535
+ readonly PASSWORD_SETUP_REQUIRED: "password_setup_required";
536
+ readonly USER_IDENTIFIER_PASSWORD_NOT_SUPPORTED: "user_identifier_password_not_supported";
537
+ readonly USER_IDENTIFIER_PASSWORD_NOT_SET: "user_identifier_password_not_set";
538
+ };
539
+
540
+ export declare const ListingParamNames: {
541
+ readonly PAGE_NUMBER: "page_number";
542
+ readonly PAGE_SIZE: "page_size";
543
+ readonly SORT_BY: "sort_by";
544
+ readonly SORT_ORDER: "sort_order";
545
+ readonly Pagination: {
546
+ readonly PAGE_NUMBER: "page_number";
547
+ readonly PAGE_SIZE: "page_size";
548
+ };
549
+ readonly Sort: {
550
+ readonly SORT_BY: "sort_by";
551
+ readonly SORT_ORDER: "sort_order";
552
+ };
553
+ };
554
+
555
+ export declare const AuditFilterValues: {
556
+ readonly AuditEventFilterValues: {
557
+ readonly ACTOR_ID: "actor_id";
558
+ readonly ACTOR_TYPE: "actor_type";
559
+ readonly ACTOR_USER_ROLE: "actor_user_role";
560
+ readonly ACTION: "action";
561
+ readonly RESOURCE: "resource";
562
+ readonly RESOURCE_ID: "resource_id";
563
+ readonly STATUS: "status";
564
+ readonly MESSAGE: "message";
565
+ };
566
+ };
567
+
568
+ export declare const UserFilterValues: {
569
+ readonly UserFilterValues: {
570
+ readonly ROLE: "role";
571
+ readonly ACCOUNT_STATUS: "account_status";
572
+ readonly ACCOUNT_STATUS_ON_RESTORE: "account_status_on_restore";
573
+ readonly ACCOUNT_LOCKOUT_TYPE: "account_lockout_type";
574
+ readonly AUTHORITY_LEVEL_FROM: "authority_level_from";
575
+ readonly AUTHORITY_LEVEL_TO: "authority_level_to";
576
+ readonly IS_TOTP_ENABLED: "is_totp_enabled";
577
+ readonly PERMISSION_CODES: "permission_codes";
578
+ };
579
+ readonly UserIdentifierFilterValues: {
580
+ readonly USER_ID: "user_id";
581
+ readonly USER_AUTH_PROVIDER: "user_auth_provider";
582
+ readonly IDENTIFIER: "identifier";
583
+ };
584
+ readonly UserSessionFilterValues: {
585
+ readonly USER_ID: "user_id";
586
+ readonly USER_ROLE: "user_role";
587
+ readonly IDENTIFIER_ID: "identifier_id";
588
+ readonly USER_AUTH_PROVIDER: "user_auth_provider";
589
+ readonly CLIENT_TYPE: "client_type";
590
+ readonly USER_AGENT: "user_agent";
591
+ readonly IP_ADDRESS: "ip_address";
592
+ readonly LANGUAGE: "language";
593
+ readonly DEVICE_ID: "device_id";
594
+ readonly DEVICE_NAME: "device_name";
595
+ readonly APP_VERSION: "app_version";
596
+ readonly OPERATION_SYSTEM_VERSION: "operation_system_version";
597
+ readonly IDENTIFIER: "identifier";
598
+ };
599
+ };
600
+
231
601
  export declare const CommonErrorCodes: {
232
602
  readonly UNKNOWN: "UNKNOWN";
233
603
  readonly INTERNAL: "INTERNAL";
@@ -320,87 +690,728 @@ readonly ACCOUNT_LOCKOUT_TYPE: "accountLockoutType";
320
690
  readonly TEMPORARY_LOCKOUT_UNTIL: "temporaryLockoutUntil";
321
691
  };
322
692
 
323
- export declare const AuditPermissionCode: {
693
+ export const AuditPermissionCode: {
324
694
 
325
695
  };
326
696
 
327
- export declare const SecurityPermissionCode: {
697
+ export const SecurityPermissionCode: {
328
698
 
329
699
  };
330
700
 
331
- export declare const SettingsPermissionCode: {
701
+ export const SettingsPermissionCode: {
332
702
 
333
703
  };
334
704
 
335
- export declare const AuthSettingsPermissionCode: {
705
+ export const AuthSettingsPermissionCode: {
336
706
 
337
707
  };
338
708
 
339
- export declare const IdentifierPermissionCode: {
709
+ export const IdentifierPermissionCode: {
340
710
 
341
711
  };
342
712
 
343
- export declare const SessionPermissionCode: {
713
+ export const SessionPermissionCode: {
344
714
 
345
715
  };
346
716
 
347
- export declare const UserPermissionCode: {
717
+ export const UserPermissionCode: {
348
718
 
349
719
  };
350
720
 
351
- export const clientTypeSchema: z.ZodType<string>;
352
- export type ClientType = z.infer<typeof clientTypeSchema>;
353
-
354
- export const sortOrderSchema: z.ZodType<string>;
355
- export type SortOrder = z.infer<typeof sortOrderSchema>;
356
-
357
- export const accountLockoutTypeSchema: z.ZodType<string>;
358
- export type AccountLockoutType = z.infer<typeof accountLockoutTypeSchema>;
359
-
360
- export const passwordPolicyFailReasonSchema: z.ZodType<string>;
361
- export type PasswordPolicyFailReason = z.infer<typeof passwordPolicyFailReasonSchema>;
362
-
363
- export const auditActorTypeSchema: z.ZodType<string>;
364
- export type AuditActorType = z.infer<typeof auditActorTypeSchema>;
365
-
366
- export const auditValueSensitivitySchema: z.ZodType<string>;
367
- export type AuditValueSensitivity = z.infer<typeof auditValueSensitivitySchema>;
368
-
369
- export const auditStatusSchema: z.ZodType<string>;
370
- export type AuditStatus = z.infer<typeof auditStatusSchema>;
371
-
372
- export const commonAuditResourceTypeSchema: z.ZodType<string>;
373
- export type CommonAuditResourceType = z.infer<typeof commonAuditResourceTypeSchema>;
374
-
375
- export const securityAuditResourceTypeSchema: z.ZodType<string>;
376
- export type SecurityAuditResourceType = z.infer<typeof securityAuditResourceTypeSchema>;
721
+ export type ClientType = 'web' | 'android' | 'ios' | 'desktop';
722
+ export const ClientType: {
723
+ readonly WEB: 'web';
724
+ readonly ANDROID: 'android';
725
+ readonly IOS: 'ios';
726
+ readonly DESKTOP: 'desktop';
727
+ };
728
+ export const clientTypeSchema: z.ZodType<ClientType>;
729
+
730
+ export type SortOrder = 'asc' | 'desc';
731
+ export const SortOrder: {
732
+ readonly ASC: 'asc';
733
+ readonly DESC: 'desc';
734
+ };
735
+ export const sortOrderSchema: z.ZodType<SortOrder>;
736
+
737
+ export type AccountLockoutType = 'none' | 'indefinite' | 'temporary';
738
+ export const AccountLockoutType: {
739
+ readonly NONE: 'none';
740
+ readonly INDEFINITE: 'indefinite';
741
+ readonly TEMPORARY: 'temporary';
742
+ readonly PERMANENT: 'indefinite';
743
+ };
744
+ export const accountLockoutTypeSchema: z.ZodType<AccountLockoutType>;
745
+
746
+ export type PasswordPolicyFailReason = 'too_short' | 'no_letter' | 'no_uppercase' | 'no_lowercase' | 'no_digit' | 'no_special_char' | 'too_common';
747
+ export const PasswordPolicyFailReason: {
748
+ readonly TOO_SHORT: 'too_short';
749
+ readonly NO_LETTER: 'no_letter';
750
+ readonly NO_UPPERCASE: 'no_uppercase';
751
+ readonly NO_LOWERCASE: 'no_lowercase';
752
+ readonly NO_DIGIT: 'no_digit';
753
+ readonly NO_SPECIAL_CHAR: 'no_special_char';
754
+ readonly TOO_COMMON: 'too_common';
755
+ };
756
+ export const passwordPolicyFailReasonSchema: z.ZodType<PasswordPolicyFailReason>;
757
+
758
+ export type AuditActorType = 'user' | 'system' | 'service';
759
+ export const AuditActorType: {
760
+ readonly USER: 'user';
761
+ readonly SYSTEM: 'system';
762
+ readonly SERVICE: 'service';
763
+ };
764
+ export const auditActorTypeSchema: z.ZodType<AuditActorType>;
765
+
766
+ export type AuditValueSensitivity = 'non_sensitive' | 'email' | 'phone_number' | 'ip_address' | 'partial_value_mask' | 'full_value_mask';
767
+ export const AuditValueSensitivity: {
768
+ readonly NON_SENSITIVE: 'non_sensitive';
769
+ readonly EMAIL: 'email';
770
+ readonly PHONE_NUMBER: 'phone_number';
771
+ readonly IP_ADDRESS: 'ip_address';
772
+ readonly PARTIAL_VALUE_MASK: 'partial_value_mask';
773
+ readonly FULL_VALUE_MASK: 'full_value_mask';
774
+ };
775
+ export const auditValueSensitivitySchema: z.ZodType<AuditValueSensitivity>;
776
+
777
+ export type AuditStatus = 'success' | 'failed' | 'denied';
778
+ export const AuditStatus: {
779
+ readonly SUCCESS: 'success';
780
+ readonly FAILED: 'failed';
781
+ readonly DENIED: 'denied';
782
+ };
783
+ export const auditStatusSchema: z.ZodType<AuditStatus>;
784
+
785
+ export type CommonAuditResourceType = 'audit_event' | 'audit_events';
786
+ export const CommonAuditResourceType: {
787
+ readonly AUDIT_EVENT: 'audit_event';
788
+ readonly AUDIT_EVENTS: 'audit_events';
789
+ };
790
+ export const commonAuditResourceTypeSchema: z.ZodType<CommonAuditResourceType>;
791
+
792
+ export type SecurityAuditResourceType = 'security_settings';
793
+ export const SecurityAuditResourceType: {
794
+ readonly SECURITY_SETTINGS: 'security_settings';
795
+ };
796
+ export const securityAuditResourceTypeSchema: z.ZodType<SecurityAuditResourceType>;
377
797
 
378
- export const settingsAuditResourceTypeSchema: z.ZodType<string>;
379
- export type SettingsAuditResourceType = z.infer<typeof settingsAuditResourceTypeSchema>;
798
+ export type SettingsAuditResourceType = 'global_settings';
799
+ export const SettingsAuditResourceType: {
800
+ readonly GLOBAL_SETTINGS: 'global_settings';
801
+ };
802
+ export const settingsAuditResourceTypeSchema: z.ZodType<SettingsAuditResourceType>;
803
+
804
+ export type UserAuditResourceType = 'auth_settings' | 'user' | 'email_address' | 'phone_number' | 'identifier' | 'session';
805
+ export const UserAuditResourceType: {
806
+ readonly AUTH_SETTINGS: 'auth_settings';
807
+ readonly USER: 'user';
808
+ readonly EMAIL_ADDRESS: 'email_address';
809
+ readonly PHONE_NUMBER: 'phone_number';
810
+ readonly IDENTIFIER: 'identifier';
811
+ readonly SESSION: 'session';
812
+ };
813
+ export const userAuditResourceTypeSchema: z.ZodType<UserAuditResourceType>;
814
+
815
+ export type SecurityAuditActionType = 'management_update_security_settings' | 'management_reset_security_settings';
816
+ export const SecurityAuditActionType: {
817
+ readonly MANAGEMENT_UPDATE_SECURITY_SETTINGS: 'management_update_security_settings';
818
+ readonly MANAGEMENT_RESET_SECURITY_SETTINGS: 'management_reset_security_settings';
819
+ };
820
+ export const securityAuditActionTypeSchema: z.ZodType<SecurityAuditActionType>;
821
+
822
+ export type SettingsAuditActionType = 'management_update_global_settings' | 'management_reset_global_settings';
823
+ export const SettingsAuditActionType: {
824
+ readonly MANAGEMENT_UPDATE_GLOBAL_SETTINGS: 'management_update_global_settings';
825
+ readonly MANAGEMENT_RESET_GLOBAL_SETTINGS: 'management_reset_global_settings';
826
+ };
827
+ export const settingsAuditActionTypeSchema: z.ZodType<SettingsAuditActionType>;
828
+
829
+ export type UserAuditActionType = 'management_update_auth_settings' | 'management_reset_auth_settings' | 'management_delete_identifier' | 'management_delete_identifier_password' | 'management_delete_session' | 'management_delete_all_user_sessions' | 'management_update_user' | 'management_delete_user' | 'management_create_user' | 'management_disable_user_totp' | 'login_by_email' | 'login_by_phone' | 'login_by_external_auth_provider' | 'login_by_totp' | 'login_by_totp_recovery_code' | 'new_device_detected' | 'register_by_email' | 'reset_password' | 'self_unlock_account' | 'logout' | 'self_delete_session' | 'self_delete_other_sessions' | 'reauthenticate_session' | 'self_delete_identifier' | 'add_identifier_email' | 'add_identifier_phone' | 'add_identifier_external_auth_provider' | 'change_password' | 'self_schedule_user_deletion' | 'self_restore_user' | 'self_setup_totp_initiated' | 'self_enable_totp' | 'self_disable_totp' | 'self_get_recovery_codes' | 'self_regenerate_recovery_codes' | 'refresh_token_reuse_detected';
830
+ export const UserAuditActionType: {
831
+ readonly MANAGEMENT_UPDATE_AUTH_SETTINGS: 'management_update_auth_settings';
832
+ readonly MANAGEMENT_RESET_AUTH_SETTINGS: 'management_reset_auth_settings';
833
+ readonly MANAGEMENT_DELETE_IDENTIFIER: 'management_delete_identifier';
834
+ readonly MANAGEMENT_DELETE_IDENTIFIER_PASSWORD: 'management_delete_identifier_password';
835
+ readonly MANAGEMENT_DELETE_SESSION: 'management_delete_session';
836
+ readonly MANAGEMENT_DELETE_ALL_USER_SESSIONS: 'management_delete_all_user_sessions';
837
+ readonly MANAGEMENT_UPDATE_USER: 'management_update_user';
838
+ readonly MANAGEMENT_DELETE_USER: 'management_delete_user';
839
+ readonly MANAGEMENT_CREATE_USER: 'management_create_user';
840
+ readonly MANAGEMENT_DISABLE_USER_TOTP: 'management_disable_user_totp';
841
+ readonly LOGIN_BY_EMAIL: 'login_by_email';
842
+ readonly LOGIN_BY_PHONE: 'login_by_phone';
843
+ readonly LOGIN_BY_EXTERNAL_AUTH_PROVIDER: 'login_by_external_auth_provider';
844
+ readonly LOGIN_BY_TOTP: 'login_by_totp';
845
+ readonly LOGIN_BY_TOTP_RECOVERY_CODE: 'login_by_totp_recovery_code';
846
+ readonly NEW_DEVICE_DETECTED: 'new_device_detected';
847
+ readonly REGISTER_BY_EMAIL: 'register_by_email';
848
+ readonly RESET_PASSWORD: 'reset_password';
849
+ readonly SELF_UNLOCK_ACCOUNT: 'self_unlock_account';
850
+ readonly LOGOUT: 'logout';
851
+ readonly SELF_DELETE_SESSION: 'self_delete_session';
852
+ readonly SELF_DELETE_OTHER_SESSIONS: 'self_delete_other_sessions';
853
+ readonly REAUTHENTICATE_SESSION: 'reauthenticate_session';
854
+ readonly SELF_DELETE_IDENTIFIER: 'self_delete_identifier';
855
+ readonly ADD_IDENTIFIER_EMAIL: 'add_identifier_email';
856
+ readonly ADD_IDENTIFIER_PHONE: 'add_identifier_phone';
857
+ readonly ADD_IDENTIFIER_EXTERNAL_AUTH_PROVIDER: 'add_identifier_external_auth_provider';
858
+ readonly CHANGE_PASSWORD: 'change_password';
859
+ readonly SELF_SCHEDULE_USER_DELETION: 'self_schedule_user_deletion';
860
+ readonly SELF_RESTORE_USER: 'self_restore_user';
861
+ readonly SELF_SETUP_TOTP_INITIATED: 'self_setup_totp_initiated';
862
+ readonly SELF_ENABLE_TOTP: 'self_enable_totp';
863
+ readonly SELF_DISABLE_TOTP: 'self_disable_totp';
864
+ readonly SELF_GET_RECOVERY_CODES: 'self_get_recovery_codes';
865
+ readonly SELF_REGENERATE_RECOVERY_CODES: 'self_regenerate_recovery_codes';
866
+ readonly REFRESH_TOKEN_REUSE_DETECTED: 'refresh_token_reuse_detected';
867
+ };
868
+ export const userAuditActionTypeSchema: z.ZodType<UserAuditActionType>;
869
+
870
+ export type CommonAuditMetadataKey = 'device_id' | 'device_name' | 'client_type' | 'language' | 'app_version' | 'os_version' | 'user_agent' | 'key_ip_address' | 'host' | 'origin' | 'api_version' | 'trace_id' | 'denied_reason' | 'error_id' | 'error_code';
871
+ export const CommonAuditMetadataKey: {
872
+ readonly DEVICE_ID: 'device_id';
873
+ readonly DEVICE_NAME: 'device_name';
874
+ readonly CLIENT_TYPE: 'client_type';
875
+ readonly LANGUAGE: 'language';
876
+ readonly APP_VERSION: 'app_version';
877
+ readonly OS_VERSION: 'os_version';
878
+ readonly USER_AGENT: 'user_agent';
879
+ readonly IP_ADDRESS: 'key_ip_address';
880
+ readonly HOST: 'host';
881
+ readonly ORIGIN: 'origin';
882
+ readonly API_VERSION: 'api_version';
883
+ readonly TRACE_ID: 'trace_id';
884
+ readonly DENIED_REASON: 'denied_reason';
885
+ readonly ERROR_ID: 'error_id';
886
+ readonly ERROR_CODE: 'error_code';
887
+ };
888
+ export const commonAuditMetadataKeySchema: z.ZodType<CommonAuditMetadataKey>;
889
+
890
+ export type UserAuditMetadataKey = 'user_id' | 'session_id' | 'identifier_id' | 'email_address' | 'phone_number' | 'user_auth_provider' | 'external_id' | 'account_lockout_type' | 'temporary_lockout_until';
891
+ export const UserAuditMetadataKey: {
892
+ readonly USER_ID: 'user_id';
893
+ readonly SESSION_ID: 'session_id';
894
+ readonly IDENTIFIER_ID: 'identifier_id';
895
+ readonly EMAIL_ADDRESS: 'email_address';
896
+ readonly PHONE_NUMBER: 'phone_number';
897
+ readonly USER_AUTH_PROVIDER: 'user_auth_provider';
898
+ readonly EXTERNAL_ID: 'external_id';
899
+ readonly ACCOUNT_LOCKOUT_TYPE: 'account_lockout_type';
900
+ readonly TEMPORARY_LOCKOUT_UNTIL: 'temporary_lockout_until';
901
+ };
902
+ export const userAuditMetadataKeySchema: z.ZodType<UserAuditMetadataKey>;
903
+
904
+ export type UserAccountStatus = 'active' | 'read_only' | 'banned' | 'security_hold' | 'pending_deletion';
905
+ export const UserAccountStatus: {
906
+ readonly ACTIVE: 'active';
907
+ readonly READ_ONLY: 'read_only';
908
+ readonly BANNED: 'banned';
909
+ readonly SECURITY_HOLD: 'security_hold';
910
+ readonly PENDING_DELETION: 'pending_deletion';
911
+ };
912
+ export const userAccountStatusSchema: z.ZodType<UserAccountStatus>;
913
+
914
+ export type UserRole = 'user' | 'staff' | 'admin';
915
+ export const UserRole: {
916
+ readonly USER: 'user';
917
+ readonly STAFF: 'staff';
918
+ readonly ADMIN: 'admin';
919
+ readonly CLIENT_USER: 'user';
920
+ readonly MANAGEMENT_USER: 'admin';
921
+ };
922
+ export const userRoleSchema: z.ZodType<UserRole>;
923
+
924
+ export type UserAuthProvider = 'email' | 'phone' | 'google' | 'apple';
925
+ export const UserAuthProvider: {
926
+ readonly EMAIL: 'email';
927
+ readonly PHONE: 'phone';
928
+ readonly GOOGLE: 'google';
929
+ readonly APPLE: 'apple';
930
+ };
931
+ export const userAuthProviderSchema: z.ZodType<UserAuthProvider>;
932
+
933
+ export type ExternalAuthProvider = 'google' | 'apple';
934
+ export const ExternalAuthProvider: {
935
+ readonly GOOGLE: 'google';
936
+ readonly APPLE: 'apple';
937
+ };
938
+ export const externalAuthProviderSchema: z.ZodType<ExternalAuthProvider>;
939
+
940
+ export type UserSortBy = 'last_login_at' | 'last_active_at' | 'scheduled_permanent_deletion_at' | 'account_lockout_type' | 'temporary_lockout_until' | 'created_at' | 'updated_at';
941
+ export const UserSortBy: {
942
+ readonly LAST_LOGIN_AT: 'last_login_at';
943
+ readonly LAST_ACTIVE_AT: 'last_active_at';
944
+ readonly SCHEDULED_PERMANENT_DELETION_AT: 'scheduled_permanent_deletion_at';
945
+ readonly ACCOUNT_LOCKOUT_TYPE: 'account_lockout_type';
946
+ readonly TEMPORARY_LOCKOUT_UNTIL: 'temporary_lockout_until';
947
+ readonly CREATED_AT: 'created_at';
948
+ readonly UPDATED_AT: 'updated_at';
949
+ };
950
+ export const userSortBySchema: z.ZodType<UserSortBy>;
951
+
952
+ export type UserIdentifierSortBy = 'created_at' | 'updated_at';
953
+ export const UserIdentifierSortBy: {
954
+ readonly CREATED_AT: 'created_at';
955
+ readonly UPDATED_AT: 'updated_at';
956
+ };
957
+ export const userIdentifierSortBySchema: z.ZodType<UserIdentifierSortBy>;
958
+
959
+ export type UserSessionSortBy = 'expires_at' | 'last_accessed_at' | 'last_reauthenticated_at' | 'created_at' | 'updated_at';
960
+ export const UserSessionSortBy: {
961
+ readonly EXPIRES_AT: 'expires_at';
962
+ readonly LAST_ACCESSED_AT: 'last_accessed_at';
963
+ readonly LAST_REAUTHENTICATED_AT: 'last_reauthenticated_at';
964
+ readonly CREATED_AT: 'created_at';
965
+ readonly UPDATED_AT: 'updated_at';
966
+ };
967
+ export const userSessionSortBySchema: z.ZodType<UserSessionSortBy>;
968
+
969
+ export type AuditEventSortBy = 'created_at';
970
+ export const AuditEventSortBy: {
971
+ readonly CREATED_AT: 'created_at';
972
+ };
973
+ export const auditEventSortBySchema: z.ZodType<AuditEventSortBy>;
974
+
975
+ export type TimestampSortBy = 'created_at' | 'updated_at';
976
+ export const TimestampSortBy: {
977
+ readonly CREATED_AT: 'created_at';
978
+ readonly UPDATED_AT: 'updated_at';
979
+ };
980
+ export const timestampSortBySchema: z.ZodType<TimestampSortBy>;
981
+
982
+ export type UnlockMethod = 'EMAIL' | 'PHONE';
983
+ export const UnlockMethod: {
984
+ readonly EMAIL: 'EMAIL';
985
+ readonly PHONE: 'PHONE';
986
+ };
987
+ export const unlockMethodSchema: z.ZodType<UnlockMethod>;
988
+
989
+ export type ConfirmationType = 'REGISTRATION_EMAIL' | 'ADD_EMAIL' | 'PASSWORD_RESET_EMAIL' | 'LOGIN_PHONE' | 'ADD_PHONE' | 'UNLOCK_EMAIL' | 'UNLOCK_PHONE';
990
+ export const ConfirmationType: {
991
+ readonly REGISTRATION_EMAIL: 'REGISTRATION_EMAIL';
992
+ readonly ADD_EMAIL: 'ADD_EMAIL';
993
+ readonly PASSWORD_RESET_EMAIL: 'PASSWORD_RESET_EMAIL';
994
+ readonly LOGIN_PHONE: 'LOGIN_PHONE';
995
+ readonly ADD_PHONE: 'ADD_PHONE';
996
+ readonly UNLOCK_EMAIL: 'UNLOCK_EMAIL';
997
+ readonly UNLOCK_PHONE: 'UNLOCK_PHONE';
998
+ };
999
+ export const confirmationTypeSchema: z.ZodType<ConfirmationType>;
1000
+
1001
+ export type AppType = 'CLIENT' | 'MANAGEMENT';
1002
+ export const AppType: {
1003
+ readonly CLIENT: 'CLIENT';
1004
+ readonly MANAGEMENT: 'MANAGEMENT';
1005
+ };
1006
+ export const appTypeSchema: z.ZodType<AppType>;
1007
+
1008
+ export interface ConfirmationKey {
1009
+ readonly type: ConfirmationType;
1010
+ readonly identifier: string;
1011
+ }
1012
+ export const confirmationKeySchema: z.ZodType<ConfirmationKey>;
1013
+
1014
+ export interface ClientInfo {
1015
+ readonly deviceInfo: ClientDeviceInfo;
1016
+ readonly userAgent: string | null;
1017
+ readonly ipAddress: string | null;
1018
+ readonly host: string | null;
1019
+ readonly origin: string | null;
1020
+ readonly apiVersion: string | null;
1021
+ }
1022
+
1023
+ export declare const toClientInfo: (payload: ClientInfoPayload) => ClientInfo;
1024
+ export declare const toClientInfoPayload: (domain: ClientInfo) => ClientInfoPayload;
1025
+
1026
+ export interface ClientDeviceInfo {
1027
+ readonly deviceId: ClientDeviceId | null;
1028
+ readonly deviceName: string | null;
1029
+ readonly clientType: ClientType | null;
1030
+ readonly language: string | null;
1031
+ readonly appVersion: string | null;
1032
+ readonly operationSystemVersion: string | null;
1033
+ }
1034
+
1035
+ export declare const toClientDeviceInfo: (payload: ClientDeviceInfoPayload) => ClientDeviceInfo;
1036
+ export declare const toClientDeviceInfoPayload: (domain: ClientDeviceInfo) => ClientDeviceInfoPayload;
1037
+
1038
+ export interface AccountLockoutPolicy {
1039
+ readonly maxFailedPasswordAttempts: number;
1040
+ readonly maxFailedOtpAttempts: number;
1041
+ readonly maxFailedTotpAttempts: number;
1042
+ readonly failedAttemptsWindowSeconds: number;
1043
+ readonly lockoutDurationSeconds: number;
1044
+ readonly indefiniteLockoutThreshold: number;
1045
+ readonly isSelfServiceUnlockEnabled: boolean;
1046
+ }
1047
+
1048
+ export declare const toAccountLockoutPolicy: (payload: AccountLockoutPolicyPayload) => AccountLockoutPolicy;
1049
+ export declare const toAccountLockoutPolicyPayload: (domain: AccountLockoutPolicy) => AccountLockoutPolicyPayload;
1050
+
1051
+ export interface IpRestrictionPolicy {
1052
+ readonly isBlacklistEnabled: boolean;
1053
+ readonly blacklist: string[];
1054
+ readonly isWhitelistEnabled: boolean;
1055
+ readonly whitelist: string[];
1056
+ }
1057
+
1058
+ export declare const toIpRestrictionPolicy: (payload: IpRestrictionPolicyPayload) => IpRestrictionPolicy;
1059
+ export declare const toIpRestrictionPolicyPayload: (domain: IpRestrictionPolicy) => IpRestrictionPolicyPayload;
1060
+
1061
+ export interface OtpConfirmation {
1062
+ readonly retryAfterSeconds: number;
1063
+ readonly numberOfSymbols: number;
1064
+ readonly expirationSeconds: number;
1065
+ }
1066
+
1067
+ export declare const toOtpConfirmation: (payload: OtpConfirmationPayload) => OtpConfirmation;
1068
+ export declare const toOtpConfirmationPayload: (domain: OtpConfirmation) => OtpConfirmationPayload;
1069
+
1070
+ export interface ManagementPasswordPolicy {
1071
+ readonly minLength: number;
1072
+ readonly requireLetter: boolean;
1073
+ readonly requireUpperCase: boolean;
1074
+ readonly requireLowerCase: boolean;
1075
+ readonly requireDigit: boolean;
1076
+ readonly requireSpecialChar: boolean;
1077
+ readonly commonPasswords: string[];
1078
+ }
1079
+
1080
+ export declare const toManagementPasswordPolicy: (payload: ManagementPasswordPolicyPayload) => ManagementPasswordPolicy;
1081
+ export declare const toManagementPasswordPolicyPayload: (domain: ManagementPasswordPolicy) => ManagementPasswordPolicyPayload;
1082
+
1083
+ export interface OpenPasswordPolicy {
1084
+ readonly minLength: number;
1085
+ readonly requireLetter: boolean;
1086
+ readonly requireUpperCase: boolean;
1087
+ readonly requireLowerCase: boolean;
1088
+ readonly requireDigit: boolean;
1089
+ readonly requireSpecialChar: boolean;
1090
+ }
1091
+
1092
+ export declare const toOpenPasswordPolicy: (payload: OpenPasswordPolicyPayload) => OpenPasswordPolicy;
1093
+ export declare const toOpenPasswordPolicyPayload: (domain: OpenPasswordPolicy) => OpenPasswordPolicyPayload;
1094
+
1095
+ export interface ManagementSecuritySettings {
1096
+ readonly recentAuthenticationValiditySecondsForOpenUser: number;
1097
+ readonly recentAuthenticationValiditySecondsForManagementUser: number;
1098
+ readonly passwordPolicy: ManagementPasswordPolicy;
1099
+ readonly otpConfirmation: OtpConfirmation;
1100
+ readonly accountLockoutPolicy: AccountLockoutPolicy;
1101
+ readonly accountLockoutCheckIntervalSeconds: number;
1102
+ readonly openIpRestrictionPolicy: IpRestrictionPolicy;
1103
+ readonly managementIpRestrictionPolicy: IpRestrictionPolicy;
1104
+ readonly mfaTokenExpirationSeconds: number;
1105
+ readonly maxRequestsPerPeriod: number;
1106
+ readonly rateLimitPeriodSeconds: number;
1107
+ readonly refreshTokenRotationGracePeriodSeconds: number;
1108
+ }
1109
+
1110
+ export declare const toManagementSecuritySettings: (payload: ManagementSecuritySettingsPayload) => ManagementSecuritySettings;
1111
+ export declare const toManagementSecuritySettingsPayload: (domain: ManagementSecuritySettings) => ManagementSecuritySettingsPayload;
1112
+
1113
+ export interface OpenSecuritySettings {
1114
+ readonly passwordPolicy: OpenPasswordPolicy;
1115
+ readonly otpConfirmation: OtpConfirmation;
1116
+ }
1117
+
1118
+ export declare const toOpenSecuritySettings: (payload: OpenSecuritySettingsPayload) => OpenSecuritySettings;
1119
+ export declare const toOpenSecuritySettingsPayload: (domain: OpenSecuritySettings) => OpenSecuritySettingsPayload;
1120
+
1121
+ export interface TotpRecoveryCodes {
1122
+ readonly codes: string[];
1123
+ }
380
1124
 
381
- export const userAuditResourceTypeSchema: z.ZodType<string>;
382
- export type UserAuditResourceType = z.infer<typeof userAuditResourceTypeSchema>;
1125
+ export declare const toTotpRecoveryCodes: (payload: TotpRecoveryCodesPayload) => TotpRecoveryCodes;
1126
+ export declare const toTotpRecoveryCodesPayload: (domain: TotpRecoveryCodes) => TotpRecoveryCodesPayload;
1127
+
1128
+ export interface TotpSetup {
1129
+ readonly secretKey: string;
1130
+ readonly otpAuthUrl: string;
1131
+ readonly mfaToken: string;
1132
+ }
1133
+
1134
+ export declare const toTotpSetup: (payload: TotpSetupPayload) => TotpSetup;
1135
+ export declare const toTotpSetupPayload: (domain: TotpSetup) => TotpSetupPayload;
1136
+
1137
+ export interface VerifyTotp {
1138
+ readonly mfaToken: string;
1139
+ readonly code: string;
1140
+ }
1141
+
1142
+ export declare const toVerifyTotp: (payload: VerifyTotpPayload) => VerifyTotp;
1143
+ export declare const toVerifyTotpPayload: (domain: VerifyTotp) => VerifyTotpPayload;
1144
+
1145
+ export interface ManagementGlobalSettings {
1146
+ readonly privacyPolicyUrl: string | null;
1147
+ readonly termsOfServiceUrl: string | null;
1148
+ readonly contactSupportEmail: string | null;
1149
+ readonly minSupportedAppVersions: Record<string, string>;
1150
+ readonly isTracingEnabled: boolean;
1151
+ readonly isMetricsEnabled: boolean;
1152
+ readonly isVerboseLoggingEnabled: boolean;
1153
+ }
1154
+
1155
+ export declare const toManagementGlobalSettings: (payload: ManagementGlobalSettingsPayload) => ManagementGlobalSettings;
1156
+ export declare const toManagementGlobalSettingsPayload: (domain: ManagementGlobalSettings) => ManagementGlobalSettingsPayload;
1157
+
1158
+ export interface OpenGlobalSettings {
1159
+ readonly privacyPolicyUrl: string | null;
1160
+ readonly termsOfServiceUrl: string | null;
1161
+ readonly contactSupportEmail: string | null;
1162
+ readonly minSupportedAppVersions: Record<string, string>;
1163
+ }
1164
+
1165
+ export declare const toOpenGlobalSettings: (payload: OpenGlobalSettingsPayload) => OpenGlobalSettings;
1166
+ export declare const toOpenGlobalSettingsPayload: (domain: OpenGlobalSettings) => OpenGlobalSettingsPayload;
1167
+
1168
+ export interface AuditEvent {
1169
+ readonly id: AuditEventId;
1170
+ readonly actorId: UserId | null;
1171
+ readonly actorType: AuditActorType;
1172
+ readonly actorUserRole: UserRole | null;
1173
+ readonly action: AuditActionType;
1174
+ readonly resource: AuditResourceType;
1175
+ readonly resourceId: string | null;
1176
+ readonly resourceValueSensitivity: AuditValueSensitivity;
1177
+ readonly status: AuditStatus;
1178
+ readonly metadata: AuditEventMetadata[];
1179
+ readonly message: string | null;
1180
+ readonly createdAt: Instant;
1181
+ }
1182
+
1183
+ export declare const toAuditEvent: (payload: AuditEventPayload) => AuditEvent;
1184
+ export declare const toAuditEventPayload: (domain: AuditEvent) => AuditEventPayload;
1185
+
1186
+ export interface AuditEventMetadata {
1187
+ readonly key: AuditMetadataKey;
1188
+ readonly value: string;
1189
+ }
1190
+
1191
+ export declare const toAuditEventMetadata: (payload: AuditEventMetadataPayload) => AuditEventMetadata;
1192
+ export declare const toAuditEventMetadataPayload: (domain: AuditEventMetadata) => AuditEventMetadataPayload;
1193
+
1194
+ export interface AuthData {
1195
+ readonly userDetails: UserDetails;
1196
+ readonly sessionToken: SessionToken;
1197
+ }
1198
+
1199
+ export declare const toAuthData: (payload: AuthDataPayload) => AuthData;
1200
+ export declare const toAuthDataPayload: (domain: AuthData) => AuthDataPayload;
1201
+
1202
+ export interface AvailableAuthProviders {
1203
+ readonly primary: UserAuthProvider[];
1204
+ readonly secondary: UserAuthProvider[];
1205
+ }
1206
+
1207
+ export declare const toAvailableAuthProviders: (payload: AvailableAuthProvidersPayload) => AvailableAuthProviders;
1208
+ export declare const toAvailableAuthProvidersPayload: (domain: AvailableAuthProviders) => AvailableAuthProvidersPayload;
1209
+
1210
+ export interface ManagementAuthSettings {
1211
+ readonly availableAuthProviders: AvailableAuthProviders;
1212
+ readonly maxTotalIdentifiers: number;
1213
+ readonly maxEmailIdentifiers: number;
1214
+ readonly maxPhoneIdentifiers: number;
1215
+ readonly maxIdentifiersPerExternalProvider: number;
1216
+ readonly maxActiveSessionsForOpenUser: number;
1217
+ readonly maxActiveSessionsForManagementUser: number;
1218
+ readonly accessTokenExpirationSeconds: number;
1219
+ readonly refreshTokenExpirationSeconds: number;
1220
+ readonly accountDeletionGracePeriodSeconds: number;
1221
+ readonly accountDeletionCheckIntervalSeconds: number;
1222
+ readonly isRegistrationEnabled: boolean;
1223
+ readonly openEmailRestrictionPolicy: EmailRestrictionPolicy;
1224
+ readonly managementEmailRestrictionPolicy: EmailRestrictionPolicy;
1225
+ }
1226
+
1227
+ export declare const toManagementAuthSettings: (payload: ManagementAuthSettingsPayload) => ManagementAuthSettings;
1228
+ export declare const toManagementAuthSettingsPayload: (domain: ManagementAuthSettings) => ManagementAuthSettingsPayload;
1229
+
1230
+ export interface OpenAuthSettings {
1231
+ readonly availableAuthProviders: AvailableAuthProviders;
1232
+ readonly maxTotalIdentifiers: number;
1233
+ readonly maxEmailIdentifiers: number;
1234
+ readonly maxPhoneIdentifiers: number;
1235
+ readonly maxIdentifiersPerExternalProvider: number;
1236
+ readonly isRegistrationEnabled: boolean;
1237
+ }
1238
+
1239
+ export declare const toOpenAuthSettings: (payload: OpenAuthSettingsPayload) => OpenAuthSettings;
1240
+ export declare const toOpenAuthSettingsPayload: (domain: OpenAuthSettings) => OpenAuthSettingsPayload;
1241
+
1242
+ export interface ManagementUserConfiguration {
1243
+ readonly managementGlobalSettings: ManagementGlobalSettings;
1244
+ readonly managementSecuritySettings: ManagementSecuritySettings;
1245
+ readonly managementAuthSettings: ManagementAuthSettings;
1246
+ }
1247
+
1248
+ export declare const toManagementUserConfiguration: (payload: ManagementUserConfigurationPayload) => ManagementUserConfiguration;
1249
+ export declare const toManagementUserConfigurationPayload: (domain: ManagementUserConfiguration) => ManagementUserConfigurationPayload;
1250
+
1251
+ export interface OpenUserConfiguration {
1252
+ readonly openGlobalSettings: OpenGlobalSettings;
1253
+ readonly openSecuritySettings: OpenSecuritySettings;
1254
+ readonly openAuthSettings: OpenAuthSettings;
1255
+ }
1256
+
1257
+ export declare const toOpenUserConfiguration: (payload: OpenUserConfigurationPayload) => OpenUserConfiguration;
1258
+ export declare const toOpenUserConfigurationPayload: (domain: OpenUserConfiguration) => OpenUserConfigurationPayload;
1259
+
1260
+ export interface EmailRestrictionPolicy {
1261
+ readonly isBlacklistEnabled: boolean;
1262
+ readonly blacklist: string[];
1263
+ readonly isWhitelistEnabled: boolean;
1264
+ readonly whitelist: string[];
1265
+ }
1266
+
1267
+ export declare const toEmailRestrictionPolicy: (payload: EmailRestrictionPolicyPayload) => EmailRestrictionPolicy;
1268
+ export declare const toEmailRestrictionPolicyPayload: (domain: EmailRestrictionPolicy) => EmailRestrictionPolicyPayload;
1269
+
1270
+ export interface UserIdentifier {
1271
+ readonly id: UserIdentifierId;
1272
+ readonly userId: UserId;
1273
+ readonly userAuthProvider: UserAuthProvider;
1274
+ readonly identifier: string;
1275
+ readonly displayName: string;
1276
+ readonly externalProviderEmail: string | null;
1277
+ readonly isSensitiveValuesMasked: boolean;
1278
+ readonly createdAt: Instant;
1279
+ readonly updatedAt: Instant | null;
1280
+ }
1281
+
1282
+ export declare const toUserIdentifier: (payload: UserIdentifierPayload) => UserIdentifier;
1283
+ export declare const toUserIdentifierPayload: (domain: UserIdentifier) => UserIdentifierPayload;
1284
+
1285
+ export interface DeletedSessions {
1286
+ readonly deletedSessionIds: UserSessionId[];
1287
+ }
383
1288
 
384
- export const securityAuditActionTypeSchema: z.ZodType<string>;
385
- export type SecurityAuditActionType = z.infer<typeof securityAuditActionTypeSchema>;
1289
+ export declare const toDeletedSessions: (payload: DeletedSessionsPayload) => DeletedSessions;
1290
+ export declare const toDeletedSessionsPayload: (domain: DeletedSessions) => DeletedSessionsPayload;
1291
+
1292
+ export interface UserSession {
1293
+ readonly id: UserSessionId;
1294
+ readonly userId: UserId;
1295
+ readonly userRole: UserRole;
1296
+ readonly identifier: string;
1297
+ readonly identifierId: UserIdentifierId;
1298
+ readonly identifierDisplayName: string;
1299
+ readonly identifierAuthProvider: UserAuthProvider;
1300
+ readonly deviceInfo: ClientDeviceInfo;
1301
+ readonly userAgent: string | null;
1302
+ readonly ipAddress: string | null;
1303
+ readonly expiresAt: Instant;
1304
+ readonly lastAccessedAt: Instant;
1305
+ readonly lastReauthenticatedAt: Instant;
1306
+ readonly isSensitiveValuesMasked: boolean;
1307
+ readonly createdAt: Instant;
1308
+ readonly updatedAt: Instant | null;
1309
+ }
1310
+
1311
+ export declare const toUserSession: (payload: UserSessionPayload) => UserSession;
1312
+ export declare const toUserSessionPayload: (domain: UserSession) => UserSessionPayload;
1313
+
1314
+ export interface SessionToken {
1315
+ readonly accessToken: AccessToken;
1316
+ readonly refreshToken: RefreshToken;
1317
+ readonly expiresAt: Instant;
1318
+ readonly tokenType: string;
1319
+ readonly sessionId: UserSessionId;
1320
+ readonly identifierId: UserIdentifierId;
1321
+ }
1322
+
1323
+ export declare const toSessionToken: (payload: SessionTokenPayload) => SessionToken;
1324
+ export declare const toSessionTokenPayload: (domain: SessionToken) => SessionTokenPayload;
1325
+
1326
+ export interface UserDetails {
1327
+ readonly id: UserId;
1328
+ readonly role: UserRole;
1329
+ readonly accountStatus: UserAccountStatus;
1330
+ readonly accountStatusOnRestore: UserAccountStatus | null;
1331
+ readonly authorityLevel: number;
1332
+ readonly permissionCodes: PermissionCode[];
1333
+ readonly isTotpEnabled: boolean;
1334
+ readonly lastLoginAt: Instant | null;
1335
+ readonly lastActiveAt: Instant | null;
1336
+ readonly createdAt: Instant;
1337
+ readonly updatedAt: Instant | null;
1338
+ readonly scheduledPermanentDeletionAt: Instant | null;
1339
+ readonly lockoutType: AccountLockoutType;
1340
+ readonly temporaryLockoutUntil: Instant | null;
1341
+ }
1342
+
1343
+ export declare const toUserDetails: (payload: UserDetailsPayload) => UserDetails;
1344
+ export declare const toUserDetailsPayload: (domain: UserDetails) => UserDetailsPayload;
1345
+
1346
+ export interface UserPublic {
1347
+ readonly id: UserId;
1348
+ readonly role: UserRole;
1349
+ readonly accountStatus: UserAccountStatus;
1350
+ }
1351
+
1352
+ export declare const toUserPublic: (payload: UserPublicPayload) => UserPublic;
1353
+ export declare const toUserPublicPayload: (domain: UserPublic) => UserPublicPayload;
1354
+
1355
+ export type AuditActionType = SecurityAuditActionType | SettingsAuditActionType | UserAuditActionType | string;
1356
+ export type AuditMetadataKey = CommonAuditMetadataKey | UserAuditMetadataKey | string;
1357
+ export type AuditResourceType = CommonAuditResourceType | SecurityAuditResourceType | SettingsAuditResourceType | UserAuditResourceType | string;
1358
+
1359
+ export interface AuditActionTypeParser {
1360
+ parseOrNull(value: string): AuditActionType | null;
1361
+ }
386
1362
 
387
- export const settingsAuditActionTypeSchema: z.ZodType<string>;
388
- export type SettingsAuditActionType = z.infer<typeof settingsAuditActionTypeSchema>;
1363
+ export interface AuditMetadataKeyParser {
1364
+ parseOrNull(value: string): AuditMetadataKey | null;
1365
+ }
389
1366
 
390
- export const userAuditActionTypeSchema: z.ZodType<string>;
391
- export type UserAuditActionType = z.infer<typeof userAuditActionTypeSchema>;
1367
+ export interface AuditResourceTypeParser {
1368
+ parseOrNull(value: string): AuditResourceType | null;
1369
+ }
392
1370
 
393
- export const userAccountStatusSchema: z.ZodType<string>;
394
- export type UserAccountStatus = z.infer<typeof userAccountStatusSchema>;
1371
+ export declare class CompositeAuditActionTypeParser {
1372
+ constructor(auditActionTypes: Array<((value: string) => AuditActionType | null) | AuditActionTypeParser>);
1373
+ fromValueOrThrow(value: string): AuditActionType;
1374
+ }
395
1375
 
396
- export const userRoleSchema: z.ZodType<string>;
397
- export type UserRole = z.infer<typeof userRoleSchema>;
1376
+ export declare class CompositeAuditMetadataKeyParser {
1377
+ constructor(metadataKeys: Array<((value: string) => AuditMetadataKey | null) | AuditMetadataKeyParser>);
1378
+ fromValueOrThrow(value: string): AuditMetadataKey;
1379
+ }
398
1380
 
399
- export const userAuthProviderSchema: z.ZodType<string>;
400
- export type UserAuthProvider = z.infer<typeof userAuthProviderSchema>;
1381
+ export declare class CompositeAuditResourceTypeParser {
1382
+ constructor(auditResourceTypes: Array<((value: string) => AuditResourceType | null) | AuditResourceTypeParser>);
1383
+ fromValueOrThrow(value: string): AuditResourceType;
1384
+ }
401
1385
 
402
- export const externalAuthProviderSchema: z.ZodType<string>;
403
- export type ExternalAuthProvider = z.infer<typeof externalAuthProviderSchema>;
1386
+ export type UserSortValues = 'created_at' | 'updated_at' | 'last_accessed_at' | 'last_reauthenticated_at' | 'expires_at';
1387
+
1388
+ export namespace UserSortValues {
1389
+ export type UserSortBy = 'last_login_at' | 'last_active_at' | 'scheduled_permanent_deletion_at' | 'account_lockout_type' | 'temporary_lockout_until' | 'created_at' | 'updated_at';
1390
+ export const UserSortBy: {
1391
+ readonly LAST_LOGIN_AT: 'last_login_at';
1392
+ readonly LAST_ACTIVE_AT: 'last_active_at';
1393
+ readonly SCHEDULED_PERMANENT_DELETION_AT: 'scheduled_permanent_deletion_at';
1394
+ readonly ACCOUNT_LOCKOUT_TYPE: 'account_lockout_type';
1395
+ readonly TEMPORARY_LOCKOUT_UNTIL: 'temporary_lockout_until';
1396
+ readonly CREATED_AT: 'created_at';
1397
+ readonly UPDATED_AT: 'updated_at';
1398
+ };
1399
+
1400
+ export type UserIdentifierSortBy = 'created_at' | 'updated_at';
1401
+ export const UserIdentifierSortBy: {
1402
+ readonly CREATED_AT: 'created_at';
1403
+ readonly UPDATED_AT: 'updated_at';
1404
+ };
1405
+
1406
+ export type UserSessionSortBy = 'expires_at' | 'last_accessed_at' | 'last_reauthenticated_at' | 'created_at' | 'updated_at';
1407
+ export const UserSessionSortBy: {
1408
+ readonly EXPIRES_AT: 'expires_at';
1409
+ readonly LAST_ACCESSED_AT: 'last_accessed_at';
1410
+ readonly LAST_REAUTHENTICATED_AT: 'last_reauthenticated_at';
1411
+ readonly CREATED_AT: 'created_at';
1412
+ readonly UPDATED_AT: 'updated_at';
1413
+ };
1414
+ }
404
1415
 
405
1416
  export function pagedResultSchema<T extends z.ZodTypeAny>(itemSchema: T): z.ZodObject<{
406
1417
  items: z.ZodArray<T>;
@@ -568,7 +1579,7 @@ created_at: number;
568
1579
  export interface AuditEventMetadataPayload {
569
1580
  key: string;
570
1581
  value: string;
571
- value_sensitivity: string;
1582
+ value_sensitivity: AuditValueSensitivity;
572
1583
  }
573
1584
  export const auditEventMetadataPayloadSchema: z.ZodType<AuditEventMetadataPayload>;
574
1585
 
@@ -712,6 +1723,26 @@ account_status: UserAccountStatus;
712
1723
  }
713
1724
  export const userPublicPayloadSchema: z.ZodType<UserPublicPayload>;
714
1725
 
1726
+ export interface SocketFrame {
1727
+ id: UserId;
1728
+ type: string;
1729
+ payload: unknown | null;
1730
+ metadata: Record<string, string>;
1731
+ timestamp: number;
1732
+ }
1733
+ export const socketFrameSchema: z.ZodType<SocketFrame>;
1734
+
1735
+ export interface WebSocketInitializePayload {
1736
+ client_type: ClientType | null;
1737
+ language: string | null;
1738
+ device_id: ClientDeviceId | null;
1739
+ device_name: string | null;
1740
+ app_version: string | null;
1741
+ operation_system_version: string | null;
1742
+ api_version: string | null;
1743
+ }
1744
+ export const webSocketInitializePayloadSchema: z.ZodType<WebSocketInitializePayload>;
1745
+
715
1746
  export interface CreateByEmailRequest {
716
1747
  email: string;
717
1748
  password: string | null;