@hot-updater/firebase 1.0.0-rc.42 → 1.0.0-rc.43

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.
@@ -4591,7 +4591,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
4591
4591
  };
4592
4592
  //#endregion
4593
4593
  //#region ../../packages/server/dist/version.mjs
4594
- const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.42";
4594
+ const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.43";
4595
4595
  //#endregion
4596
4596
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
4597
4597
  /**
@@ -6757,6 +6757,22 @@ const ORIGIN_CACHE_MAX_ENTRIES = 128;
6757
6757
  const NO_CATALOG_HEADER = "x-hot-updater-catalog";
6758
6758
  /** A shared cache keeps a catalog, or a scope's lack of one, five seconds. */
6759
6759
  const CATALOG_CACHE_CONTROL = "public, max-age=0, s-maxage=5";
6760
+ /**
6761
+ * The same five seconds for a CDN that reads `CDN-Cache-Control` (RFC 9213),
6762
+ * such as Cloudflare's Workers Cache, which then ignores `Cache-Control`.
6763
+ * `s-maxage` forbids serving stale, so there an expired catalog held requests
6764
+ * at that location until the origin answered. Here, for five more seconds,
6765
+ * the CDN answers with the expired copy while it revalidates in the
6766
+ * background. `stale-if-error=0` keeps origin errors visible: without it,
6767
+ * Cloudflare serves a stale copy on error indefinitely.
6768
+ *
6769
+ * A device can see a catalog up to 15 seconds after a deploy or a Roll back
6770
+ * replaced it: the origin's 5-second catalog memo, then 5 seconds fresh and
6771
+ * 5 stale at the CDN. A revoked API key can read a cached catalog up to
6772
+ * 10 seconds. Devices and caches that don't read the header keep
6773
+ * `Cache-Control`.
6774
+ */
6775
+ const CATALOG_CDN_CACHE_CONTROL = "public, max-age=5, stale-while-revalidate=5, stale-if-error=0";
6760
6776
  const privateNotFound = () => Response.json({ error: "Not found" }, {
6761
6777
  status: 404,
6762
6778
  headers: { "cache-control": "private, no-store" }
@@ -6772,6 +6788,7 @@ const missingCatalog = () => Response.json({ error: "Not found" }, {
6772
6788
  status: 404,
6773
6789
  headers: {
6774
6790
  "cache-control": CATALOG_CACHE_CONTROL,
6791
+ "cdn-cache-control": CATALOG_CDN_CACHE_CONTROL,
6775
6792
  vary: "Accept-Encoding",
6776
6793
  [NO_CATALOG_HEADER]: "none"
6777
6794
  }
@@ -6786,6 +6803,7 @@ const catalogResponse = async (catalog, request) => {
6786
6803
  const etag = `"sha256:${await responseHash(body)}"`;
6787
6804
  const headers = {
6788
6805
  "cache-control": CATALOG_CACHE_CONTROL,
6806
+ "cdn-cache-control": CATALOG_CDN_CACHE_CONTROL,
6789
6807
  "content-type": CATALOG_CONTENT_TYPE,
6790
6808
  etag,
6791
6809
  vary: "Accept-Encoding"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.42",
4
+ "version": "1.0.0-rc.43",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -37,10 +37,10 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "hono": "4.12.34",
40
- "@hot-updater/protocol": "1.0.0-rc.42",
41
- "@hot-updater/plugin-core": "1.0.0-rc.42",
42
- "@hot-updater/cli-tools": "1.0.0-rc.42",
43
- "@hot-updater/server": "1.0.0-rc.42"
40
+ "@hot-updater/cli-tools": "1.0.0-rc.43",
41
+ "@hot-updater/server": "1.0.0-rc.43",
42
+ "@hot-updater/plugin-core": "1.0.0-rc.43",
43
+ "@hot-updater/protocol": "1.0.0-rc.43"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
@@ -55,8 +55,8 @@
55
55
  "firebase-tools": "15.29.0",
56
56
  "fkill": "^9.0.0",
57
57
  "mime": "^4.0.4",
58
- "@hot-updater/mock": "1.0.0-rc.42",
59
- "@hot-updater/test-utils": "1.0.0-rc.42"
58
+ "@hot-updater/mock": "1.0.0-rc.43",
59
+ "@hot-updater/test-utils": "1.0.0-rc.43"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "firebase-admin": "*",