@mudrichenkoevgeny/shared-foundation 0.0.49 → 0.0.51
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/index.d.ts +169 -169
- package/index.js +206 -192
- package/index.mjs +206 -192
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1165,8 +1165,8 @@ readonly minSupportedAppVersions: Record<string, string>;
|
|
|
1165
1165
|
export declare const toOpenGlobalSettings: (payload: OpenGlobalSettingsPayload) => OpenGlobalSettings;
|
|
1166
1166
|
export declare const toOpenGlobalSettingsPayload: (domain: OpenGlobalSettings) => OpenGlobalSettingsPayload;
|
|
1167
1167
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1168
|
+
export interface AuditEvent {
|
|
1169
|
+
readonly id: AuditEventId;
|
|
1170
1170
|
readonly actorId: UserId | null;
|
|
1171
1171
|
readonly actorType: AuditActorType;
|
|
1172
1172
|
readonly actorUserRole: UserRole | null;
|
|
@@ -1178,18 +1178,18 @@ readonly status: AuditStatus;
|
|
|
1178
1178
|
readonly metadata: AuditEventMetadata[];
|
|
1179
1179
|
readonly message: string | null;
|
|
1180
1180
|
readonly createdAt: Instant;
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export declare const toAuditEvent: (payload: AuditEventPayload, actionTypeParser: CompositeAuditActionTypeParser, resourceTypeParser: CompositeAuditResourceTypeParser, metadataKeyParser: CompositeAuditMetadataKeyParser) => AuditEvent;
|
|
1184
|
+
export declare const toAuditEventPayload: (domain: AuditEvent) => AuditEventPayload;
|
|
1185
1185
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1186
|
+
export interface AuditEventMetadata {
|
|
1187
|
+
readonly key: AuditMetadataKey;
|
|
1188
1188
|
readonly value: string;
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
export declare const toAuditEventMetadata: (payload: AuditEventMetadataPayload, metadataKeyParser: CompositeAuditMetadataKeyParser) => AuditEventMetadata;
|
|
1192
|
+
export declare const toAuditEventMetadataPayload: (domain: AuditEventMetadata) => AuditEventMetadataPayload;
|
|
1193
1193
|
|
|
1194
1194
|
export interface AuthData {
|
|
1195
1195
|
readonly userDetails: UserDetails;
|
|
@@ -1369,17 +1369,17 @@ export interface AuditResourceTypeParser {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
export declare class CompositeAuditActionTypeParser {
|
|
1372
|
-
constructor(auditActionTypes: Array<((value: string) => AuditActionType | null) | AuditActionTypeParser
|
|
1372
|
+
constructor(auditActionTypes: Array<((value: string) => AuditActionType | null) | AuditActionTypeParser | Record<string, string>>);
|
|
1373
1373
|
fromValueOrThrow(value: string): AuditActionType;
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
1376
|
export declare class CompositeAuditMetadataKeyParser {
|
|
1377
|
-
constructor(metadataKeys: Array<((value: string) => AuditMetadataKey | null) | AuditMetadataKeyParser
|
|
1377
|
+
constructor(metadataKeys: Array<((value: string) => AuditMetadataKey | null) | AuditMetadataKeyParser | Record<string, string>>);
|
|
1378
1378
|
fromValueOrThrow(value: string): AuditMetadataKey;
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
1381
1381
|
export declare class CompositeAuditResourceTypeParser {
|
|
1382
|
-
constructor(auditResourceTypes: Array<((value: string) => AuditResourceType | null) | AuditResourceTypeParser
|
|
1382
|
+
constructor(auditResourceTypes: Array<((value: string) => AuditResourceType | null) | AuditResourceTypeParser | Record<string, string>>);
|
|
1383
1383
|
fromValueOrThrow(value: string): AuditResourceType;
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
@@ -1437,14 +1437,6 @@ args: Record<string, string>;
|
|
|
1437
1437
|
}
|
|
1438
1438
|
export const apiErrorResponseSchema: z.ZodType<ApiErrorResponse>;
|
|
1439
1439
|
|
|
1440
|
-
export interface ClientInfoPayload {
|
|
1441
|
-
client_device_info: ClientDeviceInfoPayload;
|
|
1442
|
-
user_agent: string | null;
|
|
1443
|
-
ip_address: string | null;
|
|
1444
|
-
api_version: string | null;
|
|
1445
|
-
}
|
|
1446
|
-
export const clientInfoPayloadSchema: z.ZodType<ClientInfoPayload>;
|
|
1447
|
-
|
|
1448
1440
|
export interface ClientDeviceInfoPayload {
|
|
1449
1441
|
client_type: ClientType | null;
|
|
1450
1442
|
language: string | null;
|
|
@@ -1502,46 +1494,6 @@ require_special_char: boolean;
|
|
|
1502
1494
|
}
|
|
1503
1495
|
export const openPasswordPolicyPayloadSchema: z.ZodType<OpenPasswordPolicyPayload>;
|
|
1504
1496
|
|
|
1505
|
-
export interface ManagementSecuritySettingsPayload {
|
|
1506
|
-
recent_authentication_validity_seconds_for_open_user: number;
|
|
1507
|
-
recent_authentication_validity_seconds_for_management_user: number;
|
|
1508
|
-
management_password_policy: ManagementPasswordPolicyPayload;
|
|
1509
|
-
otp_confirmation: OtpConfirmationPayload;
|
|
1510
|
-
account_lockout_policy: AccountLockoutPolicyPayload;
|
|
1511
|
-
account_lockout_check_interval_seconds: number;
|
|
1512
|
-
open_ip_restriction_policy: IpRestrictionPolicyPayload;
|
|
1513
|
-
management_ip_restriction_policy: IpRestrictionPolicyPayload;
|
|
1514
|
-
expiration_seconds: number;
|
|
1515
|
-
max_requests_per_period: number;
|
|
1516
|
-
rate_limit_period_seconds: number;
|
|
1517
|
-
refresh_token_rotation_grace_period_seconds: number;
|
|
1518
|
-
}
|
|
1519
|
-
export const managementSecuritySettingsPayloadSchema: z.ZodType<ManagementSecuritySettingsPayload>;
|
|
1520
|
-
|
|
1521
|
-
export interface OpenSecuritySettingsPayload {
|
|
1522
|
-
open_password_policy: OpenPasswordPolicyPayload;
|
|
1523
|
-
otp_confirmation: OtpConfirmationPayload;
|
|
1524
|
-
}
|
|
1525
|
-
export const openSecuritySettingsPayloadSchema: z.ZodType<OpenSecuritySettingsPayload>;
|
|
1526
|
-
|
|
1527
|
-
export interface TotpRecoveryCodesPayload {
|
|
1528
|
-
totp_recovery_codes: string[];
|
|
1529
|
-
}
|
|
1530
|
-
export const totpRecoveryCodesPayloadSchema: z.ZodType<TotpRecoveryCodesPayload>;
|
|
1531
|
-
|
|
1532
|
-
export interface TotpSetupPayload {
|
|
1533
|
-
totp_secret_key: string;
|
|
1534
|
-
totp_otp_auth_url: string;
|
|
1535
|
-
mfa_token: string;
|
|
1536
|
-
}
|
|
1537
|
-
export const totpSetupPayloadSchema: z.ZodType<TotpSetupPayload>;
|
|
1538
|
-
|
|
1539
|
-
export interface VerifyTotpPayload {
|
|
1540
|
-
mfa_token: string;
|
|
1541
|
-
totp_code: string;
|
|
1542
|
-
}
|
|
1543
|
-
export const verifyTotpPayloadSchema: z.ZodType<VerifyTotpPayload>;
|
|
1544
|
-
|
|
1545
1497
|
export interface ManagementGlobalSettingsPayload {
|
|
1546
1498
|
privacy_policy_url: string | null;
|
|
1547
1499
|
terms_of_service_url: string | null;
|
|
@@ -1561,21 +1513,6 @@ min_supported_app_versions: Record<string, string>;
|
|
|
1561
1513
|
}
|
|
1562
1514
|
export const openGlobalSettingsPayloadSchema: z.ZodType<OpenGlobalSettingsPayload>;
|
|
1563
1515
|
|
|
1564
|
-
export interface AuditEventPayload {
|
|
1565
|
-
id: AuditEventId;
|
|
1566
|
-
actor_id: UserId | null;
|
|
1567
|
-
actor_type: AuditActorType;
|
|
1568
|
-
actor_user_role: UserRole | null;
|
|
1569
|
-
action: string;
|
|
1570
|
-
resource: string;
|
|
1571
|
-
resource_id: string | null;
|
|
1572
|
-
status: AuditStatus;
|
|
1573
|
-
metadata: AuditEventMetadataPayload[];
|
|
1574
|
-
message: string | null;
|
|
1575
|
-
created_at: number;
|
|
1576
|
-
}
|
|
1577
|
-
export const auditEventPayloadSchema: z.ZodType<AuditEventPayload>;
|
|
1578
|
-
|
|
1579
1516
|
export interface AuditEventMetadataPayload {
|
|
1580
1517
|
key: string;
|
|
1581
1518
|
value: string;
|
|
@@ -1583,60 +1520,12 @@ value_sensitivity: AuditValueSensitivity;
|
|
|
1583
1520
|
}
|
|
1584
1521
|
export const auditEventMetadataPayloadSchema: z.ZodType<AuditEventMetadataPayload>;
|
|
1585
1522
|
|
|
1586
|
-
export interface AuthDataPayload {
|
|
1587
|
-
user: UserDetailsPayload;
|
|
1588
|
-
session_token: SessionTokenPayload;
|
|
1589
|
-
}
|
|
1590
|
-
export const authDataPayloadSchema: z.ZodType<AuthDataPayload>;
|
|
1591
|
-
|
|
1592
1523
|
export interface AvailableAuthProvidersPayload {
|
|
1593
1524
|
primary: string[];
|
|
1594
1525
|
secondary: string[];
|
|
1595
1526
|
}
|
|
1596
1527
|
export const availableAuthProvidersPayloadSchema: z.ZodType<AvailableAuthProvidersPayload>;
|
|
1597
1528
|
|
|
1598
|
-
export interface ManagementAuthSettingsPayload {
|
|
1599
|
-
available_auth_providers: AvailableAuthProvidersPayload;
|
|
1600
|
-
max_total_identifiers: number;
|
|
1601
|
-
max_email_identifiers: number;
|
|
1602
|
-
max_phone_identifiers: number;
|
|
1603
|
-
max_identifiers_per_external_provider: number;
|
|
1604
|
-
max_active_sessions_for_open_user: number;
|
|
1605
|
-
max_active_sessions_for_management_user: number;
|
|
1606
|
-
access_token_validity_seconds: number;
|
|
1607
|
-
refresh_token_validity_seconds: number;
|
|
1608
|
-
account_deletion_grace_period_seconds: number;
|
|
1609
|
-
account_deletion_check_interval_seconds: number;
|
|
1610
|
-
is_registration_enabled: boolean;
|
|
1611
|
-
open_email_restriction_policy: EmailRestrictionPolicyPayload;
|
|
1612
|
-
management_email_restriction_policy: EmailRestrictionPolicyPayload;
|
|
1613
|
-
}
|
|
1614
|
-
export const managementAuthSettingsPayloadSchema: z.ZodType<ManagementAuthSettingsPayload>;
|
|
1615
|
-
|
|
1616
|
-
export interface OpenAuthSettingsPayload {
|
|
1617
|
-
available_auth_providers: AvailableAuthProvidersPayload;
|
|
1618
|
-
max_total_identifiers: number;
|
|
1619
|
-
max_email_identifiers: number;
|
|
1620
|
-
max_phone_identifiers: number;
|
|
1621
|
-
max_identifiers_per_external_provider: number;
|
|
1622
|
-
is_registration_enabled: boolean;
|
|
1623
|
-
}
|
|
1624
|
-
export const openAuthSettingsPayloadSchema: z.ZodType<OpenAuthSettingsPayload>;
|
|
1625
|
-
|
|
1626
|
-
export interface ManagementUserConfigurationPayload {
|
|
1627
|
-
management_global_settings: ManagementGlobalSettingsPayload;
|
|
1628
|
-
management_security_settings: ManagementSecuritySettingsPayload;
|
|
1629
|
-
management_auth_settings: ManagementAuthSettingsPayload;
|
|
1630
|
-
}
|
|
1631
|
-
export const managementUserConfigurationPayloadSchema: z.ZodType<ManagementUserConfigurationPayload>;
|
|
1632
|
-
|
|
1633
|
-
export interface OpenUserConfigurationPayload {
|
|
1634
|
-
open_global_settings: OpenGlobalSettingsPayload;
|
|
1635
|
-
open_security_settings: OpenSecuritySettingsPayload;
|
|
1636
|
-
open_auth_settings: OpenAuthSettingsPayload;
|
|
1637
|
-
}
|
|
1638
|
-
export const openUserConfigurationPayloadSchema: z.ZodType<OpenUserConfigurationPayload>;
|
|
1639
|
-
|
|
1640
1529
|
export interface EmailRestrictionPolicyPayload {
|
|
1641
1530
|
is_blacklist_enabled: boolean;
|
|
1642
1531
|
blacklist: string[];
|
|
@@ -1645,49 +1534,6 @@ whitelist: string[];
|
|
|
1645
1534
|
}
|
|
1646
1535
|
export const emailRestrictionPolicyPayloadSchema: z.ZodType<EmailRestrictionPolicyPayload>;
|
|
1647
1536
|
|
|
1648
|
-
export interface UserIdentifierPayload {
|
|
1649
|
-
id: UserIdentifierId;
|
|
1650
|
-
user_id: UserId;
|
|
1651
|
-
user_auth_provider: UserAuthProvider;
|
|
1652
|
-
identifier: string;
|
|
1653
|
-
display_name: string;
|
|
1654
|
-
external_provider_email: string | null;
|
|
1655
|
-
is_sensitive_values_masked: boolean;
|
|
1656
|
-
created_at: number;
|
|
1657
|
-
updated_at: number | null;
|
|
1658
|
-
}
|
|
1659
|
-
export const userIdentifierPayloadSchema: z.ZodType<UserIdentifierPayload>;
|
|
1660
|
-
|
|
1661
|
-
export interface DeletedSessionsPayload {
|
|
1662
|
-
deleted_session_ids: string[];
|
|
1663
|
-
}
|
|
1664
|
-
export const deletedSessionsPayloadSchema: z.ZodType<DeletedSessionsPayload>;
|
|
1665
|
-
|
|
1666
|
-
export interface UserSessionPayload {
|
|
1667
|
-
id: UserSessionId;
|
|
1668
|
-
user_id: UserId;
|
|
1669
|
-
user_role: UserRole;
|
|
1670
|
-
identifier: string;
|
|
1671
|
-
identifier_id: UserIdentifierId;
|
|
1672
|
-
identifier_display_name: string;
|
|
1673
|
-
identifier_auth_provider: UserAuthProvider;
|
|
1674
|
-
client_device_info: ClientDeviceInfoPayload;
|
|
1675
|
-
user_agent: string | null;
|
|
1676
|
-
ip_address: string | null;
|
|
1677
|
-
expires_at: number;
|
|
1678
|
-
last_accessed_at: number;
|
|
1679
|
-
last_reauthenticated_at: number;
|
|
1680
|
-
is_sensitive_values_masked: boolean;
|
|
1681
|
-
created_at: number;
|
|
1682
|
-
updated_at: number | null;
|
|
1683
|
-
}
|
|
1684
|
-
export const userSessionPayloadSchema: z.ZodType<UserSessionPayload>;
|
|
1685
|
-
|
|
1686
|
-
export interface RefreshTokenPayload {
|
|
1687
|
-
refresh_token: string;
|
|
1688
|
-
}
|
|
1689
|
-
export const refreshTokenPayloadSchema: z.ZodType<RefreshTokenPayload>;
|
|
1690
|
-
|
|
1691
1537
|
export interface SessionTokenPayload {
|
|
1692
1538
|
access_token: string;
|
|
1693
1539
|
refresh_token: string;
|
|
@@ -1723,6 +1569,47 @@ account_status: UserAccountStatus;
|
|
|
1723
1569
|
}
|
|
1724
1570
|
export const userPublicPayloadSchema: z.ZodType<UserPublicPayload>;
|
|
1725
1571
|
|
|
1572
|
+
export interface UserIdentifierPayload {
|
|
1573
|
+
id: UserIdentifierId;
|
|
1574
|
+
user_id: UserId;
|
|
1575
|
+
user_auth_provider: UserAuthProvider;
|
|
1576
|
+
identifier: string;
|
|
1577
|
+
display_name: string;
|
|
1578
|
+
external_provider_email: string | null;
|
|
1579
|
+
is_sensitive_values_masked: boolean;
|
|
1580
|
+
created_at: number;
|
|
1581
|
+
updated_at: number | null;
|
|
1582
|
+
}
|
|
1583
|
+
export const userIdentifierPayloadSchema: z.ZodType<UserIdentifierPayload>;
|
|
1584
|
+
|
|
1585
|
+
export interface DeletedSessionsPayload {
|
|
1586
|
+
deleted_session_ids: string[];
|
|
1587
|
+
}
|
|
1588
|
+
export const deletedSessionsPayloadSchema: z.ZodType<DeletedSessionsPayload>;
|
|
1589
|
+
|
|
1590
|
+
export interface RefreshTokenPayload {
|
|
1591
|
+
refresh_token: string;
|
|
1592
|
+
}
|
|
1593
|
+
export const refreshTokenPayloadSchema: z.ZodType<RefreshTokenPayload>;
|
|
1594
|
+
|
|
1595
|
+
export interface TotpRecoveryCodesPayload {
|
|
1596
|
+
totp_recovery_codes: string[];
|
|
1597
|
+
}
|
|
1598
|
+
export const totpRecoveryCodesPayloadSchema: z.ZodType<TotpRecoveryCodesPayload>;
|
|
1599
|
+
|
|
1600
|
+
export interface TotpSetupPayload {
|
|
1601
|
+
totp_secret_key: string;
|
|
1602
|
+
totp_otp_auth_url: string;
|
|
1603
|
+
mfa_token: string;
|
|
1604
|
+
}
|
|
1605
|
+
export const totpSetupPayloadSchema: z.ZodType<TotpSetupPayload>;
|
|
1606
|
+
|
|
1607
|
+
export interface VerifyTotpPayload {
|
|
1608
|
+
mfa_token: string;
|
|
1609
|
+
totp_code: string;
|
|
1610
|
+
}
|
|
1611
|
+
export const verifyTotpPayloadSchema: z.ZodType<VerifyTotpPayload>;
|
|
1612
|
+
|
|
1726
1613
|
export interface SocketFrame {
|
|
1727
1614
|
id: UserId;
|
|
1728
1615
|
type: string;
|
|
@@ -1743,6 +1630,119 @@ api_version: string | null;
|
|
|
1743
1630
|
}
|
|
1744
1631
|
export const webSocketInitializePayloadSchema: z.ZodType<WebSocketInitializePayload>;
|
|
1745
1632
|
|
|
1633
|
+
export interface ClientInfoPayload {
|
|
1634
|
+
client_device_info: ClientDeviceInfoPayload;
|
|
1635
|
+
user_agent: string | null;
|
|
1636
|
+
ip_address: string | null;
|
|
1637
|
+
api_version: string | null;
|
|
1638
|
+
}
|
|
1639
|
+
export const clientInfoPayloadSchema: z.ZodType<ClientInfoPayload>;
|
|
1640
|
+
|
|
1641
|
+
export interface UserSessionPayload {
|
|
1642
|
+
id: UserSessionId;
|
|
1643
|
+
user_id: UserId;
|
|
1644
|
+
user_role: UserRole;
|
|
1645
|
+
identifier: string;
|
|
1646
|
+
identifier_id: UserIdentifierId;
|
|
1647
|
+
identifier_display_name: string;
|
|
1648
|
+
identifier_auth_provider: UserAuthProvider;
|
|
1649
|
+
client_device_info: ClientDeviceInfoPayload;
|
|
1650
|
+
user_agent: string | null;
|
|
1651
|
+
ip_address: string | null;
|
|
1652
|
+
expires_at: number;
|
|
1653
|
+
last_accessed_at: number;
|
|
1654
|
+
last_reauthenticated_at: number;
|
|
1655
|
+
is_sensitive_values_masked: boolean;
|
|
1656
|
+
created_at: number;
|
|
1657
|
+
updated_at: number | null;
|
|
1658
|
+
}
|
|
1659
|
+
export const userSessionPayloadSchema: z.ZodType<UserSessionPayload>;
|
|
1660
|
+
|
|
1661
|
+
export interface AuditEventPayload {
|
|
1662
|
+
id: AuditEventId;
|
|
1663
|
+
actor_id: UserId | null;
|
|
1664
|
+
actor_type: AuditActorType;
|
|
1665
|
+
actor_user_role: UserRole | null;
|
|
1666
|
+
action: string;
|
|
1667
|
+
resource: string;
|
|
1668
|
+
resource_id: string | null;
|
|
1669
|
+
status: AuditStatus;
|
|
1670
|
+
metadata: AuditEventMetadataPayload[];
|
|
1671
|
+
message: string | null;
|
|
1672
|
+
created_at: number;
|
|
1673
|
+
}
|
|
1674
|
+
export const auditEventPayloadSchema: z.ZodType<AuditEventPayload>;
|
|
1675
|
+
|
|
1676
|
+
export interface AuthDataPayload {
|
|
1677
|
+
user: UserDetailsPayload;
|
|
1678
|
+
session_token: SessionTokenPayload;
|
|
1679
|
+
}
|
|
1680
|
+
export const authDataPayloadSchema: z.ZodType<AuthDataPayload>;
|
|
1681
|
+
|
|
1682
|
+
export interface ManagementAuthSettingsPayload {
|
|
1683
|
+
available_auth_providers: AvailableAuthProvidersPayload;
|
|
1684
|
+
max_total_identifiers: number;
|
|
1685
|
+
max_email_identifiers: number;
|
|
1686
|
+
max_phone_identifiers: number;
|
|
1687
|
+
max_identifiers_per_external_provider: number;
|
|
1688
|
+
max_active_sessions_for_open_user: number;
|
|
1689
|
+
max_active_sessions_for_management_user: number;
|
|
1690
|
+
access_token_validity_seconds: number;
|
|
1691
|
+
refresh_token_validity_seconds: number;
|
|
1692
|
+
account_deletion_grace_period_seconds: number;
|
|
1693
|
+
account_deletion_check_interval_seconds: number;
|
|
1694
|
+
is_registration_enabled: boolean;
|
|
1695
|
+
open_email_restriction_policy: EmailRestrictionPolicyPayload;
|
|
1696
|
+
management_email_restriction_policy: EmailRestrictionPolicyPayload;
|
|
1697
|
+
}
|
|
1698
|
+
export const managementAuthSettingsPayloadSchema: z.ZodType<ManagementAuthSettingsPayload>;
|
|
1699
|
+
|
|
1700
|
+
export interface OpenAuthSettingsPayload {
|
|
1701
|
+
available_auth_providers: AvailableAuthProvidersPayload;
|
|
1702
|
+
max_total_identifiers: number;
|
|
1703
|
+
max_email_identifiers: number;
|
|
1704
|
+
max_phone_identifiers: number;
|
|
1705
|
+
max_identifiers_per_external_provider: number;
|
|
1706
|
+
is_registration_enabled: boolean;
|
|
1707
|
+
}
|
|
1708
|
+
export const openAuthSettingsPayloadSchema: z.ZodType<OpenAuthSettingsPayload>;
|
|
1709
|
+
|
|
1710
|
+
export interface ManagementSecuritySettingsPayload {
|
|
1711
|
+
recent_authentication_validity_seconds_for_open_user: number;
|
|
1712
|
+
recent_authentication_validity_seconds_for_management_user: number;
|
|
1713
|
+
management_password_policy: ManagementPasswordPolicyPayload;
|
|
1714
|
+
otp_confirmation: OtpConfirmationPayload;
|
|
1715
|
+
account_lockout_policy: AccountLockoutPolicyPayload;
|
|
1716
|
+
account_lockout_check_interval_seconds: number;
|
|
1717
|
+
open_ip_restriction_policy: IpRestrictionPolicyPayload;
|
|
1718
|
+
management_ip_restriction_policy: IpRestrictionPolicyPayload;
|
|
1719
|
+
expiration_seconds: number;
|
|
1720
|
+
max_requests_per_period: number;
|
|
1721
|
+
rate_limit_period_seconds: number;
|
|
1722
|
+
refresh_token_rotation_grace_period_seconds: number;
|
|
1723
|
+
}
|
|
1724
|
+
export const managementSecuritySettingsPayloadSchema: z.ZodType<ManagementSecuritySettingsPayload>;
|
|
1725
|
+
|
|
1726
|
+
export interface OpenSecuritySettingsPayload {
|
|
1727
|
+
open_password_policy: OpenPasswordPolicyPayload;
|
|
1728
|
+
otp_confirmation: OtpConfirmationPayload;
|
|
1729
|
+
}
|
|
1730
|
+
export const openSecuritySettingsPayloadSchema: z.ZodType<OpenSecuritySettingsPayload>;
|
|
1731
|
+
|
|
1732
|
+
export interface ManagementUserConfigurationPayload {
|
|
1733
|
+
management_global_settings: ManagementGlobalSettingsPayload;
|
|
1734
|
+
management_security_settings: ManagementSecuritySettingsPayload;
|
|
1735
|
+
management_auth_settings: ManagementAuthSettingsPayload;
|
|
1736
|
+
}
|
|
1737
|
+
export const managementUserConfigurationPayloadSchema: z.ZodType<ManagementUserConfigurationPayload>;
|
|
1738
|
+
|
|
1739
|
+
export interface OpenUserConfigurationPayload {
|
|
1740
|
+
open_global_settings: OpenGlobalSettingsPayload;
|
|
1741
|
+
open_security_settings: OpenSecuritySettingsPayload;
|
|
1742
|
+
open_auth_settings: OpenAuthSettingsPayload;
|
|
1743
|
+
}
|
|
1744
|
+
export const openUserConfigurationPayloadSchema: z.ZodType<OpenUserConfigurationPayload>;
|
|
1745
|
+
|
|
1746
1746
|
export interface CreateByEmailRequest {
|
|
1747
1747
|
email: string;
|
|
1748
1748
|
password: string | null;
|
package/index.js
CHANGED
|
@@ -295,11 +295,16 @@ export const refreshTokenHashSchema = z.string().transform((val, ctx) => {
|
|
|
295
295
|
|
|
296
296
|
fromValueOrThrow(value) {
|
|
297
297
|
for (const parse of this.auditActionTypes) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
298
|
+
if (typeof parse === 'function') {
|
|
299
|
+
const result = parse(value);
|
|
300
|
+
if (result !== null && result !== undefined) return result;
|
|
301
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
302
|
+
const result = parse.parseOrNull(value);
|
|
303
|
+
if (result !== null && result !== undefined) return result;
|
|
304
|
+
} else if (parse && typeof parse === 'object') {
|
|
305
|
+
// Support passing the enum object directly (e.g. UserAuditActionType)
|
|
306
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
307
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
303
308
|
}
|
|
304
309
|
}
|
|
305
310
|
throw new Error("Unknown value of AuditActionType: '" + value + "'");
|
|
@@ -313,11 +318,15 @@ export class CompositeAuditMetadataKeyParser {
|
|
|
313
318
|
|
|
314
319
|
fromValueOrThrow(value) {
|
|
315
320
|
for (const parse of this.metadataKeys) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (
|
|
320
|
-
|
|
321
|
+
if (typeof parse === 'function') {
|
|
322
|
+
const result = parse(value);
|
|
323
|
+
if (result !== null && result !== undefined) return result;
|
|
324
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
325
|
+
const result = parse.parseOrNull(value);
|
|
326
|
+
if (result !== null && result !== undefined) return result;
|
|
327
|
+
} else if (parse && typeof parse === 'object') {
|
|
328
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
329
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
throw new Error("Unknown value of AuditMetadataKey: '" + value + "'");
|
|
@@ -331,11 +340,15 @@ export class CompositeAuditResourceTypeParser {
|
|
|
331
340
|
|
|
332
341
|
fromValueOrThrow(value) {
|
|
333
342
|
for (const parse of this.auditResourceTypes) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (
|
|
338
|
-
|
|
343
|
+
if (typeof parse === 'function') {
|
|
344
|
+
const result = parse(value);
|
|
345
|
+
if (result !== null && result !== undefined) return result;
|
|
346
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
347
|
+
const result = parse.parseOrNull(value);
|
|
348
|
+
if (result !== null && result !== undefined) return result;
|
|
349
|
+
} else if (parse && typeof parse === 'object') {
|
|
350
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
351
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
339
352
|
}
|
|
340
353
|
}
|
|
341
354
|
throw new Error("Unknown value of AuditResourceType: '" + value + "'");
|
|
@@ -1220,45 +1233,46 @@ contact_support_email: domain.contactSupportEmail,
|
|
|
1220
1233
|
min_supported_app_versions: domain.minSupportedAppVersions
|
|
1221
1234
|
});
|
|
1222
1235
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
actorId: payload.
|
|
1226
|
-
actorType: payload.
|
|
1227
|
-
actorUserRole: payload.
|
|
1228
|
-
action: payload.action,
|
|
1229
|
-
resource: payload.resource,
|
|
1230
|
-
resourceId: payload.
|
|
1231
|
-
resourceValueSensitivity:
|
|
1232
|
-
status: payload.status,
|
|
1233
|
-
metadata: payload.metadata ? payload.metadata.map(val => toAuditEventMetadata(val)) : [],
|
|
1234
|
-
message: payload.message,
|
|
1235
|
-
createdAt: payload.
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
action: domain.action,
|
|
1244
|
-
resource: domain.resource,
|
|
1245
|
-
|
|
1246
|
-
status: domain.status,
|
|
1247
|
-
metadata: domain.metadata ? domain.metadata.map(val => toAuditEventMetadataPayload(val)) : [],
|
|
1248
|
-
message: domain.message,
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
value: payload.value
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1236
|
+
export const toAuditEvent = (payload, actionTypeParser, resourceTypeParser, metadataKeyParser) => ({
|
|
1237
|
+
id: toAuditEventIdOrThrow(payload.id),
|
|
1238
|
+
actorId: payload.actorId,
|
|
1239
|
+
actorType: payload.actorType,
|
|
1240
|
+
actorUserRole: payload.actorUserRole,
|
|
1241
|
+
action: actionTypeParser.fromValueOrThrow(payload.action),
|
|
1242
|
+
resource: resourceTypeParser.fromValueOrThrow(payload.resource),
|
|
1243
|
+
resourceId: payload.resourceId,
|
|
1244
|
+
resourceValueSensitivity: 'non_sensitive',
|
|
1245
|
+
status: payload.status,
|
|
1246
|
+
metadata: payload.metadata ? payload.metadata.map(val => toAuditEventMetadata(val, metadataKeyParser)) : [],
|
|
1247
|
+
message: payload.message,
|
|
1248
|
+
createdAt: payload.createdAt
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
export const toAuditEventPayload = (domain) => ({
|
|
1252
|
+
id: domain.id,
|
|
1253
|
+
actorId: domain.actorId,
|
|
1254
|
+
actorType: domain.actorType,
|
|
1255
|
+
actorUserRole: domain.actorUserRole,
|
|
1256
|
+
action: domain.action,
|
|
1257
|
+
resource: domain.resource,
|
|
1258
|
+
resourceId: domain.resourceId,
|
|
1259
|
+
status: domain.status,
|
|
1260
|
+
metadata: domain.metadata ? domain.metadata.map(val => toAuditEventMetadataPayload(val)) : [],
|
|
1261
|
+
message: domain.message,
|
|
1262
|
+
createdAt: domain.createdAt
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
export const toAuditEventMetadata = (payload, metadataKeyParser) => ({
|
|
1266
|
+
key: metadataKeyParser.fromValueOrThrow(payload.key),
|
|
1267
|
+
value: payload.value,
|
|
1268
|
+
valueSensitivity: payload.valueSensitivity
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
export const toAuditEventMetadataPayload = (domain) => ({
|
|
1272
|
+
key: domain.key,
|
|
1273
|
+
value: domain.value,
|
|
1274
|
+
valueSensitivity: domain.valueSensitivity
|
|
1275
|
+
});
|
|
1262
1276
|
|
|
1263
1277
|
export const toAuthData = (payload) => ({
|
|
1264
1278
|
userDetails: toUserDetails(payload.user),
|
|
@@ -1791,13 +1805,6 @@ message: z.string(),
|
|
|
1791
1805
|
args: z.record(z.string(), z.string())
|
|
1792
1806
|
});
|
|
1793
1807
|
|
|
1794
|
-
export const clientInfoPayloadSchema = z.object({
|
|
1795
|
-
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1796
|
-
user_agent: z.string().nullable(),
|
|
1797
|
-
ip_address: z.string().nullable(),
|
|
1798
|
-
api_version: z.string().nullable()
|
|
1799
|
-
});
|
|
1800
|
-
|
|
1801
1808
|
export const clientDeviceInfoPayloadSchema = z.object({
|
|
1802
1809
|
client_type: clientTypeSchema.nullable(),
|
|
1803
1810
|
language: z.string().nullable(),
|
|
@@ -1849,41 +1856,6 @@ require_digit: z.boolean(),
|
|
|
1849
1856
|
require_special_char: z.boolean()
|
|
1850
1857
|
});
|
|
1851
1858
|
|
|
1852
|
-
export const managementSecuritySettingsPayloadSchema = z.object({
|
|
1853
|
-
recent_authentication_validity_seconds_for_open_user: z.number(),
|
|
1854
|
-
recent_authentication_validity_seconds_for_management_user: z.number(),
|
|
1855
|
-
management_password_policy: managementPasswordPolicyPayloadSchema,
|
|
1856
|
-
otp_confirmation: otpConfirmationPayloadSchema,
|
|
1857
|
-
account_lockout_policy: accountLockoutPolicyPayloadSchema,
|
|
1858
|
-
account_lockout_check_interval_seconds: z.number(),
|
|
1859
|
-
open_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
1860
|
-
management_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
1861
|
-
expiration_seconds: z.number(),
|
|
1862
|
-
max_requests_per_period: z.number(),
|
|
1863
|
-
rate_limit_period_seconds: z.number(),
|
|
1864
|
-
refresh_token_rotation_grace_period_seconds: z.number()
|
|
1865
|
-
});
|
|
1866
|
-
|
|
1867
|
-
export const openSecuritySettingsPayloadSchema = z.object({
|
|
1868
|
-
open_password_policy: openPasswordPolicyPayloadSchema,
|
|
1869
|
-
otp_confirmation: otpConfirmationPayloadSchema
|
|
1870
|
-
});
|
|
1871
|
-
|
|
1872
|
-
export const totpRecoveryCodesPayloadSchema = z.object({
|
|
1873
|
-
totp_recovery_codes: z.array(z.string())
|
|
1874
|
-
});
|
|
1875
|
-
|
|
1876
|
-
export const totpSetupPayloadSchema = z.object({
|
|
1877
|
-
totp_secret_key: z.string(),
|
|
1878
|
-
totp_otp_auth_url: z.string(),
|
|
1879
|
-
mfa_token: z.string()
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
|
-
export const verifyTotpPayloadSchema = z.object({
|
|
1883
|
-
mfa_token: z.string(),
|
|
1884
|
-
totp_code: z.string()
|
|
1885
|
-
});
|
|
1886
|
-
|
|
1887
1859
|
export const managementGlobalSettingsPayloadSchema = z.object({
|
|
1888
1860
|
privacy_policy_url: z.string().nullable(),
|
|
1889
1861
|
terms_of_service_url: z.string().nullable(),
|
|
@@ -1901,74 +1873,17 @@ contact_support_email: z.string().nullable(),
|
|
|
1901
1873
|
min_supported_app_versions: z.record(z.string(), z.string())
|
|
1902
1874
|
});
|
|
1903
1875
|
|
|
1904
|
-
export const auditEventPayloadSchema = z.object({
|
|
1905
|
-
id: auditEventIdSchema,
|
|
1906
|
-
actor_id: userIdSchema.nullable(),
|
|
1907
|
-
actor_type: auditActorTypeSchema,
|
|
1908
|
-
actor_user_role: userRoleSchema.nullable(),
|
|
1909
|
-
action: z.string(),
|
|
1910
|
-
resource: z.string(),
|
|
1911
|
-
resource_id: z.string().nullable(),
|
|
1912
|
-
status: auditStatusSchema,
|
|
1913
|
-
metadata: z.array(auditEventMetadataPayloadSchema),
|
|
1914
|
-
message: z.string().nullable(),
|
|
1915
|
-
created_at: z.number()
|
|
1916
|
-
});
|
|
1917
|
-
|
|
1918
1876
|
export const auditEventMetadataPayloadSchema = z.object({
|
|
1919
1877
|
key: z.string(),
|
|
1920
1878
|
value: z.string(),
|
|
1921
1879
|
value_sensitivity: auditValueSensitivitySchema
|
|
1922
1880
|
});
|
|
1923
1881
|
|
|
1924
|
-
export const authDataPayloadSchema = z.object({
|
|
1925
|
-
user: userDetailsPayloadSchema,
|
|
1926
|
-
session_token: sessionTokenPayloadSchema
|
|
1927
|
-
});
|
|
1928
|
-
|
|
1929
1882
|
export const availableAuthProvidersPayloadSchema = z.object({
|
|
1930
1883
|
primary: z.array(z.string()),
|
|
1931
1884
|
secondary: z.array(z.string())
|
|
1932
1885
|
});
|
|
1933
1886
|
|
|
1934
|
-
export const managementAuthSettingsPayloadSchema = z.object({
|
|
1935
|
-
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
1936
|
-
max_total_identifiers: z.number(),
|
|
1937
|
-
max_email_identifiers: z.number(),
|
|
1938
|
-
max_phone_identifiers: z.number(),
|
|
1939
|
-
max_identifiers_per_external_provider: z.number(),
|
|
1940
|
-
max_active_sessions_for_open_user: z.number(),
|
|
1941
|
-
max_active_sessions_for_management_user: z.number(),
|
|
1942
|
-
access_token_validity_seconds: z.number(),
|
|
1943
|
-
refresh_token_validity_seconds: z.number(),
|
|
1944
|
-
account_deletion_grace_period_seconds: z.number(),
|
|
1945
|
-
account_deletion_check_interval_seconds: z.number(),
|
|
1946
|
-
is_registration_enabled: z.boolean(),
|
|
1947
|
-
open_email_restriction_policy: emailRestrictionPolicyPayloadSchema,
|
|
1948
|
-
management_email_restriction_policy: emailRestrictionPolicyPayloadSchema
|
|
1949
|
-
});
|
|
1950
|
-
|
|
1951
|
-
export const openAuthSettingsPayloadSchema = z.object({
|
|
1952
|
-
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
1953
|
-
max_total_identifiers: z.number(),
|
|
1954
|
-
max_email_identifiers: z.number(),
|
|
1955
|
-
max_phone_identifiers: z.number(),
|
|
1956
|
-
max_identifiers_per_external_provider: z.number(),
|
|
1957
|
-
is_registration_enabled: z.boolean()
|
|
1958
|
-
});
|
|
1959
|
-
|
|
1960
|
-
export const managementUserConfigurationPayloadSchema = z.object({
|
|
1961
|
-
management_global_settings: managementGlobalSettingsPayloadSchema,
|
|
1962
|
-
management_security_settings: managementSecuritySettingsPayloadSchema,
|
|
1963
|
-
management_auth_settings: managementAuthSettingsPayloadSchema
|
|
1964
|
-
});
|
|
1965
|
-
|
|
1966
|
-
export const openUserConfigurationPayloadSchema = z.object({
|
|
1967
|
-
open_global_settings: openGlobalSettingsPayloadSchema,
|
|
1968
|
-
open_security_settings: openSecuritySettingsPayloadSchema,
|
|
1969
|
-
open_auth_settings: openAuthSettingsPayloadSchema
|
|
1970
|
-
});
|
|
1971
|
-
|
|
1972
1887
|
export const emailRestrictionPolicyPayloadSchema = z.object({
|
|
1973
1888
|
is_blacklist_enabled: z.boolean(),
|
|
1974
1889
|
blacklist: z.array(z.string()),
|
|
@@ -1976,45 +1891,6 @@ is_whitelist_enabled: z.boolean(),
|
|
|
1976
1891
|
whitelist: z.array(z.string())
|
|
1977
1892
|
});
|
|
1978
1893
|
|
|
1979
|
-
export const userIdentifierPayloadSchema = z.object({
|
|
1980
|
-
id: userIdentifierIdSchema,
|
|
1981
|
-
user_id: userIdSchema,
|
|
1982
|
-
user_auth_provider: userAuthProviderSchema,
|
|
1983
|
-
identifier: z.string(),
|
|
1984
|
-
display_name: z.string(),
|
|
1985
|
-
external_provider_email: z.string().nullable(),
|
|
1986
|
-
is_sensitive_values_masked: z.boolean(),
|
|
1987
|
-
created_at: z.number(),
|
|
1988
|
-
updated_at: z.number().nullable()
|
|
1989
|
-
});
|
|
1990
|
-
|
|
1991
|
-
export const deletedSessionsPayloadSchema = z.object({
|
|
1992
|
-
deleted_session_ids: z.array(z.string())
|
|
1993
|
-
});
|
|
1994
|
-
|
|
1995
|
-
export const userSessionPayloadSchema = z.object({
|
|
1996
|
-
id: userSessionIdSchema,
|
|
1997
|
-
user_id: userIdSchema,
|
|
1998
|
-
user_role: userRoleSchema,
|
|
1999
|
-
identifier: z.string(),
|
|
2000
|
-
identifier_id: userIdentifierIdSchema,
|
|
2001
|
-
identifier_display_name: z.string(),
|
|
2002
|
-
identifier_auth_provider: userAuthProviderSchema,
|
|
2003
|
-
client_device_info: clientDeviceInfoPayloadSchema,
|
|
2004
|
-
user_agent: z.string().nullable(),
|
|
2005
|
-
ip_address: z.string().nullable(),
|
|
2006
|
-
expires_at: z.number(),
|
|
2007
|
-
last_accessed_at: z.number(),
|
|
2008
|
-
last_reauthenticated_at: z.number(),
|
|
2009
|
-
is_sensitive_values_masked: z.boolean(),
|
|
2010
|
-
created_at: z.number(),
|
|
2011
|
-
updated_at: z.number().nullable()
|
|
2012
|
-
});
|
|
2013
|
-
|
|
2014
|
-
export const refreshTokenPayloadSchema = z.object({
|
|
2015
|
-
refresh_token: z.string()
|
|
2016
|
-
});
|
|
2017
|
-
|
|
2018
1894
|
export const sessionTokenPayloadSchema = z.object({
|
|
2019
1895
|
access_token: z.string(),
|
|
2020
1896
|
refresh_token: z.string(),
|
|
@@ -2047,6 +1923,41 @@ role: userRoleSchema,
|
|
|
2047
1923
|
account_status: userAccountStatusSchema
|
|
2048
1924
|
});
|
|
2049
1925
|
|
|
1926
|
+
export const userIdentifierPayloadSchema = z.object({
|
|
1927
|
+
id: userIdentifierIdSchema,
|
|
1928
|
+
user_id: userIdSchema,
|
|
1929
|
+
user_auth_provider: userAuthProviderSchema,
|
|
1930
|
+
identifier: z.string(),
|
|
1931
|
+
display_name: z.string(),
|
|
1932
|
+
external_provider_email: z.string().nullable(),
|
|
1933
|
+
is_sensitive_values_masked: z.boolean(),
|
|
1934
|
+
created_at: z.number(),
|
|
1935
|
+
updated_at: z.number().nullable()
|
|
1936
|
+
});
|
|
1937
|
+
|
|
1938
|
+
export const deletedSessionsPayloadSchema = z.object({
|
|
1939
|
+
deleted_session_ids: z.array(z.string())
|
|
1940
|
+
});
|
|
1941
|
+
|
|
1942
|
+
export const refreshTokenPayloadSchema = z.object({
|
|
1943
|
+
refresh_token: z.string()
|
|
1944
|
+
});
|
|
1945
|
+
|
|
1946
|
+
export const totpRecoveryCodesPayloadSchema = z.object({
|
|
1947
|
+
totp_recovery_codes: z.array(z.string())
|
|
1948
|
+
});
|
|
1949
|
+
|
|
1950
|
+
export const totpSetupPayloadSchema = z.object({
|
|
1951
|
+
totp_secret_key: z.string(),
|
|
1952
|
+
totp_otp_auth_url: z.string(),
|
|
1953
|
+
mfa_token: z.string()
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
export const verifyTotpPayloadSchema = z.object({
|
|
1957
|
+
mfa_token: z.string(),
|
|
1958
|
+
totp_code: z.string()
|
|
1959
|
+
});
|
|
1960
|
+
|
|
2050
1961
|
export const socketFrameSchema = z.object({
|
|
2051
1962
|
id: userIdSchema,
|
|
2052
1963
|
type: z.string(),
|
|
@@ -2065,6 +1976,109 @@ operation_system_version: z.string().nullable(),
|
|
|
2065
1976
|
api_version: z.string().nullable()
|
|
2066
1977
|
});
|
|
2067
1978
|
|
|
1979
|
+
export const clientInfoPayloadSchema = z.object({
|
|
1980
|
+
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1981
|
+
user_agent: z.string().nullable(),
|
|
1982
|
+
ip_address: z.string().nullable(),
|
|
1983
|
+
api_version: z.string().nullable()
|
|
1984
|
+
});
|
|
1985
|
+
|
|
1986
|
+
export const userSessionPayloadSchema = z.object({
|
|
1987
|
+
id: userSessionIdSchema,
|
|
1988
|
+
user_id: userIdSchema,
|
|
1989
|
+
user_role: userRoleSchema,
|
|
1990
|
+
identifier: z.string(),
|
|
1991
|
+
identifier_id: userIdentifierIdSchema,
|
|
1992
|
+
identifier_display_name: z.string(),
|
|
1993
|
+
identifier_auth_provider: userAuthProviderSchema,
|
|
1994
|
+
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1995
|
+
user_agent: z.string().nullable(),
|
|
1996
|
+
ip_address: z.string().nullable(),
|
|
1997
|
+
expires_at: z.number(),
|
|
1998
|
+
last_accessed_at: z.number(),
|
|
1999
|
+
last_reauthenticated_at: z.number(),
|
|
2000
|
+
is_sensitive_values_masked: z.boolean(),
|
|
2001
|
+
created_at: z.number(),
|
|
2002
|
+
updated_at: z.number().nullable()
|
|
2003
|
+
});
|
|
2004
|
+
|
|
2005
|
+
export const auditEventPayloadSchema = z.object({
|
|
2006
|
+
id: auditEventIdSchema,
|
|
2007
|
+
actor_id: userIdSchema.nullable(),
|
|
2008
|
+
actor_type: auditActorTypeSchema,
|
|
2009
|
+
actor_user_role: userRoleSchema.nullable(),
|
|
2010
|
+
action: z.string(),
|
|
2011
|
+
resource: z.string(),
|
|
2012
|
+
resource_id: z.string().nullable(),
|
|
2013
|
+
status: auditStatusSchema,
|
|
2014
|
+
metadata: z.array(auditEventMetadataPayloadSchema),
|
|
2015
|
+
message: z.string().nullable(),
|
|
2016
|
+
created_at: z.number()
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
export const authDataPayloadSchema = z.object({
|
|
2020
|
+
user: userDetailsPayloadSchema,
|
|
2021
|
+
session_token: sessionTokenPayloadSchema
|
|
2022
|
+
});
|
|
2023
|
+
|
|
2024
|
+
export const managementAuthSettingsPayloadSchema = z.object({
|
|
2025
|
+
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
2026
|
+
max_total_identifiers: z.number(),
|
|
2027
|
+
max_email_identifiers: z.number(),
|
|
2028
|
+
max_phone_identifiers: z.number(),
|
|
2029
|
+
max_identifiers_per_external_provider: z.number(),
|
|
2030
|
+
max_active_sessions_for_open_user: z.number(),
|
|
2031
|
+
max_active_sessions_for_management_user: z.number(),
|
|
2032
|
+
access_token_validity_seconds: z.number(),
|
|
2033
|
+
refresh_token_validity_seconds: z.number(),
|
|
2034
|
+
account_deletion_grace_period_seconds: z.number(),
|
|
2035
|
+
account_deletion_check_interval_seconds: z.number(),
|
|
2036
|
+
is_registration_enabled: z.boolean(),
|
|
2037
|
+
open_email_restriction_policy: emailRestrictionPolicyPayloadSchema,
|
|
2038
|
+
management_email_restriction_policy: emailRestrictionPolicyPayloadSchema
|
|
2039
|
+
});
|
|
2040
|
+
|
|
2041
|
+
export const openAuthSettingsPayloadSchema = z.object({
|
|
2042
|
+
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
2043
|
+
max_total_identifiers: z.number(),
|
|
2044
|
+
max_email_identifiers: z.number(),
|
|
2045
|
+
max_phone_identifiers: z.number(),
|
|
2046
|
+
max_identifiers_per_external_provider: z.number(),
|
|
2047
|
+
is_registration_enabled: z.boolean()
|
|
2048
|
+
});
|
|
2049
|
+
|
|
2050
|
+
export const managementSecuritySettingsPayloadSchema = z.object({
|
|
2051
|
+
recent_authentication_validity_seconds_for_open_user: z.number(),
|
|
2052
|
+
recent_authentication_validity_seconds_for_management_user: z.number(),
|
|
2053
|
+
management_password_policy: managementPasswordPolicyPayloadSchema,
|
|
2054
|
+
otp_confirmation: otpConfirmationPayloadSchema,
|
|
2055
|
+
account_lockout_policy: accountLockoutPolicyPayloadSchema,
|
|
2056
|
+
account_lockout_check_interval_seconds: z.number(),
|
|
2057
|
+
open_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
2058
|
+
management_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
2059
|
+
expiration_seconds: z.number(),
|
|
2060
|
+
max_requests_per_period: z.number(),
|
|
2061
|
+
rate_limit_period_seconds: z.number(),
|
|
2062
|
+
refresh_token_rotation_grace_period_seconds: z.number()
|
|
2063
|
+
});
|
|
2064
|
+
|
|
2065
|
+
export const openSecuritySettingsPayloadSchema = z.object({
|
|
2066
|
+
open_password_policy: openPasswordPolicyPayloadSchema,
|
|
2067
|
+
otp_confirmation: otpConfirmationPayloadSchema
|
|
2068
|
+
});
|
|
2069
|
+
|
|
2070
|
+
export const managementUserConfigurationPayloadSchema = z.object({
|
|
2071
|
+
management_global_settings: managementGlobalSettingsPayloadSchema,
|
|
2072
|
+
management_security_settings: managementSecuritySettingsPayloadSchema,
|
|
2073
|
+
management_auth_settings: managementAuthSettingsPayloadSchema
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
export const openUserConfigurationPayloadSchema = z.object({
|
|
2077
|
+
open_global_settings: openGlobalSettingsPayloadSchema,
|
|
2078
|
+
open_security_settings: openSecuritySettingsPayloadSchema,
|
|
2079
|
+
open_auth_settings: openAuthSettingsPayloadSchema
|
|
2080
|
+
});
|
|
2081
|
+
|
|
2068
2082
|
export const createByEmailRequestSchema = z.object({
|
|
2069
2083
|
email: z.string(),
|
|
2070
2084
|
password: z.string().nullable(),
|
package/index.mjs
CHANGED
|
@@ -295,11 +295,16 @@ export const refreshTokenHashSchema = z.string().transform((val, ctx) => {
|
|
|
295
295
|
|
|
296
296
|
fromValueOrThrow(value) {
|
|
297
297
|
for (const parse of this.auditActionTypes) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
298
|
+
if (typeof parse === 'function') {
|
|
299
|
+
const result = parse(value);
|
|
300
|
+
if (result !== null && result !== undefined) return result;
|
|
301
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
302
|
+
const result = parse.parseOrNull(value);
|
|
303
|
+
if (result !== null && result !== undefined) return result;
|
|
304
|
+
} else if (parse && typeof parse === 'object') {
|
|
305
|
+
// Support passing the enum object directly (e.g. UserAuditActionType)
|
|
306
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
307
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
303
308
|
}
|
|
304
309
|
}
|
|
305
310
|
throw new Error("Unknown value of AuditActionType: '" + value + "'");
|
|
@@ -313,11 +318,15 @@ export class CompositeAuditMetadataKeyParser {
|
|
|
313
318
|
|
|
314
319
|
fromValueOrThrow(value) {
|
|
315
320
|
for (const parse of this.metadataKeys) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (
|
|
320
|
-
|
|
321
|
+
if (typeof parse === 'function') {
|
|
322
|
+
const result = parse(value);
|
|
323
|
+
if (result !== null && result !== undefined) return result;
|
|
324
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
325
|
+
const result = parse.parseOrNull(value);
|
|
326
|
+
if (result !== null && result !== undefined) return result;
|
|
327
|
+
} else if (parse && typeof parse === 'object') {
|
|
328
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
329
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
throw new Error("Unknown value of AuditMetadataKey: '" + value + "'");
|
|
@@ -331,11 +340,15 @@ export class CompositeAuditResourceTypeParser {
|
|
|
331
340
|
|
|
332
341
|
fromValueOrThrow(value) {
|
|
333
342
|
for (const parse of this.auditResourceTypes) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (
|
|
338
|
-
|
|
343
|
+
if (typeof parse === 'function') {
|
|
344
|
+
const result = parse(value);
|
|
345
|
+
if (result !== null && result !== undefined) return result;
|
|
346
|
+
} else if (parse && typeof parse.parseOrNull === 'function') {
|
|
347
|
+
const result = parse.parseOrNull(value);
|
|
348
|
+
if (result !== null && result !== undefined) return result;
|
|
349
|
+
} else if (parse && typeof parse === 'object') {
|
|
350
|
+
const matchedValue = Object.values(parse).find(val => val === value);
|
|
351
|
+
if (matchedValue !== undefined) return matchedValue;
|
|
339
352
|
}
|
|
340
353
|
}
|
|
341
354
|
throw new Error("Unknown value of AuditResourceType: '" + value + "'");
|
|
@@ -1220,45 +1233,46 @@ contact_support_email: domain.contactSupportEmail,
|
|
|
1220
1233
|
min_supported_app_versions: domain.minSupportedAppVersions
|
|
1221
1234
|
});
|
|
1222
1235
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
actorId: payload.
|
|
1226
|
-
actorType: payload.
|
|
1227
|
-
actorUserRole: payload.
|
|
1228
|
-
action: payload.action,
|
|
1229
|
-
resource: payload.resource,
|
|
1230
|
-
resourceId: payload.
|
|
1231
|
-
resourceValueSensitivity:
|
|
1232
|
-
status: payload.status,
|
|
1233
|
-
metadata: payload.metadata ? payload.metadata.map(val => toAuditEventMetadata(val)) : [],
|
|
1234
|
-
message: payload.message,
|
|
1235
|
-
createdAt: payload.
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
action: domain.action,
|
|
1244
|
-
resource: domain.resource,
|
|
1245
|
-
|
|
1246
|
-
status: domain.status,
|
|
1247
|
-
metadata: domain.metadata ? domain.metadata.map(val => toAuditEventMetadataPayload(val)) : [],
|
|
1248
|
-
message: domain.message,
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
value: payload.value
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1236
|
+
export const toAuditEvent = (payload, actionTypeParser, resourceTypeParser, metadataKeyParser) => ({
|
|
1237
|
+
id: toAuditEventIdOrThrow(payload.id),
|
|
1238
|
+
actorId: payload.actorId,
|
|
1239
|
+
actorType: payload.actorType,
|
|
1240
|
+
actorUserRole: payload.actorUserRole,
|
|
1241
|
+
action: actionTypeParser.fromValueOrThrow(payload.action),
|
|
1242
|
+
resource: resourceTypeParser.fromValueOrThrow(payload.resource),
|
|
1243
|
+
resourceId: payload.resourceId,
|
|
1244
|
+
resourceValueSensitivity: 'non_sensitive',
|
|
1245
|
+
status: payload.status,
|
|
1246
|
+
metadata: payload.metadata ? payload.metadata.map(val => toAuditEventMetadata(val, metadataKeyParser)) : [],
|
|
1247
|
+
message: payload.message,
|
|
1248
|
+
createdAt: payload.createdAt
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
export const toAuditEventPayload = (domain) => ({
|
|
1252
|
+
id: domain.id,
|
|
1253
|
+
actorId: domain.actorId,
|
|
1254
|
+
actorType: domain.actorType,
|
|
1255
|
+
actorUserRole: domain.actorUserRole,
|
|
1256
|
+
action: domain.action,
|
|
1257
|
+
resource: domain.resource,
|
|
1258
|
+
resourceId: domain.resourceId,
|
|
1259
|
+
status: domain.status,
|
|
1260
|
+
metadata: domain.metadata ? domain.metadata.map(val => toAuditEventMetadataPayload(val)) : [],
|
|
1261
|
+
message: domain.message,
|
|
1262
|
+
createdAt: domain.createdAt
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
export const toAuditEventMetadata = (payload, metadataKeyParser) => ({
|
|
1266
|
+
key: metadataKeyParser.fromValueOrThrow(payload.key),
|
|
1267
|
+
value: payload.value,
|
|
1268
|
+
valueSensitivity: payload.valueSensitivity
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
export const toAuditEventMetadataPayload = (domain) => ({
|
|
1272
|
+
key: domain.key,
|
|
1273
|
+
value: domain.value,
|
|
1274
|
+
valueSensitivity: domain.valueSensitivity
|
|
1275
|
+
});
|
|
1262
1276
|
|
|
1263
1277
|
export const toAuthData = (payload) => ({
|
|
1264
1278
|
userDetails: toUserDetails(payload.user),
|
|
@@ -1791,13 +1805,6 @@ message: z.string(),
|
|
|
1791
1805
|
args: z.record(z.string(), z.string())
|
|
1792
1806
|
});
|
|
1793
1807
|
|
|
1794
|
-
export const clientInfoPayloadSchema = z.object({
|
|
1795
|
-
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1796
|
-
user_agent: z.string().nullable(),
|
|
1797
|
-
ip_address: z.string().nullable(),
|
|
1798
|
-
api_version: z.string().nullable()
|
|
1799
|
-
});
|
|
1800
|
-
|
|
1801
1808
|
export const clientDeviceInfoPayloadSchema = z.object({
|
|
1802
1809
|
client_type: clientTypeSchema.nullable(),
|
|
1803
1810
|
language: z.string().nullable(),
|
|
@@ -1849,41 +1856,6 @@ require_digit: z.boolean(),
|
|
|
1849
1856
|
require_special_char: z.boolean()
|
|
1850
1857
|
});
|
|
1851
1858
|
|
|
1852
|
-
export const managementSecuritySettingsPayloadSchema = z.object({
|
|
1853
|
-
recent_authentication_validity_seconds_for_open_user: z.number(),
|
|
1854
|
-
recent_authentication_validity_seconds_for_management_user: z.number(),
|
|
1855
|
-
management_password_policy: managementPasswordPolicyPayloadSchema,
|
|
1856
|
-
otp_confirmation: otpConfirmationPayloadSchema,
|
|
1857
|
-
account_lockout_policy: accountLockoutPolicyPayloadSchema,
|
|
1858
|
-
account_lockout_check_interval_seconds: z.number(),
|
|
1859
|
-
open_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
1860
|
-
management_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
1861
|
-
expiration_seconds: z.number(),
|
|
1862
|
-
max_requests_per_period: z.number(),
|
|
1863
|
-
rate_limit_period_seconds: z.number(),
|
|
1864
|
-
refresh_token_rotation_grace_period_seconds: z.number()
|
|
1865
|
-
});
|
|
1866
|
-
|
|
1867
|
-
export const openSecuritySettingsPayloadSchema = z.object({
|
|
1868
|
-
open_password_policy: openPasswordPolicyPayloadSchema,
|
|
1869
|
-
otp_confirmation: otpConfirmationPayloadSchema
|
|
1870
|
-
});
|
|
1871
|
-
|
|
1872
|
-
export const totpRecoveryCodesPayloadSchema = z.object({
|
|
1873
|
-
totp_recovery_codes: z.array(z.string())
|
|
1874
|
-
});
|
|
1875
|
-
|
|
1876
|
-
export const totpSetupPayloadSchema = z.object({
|
|
1877
|
-
totp_secret_key: z.string(),
|
|
1878
|
-
totp_otp_auth_url: z.string(),
|
|
1879
|
-
mfa_token: z.string()
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
|
-
export const verifyTotpPayloadSchema = z.object({
|
|
1883
|
-
mfa_token: z.string(),
|
|
1884
|
-
totp_code: z.string()
|
|
1885
|
-
});
|
|
1886
|
-
|
|
1887
1859
|
export const managementGlobalSettingsPayloadSchema = z.object({
|
|
1888
1860
|
privacy_policy_url: z.string().nullable(),
|
|
1889
1861
|
terms_of_service_url: z.string().nullable(),
|
|
@@ -1901,74 +1873,17 @@ contact_support_email: z.string().nullable(),
|
|
|
1901
1873
|
min_supported_app_versions: z.record(z.string(), z.string())
|
|
1902
1874
|
});
|
|
1903
1875
|
|
|
1904
|
-
export const auditEventPayloadSchema = z.object({
|
|
1905
|
-
id: auditEventIdSchema,
|
|
1906
|
-
actor_id: userIdSchema.nullable(),
|
|
1907
|
-
actor_type: auditActorTypeSchema,
|
|
1908
|
-
actor_user_role: userRoleSchema.nullable(),
|
|
1909
|
-
action: z.string(),
|
|
1910
|
-
resource: z.string(),
|
|
1911
|
-
resource_id: z.string().nullable(),
|
|
1912
|
-
status: auditStatusSchema,
|
|
1913
|
-
metadata: z.array(auditEventMetadataPayloadSchema),
|
|
1914
|
-
message: z.string().nullable(),
|
|
1915
|
-
created_at: z.number()
|
|
1916
|
-
});
|
|
1917
|
-
|
|
1918
1876
|
export const auditEventMetadataPayloadSchema = z.object({
|
|
1919
1877
|
key: z.string(),
|
|
1920
1878
|
value: z.string(),
|
|
1921
1879
|
value_sensitivity: auditValueSensitivitySchema
|
|
1922
1880
|
});
|
|
1923
1881
|
|
|
1924
|
-
export const authDataPayloadSchema = z.object({
|
|
1925
|
-
user: userDetailsPayloadSchema,
|
|
1926
|
-
session_token: sessionTokenPayloadSchema
|
|
1927
|
-
});
|
|
1928
|
-
|
|
1929
1882
|
export const availableAuthProvidersPayloadSchema = z.object({
|
|
1930
1883
|
primary: z.array(z.string()),
|
|
1931
1884
|
secondary: z.array(z.string())
|
|
1932
1885
|
});
|
|
1933
1886
|
|
|
1934
|
-
export const managementAuthSettingsPayloadSchema = z.object({
|
|
1935
|
-
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
1936
|
-
max_total_identifiers: z.number(),
|
|
1937
|
-
max_email_identifiers: z.number(),
|
|
1938
|
-
max_phone_identifiers: z.number(),
|
|
1939
|
-
max_identifiers_per_external_provider: z.number(),
|
|
1940
|
-
max_active_sessions_for_open_user: z.number(),
|
|
1941
|
-
max_active_sessions_for_management_user: z.number(),
|
|
1942
|
-
access_token_validity_seconds: z.number(),
|
|
1943
|
-
refresh_token_validity_seconds: z.number(),
|
|
1944
|
-
account_deletion_grace_period_seconds: z.number(),
|
|
1945
|
-
account_deletion_check_interval_seconds: z.number(),
|
|
1946
|
-
is_registration_enabled: z.boolean(),
|
|
1947
|
-
open_email_restriction_policy: emailRestrictionPolicyPayloadSchema,
|
|
1948
|
-
management_email_restriction_policy: emailRestrictionPolicyPayloadSchema
|
|
1949
|
-
});
|
|
1950
|
-
|
|
1951
|
-
export const openAuthSettingsPayloadSchema = z.object({
|
|
1952
|
-
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
1953
|
-
max_total_identifiers: z.number(),
|
|
1954
|
-
max_email_identifiers: z.number(),
|
|
1955
|
-
max_phone_identifiers: z.number(),
|
|
1956
|
-
max_identifiers_per_external_provider: z.number(),
|
|
1957
|
-
is_registration_enabled: z.boolean()
|
|
1958
|
-
});
|
|
1959
|
-
|
|
1960
|
-
export const managementUserConfigurationPayloadSchema = z.object({
|
|
1961
|
-
management_global_settings: managementGlobalSettingsPayloadSchema,
|
|
1962
|
-
management_security_settings: managementSecuritySettingsPayloadSchema,
|
|
1963
|
-
management_auth_settings: managementAuthSettingsPayloadSchema
|
|
1964
|
-
});
|
|
1965
|
-
|
|
1966
|
-
export const openUserConfigurationPayloadSchema = z.object({
|
|
1967
|
-
open_global_settings: openGlobalSettingsPayloadSchema,
|
|
1968
|
-
open_security_settings: openSecuritySettingsPayloadSchema,
|
|
1969
|
-
open_auth_settings: openAuthSettingsPayloadSchema
|
|
1970
|
-
});
|
|
1971
|
-
|
|
1972
1887
|
export const emailRestrictionPolicyPayloadSchema = z.object({
|
|
1973
1888
|
is_blacklist_enabled: z.boolean(),
|
|
1974
1889
|
blacklist: z.array(z.string()),
|
|
@@ -1976,45 +1891,6 @@ is_whitelist_enabled: z.boolean(),
|
|
|
1976
1891
|
whitelist: z.array(z.string())
|
|
1977
1892
|
});
|
|
1978
1893
|
|
|
1979
|
-
export const userIdentifierPayloadSchema = z.object({
|
|
1980
|
-
id: userIdentifierIdSchema,
|
|
1981
|
-
user_id: userIdSchema,
|
|
1982
|
-
user_auth_provider: userAuthProviderSchema,
|
|
1983
|
-
identifier: z.string(),
|
|
1984
|
-
display_name: z.string(),
|
|
1985
|
-
external_provider_email: z.string().nullable(),
|
|
1986
|
-
is_sensitive_values_masked: z.boolean(),
|
|
1987
|
-
created_at: z.number(),
|
|
1988
|
-
updated_at: z.number().nullable()
|
|
1989
|
-
});
|
|
1990
|
-
|
|
1991
|
-
export const deletedSessionsPayloadSchema = z.object({
|
|
1992
|
-
deleted_session_ids: z.array(z.string())
|
|
1993
|
-
});
|
|
1994
|
-
|
|
1995
|
-
export const userSessionPayloadSchema = z.object({
|
|
1996
|
-
id: userSessionIdSchema,
|
|
1997
|
-
user_id: userIdSchema,
|
|
1998
|
-
user_role: userRoleSchema,
|
|
1999
|
-
identifier: z.string(),
|
|
2000
|
-
identifier_id: userIdentifierIdSchema,
|
|
2001
|
-
identifier_display_name: z.string(),
|
|
2002
|
-
identifier_auth_provider: userAuthProviderSchema,
|
|
2003
|
-
client_device_info: clientDeviceInfoPayloadSchema,
|
|
2004
|
-
user_agent: z.string().nullable(),
|
|
2005
|
-
ip_address: z.string().nullable(),
|
|
2006
|
-
expires_at: z.number(),
|
|
2007
|
-
last_accessed_at: z.number(),
|
|
2008
|
-
last_reauthenticated_at: z.number(),
|
|
2009
|
-
is_sensitive_values_masked: z.boolean(),
|
|
2010
|
-
created_at: z.number(),
|
|
2011
|
-
updated_at: z.number().nullable()
|
|
2012
|
-
});
|
|
2013
|
-
|
|
2014
|
-
export const refreshTokenPayloadSchema = z.object({
|
|
2015
|
-
refresh_token: z.string()
|
|
2016
|
-
});
|
|
2017
|
-
|
|
2018
1894
|
export const sessionTokenPayloadSchema = z.object({
|
|
2019
1895
|
access_token: z.string(),
|
|
2020
1896
|
refresh_token: z.string(),
|
|
@@ -2047,6 +1923,41 @@ role: userRoleSchema,
|
|
|
2047
1923
|
account_status: userAccountStatusSchema
|
|
2048
1924
|
});
|
|
2049
1925
|
|
|
1926
|
+
export const userIdentifierPayloadSchema = z.object({
|
|
1927
|
+
id: userIdentifierIdSchema,
|
|
1928
|
+
user_id: userIdSchema,
|
|
1929
|
+
user_auth_provider: userAuthProviderSchema,
|
|
1930
|
+
identifier: z.string(),
|
|
1931
|
+
display_name: z.string(),
|
|
1932
|
+
external_provider_email: z.string().nullable(),
|
|
1933
|
+
is_sensitive_values_masked: z.boolean(),
|
|
1934
|
+
created_at: z.number(),
|
|
1935
|
+
updated_at: z.number().nullable()
|
|
1936
|
+
});
|
|
1937
|
+
|
|
1938
|
+
export const deletedSessionsPayloadSchema = z.object({
|
|
1939
|
+
deleted_session_ids: z.array(z.string())
|
|
1940
|
+
});
|
|
1941
|
+
|
|
1942
|
+
export const refreshTokenPayloadSchema = z.object({
|
|
1943
|
+
refresh_token: z.string()
|
|
1944
|
+
});
|
|
1945
|
+
|
|
1946
|
+
export const totpRecoveryCodesPayloadSchema = z.object({
|
|
1947
|
+
totp_recovery_codes: z.array(z.string())
|
|
1948
|
+
});
|
|
1949
|
+
|
|
1950
|
+
export const totpSetupPayloadSchema = z.object({
|
|
1951
|
+
totp_secret_key: z.string(),
|
|
1952
|
+
totp_otp_auth_url: z.string(),
|
|
1953
|
+
mfa_token: z.string()
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
export const verifyTotpPayloadSchema = z.object({
|
|
1957
|
+
mfa_token: z.string(),
|
|
1958
|
+
totp_code: z.string()
|
|
1959
|
+
});
|
|
1960
|
+
|
|
2050
1961
|
export const socketFrameSchema = z.object({
|
|
2051
1962
|
id: userIdSchema,
|
|
2052
1963
|
type: z.string(),
|
|
@@ -2065,6 +1976,109 @@ operation_system_version: z.string().nullable(),
|
|
|
2065
1976
|
api_version: z.string().nullable()
|
|
2066
1977
|
});
|
|
2067
1978
|
|
|
1979
|
+
export const clientInfoPayloadSchema = z.object({
|
|
1980
|
+
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1981
|
+
user_agent: z.string().nullable(),
|
|
1982
|
+
ip_address: z.string().nullable(),
|
|
1983
|
+
api_version: z.string().nullable()
|
|
1984
|
+
});
|
|
1985
|
+
|
|
1986
|
+
export const userSessionPayloadSchema = z.object({
|
|
1987
|
+
id: userSessionIdSchema,
|
|
1988
|
+
user_id: userIdSchema,
|
|
1989
|
+
user_role: userRoleSchema,
|
|
1990
|
+
identifier: z.string(),
|
|
1991
|
+
identifier_id: userIdentifierIdSchema,
|
|
1992
|
+
identifier_display_name: z.string(),
|
|
1993
|
+
identifier_auth_provider: userAuthProviderSchema,
|
|
1994
|
+
client_device_info: clientDeviceInfoPayloadSchema,
|
|
1995
|
+
user_agent: z.string().nullable(),
|
|
1996
|
+
ip_address: z.string().nullable(),
|
|
1997
|
+
expires_at: z.number(),
|
|
1998
|
+
last_accessed_at: z.number(),
|
|
1999
|
+
last_reauthenticated_at: z.number(),
|
|
2000
|
+
is_sensitive_values_masked: z.boolean(),
|
|
2001
|
+
created_at: z.number(),
|
|
2002
|
+
updated_at: z.number().nullable()
|
|
2003
|
+
});
|
|
2004
|
+
|
|
2005
|
+
export const auditEventPayloadSchema = z.object({
|
|
2006
|
+
id: auditEventIdSchema,
|
|
2007
|
+
actor_id: userIdSchema.nullable(),
|
|
2008
|
+
actor_type: auditActorTypeSchema,
|
|
2009
|
+
actor_user_role: userRoleSchema.nullable(),
|
|
2010
|
+
action: z.string(),
|
|
2011
|
+
resource: z.string(),
|
|
2012
|
+
resource_id: z.string().nullable(),
|
|
2013
|
+
status: auditStatusSchema,
|
|
2014
|
+
metadata: z.array(auditEventMetadataPayloadSchema),
|
|
2015
|
+
message: z.string().nullable(),
|
|
2016
|
+
created_at: z.number()
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
export const authDataPayloadSchema = z.object({
|
|
2020
|
+
user: userDetailsPayloadSchema,
|
|
2021
|
+
session_token: sessionTokenPayloadSchema
|
|
2022
|
+
});
|
|
2023
|
+
|
|
2024
|
+
export const managementAuthSettingsPayloadSchema = z.object({
|
|
2025
|
+
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
2026
|
+
max_total_identifiers: z.number(),
|
|
2027
|
+
max_email_identifiers: z.number(),
|
|
2028
|
+
max_phone_identifiers: z.number(),
|
|
2029
|
+
max_identifiers_per_external_provider: z.number(),
|
|
2030
|
+
max_active_sessions_for_open_user: z.number(),
|
|
2031
|
+
max_active_sessions_for_management_user: z.number(),
|
|
2032
|
+
access_token_validity_seconds: z.number(),
|
|
2033
|
+
refresh_token_validity_seconds: z.number(),
|
|
2034
|
+
account_deletion_grace_period_seconds: z.number(),
|
|
2035
|
+
account_deletion_check_interval_seconds: z.number(),
|
|
2036
|
+
is_registration_enabled: z.boolean(),
|
|
2037
|
+
open_email_restriction_policy: emailRestrictionPolicyPayloadSchema,
|
|
2038
|
+
management_email_restriction_policy: emailRestrictionPolicyPayloadSchema
|
|
2039
|
+
});
|
|
2040
|
+
|
|
2041
|
+
export const openAuthSettingsPayloadSchema = z.object({
|
|
2042
|
+
available_auth_providers: availableAuthProvidersPayloadSchema,
|
|
2043
|
+
max_total_identifiers: z.number(),
|
|
2044
|
+
max_email_identifiers: z.number(),
|
|
2045
|
+
max_phone_identifiers: z.number(),
|
|
2046
|
+
max_identifiers_per_external_provider: z.number(),
|
|
2047
|
+
is_registration_enabled: z.boolean()
|
|
2048
|
+
});
|
|
2049
|
+
|
|
2050
|
+
export const managementSecuritySettingsPayloadSchema = z.object({
|
|
2051
|
+
recent_authentication_validity_seconds_for_open_user: z.number(),
|
|
2052
|
+
recent_authentication_validity_seconds_for_management_user: z.number(),
|
|
2053
|
+
management_password_policy: managementPasswordPolicyPayloadSchema,
|
|
2054
|
+
otp_confirmation: otpConfirmationPayloadSchema,
|
|
2055
|
+
account_lockout_policy: accountLockoutPolicyPayloadSchema,
|
|
2056
|
+
account_lockout_check_interval_seconds: z.number(),
|
|
2057
|
+
open_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
2058
|
+
management_ip_restriction_policy: ipRestrictionPolicyPayloadSchema,
|
|
2059
|
+
expiration_seconds: z.number(),
|
|
2060
|
+
max_requests_per_period: z.number(),
|
|
2061
|
+
rate_limit_period_seconds: z.number(),
|
|
2062
|
+
refresh_token_rotation_grace_period_seconds: z.number()
|
|
2063
|
+
});
|
|
2064
|
+
|
|
2065
|
+
export const openSecuritySettingsPayloadSchema = z.object({
|
|
2066
|
+
open_password_policy: openPasswordPolicyPayloadSchema,
|
|
2067
|
+
otp_confirmation: otpConfirmationPayloadSchema
|
|
2068
|
+
});
|
|
2069
|
+
|
|
2070
|
+
export const managementUserConfigurationPayloadSchema = z.object({
|
|
2071
|
+
management_global_settings: managementGlobalSettingsPayloadSchema,
|
|
2072
|
+
management_security_settings: managementSecuritySettingsPayloadSchema,
|
|
2073
|
+
management_auth_settings: managementAuthSettingsPayloadSchema
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
export const openUserConfigurationPayloadSchema = z.object({
|
|
2077
|
+
open_global_settings: openGlobalSettingsPayloadSchema,
|
|
2078
|
+
open_security_settings: openSecuritySettingsPayloadSchema,
|
|
2079
|
+
open_auth_settings: openAuthSettingsPayloadSchema
|
|
2080
|
+
});
|
|
2081
|
+
|
|
2068
2082
|
export const createByEmailRequestSchema = z.object({
|
|
2069
2083
|
email: z.string(),
|
|
2070
2084
|
password: z.string().nullable(),
|