MCPcopy
hub / github.com/lobehub/lobehub / getTrpcClient

Function getTrpcClient

apps/cli/src/api/client.ts:72–91  ·  view source on GitHub ↗
(workspaceId?: string)

Source from the content-addressed store, hash-verified

70}
71
72export async function getTrpcClient(workspaceId?: string): Promise<TrpcClient> {
73 const wsId = resolveWorkspaceId(workspaceId);
74 const cacheKey = wsId ?? PERSONAL_KEY;
75 const cached = _clients.get(cacheKey);
76 if (cached) return cached;
77
78 const { headers, serverUrl } = await getAuthAndServer();
79 const client = createTRPCClient<LambdaRouter>({
80 links: [
81 httpLink({
82 headers: wsId ? { ...headers, 'X-Workspace-Id': wsId } : headers,
83 transformer: superjson,
84 url: `${serverUrl}/trpc/lambda`,
85 }),
86 ],
87 });
88 _clients.set(cacheKey, client);
89
90 return client;
91}
92
93/**
94 * Build a Lambda tRPC client from an already-resolved auth context, without

Callers 15

sendAutoNotifyFunction · 0.90
sendTerminalSignalFunction · 0.90
registerAllowlistCommandFunction · 0.90
registerBotCommandFunction · 0.90
registerTopicCommandFunction · 0.90
registerVerifyCommandFunction · 0.90
registerPluginCommandFunction · 0.90
registerProviderCommandFunction · 0.90
registerKbCommandFunction · 0.90

Calls 4

getAuthAndServerFunction · 0.85
resolveWorkspaceIdFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected