Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/utils/validation-utils.js
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | return convertClientIDsToServerIDs( | ||||
convertedInput, | convertedInput, | ||||
); | ); | ||||
} | } | ||||
return convertedInput; | return convertedInput; | ||||
} | } | ||||
function validateOutput<T>( | function validateOutput<T>( | ||||
viewer: Viewer, | viewer: ?Viewer, | ||||
outputValidator: TType<T>, | outputValidator: TType<T>, | ||||
data: T, | data: T, | ||||
): T { | ): T { | ||||
if (!outputValidator.is(data)) { | if (!outputValidator.is(data)) { | ||||
console.trace( | console.trace( | ||||
'Output validation failed, validator is:', | 'Output validation failed, validator is:', | ||||
outputValidator.displayName, | outputValidator.displayName, | ||||
); | ); | ||||
return data; | return data; | ||||
} | } | ||||
if ( | if ( | ||||
hasMinCodeVersion(viewer.platformDetails, 1000) && | hasMinCodeVersion(viewer?.platformDetails, 1000) && | ||||
!isWebPlatform(viewer.platformDetails?.platform) && | !isWebPlatform(viewer?.platformDetails?.platform) && | ||||
convertToNewIDSchema | convertToNewIDSchema | ||||
) { | ) { | ||||
return convertServerIDsToClientIDs( | return convertServerIDsToClientIDs( | ||||
keyserverPrefixID, | keyserverPrefixID, | ||||
outputValidator, | outputValidator, | ||||
data, | data, | ||||
); | ); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines |