API do SDK TypeScript
Importe o singleton updates (ou crie uma instância configurada com createOtaUpdates) a partir de @getcortexlabs/ota-nativescript.
ts
import { updates, OtaError, OTA_ERROR_CODES } from '@getcortexlabs/ota-nativescript';Métodos principais
updates.markReady(): boolean— confirma o boot atual de forma síncrona e offline, promovendopendingLaunchparaconfirmedReleaseId.updates.getBootInfo(): NativeBootInfo | null— retornasource,releaseId,bundlePath,binaryVersion,targetBuild,runtimeContract,pendingConfirmation,launchAttemptselastRecovery.updates.getCurrentRelease(): string | null— retorna oreleaseIdOTA ativo ounullno bundle embarcado.updates.check(options?): Promise<CheckResult>— consultaPOST /check, valida Ed25519, compatibilidade edirectiveSeq.updates.downloadAndStage(directive, options?): Promise<StageResult>— baixa manifesto e arquivos emstaging/, valida SHA-256/tamanhos/paths, promove atomicamente parareleases/e executa GC.updates.checkAndStage(options?): Promise<CheckAndStageResult>— executacheck()+downloadAndStage()com proteção single-flight.updates.collectGarbage(): Promise<string[]>— remove releases não referenciadas em disco.updates.onEvent(listener): () => void— assina eventos estruturados de telemetria (check_started,download_progress,staged,boot_confirmed,recovery_triggered,error).
