MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / connectedUserId

Function connectedUserId

packages/web/src/features/mcp/prismaScope.ts:112–123  ·  view source on GitHub ↗
(userRelation: unknown)

Source from the content-addressed store, hash-verified

110// Extracts the userId from a Prisma relation connect object.
111// Prisma's connect syntax for a relation looks like: { connect: { id: "some-id" } }
112const connectedUserId = (userRelation: unknown): string | undefined => {
113 if (!isRecord(userRelation) || !('connect' in userRelation)) {
114 return undefined;
115 }
116
117 const connect = userRelation.connect;
118 if (!isRecord(connect) || !('id' in connect) || typeof connect.id !== 'string') {
119 return undefined;
120 }
121
122 return connect.id;
123};
124
125const createDataUserId = (row: unknown): string | undefined => {
126 if (!isRecord(row)) {

Callers 1

createDataUserIdFunction · 0.85

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected