MCPcopy Index your code
hub / github.com/callstack/agent-device / buildDeviceInventoryRequestFromFlags

Function buildDeviceInventoryRequestFromFlags

src/core/dispatch-resolve.ts:182–213  ·  view source on GitHub ↗
(
  flags: ResolveDeviceFlags,
)

Source from the content-addressed store, hash-verified

180}
181
182export function buildDeviceInventoryRequestFromFlags(
183 flags: ResolveDeviceFlags,
184): DeviceInventoryRequest {
185 const platform = flags.platform;
186 if (flags.target && !platform) {
187 throw new AppError(
188 'INVALID_ARGS',
189 'Device target selector requires --platform. Use --platform ios|macos|android|linux|apple with --target mobile|tv|desktop.',
190 );
191 }
192 const iosSimulatorSetPath = resolveAppleSimulatorSetPathForSelector({
193 simulatorSetPath: resolveIosSimulatorDeviceSetPath(flags.iosSimulatorDeviceSet),
194 platform,
195 target: flags.target,
196 });
197 const androidSerialAllowlist = resolveAndroidSerialAllowlist(flags.androidDeviceAllowlist);
198 return {
199 platform,
200 target: flags.target,
201 deviceName: flags.device,
202 udid: flags.udid,
203 serial: flags.serial,
204 leaseId: flags.leaseId,
205 leaseProvider: flags.leaseProvider,
206 deviceKey: flags.deviceKey,
207 clientId: flags.clientId,
208 iosSimulatorSetPath,
209 androidSerialAllowlist: androidSerialAllowlist
210 ? Array.from(androidSerialAllowlist).sort()
211 : undefined,
212 };
213}
214
215export async function withResolveTargetDeviceCacheScope<T>(task: () => Promise<T>): Promise<T> {
216 if (resolveTargetDeviceCacheScope.getStore()) return await task();

Callers 2

deviceInventorySelectorFunction · 0.90
resolveTargetDeviceFunction · 0.85

Tested by

no test coverage detected