1import Constants from 'expo-constants'; 2 3/** 4 * The types of update-related events. 5 */ 6export enum UpdateEventType { 7 /** 8 * A new update has finished downloading to local storage. If you would like to start using this 9 * update at any point before the user closes and restarts the app on their own, you can call 10 * [`Updates.reloadAsync()`](#reloadasync) to launch this new update. 11 */ 12 UPDATE_AVAILABLE = 'updateAvailable', 13 /** 14 * No updates are available, and the most up-to-date update is already running. 15 */ 16 NO_UPDATE_AVAILABLE = 'noUpdateAvailable', 17 /** 18 * An error occurred trying to fetch the latest update. 19 */ 20 ERROR = 'error', 21} 22 23// @docsMissing 24// TODO(eric): move source of truth for manifest type to this module 25/** 26 * @hidden 27 */ 28export type ClassicManifest = typeof Constants.manifest; 29 30// @docsMissing 31/** 32 * @hidden 33 */ 34export type Manifest = ClassicManifest | typeof Constants.manifest2; 35// modern manifest type is intentionally not exported, since the plan is to call it just "Manifest" 36// in the future 37 38/** 39 * The result of checking for a new update. 40 */ 41export type UpdateCheckResult = { 42 /** 43 * `true` if an update is available, `false` if the app is already running the latest available 44 * update. 45 */ 46 isAvailable: boolean; 47 /** 48 * If `isAvailable` is `true`, the manifest of the available update, and `undefined` otherwise. 49 */ 50 manifest?: Manifest; 51}; 52 53/** 54 * The result of fetching a new update. 55 */ 56export type UpdateFetchResult = { 57 /** 58 * `true` if the fetched bundle is new (that is, a different version than what's currently 59 * running), `false` otherwise. 60 */ 61 isNew: boolean; 62 /** 63 * If `isNew` is `true`, the manifest of the newly downloaded update, and `undefined` otherwise. 64 */ 65 manifest?: Manifest; 66}; 67 68/** 69 * An object that is passed into each event listener when an auto-update check occurs. 70 */ 71export type UpdateEvent = { 72 /** 73 * Type of the event. 74 */ 75 type: UpdateEventType; 76 /** 77 * If `type` is `Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded 78 * update, and `undefined` otherwise. 79 */ 80 manifest?: Manifest; 81 /** 82 * If `type` is `Updates.UpdateEventType.ERROR`, the error message, and `undefined` otherwise. 83 */ 84 message?: string; 85}; 86 87/** 88 * An object representing a single log entry from expo-updates logging on the client. 89 */ 90export type UpdatesLogEntry = { 91 /** 92 * The time the log was written, in milliseconds since Jan 1 1970 UTC. 93 */ 94 timestamp: number; 95 /** 96 * The log entry message. 97 */ 98 message: string; 99 /** 100 * One of the defined code values for expo-updates log entries. 101 */ 102 code: UpdatesLogEntryCode; 103 /** 104 * One of the defined log level or severity values. 105 */ 106 level: UpdatesLogEntryLevel; 107 /** 108 * If present, the unique ID of an update associated with this log entry. 109 */ 110 updateId?: string; 111 /** 112 * If present, the unique ID or hash of an asset associated with this log entry. 113 */ 114 assetId?: string; 115 /** 116 * If present, an iOS or Android native stack trace associated with this log entry. 117 */ 118 stacktrace?: string[]; 119}; 120 121/** 122 * The possible code values for expo-updates log entries 123 */ 124export enum UpdatesLogEntryCode { 125 NONE = 'None', 126 NO_UPDATES_AVAILABLE = 'NoUpdatesAvailable', 127 UPDATE_ASSETS_NOT_AVAILABLE = 'UpdateAssetsNotAvailable', 128 UPDATE_SERVER_UNREACHABLE = 'UpdateServerUnreachable', 129 UPDATE_HAS_INVALID_SIGNATURE = 'UpdateHasInvalidSignature', 130 UPDATE_FAILED_TO_LOAD = 'UpdateFailedToLoad', 131 ASSETS_FAILED_TO_LOAD = 'AssetsFailedToLoad', 132 JS_RUNTIME_ERROR = 'JSRuntimeError', 133} 134 135/** 136 * The possible log levels for expo-updates log entries 137 */ 138export enum UpdatesLogEntryLevel { 139 TRACE = 'trace', 140 DEBUG = 'debug', 141 INFO = 'info', 142 WARN = 'warn', 143 ERROR = 'error', 144 FATAL = 'fatal', 145} 146 147// @docsMissing 148/** 149 * @hidden 150 */ 151export type LocalAssets = Record<string, string>; 152