MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / parseDeviceListResponse

Function parseDeviceListResponse

src/cli/commands/setup.ts:643–713  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

641}
642
643function parseDeviceListResponse(value: unknown): SetupDevice[] {
644 if (!value || typeof value !== 'object') {
645 return [];
646 }
647
648 const result = (value as { result?: unknown }).result;
649 if (!result || typeof result !== 'object') {
650 return [];
651 }
652
653 const devices = (result as { devices?: unknown }).devices;
654 if (!Array.isArray(devices)) {
655 return [];
656 }
657
658 const listed: SetupDevice[] = [];
659 for (const device of devices) {
660 if (!device || typeof device !== 'object') {
661 continue;
662 }
663
664 const record = device as {
665 identifier?: unknown;
666 visibilityClass?: unknown;
667 connectionProperties?: {
668 pairingState?: unknown;
669 tunnelState?: unknown;
670 };
671 deviceProperties?: {
672 name?: unknown;
673 platformIdentifier?: unknown;
674 };
675 };
676
677 if (record.visibilityClass === 'Simulator') {
678 continue;
679 }
680
681 if (
682 typeof record.identifier !== 'string' ||
683 typeof record.deviceProperties?.name !== 'string' ||
684 typeof record.connectionProperties?.pairingState !== 'string'
685 ) {
686 continue;
687 }
688
689 if (record.connectionProperties.pairingState !== 'paired') {
690 continue;
691 }
692
693 const tunnelState = record.connectionProperties.tunnelState;
694 if (
695 tunnelState !== 'connected' &&
696 tunnelState !== undefined &&
697 tunnelState !== 'disconnected'
698 ) {
699 continue;
700 }

Callers 1

listAvailableDevicesFunction · 0.85

Calls 2

getDevicePlatformLabelFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected