MCPcopy
hub / github.com/prisma/prisma / getItxScopeContext

Function getItxScopeContext

packages/client/src/runtime/getPrismaClient.ts:254–267  ·  view source on GitHub ↗
(client: object)

Source from the content-addressed store, hash-verified

252type ItxScopeContext = TopLevelItxScopeContext | NestedItxScopeContext
253
254function getItxScopeContext(client: object): ItxScopeContext {
255 const symbolStorage = client as Record<symbol, unknown>
256 const context = symbolStorage[TX_SCOPE_CONTEXT]
257
258 if (context === undefined) {
259 return { kind: 'top-level' }
260 }
261
262 if (isNestedItxScopeContext(context)) {
263 return context
264 }
265
266 throw new Error('Internal error: inconsistent transaction scope context.')
267}
268
269function isNestedItxScopeContext(value: unknown): value is NestedItxScopeContext {
270 if (typeof value !== 'object' || value === null) {

Callers 2

$transactionMethod · 0.85

Calls 1

isNestedItxScopeContextFunction · 0.85

Tested by

no test coverage detected