@hot-updater/firebase 0.32.0 → 0.33.0

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.
@@ -3191,6 +3191,20 @@ const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
3191
3191
  return targetAppVersionList.filter((version) => semverSatisfies$1(version, currentVersion)).sort((a, b) => b.localeCompare(a));
3192
3192
  };
3193
3193
  //#endregion
3194
+ //#region ../plugin-core/dist/requestUpdateBundleState.mjs
3195
+ const requestUpdateBundleSeeds = /* @__PURE__ */ new WeakMap();
3196
+ const isWeakMapKey = (value) => typeof value === "object" && value !== null || typeof value === "function";
3197
+ const toBundleSeeds = (seeds) => seeds.filter((seed) => !!seed);
3198
+ const seedRequestUpdateBundles = (context, seeds) => {
3199
+ if (!isWeakMapKey(context)) return;
3200
+ const nextSeeds = toBundleSeeds(seeds);
3201
+ if (nextSeeds.length === 0) return;
3202
+ const bundlesById = /* @__PURE__ */ new Map();
3203
+ for (const seed of requestUpdateBundleSeeds.get(context) ?? []) bundlesById.set(seed.id, seed);
3204
+ for (const seed of nextSeeds) bundlesById.set(seed.id, seed);
3205
+ requestUpdateBundleSeeds.set(context, [...bundlesById.values()]);
3206
+ };
3207
+ //#endregion
3194
3208
  //#region ../js/dist/index.mjs
3195
3209
  var __create = Object.create;
3196
3210
  var __defProp = Object.defineProperty;
@@ -4556,6 +4570,15 @@ const day = 3600 * 24;
4556
4570
  day * 7;
4557
4571
  day * 365.25;
4558
4572
  //#endregion
4573
+ //#region ../plugin-core/dist/resolveUpdateInfoFromBundles.mjs
4574
+ const findSeedBundle = (bundles, bundleId) => bundles.find((bundle) => bundle.id === bundleId);
4575
+ const resolveUpdateInfoFromBundles = async ({ args, bundles, context }) => {
4576
+ const info = await getUpdateInfo(bundles, args);
4577
+ if (!info) return null;
4578
+ seedRequestUpdateBundles(context, [findSeedBundle(bundles, info.id), args.bundleId === "00000000-0000-0000-0000-000000000000" ? null : findSeedBundle(bundles, args.bundleId)]);
4579
+ return info;
4580
+ };
4581
+ //#endregion
4559
4582
  //#region ../plugin-core/dist/createDatabasePluginGetUpdateInfo.mjs
4560
4583
  const normalizeAppVersionArgs = (args) => ({
4561
4584
  ...args,
@@ -4572,10 +4595,18 @@ const createDatabasePluginGetUpdateInfo = ({ getBundlesByFingerprint, getBundles
4572
4595
  if (args._updateStrategy === "appVersion") {
4573
4596
  const normalizedArgs = normalizeAppVersionArgs(args);
4574
4597
  const compatibleAppVersions = filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs, context), normalizedArgs.appVersion);
4575
- return getUpdateInfo(compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [], normalizedArgs);
4598
+ return resolveUpdateInfoFromBundles({
4599
+ args: normalizedArgs,
4600
+ bundles: compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [],
4601
+ context
4602
+ });
4576
4603
  }
4577
4604
  const normalizedArgs = normalizeFingerprintArgs(args);
4578
- return getUpdateInfo(await getBundlesByFingerprint(normalizedArgs, context), normalizedArgs);
4605
+ return resolveUpdateInfoFromBundles({
4606
+ args: normalizedArgs,
4607
+ bundles: await getBundlesByFingerprint(normalizedArgs, context),
4608
+ context
4609
+ });
4579
4610
  };
4580
4611
  };
4581
4612
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "0.32.0",
4
+ "version": "0.33.0",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -36,10 +36,10 @@
36
36
  "dependencies": {
37
37
  "firebase": "^11.3.1",
38
38
  "hono": "4.12.9",
39
- "@hot-updater/plugin-core": "0.32.0",
40
- "@hot-updater/server": "0.32.0",
41
- "@hot-updater/cli-tools": "0.32.0",
42
- "@hot-updater/core": "0.32.0"
39
+ "@hot-updater/cli-tools": "0.33.0",
40
+ "@hot-updater/core": "0.33.0",
41
+ "@hot-updater/plugin-core": "0.33.0",
42
+ "@hot-updater/server": "0.33.0"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public"
@@ -54,9 +54,9 @@
54
54
  "firebase-tools": "^13.32.0",
55
55
  "fkill": "^9.0.0",
56
56
  "mime": "^4.0.4",
57
- "@hot-updater/js": "0.32.0",
58
- "@hot-updater/mock": "0.32.0",
59
- "@hot-updater/test-utils": "0.32.0"
57
+ "@hot-updater/js": "0.33.0",
58
+ "@hot-updater/mock": "0.33.0",
59
+ "@hot-updater/test-utils": "0.33.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "firebase-admin": "*",