MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveActiveShareByToken

Function resolveActiveShareByToken

apps/sim/lib/public-shares/share-manager.ts:212–242  ·  view source on GitHub ↗
(token: string)

Source from the content-addressed store, hash-verified

210}
211
212export async function resolveActiveShareByToken(token: string): Promise<ResolvedShare | null> {
213 const [row] = await db
214 .select({
215 share: publicShare,
216 file: workspaceFiles,
217 workspaceName: workspace.name,
218 ownerName: user.name,
219 })
220 .from(publicShare)
221 .innerJoin(workspaceFiles, eq(workspaceFiles.id, publicShare.resourceId))
222 .leftJoin(workspace, eq(workspace.id, workspaceFiles.workspaceId))
223 .leftJoin(user, eq(user.id, workspaceFiles.userId))
224 .where(
225 and(
226 eq(publicShare.token, token),
227 eq(publicShare.isActive, true),
228 eq(publicShare.resourceType, 'file'),
229 isNull(workspaceFiles.deletedAt)
230 )
231 )
232 .limit(1)
233
234 if (!row) return null
235
236 return {
237 share: row.share,
238 file: row.file,
239 workspaceName: row.workspaceName,
240 ownerName: row.ownerName,
241 }
242}

Callers 6

ImageFunction · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected