(obj, prop, receiver)
| 185 | const instance = Reflect.construct(target, args, newTarget) as T; |
| 186 | return new Proxy(instance, { |
| 187 | get(obj, prop, receiver) { |
| 188 | if (prop === 'run') { |
| 189 | return async function (event: WorkflowEvent<P>, step: WorkflowStep): Promise<unknown> { |
| 190 | setAsyncLocalStorageAsyncContextStrategy(); |
| 191 | |
| 192 | return withIsolationScope(async isolationScope => { |
| 193 | const waitUntil = context.waitUntil.bind(context); |
| 194 | const client = init({ ...options, ctx: context, enableDedupe: false }); |
| 195 | isolationScope.setClient(client); |
| 196 | |
| 197 | addCloudResourceContext(isolationScope); |
| 198 | |
| 199 | return withScope(async scope => { |
| 200 | const propagationContext = await propagationContextFromInstanceId(event.instanceId); |
| 201 | scope.setPropagationContext(propagationContext); |
| 202 | |
| 203 | try { |
| 204 | return await obj.run.call( |
| 205 | obj, |
| 206 | event, |
| 207 | new WrappedWorkflowStep(event.instanceId, options, step, waitUntil), |
| 208 | ); |
| 209 | } finally { |
| 210 | waitUntil(flushAndDispose(client)); |
| 211 | } |
| 212 | }); |
| 213 | }); |
| 214 | }; |
| 215 | } |
| 216 | return Reflect.get(obj, prop, receiver); |
| 217 | }, |
| 218 | }); |
| 219 | }, |
| 220 | }); |
nothing calls this directly
no test coverage detected