MCPcopy Create free account
hub / github.com/electric-sql/electric / decodeJsonObject

Function decodeJsonObject

packages/agents-server/src/utils/server-utils.ts:493–508  ·  view source on GitHub ↗
(
  body: Uint8Array
)

Source from the content-addressed store, hash-verified

491}
492
493export function decodeJsonObject(
494 body: Uint8Array
495): Record<string, unknown> | null {
496 if (body.length === 0) return null
497
498 try {
499 const parsed = JSON.parse(new TextDecoder().decode(body)) as unknown
500 if (parsed && typeof parsed === `object` && !Array.isArray(parsed)) {
501 return parsed as Record<string, unknown>
502 }
503 } catch {
504 // Not JSON; callers can fall back to raw bytes.
505 }
506
507 return null
508}
509
510function applyTenantShapeWhere(
511 target: URL,

Callers 1

wakeCallbackFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected