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

Function dispatchDirectIosSelectorGet

src/daemon/selector-runtime.ts:244–269  ·  view source on GitHub ↗
(
  params: SelectorRuntimeParams,
  property: 'text' | 'attrs',
  selectorExpression: string,
)

Source from the content-addressed store, hash-verified

242}
243
244async function dispatchDirectIosSelectorGet(
245 params: SelectorRuntimeParams,
246 property: 'text' | 'attrs',
247 selectorExpression: string,
248): Promise<DaemonResponse | null> {
249 const session = params.sessionStore.get(params.sessionName);
250 const selector = readSimpleIosSelectorTarget({ session, selectorExpression });
251 if (!session || !selector) return null;
252 // get text intentionally disambiguates label/text/value triplets from snapshots; the runner
253 // direct query rejects those ambiguous matches before the shared selector resolver can rank them.
254 if (property === 'text' && selector.key !== 'id') return null;
255
256 const result = await queryDirectIosSelectorOrFallback(params, session, selector);
257 if (isDirectIosSelectorErrorResult(result)) return result.response;
258 if (!result) return null;
259 const directQuery = { session, selector, result };
260 const payload = buildDirectIosGetResult(property, directQuery.selector.raw, directQuery.result);
261 if (!payload) return null;
262 recordIfSession(
263 params.sessionStore,
264 params.sessionName,
265 params.req,
266 buildGetRecordResult(payload, property),
267 );
268 return { ok: true, data: toDaemonGetData(payload) };
269}
270
271async function dispatchDirectIosSelectorIs(
272 params: SelectorRuntimeParams,

Callers 1

dispatchGetViaRuntimeFunction · 0.85

Calls 8

recordIfSessionFunction · 0.90
buildGetRecordResultFunction · 0.90
toDaemonGetDataFunction · 0.90
buildDirectIosGetResultFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected