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

Function normalizeDevice

src/client/client-normalizers.ts:95–111  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

93}
94
95export function normalizeDevice(value: unknown): AgentDeviceDevice {
96 const { record, platform, id, name, target } = readClientDeviceIdentity(value, 'name');
97 const appleOs = readAppleOs(record);
98 return {
99 platform,
100 target,
101 kind: readRequiredDeviceKind(record, 'kind'),
102 id,
103 name,
104 booted: typeof record.booted === 'boolean' ? record.booted : undefined,
105 // Additive Apple-OS discriminant; Apple platforms only — gate on the platform so
106 // a non-Apple record with a stray appleOs value is not preserved.
107 ...(isApplePlatform(platform) && appleOs ? { appleOs } : {}),
108 identifiers: buildDeviceIdentifiers(platform, id, name),
109 ...buildClientDevicePlatformFields(platform, id),
110 };
111}
112
113export function normalizeSession(value: unknown): AgentDeviceSession {
114 const { record, platform, id, name, target } = readClientDeviceIdentity(value, 'name');

Callers 1

Calls 6

readRequiredDeviceKindFunction · 0.90
isApplePlatformFunction · 0.90
buildDeviceIdentifiersFunction · 0.90
readClientDeviceIdentityFunction · 0.85
readAppleOsFunction · 0.85

Tested by

no test coverage detected