@hot-updater/firebase 1.2.0-rc.13 → 1.2.0-rc.14

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.
@@ -4603,7 +4603,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
4603
4603
  };
4604
4604
  //#endregion
4605
4605
  //#region ../../packages/server/dist/version.mjs
4606
- const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.13";
4606
+ const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.14";
4607
4607
  //#endregion
4608
4608
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
4609
4609
  /**
package/dist/index.cjs CHANGED
@@ -658,10 +658,11 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
658
658
  /**
659
659
  * Adds `value` as the secret's newest version, creating the secret when
660
660
  * it is missing, and waits until the `latest` alias resolves to it. Then
661
- * it destroys the older versions this adapter added, which the secret's
662
- * `hot-updater-versions` annotation lists: versions added any other way
663
- * are never touched. The permissions this needs are checked before
664
- * anything is written. A version that could not be destroyed stays
661
+ * it destroys the versions this adapter added before the previous one,
662
+ * which the secret's `hot-updater-versions` annotation lists, keeping
663
+ * the previous value: versions added any other way are never touched.
664
+ * The permissions this needs are checked on the secret, once it exists,
665
+ * before any version is added. A version that could not be destroyed stays
665
666
  * listed for the next `set`. The annotation is updated against the
666
667
  * secret's etag, so a concurrent `set` loses no listed version. When
667
668
  * `latest` does not resolve to the new version in time, or the
@@ -684,10 +685,12 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
684
685
  } });
685
686
  const version = versionOf(isRecord(added.body) ? added.body.name : void 0);
686
687
  if (!added.ok || !VERSION_ID_PATTERN.test(version)) throw requestError("add a version", secret, added, "secretmanager.versions.add on the secret");
688
+ const own = trackedVersions(current).filter((entry) => Number(entry) < Number(version));
689
+ const previous = own.reduce((newest, entry) => newest === void 0 || Number(entry) > Number(newest) ? entry : newest, void 0);
687
690
  const visible = await waitForLatest(token, secret, version);
688
691
  const destroyed = /* @__PURE__ */ new Set();
689
692
  if (visible) {
690
- const older = trackedVersions(current).filter((entry) => Number(entry) < Number(version));
693
+ const older = own.filter((entry) => entry !== previous);
691
694
  const results = await Promise.all(older.map((entry) => destroy(token, secret, entry)));
692
695
  older.forEach((entry, index) => {
693
696
  if (results[index]) destroyed.add(entry);
@@ -703,7 +706,11 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
703
706
  await delay(LATEST_RETRY_DELAYS_MS[attempt - 1] ?? 0);
704
707
  base = await readSecret(token, secret) ?? {};
705
708
  }
706
- const listed = [.../* @__PURE__ */ new Set([version, ...trackedVersions(base)])].filter((entry) => !destroyed.has(entry));
709
+ const listed = [.../* @__PURE__ */ new Set([
710
+ version,
711
+ ...previous === void 0 ? [] : [previous],
712
+ ...trackedVersions(base)
713
+ ])].filter((entry) => !destroyed.has(entry));
707
714
  updated = await request(token, "PATCH", `${secret}?updateMask=annotations`, {
708
715
  ...base.etag === void 0 ? {} : { etag: base.etag },
709
716
  annotations: {
package/dist/index.mjs CHANGED
@@ -657,10 +657,11 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
657
657
  /**
658
658
  * Adds `value` as the secret's newest version, creating the secret when
659
659
  * it is missing, and waits until the `latest` alias resolves to it. Then
660
- * it destroys the older versions this adapter added, which the secret's
661
- * `hot-updater-versions` annotation lists: versions added any other way
662
- * are never touched. The permissions this needs are checked before
663
- * anything is written. A version that could not be destroyed stays
660
+ * it destroys the versions this adapter added before the previous one,
661
+ * which the secret's `hot-updater-versions` annotation lists, keeping
662
+ * the previous value: versions added any other way are never touched.
663
+ * The permissions this needs are checked on the secret, once it exists,
664
+ * before any version is added. A version that could not be destroyed stays
664
665
  * listed for the next `set`. The annotation is updated against the
665
666
  * secret's etag, so a concurrent `set` loses no listed version. When
666
667
  * `latest` does not resolve to the new version in time, or the
@@ -683,10 +684,12 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
683
684
  } });
684
685
  const version = versionOf(isRecord(added.body) ? added.body.name : void 0);
685
686
  if (!added.ok || !VERSION_ID_PATTERN.test(version)) throw requestError("add a version", secret, added, "secretmanager.versions.add on the secret");
687
+ const own = trackedVersions(current).filter((entry) => Number(entry) < Number(version));
688
+ const previous = own.reduce((newest, entry) => newest === void 0 || Number(entry) > Number(newest) ? entry : newest, void 0);
686
689
  const visible = await waitForLatest(token, secret, version);
687
690
  const destroyed = /* @__PURE__ */ new Set();
688
691
  if (visible) {
689
- const older = trackedVersions(current).filter((entry) => Number(entry) < Number(version));
692
+ const older = own.filter((entry) => entry !== previous);
690
693
  const results = await Promise.all(older.map((entry) => destroy(token, secret, entry)));
691
694
  older.forEach((entry, index) => {
692
695
  if (results[index]) destroyed.add(entry);
@@ -702,7 +705,11 @@ const secretManager = ({ projectId, prefix = "hot-updater-", credentials }) => {
702
705
  await delay(LATEST_RETRY_DELAYS_MS[attempt - 1] ?? 0);
703
706
  base = await readSecret(token, secret) ?? {};
704
707
  }
705
- const listed = [.../* @__PURE__ */ new Set([version, ...trackedVersions(base)])].filter((entry) => !destroyed.has(entry));
708
+ const listed = [.../* @__PURE__ */ new Set([
709
+ version,
710
+ ...previous === void 0 ? [] : [previous],
711
+ ...trackedVersions(base)
712
+ ])].filter((entry) => !destroyed.has(entry));
706
713
  updated = await request(token, "PATCH", `${secret}?updateMask=annotations`, {
707
714
  ...base.etag === void 0 ? {} : { etag: base.etag },
708
715
  annotations: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "1.2.0-rc.13",
4
+ "version": "1.2.0-rc.14",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -38,10 +38,10 @@
38
38
  "dependencies": {
39
39
  "hono": "4.12.34",
40
40
  "google-auth-library": "10.7.0",
41
- "@hot-updater/cli-tools": "1.2.0-rc.13",
42
- "@hot-updater/plugin-core": "1.2.0-rc.13",
43
- "@hot-updater/server": "1.2.0-rc.13",
44
- "@hot-updater/protocol": "1.2.0-rc.13"
41
+ "@hot-updater/cli-tools": "1.2.0-rc.14",
42
+ "@hot-updater/protocol": "1.2.0-rc.14",
43
+ "@hot-updater/plugin-core": "1.2.0-rc.14",
44
+ "@hot-updater/server": "1.2.0-rc.14"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
@@ -56,8 +56,8 @@
56
56
  "firebase-tools": "15.29.0",
57
57
  "fkill": "^9.0.0",
58
58
  "mime": "^4.0.4",
59
- "@hot-updater/mock": "1.2.0-rc.13",
60
- "@hot-updater/test-utils": "1.2.0-rc.13"
59
+ "@hot-updater/mock": "1.2.0-rc.14",
60
+ "@hot-updater/test-utils": "1.2.0-rc.14"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "firebase-admin": ">=11.10.0",