Skip to main content

Live Update — Types

Every TypeScript interface used by Live Update methods. Field tables list every property, the type, whether it is required, and what it means. Examples show realistic shapes — not invented values.

All types are exported from the package root:

import type {
BundleInfo,
SyncOptions,
SyncResult,
DownloadOptions,
DeleteOptions,
LatestVersion,
CheckForUpdateResult,
DownloadUpdateOptions,
ValidateOptions,
ValidationResult,
} from 'native-update';

SyncOptions

Optional argument to sync(). Both fields override the persistent config for the duration of the call.

FieldTypeRequiredDescription
channelstringnoOverride the configured channel for this sync only.
updateModeUpdateModenoOverride the configured updateStrategy for this sync only.
const opts: SyncOptions = { channel: 'beta', updateMode: UpdateMode.IMMEDIATE };

SyncResult

Return value of sync(). The status field is the primary signal.

FieldTypeRequiredDescription
statusSyncStatusyesOne of UP_TO_DATE, UPDATE_AVAILABLE, UPDATE_INSTALLED, ERROR.
versionstringnoVersion of the new bundle (when applicable).
descriptionstringnoServer-provided release notes.
mandatorybooleannotrue if the server marked this update mandatory.
errorUpdateErrornoPopulated only when status === ERROR.
const result: SyncResult = await NativeUpdate.sync();
// { status: 'UPDATE_INSTALLED', version: '1.2.4', mandatory: false }

DownloadOptions

Required argument to download(). Use this when you want full control of which bundle gets fetched (typical for CI flows or external CDN sources).

FieldTypeRequiredDescription
urlstringyesHTTPS URL of the bundle file. HTTP is rejected.
versionstringyesSemver string identifying the bundle.
checksumstringyesHex digest using the configured checksumAlgorithm.
signaturestringwhen requireSignature: trueBase64 signature over the checksum.
maxRetriesnumbernoOverride the default retry count for this call.
timeoutnumbernoOverride the default timeout (ms).

DownloadUpdateOptions

Optional argument to downloadUpdate(). All fields are optional; with no args the call defaults to "the latest version on the configured channel".

FieldTypeRequiredDescription
versionstringnoSpecific version to download.
urlstringnoOverride the URL the server returned.
checksumstringconditionalRequired if url is overridden.
signaturestringconditionalRequired if url is overridden and requireSignature: true.
onProgress(event: DownloadProgressEvent) => voidnoPer-call progress callback. Same payload as the downloadProgress event.

BundleInfo

The canonical "what is this bundle?" object. Returned by download(), downloadUpdate(), current(), and list(). Also passed to set().

FieldTypeRequiredDescription
bundleIdstringyesStable identifier for the bundle. The original (binary-shipped) bundle has bundleId: 'default'.
versionstringyesSemver.
pathstringyesFilesystem path to the unpacked bundle directory on the device.
downloadTimenumberyesUnix milliseconds when the download completed.
sizenumberyesBundle size in bytes.
statusBundleStatusyesPENDING, DOWNLOADING, READY, ACTIVE, or FAILED.
checksumstringyesThe verified checksum of the on-disk bundle.
signaturestringnoPresent when the bundle was signed.
verifiedbooleanyestrue when checksum (and signature, if required) verification passed.
metadataRecord<string, unknown>noFree-form tag bag set by your backend (for example, release notes, author, build number).
const current: BundleInfo = await NativeUpdate.current();
// {
// bundleId: 'b_2026_04_18_a1f',
// version: '1.2.4',
// path: '/data/data/com.you.app/bundles/b_2026_04_18_a1f',
// downloadTime: 1745000000000,
// size: 4_521_633,
// status: 'ACTIVE',
// checksum: '7e1b…',
// signature: 'MEUC…',
// verified: true,
// metadata: { author: 'ci-bot', notes: 'Hotfix payment redirect' }
// }

DeleteOptions

Argument to delete(). At least one field should be set; passing an empty object is a no-op.

FieldTypeRequiredDescription
bundleIdstringnoDelete this specific bundle.
keepVersionsnumbernoKeep the N most recent bundles; delete the rest.
olderThannumbernoDelete bundles whose downloadTime is before this Unix milliseconds value.

LatestVersion

Return value of getLatest(). All fields except available are populated only when an update exists.

FieldTypeRequiredDescription
availablebooleanyestrue if the server has a newer version on the channel.
versionstringnoSemver of the latest version.
urlstringnoBundle download URL.
mandatorybooleannotrue if the server marked it mandatory.
notesstringnoRelease notes from the backend.
sizenumbernoBundle size in bytes.
checksumstringnoExpected checksum (used by the next downloadUpdate call).

CheckForUpdateResult

Return value of checkForUpdate(). Adds the device's currentVersion so you can render a "X → Y" banner without an extra call.

FieldTypeRequiredDescription
availablebooleanyestrue if the server has a newer version.
latestVersionstringnoSemver from the server.
currentVersionstringyesSemver currently active on the device.
urlstringnoBundle URL.
mandatorybooleannoServer-marked mandatory.
notesstringnoRelease notes.
sizenumbernoBytes.
checksumstringnoExpected checksum.
signaturestringnoExpected signature (when signed).

ValidateOptions

Argument to validateUpdate(). Useful for re-checking a bundle on disk between download and apply.

FieldTypeRequiredDescription
bundlePathstringyesFilesystem path to the bundle (typically BundleInfo.path).
checksumstringyesExpected checksum.
signaturestringnoExpected signature (when requireSignature: true).
maxSizenumbernoReject if the on-disk bundle exceeds this many bytes.

ValidationResult

Return value of validateUpdate(). The per-aspect details lets you surface partial-failure UIs (e.g. "checksum OK but signature failed — was the wrong key used?").

FieldTypeRequiredDescription
isValidbooleanyestrue only if every requested check passed.
errorstringnoHuman-readable failure summary when isValid is false.
details.checksumValidbooleannoPer-aspect result.
details.signatureValidbooleannoPer-aspect result.
details.sizeValidbooleannoPer-aspect result.
details.versionValidbooleannoPer-aspect result.

Type definitions verified against src/definitions.ts in the plugin repo as of 2026-05-10. Documented by Ahsan Mahmood.