MCPcopy
hub / github.com/simstudioai/sim / connectRequest

Function connectRequest

apps/sim/app/api/tools/onepassword/utils.ts:332–360  ·  view source on GitHub ↗
(options: {
  serverUrl: string
  apiKey: string
  path: string
  method: string
  body?: unknown
  query?: string
})

Source from the content-addressed store, hash-verified

330
331/** Proxy a request to the 1Password Connect Server. */
332export async function connectRequest(options: {
333 serverUrl: string
334 apiKey: string
335 path: string
336 method: string
337 body?: unknown
338 query?: string
339}): Promise<ConnectResponse> {
340 const resolvedIP = await validateConnectServerUrl(options.serverUrl)
341
342 const base = options.serverUrl.replace(/\/$/, '')
343 const queryStr = options.query ? `?${options.query}` : ''
344 const url = `${base}${options.path}${queryStr}`
345
346 const headers: Record<string, string> = {
347 Authorization: `Bearer ${options.apiKey}`,
348 }
349
350 if (options.body) {
351 headers['Content-Type'] = 'application/json'
352 }
353
354 return secureFetchWithPinnedIP(url, resolvedIP, {
355 method: options.method,
356 headers,
357 body: options.body ? JSON.stringify(options.body) : undefined,
358 allowHttp: true,
359 })
360}
361
362/** Normalize an SDK VaultOverview to match Connect API vault shape. */
363export function normalizeSdkVault(vault: VaultOverview): NormalizedVault {

Callers 8

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

Calls 3

secureFetchWithPinnedIPFunction · 0.90
validateConnectServerUrlFunction · 0.85
replaceMethod · 0.65

Tested by

no test coverage detected