(client: object)
| 252 | type ItxScopeContext = TopLevelItxScopeContext | NestedItxScopeContext |
| 253 | |
| 254 | function 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 | |
| 269 | function isNestedItxScopeContext(value: unknown): value is NestedItxScopeContext { |
| 270 | if (typeof value !== 'object' || value === null) { |
no test coverage detected