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

Function listSessionSelectorConflicts

src/daemon/session-selector.ts:37–86  ·  view source on GitHub ↗
(
  session: SessionState,
  flags?: CommandFlags,
)

Source from the content-addressed store, hash-verified

35}
36
37export function listSessionSelectorConflicts(
38 session: SessionState,
39 flags?: CommandFlags,
40): SessionSelectorConflict[] {
41 if (!flags) return [];
42
43 const mismatches: SessionSelectorConflict[] = [];
44 const device = session.device;
45
46 const normalizedPlatform = flags.platform;
47 if (normalizedPlatform && !matchesPlatformSelector(device, normalizedPlatform)) {
48 mismatches.push({ key: 'platform', value: flags.platform! });
49 }
50 if (flags.target && flags.target !== (device.target ?? 'mobile')) {
51 mismatches.push({ key: 'target', value: flags.target });
52 }
53
54 if (flags.udid && (!isIosFamily(device) || flags.udid !== device.id)) {
55 mismatches.push({ key: 'udid', value: flags.udid });
56 }
57
58 if (flags.serial && (device.platform !== 'android' || flags.serial !== device.id)) {
59 mismatches.push({ key: 'serial', value: flags.serial });
60 }
61
62 if (flags.device && flags.device.trim().toLowerCase() !== device.name.trim().toLowerCase()) {
63 mismatches.push({ key: 'device', value: flags.device });
64 }
65
66 if (flags.iosSimulatorDeviceSet) {
67 const requestedSetPath = flags.iosSimulatorDeviceSet.trim();
68 const sessionSetPath = device.simulatorSetPath?.trim();
69 if (
70 !isIosFamily(device) ||
71 device.kind !== 'simulator' ||
72 requestedSetPath !== sessionSetPath
73 ) {
74 mismatches.push({ key: 'iosSimulatorDeviceSet', value: flags.iosSimulatorDeviceSet });
75 }
76 }
77
78 if (flags.androidDeviceAllowlist) {
79 const allowlist = parseSerialAllowlist(flags.androidDeviceAllowlist);
80 if (device.platform !== 'android' || !allowlist.has(device.id)) {
81 mismatches.push({ key: 'androidDeviceAllowlist', value: flags.androidDeviceAllowlist });
82 }
83 }
84
85 return mismatches;
86}
87
88export function formatSessionSelectorConflict(conflict: SessionSelectorConflict): string {
89 return `${flagNameForConflictKey(conflict.key)}=${conflict.value}`;

Callers 3

applyRequestLockPolicyFunction · 0.90

Calls 4

matchesPlatformSelectorFunction · 0.90
isIosFamilyFunction · 0.90
parseSerialAllowlistFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected