@styleflow.app/flowpress-deploy 1.0.0-beta.14 → 1.0.0-beta.15

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0-beta.15
4
+
5
+ - Export a Node fetch adapter for media proxies: negotiate identity encoding and remove encoding metadata after automatic decompression.
6
+ - Verify gzip proxying against a real HTTP server.
7
+
3
8
  ## 1.0.0-beta.14
4
9
 
5
10
  - Preserve provider timestamp offsets when waiting for backup completion.
@@ -0,0 +1,3 @@
1
+ /** Fetch adapter for proxies running on Node, whose fetch decompresses bodies. */
2
+ export declare const nodeProxyFetch: typeof fetch;
3
+ //# sourceMappingURL=node-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-fetch.d.ts","sourceRoot":"","sources":["../src/node-fetch.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,eAAO,MAAM,cAAc,EAAE,OAAO,KAgBnC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /** Fetch adapter for proxies running on Node, whose fetch decompresses bodies. */
2
+ export const nodeProxyFetch = async (input, init) => {
3
+ const headers = new Headers(init?.headers ?? (input instanceof Request ? input.headers : undefined));
4
+ headers.set("accept-encoding", "identity");
5
+ const response = await fetch(input, { ...init, headers });
6
+ const encoding = response.headers.get("content-encoding")?.trim().toLowerCase();
7
+ const method = init?.method ?? (input instanceof Request ? input.method : "GET");
8
+ if (method === "HEAD" || !response.body || !encoding || !/^(gzip|deflate|br)$/.test(encoding))
9
+ return response;
10
+ // A server ignoring identity negotiation must not label decoded bytes as gzip.
11
+ if (response.status === 206) {
12
+ await response.body.cancel();
13
+ throw new Error("Encoded partial media response cannot be proxied safely.");
14
+ }
15
+ const decodedHeaders = new Headers(response.headers);
16
+ decodedHeaders.delete("content-encoding");
17
+ decodedHeaders.delete("content-length");
18
+ return new Response(response.body, { status: response.status, statusText: response.statusText, headers: decodedHeaders });
19
+ };
20
+ //# sourceMappingURL=node-fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-fetch.js","sourceRoot":"","sources":["../src/node-fetch.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAiB,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAChE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACrG,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjF,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC/G,+EAA+E;IAC/E,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrD,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC1C,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACxC,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;AAC5H,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@styleflow.app/flowpress-deploy",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "Safe full and partial deployment primitives for FlowPress.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -36,6 +36,10 @@
36
36
  "./ops": {
37
37
  "import": "./dist/ops/config.js",
38
38
  "types": "./dist/ops/config.d.ts"
39
+ },
40
+ "./node-fetch": {
41
+ "import": "./dist/node-fetch.js",
42
+ "types": "./dist/node-fetch.d.ts"
39
43
  }
40
44
  },
41
45
  "files": [