import type { QualifiedUserClients , UserClients } from '@wireapp/api-client/src/conversation/' ; import type { QualifiedId } from '@wireapp/api-client/src/user/' ; export function isStringArray ( obj ) { return Array . isArray ( obj ) && ( obj . length === 0 || typeof obj [ 0 ] === 'string' ) ; } export function isQualifiedId ( obj ) { return typeof obj === 'object' && typeof obj [ 'domain' ] === 'string' ; } export function isQualifiedIdArray ( obj ) { return Array . isArray ( obj ) && isQualifiedId ( obj [ 0 ] ) ; } export function isQualifiedUserClients ( obj ) { if ( typeof obj === 'object' ) { const firstUserClientObject = Object . values ( obj ) ?. [ 0 ] ; if ( typeof firstUserClientObject === 'object' ) { const firstClientIdArray = Object . values ( firstUserClientObject as object ) [ 0 ] ; return isStringArray ( firstClientIdArray ) ; } } return false ; } export function isUserClients ( obj ) { if ( typeof obj === 'object' ) { const firstUserClientArray = Object . values ( obj ) ?. [ 0 ] ; return isStringArray ( firstUserClientArray ) ; } return false ; }