MCPcopy Create free account
hub / github.com/CommE2E/comm / convertServerIDsToClientIDs

Function convertServerIDsToClientIDs

lib/utils/conversion-utils.js:19–33  ·  view source on GitHub ↗
(
  serverPrefixID: string,
  outputValidator: TType<T>,
  data: T,
)

Source from the content-addressed store, hash-verified

17} from '../shared/thread-utils.js';
18
19function convertServerIDsToClientIDs<T>(
20 serverPrefixID: string,
21 outputValidator: TType<T>,
22 data: T,
23): T {
24 const conversionFunction = (id: string) => {
25 if (id.indexOf('|') !== -1) {
26 console.warn(`Server id '${id}' already has a prefix`);
27 return id;
28 }
29 return convertIDToNewSchema(id, serverPrefixID);
30 };
31
32 return convertObject(outputValidator, data, [tID], conversionFunction);
33}
34
35function convertClientIDsToServerIDs<T>(
36 serverPrefixID: string,

Callers 2

validateOutputFunction · 0.90

Calls 1

convertObjectFunction · 0.85

Tested by

no test coverage detected