@hot-updater/azure 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.
@@ -8155,7 +8155,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
8155
8155
  };
8156
8156
  //#endregion
8157
8157
  //#region ../../packages/server/dist/version.mjs
8158
- const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.33";
8158
+ const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.35";
8159
8159
  //#endregion
8160
8160
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
8161
8161
  const createVersionRouteHandlers = (plugins = []) => {
@@ -9460,7 +9460,7 @@ const deleteBundle = async (tx, current) => {
9460
9460
  await tx.delete("bundles", current);
9461
9461
  countBundle(tx, current.platform, -1);
9462
9462
  };
9463
- const replaceBundlePatches = async (tx, bundle, rows) => {
9463
+ const replaceBundlePatches = async (tx, bundle, rows, checkNew) => {
9464
9464
  const wanted = new Map(rows.map((row) => [row.id, row]));
9465
9465
  const count = bundle._refs_bundle_patches_bundle_id ?? 0;
9466
9466
  let cursor;
@@ -9485,6 +9485,7 @@ const replaceBundlePatches = async (tx, bundle, rows) => {
9485
9485
  if (page.next === void 0) break;
9486
9486
  cursor = page.next;
9487
9487
  }
9488
+ if (checkNew !== void 0) for (const row of wanted.values()) await checkNew(row);
9488
9489
  for (const row of wanted.values()) tx.create("bundle_patches", row);
9489
9490
  };
9490
9491
  const insertChannel = async (db, row) => {
@@ -9597,6 +9598,9 @@ const nativeBuildScopeKey = (scope) => {
9597
9598
  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.`);
9598
9599
  return scopeKey;
9599
9600
  };
9601
+ const refuseSandboxPatchBase = async (db, baseBundleId) => {
9602
+ 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.");
9603
+ };
9600
9604
  const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
9601
9605
  const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, exportMethod, nativeAppVersion, artifact }) => {
9602
9606
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
@@ -9715,10 +9719,11 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
9715
9719
  ...page
9716
9720
  });
9717
9721
  };
9722
+ const bundleId = options?.builtInOlderThan;
9723
+ if (bundleId !== void 0 && scope.channel.startsWith(SANDBOX_CHANNEL_PREFIX)) return null;
9718
9724
  const { rows } = await read(1);
9719
9725
  const newest = rows[0];
9720
9726
  if (newest === void 0) return null;
9721
- const bundleId = options?.builtInOlderThan;
9722
9727
  if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick(newest);
9723
9728
  for (let before = newest.id;;) {
9724
9729
  const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
@@ -10108,7 +10113,11 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
10108
10113
  for (const { release } of deployments) if (!channels.has(release.channel)) channels.set(release.channel, await ensureChannel(release.channel));
10109
10114
  const platforms = /* @__PURE__ */ new Map();
10110
10115
  for (const deployment of deployments) {
10111
- if (!("bundleId" in deployment) || platforms.has(deployment.bundleId)) continue;
10116
+ if (!("bundleId" in deployment)) {
10117
+ for (const { baseBundleId } of deployment.bundle.patches ?? []) await refuseSandboxPatchBase(db, baseBundleId);
10118
+ continue;
10119
+ }
10120
+ if (platforms.has(deployment.bundleId)) continue;
10112
10121
  const row = await db.findOne("bundles", { id: deployment.bundleId });
10113
10122
  if (row === null) throw new DatabaseBundleNotFoundError(deployment.bundleId);
10114
10123
  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.`);
@@ -10312,7 +10321,7 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
10312
10321
  if (patches !== void 0) await replaceBundlePatches(tx, current, bundleToPatchRows({
10313
10322
  ...next,
10314
10323
  patches
10315
- }));
10324
+ }), (row) => refuseSandboxPatchBase(tx, row.base_bundle_id));
10316
10325
  }),
10317
10326
  deleteBundles: async (ids) => {
10318
10327
  try {
@@ -10771,7 +10780,8 @@ const createAdminRouteHandlers = () => ({
10771
10780
  rebuildReleaseCatalog: onCore(async (core, _request, params) => json$2({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
10772
10781
  updateBundle: onCore(async (core, request, params) => {
10773
10782
  const bundleId = requireRouteParam(params, "id");
10774
- await core.updateBundle(bundleId, bundleUpdateOf(await request.json(), bundleId));
10783
+ const update = bundleUpdateOf(await request.json(), bundleId);
10784
+ await refusingInvalid(() => core.updateBundle(bundleId, update));
10775
10785
  return noContent();
10776
10786
  }),
10777
10787
  countBundles: onCore(async (core, request) => json$2({ data: await core.countBundles(platformOf(new URL(request.url))) })),
@@ -10795,7 +10805,7 @@ const createAdminRouteHandlers = () => ({
10795
10805
  deployReleases: onCore(async (core, request) => {
10796
10806
  const { deployments } = await body$1(request);
10797
10807
  if (!Array.isArray(deployments) || deployments.length === 0 || !deployments.every(isDeployment)) throw new HandlerBadRequestError("Deploy needs deployments, each a bundle and its release policy.");
10798
- return json$2({ data: await core.deploy(deployments) }, 201);
10808
+ return json$2({ data: await refusingInvalid(() => core.deploy(deployments)) }, 201);
10799
10809
  }),
10800
10810
  promoteRelease: onCore(async (core, request, params) => {
10801
10811
  const input = await body$1(request);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/azure",
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
  "engines": {
7
7
  "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
@@ -44,10 +44,10 @@
44
44
  "@azure/identity": "4.14.0",
45
45
  "@azure/keyvault-secrets": "4.11.2",
46
46
  "@azure/storage-blob": "12.34.0",
47
- "@hot-updater/cli-tools": "1.2.0-rc.33",
48
- "@hot-updater/plugin-core": "1.2.0-rc.33",
49
- "@hot-updater/protocol": "1.2.0-rc.33",
50
- "@hot-updater/server": "1.2.0-rc.33"
47
+ "@hot-updater/cli-tools": "1.2.0-rc.35",
48
+ "@hot-updater/plugin-core": "1.2.0-rc.35",
49
+ "@hot-updater/protocol": "1.2.0-rc.35",
50
+ "@hot-updater/server": "1.2.0-rc.35"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@azure/functions": "4.16.5",
@@ -55,7 +55,7 @@
55
55
  "execa": "9.5.2",
56
56
  "jszip": "^3.10.1",
57
57
  "vitest": "4.1.4",
58
- "@hot-updater/test-utils": "1.2.0-rc.33"
58
+ "@hot-updater/test-utils": "1.2.0-rc.35"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsdown",