@hot-updater/aws 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.
@@ -4637,7 +4637,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
4637
4637
  };
4638
4638
  //#endregion
4639
4639
  //#region ../../packages/server/dist/version.mjs
4640
- const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.42";
4640
+ const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.43";
4641
4641
  //#endregion
4642
4642
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
4643
4643
  /**
@@ -6803,6 +6803,22 @@ const ORIGIN_CACHE_MAX_ENTRIES = 128;
6803
6803
  const NO_CATALOG_HEADER = "x-hot-updater-catalog";
6804
6804
  /** A shared cache keeps a catalog, or a scope's lack of one, five seconds. */
6805
6805
  const CATALOG_CACHE_CONTROL = "public, max-age=0, s-maxage=5";
6806
+ /**
6807
+ * The same five seconds for a CDN that reads `CDN-Cache-Control` (RFC 9213),
6808
+ * such as Cloudflare's Workers Cache, which then ignores `Cache-Control`.
6809
+ * `s-maxage` forbids serving stale, so there an expired catalog held requests
6810
+ * at that location until the origin answered. Here, for five more seconds,
6811
+ * the CDN answers with the expired copy while it revalidates in the
6812
+ * background. `stale-if-error=0` keeps origin errors visible: without it,
6813
+ * Cloudflare serves a stale copy on error indefinitely.
6814
+ *
6815
+ * A device can see a catalog up to 15 seconds after a deploy or a Roll back
6816
+ * replaced it: the origin's 5-second catalog memo, then 5 seconds fresh and
6817
+ * 5 stale at the CDN. A revoked API key can read a cached catalog up to
6818
+ * 10 seconds. Devices and caches that don't read the header keep
6819
+ * `Cache-Control`.
6820
+ */
6821
+ const CATALOG_CDN_CACHE_CONTROL = "public, max-age=5, stale-while-revalidate=5, stale-if-error=0";
6806
6822
  const privateNotFound = () => Response.json({ error: "Not found" }, {
6807
6823
  status: 404,
6808
6824
  headers: { "cache-control": "private, no-store" }
@@ -6818,6 +6834,7 @@ const missingCatalog = () => Response.json({ error: "Not found" }, {
6818
6834
  status: 404,
6819
6835
  headers: {
6820
6836
  "cache-control": CATALOG_CACHE_CONTROL,
6837
+ "cdn-cache-control": CATALOG_CDN_CACHE_CONTROL,
6821
6838
  vary: "Accept-Encoding",
6822
6839
  [NO_CATALOG_HEADER]: "none"
6823
6840
  }
@@ -6832,6 +6849,7 @@ const catalogResponse = async (catalog, request) => {
6832
6849
  const etag = `"sha256:${await responseHash(body)}"`;
6833
6850
  const headers = {
6834
6851
  "cache-control": CATALOG_CACHE_CONTROL,
6852
+ "cdn-cache-control": CATALOG_CDN_CACHE_CONTROL,
6835
6853
  "content-type": CATALOG_CONTENT_TYPE,
6836
6854
  etag,
6837
6855
  vary: "Accept-Encoding"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/aws",
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
  "module": "dist/index.mjs",
@@ -45,9 +45,9 @@
45
45
  "es-toolkit": "^1.32.0",
46
46
  "execa": "9.5.2",
47
47
  "mime": "^4.0.4",
48
- "@hot-updater/mock": "1.0.0-rc.42",
49
- "@hot-updater/test-utils": "1.0.0-rc.42",
50
- "@hot-updater/protocol": "1.0.0-rc.42"
48
+ "@hot-updater/mock": "1.0.0-rc.43",
49
+ "@hot-updater/test-utils": "1.0.0-rc.43",
50
+ "@hot-updater/protocol": "1.0.0-rc.43"
51
51
  },
52
52
  "dependencies": {
53
53
  "@aws-sdk/client-cloudfront": "3.1066.0",
@@ -62,9 +62,9 @@
62
62
  "@aws-sdk/lib-storage": "3.1066.0",
63
63
  "@aws-sdk/lib-dynamodb": "3.1066.0",
64
64
  "hono": "4.12.34",
65
- "@hot-updater/cli-tools": "1.0.0-rc.42",
66
- "@hot-updater/server": "1.0.0-rc.42",
67
- "@hot-updater/plugin-core": "1.0.0-rc.42"
65
+ "@hot-updater/plugin-core": "1.0.0-rc.43",
66
+ "@hot-updater/cli-tools": "1.0.0-rc.43",
67
+ "@hot-updater/server": "1.0.0-rc.43"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsdown",