MCPcopy Index your code
hub / github.com/tinyplex/tinybase / request

Function request

src/synchronizers/index.ts:101–125  ·  view source on GitHub ↗
(
    toClientId: IdOrNull,
    message: MessageEnum | any,
    body: any,
    transactionId: Id,
  )

Source from the content-addressed store, hash-verified

99 };
100
101 const request = async <Response>(
102 toClientId: IdOrNull,
103 message: MessageEnum | any,
104 body: any,
105 transactionId: Id,
106 ): Promise<[response: Response, fromClientId: Id, transactionId: Id]> =>
107 promiseNew((resolve, reject) => {
108 const requestId = transactionId + DOT + getUniqueId(4);
109 const timeout = startTimeout(() => {
110 collDel(pendingRequests, requestId);
111 reject(
112 `No response from ${toClientId ?? 'anyone'} to ${requestId}, ` +
113 message,
114 );
115 }, requestTimeoutSeconds);
116 mapSet(pendingRequests, requestId, [
117 toClientId,
118 (response: Response, fromClientId: Id) => {
119 clearTimeout(timeout);
120 collDel(pendingRequests, requestId);
121 resolve([response, fromClientId, transactionId]);
122 },
123 ]);
124 sendImpl(toClientId, requestId, message, body);
125 });
126
127 const mergeTablesStamps = (
128 tablesStamp: TablesStamp,

Callers

nothing calls this directly

Calls 6

promiseNewFunction · 0.90
getUniqueIdFunction · 0.90
startTimeoutFunction · 0.90
collDelFunction · 0.90
mapSetFunction · 0.90
sendImplFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…