@hot-updater/cloudflare 1.2.0-rc.33 → 1.2.0-rc.35

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.33",
4
+ "version": "1.2.0-rc.35",
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.33",
56
- "@hot-updater/plugin-core": "1.2.0-rc.33",
57
- "@hot-updater/server": "1.2.0-rc.33",
58
- "@hot-updater/storage-s3": "1.2.0-rc.33",
59
- "@hot-updater/protocol": "1.2.0-rc.33"
55
+ "@hot-updater/cli-tools": "1.2.0-rc.35",
56
+ "@hot-updater/plugin-core": "1.2.0-rc.35",
57
+ "@hot-updater/storage-s3": "1.2.0-rc.35",
58
+ "@hot-updater/server": "1.2.0-rc.35",
59
+ "@hot-updater/protocol": "1.2.0-rc.35"
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.33"
78
+ "@hot-updater/test-utils": "1.2.0-rc.35"
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-11-12T07:36:29.449Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2026-11-12T14:15:19.044Z.
@@ -4672,7 +4672,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
4672
4672
  }, "createSqlAdapter");
4673
4673
 
4674
4674
  // ../../packages/server/dist/package.mjs
4675
- var version = "1.2.0-rc.33";
4675
+ var version = "1.2.0-rc.35";
4676
4676
 
4677
4677
  // ../../packages/server/dist/version.mjs
4678
4678
  var HOT_UPDATER_SERVER_VERSION = version;
@@ -6044,7 +6044,7 @@ var deleteBundle = /* @__PURE__ */ __name(async (tx, current) => {
6044
6044
  await tx.delete("bundles", current);
6045
6045
  countBundle(tx, current.platform, -1);
6046
6046
  }, "deleteBundle");
6047
- var replaceBundlePatches = /* @__PURE__ */ __name(async (tx, bundle, rows) => {
6047
+ var replaceBundlePatches = /* @__PURE__ */ __name(async (tx, bundle, rows, checkNew) => {
6048
6048
  const wanted = new Map(rows.map((row) => [row.id, row]));
6049
6049
  const count = bundle._refs_bundle_patches_bundle_id ?? 0;
6050
6050
  let cursor;
@@ -6069,6 +6069,7 @@ var replaceBundlePatches = /* @__PURE__ */ __name(async (tx, bundle, rows) => {
6069
6069
  if (page2.next === void 0) break;
6070
6070
  cursor = page2.next;
6071
6071
  }
6072
+ if (checkNew !== void 0) for (const row of wanted.values()) await checkNew(row);
6072
6073
  for (const row of wanted.values()) tx.create("bundle_patches", row);
6073
6074
  }, "replaceBundlePatches");
6074
6075
  var insertChannel = /* @__PURE__ */ __name(async (db, row) => {
@@ -6184,6 +6185,9 @@ var nativeBuildScopeKey = /* @__PURE__ */ __name((scope) => {
6184
6185
  if (scopeKey.length > SCOPE_KEY_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build scope: its key is longer than ${SCOPE_KEY_MAX_LENGTH} characters; shorten the channel or app version.`);
6185
6186
  return scopeKey;
6186
6187
  }, "nativeBuildScopeKey");
6188
+ var refuseSandboxPatchBase = /* @__PURE__ */ __name(async (db, baseBundleId) => {
6189
+ if ((await db.findOne("native_builds", { min_bundle_id: baseBundleId }))?.is_sandbox === true) throw new NativeBuildInputError("A sandbox build's built-in bundle is no patch base.");
6190
+ }, "refuseSandboxPatchBase");
6187
6191
  var isBuiltInBundle = /* @__PURE__ */ __name(async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null, "isBuiltInBundle");
6188
6192
  var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, exportMethod, nativeAppVersion, artifact }) => {
6189
6193
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
@@ -6302,10 +6306,11 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
6302
6306
  ...page2
6303
6307
  });
6304
6308
  }, "read");
6309
+ const bundleId = options?.builtInOlderThan;
6310
+ if (bundleId !== void 0 && scope.channel.startsWith(SANDBOX_CHANNEL_PREFIX)) return null;
6305
6311
  const { rows } = await read(1);
6306
6312
  const newest = rows[0];
6307
6313
  if (newest === void 0) return null;
6308
- const bundleId = options?.builtInOlderThan;
6309
6314
  if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick3(newest);
6310
6315
  for (let before = newest.id; ; ) {
6311
6316
  const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
@@ -6698,7 +6703,11 @@ var createCoreOperations = /* @__PURE__ */ __name((db, { now = Date.now } = {})
6698
6703
  for (const { release } of deployments) if (!channels2.has(release.channel)) channels2.set(release.channel, await ensureChannel(release.channel));
6699
6704
  const platforms = /* @__PURE__ */ new Map();
6700
6705
  for (const deployment of deployments) {
6701
- if (!("bundleId" in deployment) || platforms.has(deployment.bundleId)) continue;
6706
+ if (!("bundleId" in deployment)) {
6707
+ for (const { baseBundleId } of deployment.bundle.patches ?? []) await refuseSandboxPatchBase(db, baseBundleId);
6708
+ continue;
6709
+ }
6710
+ if (platforms.has(deployment.bundleId)) continue;
6702
6711
  const row = await db.findOne("bundles", { id: deployment.bundleId });
6703
6712
  if (row === null) throw new DatabaseBundleNotFoundError(deployment.bundleId);
6704
6713
  if (await isBuiltInBundle(db, deployment.bundleId)) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", `Bundle "${deployment.bundleId}" is a native build's built-in bundle, which no release publishes.`);
@@ -6902,7 +6911,7 @@ var createCoreOperations = /* @__PURE__ */ __name((db, { now = Date.now } = {})
6902
6911
  if (patches !== void 0) await replaceBundlePatches(tx, current, bundleToPatchRows({
6903
6912
  ...next,
6904
6913
  patches
6905
- }));
6914
+ }), (row) => refuseSandboxPatchBase(tx, row.base_bundle_id));
6906
6915
  }), "updateBundle"),
6907
6916
  deleteBundles: /* @__PURE__ */ __name(async (ids) => {
6908
6917
  try {
@@ -7369,7 +7378,8 @@ var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
7369
7378
  rebuildReleaseCatalog: onCore(async (core, _request, params) => json({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
7370
7379
  updateBundle: onCore(async (core, request, params) => {
7371
7380
  const bundleId = requireRouteParam(params, "id");
7372
- await core.updateBundle(bundleId, bundleUpdateOf(await request.json(), bundleId));
7381
+ const update = bundleUpdateOf(await request.json(), bundleId);
7382
+ await refusingInvalid(() => core.updateBundle(bundleId, update));
7373
7383
  return noContent();
7374
7384
  }),
7375
7385
  countBundles: onCore(async (core, request) => json({ data: await core.countBundles(platformOf(new URL(request.url))) })),
@@ -7393,7 +7403,7 @@ var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
7393
7403
  deployReleases: onCore(async (core, request) => {
7394
7404
  const { deployments } = await body(request);
7395
7405
  if (!Array.isArray(deployments) || deployments.length === 0 || !deployments.every(isDeployment)) throw new HandlerBadRequestError("Deploy needs deployments, each a bundle and its release policy.");
7396
- return json({ data: await core.deploy(deployments) }, 201);
7406
+ return json({ data: await refusingInvalid(() => core.deploy(deployments)) }, 201);
7397
7407
  }),
7398
7408
  promoteRelease: onCore(async (core, request, params) => {
7399
7409
  const input = await body(request);