@hot-updater/vercel 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.
@@ -17735,7 +17735,7 @@ const postgres = (config) => {
17735
17735
  };
17736
17736
  //#endregion
17737
17737
  //#region ../../packages/server/dist/version.mjs
17738
- const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.33";
17738
+ const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.35";
17739
17739
  //#endregion
17740
17740
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
17741
17741
  const createVersionRouteHandlers = (plugins = []) => {
@@ -19040,7 +19040,7 @@ const deleteBundle = async (tx, current) => {
19040
19040
  await tx.delete("bundles", current);
19041
19041
  countBundle(tx, current.platform, -1);
19042
19042
  };
19043
- const replaceBundlePatches = async (tx, bundle, rows) => {
19043
+ const replaceBundlePatches = async (tx, bundle, rows, checkNew) => {
19044
19044
  const wanted = new Map(rows.map((row) => [row.id, row]));
19045
19045
  const count = bundle._refs_bundle_patches_bundle_id ?? 0;
19046
19046
  let cursor;
@@ -19065,6 +19065,7 @@ const replaceBundlePatches = async (tx, bundle, rows) => {
19065
19065
  if (page.next === void 0) break;
19066
19066
  cursor = page.next;
19067
19067
  }
19068
+ if (checkNew !== void 0) for (const row of wanted.values()) await checkNew(row);
19068
19069
  for (const row of wanted.values()) tx.create("bundle_patches", row);
19069
19070
  };
19070
19071
  const insertChannel = async (db, row) => {
@@ -19177,6 +19178,9 @@ const nativeBuildScopeKey = (scope) => {
19177
19178
  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.`);
19178
19179
  return scopeKey;
19179
19180
  };
19181
+ const refuseSandboxPatchBase = async (db, baseBundleId) => {
19182
+ 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.");
19183
+ };
19180
19184
  const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
19181
19185
  const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, exportMethod, nativeAppVersion, artifact }) => {
19182
19186
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
@@ -19295,10 +19299,11 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
19295
19299
  ...page
19296
19300
  });
19297
19301
  };
19302
+ const bundleId = options?.builtInOlderThan;
19303
+ if (bundleId !== void 0 && scope.channel.startsWith(SANDBOX_CHANNEL_PREFIX)) return null;
19298
19304
  const { rows } = await read(1);
19299
19305
  const newest = rows[0];
19300
19306
  if (newest === void 0) return null;
19301
- const bundleId = options?.builtInOlderThan;
19302
19307
  if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick(newest);
19303
19308
  for (let before = newest.id;;) {
19304
19309
  const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
@@ -19688,7 +19693,11 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
19688
19693
  for (const { release } of deployments) if (!channels.has(release.channel)) channels.set(release.channel, await ensureChannel(release.channel));
19689
19694
  const platforms = /* @__PURE__ */ new Map();
19690
19695
  for (const deployment of deployments) {
19691
- if (!("bundleId" in deployment) || platforms.has(deployment.bundleId)) continue;
19696
+ if (!("bundleId" in deployment)) {
19697
+ for (const { baseBundleId } of deployment.bundle.patches ?? []) await refuseSandboxPatchBase(db, baseBundleId);
19698
+ continue;
19699
+ }
19700
+ if (platforms.has(deployment.bundleId)) continue;
19692
19701
  const row = await db.findOne("bundles", { id: deployment.bundleId });
19693
19702
  if (row === null) throw new DatabaseBundleNotFoundError(deployment.bundleId);
19694
19703
  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.`);
@@ -19892,7 +19901,7 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
19892
19901
  if (patches !== void 0) await replaceBundlePatches(tx, current, bundleToPatchRows({
19893
19902
  ...next,
19894
19903
  patches
19895
- }));
19904
+ }), (row) => refuseSandboxPatchBase(tx, row.base_bundle_id));
19896
19905
  }),
19897
19906
  deleteBundles: async (ids) => {
19898
19907
  try {
@@ -20351,7 +20360,8 @@ const createAdminRouteHandlers = () => ({
20351
20360
  rebuildReleaseCatalog: onCore(async (core, _request, params) => json$2({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
20352
20361
  updateBundle: onCore(async (core, request, params) => {
20353
20362
  const bundleId = requireRouteParam(params, "id");
20354
- await core.updateBundle(bundleId, bundleUpdateOf(await request.json(), bundleId));
20363
+ const update = bundleUpdateOf(await request.json(), bundleId);
20364
+ await refusingInvalid(() => core.updateBundle(bundleId, update));
20355
20365
  return noContent();
20356
20366
  }),
20357
20367
  countBundles: onCore(async (core, request) => json$2({ data: await core.countBundles(platformOf(new URL(request.url))) })),
@@ -20375,7 +20385,7 @@ const createAdminRouteHandlers = () => ({
20375
20385
  deployReleases: onCore(async (core, request) => {
20376
20386
  const { deployments } = await body(request);
20377
20387
  if (!Array.isArray(deployments) || deployments.length === 0 || !deployments.every(isDeployment)) throw new HandlerBadRequestError("Deploy needs deployments, each a bundle and its release policy.");
20378
- return json$2({ data: await core.deploy(deployments) }, 201);
20388
+ return json$2({ data: await refusingInvalid(() => core.deploy(deployments)) }, 201);
20379
20389
  }),
20380
20390
  promoteRelease: onCore(async (core, request, params) => {
20381
20391
  const input = await body(request);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/vercel",
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",
@@ -41,11 +41,11 @@
41
41
  "@vercel/cli-auth": "0.3.10",
42
42
  "@vercel/cli-config": "0.3.1",
43
43
  "pg": "8.13.1",
44
- "@hot-updater/cli-tools": "1.2.0-rc.33",
45
- "@hot-updater/postgres": "1.2.0-rc.33",
46
- "@hot-updater/plugin-core": "1.2.0-rc.33",
47
- "@hot-updater/protocol": "1.2.0-rc.33",
48
- "@hot-updater/server": "1.2.0-rc.33"
44
+ "@hot-updater/cli-tools": "1.2.0-rc.35",
45
+ "@hot-updater/plugin-core": "1.2.0-rc.35",
46
+ "@hot-updater/postgres": "1.2.0-rc.35",
47
+ "@hot-updater/protocol": "1.2.0-rc.35",
48
+ "@hot-updater/server": "1.2.0-rc.35"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^20",
@@ -54,7 +54,7 @@
54
54
  "execa": "9.5.2",
55
55
  "kysely": "0.28.17",
56
56
  "vitest": "4.1.4",
57
- "@hot-updater/test-utils": "1.2.0-rc.33"
57
+ "@hot-updater/test-utils": "1.2.0-rc.35"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown",