@hot-updater/protocol 1.0.0-rc.28 → 1.0.0-rc.30
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.
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +1 -12
- package/dist/index.d.mts +1 -12
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -199,7 +199,11 @@ const createPluginHost = (environment) => {
|
|
|
199
199
|
const abortFromCaller = () => controller.abort();
|
|
200
200
|
if (callerSignal?.aborted) controller.abort();
|
|
201
201
|
callerSignal?.addEventListener("abort", abortFromCaller);
|
|
202
|
-
|
|
202
|
+
let timedOut = false;
|
|
203
|
+
const timeoutId = setTimeout(() => {
|
|
204
|
+
timedOut = true;
|
|
205
|
+
controller.abort();
|
|
206
|
+
}, requestTimeout ?? 5e3);
|
|
203
207
|
try {
|
|
204
208
|
return await environment.fetch(url, {
|
|
205
209
|
...init,
|
|
@@ -207,7 +211,7 @@ const createPluginHost = (environment) => {
|
|
|
207
211
|
signal: controller.signal
|
|
208
212
|
});
|
|
209
213
|
} catch (error) {
|
|
210
|
-
if (error instanceof Error && error.name === "AbortError"
|
|
214
|
+
if (!callerSignal?.aborted && (timedOut || error instanceof Error && error.name === "AbortError")) throw new Error("Request timed out");
|
|
211
215
|
throw error;
|
|
212
216
|
} finally {
|
|
213
217
|
clearTimeout(timeoutId);
|
package/dist/index.d.cts
CHANGED
|
@@ -133,7 +133,7 @@ type UpdateStrategy = "fingerprint" | "appVersion";
|
|
|
133
133
|
/** How an update moves the app's selection. */
|
|
134
134
|
type ReleaseTransitionKind = "INSTALL" | "ADOPT_RELEASE" | "USE_EMBEDDED" | "USE_BUILTIN";
|
|
135
135
|
/** The launch outcome native reports once per JavaScript runtime. */
|
|
136
|
-
type AppReadyResult =
|
|
136
|
+
type AppReadyResult = {
|
|
137
137
|
/** No update was applied or recovered at this launch. */
|
|
138
138
|
readonly status: "UNCHANGED";
|
|
139
139
|
readonly channel: string;
|
|
@@ -153,15 +153,6 @@ type AppReadyResult = ({
|
|
|
153
153
|
readonly toBundleId: string;
|
|
154
154
|
readonly toReleaseId: string | null;
|
|
155
155
|
readonly updateStrategy: UpdateStrategy;
|
|
156
|
-
}) & {
|
|
157
|
-
/**
|
|
158
|
-
* Android 11+: why the app's previous main process exited, the
|
|
159
|
-
* `ApplicationExitInfo` reason without its `REASON_` prefix, such as
|
|
160
|
-
* `CRASH`, `ANR`, `LOW_MEMORY`, or `USER_REQUESTED`. Null on iOS and on
|
|
161
|
-
* older Android. It tells a crash from the system or the user closing the
|
|
162
|
-
* app.
|
|
163
|
-
*/
|
|
164
|
-
readonly previousProcessExit: string | null;
|
|
165
156
|
};
|
|
166
157
|
/** What an update check found. */
|
|
167
158
|
type UpdateCheckResult = {
|
|
@@ -233,8 +224,6 @@ interface UpdateError {
|
|
|
233
224
|
readonly originCode?: string;
|
|
234
225
|
/** Why no response arrived, for a `network` failure, when the SDK knows. */
|
|
235
226
|
readonly transport?: UpdateErrorTransport;
|
|
236
|
-
/** Android 11+: why the previous main process exited (see `AppReadyResult`). */
|
|
237
|
-
readonly previousProcessExit?: string;
|
|
238
227
|
/** The bundle the update targeted; absent for the check stage. */
|
|
239
228
|
readonly targetBundleId?: string;
|
|
240
229
|
/** The Release the update targeted, when it names one. */
|
package/dist/index.d.mts
CHANGED
|
@@ -133,7 +133,7 @@ type UpdateStrategy = "fingerprint" | "appVersion";
|
|
|
133
133
|
/** How an update moves the app's selection. */
|
|
134
134
|
type ReleaseTransitionKind = "INSTALL" | "ADOPT_RELEASE" | "USE_EMBEDDED" | "USE_BUILTIN";
|
|
135
135
|
/** The launch outcome native reports once per JavaScript runtime. */
|
|
136
|
-
type AppReadyResult =
|
|
136
|
+
type AppReadyResult = {
|
|
137
137
|
/** No update was applied or recovered at this launch. */
|
|
138
138
|
readonly status: "UNCHANGED";
|
|
139
139
|
readonly channel: string;
|
|
@@ -153,15 +153,6 @@ type AppReadyResult = ({
|
|
|
153
153
|
readonly toBundleId: string;
|
|
154
154
|
readonly toReleaseId: string | null;
|
|
155
155
|
readonly updateStrategy: UpdateStrategy;
|
|
156
|
-
}) & {
|
|
157
|
-
/**
|
|
158
|
-
* Android 11+: why the app's previous main process exited, the
|
|
159
|
-
* `ApplicationExitInfo` reason without its `REASON_` prefix, such as
|
|
160
|
-
* `CRASH`, `ANR`, `LOW_MEMORY`, or `USER_REQUESTED`. Null on iOS and on
|
|
161
|
-
* older Android. It tells a crash from the system or the user closing the
|
|
162
|
-
* app.
|
|
163
|
-
*/
|
|
164
|
-
readonly previousProcessExit: string | null;
|
|
165
156
|
};
|
|
166
157
|
/** What an update check found. */
|
|
167
158
|
type UpdateCheckResult = {
|
|
@@ -233,8 +224,6 @@ interface UpdateError {
|
|
|
233
224
|
readonly originCode?: string;
|
|
234
225
|
/** Why no response arrived, for a `network` failure, when the SDK knows. */
|
|
235
226
|
readonly transport?: UpdateErrorTransport;
|
|
236
|
-
/** Android 11+: why the previous main process exited (see `AppReadyResult`). */
|
|
237
|
-
readonly previousProcessExit?: string;
|
|
238
227
|
/** The bundle the update targeted; absent for the check stage. */
|
|
239
228
|
readonly targetBundleId?: string;
|
|
240
229
|
/** The Release the update targeted, when it names one. */
|
package/dist/index.mjs
CHANGED
|
@@ -198,7 +198,11 @@ const createPluginHost = (environment) => {
|
|
|
198
198
|
const abortFromCaller = () => controller.abort();
|
|
199
199
|
if (callerSignal?.aborted) controller.abort();
|
|
200
200
|
callerSignal?.addEventListener("abort", abortFromCaller);
|
|
201
|
-
|
|
201
|
+
let timedOut = false;
|
|
202
|
+
const timeoutId = setTimeout(() => {
|
|
203
|
+
timedOut = true;
|
|
204
|
+
controller.abort();
|
|
205
|
+
}, requestTimeout ?? 5e3);
|
|
202
206
|
try {
|
|
203
207
|
return await environment.fetch(url, {
|
|
204
208
|
...init,
|
|
@@ -206,7 +210,7 @@ const createPluginHost = (environment) => {
|
|
|
206
210
|
signal: controller.signal
|
|
207
211
|
});
|
|
208
212
|
} catch (error) {
|
|
209
|
-
if (error instanceof Error && error.name === "AbortError"
|
|
213
|
+
if (!callerSignal?.aborted && (timedOut || error instanceof Error && error.name === "AbortError")) throw new Error("Request timed out");
|
|
210
214
|
throw error;
|
|
211
215
|
} finally {
|
|
212
216
|
clearTimeout(timeoutId);
|