( runtimes: ProviderDeviceRuntime[], method: keyof LeaseLifecycleProvider, lease: DeviceLease, context?: LeaseLifecycleContext, )
| 234 | } |
| 235 | |
| 236 | async function firstProviderResult( |
| 237 | runtimes: ProviderDeviceRuntime[], |
| 238 | method: keyof LeaseLifecycleProvider, |
| 239 | lease: DeviceLease, |
| 240 | context?: LeaseLifecycleContext, |
| 241 | ): Promise<Record<string, unknown> | undefined> { |
| 242 | for (const runtime of runtimes) { |
| 243 | if (!runtimeMatchesProvider(runtime, lease.leaseProvider)) continue; |
| 244 | const handler = runtime.leaseLifecycle[method]; |
| 245 | const result = handler ? await handler(lease, context) : undefined; |
| 246 | if (result) return result; |
| 247 | } |
| 248 | return undefined; |
| 249 | } |
| 250 | |
| 251 | function runtimeMatchesProvider( |
| 252 | runtime: ProviderDeviceRuntime, |
no test coverage detected
searching dependent graphs…