expo-updates 0.25.4 → 0.25.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/updates/db/dao/AssetDao.kt +9 -0
  4. package/android/src/main/java/expo/modules/updates/db/dao/UpdateDao.kt +6 -6
  5. package/android/src/main/java/expo/modules/updates/db/entity/UpdateEntity.kt +2 -0
  6. package/android/src/main/java/expo/modules/updates/launcher/DatabaseLauncher.kt +9 -4
  7. package/android/src/main/java/expo/modules/updates/selectionpolicy/ReaperSelectionPolicyFilterAware.kt +4 -1
  8. package/build/ExpoUpdatesModule.types.d.ts +3 -0
  9. package/build/ExpoUpdatesModule.types.d.ts.map +1 -1
  10. package/build/ExpoUpdatesModule.types.js.map +1 -1
  11. package/build/Updates.d.ts +13 -12
  12. package/build/Updates.d.ts.map +1 -1
  13. package/build/Updates.js +13 -12
  14. package/build/Updates.js.map +1 -1
  15. package/build/Updates.types.d.ts +6 -4
  16. package/build/Updates.types.d.ts.map +1 -1
  17. package/build/Updates.types.js +3 -3
  18. package/build/Updates.types.js.map +1 -1
  19. package/build/UseUpdates.types.d.ts +15 -15
  20. package/build/UseUpdates.types.d.ts.map +1 -1
  21. package/build/UseUpdates.types.js.map +1 -1
  22. package/build/statemachine/UpdatesStateMachine.d.ts +2 -2
  23. package/build/statemachine/UpdatesStateMachine.js +2 -2
  24. package/build/statemachine/UpdatesStateMachine.js.map +1 -1
  25. package/package.json +2 -2
  26. package/src/ExpoUpdatesModule.types.ts +3 -0
  27. package/src/Updates.ts +13 -12
  28. package/src/Updates.types.ts +6 -6
  29. package/src/UseUpdates.types.ts +15 -14
  30. package/src/statemachine/UpdatesStateMachine.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.25.6 — 2024-05-01
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Android: Fix hard crash due to missing asset edge row. ([#28264](https://github.com/expo/expo/pull/28264) by [@douglowder](https://github.com/douglowder))
18
+
19
+ ## 0.25.5 — 2024-04-24
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
13
23
  ## 0.25.4 — 2024-04-24
14
24
 
15
25
  ### 🐛 Bug fixes
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2
2
  apply plugin: 'kotlin-kapt'
3
3
 
4
4
  group = 'host.exp.exponent'
5
- version = '0.25.4'
5
+ version = '0.25.6'
6
6
 
7
7
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
8
8
  apply from: expoModulesCorePlugin
@@ -48,7 +48,7 @@ android {
48
48
  namespace "expo.modules.updates"
49
49
  defaultConfig {
50
50
  versionCode 31
51
- versionName '0.25.4'
51
+ versionName '0.25.6'
52
52
  consumerProguardFiles("proguard-rules.pro")
53
53
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
54
54
 
@@ -37,6 +37,14 @@ abstract class AssetDao {
37
37
  )
38
38
  abstract fun _unmarkUsedAssetsFromDeletion()
39
39
 
40
+ @Query(
41
+ "UPDATE assets SET marked_for_deletion = 0 WHERE id IN (" +
42
+ " SELECT launch_asset_id" +
43
+ " FROM updates" +
44
+ " WHERE updates.keep);"
45
+ )
46
+ abstract fun _unmarkUsedLaunchAssetsFromDeletion()
47
+
40
48
  @Query(
41
49
  "UPDATE assets SET marked_for_deletion = 0 WHERE relative_path IN (" +
42
50
  " SELECT relative_path" +
@@ -145,6 +153,7 @@ abstract class AssetDao {
145
153
  // this is safe since this is a transaction and will be rolled back upon failure
146
154
  _markAllAssetsForDeletion()
147
155
  _unmarkUsedAssetsFromDeletion()
156
+ _unmarkUsedLaunchAssetsFromDeletion()
148
157
  // check for duplicate rows representing a single file on disk
149
158
  _unmarkDuplicateUsedAssetsFromDeletion()
150
159
  val deletedAssets = _loadAssetsMarkedForDeletion()
@@ -25,8 +25,8 @@ abstract class UpdateDao {
25
25
  @Query("SELECT * FROM updates WHERE id = :id;")
26
26
  abstract fun _loadUpdatesWithId(id: UUID): List<UpdateEntity>
27
27
 
28
- @Query("SELECT assets.* FROM assets INNER JOIN updates ON updates.launch_asset_id = assets.id WHERE updates.id = :id;")
29
- abstract fun _loadLaunchAsset(id: UUID): AssetEntity
28
+ @Query("SELECT assets.* FROM assets INNER JOIN updates ON updates.launch_asset_id = assets.id WHERE updates.id = :updateId;")
29
+ abstract fun _loadLaunchAssetForUpdate(updateId: UUID): AssetEntity?
30
30
 
31
31
  @Query("UPDATE updates SET keep = 1 WHERE id = :id;")
32
32
  abstract fun _keepUpdate(id: UUID)
@@ -67,10 +67,10 @@ abstract class UpdateDao {
67
67
  return if (updateEntities.isNotEmpty()) updateEntities[0] else null
68
68
  }
69
69
 
70
- fun loadLaunchAsset(id: UUID): AssetEntity {
71
- val assetEntity = _loadLaunchAsset(id)
72
- assetEntity.isLaunchAsset = true
73
- return assetEntity
70
+ fun loadLaunchAssetForUpdate(updateId: UUID): AssetEntity? {
71
+ return _loadLaunchAssetForUpdate(updateId)?.apply {
72
+ isLaunchAsset = true
73
+ }
74
74
  }
75
75
 
76
76
  @Insert
@@ -59,4 +59,6 @@ class UpdateEntity(
59
59
 
60
60
  @ColumnInfo(name = "failed_launch_count", defaultValue = "0")
61
61
  var failedLaunchCount = 0
62
+
63
+ fun debugInfo(): String = JSONObject(mapOf("id" to id.toString(), "status" to status.name)).toString()
62
64
  }
@@ -71,7 +71,7 @@ class DatabaseLauncher(
71
71
 
72
72
  launchedUpdate = getLaunchableUpdate(database, context)
73
73
  if (launchedUpdate == null) {
74
- this.callback!!.onFailure(Exception("No launchable update was found. If this is a bare workflow app, make sure you have configured expo-updates correctly in android/app/build.gradle."))
74
+ this.callback!!.onFailure(Exception("No launchable update was found. If this is a generic app, ensure expo-updates is configured correctly."))
75
75
  return
76
76
  }
77
77
 
@@ -83,9 +83,14 @@ class DatabaseLauncher(
83
83
 
84
84
  // verify that we have all assets on disk
85
85
  // according to the database, we should, but something could have gone wrong on disk
86
- val launchAsset = database.updateDao().loadLaunchAsset(launchedUpdate!!.id)
86
+ val launchAsset = database.updateDao().loadLaunchAssetForUpdate(launchedUpdate!!.id)
87
+ if (launchAsset == null) {
88
+ this.callback!!.onFailure(Exception("Launch asset not found for update; this should never happen. Debug info: ${launchedUpdate!!.debugInfo()}"))
89
+ return
90
+ }
91
+
87
92
  if (launchAsset.relativePath == null) {
88
- throw AssertionError("Launch Asset relativePath should not be null")
93
+ this.callback!!.onFailure(Exception("Launch asset relative path should not be null. Debug info: ${launchedUpdate!!.debugInfo()}"))
89
94
  }
90
95
 
91
96
  val launchAssetFile = ensureAssetExists(launchAsset, database, context)
@@ -113,7 +118,7 @@ class DatabaseLauncher(
113
118
 
114
119
  if (assetsToDownload == 0) {
115
120
  if (this.launchAssetFile == null) {
116
- this.callback!!.onFailure(Exception("mLaunchAssetFile was immediately null; this should never happen"))
121
+ this.callback!!.onFailure(Exception("Launch asset file was null with no assets to download reported; this should never happen. Debug info: ${launchedUpdate!!.debugInfo()}"))
117
122
  } else {
118
123
  this.callback!!.onSuccess()
119
124
  }
@@ -1,6 +1,7 @@
1
1
  package expo.modules.updates.selectionpolicy
2
2
 
3
3
  import expo.modules.updates.db.entity.UpdateEntity
4
+ import expo.modules.updates.db.enums.UpdateStatus
4
5
  import org.json.JSONObject
5
6
 
6
7
  /**
@@ -50,6 +51,8 @@ class ReaperSelectionPolicyFilterAware : ReaperSelectionPolicy {
50
51
  } else if (nextNewestUpdate != null) {
51
52
  updatesToDelete.remove(nextNewestUpdate)
52
53
  }
53
- return updatesToDelete
54
+
55
+ // don't delete embedded update
56
+ return updatesToDelete.filter { it.status != UpdateStatus.EMBEDDED }
54
57
  }
55
58
  }
@@ -45,6 +45,9 @@ export interface ExpoUpdatesModule extends Pick<ProxyNativeModule, 'addListener'
45
45
  } | {
46
46
  manifest: Manifest;
47
47
  })) | UpdateFetchResultFailure | UpdateFetchResultRollBackToEmbedded>;
48
+ /**
49
+ * @hidden
50
+ */
48
51
  getNativeStateMachineContextAsync: () => Promise<UpdatesNativeStateMachineContext & {
49
52
  latestManifestString?: string;
50
53
  downloadedManifestString?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoUpdatesModule.types.d.ts","sourceRoot":"","sources":["../src/ExpoUpdatesModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,EACzB,mCAAmC,EACnC,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,gCAAgC,EACjC,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,iBAAiB,CAAC;IAClE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD,EAAE,OAAO,CAAC;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B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,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACpE,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,gBAAgB,EAAE,MAAM,OAAO,CAC3B,CAAC,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,GACzC,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC,GACxD,wBAAwB,GACxB,mCAAmC,CACtC,CAAC;IACF;;OAEG;IACH,iCAAiC,EAAE,MAAM,OAAO,CAC9C,gCAAgC,GAAG;QACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,4BAA4B,CAAC,EAAE,MAAM,CAAC;QACtC,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CACF,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoUpdatesModule.types.js","sourceRoot":"","sources":["../src/ExpoUpdatesModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport {\n Manifest,\n UpdateCheckResultAvailable,\n UpdateCheckResultNotAvailable,\n UpdateCheckResultRollBack,\n UpdateFetchResultRollBackToEmbedded,\n UpdateFetchResultFailure,\n UpdateFetchResultSuccess,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * @internal\n */\nexport interface ExpoUpdatesModule\n extends Pick<ProxyNativeModule, 'addListener' | 'removeListeners'> {\n isEmergencyLaunch: boolean;\n emergencyLaunchReason: string | null;\n isEmbeddedLaunch: boolean;\n isEnabled: boolean;\n isUsingEmbeddedAssets?: boolean;\n /**\n * Can be empty string\n */\n runtimeVersion: string;\n checkAutomatically: string;\n /**\n * Can be empty string\n */\n channel: string;\n shouldDeferToNativeForAPIMethodAvailabilityInDevelopment: boolean;\n updateId?: string;\n commitTime?: string;\n /**\n * @platform android\n */\n manifestString?: string;\n /**\n * @platform ios\n */\n manifest?: Manifest;\n localAssets?: Record<string, string>;\n\n reload: () => Promise<void>;\n checkForUpdateAsync: () => Promise<\n | UpdateCheckResultRollBack\n | (Omit<UpdateCheckResultAvailable, 'manifest'> &\n ({ manifestString: string } | { manifest: Manifest }))\n | UpdateCheckResultNotAvailable\n >;\n getExtraParamsAsync: () => Promise<Record<string, string>>;\n setExtraParamAsync: (key: string, value: string | null) => Promise<void>;\n readLogEntriesAsync: (maxAge: number) => Promise<UpdatesLogEntry[]>;\n clearLogEntriesAsync: () => Promise<void>;\n fetchUpdateAsync: () => Promise<\n | (Omit<UpdateFetchResultSuccess, 'manifest'> &\n ({ manifestString: string } | { manifest: Manifest }))\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded\n >;\n getNativeStateMachineContextAsync: () => Promise<\n UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n >;\n}\n"]}
1
+ {"version":3,"file":"ExpoUpdatesModule.types.js","sourceRoot":"","sources":["../src/ExpoUpdatesModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport {\n Manifest,\n UpdateCheckResultAvailable,\n UpdateCheckResultNotAvailable,\n UpdateCheckResultRollBack,\n UpdateFetchResultRollBackToEmbedded,\n UpdateFetchResultFailure,\n UpdateFetchResultSuccess,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * @internal\n */\nexport interface ExpoUpdatesModule\n extends Pick<ProxyNativeModule, 'addListener' | 'removeListeners'> {\n isEmergencyLaunch: boolean;\n emergencyLaunchReason: string | null;\n isEmbeddedLaunch: boolean;\n isEnabled: boolean;\n isUsingEmbeddedAssets?: boolean;\n /**\n * Can be empty string\n */\n runtimeVersion: string;\n checkAutomatically: string;\n /**\n * Can be empty string\n */\n channel: string;\n shouldDeferToNativeForAPIMethodAvailabilityInDevelopment: boolean;\n updateId?: string;\n commitTime?: string;\n /**\n * @platform android\n */\n manifestString?: string;\n /**\n * @platform ios\n */\n manifest?: Manifest;\n localAssets?: Record<string, string>;\n\n reload: () => Promise<void>;\n checkForUpdateAsync: () => Promise<\n | UpdateCheckResultRollBack\n | (Omit<UpdateCheckResultAvailable, 'manifest'> &\n ({ manifestString: string } | { manifest: Manifest }))\n | UpdateCheckResultNotAvailable\n >;\n getExtraParamsAsync: () => Promise<Record<string, string>>;\n setExtraParamAsync: (key: string, value: string | null) => Promise<void>;\n readLogEntriesAsync: (maxAge: number) => Promise<UpdatesLogEntry[]>;\n clearLogEntriesAsync: () => Promise<void>;\n fetchUpdateAsync: () => Promise<\n | (Omit<UpdateFetchResultSuccess, 'manifest'> &\n ({ manifestString: string } | { manifest: Manifest }))\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded\n >;\n /**\n * @hidden\n */\n getNativeStateMachineContextAsync: () => Promise<\n UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n >;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { LocalAssets, Manifest, UpdateCheckResult, UpdateFetchResult, UpdatesCheckAutomaticallyValue, UpdatesLogEntry, UpdatesNativeStateMachineContext } from './Updates.types';
2
2
  /**
3
- * Whether expo-updates is enabled. This may be false in a variety of cases including:
3
+ * Whether `expo-updates` is enabled. This may be false in a variety of cases including:
4
4
  * - enabled set to false in configuration
5
5
  * - missing or invalid URL in configuration
6
6
  * - missing runtime version or SDK version in configuration
@@ -13,7 +13,8 @@ export declare const isEnabled: boolean;
13
13
  * The UUID that uniquely identifies the currently running update. The
14
14
  * UUID is represented in its canonical string form and will always use lowercase letters.
15
15
  * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.
16
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
16
+ * @example
17
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
17
18
  */
18
19
  export declare const updateId: string | null;
19
20
  /**
@@ -27,7 +28,7 @@ export declare const channel: string | null;
27
28
  */
28
29
  export declare const runtimeVersion: string | null;
29
30
  /**
30
- * Determines if and when expo-updates checks for and downloads updates automatically on startup.
31
+ * Determines if and when `expo-updates` checks for and downloads updates automatically on startup.
31
32
  */
32
33
  export declare const checkAutomatically: UpdatesCheckAutomaticallyValue | null;
33
34
  /**
@@ -88,7 +89,7 @@ export declare const createdAt: Date | null;
88
89
  * the state of the native module and main threads.
89
90
  *
90
91
  * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you
91
- * try to do so. It also rejects when expo-updates is not enabled.
92
+ * try to do so. It also rejects when `expo-updates` is not enabled.
92
93
  *
93
94
  * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
94
95
  * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
@@ -113,27 +114,27 @@ export declare function reloadAsync(): Promise<void>;
113
114
  * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
114
115
  *
115
116
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
116
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
117
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
117
118
  */
118
119
  export declare function checkForUpdateAsync(): Promise<UpdateCheckResult>;
119
120
  /**
120
121
  * Retrieves the current extra params.
121
122
  *
122
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
123
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
123
124
  */
124
125
  export declare function getExtraParamsAsync(): Promise<Record<string, string>>;
125
126
  /**
126
127
  * Sets an extra param if value is non-null, otherwise unsets the param.
127
- * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)
128
+ * Extra params are sent as an [Expo Structured Field Value Dictionary](/technical-specs/expo-sfv-0/)
128
129
  * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.
129
130
  *
130
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
131
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
131
132
  */
132
133
  export declare function setExtraParamAsync(key: string, value: string | null | undefined): Promise<void>;
133
134
  /**
134
- * Retrieves the most recent expo-updates log entries.
135
+ * Retrieves the most recent `expo-updates` log entries.
135
136
  *
136
- * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).
137
+ * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to `3600000` ms (1 hour).
137
138
  *
138
139
  * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;
139
140
  *
@@ -141,7 +142,7 @@ export declare function setExtraParamAsync(key: string, value: string | null | u
141
142
  */
142
143
  export declare function readLogEntriesAsync(maxAge?: number): Promise<UpdatesLogEntry[]>;
143
144
  /**
144
- * Clears existing expo-updates log entries.
145
+ * Clears existing `expo-updates` log entries.
145
146
  *
146
147
  * > For now, this operation does nothing on the client. Once log persistence has been
147
148
  * > implemented, this operation will actually remove existing logs.
@@ -164,7 +165,7 @@ export declare function clearLogEntriesAsync(): Promise<void>;
164
165
  * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
165
166
  *
166
167
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
167
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
168
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
168
169
  */
169
170
  export declare function fetchUpdateAsync(): Promise<UpdateFetchResult>;
170
171
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.d.ts","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"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IAAI,OAAO,CAAC,iBAAiB,CAAC,CAoBnE;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,CAAC,EAAE,MAAM,QAIrE;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,qBAAqB,EAAE,gCAAgC,GAAG;IACxD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,gCAAgC,CAmBlC;AAED;;GAEG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,gCAAgC,CAAC,CAGnG"}
package/build/Updates.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CodedError } from 'expo-modules-core';
2
2
  import ExpoUpdates from './ExpoUpdates';
3
3
  /**
4
- * Whether expo-updates is enabled. This may be false in a variety of cases including:
4
+ * Whether `expo-updates` is enabled. This may be false in a variety of cases including:
5
5
  * - enabled set to false in configuration
6
6
  * - missing or invalid URL in configuration
7
7
  * - missing runtime version or SDK version in configuration
@@ -14,7 +14,8 @@ export const isEnabled = !!ExpoUpdates.isEnabled;
14
14
  * The UUID that uniquely identifies the currently running update. The
15
15
  * UUID is represented in its canonical string form and will always use lowercase letters.
16
16
  * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.
17
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
17
+ * @example
18
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
18
19
  */
19
20
  export const updateId = ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'
20
21
  ? ExpoUpdates.updateId.toLowerCase()
@@ -36,7 +37,7 @@ const _checkAutomaticallyMapNativeToJS = {
36
37
  WIFI_ONLY: 'WIFI_ONLY',
37
38
  };
38
39
  /**
39
- * Determines if and when expo-updates checks for and downloads updates automatically on startup.
40
+ * Determines if and when `expo-updates` checks for and downloads updates automatically on startup.
40
41
  */
41
42
  export const checkAutomatically = _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;
42
43
  // @docsMissing
@@ -114,7 +115,7 @@ const manualUpdatesInstructions = 'To test usage of the expo-updates JS API in y
114
115
  * the state of the native module and main threads.
115
116
  *
116
117
  * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you
117
- * try to do so. It also rejects when expo-updates is not enabled.
118
+ * try to do so. It also rejects when `expo-updates` is not enabled.
118
119
  *
119
120
  * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
120
121
  * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
@@ -145,7 +146,7 @@ export async function reloadAsync() {
145
146
  * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
146
147
  *
147
148
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
148
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
149
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
149
150
  */
150
151
  export async function checkForUpdateAsync() {
151
152
  if ((__DEV__ || isUsingDeveloperTool) &&
@@ -165,25 +166,25 @@ export async function checkForUpdateAsync() {
165
166
  /**
166
167
  * Retrieves the current extra params.
167
168
  *
168
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
169
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
169
170
  */
170
171
  export async function getExtraParamsAsync() {
171
172
  return await ExpoUpdates.getExtraParamsAsync();
172
173
  }
173
174
  /**
174
175
  * Sets an extra param if value is non-null, otherwise unsets the param.
175
- * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)
176
+ * Extra params are sent as an [Expo Structured Field Value Dictionary](/technical-specs/expo-sfv-0/)
176
177
  * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.
177
178
  *
178
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
179
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
179
180
  */
180
181
  export async function setExtraParamAsync(key, value) {
181
182
  return await ExpoUpdates.setExtraParamAsync(key, value ?? null);
182
183
  }
183
184
  /**
184
- * Retrieves the most recent expo-updates log entries.
185
+ * Retrieves the most recent `expo-updates` log entries.
185
186
  *
186
- * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).
187
+ * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to `3600000` ms (1 hour).
187
188
  *
188
189
  * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;
189
190
  *
@@ -193,7 +194,7 @@ export async function readLogEntriesAsync(maxAge = 3600000) {
193
194
  return await ExpoUpdates.readLogEntriesAsync(maxAge);
194
195
  }
195
196
  /**
196
- * Clears existing expo-updates log entries.
197
+ * Clears existing `expo-updates` log entries.
197
198
  *
198
199
  * > For now, this operation does nothing on the client. Once log persistence has been
199
200
  * > implemented, this operation will actually remove existing logs.
@@ -218,7 +219,7 @@ export async function clearLogEntriesAsync() {
218
219
  * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
219
220
  *
220
221
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
221
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
222
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
222
223
  */
223
224
  export async function fetchUpdateAsync() {
224
225
  if ((__DEV__ || isUsingDeveloperTool) &&
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,WAAW,MAAM,eAAe,CAAC;AAWxC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAY,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC;AAE1D;;;;;GAKG;AAC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AC,IAAI,CACV,2GAA2G,CAC5G,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kCAAkC,CAChD,qBAKC;IAED,MAAM,aAAa,GAAG,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACnD,IAAI,aAAa,CAAC,oBAAoB,EAAE;QACtC,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAC9E,OAAO,aAAa,CAAC,oBAAoB,CAAC;KAC3C;IACD,IAAI,aAAa,CAAC,wBAAwB,EAAE;QAC1C,aAAa,CAAC,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QACtF,OAAO,aAAa,CAAC,wBAAwB,CAAC;KAC/C;IACD,IAAI,aAAa,CAAC,4BAA4B,EAAE;QAC9C,aAAa,CAAC,sBAAsB,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;QAC5F,OAAO,aAAa,CAAC,4BAA4B,CAAC;KACnD;IACD,IAAI,aAAa,CAAC,cAAc,EAAE;QAChC,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAClE,OAAO,aAAa,CAAC,cAAc,CAAC;KACrC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,iCAAiC,EAAE,CAAC;IAC5E,OAAO,kCAAkC,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { CodedError } from 'expo-modules-core';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateFetchResult,\n UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * Whether expo-updates is enabled. This may be false in a variety of cases including:\n * - enabled set to false in configuration\n * - missing or invalid URL in configuration\n * - missing runtime version or SDK version in configuration\n * - error accessing storage on device during initialization\n *\n * When false, the embedded update is loaded.\n */\nexport const isEnabled: boolean = !!ExpoUpdates.isEnabled;\n\n/**\n * The UUID that uniquely identifies the currently running update. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.\n * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n/**\n * The channel name of the current build, if configured for use with EAS Update. `null` otherwise.\n *\n * Expo Go and development builds are not set to a specific channel and can run any updates compatible with their native runtime. Therefore, this value will always be `null` when running an update on Expo Go or a development build.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when expo-updates checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch;\n\n/**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\nexport const emergencyLaunchReason = ExpoUpdates.emergencyLaunchReason;\n\n/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\n/**\n * If `expo-updates` is enabled, this is the\n * [manifest](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\n * object for the update that's currently running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\nexport const manifest: Partial<Manifest> =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\n\n/**\n * During non-expo development we block accessing the updates API methods on the JS side, but when developing in\n * Expo Go or a development client build, the controllers should have control over which API methods should\n * be allowed.\n */\nconst shouldDeferToNativeForAPIMethodAvailabilityInDevelopment =\n !!ExpoUpdates.shouldDeferToNativeForAPIMethodAvailabilityInDevelopment;\n\n/**\n * Developer tool is set when a project is served by `expo start`.\n */\nconst isUsingDeveloperTool =\n 'extra' in manifest ? !!manifest.extra?.expoGo?.developer?.tool : false;\n\nconst manualUpdatesInstructions =\n 'To test usage of the expo-updates JS API in your app, make a release build with `npx expo run:ios --configuration Release` or ' +\n '`npx expo run:android --variant Release`.';\n\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the\n * app.\n *\n * It is not recommended to place any meaningful logic after a call to `await\n * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can\n * be reloaded, and immediately before posting an asynchronous task to the main thread to actually\n * reload the app. It is unsafe to make any assumptions about whether any more JS code will be\n * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and\n * the state of the native module and main threads.\n *\n * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you\n * try to do so. It also rejects when expo-updates is not enabled.\n *\n * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or\n * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production\n * mode, it most likely means you have installed the module incorrectly. Double check you've\n * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`\n * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on\n * Android ensure you either call `UpdatesController.initialize` with the instance of\n * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the\n * proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise<void> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * promise will be rejected if you try to do so.\n *\n * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\n *\n * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function checkForUpdateAsync(): Promise<UpdateCheckResult> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * Retrieves the current extra params.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function getExtraParamsAsync(): Promise<Record<string, string>> {\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)\n * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise<void> {\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent expo-updates log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise<UpdatesLogEntry[]> {\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing expo-updates log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise<void> {\n await ExpoUpdates.clearLogEntriesAsync();\n}\n\n/**\n * Downloads the most recently deployed update to your project from server to the device's local\n * storage. This method cannot be used in development mode, and the returned promise will be\n * rejected if you try to do so.\n *\n > **Note:** [`reloadAsync()`](#updatesreloadasync) can be called after promise resolution to\n * reload the app using the most recently downloaded version. Otherwise, the update will be applied\n * on the next app cold start.\n *\n * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function fetchUpdateAsync(): Promise<UpdateFetchResult> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\n/**\n * @hidden\n */\nexport function transformNativeStateMachineContext(\n originalNativeContext: UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n): UpdatesNativeStateMachineContext {\n const nativeContext = { ...originalNativeContext };\n if (nativeContext.latestManifestString) {\n nativeContext.latestManifest = JSON.parse(nativeContext.latestManifestString);\n delete nativeContext.latestManifestString;\n }\n if (nativeContext.downloadedManifestString) {\n nativeContext.downloadedManifest = JSON.parse(nativeContext.downloadedManifestString);\n delete nativeContext.downloadedManifestString;\n }\n if (nativeContext.lastCheckForUpdateTimeString) {\n nativeContext.lastCheckForUpdateTime = new Date(nativeContext.lastCheckForUpdateTimeString);\n delete nativeContext.lastCheckForUpdateTimeString;\n }\n if (nativeContext.rollbackString) {\n nativeContext.rollback = JSON.parse(nativeContext.rollbackString);\n delete nativeContext.rollbackString;\n }\n return nativeContext;\n}\n\n/**\n * @hidden\n */\nexport async function getNativeStateMachineContextAsync(): Promise<UpdatesNativeStateMachineContext> {\n const nativeContext = await ExpoUpdates.getNativeStateMachineContextAsync();\n return transformNativeStateMachineContext(nativeContext);\n}\n"]}
1
+ {"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,WAAW,MAAM,eAAe,CAAC;AAWxC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAY,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,WAAW,CAAC,QAAQ,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;IAC9D,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE;IACpC,CAAC,CAAC,IAAI,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB,WAAW,CAAC,cAAc,IAAI,IAAI,CAAC;AAEhF,MAAM,gCAAgC,GAAG;IACvC,MAAM,EAAE,SAAS;IACjB,mBAAmB,EAAE,mBAAmB;IACxC,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,gCAAgC,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC;AAE3E,eAAe;AAC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C5F,OAAO,aAAa,CAAC,4BAA4B,CAAC;KACnD;IACD,IAAI,aAAa,CAAC,cAAc,EAAE;QAChC,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAClE,OAAO,aAAa,CAAC,cAAc,CAAC;KACrC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,iCAAiC,EAAE,CAAC;IAC5E,OAAO,kCAAkC,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { CodedError } from 'expo-modules-core';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateFetchResult,\n UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * Whether `expo-updates` is enabled. This may be false in a variety of cases including:\n * - enabled set to false in configuration\n * - missing or invalid URL in configuration\n * - missing runtime version or SDK version in configuration\n * - error accessing storage on device during initialization\n *\n * When false, the embedded update is loaded.\n */\nexport const isEnabled: boolean = !!ExpoUpdates.isEnabled;\n\n/**\n * The UUID that uniquely identifies the currently running update. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.\n * @example\n * `\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"`\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n/**\n * The channel name of the current build, if configured for use with EAS Update. `null` otherwise.\n *\n * Expo Go and development builds are not set to a specific channel and can run any updates compatible with their native runtime. Therefore, this value will always be `null` when running an update on Expo Go or a development build.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when `expo-updates` checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch;\n\n/**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\nexport const emergencyLaunchReason = ExpoUpdates.emergencyLaunchReason;\n\n/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\n/**\n * If `expo-updates` is enabled, this is the\n * [manifest](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\n * object for the update that's currently running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\nexport const manifest: Partial<Manifest> =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\n\n/**\n * During non-expo development we block accessing the updates API methods on the JS side, but when developing in\n * Expo Go or a development client build, the controllers should have control over which API methods should\n * be allowed.\n */\nconst shouldDeferToNativeForAPIMethodAvailabilityInDevelopment =\n !!ExpoUpdates.shouldDeferToNativeForAPIMethodAvailabilityInDevelopment;\n\n/**\n * Developer tool is set when a project is served by `expo start`.\n */\nconst isUsingDeveloperTool =\n 'extra' in manifest ? !!manifest.extra?.expoGo?.developer?.tool : false;\n\nconst manualUpdatesInstructions =\n 'To test usage of the expo-updates JS API in your app, make a release build with `npx expo run:ios --configuration Release` or ' +\n '`npx expo run:android --variant Release`.';\n\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the\n * app.\n *\n * It is not recommended to place any meaningful logic after a call to `await\n * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can\n * be reloaded, and immediately before posting an asynchronous task to the main thread to actually\n * reload the app. It is unsafe to make any assumptions about whether any more JS code will be\n * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and\n * the state of the native module and main threads.\n *\n * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you\n * try to do so. It also rejects when `expo-updates` is not enabled.\n *\n * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or\n * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production\n * mode, it most likely means you have installed the module incorrectly. Double check you've\n * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`\n * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on\n * Android ensure you either call `UpdatesController.initialize` with the instance of\n * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the\n * proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise<void> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * promise will be rejected if you try to do so.\n *\n * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\n *\n * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.\n */\nexport async function checkForUpdateAsync(): Promise<UpdateCheckResult> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * Retrieves the current extra params.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.\n */\nexport async function getExtraParamsAsync(): Promise<Record<string, string>> {\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent as an [Expo Structured Field Value Dictionary](/technical-specs/expo-sfv-0/)\n * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise<void> {\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent `expo-updates` log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to `3600000` ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise<UpdatesLogEntry[]> {\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing `expo-updates` log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise<void> {\n await ExpoUpdates.clearLogEntriesAsync();\n}\n\n/**\n * Downloads the most recently deployed update to your project from server to the device's local\n * storage. This method cannot be used in development mode, and the returned promise will be\n * rejected if you try to do so.\n *\n > **Note:** [`reloadAsync()`](#updatesreloadasync) can be called after promise resolution to\n * reload the app using the most recently downloaded version. Otherwise, the update will be applied\n * on the next app cold start.\n *\n * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.\n */\nexport async function fetchUpdateAsync(): Promise<UpdateFetchResult> {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\n/**\n * @hidden\n */\nexport function transformNativeStateMachineContext(\n originalNativeContext: UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n): UpdatesNativeStateMachineContext {\n const nativeContext = { ...originalNativeContext };\n if (nativeContext.latestManifestString) {\n nativeContext.latestManifest = JSON.parse(nativeContext.latestManifestString);\n delete nativeContext.latestManifestString;\n }\n if (nativeContext.downloadedManifestString) {\n nativeContext.downloadedManifest = JSON.parse(nativeContext.downloadedManifestString);\n delete nativeContext.downloadedManifestString;\n }\n if (nativeContext.lastCheckForUpdateTimeString) {\n nativeContext.lastCheckForUpdateTime = new Date(nativeContext.lastCheckForUpdateTimeString);\n delete nativeContext.lastCheckForUpdateTimeString;\n }\n if (nativeContext.rollbackString) {\n nativeContext.rollback = JSON.parse(nativeContext.rollbackString);\n delete nativeContext.rollbackString;\n }\n return nativeContext;\n}\n\n/**\n * @hidden\n */\nexport async function getNativeStateMachineContextAsync(): Promise<UpdatesNativeStateMachineContext> {\n const nativeContext = await ExpoUpdates.getNativeStateMachineContextAsync();\n return transformNativeStateMachineContext(nativeContext);\n}\n"]}
@@ -159,7 +159,7 @@ export type UpdateFetchResultRollBackToEmbedded = {
159
159
  */
160
160
  export type UpdateFetchResult = UpdateFetchResultSuccess | UpdateFetchResultFailure | UpdateFetchResultRollBackToEmbedded;
161
161
  /**
162
- * An object representing a single log entry from expo-updates logging on the client.
162
+ * An object representing a single log entry from `expo-updates` logging on the client.
163
163
  */
164
164
  export type UpdatesLogEntry = {
165
165
  /**
@@ -192,7 +192,7 @@ export type UpdatesLogEntry = {
192
192
  stacktrace?: string[];
193
193
  };
194
194
  /**
195
- * The possible code values for expo-updates log entries
195
+ * The possible code values for `expo-updates` log entries
196
196
  */
197
197
  export declare enum UpdatesLogEntryCode {
198
198
  NONE = "None",
@@ -208,7 +208,7 @@ export declare enum UpdatesLogEntryCode {
208
208
  UNKNOWN = "Unknown"
209
209
  }
210
210
  /**
211
- * The possible log levels for expo-updates log entries
211
+ * The possible log levels for `expo-updates` log entries
212
212
  */
213
213
  export declare enum UpdatesLogEntryLevel {
214
214
  TRACE = "trace",
@@ -219,7 +219,7 @@ export declare enum UpdatesLogEntryLevel {
219
219
  FATAL = "fatal"
220
220
  }
221
221
  /**
222
- * The possible settings that determine if expo-updates will check for updates on app startup.
222
+ * The possible settings that determine if `expo-updates` will check for updates on app startup.
223
223
  * By default, Expo will check for updates every time the app is loaded.
224
224
  * Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error.
225
225
  * Set this to `NEVER` to completely disable automatic checking.
@@ -253,6 +253,8 @@ export type UpdatesNativeStateRollback = {
253
253
  commitTime: string;
254
254
  };
255
255
  /**
256
+ * The native state machine context, either read directly from a native module method,
257
+ * or received in a state change event. Used internally by this module and not exported publicly.
256
258
  * @hidden
257
259
  */
258
260
  export type UpdatesNativeStateMachineContext = {
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.types.d.ts","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAE9D,oBAAY,mCAAmC;IAC7C;;OAEG;IACH,6BAA6B,8BAA8B;IAC3D;;;OAGG;IACH,mCAAmC,oCAAoC;IACvE;;;OAGG;IACH,wBAAwB,2BAA2B;IACnD;;;OAGG;IACH,qCAAqC,sCAAsC;IAC3E;;OAEG;IACH,oBAAo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AAS,cAAc;IACvB;;OAEG;IACH,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IAEvC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,EAAE,0BAA0B,CAAC;IACtC,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAE1C,OAAO,EAAE,gCAAgC,CAAC;CAC3C,CAAC"}
@@ -25,7 +25,7 @@ export var UpdateCheckResultNotAvailableReason;
25
25
  UpdateCheckResultNotAvailableReason["ROLLBACK_NO_EMBEDDED"] = "rollbackNoEmbeddedConfiguration";
26
26
  })(UpdateCheckResultNotAvailableReason || (UpdateCheckResultNotAvailableReason = {}));
27
27
  /**
28
- * The possible code values for expo-updates log entries
28
+ * The possible code values for `expo-updates` log entries
29
29
  */
30
30
  export var UpdatesLogEntryCode;
31
31
  (function (UpdatesLogEntryCode) {
@@ -42,7 +42,7 @@ export var UpdatesLogEntryCode;
42
42
  UpdatesLogEntryCode["UNKNOWN"] = "Unknown";
43
43
  })(UpdatesLogEntryCode || (UpdatesLogEntryCode = {}));
44
44
  /**
45
- * The possible log levels for expo-updates log entries
45
+ * The possible log levels for `expo-updates` log entries
46
46
  */
47
47
  export var UpdatesLogEntryLevel;
48
48
  (function (UpdatesLogEntryLevel) {
@@ -54,7 +54,7 @@ export var UpdatesLogEntryLevel;
54
54
  UpdatesLogEntryLevel["FATAL"] = "fatal";
55
55
  })(UpdatesLogEntryLevel || (UpdatesLogEntryLevel = {}));
56
56
  /**
57
- * The possible settings that determine if expo-updates will check for updates on app startup.
57
+ * The possible settings that determine if `expo-updates` will check for updates on app startup.
58
58
  * By default, Expo will check for updates every time the app is loaded.
59
59
  * Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error.
60
60
  * Set this to `NEVER` to completely disable automatic checking.
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,mCAwBX;AAxBD,WAAY,mCAAmC;IAC7C;;OAEG;IACH,kGAA2D,CAAA;IAC3D;;;OAGG;IACH,8GAAuE,CAAA;IACvE;;;OAGG;IACH,0FAAmD,CAAA;IACnD;;;OAGG;IACH,kHAA2E,CAAA;IAC3E;;OAEG;IACH,+FAAwD,CAAA;AAC1D,CAAC,EAxBW,mCAAmC,KAAnC,mCAAmC,QAwB9C;AAyLD;;GAEG;AACH,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kEAA2C,CAAA;IAC3C,+EAAwD,CAAA;IACxD,4EAAqD,CAAA;IACrD,iFAA0D,CAAA;IAC1D,2EAAoD,CAAA;IACpD,mEAA4C,CAAA;IAC5C,mEAA4C,CAAA;IAC5C,0DAAmC,CAAA;IACnC,mEAA4C,CAAA;IAC5C,0CAAmB,CAAA;AACrB,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,uCAAe,CAAA;AACjB,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,8BAiBX;AAjBD,WAAY,8BAA8B;IACxC;;OAEG;IACH,qDAAmB,CAAA;IACnB;;OAEG;IACH,yEAAuC,CAAA;IACvC;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,iDAAe,CAAA;AACjB,CAAC,EAjBW,8BAA8B,KAA9B,8BAA8B,QAiBzC","sourcesContent":["import { ExpoUpdatesManifest, EmbeddedManifest } from 'expo-manifests';\n\nexport type Manifest = ExpoUpdatesManifest | EmbeddedManifest;\n\nexport enum UpdateCheckResultNotAvailableReason {\n /**\n * No update manifest or rollback directive received from the update server.\n */\n NO_UPDATE_AVAILABLE_ON_SERVER = 'noUpdateAvailableOnServer',\n /**\n * An update manifest was received from the update server, but the update is not launchable,\n * or does not pass the configured selection policy.\n */\n UPDATE_REJECTED_BY_SELECTION_POLICY = 'updateRejectedBySelectionPolicy',\n /**\n * An update manifest was received from the update server, but the update has been previously\n * launched on this device and never successfully launched.\n */\n UPDATE_PREVIOUSLY_FAILED = 'updatePreviouslyFailed',\n /**\n * A rollback directive was received from the update server, but the directive does not pass\n * the configured selection policy.\n */\n ROLLBACK_REJECTED_BY_SELECTION_POLICY = 'rollbackRejectedBySelectionPolicy',\n /**\n * A rollback directive was received from the update server, but this app has no embedded update.\n */\n ROLLBACK_NO_EMBEDDED = 'rollbackNoEmbeddedConfiguration',\n}\n\n/**\n * The update check result when a rollback directive is received.\n */\nexport type UpdateCheckResultRollBack = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: true;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result when a new update is found on the server.\n */\nexport type UpdateCheckResultAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: true;\n /**\n * The manifest of the update when available.\n */\n manifest: Manifest;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result if no new update was found.\n */\nexport type UpdateCheckResultNotAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: UpdateCheckResultNotAvailableReason;\n};\n\n/**\n * The result of checking for a new update.\n */\nexport type UpdateCheckResult =\n | UpdateCheckResultRollBack\n | UpdateCheckResultAvailable\n | UpdateCheckResultNotAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultSuccess = UpdateCheckResultAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultFailure = UpdateCheckResultNotAvailable;\n\n/**\n * The successful result of fetching a new update.\n */\nexport type UpdateFetchResultSuccess = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `true` when `isRollBackToEmbedded` is `false`.\n */\n isNew: true;\n /**\n * The manifest of the fetched update.\n */\n manifest: Manifest;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The failed result of fetching a new update.\n */\nexport type UpdateFetchResultFailure = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `false` when `isRollBackToEmbedded` is `true`.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The roll back to embedded result of fetching a new update.\n */\nexport type UpdateFetchResultRollBackToEmbedded = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `false` when `isRollBackToEmbedded` is `true`.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: true;\n};\n\n/**\n * The result of fetching a new update.\n */\nexport type UpdateFetchResult =\n | UpdateFetchResultSuccess\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded;\n\n/**\n * An object representing a single log entry from expo-updates logging on the client.\n */\nexport type UpdatesLogEntry = {\n /**\n * The time the log was written, in milliseconds since Jan 1 1970 UTC.\n */\n timestamp: number;\n /**\n * The log entry message.\n */\n message: string;\n /**\n * One of the defined code values for `expo-updates` log entries.\n */\n code: UpdatesLogEntryCode;\n /**\n * One of the defined log level or severity values.\n */\n level: UpdatesLogEntryLevel;\n /**\n * If present, the unique ID of an update associated with this log entry.\n */\n updateId?: string;\n /**\n * If present, the unique ID or hash of an asset associated with this log entry.\n */\n assetId?: string;\n /**\n * If present, an Android or iOS native stack trace associated with this log entry.\n */\n stacktrace?: string[];\n};\n\n/**\n * The possible code values for expo-updates log entries\n */\nexport enum UpdatesLogEntryCode {\n NONE = 'None',\n NO_UPDATES_AVAILABLE = 'NoUpdatesAvailable',\n UPDATE_ASSETS_NOT_AVAILABLE = 'UpdateAssetsNotAvailable',\n UPDATE_SERVER_UNREACHABLE = 'UpdateServerUnreachable',\n UPDATE_HAS_INVALID_SIGNATURE = 'UpdateHasInvalidSignature',\n UPDATE_CODE_SIGNING_ERROR = 'UpdateCodeSigningError',\n UPDATE_FAILED_TO_LOAD = 'UpdateFailedToLoad',\n ASSETS_FAILED_TO_LOAD = 'AssetsFailedToLoad',\n JS_RUNTIME_ERROR = 'JSRuntimeError',\n INITIALIZATION_ERROR = 'InitializationError',\n UNKNOWN = 'Unknown',\n}\n\n/**\n * The possible log levels for expo-updates log entries\n */\nexport enum UpdatesLogEntryLevel {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n FATAL = 'fatal',\n}\n\n/**\n * The possible settings that determine if expo-updates will check for updates on app startup.\n * By default, Expo will check for updates every time the app is loaded.\n * Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error.\n * Set this to `NEVER` to completely disable automatic checking.\n */\nexport enum UpdatesCheckAutomaticallyValue {\n /**\n * Checks for updates whenever the app is loaded. This is the default setting.\n */\n ON_LOAD = 'ON_LOAD',\n /**\n * Only checks for updates when the app starts up after an error recovery.\n */\n ON_ERROR_RECOVERY = 'ON_ERROR_RECOVERY',\n /**\n * Only checks for updates when the app starts and has a Wi-Fi connection.\n */\n WIFI_ONLY = 'WIFI_ONLY',\n /**\n * Automatic update checks are off, and update checks must be done through the JS API.\n */\n NEVER = 'NEVER',\n}\n\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateRollback = {\n // ISO date string with the rollback commit time\n commitTime: string;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateMachineContext = {\n // The native state machine context, either read directly from a native module method,\n // or received in a state change event. Used internally by this module and not exported publicly.\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n isChecking: boolean;\n isDownloading: boolean;\n isRestarting: boolean;\n latestManifest?: Manifest;\n downloadedManifest?: Manifest;\n rollback?: UpdatesNativeStateRollback;\n checkError?: Error;\n downloadError?: Error;\n lastCheckForUpdateTime?: Date;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateChangeEvent = {\n // Change event emitted by native\n context: UpdatesNativeStateMachineContext;\n};\n"]}
1
+ {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,mCAwBX;AAxBD,WAAY,mCAAmC;IAC7C;;OAEG;IACH,kGAA2D,CAAA;IAC3D;;;OAGG;IACH,8GAAuE,CAAA;IACvE;;;OAGG;IACH,0FAAmD,CAAA;IACnD;;;OAGG;IACH,kHAA2E,CAAA;IAC3E;;OAEG;IACH,+FAAwD,CAAA;AAC1D,CAAC,EAxBW,mCAAmC,KAAnC,mCAAmC,QAwB9C;AAyLD;;GAEG;AACH,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kEAA2C,CAAA;IAC3C,+EAAwD,CAAA;IACxD,4EAAqD,CAAA;IACrD,iFAA0D,CAAA;IAC1D,2EAAoD,CAAA;IACpD,mEAA4C,CAAA;IAC5C,mEAA4C,CAAA;IAC5C,0DAAmC,CAAA;IACnC,mEAA4C,CAAA;IAC5C,0CAAmB,CAAA;AACrB,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,uCAAe,CAAA;AACjB,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,8BAiBX;AAjBD,WAAY,8BAA8B;IACxC;;OAEG;IACH,qDAAmB,CAAA;IACnB;;OAEG;IACH,yEAAuC,CAAA;IACvC;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,iDAAe,CAAA;AACjB,CAAC,EAjBW,8BAA8B,KAA9B,8BAA8B,QAiBzC","sourcesContent":["import { ExpoUpdatesManifest, EmbeddedManifest } from 'expo-manifests';\n\nexport type Manifest = ExpoUpdatesManifest | EmbeddedManifest;\n\nexport enum UpdateCheckResultNotAvailableReason {\n /**\n * No update manifest or rollback directive received from the update server.\n */\n NO_UPDATE_AVAILABLE_ON_SERVER = 'noUpdateAvailableOnServer',\n /**\n * An update manifest was received from the update server, but the update is not launchable,\n * or does not pass the configured selection policy.\n */\n UPDATE_REJECTED_BY_SELECTION_POLICY = 'updateRejectedBySelectionPolicy',\n /**\n * An update manifest was received from the update server, but the update has been previously\n * launched on this device and never successfully launched.\n */\n UPDATE_PREVIOUSLY_FAILED = 'updatePreviouslyFailed',\n /**\n * A rollback directive was received from the update server, but the directive does not pass\n * the configured selection policy.\n */\n ROLLBACK_REJECTED_BY_SELECTION_POLICY = 'rollbackRejectedBySelectionPolicy',\n /**\n * A rollback directive was received from the update server, but this app has no embedded update.\n */\n ROLLBACK_NO_EMBEDDED = 'rollbackNoEmbeddedConfiguration',\n}\n\n/**\n * The update check result when a rollback directive is received.\n */\nexport type UpdateCheckResultRollBack = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: true;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result when a new update is found on the server.\n */\nexport type UpdateCheckResultAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: true;\n /**\n * The manifest of the update when available.\n */\n manifest: Manifest;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result if no new update was found.\n */\nexport type UpdateCheckResultNotAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: UpdateCheckResultNotAvailableReason;\n};\n\n/**\n * The result of checking for a new update.\n */\nexport type UpdateCheckResult =\n | UpdateCheckResultRollBack\n | UpdateCheckResultAvailable\n | UpdateCheckResultNotAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultSuccess = UpdateCheckResultAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultFailure = UpdateCheckResultNotAvailable;\n\n/**\n * The successful result of fetching a new update.\n */\nexport type UpdateFetchResultSuccess = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `true` when `isRollBackToEmbedded` is `false`.\n */\n isNew: true;\n /**\n * The manifest of the fetched update.\n */\n manifest: Manifest;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The failed result of fetching a new update.\n */\nexport type UpdateFetchResultFailure = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `false` when `isRollBackToEmbedded` is `true`.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The roll back to embedded result of fetching a new update.\n */\nexport type UpdateFetchResultRollBackToEmbedded = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * Always `false` when `isRollBackToEmbedded` is `true`.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: true;\n};\n\n/**\n * The result of fetching a new update.\n */\nexport type UpdateFetchResult =\n | UpdateFetchResultSuccess\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded;\n\n/**\n * An object representing a single log entry from `expo-updates` logging on the client.\n */\nexport type UpdatesLogEntry = {\n /**\n * The time the log was written, in milliseconds since Jan 1 1970 UTC.\n */\n timestamp: number;\n /**\n * The log entry message.\n */\n message: string;\n /**\n * One of the defined code values for `expo-updates` log entries.\n */\n code: UpdatesLogEntryCode;\n /**\n * One of the defined log level or severity values.\n */\n level: UpdatesLogEntryLevel;\n /**\n * If present, the unique ID of an update associated with this log entry.\n */\n updateId?: string;\n /**\n * If present, the unique ID or hash of an asset associated with this log entry.\n */\n assetId?: string;\n /**\n * If present, an Android or iOS native stack trace associated with this log entry.\n */\n stacktrace?: string[];\n};\n\n/**\n * The possible code values for `expo-updates` log entries\n */\nexport enum UpdatesLogEntryCode {\n NONE = 'None',\n NO_UPDATES_AVAILABLE = 'NoUpdatesAvailable',\n UPDATE_ASSETS_NOT_AVAILABLE = 'UpdateAssetsNotAvailable',\n UPDATE_SERVER_UNREACHABLE = 'UpdateServerUnreachable',\n UPDATE_HAS_INVALID_SIGNATURE = 'UpdateHasInvalidSignature',\n UPDATE_CODE_SIGNING_ERROR = 'UpdateCodeSigningError',\n UPDATE_FAILED_TO_LOAD = 'UpdateFailedToLoad',\n ASSETS_FAILED_TO_LOAD = 'AssetsFailedToLoad',\n JS_RUNTIME_ERROR = 'JSRuntimeError',\n INITIALIZATION_ERROR = 'InitializationError',\n UNKNOWN = 'Unknown',\n}\n\n/**\n * The possible log levels for `expo-updates` log entries\n */\nexport enum UpdatesLogEntryLevel {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n FATAL = 'fatal',\n}\n\n/**\n * The possible settings that determine if `expo-updates` will check for updates on app startup.\n * By default, Expo will check for updates every time the app is loaded.\n * Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error.\n * Set this to `NEVER` to completely disable automatic checking.\n */\nexport enum UpdatesCheckAutomaticallyValue {\n /**\n * Checks for updates whenever the app is loaded. This is the default setting.\n */\n ON_LOAD = 'ON_LOAD',\n /**\n * Only checks for updates when the app starts up after an error recovery.\n */\n ON_ERROR_RECOVERY = 'ON_ERROR_RECOVERY',\n /**\n * Only checks for updates when the app starts and has a Wi-Fi connection.\n */\n WIFI_ONLY = 'WIFI_ONLY',\n /**\n * Automatic update checks are off, and update checks must be done through the JS API.\n */\n NEVER = 'NEVER',\n}\n\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateRollback = {\n // ISO date string with the rollback commit time\n commitTime: string;\n};\n\n/**\n * The native state machine context, either read directly from a native module method,\n * or received in a state change event. Used internally by this module and not exported publicly.\n * @hidden\n */\nexport type UpdatesNativeStateMachineContext = {\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n isChecking: boolean;\n isDownloading: boolean;\n isRestarting: boolean;\n latestManifest?: Manifest;\n downloadedManifest?: Manifest;\n rollback?: UpdatesNativeStateRollback;\n checkError?: Error;\n downloadError?: Error;\n lastCheckForUpdateTime?: Date;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateChangeEvent = {\n // Change event emitted by native\n context: UpdatesNativeStateMachineContext;\n};\n"]}
@@ -8,11 +8,12 @@ export type CurrentlyRunningInfo = {
8
8
  * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The
9
9
  * UUID is represented in its canonical string form and will always use lowercase letters.
10
10
  * In development mode, or any other environment in which `expo-updates` is disabled, this value is undefined.
11
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
11
+ * @example
12
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
12
13
  */
13
14
  updateId?: string;
14
15
  /**
15
- * The channel name of the current build, if configured for use with EAS Update; undefined otherwise.
16
+ * The channel name of the current build, if configured for use with EAS Update, `undefined` otherwise.
16
17
  */
17
18
  channel?: string;
18
19
  /**
@@ -76,7 +77,7 @@ export declare enum UpdateInfoType {
76
77
  /**
77
78
  * Structure representing a new update.
78
79
  */
79
- type UpdateInfoNew = {
80
+ export type UpdateInfoNew = {
80
81
  /**
81
82
  * The type of update.
82
83
  */
@@ -85,7 +86,8 @@ type UpdateInfoNew = {
85
86
  * For updates of type `UpdateInfoType.NEW`, this is
86
87
  * a string that uniquely identifies the update. For the manifests used in the current Expo Updates protocol (including
87
88
  * EAS Update), this represents the update's UUID in its canonical string form and will always use lowercase letters.
88
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
89
+ * @example
90
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
89
91
  */
90
92
  updateId: string;
91
93
  /**
@@ -102,13 +104,13 @@ type UpdateInfoNew = {
102
104
  /**
103
105
  * Structure representing a rollback directive.
104
106
  */
105
- type UpdateInfoRollback = {
107
+ export type UpdateInfoRollback = {
106
108
  /**
107
109
  * The type of update.
108
110
  */
109
111
  type: UpdateInfoType.ROLLBACK;
110
112
  /**
111
- * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.
113
+ * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.
112
114
  */
113
115
  updateId: undefined;
114
116
  /**
@@ -117,7 +119,7 @@ type UpdateInfoRollback = {
117
119
  */
118
120
  createdAt: Date;
119
121
  /**
120
- * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.
122
+ * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.
121
123
  */
122
124
  manifest: undefined;
123
125
  };
@@ -126,7 +128,7 @@ type UpdateInfoRollback = {
126
128
  */
127
129
  export type UpdateInfo = UpdateInfoNew | UpdateInfoRollback;
128
130
  /**
129
- * The structures and methods returned by `useUpdates()`.
131
+ * The structures and methods returned by [`useUpdates()`](#useupdates).
130
132
  */
131
133
  export type UseUpdatesReturnType = {
132
134
  /**
@@ -134,9 +136,8 @@ export type UseUpdatesReturnType = {
134
136
  */
135
137
  currentlyRunning: CurrentlyRunningInfo;
136
138
  /**
137
- * If a new available update has been found, either by using checkForUpdate(),
138
- * or by the `UpdateEvent` listener in `useUpdates()`,
139
- * this will contain the information for that update.
139
+ * If a new available update has been found, either by using [`checkForUpdateAsync()`](#updatescheckforupdateasync),
140
+ * or by the `UpdateEvent` listener in `useUpdates()`, this will contain the information for that update.
140
141
  */
141
142
  availableUpdate?: UpdateInfo;
142
143
  /**
@@ -161,17 +162,17 @@ export type UseUpdatesReturnType = {
161
162
  */
162
163
  isDownloading: boolean;
163
164
  /**
164
- * If an error is returned from either the startup check for updates, or a call to `checkForUpdateAsync()`,
165
+ * If an error is returned from either the startup check for updates, or a call to [`checkForUpdateAsync()`](#updatescheckforupdateasync),
165
166
  * the error description will appear here.
166
167
  */
167
168
  checkError?: Error;
168
169
  /**
169
- * If an error is returned from either a startup update download, or a call to `fetchUpdateAsync()`,
170
+ * If an error is returned from either a startup update download, or a call to [`fetchUpdateAsync()`](#updatesfetchupdateasync),
170
171
  * the error description will appear here.
171
172
  */
172
173
  downloadError?: Error;
173
174
  /**
174
- * If an error occurs during initialization of `useUpdates()`, the error description will appear here.
175
+ * If an error occurs during initialization of [`useUpdates()`](#useupdates), the error description will appear here.
175
176
  */
176
177
  initializationError?: Error;
177
178
  /**
@@ -181,5 +182,4 @@ export type UseUpdatesReturnType = {
181
182
  */
182
183
  lastCheckForUpdateTimeSinceRestart?: Date;
183
184
  };
184
- export {};
185
185
  //# sourceMappingURL=UseUpdates.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UseUpdates.types.d.ts","sourceRoot":"","sources":["../src/UseUpdates.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB;;;OAGG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;;;;;;;OAQG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH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MAAM,UAAU,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,gBAAgB,EAAE,oBAAoB,CAAC;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC;IAC5B;;;;OAIG;IACH,kCAAkC,CAAC,EAAE,IAAI,CAAC;CAC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UseUpdates.types.js","sourceRoot":"","sources":["../src/UseUpdates.types.ts"],"names":[],"mappings":"AA6DA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB;;OAEG;IACH,6BAAW,CAAA;IACX;;OAEG;IACH,uCAAqB,CAAA;AACvB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB","sourcesContent":["import type { Manifest } from './Updates.types';\n\n/**\n * Structure encapsulating information on the currently running app\n * (either the embedded bundle or a downloaded update).\n */\nexport type CurrentlyRunningInfo = {\n /**\n * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is undefined.\n * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\n updateId?: string;\n /**\n * The channel name of the current build, if configured for use with EAS Update; undefined otherwise.\n */\n channel?: string;\n /**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update\n * that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * undefined.\n */\n createdAt?: Date;\n /**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\n isEmbeddedLaunch: boolean;\n /**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\n isEmergencyLaunch: boolean;\n /**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\n emergencyLaunchReason: string | null;\n /**\n * If `expo-updates` is enabled, this is the\n * [manifest](https://docs.expo.dev/versions/latest/sdk/updates/#updatesmanifest) object for the update that's currently\n * running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\n manifest?: Partial<Manifest>;\n /**\n * The runtime version of the current build.\n */\n runtimeVersion?: string;\n};\n\n/**\n * The different possible types of updates.\n * Currently, the only supported type is `UpdateInfoType.NEW`, indicating a new update that can be downloaded and launched\n * on the device.\n * In the future, other types of updates may be added to this list.\n */\nexport enum UpdateInfoType {\n /**\n * This is the type for new updates found on or downloaded from the update server, that are launchable on the device.\n */\n NEW = 'new',\n /**\n * This type is used when an update is a directive to roll back to the embedded bundle.\n */\n ROLLBACK = 'rollback',\n}\n\n/**\n * Structure representing a new update.\n */\ntype UpdateInfoNew = {\n /**\n * The type of update.\n */\n type: UpdateInfoType.NEW;\n /**\n * For updates of type `UpdateInfoType.NEW`, this is\n * a string that uniquely identifies the update. For the manifests used in the current Expo Updates protocol (including\n * EAS Update), this represents the update's UUID in its canonical string form and will always use lowercase letters.\n * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\n updateId: string;\n /**\n * For all types of updates, this is\n * a `Date` object representing the creation time or commit time of the update.\n */\n createdAt: Date;\n /**\n * For updates of type `UpdateInfoType.NEW`, this is\n * the [manifest](https://docs.expo.dev/versions/latest/sdk/constants/#manifest) for the update.\n */\n manifest: Manifest;\n};\n\n/**\n * Structure representing a rollback directive.\n */\ntype UpdateInfoRollback = {\n /**\n * The type of update.\n */\n type: UpdateInfoType.ROLLBACK;\n /**\n * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.\n */\n updateId: undefined;\n /**\n * For all types of updates, this is\n * a `Date` object representing the creation time or commit time of the update.\n */\n createdAt: Date;\n /**\n * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.\n */\n manifest: undefined;\n};\n\n/**\n * Combined structure representing any type of update.\n */\nexport type UpdateInfo = UpdateInfoNew | UpdateInfoRollback;\n\n/**\n * The structures and methods returned by `useUpdates()`.\n */\nexport type UseUpdatesReturnType = {\n /**\n * Information on the currently running app.\n */\n currentlyRunning: CurrentlyRunningInfo;\n /**\n * If a new available update has been found, either by using checkForUpdate(),\n * or by the `UpdateEvent` listener in `useUpdates()`,\n * this will contain the information for that update.\n */\n availableUpdate?: UpdateInfo;\n /**\n * If an available update has been downloaded, this will contain the information\n * for that update.\n */\n downloadedUpdate?: UpdateInfo;\n /**\n * True if a new available update has been found, false otherwise.\n */\n isUpdateAvailable: boolean;\n /**\n * True if a new available update is available and has been downloaded.\n */\n isUpdatePending: boolean;\n /**\n * True if the app is currently checking for a new available update from the server.\n */\n isChecking: boolean;\n /**\n * True if the app is currently downloading an update from the server.\n */\n isDownloading: boolean;\n /**\n * If an error is returned from either the startup check for updates, or a call to `checkForUpdateAsync()`,\n * the error description will appear here.\n */\n checkError?: Error;\n /**\n * If an error is returned from either a startup update download, or a call to `fetchUpdateAsync()`,\n * the error description will appear here.\n */\n downloadError?: Error;\n /**\n * If an error occurs during initialization of `useUpdates()`, the error description will appear here.\n */\n initializationError?: Error;\n /**\n * A `Date` object representing the last time this client checked for an available update,\n * or `undefined` if no check has yet occurred since the app started. Does not persist across\n * app reloads or restarts.\n */\n lastCheckForUpdateTimeSinceRestart?: Date;\n};\n"]}
1
+ {"version":3,"file":"UseUpdates.types.js","sourceRoot":"","sources":["../src/UseUpdates.types.ts"],"names":[],"mappings":"AA8DA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB;;OAEG;IACH,6BAAW,CAAA;IACX;;OAEG;IACH,uCAAqB,CAAA;AACvB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB","sourcesContent":["import type { Manifest } from './Updates.types';\n\n/**\n * Structure encapsulating information on the currently running app\n * (either the embedded bundle or a downloaded update).\n */\nexport type CurrentlyRunningInfo = {\n /**\n * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is undefined.\n * @example\n * `\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"`\n */\n updateId?: string;\n /**\n * The channel name of the current build, if configured for use with EAS Update, `undefined` otherwise.\n */\n channel?: string;\n /**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update\n * that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * undefined.\n */\n createdAt?: Date;\n /**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\n isEmbeddedLaunch: boolean;\n /**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\n isEmergencyLaunch: boolean;\n /**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\n emergencyLaunchReason: string | null;\n /**\n * If `expo-updates` is enabled, this is the\n * [manifest](https://docs.expo.dev/versions/latest/sdk/updates/#updatesmanifest) object for the update that's currently\n * running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\n manifest?: Partial<Manifest>;\n /**\n * The runtime version of the current build.\n */\n runtimeVersion?: string;\n};\n\n/**\n * The different possible types of updates.\n * Currently, the only supported type is `UpdateInfoType.NEW`, indicating a new update that can be downloaded and launched\n * on the device.\n * In the future, other types of updates may be added to this list.\n */\nexport enum UpdateInfoType {\n /**\n * This is the type for new updates found on or downloaded from the update server, that are launchable on the device.\n */\n NEW = 'new',\n /**\n * This type is used when an update is a directive to roll back to the embedded bundle.\n */\n ROLLBACK = 'rollback',\n}\n\n/**\n * Structure representing a new update.\n */\nexport type UpdateInfoNew = {\n /**\n * The type of update.\n */\n type: UpdateInfoType.NEW;\n /**\n * For updates of type `UpdateInfoType.NEW`, this is\n * a string that uniquely identifies the update. For the manifests used in the current Expo Updates protocol (including\n * EAS Update), this represents the update's UUID in its canonical string form and will always use lowercase letters.\n * @example\n * `\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"`\n */\n updateId: string;\n /**\n * For all types of updates, this is\n * a `Date` object representing the creation time or commit time of the update.\n */\n createdAt: Date;\n /**\n * For updates of type `UpdateInfoType.NEW`, this is\n * the [manifest](https://docs.expo.dev/versions/latest/sdk/constants/#manifest) for the update.\n */\n manifest: Manifest;\n};\n\n/**\n * Structure representing a rollback directive.\n */\nexport type UpdateInfoRollback = {\n /**\n * The type of update.\n */\n type: UpdateInfoType.ROLLBACK;\n /**\n * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.\n */\n updateId: undefined;\n /**\n * For all types of updates, this is\n * a `Date` object representing the creation time or commit time of the update.\n */\n createdAt: Date;\n /**\n * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.\n */\n manifest: undefined;\n};\n\n/**\n * Combined structure representing any type of update.\n */\nexport type UpdateInfo = UpdateInfoNew | UpdateInfoRollback;\n\n/**\n * The structures and methods returned by [`useUpdates()`](#useupdates).\n */\nexport type UseUpdatesReturnType = {\n /**\n * Information on the currently running app.\n */\n currentlyRunning: CurrentlyRunningInfo;\n /**\n * If a new available update has been found, either by using [`checkForUpdateAsync()`](#updatescheckforupdateasync),\n * or by the `UpdateEvent` listener in `useUpdates()`, this will contain the information for that update.\n */\n availableUpdate?: UpdateInfo;\n /**\n * If an available update has been downloaded, this will contain the information\n * for that update.\n */\n downloadedUpdate?: UpdateInfo;\n /**\n * True if a new available update has been found, false otherwise.\n */\n isUpdateAvailable: boolean;\n /**\n * True if a new available update is available and has been downloaded.\n */\n isUpdatePending: boolean;\n /**\n * True if the app is currently checking for a new available update from the server.\n */\n isChecking: boolean;\n /**\n * True if the app is currently downloading an update from the server.\n */\n isDownloading: boolean;\n /**\n * If an error is returned from either the startup check for updates, or a call to [`checkForUpdateAsync()`](#updatescheckforupdateasync),\n * the error description will appear here.\n */\n checkError?: Error;\n /**\n * If an error is returned from either a startup update download, or a call to [`fetchUpdateAsync()`](#updatesfetchupdateasync),\n * the error description will appear here.\n */\n downloadError?: Error;\n /**\n * If an error occurs during initialization of [`useUpdates()`](#useupdates), the error description will appear here.\n */\n initializationError?: Error;\n /**\n * A `Date` object representing the last time this client checked for an available update,\n * or `undefined` if no check has yet occurred since the app started. Does not persist across\n * app reloads or restarts.\n */\n lastCheckForUpdateTimeSinceRestart?: Date;\n};\n"]}
@@ -40,8 +40,8 @@ export interface UpdatesStateMachineContext {
40
40
  downloadError?: Error;
41
41
  }
42
42
  /**
43
- * Model of the expo-updates state machine, written in Typescript.
44
- * The actual implementations of this state machine will be in Swift on iOS and Kotlin on Android.
43
+ * Model of the `expo-updates` state machine, written in Typescript.
44
+ * The actual implementations of this state machine will be in Kotlin on Android and Swift on iOS.
45
45
  */
46
46
  export declare const UpdatesStateMachine: import("xstate").StateMachine<UpdatesStateMachineContext, any, import("xstate").AnyEventObject, {
47
47
  value: any;
@@ -50,8 +50,8 @@ const download = assign({
50
50
  isDownloading: (context) => true,
51
51
  });
52
52
  /**
53
- * Model of the expo-updates state machine, written in Typescript.
54
- * The actual implementations of this state machine will be in Swift on iOS and Kotlin on Android.
53
+ * Model of the `expo-updates` state machine, written in Typescript.
54
+ * The actual implementations of this state machine will be in Kotlin on Android and Swift on iOS.
55
55
  */
56
56
  export const UpdatesStateMachine = createMachine({
57
57
  id: 'Updates',
@@ -1 +1 @@
1
- {"version":3,"file":"UpdatesStateMachine.js","sourceRoot":"","sources":["../../src/statemachine/UpdatesStateMachine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,CAAN,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC,gDAAe,CAAA;IACf,oFAAmD,CAAA;IACnD,wFAAuD,CAAA;IACvD,2DAA0B,CAAA;IAC1B,sDAAqB,CAAA;IACrB,uEAAsC,CAAA;IACtC,iEAAgC,CAAA;IAChC,oDAAmB,CAAA;AACrB,CAAC,EATW,6BAA6B,KAA7B,6BAA6B,QASxC;AAoCD;;GAEG;AACH,MAAM,4BAA4B,GAAG,MAAM,CAAC;IAC1C,cAAc,EAAE,CAAC,OAAmC,EAAE,KAA+B,EAAE,EAAE,CACvF,KAAK,CAAC,IAAI,EAAE,QAAQ,IAAI,SAAS;IACnC,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;IAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC7B,UAAU,EAAE,CAAC,OAAmC,EAAE,KAA+B,EAAE,EAAE,CACnF,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC;CAC5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gBAAgB,CAAC;iBAC5B;aACF;SACF;QACD,WAAW,EAAE;YACX,EAAE,EAAE;gBACF,gBAAgB,EAAE;oBAChB,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBAClC;gBACD,aAAa,EAAE;oBACb,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,CAAC,mBAAmB,CAAC;iBAC/B;aACF;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;SACd;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMachine, assign } from 'xstate';\n\nexport enum UpdatesStateMachineEventTypes {\n CHECK = 'check',\n CHECK_COMPLETE_AVAILABLE = 'checkCompleteAvailable',\n CHECK_COMPLETE_UNAVAILABLE = 'checkCompleteUnavailable',\n CHECK_ERROR = 'checkError',\n DOWNLOAD = 'download',\n DOWNLOAD_COMPLETE = 'downloadComplete',\n DOWNLOAD_ERROR = 'downloadError',\n RESTART = 'restart',\n}\n\n/**\n * Simplified model for an update manifest\n */\nexport type Manifest = {\n updateId: string;\n};\n\n/**\n * Model for an update event\n */\nexport type UpdatesStateMachineEvent = {\n type: UpdatesStateMachineEventTypes;\n body: {\n message?: string;\n manifest?: Manifest;\n isRollBackToEmbedded?: boolean;\n };\n};\n\n/**\n * The context structure\n */\nexport interface UpdatesStateMachineContext {\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n latestManifest?: Manifest;\n isChecking: boolean;\n isDownloading: boolean;\n isRollback: boolean;\n downloadedManifest?: Manifest;\n checkError?: Error;\n downloadError?: Error;\n}\n\n/**\n * Actions that modify the context\n */\nconst checkCompleteAvailableAction = assign({\n latestManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || undefined,\n checkError: () => undefined,\n isChecking: () => false,\n isUpdateAvailable: () => true,\n isRollback: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n Boolean(event.body?.isRollBackToEmbedded),\n});\n\nconst checkCompleteUnavailableAction = assign({\n latestManifest: () => undefined,\n checkError: () => undefined,\n isChecking: () => false,\n isUpdateAvailable: () => false,\n isRollback: () => false,\n});\n\nconst checkErrorAction = assign({\n isChecking: () => false,\n checkError: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n new Error(event.body?.message || 'checkError'),\n});\n\nconst downloadCompleteAction = assign({\n downloadedManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || context.downloadedManifest,\n latestManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || context.latestManifest,\n downloadError: () => undefined,\n isDownloading: () => false,\n isUpdatePending: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n !!(event.body?.manifest || context.downloadedManifest),\n isUpdateAvailable: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest !== undefined || context.isUpdateAvailable,\n});\n\nconst downloadErrorAction = assign({\n downloadError: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n new Error(event.body?.message || 'downloadError'),\n isDownloading: () => false,\n});\n\nconst check = assign({\n isChecking: (context: UpdatesStateMachineContext) => true,\n});\n\nconst download = assign({\n isDownloading: (context: UpdatesStateMachineContext) => true,\n});\n\n/**\n * Model of the expo-updates state machine, written in Typescript.\n * The actual implementations of this state machine will be in Swift on iOS and Kotlin on Android.\n */\nexport const UpdatesStateMachine = createMachine<UpdatesStateMachineContext>({\n id: 'Updates',\n initial: 'idle',\n context: {\n isChecking: false,\n isDownloading: false,\n isUpdateAvailable: false,\n isUpdatePending: false,\n isRollback: false,\n },\n predictableActionArguments: true,\n states: {\n idle: {\n on: {\n check: {\n target: 'checking',\n actions: check,\n },\n download: {\n target: 'downloading',\n actions: download,\n },\n restart: {\n target: 'restarting',\n },\n },\n },\n checking: {\n on: {\n checkCompleteAvailable: {\n target: 'idle',\n actions: [checkCompleteAvailableAction],\n },\n checkCompleteUnavailable: {\n target: 'idle',\n actions: [checkCompleteUnavailableAction],\n },\n checkError: {\n target: 'idle',\n actions: [checkErrorAction],\n },\n },\n },\n downloading: {\n on: {\n downloadComplete: {\n target: 'idle',\n actions: [downloadCompleteAction],\n },\n downloadError: {\n target: 'idle',\n actions: [downloadErrorAction],\n },\n },\n },\n restarting: {\n type: 'final',\n },\n },\n});\n"]}
1
+ {"version":3,"file":"UpdatesStateMachine.js","sourceRoot":"","sources":["../../src/statemachine/UpdatesStateMachine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,CAAN,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC,gDAAe,CAAA;IACf,oFAAmD,CAAA;IACnD,wFAAuD,CAAA;IACvD,2DAA0B,CAAA;IAC1B,sDAAqB,CAAA;IACrB,uEAAsC,CAAA;IACtC,iEAAgC,CAAA;IAChC,oDAAmB,CAAA;AACrB,CAAC,EATW,6BAA6B,KAA7B,6BAA6B,QASxC;AAoCD;;GAEG;AACH,MAAM,4BAA4B,GAAG,MAAM,CAAC;IAC1C,cAAc,EAAE,CAAC,OAAmC,EAAE,KAA+B,EAAE,EAAE,CACvF,KAAK,CAAC,IAAI,EAAE,QAAQ,IAAI,SAAS;IACnC,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;IAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC7B,UAAU,EAAE,CAAC,OAAmC,EAAE,KAA+B,EAAE,EAAE,CACnF,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,8BAA8B,GAAG,MAAM,CAAC;IAC5C,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS;IAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;IAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,iBAAi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AAM;oBACd,OAAO,EAAE,CAAC,mBAAmB,CAAC;iBAC/B;aACF;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;SACd;KACF;CACF,CAAC,CAAC","sourcesContent":["import { createMachine, assign } from 'xstate';\n\nexport enum UpdatesStateMachineEventTypes {\n CHECK = 'check',\n CHECK_COMPLETE_AVAILABLE = 'checkCompleteAvailable',\n CHECK_COMPLETE_UNAVAILABLE = 'checkCompleteUnavailable',\n CHECK_ERROR = 'checkError',\n DOWNLOAD = 'download',\n DOWNLOAD_COMPLETE = 'downloadComplete',\n DOWNLOAD_ERROR = 'downloadError',\n RESTART = 'restart',\n}\n\n/**\n * Simplified model for an update manifest\n */\nexport type Manifest = {\n updateId: string;\n};\n\n/**\n * Model for an update event\n */\nexport type UpdatesStateMachineEvent = {\n type: UpdatesStateMachineEventTypes;\n body: {\n message?: string;\n manifest?: Manifest;\n isRollBackToEmbedded?: boolean;\n };\n};\n\n/**\n * The context structure\n */\nexport interface UpdatesStateMachineContext {\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n latestManifest?: Manifest;\n isChecking: boolean;\n isDownloading: boolean;\n isRollback: boolean;\n downloadedManifest?: Manifest;\n checkError?: Error;\n downloadError?: Error;\n}\n\n/**\n * Actions that modify the context\n */\nconst checkCompleteAvailableAction = assign({\n latestManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || undefined,\n checkError: () => undefined,\n isChecking: () => false,\n isUpdateAvailable: () => true,\n isRollback: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n Boolean(event.body?.isRollBackToEmbedded),\n});\n\nconst checkCompleteUnavailableAction = assign({\n latestManifest: () => undefined,\n checkError: () => undefined,\n isChecking: () => false,\n isUpdateAvailable: () => false,\n isRollback: () => false,\n});\n\nconst checkErrorAction = assign({\n isChecking: () => false,\n checkError: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n new Error(event.body?.message || 'checkError'),\n});\n\nconst downloadCompleteAction = assign({\n downloadedManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || context.downloadedManifest,\n latestManifest: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest || context.latestManifest,\n downloadError: () => undefined,\n isDownloading: () => false,\n isUpdatePending: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n !!(event.body?.manifest || context.downloadedManifest),\n isUpdateAvailable: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n event.body?.manifest !== undefined || context.isUpdateAvailable,\n});\n\nconst downloadErrorAction = assign({\n downloadError: (context: UpdatesStateMachineContext, event: UpdatesStateMachineEvent) =>\n new Error(event.body?.message || 'downloadError'),\n isDownloading: () => false,\n});\n\nconst check = assign({\n isChecking: (context: UpdatesStateMachineContext) => true,\n});\n\nconst download = assign({\n isDownloading: (context: UpdatesStateMachineContext) => true,\n});\n\n/**\n * Model of the `expo-updates` state machine, written in Typescript.\n * The actual implementations of this state machine will be in Kotlin on Android and Swift on iOS.\n */\nexport const UpdatesStateMachine = createMachine<UpdatesStateMachineContext>({\n id: 'Updates',\n initial: 'idle',\n context: {\n isChecking: false,\n isDownloading: false,\n isUpdateAvailable: false,\n isUpdatePending: false,\n isRollback: false,\n },\n predictableActionArguments: true,\n states: {\n idle: {\n on: {\n check: {\n target: 'checking',\n actions: check,\n },\n download: {\n target: 'downloading',\n actions: download,\n },\n restart: {\n target: 'restarting',\n },\n },\n },\n checking: {\n on: {\n checkCompleteAvailable: {\n target: 'idle',\n actions: [checkCompleteAvailableAction],\n },\n checkCompleteUnavailable: {\n target: 'idle',\n actions: [checkCompleteUnavailableAction],\n },\n checkError: {\n target: 'idle',\n actions: [checkErrorAction],\n },\n },\n },\n downloading: {\n on: {\n downloadComplete: {\n target: 'idle',\n actions: [downloadCompleteAction],\n },\n downloadError: {\n target: 'idle',\n actions: [downloadErrorAction],\n },\n },\n },\n restarting: {\n type: 'final',\n },\n },\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.25.4",
3
+ "version": "0.25.6",
4
4
  "description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -67,5 +67,5 @@
67
67
  "peerDependencies": {
68
68
  "expo": "*"
69
69
  },
70
- "gitHead": "915a89deafdbb85ce8f6120e499c8c1386c43824"
70
+ "gitHead": "470464ab5c25ae8bd45eb2a94d221ce51a8b2560"
71
71
  }
@@ -61,6 +61,9 @@ export interface ExpoUpdatesModule
61
61
  | UpdateFetchResultFailure
62
62
  | UpdateFetchResultRollBackToEmbedded
63
63
  >;
64
+ /**
65
+ * @hidden
66
+ */
64
67
  getNativeStateMachineContextAsync: () => Promise<
65
68
  UpdatesNativeStateMachineContext & {
66
69
  latestManifestString?: string;
package/src/Updates.ts CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  } from './Updates.types';
13
13
 
14
14
  /**
15
- * Whether expo-updates is enabled. This may be false in a variety of cases including:
15
+ * Whether `expo-updates` is enabled. This may be false in a variety of cases including:
16
16
  * - enabled set to false in configuration
17
17
  * - missing or invalid URL in configuration
18
18
  * - missing runtime version or SDK version in configuration
@@ -26,7 +26,8 @@ export const isEnabled: boolean = !!ExpoUpdates.isEnabled;
26
26
  * The UUID that uniquely identifies the currently running update. The
27
27
  * UUID is represented in its canonical string form and will always use lowercase letters.
28
28
  * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.
29
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
29
+ * @example
30
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
30
31
  */
31
32
  export const updateId: string | null =
32
33
  ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'
@@ -53,7 +54,7 @@ const _checkAutomaticallyMapNativeToJS = {
53
54
  };
54
55
 
55
56
  /**
56
- * Determines if and when expo-updates checks for and downloads updates automatically on startup.
57
+ * Determines if and when `expo-updates` checks for and downloads updates automatically on startup.
57
58
  */
58
59
  export const checkAutomatically: UpdatesCheckAutomaticallyValue | null =
59
60
  _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;
@@ -147,7 +148,7 @@ const manualUpdatesInstructions =
147
148
  * the state of the native module and main threads.
148
149
  *
149
150
  * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you
150
- * try to do so. It also rejects when expo-updates is not enabled.
151
+ * try to do so. It also rejects when `expo-updates` is not enabled.
151
152
  *
152
153
  * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
153
154
  * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
@@ -184,7 +185,7 @@ export async function reloadAsync(): Promise<void> {
184
185
  * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
185
186
  *
186
187
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
187
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
188
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
188
189
  */
189
190
  export async function checkForUpdateAsync(): Promise<UpdateCheckResult> {
190
191
  if (
@@ -211,7 +212,7 @@ export async function checkForUpdateAsync(): Promise<UpdateCheckResult> {
211
212
  /**
212
213
  * Retrieves the current extra params.
213
214
  *
214
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
215
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
215
216
  */
216
217
  export async function getExtraParamsAsync(): Promise<Record<string, string>> {
217
218
  return await ExpoUpdates.getExtraParamsAsync();
@@ -219,10 +220,10 @@ export async function getExtraParamsAsync(): Promise<Record<string, string>> {
219
220
 
220
221
  /**
221
222
  * Sets an extra param if value is non-null, otherwise unsets the param.
222
- * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)
223
+ * Extra params are sent as an [Expo Structured Field Value Dictionary](/technical-specs/expo-sfv-0/)
223
224
  * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.
224
225
  *
225
- * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.
226
+ * This method cannot be used in Expo Go or development mode. It also rejects when `expo-updates` is not enabled.
226
227
  */
227
228
  export async function setExtraParamAsync(
228
229
  key: string,
@@ -232,9 +233,9 @@ export async function setExtraParamAsync(
232
233
  }
233
234
 
234
235
  /**
235
- * Retrieves the most recent expo-updates log entries.
236
+ * Retrieves the most recent `expo-updates` log entries.
236
237
  *
237
- * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).
238
+ * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to `3600000` ms (1 hour).
238
239
  *
239
240
  * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;
240
241
  *
@@ -245,7 +246,7 @@ export async function readLogEntriesAsync(maxAge: number = 3600000): Promise<Upd
245
246
  }
246
247
 
247
248
  /**
248
- * Clears existing expo-updates log entries.
249
+ * Clears existing `expo-updates` log entries.
249
250
  *
250
251
  * > For now, this operation does nothing on the client. Once log persistence has been
251
252
  * > implemented, this operation will actually remove existing logs.
@@ -271,7 +272,7 @@ export async function clearLogEntriesAsync(): Promise<void> {
271
272
  * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
272
273
  *
273
274
  * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or
274
- * timeout communicating with the server. It also rejects when expo-updates is not enabled.
275
+ * timeout communicating with the server. It also rejects when `expo-updates` is not enabled.
275
276
  */
276
277
  export async function fetchUpdateAsync(): Promise<UpdateFetchResult> {
277
278
  if (
@@ -178,7 +178,7 @@ export type UpdateFetchResult =
178
178
  | UpdateFetchResultRollBackToEmbedded;
179
179
 
180
180
  /**
181
- * An object representing a single log entry from expo-updates logging on the client.
181
+ * An object representing a single log entry from `expo-updates` logging on the client.
182
182
  */
183
183
  export type UpdatesLogEntry = {
184
184
  /**
@@ -212,7 +212,7 @@ export type UpdatesLogEntry = {
212
212
  };
213
213
 
214
214
  /**
215
- * The possible code values for expo-updates log entries
215
+ * The possible code values for `expo-updates` log entries
216
216
  */
217
217
  export enum UpdatesLogEntryCode {
218
218
  NONE = 'None',
@@ -229,7 +229,7 @@ export enum UpdatesLogEntryCode {
229
229
  }
230
230
 
231
231
  /**
232
- * The possible log levels for expo-updates log entries
232
+ * The possible log levels for `expo-updates` log entries
233
233
  */
234
234
  export enum UpdatesLogEntryLevel {
235
235
  TRACE = 'trace',
@@ -241,7 +241,7 @@ export enum UpdatesLogEntryLevel {
241
241
  }
242
242
 
243
243
  /**
244
- * The possible settings that determine if expo-updates will check for updates on app startup.
244
+ * The possible settings that determine if `expo-updates` will check for updates on app startup.
245
245
  * By default, Expo will check for updates every time the app is loaded.
246
246
  * Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error.
247
247
  * Set this to `NEVER` to completely disable automatic checking.
@@ -279,11 +279,11 @@ export type UpdatesNativeStateRollback = {
279
279
  };
280
280
 
281
281
  /**
282
+ * The native state machine context, either read directly from a native module method,
283
+ * or received in a state change event. Used internally by this module and not exported publicly.
282
284
  * @hidden
283
285
  */
284
286
  export type UpdatesNativeStateMachineContext = {
285
- // The native state machine context, either read directly from a native module method,
286
- // or received in a state change event. Used internally by this module and not exported publicly.
287
287
  isUpdateAvailable: boolean;
288
288
  isUpdatePending: boolean;
289
289
  isChecking: boolean;
@@ -9,11 +9,12 @@ export type CurrentlyRunningInfo = {
9
9
  * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The
10
10
  * UUID is represented in its canonical string form and will always use lowercase letters.
11
11
  * In development mode, or any other environment in which `expo-updates` is disabled, this value is undefined.
12
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
12
+ * @example
13
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
13
14
  */
14
15
  updateId?: string;
15
16
  /**
16
- * The channel name of the current build, if configured for use with EAS Update; undefined otherwise.
17
+ * The channel name of the current build, if configured for use with EAS Update, `undefined` otherwise.
17
18
  */
18
19
  channel?: string;
19
20
  /**
@@ -79,7 +80,7 @@ export enum UpdateInfoType {
79
80
  /**
80
81
  * Structure representing a new update.
81
82
  */
82
- type UpdateInfoNew = {
83
+ export type UpdateInfoNew = {
83
84
  /**
84
85
  * The type of update.
85
86
  */
@@ -88,7 +89,8 @@ type UpdateInfoNew = {
88
89
  * For updates of type `UpdateInfoType.NEW`, this is
89
90
  * a string that uniquely identifies the update. For the manifests used in the current Expo Updates protocol (including
90
91
  * EAS Update), this represents the update's UUID in its canonical string form and will always use lowercase letters.
91
- * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
92
+ * @example
93
+ * `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`
92
94
  */
93
95
  updateId: string;
94
96
  /**
@@ -106,13 +108,13 @@ type UpdateInfoNew = {
106
108
  /**
107
109
  * Structure representing a rollback directive.
108
110
  */
109
- type UpdateInfoRollback = {
111
+ export type UpdateInfoRollback = {
110
112
  /**
111
113
  * The type of update.
112
114
  */
113
115
  type: UpdateInfoType.ROLLBACK;
114
116
  /**
115
- * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.
117
+ * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.
116
118
  */
117
119
  updateId: undefined;
118
120
  /**
@@ -121,7 +123,7 @@ type UpdateInfoRollback = {
121
123
  */
122
124
  createdAt: Date;
123
125
  /**
124
- * For updates of type `UpdateInfoType.ROLLBACK`, this is undefined.
126
+ * For updates of type `UpdateInfoType.ROLLBACK`, this is always set to `undefined`.
125
127
  */
126
128
  manifest: undefined;
127
129
  };
@@ -132,7 +134,7 @@ type UpdateInfoRollback = {
132
134
  export type UpdateInfo = UpdateInfoNew | UpdateInfoRollback;
133
135
 
134
136
  /**
135
- * The structures and methods returned by `useUpdates()`.
137
+ * The structures and methods returned by [`useUpdates()`](#useupdates).
136
138
  */
137
139
  export type UseUpdatesReturnType = {
138
140
  /**
@@ -140,9 +142,8 @@ export type UseUpdatesReturnType = {
140
142
  */
141
143
  currentlyRunning: CurrentlyRunningInfo;
142
144
  /**
143
- * If a new available update has been found, either by using checkForUpdate(),
144
- * or by the `UpdateEvent` listener in `useUpdates()`,
145
- * this will contain the information for that update.
145
+ * If a new available update has been found, either by using [`checkForUpdateAsync()`](#updatescheckforupdateasync),
146
+ * or by the `UpdateEvent` listener in `useUpdates()`, this will contain the information for that update.
146
147
  */
147
148
  availableUpdate?: UpdateInfo;
148
149
  /**
@@ -167,17 +168,17 @@ export type UseUpdatesReturnType = {
167
168
  */
168
169
  isDownloading: boolean;
169
170
  /**
170
- * If an error is returned from either the startup check for updates, or a call to `checkForUpdateAsync()`,
171
+ * If an error is returned from either the startup check for updates, or a call to [`checkForUpdateAsync()`](#updatescheckforupdateasync),
171
172
  * the error description will appear here.
172
173
  */
173
174
  checkError?: Error;
174
175
  /**
175
- * If an error is returned from either a startup update download, or a call to `fetchUpdateAsync()`,
176
+ * If an error is returned from either a startup update download, or a call to [`fetchUpdateAsync()`](#updatesfetchupdateasync),
176
177
  * the error description will appear here.
177
178
  */
178
179
  downloadError?: Error;
179
180
  /**
180
- * If an error occurs during initialization of `useUpdates()`, the error description will appear here.
181
+ * If an error occurs during initialization of [`useUpdates()`](#useupdates), the error description will appear here.
181
182
  */
182
183
  initializationError?: Error;
183
184
  /**
@@ -100,8 +100,8 @@ const download = assign({
100
100
  });
101
101
 
102
102
  /**
103
- * Model of the expo-updates state machine, written in Typescript.
104
- * The actual implementations of this state machine will be in Swift on iOS and Kotlin on Android.
103
+ * Model of the `expo-updates` state machine, written in Typescript.
104
+ * The actual implementations of this state machine will be in Kotlin on Android and Swift on iOS.
105
105
  */
106
106
  export const UpdatesStateMachine = createMachine<UpdatesStateMachineContext>({
107
107
  id: 'Updates',