@mudrichenkoevgeny/shared-foundation 0.0.47 → 0.0.48
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/README.md +6 -36
- package/index.d.ts +520 -59
- package/index.js +442 -16
- package/index.mjs +442 -16
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -342,6 +342,212 @@ UPDATE_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings",
|
|
|
342
342
|
RESET_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings/reset"
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
export const CommonApiFields = {
|
|
346
|
+
ITEMS: "items",
|
|
347
|
+
TOTAL_COUNT: "total_count",
|
|
348
|
+
TOTAL_PAGES: "total_pages",
|
|
349
|
+
ID: "id",
|
|
350
|
+
CREATED_AT: "created_at",
|
|
351
|
+
UPDATED_AT: "updated_at",
|
|
352
|
+
CODE: "code",
|
|
353
|
+
MESSAGE: "message",
|
|
354
|
+
ARGS: "args",
|
|
355
|
+
TYPE: "type",
|
|
356
|
+
PAYLOAD: "payload",
|
|
357
|
+
METADATA: "metadata",
|
|
358
|
+
TIMESTAMP: "timestamp",
|
|
359
|
+
CLIENT_TYPE: "client_type",
|
|
360
|
+
CLIENT_DEVICE_INFO: "client_device_info",
|
|
361
|
+
CLIENT_INFO: "client_info",
|
|
362
|
+
USER_AGENT: "user_agent",
|
|
363
|
+
IP_ADDRESS: "ip_address",
|
|
364
|
+
MASKED_IP_ADDRESS: "masked_ip_address",
|
|
365
|
+
LANGUAGE: "language",
|
|
366
|
+
DEVICE_ID: "device_id",
|
|
367
|
+
DEVICE_NAME: "device_name",
|
|
368
|
+
APP_VERSION: "app_version",
|
|
369
|
+
OPERATION_SYSTEM_VERSION: "operation_system_version",
|
|
370
|
+
API_VERSION: "api_version",
|
|
371
|
+
IS_SENSITIVE_VALUES_MASKED: "is_sensitive_values_masked"
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export const SecurityApiFields = {
|
|
375
|
+
RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_OPEN_USER: "recent_authentication_validity_seconds_for_open_user",
|
|
376
|
+
RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_MANAGEMENT_USER: "recent_authentication_validity_seconds_for_management_user",
|
|
377
|
+
MFA_TOKEN: "mfa_token",
|
|
378
|
+
TOTP_CODE: "totp_code",
|
|
379
|
+
TOTP_SECRET_KEY: "totp_secret_key",
|
|
380
|
+
TOTP_OTP_AUTH_URL: "totp_otp_auth_url",
|
|
381
|
+
TOTP_RECOVERY_CODES: "totp_recovery_codes",
|
|
382
|
+
OPEN_PASSWORD_POLICY: "open_password_policy",
|
|
383
|
+
MANAGEMENT_PASSWORD_POLICY: "management_password_policy",
|
|
384
|
+
MIN_LENGTH: "min_length",
|
|
385
|
+
REQUIRE_LETTER: "require_letter",
|
|
386
|
+
REQUIRE_UPPER_CASE: "require_upper_case",
|
|
387
|
+
REQUIRE_LOWER_CASE: "require_lower_case",
|
|
388
|
+
REQUIRE_DIGIT: "require_digit",
|
|
389
|
+
REQUIRE_SPECIAL_CHAR: "require_special_char",
|
|
390
|
+
COMMON_PASSWORDS: "common_passwords",
|
|
391
|
+
OTP_CONFIRMATION: "otp_confirmation",
|
|
392
|
+
RETRY_AFTER_SECONDS: "retry_after_seconds",
|
|
393
|
+
NUMBER_OF_SYMBOLS: "number_of_symbols",
|
|
394
|
+
EXPIRATION_SECONDS: "expiration_seconds",
|
|
395
|
+
MAX_REQUESTS_PER_PERIOD: "max_requests_per_period",
|
|
396
|
+
RATE_LIMIT_PERIOD_SECONDS: "rate_limit_period_seconds",
|
|
397
|
+
REFRESH_TOKEN_ROTATION_GRACE_PERIOD_SECONDS: "refresh_token_rotation_grace_period_seconds",
|
|
398
|
+
ACCOUNT_LOCKOUT_POLICY: "account_lockout_policy",
|
|
399
|
+
ACCOUNT_LOCKOUT_CHECK_INTERVAL_SECONDS: "account_lockout_check_interval_seconds",
|
|
400
|
+
MAX_FAILED_PASSWORD_ATTEMPTS: "max_failed_password_attempts",
|
|
401
|
+
MAX_FAILED_OTP_ATTEMPTS: "max_failed_otp_attempts",
|
|
402
|
+
MAX_FAILED_TOTP_ATTEMPTS: "max_failed_totp_attempts",
|
|
403
|
+
FAILED_ATTEMPTS_WINDOW_SECONDS: "failed_attempts_window_seconds",
|
|
404
|
+
LOCKOUT_DURATION_SECONDS: "lockout_duration_seconds",
|
|
405
|
+
INDEFINITE_LOCKOUT_THRESHOLD: "indefinite_lockout_threshold",
|
|
406
|
+
IS_SELF_SERVICE_UNLOCK_ENABLED: "is_self_service_unlock_enabled",
|
|
407
|
+
OPEN_IP_RESTRICTION_POLICY: "open_ip_restriction_policy",
|
|
408
|
+
MANAGEMENT_IP_RESTRICTION_POLICY: "management_ip_restriction_policy",
|
|
409
|
+
IS_BLACKLIST_ENABLED: "is_blacklist_enabled",
|
|
410
|
+
BLACKLIST: "blacklist",
|
|
411
|
+
IS_WHITELIST_ENABLED: "is_whitelist_enabled",
|
|
412
|
+
WHITELIST: "whitelist"
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export const GlobalSettingsApiFields = {
|
|
416
|
+
PRIVACY_POLICY_URL: "privacy_policy_url",
|
|
417
|
+
TERMS_OF_SERVICE_URL: "terms_of_service_url",
|
|
418
|
+
CONTACT_SUPPORT_EMAIL: "contact_support_email",
|
|
419
|
+
IS_TRACING_ENABLED: "is_tracing_enabled",
|
|
420
|
+
IS_METRICS_ENABLED: "is_metrics_enabled",
|
|
421
|
+
IS_VERBOSE_LOGGING_ENABLED: "is_verbose_logging_enabled",
|
|
422
|
+
MIN_SUPPORTED_APP_VERSIONS: "min_supported_app_versions"
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
export const UserApiFields = {
|
|
426
|
+
EXTERNAL_PROVIDER_TOKEN: "external_provider_token",
|
|
427
|
+
TOKEN_TYPE: "token_type",
|
|
428
|
+
SESSION_ID: "session_id",
|
|
429
|
+
ACCESS_TOKEN: "access_token",
|
|
430
|
+
REFRESH_TOKEN: "refresh_token",
|
|
431
|
+
SESSION_TOKEN: "session_token",
|
|
432
|
+
EXPIRES_AT: "expires_at",
|
|
433
|
+
EMAIL: "email",
|
|
434
|
+
PHONE_NUMBER: "phone_number",
|
|
435
|
+
PASSWORD: "password",
|
|
436
|
+
OLD_PASSWORD: "old_password",
|
|
437
|
+
NEW_PASSWORD: "new_password",
|
|
438
|
+
CONFIRMATION_CODE: "confirmation_code",
|
|
439
|
+
AUTH_PROVIDER: "auth_provider",
|
|
440
|
+
USER: "user",
|
|
441
|
+
USER_ID: "user_id",
|
|
442
|
+
ROLE: "role",
|
|
443
|
+
USER_ROLE: "user_role",
|
|
444
|
+
ACCOUNT_STATUS: "account_status",
|
|
445
|
+
ACCOUNT_STATUS_ON_RESTORE: "account_status_on_restore",
|
|
446
|
+
AUTHORITY_LEVEL: "authority_level",
|
|
447
|
+
PERMISSION_CODES: "permission_codes",
|
|
448
|
+
IS_TOTP_ENABLED: "is_totp_enabled",
|
|
449
|
+
LAST_LOGIN_AT: "last_login_at",
|
|
450
|
+
LAST_ACTIVE_AT: "last_active_at",
|
|
451
|
+
SCHEDULED_PERMANENT_DELETION_AT: "scheduled_permanent_deletion_at",
|
|
452
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
453
|
+
TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until",
|
|
454
|
+
IDENTIFIER: "identifier",
|
|
455
|
+
EXTERNAL_PROVIDER_EMAIL: "external_provider_email",
|
|
456
|
+
USER_AUTH_PROVIDER: "user_auth_provider",
|
|
457
|
+
IDENTIFIER_ID: "identifier_id",
|
|
458
|
+
DISPLAY_NAME: "display_name",
|
|
459
|
+
IDENTIFIER_DISPLAY_NAME: "identifier_display_name",
|
|
460
|
+
IDENTIFIER_AUTH_PROVIDER: "identifier_auth_provider",
|
|
461
|
+
LAST_ACCESSED_AT: "last_accessed_at",
|
|
462
|
+
LAST_REAUTHENTICATED_AT: "last_reauthenticated_at",
|
|
463
|
+
DELETED_SESSION_IDS: "deleted_session_ids",
|
|
464
|
+
DELETED_IDENTIFIER_IDS: "deleted_identifier_ids",
|
|
465
|
+
MAX_TOTAL_IDENTIFIERS: "max_total_identifiers",
|
|
466
|
+
MAX_EMAIL_IDENTIFIERS: "max_email_identifiers",
|
|
467
|
+
MAX_PHONE_IDENTIFIERS: "max_phone_identifiers",
|
|
468
|
+
MAX_IDENTIFIERS_PER_EXTERNAL_PROVIDER: "max_identifiers_per_external_provider",
|
|
469
|
+
MAX_ACTIVE_SESSIONS_FOR_OPEN_USER: "max_active_sessions_for_open_user",
|
|
470
|
+
MAX_ACTIVE_SESSIONS_FOR_MANAGEMENT_USER: "max_active_sessions_for_management_user",
|
|
471
|
+
AVAILABLE_AUTH_PROVIDERS: "available_auth_providers",
|
|
472
|
+
ACCESS_TOKEN_VALIDITY_SECONDS: "access_token_validity_seconds",
|
|
473
|
+
REFRESH_TOKEN_VALIDITY_SECONDS: "refresh_token_validity_seconds",
|
|
474
|
+
ACCOUNT_DELETION_GRACE_PERIOD_SECONDS: "account_deletion_grace_period_seconds",
|
|
475
|
+
ACCOUNT_DELETION_CHECK_INTERVAL_SECONDS: "account_deletion_check_interval_seconds",
|
|
476
|
+
IS_REGISTRATION_ENABLED: "is_registration_enabled",
|
|
477
|
+
EMAIL_RESTRICTION_POLICY: "email_restriction_policy",
|
|
478
|
+
OPEN_EMAIL_RESTRICTION_POLICY: "open_email_restriction_policy",
|
|
479
|
+
MANAGEMENT_EMAIL_RESTRICTION_POLICY: "management_email_restriction_policy",
|
|
480
|
+
PRIMARY: "primary",
|
|
481
|
+
SECONDARY: "secondary",
|
|
482
|
+
OPEN_GLOBAL_SETTINGS: "open_global_settings",
|
|
483
|
+
MANAGEMENT_GLOBAL_SETTINGS: "management_global_settings",
|
|
484
|
+
OPEN_SECURITY_SETTINGS: "open_security_settings",
|
|
485
|
+
MANAGEMENT_SECURITY_SETTINGS: "management_security_settings",
|
|
486
|
+
OPEN_AUTH_SETTINGS: "open_auth_settings",
|
|
487
|
+
MANAGEMENT_AUTH_SETTINGS: "management_auth_settings"
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export const AuditEventFields = {
|
|
491
|
+
ACTOR_ID: "actor_id",
|
|
492
|
+
ACTOR_TYPE: "actor_type",
|
|
493
|
+
ACTOR_USER_ROLE: "actor_user_role",
|
|
494
|
+
ACTION: "action",
|
|
495
|
+
RESOURCE: "resource",
|
|
496
|
+
RESOURCE_ID: "resource_id",
|
|
497
|
+
STATUS: "status",
|
|
498
|
+
METADATA_KEY: "key",
|
|
499
|
+
METADATA_VALUE: "value",
|
|
500
|
+
METADATA_VALUE_SENSITIVITY: "value_sensitivity"
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
export const CommonHttpHeaders = {
|
|
504
|
+
TRACE_HEADER_NAME: "X-Trace-Id",
|
|
505
|
+
CLIENT_TYPE_HEADER_NAME: "X-Client-Type",
|
|
506
|
+
DEVICE_ID_HEADER_NAME: "X-Device-Id",
|
|
507
|
+
DEVICE_NAME_HEADER_NAME: "X-Device-Name",
|
|
508
|
+
APP_VERSION_HEADER_NAME: "X-App-Version",
|
|
509
|
+
OPERATION_SYSTEM_VERSION_HEADER_NAME: "X-OS-Version",
|
|
510
|
+
API_VERSION_HEADER_NAME: "X-Api-Version"
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
export const CommonWebSocketCloseReasons = {
|
|
514
|
+
NORMAL: "Normal",
|
|
515
|
+
SERVER_RESTART: "Server restart",
|
|
516
|
+
INTERNAL_SERVER_ERROR: "Internal server error"
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
export const CommonWebSocketEventTypes = {
|
|
520
|
+
PING: "PING",
|
|
521
|
+
PONG: "PONG",
|
|
522
|
+
INITIALIZE: "INITIALIZE",
|
|
523
|
+
INITIALIZED_SUCCESS: "INITIALIZED_SUCCESS"
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
export const SecurityWebSocketEventTypes = {
|
|
527
|
+
OPEN_SECURITY_SETTINGS_UPDATED: "OPEN_SECURITY_SETTINGS_UPDATED",
|
|
528
|
+
MANAGEMENT_SECURITY_SETTINGS_UPDATED: "MANAGEMENT_SECURITY_SETTINGS_UPDATED"
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export const SettingsWebSocketEventTypes = {
|
|
532
|
+
OPEN_GLOBAL_SETTINGS_UPDATED: "OPEN_GLOBAL_SETTINGS_UPDATED",
|
|
533
|
+
MANAGEMENT_GLOBAL_SETTINGS_UPDATED: "MANAGEMENT_GLOBAL_SETTINGS_UPDATED"
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export const ListingParamNames = {
|
|
537
|
+
PAGE_NUMBER: "page_number",
|
|
538
|
+
PAGE_SIZE: "page_size",
|
|
539
|
+
SORT_BY: "sort_by",
|
|
540
|
+
SORT_ORDER: "sort_order",
|
|
541
|
+
Pagination: {
|
|
542
|
+
PAGE_NUMBER: "page_number",
|
|
543
|
+
PAGE_SIZE: "page_size"
|
|
544
|
+
},
|
|
545
|
+
Sort: {
|
|
546
|
+
SORT_BY: "sort_by",
|
|
547
|
+
SORT_ORDER: "sort_order"
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
345
551
|
export const CommonErrorCodes = {
|
|
346
552
|
UNKNOWN: "UNKNOWN",
|
|
347
553
|
INTERNAL: "INTERNAL",
|
|
@@ -462,41 +668,243 @@ export const UserPermissionCode = {
|
|
|
462
668
|
|
|
463
669
|
};
|
|
464
670
|
|
|
465
|
-
|
|
671
|
+
export const clientTypeSchema = z.enum(["web", "android", "ios", "desktop"]);
|
|
672
|
+
export const ClientType = {
|
|
673
|
+
WEB: "web",
|
|
674
|
+
ANDROID: "android",
|
|
675
|
+
IOS: "ios",
|
|
676
|
+
DESKTOP: "desktop"
|
|
677
|
+
};
|
|
466
678
|
|
|
467
|
-
export const sortOrderSchema = z.enum(["asc", "desc"]);
|
|
679
|
+
export const sortOrderSchema = z.enum(["asc", "desc"]);
|
|
680
|
+
export const SortOrder = {
|
|
681
|
+
ASC: "asc",
|
|
682
|
+
DESC: "desc"
|
|
683
|
+
};
|
|
468
684
|
|
|
469
|
-
export const accountLockoutTypeSchema = z.enum(["none", "indefinite", "temporary"]);
|
|
685
|
+
export const accountLockoutTypeSchema = z.enum(["none", "indefinite", "temporary"]);
|
|
686
|
+
export const AccountLockoutType = {
|
|
687
|
+
NONE: "none",
|
|
688
|
+
INDEFINITE: "indefinite",
|
|
689
|
+
TEMPORARY: "temporary",
|
|
690
|
+
PERMANENT: "indefinite"
|
|
691
|
+
};
|
|
470
692
|
|
|
471
|
-
export const passwordPolicyFailReasonSchema = z.enum(["too_short", "no_letter", "no_uppercase", "no_lowercase", "no_digit", "no_special_char", "too_common"]);
|
|
693
|
+
export const passwordPolicyFailReasonSchema = z.enum(["too_short", "no_letter", "no_uppercase", "no_lowercase", "no_digit", "no_special_char", "too_common"]);
|
|
694
|
+
export const PasswordPolicyFailReason = {
|
|
695
|
+
TOO_SHORT: "too_short",
|
|
696
|
+
NO_LETTER: "no_letter",
|
|
697
|
+
NO_UPPERCASE: "no_uppercase",
|
|
698
|
+
NO_LOWERCASE: "no_lowercase",
|
|
699
|
+
NO_DIGIT: "no_digit",
|
|
700
|
+
NO_SPECIAL_CHAR: "no_special_char",
|
|
701
|
+
TOO_COMMON: "too_common"
|
|
702
|
+
};
|
|
472
703
|
|
|
473
|
-
export const auditActorTypeSchema = z.enum(["user", "system", "service"]);
|
|
704
|
+
export const auditActorTypeSchema = z.enum(["user", "system", "service"]);
|
|
705
|
+
export const AuditActorType = {
|
|
706
|
+
USER: "user",
|
|
707
|
+
SYSTEM: "system",
|
|
708
|
+
SERVICE: "service"
|
|
709
|
+
};
|
|
474
710
|
|
|
475
|
-
export const auditValueSensitivitySchema = z.enum(["non_sensitive", "email", "phone_number", "ip_address", "partial_value_mask", "full_value_mask"]);
|
|
711
|
+
export const auditValueSensitivitySchema = z.enum(["non_sensitive", "email", "phone_number", "ip_address", "partial_value_mask", "full_value_mask"]);
|
|
712
|
+
export const AuditValueSensitivity = {
|
|
713
|
+
NON_SENSITIVE: "non_sensitive",
|
|
714
|
+
EMAIL: "email",
|
|
715
|
+
PHONE_NUMBER: "phone_number",
|
|
716
|
+
IP_ADDRESS: "ip_address",
|
|
717
|
+
PARTIAL_VALUE_MASK: "partial_value_mask",
|
|
718
|
+
FULL_VALUE_MASK: "full_value_mask"
|
|
719
|
+
};
|
|
476
720
|
|
|
477
|
-
export const auditStatusSchema = z.enum(["success", "failed", "denied"]);
|
|
721
|
+
export const auditStatusSchema = z.enum(["success", "failed", "denied"]);
|
|
722
|
+
export const AuditStatus = {
|
|
723
|
+
SUCCESS: "success",
|
|
724
|
+
FAILED: "failed",
|
|
725
|
+
DENIED: "denied"
|
|
726
|
+
};
|
|
478
727
|
|
|
479
|
-
export const commonAuditResourceTypeSchema = z.enum(["audit_event", "audit_events"]);
|
|
728
|
+
export const commonAuditResourceTypeSchema = z.enum(["audit_event", "audit_events"]);
|
|
729
|
+
export const CommonAuditResourceType = {
|
|
730
|
+
AUDIT_EVENT: "audit_event",
|
|
731
|
+
AUDIT_EVENTS: "audit_events"
|
|
732
|
+
};
|
|
480
733
|
|
|
481
734
|
export const securityAuditResourceTypeSchema = z.enum(["security_settings"]);
|
|
735
|
+
export const SecurityAuditResourceType = {
|
|
736
|
+
SECURITY_SETTINGS: "security_settings"
|
|
737
|
+
};
|
|
482
738
|
|
|
483
739
|
export const settingsAuditResourceTypeSchema = z.enum(["global_settings"]);
|
|
740
|
+
export const SettingsAuditResourceType = {
|
|
741
|
+
GLOBAL_SETTINGS: "global_settings"
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
export const userAuditResourceTypeSchema = z.enum(["auth_settings", "user", "email_address", "phone_number", "identifier", "session"]);
|
|
745
|
+
export const UserAuditResourceType = {
|
|
746
|
+
AUTH_SETTINGS: "auth_settings",
|
|
747
|
+
USER: "user",
|
|
748
|
+
EMAIL_ADDRESS: "email_address",
|
|
749
|
+
PHONE_NUMBER: "phone_number",
|
|
750
|
+
IDENTIFIER: "identifier",
|
|
751
|
+
SESSION: "session"
|
|
752
|
+
};
|
|
484
753
|
|
|
485
|
-
export const
|
|
754
|
+
export const securityAuditActionTypeSchema = z.enum(["management_update_security_settings", "management_reset_security_settings"]);
|
|
755
|
+
export const SecurityAuditActionType = {
|
|
756
|
+
MANAGEMENT_UPDATE_SECURITY_SETTINGS: "management_update_security_settings",
|
|
757
|
+
MANAGEMENT_RESET_SECURITY_SETTINGS: "management_reset_security_settings"
|
|
758
|
+
};
|
|
486
759
|
|
|
487
|
-
export const
|
|
760
|
+
export const settingsAuditActionTypeSchema = z.enum(["management_update_global_settings", "management_reset_global_settings"]);
|
|
761
|
+
export const SettingsAuditActionType = {
|
|
762
|
+
MANAGEMENT_UPDATE_GLOBAL_SETTINGS: "management_update_global_settings",
|
|
763
|
+
MANAGEMENT_RESET_GLOBAL_SETTINGS: "management_reset_global_settings"
|
|
764
|
+
};
|
|
488
765
|
|
|
489
|
-
export const
|
|
766
|
+
export const userAuditActionTypeSchema = z.enum(["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"]);
|
|
767
|
+
export const UserAuditActionType = {
|
|
768
|
+
MANAGEMENT_UPDATE_AUTH_SETTINGS: "management_update_auth_settings",
|
|
769
|
+
MANAGEMENT_RESET_AUTH_SETTINGS: "management_reset_auth_settings",
|
|
770
|
+
MANAGEMENT_DELETE_IDENTIFIER: "management_delete_identifier",
|
|
771
|
+
MANAGEMENT_DELETE_IDENTIFIER_PASSWORD: "management_delete_identifier_password",
|
|
772
|
+
MANAGEMENT_DELETE_SESSION: "management_delete_session",
|
|
773
|
+
MANAGEMENT_DELETE_ALL_USER_SESSIONS: "management_delete_all_user_sessions",
|
|
774
|
+
MANAGEMENT_UPDATE_USER: "management_update_user",
|
|
775
|
+
MANAGEMENT_DELETE_USER: "management_delete_user",
|
|
776
|
+
MANAGEMENT_CREATE_USER: "management_create_user",
|
|
777
|
+
MANAGEMENT_DISABLE_USER_TOTP: "management_disable_user_totp",
|
|
778
|
+
LOGIN_BY_EMAIL: "login_by_email",
|
|
779
|
+
LOGIN_BY_PHONE: "login_by_phone",
|
|
780
|
+
LOGIN_BY_EXTERNAL_AUTH_PROVIDER: "login_by_external_auth_provider",
|
|
781
|
+
LOGIN_BY_TOTP: "login_by_totp",
|
|
782
|
+
LOGIN_BY_TOTP_RECOVERY_CODE: "login_by_totp_recovery_code",
|
|
783
|
+
NEW_DEVICE_DETECTED: "new_device_detected",
|
|
784
|
+
REGISTER_BY_EMAIL: "register_by_email",
|
|
785
|
+
RESET_PASSWORD: "reset_password",
|
|
786
|
+
SELF_UNLOCK_ACCOUNT: "self_unlock_account",
|
|
787
|
+
LOGOUT: "logout",
|
|
788
|
+
SELF_DELETE_SESSION: "self_delete_session",
|
|
789
|
+
SELF_DELETE_OTHER_SESSIONS: "self_delete_other_sessions",
|
|
790
|
+
REAUTHENTICATE_SESSION: "reauthenticate_session",
|
|
791
|
+
SELF_DELETE_IDENTIFIER: "self_delete_identifier",
|
|
792
|
+
ADD_IDENTIFIER_EMAIL: "add_identifier_email",
|
|
793
|
+
ADD_IDENTIFIER_PHONE: "add_identifier_phone",
|
|
794
|
+
ADD_IDENTIFIER_EXTERNAL_AUTH_PROVIDER: "add_identifier_external_auth_provider",
|
|
795
|
+
CHANGE_PASSWORD: "change_password",
|
|
796
|
+
SELF_SCHEDULE_USER_DELETION: "self_schedule_user_deletion",
|
|
797
|
+
SELF_RESTORE_USER: "self_restore_user",
|
|
798
|
+
SELF_SETUP_TOTP_INITIATED: "self_setup_totp_initiated",
|
|
799
|
+
SELF_ENABLE_TOTP: "self_enable_totp",
|
|
800
|
+
SELF_DISABLE_TOTP: "self_disable_totp",
|
|
801
|
+
SELF_GET_RECOVERY_CODES: "self_get_recovery_codes",
|
|
802
|
+
SELF_REGENERATE_RECOVERY_CODES: "self_regenerate_recovery_codes",
|
|
803
|
+
REFRESH_TOKEN_REUSE_DETECTED: "refresh_token_reuse_detected"
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
export const userAccountStatusSchema = z.enum(["active", "read_only", "banned", "security_hold", "pending_deletion"]);
|
|
807
|
+
export const UserAccountStatus = {
|
|
808
|
+
ACTIVE: "active",
|
|
809
|
+
READ_ONLY: "read_only",
|
|
810
|
+
BANNED: "banned",
|
|
811
|
+
SECURITY_HOLD: "security_hold",
|
|
812
|
+
PENDING_DELETION: "pending_deletion"
|
|
813
|
+
};
|
|
490
814
|
|
|
491
|
-
export const
|
|
815
|
+
export const userRoleSchema = z.enum(["user", "staff", "admin"]);
|
|
816
|
+
export const UserRole = {
|
|
817
|
+
USER: "user",
|
|
818
|
+
STAFF: "staff",
|
|
819
|
+
ADMIN: "admin",
|
|
820
|
+
CLIENT_USER: "user",
|
|
821
|
+
MANAGEMENT_USER: "admin"
|
|
822
|
+
};
|
|
492
823
|
|
|
493
|
-
export const
|
|
824
|
+
export const userAuthProviderSchema = z.enum(["email", "phone", "google", "apple"]);
|
|
825
|
+
export const UserAuthProvider = {
|
|
826
|
+
EMAIL: "email",
|
|
827
|
+
PHONE: "phone",
|
|
828
|
+
GOOGLE: "google",
|
|
829
|
+
APPLE: "apple"
|
|
830
|
+
};
|
|
494
831
|
|
|
495
|
-
export const
|
|
832
|
+
export const externalAuthProviderSchema = z.enum(["google", "apple"]);
|
|
833
|
+
export const ExternalAuthProvider = {
|
|
834
|
+
GOOGLE: "google",
|
|
835
|
+
APPLE: "apple"
|
|
836
|
+
};
|
|
496
837
|
|
|
497
|
-
export const
|
|
838
|
+
export const userSortBySchema = z.enum(["last_login_at", "last_active_at", "scheduled_permanent_deletion_at", "account_lockout_type", "temporary_lockout_until", "created_at", "updated_at"]);
|
|
839
|
+
export const UserSortBy = {
|
|
840
|
+
LAST_LOGIN_AT: "last_login_at",
|
|
841
|
+
LAST_ACTIVE_AT: "last_active_at",
|
|
842
|
+
SCHEDULED_PERMANENT_DELETION_AT: "scheduled_permanent_deletion_at",
|
|
843
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
844
|
+
TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until",
|
|
845
|
+
CREATED_AT: "created_at",
|
|
846
|
+
UPDATED_AT: "updated_at"
|
|
847
|
+
};
|
|
498
848
|
|
|
499
|
-
export const
|
|
849
|
+
export const userIdentifierSortBySchema = z.enum(["created_at", "updated_at"]);
|
|
850
|
+
export const UserIdentifierSortBy = {
|
|
851
|
+
CREATED_AT: "created_at",
|
|
852
|
+
UPDATED_AT: "updated_at"
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
export const userSessionSortBySchema = z.enum(["expires_at", "last_accessed_at", "last_reauthenticated_at", "created_at", "updated_at"]);
|
|
856
|
+
export const UserSessionSortBy = {
|
|
857
|
+
EXPIRES_AT: "expires_at",
|
|
858
|
+
LAST_ACCESSED_AT: "last_accessed_at",
|
|
859
|
+
LAST_REAUTHENTICATED_AT: "last_reauthenticated_at",
|
|
860
|
+
CREATED_AT: "created_at",
|
|
861
|
+
UPDATED_AT: "updated_at"
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
export const auditEventSortBySchema = z.enum(["created_at"]);
|
|
865
|
+
export const AuditEventSortBy = {
|
|
866
|
+
CREATED_AT: "created_at"
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
export const timestampSortBySchema = z.enum(["created_at", "updated_at"]);
|
|
870
|
+
export const TimestampSortBy = {
|
|
871
|
+
CREATED_AT: "created_at",
|
|
872
|
+
UPDATED_AT: "updated_at"
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
export const unlockMethodSchema = z.enum(["EMAIL", "PHONE"]);
|
|
876
|
+
export const UnlockMethod = {
|
|
877
|
+
EMAIL: "EMAIL",
|
|
878
|
+
PHONE: "PHONE"
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
export const confirmationTypeSchema = z.enum(["REGISTRATION_EMAIL", "ADD_EMAIL", "PASSWORD_RESET_EMAIL", "LOGIN_PHONE", "ADD_PHONE", "UNLOCK_EMAIL", "UNLOCK_PHONE"]);
|
|
882
|
+
export const ConfirmationType = {
|
|
883
|
+
REGISTRATION_EMAIL: "REGISTRATION_EMAIL",
|
|
884
|
+
ADD_EMAIL: "ADD_EMAIL",
|
|
885
|
+
PASSWORD_RESET_EMAIL: "PASSWORD_RESET_EMAIL",
|
|
886
|
+
LOGIN_PHONE: "LOGIN_PHONE",
|
|
887
|
+
ADD_PHONE: "ADD_PHONE",
|
|
888
|
+
UNLOCK_EMAIL: "UNLOCK_EMAIL",
|
|
889
|
+
UNLOCK_PHONE: "UNLOCK_PHONE"
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
export const appTypeSchema = z.enum(["CLIENT", "MANAGEMENT"]);
|
|
893
|
+
export const AppType = {
|
|
894
|
+
CLIENT: "CLIENT",
|
|
895
|
+
MANAGEMENT: "MANAGEMENT"
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
export const confirmationKeySchema = z.object({
|
|
899
|
+
type: confirmationTypeSchema,
|
|
900
|
+
identifier: z.string()
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
export const UserSortValues = {
|
|
904
|
+
UserSortBy,
|
|
905
|
+
UserIdentifierSortBy,
|
|
906
|
+
UserSessionSortBy
|
|
907
|
+
};
|
|
500
908
|
|
|
501
909
|
export function pagedResultSchema(itemSchema) {
|
|
502
910
|
return z.object({
|
|
@@ -771,6 +1179,24 @@ role: userRoleSchema,
|
|
|
771
1179
|
account_status: userAccountStatusSchema
|
|
772
1180
|
});
|
|
773
1181
|
|
|
1182
|
+
export const socketFrameSchema = z.object({
|
|
1183
|
+
id: userIdSchema,
|
|
1184
|
+
type: z.string(),
|
|
1185
|
+
payload: z.unknown().nullable(),
|
|
1186
|
+
metadata: z.record(z.string(), z.string()),
|
|
1187
|
+
timestamp: z.number()
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
export const webSocketInitializePayloadSchema = z.object({
|
|
1191
|
+
client_type: clientTypeSchema.nullable(),
|
|
1192
|
+
language: z.string().nullable(),
|
|
1193
|
+
device_id: clientDeviceIdSchema.nullable(),
|
|
1194
|
+
device_name: z.string().nullable(),
|
|
1195
|
+
app_version: z.string().nullable(),
|
|
1196
|
+
operation_system_version: z.string().nullable(),
|
|
1197
|
+
api_version: z.string().nullable()
|
|
1198
|
+
});
|
|
1199
|
+
|
|
774
1200
|
export const createByEmailRequestSchema = z.object({
|
|
775
1201
|
email: z.string(),
|
|
776
1202
|
password: z.string().nullable(),
|