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

Function normalizeOpenTarget

src/commands/management/runtime/apps.ts:238–260  ·  view source on GitHub ↗
(options: OpenAppCommandOptions)

Source from the content-addressed store, hash-verified

236};
237
238function normalizeOpenTarget(options: OpenAppCommandOptions): BackendOpenTarget {
239 const app = normalizeOptionalText(options.app, 'app');
240 const appId = normalizeOptionalText(options.appId, 'appId');
241 const bundleId = normalizeOptionalText(options.bundleId, 'bundleId');
242 const packageName = normalizeOptionalText(options.packageName, 'packageName');
243 const url = normalizeOptionalText(options.url, 'url');
244 const activity = normalizeOptionalText(options.activity, 'activity');
245 const target: BackendOpenTarget = {
246 ...(app ? { app } : {}),
247 ...(appId ? { appId } : {}),
248 ...(bundleId ? { bundleId } : {}),
249 ...(packageName ? { packageName } : {}),
250 ...(url ? { url } : {}),
251 ...(activity ? { activity } : {}),
252 };
253 if (!hasOpenTarget(target)) {
254 throw new AppError(
255 'INVALID_ARGS',
256 'apps.open requires app, appId, bundleId, packageName, url, or activity',
257 );
258 }
259 return target;
260}
261
262function hasOpenTarget(target: BackendOpenTarget): boolean {
263 return Boolean(

Callers 1

openAppCommandFunction · 0.85

Calls 2

normalizeOptionalTextFunction · 0.90
hasOpenTargetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…