(params: {
session: SessionState | undefined;
flags: DaemonRequest['flags'] | undefined;
})
| 67 | } |
| 68 | |
| 69 | async function resolveInstallDevice(params: { |
| 70 | session: SessionState | undefined; |
| 71 | flags: DaemonRequest['flags'] | undefined; |
| 72 | }): Promise<SessionState['device']> { |
| 73 | const requestedPlatform = normalizePlatform(params.flags?.platform); |
| 74 | if (params.session) { |
| 75 | if (requestedPlatform && params.session.device.platform !== requestedPlatform) { |
| 76 | throw new AppError( |
| 77 | 'INVALID_ARGS', |
| 78 | `install_from_source requested platform ${requestedPlatform}, but session is bound to ${params.session.device.platform}`, |
| 79 | ); |
| 80 | } |
| 81 | await ensureDeviceReady(params.session.device); |
| 82 | return params.session.device; |
| 83 | } |
| 84 | |
| 85 | if (!requestedPlatform) { |
| 86 | throw new AppError( |
| 87 | 'INVALID_ARGS', |
| 88 | 'install_from_source requires platform "ios" or "android" when no session is provided', |
| 89 | ); |
| 90 | } |
| 91 | const device = await resolveTargetDevice(params.flags ?? {}); |
| 92 | await ensureDeviceReady(device); |
| 93 | return device; |
| 94 | } |
| 95 | |
| 96 | async function maybeRetainInstallArtifact(params: { |
| 97 | prepared: PreparedInstallArtifact; |
no test coverage detected