@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.
- package/README.md +4 -1
- package/index.d.ts +1083 -52
- package/index.js +1311 -17
- package/index.mjs +1311 -17
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -144,6 +144,204 @@ export const clientDeviceIdSchema = z.string().transform((val, ctx) => {
|
|
|
144
144
|
return result;
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
+
export function toDecryptedStringOrNull(value) {
|
|
148
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function toDecryptedStringOrThrow(value) {
|
|
155
|
+
const result = toDecryptedStringOrNull(value);
|
|
156
|
+
if (!result) {
|
|
157
|
+
throw new Error('DecryptedString value must not be blank.');
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const decryptedStringSchema = z.string().transform((val, ctx) => {
|
|
163
|
+
const result = toDecryptedStringOrNull(val);
|
|
164
|
+
if (!result) {
|
|
165
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid DecryptedString' });
|
|
166
|
+
return z.NEVER;
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export function toEncryptedStringOrNull(value) {
|
|
172
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function toEncryptedStringOrThrow(value) {
|
|
179
|
+
const result = toEncryptedStringOrNull(value);
|
|
180
|
+
if (!result) {
|
|
181
|
+
throw new Error('EncryptedString value must not be blank.');
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const encryptedStringSchema = z.string().transform((val, ctx) => {
|
|
187
|
+
const result = toEncryptedStringOrNull(val);
|
|
188
|
+
if (!result) {
|
|
189
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid EncryptedString' });
|
|
190
|
+
return z.NEVER;
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export function toPasswordHashOrNull(value) {
|
|
196
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function toPasswordHashOrThrow(value) {
|
|
203
|
+
const result = toPasswordHashOrNull(value);
|
|
204
|
+
if (!result) {
|
|
205
|
+
throw new Error('PasswordHash value must not be blank.');
|
|
206
|
+
}
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const passwordHashSchema = z.string().transform((val, ctx) => {
|
|
211
|
+
const result = toPasswordHashOrNull(val);
|
|
212
|
+
if (!result) {
|
|
213
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid PasswordHash' });
|
|
214
|
+
return z.NEVER;
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
export function toAccessTokenOrNull(value) {
|
|
220
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
return value;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function toAccessTokenOrThrow(value) {
|
|
227
|
+
const result = toAccessTokenOrNull(value);
|
|
228
|
+
if (!result) {
|
|
229
|
+
throw new Error('AccessToken value must not be blank.');
|
|
230
|
+
}
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const accessTokenSchema = z.string().transform((val, ctx) => {
|
|
235
|
+
const result = toAccessTokenOrNull(val);
|
|
236
|
+
if (!result) {
|
|
237
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid AccessToken' });
|
|
238
|
+
return z.NEVER;
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export function toRefreshTokenOrNull(value) {
|
|
244
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
return value;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function toRefreshTokenOrThrow(value) {
|
|
251
|
+
const result = toRefreshTokenOrNull(value);
|
|
252
|
+
if (!result) {
|
|
253
|
+
throw new Error('RefreshToken value must not be blank.');
|
|
254
|
+
}
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export const refreshTokenSchema = z.string().transform((val, ctx) => {
|
|
259
|
+
const result = toRefreshTokenOrNull(val);
|
|
260
|
+
if (!result) {
|
|
261
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid RefreshToken' });
|
|
262
|
+
return z.NEVER;
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
export function toRefreshTokenHashOrNull(value) {
|
|
268
|
+
if (!value || typeof value !== 'string' || value.trim() === '') {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
return value;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function toRefreshTokenHashOrThrow(value) {
|
|
275
|
+
const result = toRefreshTokenHashOrNull(value);
|
|
276
|
+
if (!result) {
|
|
277
|
+
throw new Error('RefreshTokenHash value must not be blank.');
|
|
278
|
+
}
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export const refreshTokenHashSchema = z.string().transform((val, ctx) => {
|
|
283
|
+
const result = toRefreshTokenHashOrNull(val);
|
|
284
|
+
if (!result) {
|
|
285
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid RefreshTokenHash' });
|
|
286
|
+
return z.NEVER;
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
export class CompositeAuditActionTypeParser {
|
|
292
|
+
constructor(auditActionTypes) {
|
|
293
|
+
this.auditActionTypes = auditActionTypes;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
fromValueOrThrow(value) {
|
|
297
|
+
for (const parse of this.auditActionTypes) {
|
|
298
|
+
const result = typeof parse === 'function'
|
|
299
|
+
? parse(value)
|
|
300
|
+
: (parse && typeof parse.parseOrNull === 'function' ? parse.parseOrNull(value) : null);
|
|
301
|
+
if (result !== null && result !== undefined) {
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
throw new Error("Unknown value of AuditActionType: '" + value + "'");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export class CompositeAuditMetadataKeyParser {
|
|
310
|
+
constructor(metadataKeys) {
|
|
311
|
+
this.metadataKeys = metadataKeys;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
fromValueOrThrow(value) {
|
|
315
|
+
for (const parse of this.metadataKeys) {
|
|
316
|
+
const result = typeof parse === 'function'
|
|
317
|
+
? parse(value)
|
|
318
|
+
: (parse && typeof parse.parseOrNull === 'function' ? parse.parseOrNull(value) : null);
|
|
319
|
+
if (result !== null && result !== undefined) {
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
throw new Error("Unknown value of AuditMetadataKey: '" + value + "'");
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export class CompositeAuditResourceTypeParser {
|
|
328
|
+
constructor(auditResourceTypes) {
|
|
329
|
+
this.auditResourceTypes = auditResourceTypes;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
fromValueOrThrow(value) {
|
|
333
|
+
for (const parse of this.auditResourceTypes) {
|
|
334
|
+
const result = typeof parse === 'function'
|
|
335
|
+
? parse(value)
|
|
336
|
+
: (parse && typeof parse.parseOrNull === 'function' ? parse.parseOrNull(value) : null);
|
|
337
|
+
if (result !== null && result !== undefined) {
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
throw new Error("Unknown value of AuditResourceType: '" + value + "'");
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
147
345
|
export const ManagementRoutes = {
|
|
148
346
|
BASE_MANAGEMENT_ROUTE: "/management"
|
|
149
347
|
};
|
|
@@ -194,6 +392,14 @@ LOGIN_BY_TOTP: "/management/auth/login/totp",
|
|
|
194
392
|
LOGIN_BY_TOTP_RECOVERY_CODE: "/management/auth/login/totp-recovery-code"
|
|
195
393
|
};
|
|
196
394
|
|
|
395
|
+
export const OpenRefreshTokenRoutes = {
|
|
396
|
+
REFRESH_TOKEN: "/auth/refresh"
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
export const SelfManagementRefreshTokenRoutes = {
|
|
400
|
+
REFRESH_TOKEN: "/management/auth/refresh"
|
|
401
|
+
};
|
|
402
|
+
|
|
197
403
|
export const OpenRegisterRoutes = {
|
|
198
404
|
REGISTER_BY_EMAIL_ROUTE: "/auth/register/email",
|
|
199
405
|
REGISTER_BY_EMAIL: "/auth/register/email",
|
|
@@ -342,6 +548,336 @@ UPDATE_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings",
|
|
|
342
548
|
RESET_MANAGEMENT_AUTH_SETTINGS: "/management/auth/settings/reset"
|
|
343
549
|
};
|
|
344
550
|
|
|
551
|
+
export const OpenAuthSettingsRoutes = {
|
|
552
|
+
GET_OPEN_AUTH_SETTINGS: "/auth/settings"
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
export const OpenUserConfigurationRoutes = {
|
|
556
|
+
GET_CONFIGURATION: "user-configuration"
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
export const ManagementUserConfigurationRoutes = {
|
|
560
|
+
GET_CONFIGURATION: "/management/user-configuration"
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export const CommonApiFields = {
|
|
564
|
+
ITEMS: "items",
|
|
565
|
+
TOTAL_COUNT: "total_count",
|
|
566
|
+
TOTAL_PAGES: "total_pages",
|
|
567
|
+
ID: "id",
|
|
568
|
+
CREATED_AT: "created_at",
|
|
569
|
+
UPDATED_AT: "updated_at",
|
|
570
|
+
CODE: "code",
|
|
571
|
+
MESSAGE: "message",
|
|
572
|
+
ARGS: "args",
|
|
573
|
+
TYPE: "type",
|
|
574
|
+
PAYLOAD: "payload",
|
|
575
|
+
METADATA: "metadata",
|
|
576
|
+
TIMESTAMP: "timestamp",
|
|
577
|
+
CLIENT_TYPE: "client_type",
|
|
578
|
+
CLIENT_DEVICE_INFO: "client_device_info",
|
|
579
|
+
CLIENT_INFO: "client_info",
|
|
580
|
+
USER_AGENT: "user_agent",
|
|
581
|
+
IP_ADDRESS: "ip_address",
|
|
582
|
+
MASKED_IP_ADDRESS: "masked_ip_address",
|
|
583
|
+
LANGUAGE: "language",
|
|
584
|
+
DEVICE_ID: "device_id",
|
|
585
|
+
DEVICE_NAME: "device_name",
|
|
586
|
+
APP_VERSION: "app_version",
|
|
587
|
+
OPERATION_SYSTEM_VERSION: "operation_system_version",
|
|
588
|
+
API_VERSION: "api_version",
|
|
589
|
+
IS_SENSITIVE_VALUES_MASKED: "is_sensitive_values_masked"
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
export const SecurityApiFields = {
|
|
593
|
+
RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_OPEN_USER: "recent_authentication_validity_seconds_for_open_user",
|
|
594
|
+
RECENT_AUTHENTICATION_VALIDITY_SECONDS_FOR_MANAGEMENT_USER: "recent_authentication_validity_seconds_for_management_user",
|
|
595
|
+
MFA_TOKEN: "mfa_token",
|
|
596
|
+
TOTP_CODE: "totp_code",
|
|
597
|
+
TOTP_SECRET_KEY: "totp_secret_key",
|
|
598
|
+
TOTP_OTP_AUTH_URL: "totp_otp_auth_url",
|
|
599
|
+
TOTP_RECOVERY_CODES: "totp_recovery_codes",
|
|
600
|
+
OPEN_PASSWORD_POLICY: "open_password_policy",
|
|
601
|
+
MANAGEMENT_PASSWORD_POLICY: "management_password_policy",
|
|
602
|
+
MIN_LENGTH: "min_length",
|
|
603
|
+
REQUIRE_LETTER: "require_letter",
|
|
604
|
+
REQUIRE_UPPER_CASE: "require_upper_case",
|
|
605
|
+
REQUIRE_LOWER_CASE: "require_lower_case",
|
|
606
|
+
REQUIRE_DIGIT: "require_digit",
|
|
607
|
+
REQUIRE_SPECIAL_CHAR: "require_special_char",
|
|
608
|
+
COMMON_PASSWORDS: "common_passwords",
|
|
609
|
+
OTP_CONFIRMATION: "otp_confirmation",
|
|
610
|
+
RETRY_AFTER_SECONDS: "retry_after_seconds",
|
|
611
|
+
NUMBER_OF_SYMBOLS: "number_of_symbols",
|
|
612
|
+
EXPIRATION_SECONDS: "expiration_seconds",
|
|
613
|
+
MAX_REQUESTS_PER_PERIOD: "max_requests_per_period",
|
|
614
|
+
RATE_LIMIT_PERIOD_SECONDS: "rate_limit_period_seconds",
|
|
615
|
+
REFRESH_TOKEN_ROTATION_GRACE_PERIOD_SECONDS: "refresh_token_rotation_grace_period_seconds",
|
|
616
|
+
ACCOUNT_LOCKOUT_POLICY: "account_lockout_policy",
|
|
617
|
+
ACCOUNT_LOCKOUT_CHECK_INTERVAL_SECONDS: "account_lockout_check_interval_seconds",
|
|
618
|
+
MAX_FAILED_PASSWORD_ATTEMPTS: "max_failed_password_attempts",
|
|
619
|
+
MAX_FAILED_OTP_ATTEMPTS: "max_failed_otp_attempts",
|
|
620
|
+
MAX_FAILED_TOTP_ATTEMPTS: "max_failed_totp_attempts",
|
|
621
|
+
FAILED_ATTEMPTS_WINDOW_SECONDS: "failed_attempts_window_seconds",
|
|
622
|
+
LOCKOUT_DURATION_SECONDS: "lockout_duration_seconds",
|
|
623
|
+
INDEFINITE_LOCKOUT_THRESHOLD: "indefinite_lockout_threshold",
|
|
624
|
+
IS_SELF_SERVICE_UNLOCK_ENABLED: "is_self_service_unlock_enabled",
|
|
625
|
+
OPEN_IP_RESTRICTION_POLICY: "open_ip_restriction_policy",
|
|
626
|
+
MANAGEMENT_IP_RESTRICTION_POLICY: "management_ip_restriction_policy",
|
|
627
|
+
IS_BLACKLIST_ENABLED: "is_blacklist_enabled",
|
|
628
|
+
BLACKLIST: "blacklist",
|
|
629
|
+
IS_WHITELIST_ENABLED: "is_whitelist_enabled",
|
|
630
|
+
WHITELIST: "whitelist"
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export const GlobalSettingsApiFields = {
|
|
634
|
+
PRIVACY_POLICY_URL: "privacy_policy_url",
|
|
635
|
+
TERMS_OF_SERVICE_URL: "terms_of_service_url",
|
|
636
|
+
CONTACT_SUPPORT_EMAIL: "contact_support_email",
|
|
637
|
+
IS_TRACING_ENABLED: "is_tracing_enabled",
|
|
638
|
+
IS_METRICS_ENABLED: "is_metrics_enabled",
|
|
639
|
+
IS_VERBOSE_LOGGING_ENABLED: "is_verbose_logging_enabled",
|
|
640
|
+
MIN_SUPPORTED_APP_VERSIONS: "min_supported_app_versions"
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
export const UserApiFields = {
|
|
644
|
+
EXTERNAL_PROVIDER_TOKEN: "external_provider_token",
|
|
645
|
+
TOKEN_TYPE: "token_type",
|
|
646
|
+
SESSION_ID: "session_id",
|
|
647
|
+
ACCESS_TOKEN: "access_token",
|
|
648
|
+
REFRESH_TOKEN: "refresh_token",
|
|
649
|
+
SESSION_TOKEN: "session_token",
|
|
650
|
+
EXPIRES_AT: "expires_at",
|
|
651
|
+
EMAIL: "email",
|
|
652
|
+
PHONE_NUMBER: "phone_number",
|
|
653
|
+
PASSWORD: "password",
|
|
654
|
+
OLD_PASSWORD: "old_password",
|
|
655
|
+
NEW_PASSWORD: "new_password",
|
|
656
|
+
CONFIRMATION_CODE: "confirmation_code",
|
|
657
|
+
AUTH_PROVIDER: "auth_provider",
|
|
658
|
+
USER: "user",
|
|
659
|
+
USER_ID: "user_id",
|
|
660
|
+
ROLE: "role",
|
|
661
|
+
USER_ROLE: "user_role",
|
|
662
|
+
ACCOUNT_STATUS: "account_status",
|
|
663
|
+
ACCOUNT_STATUS_ON_RESTORE: "account_status_on_restore",
|
|
664
|
+
AUTHORITY_LEVEL: "authority_level",
|
|
665
|
+
PERMISSION_CODES: "permission_codes",
|
|
666
|
+
IS_TOTP_ENABLED: "is_totp_enabled",
|
|
667
|
+
LAST_LOGIN_AT: "last_login_at",
|
|
668
|
+
LAST_ACTIVE_AT: "last_active_at",
|
|
669
|
+
SCHEDULED_PERMANENT_DELETION_AT: "scheduled_permanent_deletion_at",
|
|
670
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
671
|
+
TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until",
|
|
672
|
+
IDENTIFIER: "identifier",
|
|
673
|
+
EXTERNAL_PROVIDER_EMAIL: "external_provider_email",
|
|
674
|
+
USER_AUTH_PROVIDER: "user_auth_provider",
|
|
675
|
+
IDENTIFIER_ID: "identifier_id",
|
|
676
|
+
DISPLAY_NAME: "display_name",
|
|
677
|
+
IDENTIFIER_DISPLAY_NAME: "identifier_display_name",
|
|
678
|
+
IDENTIFIER_AUTH_PROVIDER: "identifier_auth_provider",
|
|
679
|
+
LAST_ACCESSED_AT: "last_accessed_at",
|
|
680
|
+
LAST_REAUTHENTICATED_AT: "last_reauthenticated_at",
|
|
681
|
+
DELETED_SESSION_IDS: "deleted_session_ids",
|
|
682
|
+
DELETED_IDENTIFIER_IDS: "deleted_identifier_ids",
|
|
683
|
+
MAX_TOTAL_IDENTIFIERS: "max_total_identifiers",
|
|
684
|
+
MAX_EMAIL_IDENTIFIERS: "max_email_identifiers",
|
|
685
|
+
MAX_PHONE_IDENTIFIERS: "max_phone_identifiers",
|
|
686
|
+
MAX_IDENTIFIERS_PER_EXTERNAL_PROVIDER: "max_identifiers_per_external_provider",
|
|
687
|
+
MAX_ACTIVE_SESSIONS_FOR_OPEN_USER: "max_active_sessions_for_open_user",
|
|
688
|
+
MAX_ACTIVE_SESSIONS_FOR_MANAGEMENT_USER: "max_active_sessions_for_management_user",
|
|
689
|
+
AVAILABLE_AUTH_PROVIDERS: "available_auth_providers",
|
|
690
|
+
ACCESS_TOKEN_VALIDITY_SECONDS: "access_token_validity_seconds",
|
|
691
|
+
REFRESH_TOKEN_VALIDITY_SECONDS: "refresh_token_validity_seconds",
|
|
692
|
+
ACCOUNT_DELETION_GRACE_PERIOD_SECONDS: "account_deletion_grace_period_seconds",
|
|
693
|
+
ACCOUNT_DELETION_CHECK_INTERVAL_SECONDS: "account_deletion_check_interval_seconds",
|
|
694
|
+
IS_REGISTRATION_ENABLED: "is_registration_enabled",
|
|
695
|
+
EMAIL_RESTRICTION_POLICY: "email_restriction_policy",
|
|
696
|
+
OPEN_EMAIL_RESTRICTION_POLICY: "open_email_restriction_policy",
|
|
697
|
+
MANAGEMENT_EMAIL_RESTRICTION_POLICY: "management_email_restriction_policy",
|
|
698
|
+
PRIMARY: "primary",
|
|
699
|
+
SECONDARY: "secondary",
|
|
700
|
+
OPEN_GLOBAL_SETTINGS: "open_global_settings",
|
|
701
|
+
MANAGEMENT_GLOBAL_SETTINGS: "management_global_settings",
|
|
702
|
+
OPEN_SECURITY_SETTINGS: "open_security_settings",
|
|
703
|
+
MANAGEMENT_SECURITY_SETTINGS: "management_security_settings",
|
|
704
|
+
OPEN_AUTH_SETTINGS: "open_auth_settings",
|
|
705
|
+
MANAGEMENT_AUTH_SETTINGS: "management_auth_settings"
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
export const AuditEventFields = {
|
|
709
|
+
ACTOR_ID: "actor_id",
|
|
710
|
+
ACTOR_TYPE: "actor_type",
|
|
711
|
+
ACTOR_USER_ROLE: "actor_user_role",
|
|
712
|
+
ACTION: "action",
|
|
713
|
+
RESOURCE: "resource",
|
|
714
|
+
RESOURCE_ID: "resource_id",
|
|
715
|
+
STATUS: "status",
|
|
716
|
+
METADATA_KEY: "key",
|
|
717
|
+
METADATA_VALUE: "value",
|
|
718
|
+
METADATA_VALUE_SENSITIVITY: "value_sensitivity"
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
export const CommonHttpHeaders = {
|
|
722
|
+
TRACE_HEADER_NAME: "X-Trace-Id",
|
|
723
|
+
CLIENT_TYPE_HEADER_NAME: "X-Client-Type",
|
|
724
|
+
DEVICE_ID_HEADER_NAME: "X-Device-Id",
|
|
725
|
+
DEVICE_NAME_HEADER_NAME: "X-Device-Name",
|
|
726
|
+
APP_VERSION_HEADER_NAME: "X-App-Version",
|
|
727
|
+
OPERATION_SYSTEM_VERSION_HEADER_NAME: "X-OS-Version",
|
|
728
|
+
API_VERSION_HEADER_NAME: "X-Api-Version"
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
export const CommonWebSocketCloseReasons = {
|
|
732
|
+
NORMAL: "Normal",
|
|
733
|
+
SERVER_RESTART: "Server restart",
|
|
734
|
+
INTERNAL_SERVER_ERROR: "Internal server error"
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
export const CommonWebSocketEventTypes = {
|
|
738
|
+
PING: "PING",
|
|
739
|
+
PONG: "PONG",
|
|
740
|
+
INITIALIZE: "INITIALIZE",
|
|
741
|
+
INITIALIZED_SUCCESS: "INITIALIZED_SUCCESS"
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
export const SecurityWebSocketEventTypes = {
|
|
745
|
+
OPEN_SECURITY_SETTINGS_UPDATED: "OPEN_SECURITY_SETTINGS_UPDATED",
|
|
746
|
+
MANAGEMENT_SECURITY_SETTINGS_UPDATED: "MANAGEMENT_SECURITY_SETTINGS_UPDATED"
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
export const SettingsWebSocketEventTypes = {
|
|
750
|
+
OPEN_GLOBAL_SETTINGS_UPDATED: "OPEN_GLOBAL_SETTINGS_UPDATED",
|
|
751
|
+
MANAGEMENT_GLOBAL_SETTINGS_UPDATED: "MANAGEMENT_GLOBAL_SETTINGS_UPDATED"
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
export const UserWebSocketCloseReasons = {
|
|
755
|
+
AUTH_FAILED: "Auth failed",
|
|
756
|
+
SESSION_EXPIRED: "Session expired",
|
|
757
|
+
SESSION_DELETED: "Session deleted",
|
|
758
|
+
USER_BANNED: "User banned"
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
export const UserWebSocketEventTypes = {
|
|
762
|
+
UNAUTHORIZED: "UNAUTHORIZED",
|
|
763
|
+
OPEN_AUTH_SETTINGS_UPDATED: "OPEN_AUTH_SETTINGS_UPDATED",
|
|
764
|
+
MANAGEMENT_AUTH_SETTINGS_UPDATED: "MANAGEMENT_AUTH_SETTINGS_UPDATED",
|
|
765
|
+
USER_UPDATED: "USER_UPDATED",
|
|
766
|
+
SESSION_DELETED: "SESSION_DELETED"
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
export const UserApiPaths = {
|
|
770
|
+
USER_ID: "user_id",
|
|
771
|
+
SESSION_ID: "session_id",
|
|
772
|
+
USER_IDENTIFIER_ID: "user_identifier_id"
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
export const UserApiQueryParams = {
|
|
776
|
+
ACCESS_TOKEN: "token"
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
export const UserAuthSpec = {
|
|
780
|
+
TOKEN_TYPE_BEARER: "Bearer"
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
export const AuditApiPaths = {
|
|
784
|
+
EVENT_ID: "event_id"
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
export const UserRoleDefaultAuthorityLevel = {
|
|
788
|
+
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
export const SecurityAuditMetadataDeniedReasonValues = {
|
|
792
|
+
RATE_LIMIT: "rate_limit",
|
|
793
|
+
PASSWORD_TOO_WEAK: "password_too_weak",
|
|
794
|
+
MFA_TOKEN_EXPIRED: "mfa_token_expired",
|
|
795
|
+
TOTP_ALREADY_ENABLED: "totp_already_enabled",
|
|
796
|
+
TOTP_NOT_ENABLED: "totp_not_enabled",
|
|
797
|
+
RECOVERY_CODE_ALREADY_USED: "recovery_code_already_used",
|
|
798
|
+
MFA_REQUIRED: "mfa_required"
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
export const UserAuditMetadataDeniedReasonValues = {
|
|
802
|
+
USER_READ_ONLY: "user_read_only",
|
|
803
|
+
USER_BANNED: "user_banned",
|
|
804
|
+
USER_LOCKED: "user_locked",
|
|
805
|
+
USER_SECURITY_HOLD: "user_security_hold",
|
|
806
|
+
USER_PENDING_DELETION: "user_pending_deletion",
|
|
807
|
+
USER_NOT_FOUND: "user_not_found",
|
|
808
|
+
USER_ROLE_NOT_ALLOWED: "user_role_not_allowed",
|
|
809
|
+
USER_MISSING_PERMISSIONS: "user_missing_permissions",
|
|
810
|
+
USER_INSUFFICIENT_AUTHORITY_LEVEL: "user_insufficient_authority_level",
|
|
811
|
+
USER_ILLEGAL_ACCOUNT_STATUS: "user_illegal_account_status",
|
|
812
|
+
USER_FORBIDDEN: "user_forbidden",
|
|
813
|
+
USER_IDENTIFIER_LIMIT_REACHED: "user_identifier_limit_reached",
|
|
814
|
+
TOTAL_USER_IDENTIFIERS_LIMIT_REACHED: "total_user_identifier_limit_reached",
|
|
815
|
+
PASSWORD_SETUP_REQUIRED: "password_setup_required",
|
|
816
|
+
USER_IDENTIFIER_PASSWORD_NOT_SUPPORTED: "user_identifier_password_not_supported",
|
|
817
|
+
USER_IDENTIFIER_PASSWORD_NOT_SET: "user_identifier_password_not_set"
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
export const ListingParamNames = {
|
|
821
|
+
PAGE_NUMBER: "page_number",
|
|
822
|
+
PAGE_SIZE: "page_size",
|
|
823
|
+
SORT_BY: "sort_by",
|
|
824
|
+
SORT_ORDER: "sort_order",
|
|
825
|
+
Pagination: {
|
|
826
|
+
PAGE_NUMBER: "page_number",
|
|
827
|
+
PAGE_SIZE: "page_size"
|
|
828
|
+
},
|
|
829
|
+
Sort: {
|
|
830
|
+
SORT_BY: "sort_by",
|
|
831
|
+
SORT_ORDER: "sort_order"
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
export const AuditFilterValues = {
|
|
836
|
+
AuditEventFilterValues: {
|
|
837
|
+
ACTOR_ID: "actor_id",
|
|
838
|
+
ACTOR_TYPE: "actor_type",
|
|
839
|
+
ACTOR_USER_ROLE: "actor_user_role",
|
|
840
|
+
ACTION: "action",
|
|
841
|
+
RESOURCE: "resource",
|
|
842
|
+
RESOURCE_ID: "resource_id",
|
|
843
|
+
STATUS: "status",
|
|
844
|
+
MESSAGE: "message"
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
export const UserFilterValues = {
|
|
849
|
+
UserFilterValues: {
|
|
850
|
+
ROLE: "role",
|
|
851
|
+
ACCOUNT_STATUS: "account_status",
|
|
852
|
+
ACCOUNT_STATUS_ON_RESTORE: "account_status_on_restore",
|
|
853
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
854
|
+
AUTHORITY_LEVEL_FROM: "authority_level_from",
|
|
855
|
+
AUTHORITY_LEVEL_TO: "authority_level_to",
|
|
856
|
+
IS_TOTP_ENABLED: "is_totp_enabled",
|
|
857
|
+
PERMISSION_CODES: "permission_codes"
|
|
858
|
+
},
|
|
859
|
+
UserIdentifierFilterValues: {
|
|
860
|
+
USER_ID: "user_id",
|
|
861
|
+
USER_AUTH_PROVIDER: "user_auth_provider",
|
|
862
|
+
IDENTIFIER: "identifier"
|
|
863
|
+
},
|
|
864
|
+
UserSessionFilterValues: {
|
|
865
|
+
USER_ID: "user_id",
|
|
866
|
+
USER_ROLE: "user_role",
|
|
867
|
+
IDENTIFIER_ID: "identifier_id",
|
|
868
|
+
USER_AUTH_PROVIDER: "user_auth_provider",
|
|
869
|
+
CLIENT_TYPE: "client_type",
|
|
870
|
+
USER_AGENT: "user_agent",
|
|
871
|
+
IP_ADDRESS: "ip_address",
|
|
872
|
+
LANGUAGE: "language",
|
|
873
|
+
DEVICE_ID: "device_id",
|
|
874
|
+
DEVICE_NAME: "device_name",
|
|
875
|
+
APP_VERSION: "app_version",
|
|
876
|
+
OPERATION_SYSTEM_VERSION: "operation_system_version",
|
|
877
|
+
IDENTIFIER: "identifier"
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
345
881
|
export const CommonErrorCodes = {
|
|
346
882
|
UNKNOWN: "UNKNOWN",
|
|
347
883
|
INTERNAL: "INTERNAL",
|
|
@@ -462,41 +998,781 @@ export const UserPermissionCode = {
|
|
|
462
998
|
|
|
463
999
|
};
|
|
464
1000
|
|
|
465
|
-
|
|
1001
|
+
export const toClientInfo = (payload) => ({
|
|
1002
|
+
deviceInfo: toClientDeviceInfo(payload.client_device_info),
|
|
1003
|
+
userAgent: payload.user_agent,
|
|
1004
|
+
ipAddress: payload.ip_address,
|
|
1005
|
+
host: null,
|
|
1006
|
+
origin: null,
|
|
1007
|
+
apiVersion: payload.api_version
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
export const toClientInfoPayload = (domain) => ({
|
|
1011
|
+
client_device_info: toClientDeviceInfoPayload(domain.deviceInfo),
|
|
1012
|
+
user_agent: domain.userAgent,
|
|
1013
|
+
ip_address: domain.ipAddress,
|
|
1014
|
+
api_version: domain.apiVersion
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
export const toClientDeviceInfo = (payload) => ({
|
|
1018
|
+
deviceId: payload.device_id ? toClientDeviceIdOrThrow(payload.device_id) : null,
|
|
1019
|
+
deviceName: payload.device_name,
|
|
1020
|
+
clientType: payload.client_type,
|
|
1021
|
+
language: payload.language,
|
|
1022
|
+
appVersion: payload.app_version,
|
|
1023
|
+
operationSystemVersion: payload.operation_system_version
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
export const toClientDeviceInfoPayload = (domain) => ({
|
|
1027
|
+
client_type: domain.clientType,
|
|
1028
|
+
language: domain.language,
|
|
1029
|
+
device_id: domain.deviceId,
|
|
1030
|
+
device_name: domain.deviceName,
|
|
1031
|
+
app_version: domain.appVersion,
|
|
1032
|
+
operation_system_version: domain.operationSystemVersion
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
export const toAccountLockoutPolicy = (payload) => ({
|
|
1036
|
+
maxFailedPasswordAttempts: payload.max_failed_password_attempts,
|
|
1037
|
+
maxFailedOtpAttempts: payload.max_failed_otp_attempts,
|
|
1038
|
+
maxFailedTotpAttempts: payload.max_failed_totp_attempts,
|
|
1039
|
+
failedAttemptsWindowSeconds: payload.failed_attempts_window_seconds,
|
|
1040
|
+
lockoutDurationSeconds: payload.lockout_duration_seconds,
|
|
1041
|
+
indefiniteLockoutThreshold: payload.indefinite_lockout_threshold,
|
|
1042
|
+
isSelfServiceUnlockEnabled: payload.is_self_service_unlock_enabled
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
export const toAccountLockoutPolicyPayload = (domain) => ({
|
|
1046
|
+
max_failed_password_attempts: domain.maxFailedPasswordAttempts,
|
|
1047
|
+
max_failed_otp_attempts: domain.maxFailedOtpAttempts,
|
|
1048
|
+
max_failed_totp_attempts: domain.maxFailedTotpAttempts,
|
|
1049
|
+
failed_attempts_window_seconds: domain.failedAttemptsWindowSeconds,
|
|
1050
|
+
lockout_duration_seconds: domain.lockoutDurationSeconds,
|
|
1051
|
+
indefinite_lockout_threshold: domain.indefiniteLockoutThreshold,
|
|
1052
|
+
is_self_service_unlock_enabled: domain.isSelfServiceUnlockEnabled
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
export const toIpRestrictionPolicy = (payload) => ({
|
|
1056
|
+
isBlacklistEnabled: payload.is_blacklist_enabled,
|
|
1057
|
+
blacklist: payload.blacklist,
|
|
1058
|
+
isWhitelistEnabled: payload.is_whitelist_enabled,
|
|
1059
|
+
whitelist: payload.whitelist
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
export const toIpRestrictionPolicyPayload = (domain) => ({
|
|
1063
|
+
is_blacklist_enabled: domain.isBlacklistEnabled,
|
|
1064
|
+
blacklist: domain.blacklist,
|
|
1065
|
+
is_whitelist_enabled: domain.isWhitelistEnabled,
|
|
1066
|
+
whitelist: domain.whitelist
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
export const toOtpConfirmation = (payload) => ({
|
|
1070
|
+
retryAfterSeconds: payload.retry_after_seconds,
|
|
1071
|
+
numberOfSymbols: payload.number_of_symbols,
|
|
1072
|
+
expirationSeconds: payload.expiration_seconds
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
export const toOtpConfirmationPayload = (domain) => ({
|
|
1076
|
+
retry_after_seconds: domain.retryAfterSeconds,
|
|
1077
|
+
number_of_symbols: domain.numberOfSymbols,
|
|
1078
|
+
expiration_seconds: domain.expirationSeconds
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
export const toManagementPasswordPolicy = (payload) => ({
|
|
1082
|
+
minLength: payload.min_length,
|
|
1083
|
+
requireLetter: payload.require_letter,
|
|
1084
|
+
requireUpperCase: payload.require_upper_case,
|
|
1085
|
+
requireLowerCase: payload.require_lower_case,
|
|
1086
|
+
requireDigit: payload.require_digit,
|
|
1087
|
+
requireSpecialChar: payload.require_special_char,
|
|
1088
|
+
commonPasswords: payload.common_passwords
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
export const toManagementPasswordPolicyPayload = (domain) => ({
|
|
1092
|
+
min_length: domain.minLength,
|
|
1093
|
+
require_letter: domain.requireLetter,
|
|
1094
|
+
require_upper_case: domain.requireUpperCase,
|
|
1095
|
+
require_lower_case: domain.requireLowerCase,
|
|
1096
|
+
require_digit: domain.requireDigit,
|
|
1097
|
+
require_special_char: domain.requireSpecialChar,
|
|
1098
|
+
common_passwords: domain.commonPasswords
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
export const toOpenPasswordPolicy = (payload) => ({
|
|
1102
|
+
minLength: payload.min_length,
|
|
1103
|
+
requireLetter: payload.require_letter,
|
|
1104
|
+
requireUpperCase: payload.require_upper_case,
|
|
1105
|
+
requireLowerCase: payload.require_lower_case,
|
|
1106
|
+
requireDigit: payload.require_digit,
|
|
1107
|
+
requireSpecialChar: payload.require_special_char
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
export const toOpenPasswordPolicyPayload = (domain) => ({
|
|
1111
|
+
min_length: domain.minLength,
|
|
1112
|
+
require_letter: domain.requireLetter,
|
|
1113
|
+
require_upper_case: domain.requireUpperCase,
|
|
1114
|
+
require_lower_case: domain.requireLowerCase,
|
|
1115
|
+
require_digit: domain.requireDigit,
|
|
1116
|
+
require_special_char: domain.requireSpecialChar
|
|
1117
|
+
});
|
|
1118
|
+
|
|
1119
|
+
export const toManagementSecuritySettings = (payload) => ({
|
|
1120
|
+
recentAuthenticationValiditySecondsForOpenUser: payload.recent_authentication_validity_seconds_for_open_user,
|
|
1121
|
+
recentAuthenticationValiditySecondsForManagementUser: payload.recent_authentication_validity_seconds_for_management_user,
|
|
1122
|
+
passwordPolicy: toManagementPasswordPolicy(payload.management_password_policy),
|
|
1123
|
+
otpConfirmation: toOtpConfirmation(payload.otp_confirmation),
|
|
1124
|
+
accountLockoutPolicy: toAccountLockoutPolicy(payload.account_lockout_policy),
|
|
1125
|
+
accountLockoutCheckIntervalSeconds: payload.account_lockout_check_interval_seconds,
|
|
1126
|
+
openIpRestrictionPolicy: toIpRestrictionPolicy(payload.open_ip_restriction_policy),
|
|
1127
|
+
managementIpRestrictionPolicy: toIpRestrictionPolicy(payload.management_ip_restriction_policy),
|
|
1128
|
+
mfaTokenExpirationSeconds: payload.expiration_seconds,
|
|
1129
|
+
maxRequestsPerPeriod: payload.max_requests_per_period,
|
|
1130
|
+
rateLimitPeriodSeconds: payload.rate_limit_period_seconds,
|
|
1131
|
+
refreshTokenRotationGracePeriodSeconds: payload.refresh_token_rotation_grace_period_seconds
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
export const toManagementSecuritySettingsPayload = (domain) => ({
|
|
1135
|
+
recent_authentication_validity_seconds_for_open_user: domain.recentAuthenticationValiditySecondsForOpenUser,
|
|
1136
|
+
recent_authentication_validity_seconds_for_management_user: domain.recentAuthenticationValiditySecondsForManagementUser,
|
|
1137
|
+
management_password_policy: toManagementPasswordPolicyPayload(domain.passwordPolicy),
|
|
1138
|
+
otp_confirmation: toOtpConfirmationPayload(domain.otpConfirmation),
|
|
1139
|
+
account_lockout_policy: toAccountLockoutPolicyPayload(domain.accountLockoutPolicy),
|
|
1140
|
+
account_lockout_check_interval_seconds: domain.accountLockoutCheckIntervalSeconds,
|
|
1141
|
+
open_ip_restriction_policy: toIpRestrictionPolicyPayload(domain.openIpRestrictionPolicy),
|
|
1142
|
+
management_ip_restriction_policy: toIpRestrictionPolicyPayload(domain.managementIpRestrictionPolicy),
|
|
1143
|
+
expiration_seconds: domain.mfaTokenExpirationSeconds,
|
|
1144
|
+
max_requests_per_period: domain.maxRequestsPerPeriod,
|
|
1145
|
+
rate_limit_period_seconds: domain.rateLimitPeriodSeconds,
|
|
1146
|
+
refresh_token_rotation_grace_period_seconds: domain.refreshTokenRotationGracePeriodSeconds
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
export const toOpenSecuritySettings = (payload) => ({
|
|
1150
|
+
passwordPolicy: toOpenPasswordPolicy(payload.open_password_policy),
|
|
1151
|
+
otpConfirmation: toOtpConfirmation(payload.otp_confirmation)
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
export const toOpenSecuritySettingsPayload = (domain) => ({
|
|
1155
|
+
open_password_policy: toOpenPasswordPolicyPayload(domain.passwordPolicy),
|
|
1156
|
+
otp_confirmation: toOtpConfirmationPayload(domain.otpConfirmation)
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
export const toTotpRecoveryCodes = (payload) => ({
|
|
1160
|
+
codes: payload.totp_recovery_codes
|
|
1161
|
+
});
|
|
466
1162
|
|
|
467
|
-
export const
|
|
1163
|
+
export const toTotpRecoveryCodesPayload = (domain) => ({
|
|
1164
|
+
totp_recovery_codes: domain.codes
|
|
1165
|
+
});
|
|
468
1166
|
|
|
469
|
-
export const
|
|
1167
|
+
export const toTotpSetup = (payload) => ({
|
|
1168
|
+
secretKey: payload.totp_secret_key,
|
|
1169
|
+
otpAuthUrl: payload.totp_otp_auth_url,
|
|
1170
|
+
mfaToken: payload.mfa_token
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1173
|
+
export const toTotpSetupPayload = (domain) => ({
|
|
1174
|
+
totp_secret_key: domain.secretKey,
|
|
1175
|
+
totp_otp_auth_url: domain.otpAuthUrl,
|
|
1176
|
+
mfa_token: domain.mfaToken
|
|
1177
|
+
});
|
|
1178
|
+
|
|
1179
|
+
export const toVerifyTotp = (payload) => ({
|
|
1180
|
+
mfaToken: payload.mfa_token,
|
|
1181
|
+
code: payload.totp_code
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
export const toVerifyTotpPayload = (domain) => ({
|
|
1185
|
+
mfa_token: domain.mfaToken,
|
|
1186
|
+
totp_code: domain.code
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
export const toManagementGlobalSettings = (payload) => ({
|
|
1190
|
+
privacyPolicyUrl: payload.privacy_policy_url,
|
|
1191
|
+
termsOfServiceUrl: payload.terms_of_service_url,
|
|
1192
|
+
contactSupportEmail: payload.contact_support_email,
|
|
1193
|
+
minSupportedAppVersions: payload.min_supported_app_versions,
|
|
1194
|
+
isTracingEnabled: payload.is_tracing_enabled,
|
|
1195
|
+
isMetricsEnabled: payload.is_metrics_enabled,
|
|
1196
|
+
isVerboseLoggingEnabled: payload.is_verbose_logging_enabled
|
|
1197
|
+
});
|
|
1198
|
+
|
|
1199
|
+
export const toManagementGlobalSettingsPayload = (domain) => ({
|
|
1200
|
+
privacy_policy_url: domain.privacyPolicyUrl,
|
|
1201
|
+
terms_of_service_url: domain.termsOfServiceUrl,
|
|
1202
|
+
contact_support_email: domain.contactSupportEmail,
|
|
1203
|
+
min_supported_app_versions: domain.minSupportedAppVersions,
|
|
1204
|
+
is_tracing_enabled: domain.isTracingEnabled,
|
|
1205
|
+
is_metrics_enabled: domain.isMetricsEnabled,
|
|
1206
|
+
is_verbose_logging_enabled: domain.isVerboseLoggingEnabled
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1209
|
+
export const toOpenGlobalSettings = (payload) => ({
|
|
1210
|
+
privacyPolicyUrl: payload.privacy_policy_url,
|
|
1211
|
+
termsOfServiceUrl: payload.terms_of_service_url,
|
|
1212
|
+
contactSupportEmail: payload.contact_support_email,
|
|
1213
|
+
minSupportedAppVersions: payload.min_supported_app_versions
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
export const toOpenGlobalSettingsPayload = (domain) => ({
|
|
1217
|
+
privacy_policy_url: domain.privacyPolicyUrl,
|
|
1218
|
+
terms_of_service_url: domain.termsOfServiceUrl,
|
|
1219
|
+
contact_support_email: domain.contactSupportEmail,
|
|
1220
|
+
min_supported_app_versions: domain.minSupportedAppVersions
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
export const toAuditEvent = (payload) => ({
|
|
1224
|
+
id: toAuditEventIdOrThrow(payload.id),
|
|
1225
|
+
actorId: payload.actor_id,
|
|
1226
|
+
actorType: payload.actor_type,
|
|
1227
|
+
actorUserRole: payload.actor_user_role,
|
|
1228
|
+
action: payload.action,
|
|
1229
|
+
resource: payload.resource,
|
|
1230
|
+
resourceId: payload.resource_id,
|
|
1231
|
+
resourceValueSensitivity: null,
|
|
1232
|
+
status: payload.status,
|
|
1233
|
+
metadata: payload.metadata ? payload.metadata.map(val => toAuditEventMetadata(val)) : [],
|
|
1234
|
+
message: payload.message,
|
|
1235
|
+
createdAt: payload.created_at
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
export const toAuditEventPayload = (domain) => ({
|
|
1239
|
+
id: domain.id,
|
|
1240
|
+
actor_id: domain.actorId,
|
|
1241
|
+
actor_type: domain.actorType,
|
|
1242
|
+
actor_user_role: domain.actorUserRole,
|
|
1243
|
+
action: domain.action,
|
|
1244
|
+
resource: domain.resource,
|
|
1245
|
+
resource_id: domain.resourceId,
|
|
1246
|
+
status: domain.status,
|
|
1247
|
+
metadata: domain.metadata ? domain.metadata.map(val => toAuditEventMetadataPayload(val)) : [],
|
|
1248
|
+
message: domain.message,
|
|
1249
|
+
created_at: domain.createdAt
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
export const toAuditEventMetadata = (payload) => ({
|
|
1253
|
+
key: payload.key,
|
|
1254
|
+
value: payload.value
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
export const toAuditEventMetadataPayload = (domain) => ({
|
|
1258
|
+
key: domain.key,
|
|
1259
|
+
value: domain.value,
|
|
1260
|
+
value_sensitivity: null
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
export const toAuthData = (payload) => ({
|
|
1264
|
+
userDetails: toUserDetails(payload.user),
|
|
1265
|
+
sessionToken: toSessionToken(payload.session_token)
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
export const toAuthDataPayload = (domain) => ({
|
|
1269
|
+
user: toUserDetailsPayload(domain.userDetails),
|
|
1270
|
+
session_token: toSessionTokenPayload(domain.sessionToken)
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
export const toAvailableAuthProviders = (payload) => ({
|
|
1274
|
+
primary: payload.primary,
|
|
1275
|
+
secondary: payload.secondary
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
export const toAvailableAuthProvidersPayload = (domain) => ({
|
|
1279
|
+
primary: domain.primary,
|
|
1280
|
+
secondary: domain.secondary
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1283
|
+
export const toManagementAuthSettings = (payload) => ({
|
|
1284
|
+
availableAuthProviders: toAvailableAuthProviders(payload.available_auth_providers),
|
|
1285
|
+
maxTotalIdentifiers: payload.max_total_identifiers,
|
|
1286
|
+
maxEmailIdentifiers: payload.max_email_identifiers,
|
|
1287
|
+
maxPhoneIdentifiers: payload.max_phone_identifiers,
|
|
1288
|
+
maxIdentifiersPerExternalProvider: payload.max_identifiers_per_external_provider,
|
|
1289
|
+
maxActiveSessionsForOpenUser: payload.max_active_sessions_for_open_user,
|
|
1290
|
+
maxActiveSessionsForManagementUser: payload.max_active_sessions_for_management_user,
|
|
1291
|
+
accessTokenExpirationSeconds: payload.access_token_validity_seconds,
|
|
1292
|
+
refreshTokenExpirationSeconds: payload.refresh_token_validity_seconds,
|
|
1293
|
+
accountDeletionGracePeriodSeconds: payload.account_deletion_grace_period_seconds,
|
|
1294
|
+
accountDeletionCheckIntervalSeconds: payload.account_deletion_check_interval_seconds,
|
|
1295
|
+
isRegistrationEnabled: payload.is_registration_enabled,
|
|
1296
|
+
openEmailRestrictionPolicy: toEmailRestrictionPolicy(payload.open_email_restriction_policy),
|
|
1297
|
+
managementEmailRestrictionPolicy: toEmailRestrictionPolicy(payload.management_email_restriction_policy)
|
|
1298
|
+
});
|
|
1299
|
+
|
|
1300
|
+
export const toManagementAuthSettingsPayload = (domain) => ({
|
|
1301
|
+
available_auth_providers: toAvailableAuthProvidersPayload(domain.availableAuthProviders),
|
|
1302
|
+
max_total_identifiers: domain.maxTotalIdentifiers,
|
|
1303
|
+
max_email_identifiers: domain.maxEmailIdentifiers,
|
|
1304
|
+
max_phone_identifiers: domain.maxPhoneIdentifiers,
|
|
1305
|
+
max_identifiers_per_external_provider: domain.maxIdentifiersPerExternalProvider,
|
|
1306
|
+
max_active_sessions_for_open_user: domain.maxActiveSessionsForOpenUser,
|
|
1307
|
+
max_active_sessions_for_management_user: domain.maxActiveSessionsForManagementUser,
|
|
1308
|
+
access_token_validity_seconds: domain.accessTokenExpirationSeconds,
|
|
1309
|
+
refresh_token_validity_seconds: domain.refreshTokenExpirationSeconds,
|
|
1310
|
+
account_deletion_grace_period_seconds: domain.accountDeletionGracePeriodSeconds,
|
|
1311
|
+
account_deletion_check_interval_seconds: domain.accountDeletionCheckIntervalSeconds,
|
|
1312
|
+
is_registration_enabled: domain.isRegistrationEnabled,
|
|
1313
|
+
open_email_restriction_policy: toEmailRestrictionPolicyPayload(domain.openEmailRestrictionPolicy),
|
|
1314
|
+
management_email_restriction_policy: toEmailRestrictionPolicyPayload(domain.managementEmailRestrictionPolicy)
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
export const toOpenAuthSettings = (payload) => ({
|
|
1318
|
+
availableAuthProviders: toAvailableAuthProviders(payload.available_auth_providers),
|
|
1319
|
+
maxTotalIdentifiers: payload.max_total_identifiers,
|
|
1320
|
+
maxEmailIdentifiers: payload.max_email_identifiers,
|
|
1321
|
+
maxPhoneIdentifiers: payload.max_phone_identifiers,
|
|
1322
|
+
maxIdentifiersPerExternalProvider: payload.max_identifiers_per_external_provider,
|
|
1323
|
+
isRegistrationEnabled: payload.is_registration_enabled
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
export const toOpenAuthSettingsPayload = (domain) => ({
|
|
1327
|
+
available_auth_providers: toAvailableAuthProvidersPayload(domain.availableAuthProviders),
|
|
1328
|
+
max_total_identifiers: domain.maxTotalIdentifiers,
|
|
1329
|
+
max_email_identifiers: domain.maxEmailIdentifiers,
|
|
1330
|
+
max_phone_identifiers: domain.maxPhoneIdentifiers,
|
|
1331
|
+
max_identifiers_per_external_provider: domain.maxIdentifiersPerExternalProvider,
|
|
1332
|
+
is_registration_enabled: domain.isRegistrationEnabled
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
export const toManagementUserConfiguration = (payload) => ({
|
|
1336
|
+
managementGlobalSettings: toManagementGlobalSettings(payload.management_global_settings),
|
|
1337
|
+
managementSecuritySettings: toManagementSecuritySettings(payload.management_security_settings),
|
|
1338
|
+
managementAuthSettings: toManagementAuthSettings(payload.management_auth_settings)
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
export const toManagementUserConfigurationPayload = (domain) => ({
|
|
1342
|
+
management_global_settings: toManagementGlobalSettingsPayload(domain.managementGlobalSettings),
|
|
1343
|
+
management_security_settings: toManagementSecuritySettingsPayload(domain.managementSecuritySettings),
|
|
1344
|
+
management_auth_settings: toManagementAuthSettingsPayload(domain.managementAuthSettings)
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
export const toOpenUserConfiguration = (payload) => ({
|
|
1348
|
+
openGlobalSettings: toOpenGlobalSettings(payload.open_global_settings),
|
|
1349
|
+
openSecuritySettings: toOpenSecuritySettings(payload.open_security_settings),
|
|
1350
|
+
openAuthSettings: toOpenAuthSettings(payload.open_auth_settings)
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
export const toOpenUserConfigurationPayload = (domain) => ({
|
|
1354
|
+
open_global_settings: toOpenGlobalSettingsPayload(domain.openGlobalSettings),
|
|
1355
|
+
open_security_settings: toOpenSecuritySettingsPayload(domain.openSecuritySettings),
|
|
1356
|
+
open_auth_settings: toOpenAuthSettingsPayload(domain.openAuthSettings)
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
export const toEmailRestrictionPolicy = (payload) => ({
|
|
1360
|
+
isBlacklistEnabled: payload.is_blacklist_enabled,
|
|
1361
|
+
blacklist: payload.blacklist,
|
|
1362
|
+
isWhitelistEnabled: payload.is_whitelist_enabled,
|
|
1363
|
+
whitelist: payload.whitelist
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
export const toEmailRestrictionPolicyPayload = (domain) => ({
|
|
1367
|
+
is_blacklist_enabled: domain.isBlacklistEnabled,
|
|
1368
|
+
blacklist: domain.blacklist,
|
|
1369
|
+
is_whitelist_enabled: domain.isWhitelistEnabled,
|
|
1370
|
+
whitelist: domain.whitelist
|
|
1371
|
+
});
|
|
1372
|
+
|
|
1373
|
+
export const toUserIdentifier = (payload) => ({
|
|
1374
|
+
id: toUserIdentifierIdOrThrow(payload.id),
|
|
1375
|
+
userId: toUserIdOrThrow(payload.user_id),
|
|
1376
|
+
userAuthProvider: payload.user_auth_provider,
|
|
1377
|
+
identifier: payload.identifier,
|
|
1378
|
+
displayName: payload.display_name,
|
|
1379
|
+
externalProviderEmail: payload.external_provider_email,
|
|
1380
|
+
isSensitiveValuesMasked: payload.is_sensitive_values_masked,
|
|
1381
|
+
createdAt: payload.created_at,
|
|
1382
|
+
updatedAt: payload.updated_at
|
|
1383
|
+
});
|
|
1384
|
+
|
|
1385
|
+
export const toUserIdentifierPayload = (domain) => ({
|
|
1386
|
+
id: domain.id,
|
|
1387
|
+
user_id: domain.userId,
|
|
1388
|
+
user_auth_provider: domain.userAuthProvider,
|
|
1389
|
+
identifier: domain.identifier,
|
|
1390
|
+
display_name: domain.displayName,
|
|
1391
|
+
external_provider_email: domain.externalProviderEmail,
|
|
1392
|
+
is_sensitive_values_masked: domain.isSensitiveValuesMasked,
|
|
1393
|
+
created_at: domain.createdAt,
|
|
1394
|
+
updated_at: domain.updatedAt
|
|
1395
|
+
});
|
|
1396
|
+
|
|
1397
|
+
export const toDeletedSessions = (payload) => ({
|
|
1398
|
+
deletedSessionIds: payload.deleted_session_ids ? payload.deleted_session_ids.map(val => toUserSessionIdOrThrow(val)) : []
|
|
1399
|
+
});
|
|
470
1400
|
|
|
471
|
-
export const
|
|
1401
|
+
export const toDeletedSessionsPayload = (domain) => ({
|
|
1402
|
+
deleted_session_ids: domain.deletedSessionIds
|
|
1403
|
+
});
|
|
1404
|
+
|
|
1405
|
+
export const toUserSession = (payload) => ({
|
|
1406
|
+
id: toUserSessionIdOrThrow(payload.id),
|
|
1407
|
+
userId: toUserIdOrThrow(payload.user_id),
|
|
1408
|
+
userRole: payload.user_role,
|
|
1409
|
+
identifier: payload.identifier,
|
|
1410
|
+
identifierId: toUserIdentifierIdOrThrow(payload.identifier_id),
|
|
1411
|
+
identifierDisplayName: payload.identifier_display_name,
|
|
1412
|
+
identifierAuthProvider: payload.identifier_auth_provider,
|
|
1413
|
+
deviceInfo: toClientDeviceInfo(payload.client_device_info),
|
|
1414
|
+
userAgent: payload.user_agent,
|
|
1415
|
+
ipAddress: payload.ip_address,
|
|
1416
|
+
expiresAt: payload.expires_at,
|
|
1417
|
+
lastAccessedAt: payload.last_accessed_at,
|
|
1418
|
+
lastReauthenticatedAt: payload.last_reauthenticated_at,
|
|
1419
|
+
isSensitiveValuesMasked: payload.is_sensitive_values_masked,
|
|
1420
|
+
createdAt: payload.created_at,
|
|
1421
|
+
updatedAt: payload.updated_at
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
export const toUserSessionPayload = (domain) => ({
|
|
1425
|
+
id: domain.id,
|
|
1426
|
+
user_id: domain.userId,
|
|
1427
|
+
user_role: domain.userRole,
|
|
1428
|
+
identifier: domain.identifier,
|
|
1429
|
+
identifier_id: domain.identifierId,
|
|
1430
|
+
identifier_display_name: domain.identifierDisplayName,
|
|
1431
|
+
identifier_auth_provider: domain.identifierAuthProvider,
|
|
1432
|
+
client_device_info: toClientDeviceInfoPayload(domain.deviceInfo),
|
|
1433
|
+
user_agent: domain.userAgent,
|
|
1434
|
+
ip_address: domain.ipAddress,
|
|
1435
|
+
expires_at: domain.expiresAt,
|
|
1436
|
+
last_accessed_at: domain.lastAccessedAt,
|
|
1437
|
+
last_reauthenticated_at: domain.lastReauthenticatedAt,
|
|
1438
|
+
is_sensitive_values_masked: domain.isSensitiveValuesMasked,
|
|
1439
|
+
created_at: domain.createdAt,
|
|
1440
|
+
updated_at: domain.updatedAt
|
|
1441
|
+
});
|
|
1442
|
+
|
|
1443
|
+
export const toSessionToken = (payload) => ({
|
|
1444
|
+
accessToken: payload.access_token,
|
|
1445
|
+
refreshToken: payload.refresh_token,
|
|
1446
|
+
expiresAt: payload.expires_at,
|
|
1447
|
+
tokenType: payload.token_type,
|
|
1448
|
+
sessionId: toUserSessionIdOrThrow(payload.session_id),
|
|
1449
|
+
identifierId: toUserIdentifierIdOrThrow(payload.identifier_id)
|
|
1450
|
+
});
|
|
1451
|
+
|
|
1452
|
+
export const toSessionTokenPayload = (domain) => ({
|
|
1453
|
+
access_token: domain.accessToken,
|
|
1454
|
+
refresh_token: domain.refreshToken,
|
|
1455
|
+
expires_at: domain.expiresAt,
|
|
1456
|
+
token_type: domain.tokenType,
|
|
1457
|
+
session_id: domain.sessionId,
|
|
1458
|
+
identifier_id: domain.identifierId
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1461
|
+
export const toUserDetails = (payload) => ({
|
|
1462
|
+
id: toUserIdOrThrow(payload.id),
|
|
1463
|
+
role: payload.role,
|
|
1464
|
+
accountStatus: payload.account_status,
|
|
1465
|
+
accountStatusOnRestore: payload.account_status_on_restore,
|
|
1466
|
+
authorityLevel: payload.authority_level,
|
|
1467
|
+
permissionCodes: payload.permission_codes ? payload.permission_codes.map(val => toPermissionCodeOrThrow(val)) : [],
|
|
1468
|
+
isTotpEnabled: payload.is_totp_enabled,
|
|
1469
|
+
lastLoginAt: payload.last_login_at,
|
|
1470
|
+
lastActiveAt: payload.last_active_at,
|
|
1471
|
+
createdAt: payload.created_at,
|
|
1472
|
+
updatedAt: payload.updated_at,
|
|
1473
|
+
scheduledPermanentDeletionAt: payload.scheduled_permanent_deletion_at,
|
|
1474
|
+
lockoutType: payload.account_lockout_type,
|
|
1475
|
+
temporaryLockoutUntil: payload.temporary_lockout_until
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
export const toUserDetailsPayload = (domain) => ({
|
|
1479
|
+
id: domain.id,
|
|
1480
|
+
role: domain.role,
|
|
1481
|
+
account_status: domain.accountStatus,
|
|
1482
|
+
account_status_on_restore: domain.accountStatusOnRestore,
|
|
1483
|
+
authority_level: domain.authorityLevel,
|
|
1484
|
+
permission_codes: domain.permissionCodes,
|
|
1485
|
+
is_totp_enabled: domain.isTotpEnabled,
|
|
1486
|
+
last_login_at: domain.lastLoginAt,
|
|
1487
|
+
last_active_at: domain.lastActiveAt,
|
|
1488
|
+
created_at: domain.createdAt,
|
|
1489
|
+
updated_at: domain.updatedAt,
|
|
1490
|
+
scheduled_permanent_deletion_at: domain.scheduledPermanentDeletionAt,
|
|
1491
|
+
account_lockout_type: domain.lockoutType,
|
|
1492
|
+
temporary_lockout_until: domain.temporaryLockoutUntil
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
export const toUserPublic = (payload) => ({
|
|
1496
|
+
id: toUserIdOrThrow(payload.id),
|
|
1497
|
+
role: payload.role,
|
|
1498
|
+
accountStatus: payload.account_status
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1501
|
+
export const toUserPublicPayload = (domain) => ({
|
|
1502
|
+
id: domain.id,
|
|
1503
|
+
role: domain.role,
|
|
1504
|
+
account_status: domain.accountStatus
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
export const clientTypeSchema = z.enum(["web", "android", "ios", "desktop"]);
|
|
1508
|
+
export const ClientType = {
|
|
1509
|
+
WEB: "web",
|
|
1510
|
+
ANDROID: "android",
|
|
1511
|
+
IOS: "ios",
|
|
1512
|
+
DESKTOP: "desktop"
|
|
1513
|
+
};
|
|
472
1514
|
|
|
473
|
-
export const
|
|
1515
|
+
export const sortOrderSchema = z.enum(["asc", "desc"]);
|
|
1516
|
+
export const SortOrder = {
|
|
1517
|
+
ASC: "asc",
|
|
1518
|
+
DESC: "desc"
|
|
1519
|
+
};
|
|
474
1520
|
|
|
475
|
-
export const
|
|
1521
|
+
export const accountLockoutTypeSchema = z.enum(["none", "indefinite", "temporary"]);
|
|
1522
|
+
export const AccountLockoutType = {
|
|
1523
|
+
NONE: "none",
|
|
1524
|
+
INDEFINITE: "indefinite",
|
|
1525
|
+
TEMPORARY: "temporary",
|
|
1526
|
+
PERMANENT: "indefinite"
|
|
1527
|
+
};
|
|
476
1528
|
|
|
477
|
-
export const
|
|
1529
|
+
export const passwordPolicyFailReasonSchema = z.enum(["too_short", "no_letter", "no_uppercase", "no_lowercase", "no_digit", "no_special_char", "too_common"]);
|
|
1530
|
+
export const PasswordPolicyFailReason = {
|
|
1531
|
+
TOO_SHORT: "too_short",
|
|
1532
|
+
NO_LETTER: "no_letter",
|
|
1533
|
+
NO_UPPERCASE: "no_uppercase",
|
|
1534
|
+
NO_LOWERCASE: "no_lowercase",
|
|
1535
|
+
NO_DIGIT: "no_digit",
|
|
1536
|
+
NO_SPECIAL_CHAR: "no_special_char",
|
|
1537
|
+
TOO_COMMON: "too_common"
|
|
1538
|
+
};
|
|
478
1539
|
|
|
479
|
-
export const
|
|
1540
|
+
export const auditActorTypeSchema = z.enum(["user", "system", "service"]);
|
|
1541
|
+
export const AuditActorType = {
|
|
1542
|
+
USER: "user",
|
|
1543
|
+
SYSTEM: "system",
|
|
1544
|
+
SERVICE: "service"
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
export const auditValueSensitivitySchema = z.enum(["non_sensitive", "email", "phone_number", "ip_address", "partial_value_mask", "full_value_mask"]);
|
|
1548
|
+
export const AuditValueSensitivity = {
|
|
1549
|
+
NON_SENSITIVE: "non_sensitive",
|
|
1550
|
+
EMAIL: "email",
|
|
1551
|
+
PHONE_NUMBER: "phone_number",
|
|
1552
|
+
IP_ADDRESS: "ip_address",
|
|
1553
|
+
PARTIAL_VALUE_MASK: "partial_value_mask",
|
|
1554
|
+
FULL_VALUE_MASK: "full_value_mask"
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
export const auditStatusSchema = z.enum(["success", "failed", "denied"]);
|
|
1558
|
+
export const AuditStatus = {
|
|
1559
|
+
SUCCESS: "success",
|
|
1560
|
+
FAILED: "failed",
|
|
1561
|
+
DENIED: "denied"
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
export const commonAuditResourceTypeSchema = z.enum(["audit_event", "audit_events"]);
|
|
1565
|
+
export const CommonAuditResourceType = {
|
|
1566
|
+
AUDIT_EVENT: "audit_event",
|
|
1567
|
+
AUDIT_EVENTS: "audit_events"
|
|
1568
|
+
};
|
|
480
1569
|
|
|
481
1570
|
export const securityAuditResourceTypeSchema = z.enum(["security_settings"]);
|
|
1571
|
+
export const SecurityAuditResourceType = {
|
|
1572
|
+
SECURITY_SETTINGS: "security_settings"
|
|
1573
|
+
};
|
|
482
1574
|
|
|
483
1575
|
export const settingsAuditResourceTypeSchema = z.enum(["global_settings"]);
|
|
1576
|
+
export const SettingsAuditResourceType = {
|
|
1577
|
+
GLOBAL_SETTINGS: "global_settings"
|
|
1578
|
+
};
|
|
484
1579
|
|
|
485
|
-
export const userAuditResourceTypeSchema = z.enum(["auth_settings", "user", "email_address", "phone_number", "identifier", "session"]);
|
|
1580
|
+
export const userAuditResourceTypeSchema = z.enum(["auth_settings", "user", "email_address", "phone_number", "identifier", "session"]);
|
|
1581
|
+
export const UserAuditResourceType = {
|
|
1582
|
+
AUTH_SETTINGS: "auth_settings",
|
|
1583
|
+
USER: "user",
|
|
1584
|
+
EMAIL_ADDRESS: "email_address",
|
|
1585
|
+
PHONE_NUMBER: "phone_number",
|
|
1586
|
+
IDENTIFIER: "identifier",
|
|
1587
|
+
SESSION: "session"
|
|
1588
|
+
};
|
|
486
1589
|
|
|
487
|
-
export const securityAuditActionTypeSchema = z.enum(["management_update_security_settings", "management_reset_security_settings"]);
|
|
1590
|
+
export const securityAuditActionTypeSchema = z.enum(["management_update_security_settings", "management_reset_security_settings"]);
|
|
1591
|
+
export const SecurityAuditActionType = {
|
|
1592
|
+
MANAGEMENT_UPDATE_SECURITY_SETTINGS: "management_update_security_settings",
|
|
1593
|
+
MANAGEMENT_RESET_SECURITY_SETTINGS: "management_reset_security_settings"
|
|
1594
|
+
};
|
|
488
1595
|
|
|
489
|
-
export const settingsAuditActionTypeSchema = z.enum(["management_update_global_settings", "management_reset_global_settings"]);
|
|
1596
|
+
export const settingsAuditActionTypeSchema = z.enum(["management_update_global_settings", "management_reset_global_settings"]);
|
|
1597
|
+
export const SettingsAuditActionType = {
|
|
1598
|
+
MANAGEMENT_UPDATE_GLOBAL_SETTINGS: "management_update_global_settings",
|
|
1599
|
+
MANAGEMENT_RESET_GLOBAL_SETTINGS: "management_reset_global_settings"
|
|
1600
|
+
};
|
|
490
1601
|
|
|
491
|
-
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"]);
|
|
1602
|
+
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"]);
|
|
1603
|
+
export const UserAuditActionType = {
|
|
1604
|
+
MANAGEMENT_UPDATE_AUTH_SETTINGS: "management_update_auth_settings",
|
|
1605
|
+
MANAGEMENT_RESET_AUTH_SETTINGS: "management_reset_auth_settings",
|
|
1606
|
+
MANAGEMENT_DELETE_IDENTIFIER: "management_delete_identifier",
|
|
1607
|
+
MANAGEMENT_DELETE_IDENTIFIER_PASSWORD: "management_delete_identifier_password",
|
|
1608
|
+
MANAGEMENT_DELETE_SESSION: "management_delete_session",
|
|
1609
|
+
MANAGEMENT_DELETE_ALL_USER_SESSIONS: "management_delete_all_user_sessions",
|
|
1610
|
+
MANAGEMENT_UPDATE_USER: "management_update_user",
|
|
1611
|
+
MANAGEMENT_DELETE_USER: "management_delete_user",
|
|
1612
|
+
MANAGEMENT_CREATE_USER: "management_create_user",
|
|
1613
|
+
MANAGEMENT_DISABLE_USER_TOTP: "management_disable_user_totp",
|
|
1614
|
+
LOGIN_BY_EMAIL: "login_by_email",
|
|
1615
|
+
LOGIN_BY_PHONE: "login_by_phone",
|
|
1616
|
+
LOGIN_BY_EXTERNAL_AUTH_PROVIDER: "login_by_external_auth_provider",
|
|
1617
|
+
LOGIN_BY_TOTP: "login_by_totp",
|
|
1618
|
+
LOGIN_BY_TOTP_RECOVERY_CODE: "login_by_totp_recovery_code",
|
|
1619
|
+
NEW_DEVICE_DETECTED: "new_device_detected",
|
|
1620
|
+
REGISTER_BY_EMAIL: "register_by_email",
|
|
1621
|
+
RESET_PASSWORD: "reset_password",
|
|
1622
|
+
SELF_UNLOCK_ACCOUNT: "self_unlock_account",
|
|
1623
|
+
LOGOUT: "logout",
|
|
1624
|
+
SELF_DELETE_SESSION: "self_delete_session",
|
|
1625
|
+
SELF_DELETE_OTHER_SESSIONS: "self_delete_other_sessions",
|
|
1626
|
+
REAUTHENTICATE_SESSION: "reauthenticate_session",
|
|
1627
|
+
SELF_DELETE_IDENTIFIER: "self_delete_identifier",
|
|
1628
|
+
ADD_IDENTIFIER_EMAIL: "add_identifier_email",
|
|
1629
|
+
ADD_IDENTIFIER_PHONE: "add_identifier_phone",
|
|
1630
|
+
ADD_IDENTIFIER_EXTERNAL_AUTH_PROVIDER: "add_identifier_external_auth_provider",
|
|
1631
|
+
CHANGE_PASSWORD: "change_password",
|
|
1632
|
+
SELF_SCHEDULE_USER_DELETION: "self_schedule_user_deletion",
|
|
1633
|
+
SELF_RESTORE_USER: "self_restore_user",
|
|
1634
|
+
SELF_SETUP_TOTP_INITIATED: "self_setup_totp_initiated",
|
|
1635
|
+
SELF_ENABLE_TOTP: "self_enable_totp",
|
|
1636
|
+
SELF_DISABLE_TOTP: "self_disable_totp",
|
|
1637
|
+
SELF_GET_RECOVERY_CODES: "self_get_recovery_codes",
|
|
1638
|
+
SELF_REGENERATE_RECOVERY_CODES: "self_regenerate_recovery_codes",
|
|
1639
|
+
REFRESH_TOKEN_REUSE_DETECTED: "refresh_token_reuse_detected"
|
|
1640
|
+
};
|
|
492
1641
|
|
|
493
|
-
export const
|
|
1642
|
+
export const commonAuditMetadataKeySchema = z.enum(["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"]);
|
|
1643
|
+
export const CommonAuditMetadataKey = {
|
|
1644
|
+
DEVICE_ID: "device_id",
|
|
1645
|
+
DEVICE_NAME: "device_name",
|
|
1646
|
+
CLIENT_TYPE: "client_type",
|
|
1647
|
+
LANGUAGE: "language",
|
|
1648
|
+
APP_VERSION: "app_version",
|
|
1649
|
+
OS_VERSION: "os_version",
|
|
1650
|
+
USER_AGENT: "user_agent",
|
|
1651
|
+
IP_ADDRESS: "key_ip_address",
|
|
1652
|
+
HOST: "host",
|
|
1653
|
+
ORIGIN: "origin",
|
|
1654
|
+
API_VERSION: "api_version",
|
|
1655
|
+
TRACE_ID: "trace_id",
|
|
1656
|
+
DENIED_REASON: "denied_reason",
|
|
1657
|
+
ERROR_ID: "error_id",
|
|
1658
|
+
ERROR_CODE: "error_code"
|
|
1659
|
+
};
|
|
494
1660
|
|
|
495
|
-
export const
|
|
1661
|
+
export const userAuditMetadataKeySchema = z.enum(["user_id", "session_id", "identifier_id", "email_address", "phone_number", "user_auth_provider", "external_id", "account_lockout_type", "temporary_lockout_until"]);
|
|
1662
|
+
export const UserAuditMetadataKey = {
|
|
1663
|
+
USER_ID: "user_id",
|
|
1664
|
+
SESSION_ID: "session_id",
|
|
1665
|
+
IDENTIFIER_ID: "identifier_id",
|
|
1666
|
+
EMAIL_ADDRESS: "email_address",
|
|
1667
|
+
PHONE_NUMBER: "phone_number",
|
|
1668
|
+
USER_AUTH_PROVIDER: "user_auth_provider",
|
|
1669
|
+
EXTERNAL_ID: "external_id",
|
|
1670
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
1671
|
+
TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until"
|
|
1672
|
+
};
|
|
496
1673
|
|
|
497
|
-
export const
|
|
1674
|
+
export const userAccountStatusSchema = z.enum(["active", "read_only", "banned", "security_hold", "pending_deletion"]);
|
|
1675
|
+
export const UserAccountStatus = {
|
|
1676
|
+
ACTIVE: "active",
|
|
1677
|
+
READ_ONLY: "read_only",
|
|
1678
|
+
BANNED: "banned",
|
|
1679
|
+
SECURITY_HOLD: "security_hold",
|
|
1680
|
+
PENDING_DELETION: "pending_deletion"
|
|
1681
|
+
};
|
|
498
1682
|
|
|
499
|
-
export const
|
|
1683
|
+
export const userRoleSchema = z.enum(["user", "staff", "admin"]);
|
|
1684
|
+
export const UserRole = {
|
|
1685
|
+
USER: "user",
|
|
1686
|
+
STAFF: "staff",
|
|
1687
|
+
ADMIN: "admin",
|
|
1688
|
+
CLIENT_USER: "user",
|
|
1689
|
+
MANAGEMENT_USER: "admin"
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1692
|
+
export const userAuthProviderSchema = z.enum(["email", "phone", "google", "apple"]);
|
|
1693
|
+
export const UserAuthProvider = {
|
|
1694
|
+
EMAIL: "email",
|
|
1695
|
+
PHONE: "phone",
|
|
1696
|
+
GOOGLE: "google",
|
|
1697
|
+
APPLE: "apple"
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
export const externalAuthProviderSchema = z.enum(["google", "apple"]);
|
|
1701
|
+
export const ExternalAuthProvider = {
|
|
1702
|
+
GOOGLE: "google",
|
|
1703
|
+
APPLE: "apple"
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
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"]);
|
|
1707
|
+
export const UserSortBy = {
|
|
1708
|
+
LAST_LOGIN_AT: "last_login_at",
|
|
1709
|
+
LAST_ACTIVE_AT: "last_active_at",
|
|
1710
|
+
SCHEDULED_PERMANENT_DELETION_AT: "scheduled_permanent_deletion_at",
|
|
1711
|
+
ACCOUNT_LOCKOUT_TYPE: "account_lockout_type",
|
|
1712
|
+
TEMPORARY_LOCKOUT_UNTIL: "temporary_lockout_until",
|
|
1713
|
+
CREATED_AT: "created_at",
|
|
1714
|
+
UPDATED_AT: "updated_at"
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
export const userIdentifierSortBySchema = z.enum(["created_at", "updated_at"]);
|
|
1718
|
+
export const UserIdentifierSortBy = {
|
|
1719
|
+
CREATED_AT: "created_at",
|
|
1720
|
+
UPDATED_AT: "updated_at"
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
export const userSessionSortBySchema = z.enum(["expires_at", "last_accessed_at", "last_reauthenticated_at", "created_at", "updated_at"]);
|
|
1724
|
+
export const UserSessionSortBy = {
|
|
1725
|
+
EXPIRES_AT: "expires_at",
|
|
1726
|
+
LAST_ACCESSED_AT: "last_accessed_at",
|
|
1727
|
+
LAST_REAUTHENTICATED_AT: "last_reauthenticated_at",
|
|
1728
|
+
CREATED_AT: "created_at",
|
|
1729
|
+
UPDATED_AT: "updated_at"
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
export const auditEventSortBySchema = z.enum(["created_at"]);
|
|
1733
|
+
export const AuditEventSortBy = {
|
|
1734
|
+
CREATED_AT: "created_at"
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
export const timestampSortBySchema = z.enum(["created_at", "updated_at"]);
|
|
1738
|
+
export const TimestampSortBy = {
|
|
1739
|
+
CREATED_AT: "created_at",
|
|
1740
|
+
UPDATED_AT: "updated_at"
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
export const unlockMethodSchema = z.enum(["EMAIL", "PHONE"]);
|
|
1744
|
+
export const UnlockMethod = {
|
|
1745
|
+
EMAIL: "EMAIL",
|
|
1746
|
+
PHONE: "PHONE"
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1749
|
+
export const confirmationTypeSchema = z.enum(["REGISTRATION_EMAIL", "ADD_EMAIL", "PASSWORD_RESET_EMAIL", "LOGIN_PHONE", "ADD_PHONE", "UNLOCK_EMAIL", "UNLOCK_PHONE"]);
|
|
1750
|
+
export const ConfirmationType = {
|
|
1751
|
+
REGISTRATION_EMAIL: "REGISTRATION_EMAIL",
|
|
1752
|
+
ADD_EMAIL: "ADD_EMAIL",
|
|
1753
|
+
PASSWORD_RESET_EMAIL: "PASSWORD_RESET_EMAIL",
|
|
1754
|
+
LOGIN_PHONE: "LOGIN_PHONE",
|
|
1755
|
+
ADD_PHONE: "ADD_PHONE",
|
|
1756
|
+
UNLOCK_EMAIL: "UNLOCK_EMAIL",
|
|
1757
|
+
UNLOCK_PHONE: "UNLOCK_PHONE"
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
export const appTypeSchema = z.enum(["CLIENT", "MANAGEMENT"]);
|
|
1761
|
+
export const AppType = {
|
|
1762
|
+
CLIENT: "CLIENT",
|
|
1763
|
+
MANAGEMENT: "MANAGEMENT"
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
export const confirmationKeySchema = z.object({
|
|
1767
|
+
type: confirmationTypeSchema,
|
|
1768
|
+
identifier: z.string()
|
|
1769
|
+
});
|
|
1770
|
+
|
|
1771
|
+
export const UserSortValues = {
|
|
1772
|
+
UserSortBy,
|
|
1773
|
+
UserIdentifierSortBy,
|
|
1774
|
+
UserSessionSortBy
|
|
1775
|
+
};
|
|
500
1776
|
|
|
501
1777
|
export function pagedResultSchema(itemSchema) {
|
|
502
1778
|
return z.object({
|
|
@@ -642,7 +1918,7 @@ created_at: z.number()
|
|
|
642
1918
|
export const auditEventMetadataPayloadSchema = z.object({
|
|
643
1919
|
key: z.string(),
|
|
644
1920
|
value: z.string(),
|
|
645
|
-
value_sensitivity:
|
|
1921
|
+
value_sensitivity: auditValueSensitivitySchema
|
|
646
1922
|
});
|
|
647
1923
|
|
|
648
1924
|
export const authDataPayloadSchema = z.object({
|
|
@@ -771,6 +2047,24 @@ role: userRoleSchema,
|
|
|
771
2047
|
account_status: userAccountStatusSchema
|
|
772
2048
|
});
|
|
773
2049
|
|
|
2050
|
+
export const socketFrameSchema = z.object({
|
|
2051
|
+
id: userIdSchema,
|
|
2052
|
+
type: z.string(),
|
|
2053
|
+
payload: z.unknown().nullable(),
|
|
2054
|
+
metadata: z.record(z.string(), z.string()),
|
|
2055
|
+
timestamp: z.number()
|
|
2056
|
+
});
|
|
2057
|
+
|
|
2058
|
+
export const webSocketInitializePayloadSchema = z.object({
|
|
2059
|
+
client_type: clientTypeSchema.nullable(),
|
|
2060
|
+
language: z.string().nullable(),
|
|
2061
|
+
device_id: clientDeviceIdSchema.nullable(),
|
|
2062
|
+
device_name: z.string().nullable(),
|
|
2063
|
+
app_version: z.string().nullable(),
|
|
2064
|
+
operation_system_version: z.string().nullable(),
|
|
2065
|
+
api_version: z.string().nullable()
|
|
2066
|
+
});
|
|
2067
|
+
|
|
774
2068
|
export const createByEmailRequestSchema = z.object({
|
|
775
2069
|
email: z.string(),
|
|
776
2070
|
password: z.string().nullable(),
|