@hot-updater/protocol 1.0.8 → 1.1.1

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.d.cts CHANGED
@@ -198,6 +198,12 @@ type UpdateCheckResult = {
198
198
  readonly releaseId: string | null;
199
199
  /** The Release before the check; it differs after an adoption. */
200
200
  readonly previousReleaseId: string | null;
201
+ /**
202
+ * When the event happened, in epoch milliseconds, for an event native
203
+ * code recorded before this runtime started (a native
204
+ * `HotUpdaterInstance`). Absent when the event happens now.
205
+ */
206
+ readonly occurredAt?: number;
201
207
  } | {
202
208
  /** The check found a Release to install, adopt, or roll back to. */
203
209
  readonly status: "UPDATE_AVAILABLE";
@@ -210,6 +216,12 @@ type UpdateCheckResult = {
210
216
  readonly updateStatus: "UPDATE" | "ROLLBACK";
211
217
  readonly shouldForceUpdate: boolean;
212
218
  readonly updateStrategy: UpdateStrategy;
219
+ /**
220
+ * When the event happened, in epoch milliseconds, for an event native
221
+ * code recorded before this runtime started (a native
222
+ * `HotUpdaterInstance`). Absent when the event happens now.
223
+ */
224
+ readonly occurredAt?: number;
213
225
  };
214
226
  /** A bundle the SDK downloaded, verified, and staged for the next launch. */
215
227
  interface BundleDownloadedInfo {
@@ -227,6 +239,12 @@ interface BundleDownloadedInfo {
227
239
  readonly delivery: "patch" | "manifest" | "archive";
228
240
  /** A patch was tried, but the file or the archive was downloaded instead. */
229
241
  readonly patchFallback: boolean;
242
+ /**
243
+ * When the event happened, in epoch milliseconds, for an event native code
244
+ * recorded before this runtime started (a native `HotUpdaterInstance`).
245
+ * Absent when the event happens now.
246
+ */
247
+ readonly occurredAt?: number;
230
248
  }
231
249
  /**
232
250
  * Where an update failed: `check` covers the Release catalog request,
@@ -266,16 +284,34 @@ interface UpdateError {
266
284
  readonly updateStrategy: UpdateStrategy;
267
285
  /** The error the SDK caught. */
268
286
  readonly cause: unknown;
287
+ /**
288
+ * When the event happened, in epoch milliseconds, for an event native code
289
+ * recorded before this runtime started (a native `HotUpdaterInstance`).
290
+ * Absent when the event happens now.
291
+ */
292
+ readonly occurredAt?: number;
269
293
  }
270
294
  /** A response from the update server's catalog or artifact API. */
271
295
  interface UpdateHttpResponse {
272
296
  readonly resource: "catalog" | "artifact";
297
+ /**
298
+ * The channel the request checked, for a response native code received before
299
+ * this runtime started (a native `HotUpdaterInstance`). Absent when the
300
+ * response belongs to the current channel.
301
+ */
302
+ readonly channel?: string;
273
303
  /** Request path only; authentication headers and query parameters are omitted. */
274
304
  readonly path: string;
275
305
  readonly status: number;
276
306
  /** The response as text, or null if the body could not be read. */
277
307
  readonly body: string | null;
278
308
  readonly bodyTruncated: boolean;
309
+ /**
310
+ * When the response arrived, in epoch milliseconds, for a response native
311
+ * code received before this runtime started (a native `HotUpdaterInstance`).
312
+ * Absent when it arrives now.
313
+ */
314
+ readonly occurredAt?: number;
279
315
  }
280
316
  /**
281
317
  * Lifecycle hooks a plugin returns from `setup` as `hooks`. Hooks observe:
package/dist/index.d.mts CHANGED
@@ -198,6 +198,12 @@ type UpdateCheckResult = {
198
198
  readonly releaseId: string | null;
199
199
  /** The Release before the check; it differs after an adoption. */
200
200
  readonly previousReleaseId: string | null;
201
+ /**
202
+ * When the event happened, in epoch milliseconds, for an event native
203
+ * code recorded before this runtime started (a native
204
+ * `HotUpdaterInstance`). Absent when the event happens now.
205
+ */
206
+ readonly occurredAt?: number;
201
207
  } | {
202
208
  /** The check found a Release to install, adopt, or roll back to. */
203
209
  readonly status: "UPDATE_AVAILABLE";
@@ -210,6 +216,12 @@ type UpdateCheckResult = {
210
216
  readonly updateStatus: "UPDATE" | "ROLLBACK";
211
217
  readonly shouldForceUpdate: boolean;
212
218
  readonly updateStrategy: UpdateStrategy;
219
+ /**
220
+ * When the event happened, in epoch milliseconds, for an event native
221
+ * code recorded before this runtime started (a native
222
+ * `HotUpdaterInstance`). Absent when the event happens now.
223
+ */
224
+ readonly occurredAt?: number;
213
225
  };
214
226
  /** A bundle the SDK downloaded, verified, and staged for the next launch. */
215
227
  interface BundleDownloadedInfo {
@@ -227,6 +239,12 @@ interface BundleDownloadedInfo {
227
239
  readonly delivery: "patch" | "manifest" | "archive";
228
240
  /** A patch was tried, but the file or the archive was downloaded instead. */
229
241
  readonly patchFallback: boolean;
242
+ /**
243
+ * When the event happened, in epoch milliseconds, for an event native code
244
+ * recorded before this runtime started (a native `HotUpdaterInstance`).
245
+ * Absent when the event happens now.
246
+ */
247
+ readonly occurredAt?: number;
230
248
  }
231
249
  /**
232
250
  * Where an update failed: `check` covers the Release catalog request,
@@ -266,16 +284,34 @@ interface UpdateError {
266
284
  readonly updateStrategy: UpdateStrategy;
267
285
  /** The error the SDK caught. */
268
286
  readonly cause: unknown;
287
+ /**
288
+ * When the event happened, in epoch milliseconds, for an event native code
289
+ * recorded before this runtime started (a native `HotUpdaterInstance`).
290
+ * Absent when the event happens now.
291
+ */
292
+ readonly occurredAt?: number;
269
293
  }
270
294
  /** A response from the update server's catalog or artifact API. */
271
295
  interface UpdateHttpResponse {
272
296
  readonly resource: "catalog" | "artifact";
297
+ /**
298
+ * The channel the request checked, for a response native code received before
299
+ * this runtime started (a native `HotUpdaterInstance`). Absent when the
300
+ * response belongs to the current channel.
301
+ */
302
+ readonly channel?: string;
273
303
  /** Request path only; authentication headers and query parameters are omitted. */
274
304
  readonly path: string;
275
305
  readonly status: number;
276
306
  /** The response as text, or null if the body could not be read. */
277
307
  readonly body: string | null;
278
308
  readonly bodyTruncated: boolean;
309
+ /**
310
+ * When the response arrived, in epoch milliseconds, for a response native
311
+ * code received before this runtime started (a native `HotUpdaterInstance`).
312
+ * Absent when it arrives now.
313
+ */
314
+ readonly occurredAt?: number;
279
315
  }
280
316
  /**
281
317
  * Lifecycle hooks a plugin returns from `setup` as `hooks`. Hooks observe:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/protocol",
3
- "version": "1.0.8",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "The data formats and pure computations that Hot Updater's app and server share",
6
6
  "sideEffects": false,