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

Function triggerAppEventCommand

src/commands/management/runtime/apps.ts:210–236  ·  view source on GitHub ↗
(runtime, options)

Source from the content-addressed store, hash-verified

208 TriggerAppEventCommandOptions,
209 TriggerAppEventCommandResult
210> = async (runtime, options): Promise<TriggerAppEventCommandResult> => {
211 if (!runtime.backend.triggerAppEvent) {
212 throw new AppError(
213 'UNSUPPORTED_OPERATION',
214 'apps.triggerEvent is not supported by this backend',
215 );
216 }
217
218 const name = requireAppEventName(options.name);
219 assertPayload(options.payload, `apps.triggerEvent payload for "${name}"`);
220 const backendResult = await runtime.backend.triggerAppEvent(
221 toAppBackendContext(runtime, options),
222 {
223 name,
224 ...(options.payload ? { payload: options.payload } : {}),
225 },
226 );
227
228 const formattedBackendResult = toBackendResult(backendResult);
229 return {
230 kind: 'appEventTriggered',
231 name,
232 ...(options.payload ? { payload: options.payload } : {}),
233 ...(formattedBackendResult ? { backendResult: formattedBackendResult } : {}),
234 ...successText(`Triggered app event: ${name}`),
235 };
236};
237
238function normalizeOpenTarget(options: OpenAppCommandOptions): BackendOpenTarget {
239 const app = normalizeOptionalText(options.app, 'app');

Callers

nothing calls this directly

Calls 5

toBackendResultFunction · 0.90
successTextFunction · 0.90
requireAppEventNameFunction · 0.85
assertPayloadFunction · 0.85
toAppBackendContextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…