@hot-updater/cloudflare 1.2.0-rc.24 → 1.2.0-rc.26

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "1.2.0-rc.24",
4
+ "version": "1.2.0-rc.26",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -52,11 +52,11 @@
52
52
  "cloudflare": "4.2.0",
53
53
  "hono": "4.12.34",
54
54
  "uuidv7": "^1.0.2",
55
- "@hot-updater/cli-tools": "1.2.0-rc.24",
56
- "@hot-updater/plugin-core": "1.2.0-rc.24",
57
- "@hot-updater/storage-s3": "1.2.0-rc.24",
58
- "@hot-updater/server": "1.2.0-rc.24",
59
- "@hot-updater/protocol": "1.2.0-rc.24"
55
+ "@hot-updater/cli-tools": "1.2.0-rc.26",
56
+ "@hot-updater/plugin-core": "1.2.0-rc.26",
57
+ "@hot-updater/protocol": "1.2.0-rc.26",
58
+ "@hot-updater/storage-s3": "1.2.0-rc.26",
59
+ "@hot-updater/server": "1.2.0-rc.26"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@aws-sdk/client-s3": "3.1066.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.2.0-rc.24"
78
+ "@hot-updater/test-utils": "1.2.0-rc.26"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsdown && pnpm build:worker",
package/sql/bundles.sql CHANGED
@@ -36,7 +36,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS "channels_name" ON "channels" ("name");
36
36
 
37
37
  CREATE TABLE IF NOT EXISTS "bundle_totals" ("platform_key" TEXT NOT NULL, "_shard" INTEGER NOT NULL, "bundles" INTEGER NOT NULL, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("platform_key", "_shard"));
38
38
 
39
- CREATE TABLE IF NOT EXISTS "native_builds" ("id" TEXT NOT NULL, "scope_key" TEXT NOT NULL, "platform" TEXT NOT NULL, "channel_id" TEXT NOT NULL, "fingerprint_hash" TEXT, "app_version" TEXT, "min_bundle_id" TEXT NOT NULL, "artifact_kind" TEXT NOT NULL, "artifact_storage_uri" TEXT NOT NULL, "byte_size" INTEGER NOT NULL, "git_commit_hash" TEXT, "created_at_ms" INTEGER NOT NULL, "build_key" TEXT, "build_number" TEXT, "submitted_to" TEXT, "submitted_at_ms" INTEGER, "submitted_version" TEXT, "is_store_build" INTEGER NOT NULL, "is_sandbox" INTEGER NOT NULL, "store_build_scope_key" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
39
+ CREATE TABLE IF NOT EXISTS "native_builds" ("id" TEXT NOT NULL, "scope_key" TEXT NOT NULL, "platform" TEXT NOT NULL, "channel_id" TEXT NOT NULL, "fingerprint_hash" TEXT, "app_version" TEXT, "min_bundle_id" TEXT NOT NULL, "artifact_kind" TEXT NOT NULL, "artifact_storage_uri" TEXT NOT NULL, "byte_size" INTEGER NOT NULL, "git_commit_hash" TEXT, "created_at_ms" INTEGER NOT NULL, "build_key" TEXT, "build_number" TEXT, "submitted_to" TEXT, "submitted_at_ms" INTEGER, "submitted_version" TEXT, "is_store_build" INTEGER NOT NULL, "is_sandbox" INTEGER NOT NULL, "sandbox_url_scheme" TEXT, "store_build_scope_key" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
40
40
 
41
41
  CREATE INDEX IF NOT EXISTS "native_builds_byScope" ON "native_builds" ("scope_key", "id");
42
42
 
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2026-11-05T15:51:59.455Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2026-11-10T06:31:48.689Z.
@@ -2602,7 +2602,13 @@ var nativeBuilds = defineTable({
2602
2602
  required: false
2603
2603
  },
2604
2604
  is_store_build: { type: "boolean" },
2605
- is_sandbox: { type: "boolean" }
2605
+ is_sandbox: { type: "boolean" },
2606
+ sandbox_url_scheme: {
2607
+ type: "string",
2608
+ maxLength: 255,
2609
+ ascii: true,
2610
+ required: false
2611
+ }
2606
2612
  }, {
2607
2613
  key: ["id"],
2608
2614
  derived: {
@@ -4569,7 +4575,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
4569
4575
  }, "createSqlAdapter");
4570
4576
 
4571
4577
  // ../../packages/server/dist/package.mjs
4572
- var version = "1.2.0-rc.24";
4578
+ var version = "1.2.0-rc.26";
4573
4579
 
4574
4580
  // ../../packages/server/dist/version.mjs
4575
4581
  var HOT_UPDATER_SERVER_VERSION = version;
@@ -5624,6 +5630,17 @@ var createCoreReads = /* @__PURE__ */ __name((db, storage) => {
5624
5630
  };
5625
5631
  }, "createCoreReads");
5626
5632
 
5633
+ // ../../packages/server/dist/core/nativeBuildDestinations.mjs
5634
+ var NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
5635
+ android: [
5636
+ "play-internal",
5637
+ "play-closed",
5638
+ "play-open",
5639
+ "play-production"
5640
+ ],
5641
+ ios: ["testflight"]
5642
+ };
5643
+
5627
5644
  // ../../packages/server/dist/core/writes.mjs
5628
5645
  var PAGE2 = 500;
5629
5646
  var countBundle = /* @__PURE__ */ __name((tx, platform, delta) => {
@@ -5721,6 +5738,8 @@ var ARTIFACT_KINDS = {
5721
5738
  var SCOPE_KEY_MAX_LENGTH = 2048;
5722
5739
  var GIT_COMMIT_HASH_MAX_LENGTH = 255;
5723
5740
  var BUILD_KEY = /^nbk1:[0-9a-f]{64}$/;
5741
+ var SANDBOX_URL_SCHEME_MAX_LENGTH = 255;
5742
+ var URL_SCHEME = new RegExp(`^[a-z][a-z0-9+.-]{0,254}$`);
5724
5743
  var NativeBuildInputError = class extends TypeError {
5725
5744
  static {
5726
5745
  __name(this, "NativeBuildInputError");
@@ -5746,15 +5765,12 @@ var pick2 = /* @__PURE__ */ __name((row) => ({
5746
5765
  submitted_at_ms: row.submitted_at_ms ?? null,
5747
5766
  submitted_version: row.submitted_version ?? null,
5748
5767
  is_store_build: row.is_store_build === true,
5749
- is_sandbox: row.is_sandbox === true
5768
+ is_sandbox: row.is_sandbox === true,
5769
+ sandbox_url_scheme: row.sandbox_url_scheme ?? null
5750
5770
  }), "pick");
5751
5771
  var SANDBOX_CHANNEL_PREFIX = "sandbox-";
5752
5772
  var OLDER_BUILDS_PAGE = 20;
5753
5773
  var MARK_ATTEMPTS = 8;
5754
- var SUBMISSION_DESTINATIONS = {
5755
- android: "play-internal",
5756
- ios: "testflight"
5757
- };
5758
5774
  var BUILD_NUMBER_MAX_LENGTH = 64;
5759
5775
  var SUBMITTED_VERSION_MAX_LENGTH = 255;
5760
5776
  var nativeBuildScopeKey = /* @__PURE__ */ __name((scope) => {
@@ -5778,7 +5794,7 @@ var nativeBuildScopeKey = /* @__PURE__ */ __name((scope) => {
5778
5794
  return scopeKey;
5779
5795
  }, "nativeBuildScopeKey");
5780
5796
  var isBuiltInBundle = /* @__PURE__ */ __name(async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null, "isBuiltInBundle");
5781
- var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
5797
+ var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, artifact }) => {
5782
5798
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
5783
5799
  if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
5784
5800
  if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
@@ -5787,6 +5803,10 @@ var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fi
5787
5803
  const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
5788
5804
  if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
5789
5805
  if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
5806
+ if (sandboxUrlScheme !== void 0 && sandboxUrlScheme !== null) {
5807
+ if (isSandbox !== true) return "sandboxUrlScheme is a sandbox build's, and this isn't one";
5808
+ if (typeof sandboxUrlScheme !== "string" || !URL_SCHEME.test(sandboxUrlScheme)) return `sandboxUrlScheme must be a URL scheme in lower case, up to ${SANDBOX_URL_SCHEME_MAX_LENGTH} characters, or null`;
5809
+ }
5790
5810
  if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
5791
5811
  if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
5792
5812
  if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
@@ -5822,7 +5842,8 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
5822
5842
  submitted_at_ms: null,
5823
5843
  submitted_version: null,
5824
5844
  is_store_build: false,
5825
- is_sandbox: registration.isSandbox === true
5845
+ is_sandbox: registration.isSandbox === true,
5846
+ sandbox_url_scheme: registration.sandboxUrlScheme ?? null
5826
5847
  };
5827
5848
  for (let attempt = 1; ; attempt += 1) {
5828
5849
  await insertChannel(db, {
@@ -5903,7 +5924,8 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
5903
5924
  const row = await tx.findOne("native_builds", { id });
5904
5925
  if (row === null) return null;
5905
5926
  const build = pick2(row);
5906
- if (SUBMISSION_DESTINATIONS[build.platform] !== destination) throw new NativeBuildInputError(`Invalid native build submission: an ${build.platform} build is submitted to ${SUBMISSION_DESTINATIONS[build.platform]}, not ${destination}.`);
5927
+ if (!NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].includes(destination)) throw new NativeBuildInputError(`Invalid native build submission: an ${build.platform} build is submitted to ${NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].join(" or ")}, not ${destination}.`);
5928
+ if (build.is_sandbox && destination !== "testflight" && destination !== "play-internal") throw new NativeBuildInputError("A sandbox build can submit only to TestFlight or Play internal testing.");
5907
5929
  const set = {
5908
5930
  submitted_to: destination,
5909
5931
  submitted_at_ms: now(),
@@ -6865,7 +6887,7 @@ var refusingInvalid = /* @__PURE__ */ __name(async (operation) => {
6865
6887
  throw error;
6866
6888
  }
6867
6889
  }, "refusingInvalid");
6868
- var isNativeBuildRegistration = /* @__PURE__ */ __name((value) => isRecord3(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && (value.isSandbox === void 0 || typeof value.isSandbox === "boolean") && isRecord3(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord3(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord3(value.embeddedBundle.metadata)), "isNativeBuildRegistration");
6890
+ var isNativeBuildRegistration = /* @__PURE__ */ __name((value) => isRecord3(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && (value.isSandbox === void 0 || typeof value.isSandbox === "boolean") && (value.sandboxUrlScheme === void 0 || isTextOrNull(value.sandboxUrlScheme)) && isRecord3(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord3(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord3(value.embeddedBundle.metadata)), "isNativeBuildRegistration");
6869
6891
  var scopeKeyOf = /* @__PURE__ */ __name((params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "", "scopeKeyOf");
6870
6892
  var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
6871
6893
  listBundles: onCore(async (core, request) => {
@@ -7013,7 +7035,7 @@ var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
7013
7035
  }),
7014
7036
  recordNativeBuildSubmission: onCore(async (core, request, params) => {
7015
7037
  const input = await body(request);
7016
- if (!isRecord3(input) || input.destination !== "testflight" && input.destination !== "play-internal" || !isText(input.version)) throw new HandlerBadRequestError("A native build submission needs destination (testflight or play-internal) and version.");
7038
+ if (!isRecord3(input) || !Object.values(NATIVE_BUILD_SUBMISSION_DESTINATIONS).flat().includes(input.destination) || !isText(input.version)) throw new HandlerBadRequestError("A native build submission needs a valid store destination and version.");
7017
7039
  const submission = {
7018
7040
  destination: input.destination,
7019
7041
  version: input.version