(inner: FumaDb)
| 71 | hooks: { readonly enter: () => void; readonly exit: () => void }, |
| 72 | ): FumaDb => { |
| 73 | const wrap = (inner: FumaDb): FumaDb => |
| 74 | new Proxy(inner, { |
| 75 | get(target, prop) { |
| 76 | if (prop === "withContext") { |
| 77 | return (context: unknown) => |
| 78 | wrap((target.withContext as (c: unknown) => FumaDb)(context)); |
| 79 | } |
| 80 | if (prop === "transaction") { |
| 81 | return async (run: Parameters<FumaDb["transaction"]>[0]) => { |
| 82 | hooks.enter(); |
| 83 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: test instrument must unwind on both outcomes |
| 84 | try { |
| 85 | return await target.transaction(run); |
| 86 | } finally { |
| 87 | hooks.exit(); |
| 88 | } |
| 89 | }; |
| 90 | } |
| 91 | return Reflect.get(target, prop); |
| 92 | }, |
| 93 | }); |
| 94 | return wrap(db); |
| 95 | }; |
| 96 |
no outgoing calls
no test coverage detected