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

Function normalizeSession

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

Source from the content-addressed store, hash-verified

111}
112
113export function normalizeSession(value: unknown): AgentDeviceSession {
114 const { record, platform, id, name, target } = readClientDeviceIdentity(value, 'name');
115 const deviceName = readRequiredString(record, 'device');
116 const appleOs = readAppleOs(record);
117 const identifiers = {
118 session: name,
119 ...buildDeviceIdentifiers(platform, id, deviceName),
120 };
121 return {
122 name,
123 createdAt: readRequiredNumber(record, 'createdAt'),
124 sessionStateDir: readOptionalString(record, 'sessionStateDir'),
125 runnerLogPath: readOptionalString(record, 'runnerLogPath'),
126 device: {
127 platform,
128 target,
129 id,
130 name: deviceName,
131 // Additive Apple-OS discriminant; present only when the daemon emits it (Apple devices).
132 ...(appleOs ? { appleOs } : {}),
133 identifiers,
134 ...buildClientDevicePlatformFields(
135 platform,
136 id,
137 readNullableString(record, 'ios_simulator_device_set'),
138 ),
139 },
140 identifiers,
141 };
142}
143
144function readAppleOs(record: Record<string, unknown>): AppleOS | undefined {
145 const value = record.appleOs;

Callers 1

Calls 8

readRequiredStringFunction · 0.90
buildDeviceIdentifiersFunction · 0.90
readRequiredNumberFunction · 0.90
readOptionalStringFunction · 0.90
readNullableStringFunction · 0.90
readClientDeviceIdentityFunction · 0.85
readAppleOsFunction · 0.85

Tested by

no test coverage detected