MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / localProviderMetadata

Function localProviderMetadata

scripts/studio-provider-bridge.mjs:377–405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375}
376
377async function localProviderMetadata() {
378 let health = null;
379 let healthError = null;
380 try {
381 health = await localJson("/api/health");
382 } catch (error) {
383 healthError = error;
384 health = null;
385 }
386
387 try {
388 const simulators = await localJson("/api/simulators");
389 const selected =
390 simulators.simulators?.find((simulator) => simulator.isBooted) ??
391 simulators.simulators?.[0] ??
392 null;
393 return { health, ok: true, simulator: selected };
394 } catch (error) {
395 if (health) {
396 return { health, ok: true, simulator: null };
397 }
398 return {
399 failureReason: localProviderFailureReason(healthError, error),
400 health: null,
401 ok: false,
402 simulator: null,
403 };
404 }
405}
406
407function localProviderFailureReason(healthError, simulatorError) {
408 const healthMessage = describeError(healthError);

Callers 1

registerProviderFunction · 0.70

Calls 2

localJsonFunction · 0.70

Tested by

no test coverage detected