@hot-updater/cloudflare 1.0.0-rc.28 → 1.0.0-rc.29

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
@@ -1,5 +1,6 @@
1
1
  import { DatabaseJsonObject, Platform, StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
2
2
  import { S3ClientConfig } from "@aws-sdk/client-s3";
3
+ import "@hot-updater/protocol";
3
4
  //#region src/d1Executor.d.ts
4
5
  declare class D1ExecutionError extends Error {
5
6
  readonly name = "D1ExecutionError";
@@ -56,6 +57,14 @@ type BundleEventFailure = DatabaseJsonObject & {
56
57
  /** Android's `ApplicationExitInfo` reason for the process before this one. */
57
58
  readonly previous_process_exit?: string;
58
59
  };
60
+ type DatabaseHttpResponse = DatabaseJsonObject & {
61
+ readonly resource: "catalog" | "artifact";
62
+ readonly path: string;
63
+ readonly status: number;
64
+ readonly body: string | null;
65
+ readonly body_truncated: boolean;
66
+ readonly received_at_ms: number;
67
+ };
59
68
  /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
60
69
  type DatabaseBundleEventMetadata = DatabaseJsonObject & {
61
70
  readonly cohort: string;
@@ -64,6 +73,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
64
73
  readonly sdk_version: string | null;
65
74
  /** `UPDATE_FAILED`: what failed. */
66
75
  readonly failure?: BundleEventFailure;
76
+ readonly http_response?: DatabaseHttpResponse;
67
77
  /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
68
78
  readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
69
79
  /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DatabaseJsonObject, Platform, StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
2
2
  import { S3ClientConfig } from "@aws-sdk/client-s3";
3
+ import "@hot-updater/protocol";
3
4
  //#region src/d1Executor.d.ts
4
5
  declare class D1ExecutionError extends Error {
5
6
  readonly name = "D1ExecutionError";
@@ -56,6 +57,14 @@ type BundleEventFailure = DatabaseJsonObject & {
56
57
  /** Android's `ApplicationExitInfo` reason for the process before this one. */
57
58
  readonly previous_process_exit?: string;
58
59
  };
60
+ type DatabaseHttpResponse = DatabaseJsonObject & {
61
+ readonly resource: "catalog" | "artifact";
62
+ readonly path: string;
63
+ readonly status: number;
64
+ readonly body: string | null;
65
+ readonly body_truncated: boolean;
66
+ readonly received_at_ms: number;
67
+ };
59
68
  /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
60
69
  type DatabaseBundleEventMetadata = DatabaseJsonObject & {
61
70
  readonly cohort: string;
@@ -64,6 +73,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
64
73
  readonly sdk_version: string | null;
65
74
  /** `UPDATE_FAILED`: what failed. */
66
75
  readonly failure?: BundleEventFailure;
76
+ readonly http_response?: DatabaseHttpResponse;
67
77
  /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
68
78
  readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
69
79
  /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
@@ -1,4 +1,5 @@
1
1
  import { DatabaseJsonObject, EngineDatabase, Platform, StorageAdapterWith } from "@hot-updater/plugin-core";
2
+ import "@hot-updater/protocol";
2
3
  //#region src/d1Executor.d.ts
3
4
  /** A D1 result, from the binding or the REST API. */
4
5
  interface D1ResultLike {
@@ -44,6 +45,14 @@ type BundleEventFailure = DatabaseJsonObject & {
44
45
  /** Android's `ApplicationExitInfo` reason for the process before this one. */
45
46
  readonly previous_process_exit?: string;
46
47
  };
48
+ type DatabaseHttpResponse = DatabaseJsonObject & {
49
+ readonly resource: "catalog" | "artifact";
50
+ readonly path: string;
51
+ readonly status: number;
52
+ readonly body: string | null;
53
+ readonly body_truncated: boolean;
54
+ readonly received_at_ms: number;
55
+ };
47
56
  /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
48
57
  type DatabaseBundleEventMetadata = DatabaseJsonObject & {
49
58
  readonly cohort: string;
@@ -52,6 +61,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
52
61
  readonly sdk_version: string | null;
53
62
  /** `UPDATE_FAILED`: what failed. */
54
63
  readonly failure?: BundleEventFailure;
64
+ readonly http_response?: DatabaseHttpResponse;
55
65
  /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
56
66
  readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
57
67
  /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
@@ -1,4 +1,5 @@
1
1
  import { DatabaseJsonObject, EngineDatabase, Platform, StorageAdapterWith } from "@hot-updater/plugin-core";
2
+ import "@hot-updater/protocol";
2
3
  //#region src/d1Executor.d.ts
3
4
  /** A D1 result, from the binding or the REST API. */
4
5
  interface D1ResultLike {
@@ -44,6 +45,14 @@ type BundleEventFailure = DatabaseJsonObject & {
44
45
  /** Android's `ApplicationExitInfo` reason for the process before this one. */
45
46
  readonly previous_process_exit?: string;
46
47
  };
48
+ type DatabaseHttpResponse = DatabaseJsonObject & {
49
+ readonly resource: "catalog" | "artifact";
50
+ readonly path: string;
51
+ readonly status: number;
52
+ readonly body: string | null;
53
+ readonly body_truncated: boolean;
54
+ readonly received_at_ms: number;
55
+ };
47
56
  /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
48
57
  type DatabaseBundleEventMetadata = DatabaseJsonObject & {
49
58
  readonly cohort: string;
@@ -52,6 +61,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
52
61
  readonly sdk_version: string | null;
53
62
  /** `UPDATE_FAILED`: what failed. */
54
63
  readonly failure?: BundleEventFailure;
64
+ readonly http_response?: DatabaseHttpResponse;
55
65
  /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
56
66
  readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
57
67
  /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.28",
4
+ "version": "1.0.0-rc.29",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -56,10 +56,10 @@
56
56
  "cloudflare": "4.2.0",
57
57
  "hono": "4.12.34",
58
58
  "uuidv7": "^1.0.2",
59
- "@hot-updater/cli-tools": "1.0.0-rc.28",
60
- "@hot-updater/protocol": "1.0.0-rc.27",
61
- "@hot-updater/plugin-core": "1.0.0-rc.27",
62
- "@hot-updater/server": "1.0.0-rc.28"
59
+ "@hot-updater/cli-tools": "1.0.0-rc.29",
60
+ "@hot-updater/protocol": "1.0.0-rc.28",
61
+ "@hot-updater/server": "1.0.0-rc.29",
62
+ "@hot-updater/plugin-core": "1.0.0-rc.28"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@cloudflare/vitest-pool-workers": "0.13.0",
@@ -75,7 +75,7 @@
75
75
  "vitest": "4.1.4",
76
76
  "wrangler": "^4.69.0",
77
77
  "xdg-app-paths": "^8.3.0",
78
- "@hot-updater/test-utils": "1.0.0-rc.27"
78
+ "@hot-updater/test-utils": "1.0.0-rc.28"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsdown && pnpm build:worker",
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2026-10-03T06:35:04.811Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2026-10-03T08:14:41.223Z.
@@ -4511,7 +4511,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
4511
4511
  }, "createSqlAdapter");
4512
4512
 
4513
4513
  // ../../packages/server/dist/package.mjs
4514
- var version = "1.0.0-rc.28";
4514
+ var version = "1.0.0-rc.29";
4515
4515
 
4516
4516
  // ../../packages/server/dist/version.mjs
4517
4517
  var HOT_UPDATER_SERVER_VERSION = version;
@@ -9555,8 +9555,9 @@ var apiKeys = /* @__PURE__ */ __name((options = {}) => {
9555
9555
  // ../insights/dist/server/eventRow.mjs
9556
9556
  var isOptional = /* @__PURE__ */ __name((value, key, valid) => !Object.hasOwn(value, key) || valid(value[key]), "isOptional");
9557
9557
  var isString = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
9558
+ var isDatabaseHttpResponse = /* @__PURE__ */ __name((value) => isDatabaseJsonObject(value) && (value.resource === "catalog" || value.resource === "artifact") && isString(value.path) && Number.isSafeInteger(value.status) && (value.body === null || isString(value.body)) && typeof value.body_truncated === "boolean" && Number.isSafeInteger(value.received_at_ms), "isDatabaseHttpResponse");
9558
9559
  var isDatabaseBundleEventFailure = /* @__PURE__ */ __name((value) => isDatabaseJsonObject(value) && isString(value.stage) && isString(value.reason) && isOptional(value, "resource", isString) && isOptional(value, "http_status", (status) => Number.isSafeInteger(status)) && isOptional(value, "transport", isString) && isOptional(value, "origin_code", isString) && isOptional(value, "error_message", isString) && isOptional(value, "error_stack", isString) && isOptional(value, "previous_process_exit", isString), "isDatabaseBundleEventFailure");
9559
- var isDatabaseBundleEventMetadata = /* @__PURE__ */ __name((value) => isDatabaseJsonObject(value) && typeof value.cohort === "string" && (value.update_strategy === null || value.update_strategy === "fingerprint" || value.update_strategy === "appVersion") && (value.fingerprint_hash === null || typeof value.fingerprint_hash === "string") && (value.sdk_version === null || typeof value.sdk_version === "string") && isOptional(value, "failure", isDatabaseBundleEventFailure) && isOptional(value, "delivery", isString) && isOptional(value, "patch_fallback", (flag) => typeof flag === "boolean") && isOptional(value, "previous_process_exit", isString), "isDatabaseBundleEventMetadata");
9560
+ var isDatabaseBundleEventMetadata = /* @__PURE__ */ __name((value) => isDatabaseJsonObject(value) && typeof value.cohort === "string" && (value.update_strategy === null || value.update_strategy === "fingerprint" || value.update_strategy === "appVersion") && (value.fingerprint_hash === null || typeof value.fingerprint_hash === "string") && (value.sdk_version === null || typeof value.sdk_version === "string") && isOptional(value, "failure", isDatabaseBundleEventFailure) && isOptional(value, "http_response", isDatabaseHttpResponse) && isOptional(value, "delivery", isString) && isOptional(value, "patch_fallback", (flag) => typeof flag === "boolean") && isOptional(value, "previous_process_exit", isString), "isDatabaseBundleEventMetadata");
9560
9561
  var isRecord5 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
9561
9562
  var isIdentity = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value.length <= 255, "isIdentity");
9562
9563
  var isTextOrNull2 = /* @__PURE__ */ __name((value) => value === null || typeof value === "string", "isTextOrNull");
@@ -9892,6 +9893,18 @@ function readFailure(value) {
9892
9893
  };
9893
9894
  }
9894
9895
  __name(readFailure, "readFailure");
9896
+ function readHttpResponse(value) {
9897
+ if (!isRecord6(value) || value.resource !== "catalog" && value.resource !== "artifact" || typeof value.path !== "string" || value.path.length > 1024 || !Number.isSafeInteger(value.status) || value.status < 100 || value.status > 599 || value.body !== null && (typeof value.body !== "string" || new TextEncoder().encode(JSON.stringify(value.body)).byteLength > 4096) || typeof value.bodyTruncated !== "boolean" || !Number.isSafeInteger(value.receivedAtMs) || value.receivedAtMs < 0) throw new InsightsBadRequestError("Invalid HTTP response details");
9898
+ return {
9899
+ resource: value.resource,
9900
+ path: value.path,
9901
+ status: value.status,
9902
+ body: value.body,
9903
+ bodyTruncated: value.bodyTruncated,
9904
+ receivedAtMs: value.receivedAtMs
9905
+ };
9906
+ }
9907
+ __name(readHttpResponse, "readHttpResponse");
9895
9908
  async function readBoundedText(request) {
9896
9909
  const contentLength = request.headers.get("content-length");
9897
9910
  const declaredByteLength = Number(contentLength);
@@ -9929,7 +9942,10 @@ function requireEvent(payload) {
9929
9942
  const platform = requireStringField(payload, "platform");
9930
9943
  if (platform !== "ios" && platform !== "android") throw new InsightsBadRequestError("Invalid event field: platform");
9931
9944
  const eventId = readEventId(payload);
9945
+ const metadata = readMetadata(payload);
9946
+ const httpMetadata = metadata.httpResponse === void 0 ? {} : { httpResponse: readHttpResponse(metadata.httpResponse) };
9932
9947
  const base = {
9948
+ ...metadata.httpResponse === void 0 ? {} : { metadata: httpMetadata },
9933
9949
  ...eventId === void 0 ? {} : { eventId },
9934
9950
  installId: requireIdentityField(payload, "installId"),
9935
9951
  toBundleId: requireStringField(payload, "toBundleId"),
@@ -9953,11 +9969,11 @@ function requireEvent(payload) {
9953
9969
  updateStrategy
9954
9970
  };
9955
9971
  }, "movement");
9956
- const metadata = readMetadata(payload);
9957
9972
  switch (type) {
9958
9973
  case "UPDATE_DOWNLOADED": {
9959
9974
  const delivery = metadata.delivery;
9960
9975
  const read = {
9976
+ ...httpMetadata,
9961
9977
  ...delivery == null ? {} : { delivery: oneOf(DELIVERIES, delivery) },
9962
9978
  ...metadata.patchFallback === true ? { patchFallback: true } : {}
9963
9979
  };
@@ -9977,14 +9993,20 @@ function requireEvent(payload) {
9977
9993
  return {
9978
9994
  ...movement(),
9979
9995
  type,
9980
- ...previousProcessExit === void 0 ? {} : { metadata: { previousProcessExit } }
9996
+ ...previousProcessExit === void 0 ? {} : { metadata: {
9997
+ ...httpMetadata,
9998
+ previousProcessExit
9999
+ } }
9981
10000
  };
9982
10001
  }
9983
10002
  case "UPDATE_FAILED":
9984
10003
  return {
9985
10004
  ...movement(),
9986
10005
  type,
9987
- metadata: { failure: readFailure(metadata.failure) }
10006
+ metadata: {
10007
+ ...httpMetadata,
10008
+ failure: readFailure(metadata.failure)
10009
+ }
9988
10010
  };
9989
10011
  case "UNCHANGED":
9990
10012
  if (payload.fromBundleId !== null || payload.updateStrategy !== null) throw new InsightsBadRequestError("Invalid unchanged event shape");
@@ -10017,7 +10039,16 @@ function createBundleEventRow(input) {
10017
10039
  to_release_id: input.toReleaseId,
10018
10040
  user_id: input.userId ?? null
10019
10041
  };
10042
+ const response = input.metadata?.httpResponse;
10020
10043
  const metadata = {
10044
+ ...response ? { http_response: {
10045
+ resource: response.resource,
10046
+ path: response.path,
10047
+ status: response.status,
10048
+ body: response.body,
10049
+ body_truncated: response.bodyTruncated,
10050
+ received_at_ms: response.receivedAtMs
10051
+ } } : {},
10021
10052
  cohort: input.cohort,
10022
10053
  fingerprint_hash: input.fingerprintHash,
10023
10054
  sdk_version: input.sdkVersion ?? null,
@@ -10243,6 +10274,14 @@ var toFailure = /* @__PURE__ */ __name((failure) => ({
10243
10274
  ...failure.previous_process_exit === void 0 ? {} : { previousProcessExit: failure.previous_process_exit }
10244
10275
  }), "toFailure");
10245
10276
  var eventDetails = /* @__PURE__ */ __name(({ type, metadata }) => ({
10277
+ ...metadata.http_response !== void 0 ? { httpResponse: {
10278
+ resource: metadata.http_response.resource,
10279
+ path: metadata.http_response.path,
10280
+ status: metadata.http_response.status,
10281
+ body: metadata.http_response.body,
10282
+ bodyTruncated: metadata.http_response.body_truncated,
10283
+ receivedAtMs: metadata.http_response.received_at_ms
10284
+ } } : {},
10246
10285
  ...type === "UPDATE_FAILED" && metadata.failure !== void 0 ? { failure: toFailure(metadata.failure) } : {},
10247
10286
  ...type === "UPDATE_DOWNLOADED" && metadata.delivery !== void 0 ? { delivery: metadata.delivery } : {},
10248
10287
  ...type === "UPDATE_DOWNLOADED" && metadata.patch_fallback === true ? { patchFallback: true } : {},
@@ -10265,6 +10304,7 @@ var toEventHistoryRow = /* @__PURE__ */ __name((row) => ({
10265
10304
  ...eventDetails(row)
10266
10305
  }), "toEventHistoryRow");
10267
10306
  var toInstallationRow = /* @__PURE__ */ __name((row) => ({
10307
+ ...eventDetails(row).httpResponse ? { httpResponse: eventDetails(row).httpResponse } : {},
10268
10308
  appVersion: row.app_version,
10269
10309
  channel: row.channel,
10270
10310
  cohort: row.metadata.cohort,