MCPcopy Create free account
hub / github.com/callstack/agent-device / normalizeAlertHandledResult

Function normalizeAlertHandledResult

src/commands/system/runtime/system.ts:411–429  ·  view source on GitHub ↗
(
  action: Exclude<BackendAlertAction, 'get' | 'wait'>,
  result: BackendAlertResult,
)

Source from the content-addressed store, hash-verified

409}
410
411function normalizeAlertHandledResult(
412 action: Exclude<BackendAlertAction, 'get' | 'wait'>,
413 result: BackendAlertResult,
414): SystemAlertCommandResult {
415 if (result.kind !== 'alertHandled') {
416 throw new AppError(
417 'COMMAND_FAILED',
418 `system.alert ${action} returned an invalid backend result`,
419 );
420 }
421 return {
422 kind: 'alertHandled',
423 action,
424 handled: result.handled,
425 ...(result.alert ? { alert: result.alert } : {}),
426 ...(result.button ? { button: result.button } : {}),
427 ...successText(result.handled ? `Alert ${action}ed` : 'No alert handled'),
428 };
429}
430
431function isKeyboardResult(value: unknown): value is BackendKeyboardResult {
432 return Boolean(value && typeof value === 'object');

Callers 1

normalizeAlertResultFunction · 0.85

Calls 1

successTextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…