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

Function openSession

apps/sim/lib/data-drains/destinations/bigquery.ts:310–332  ·  view source on GitHub ↗
({ config, credentials })

Source from the content-addressed store, hash-verified

308 },
309
310 openSession({ config, credentials }) {
311 const account = parseServiceAccount(credentials.serviceAccountJson)
312 const jwt = buildJwt(account)
313 return {
314 async deliver({ body, metadata, signal }) {
315 const rows = parseNdjsonObjects(body, { requireObject: true }) as Record<string, unknown>[]
316 if (rows.length === 0) {
317 return {
318 locator: `bigquery://${config.projectId}/${config.datasetId}/${config.tableId}#${metadata.runId}-${metadata.sequence}`,
319 }
320 }
321 await insertAll({ config, rows, metadata, jwt, signal })
322 logger.debug('BigQuery chunk delivered', {
323 table: `${config.projectId}.${config.datasetId}.${config.tableId}`,
324 rows: rows.length,
325 })
326 return {
327 locator: `bigquery://${config.projectId}/${config.datasetId}/${config.tableId}#${metadata.runId}-${metadata.sequence}`,
328 }
329 },
330 async close() {},
331 }
332 },
333}

Callers

nothing calls this directly

Calls 2

parseServiceAccountFunction · 0.90
buildJwtFunction · 0.70

Tested by

no test coverage detected