@quintype/framework 7.5.0 → 7.7.0-beta-amp-cta.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [7.6.0](https://github.com/quintype/quintype-node-framework/compare/v7.4.0...v7.6.0) (2022-06-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * **api-client:** Implement wildcard_to_api_host ⚡ ([#308](https://github.com/quintype/quintype-node-framework/issues/308)) ([9c585f4](https://github.com/quintype/quintype-node-framework/commit/9c585f49fece1cba7271a47465633ca9c40034ff))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **amp:** Incorrect localised content displayed across publishers ([#304](https://github.com/quintype/quintype-node-framework/issues/304)) ([c47d929](https://github.com/quintype/quintype-node-framework/commit/c47d9294c022100a95ba5ca1d755dd4731b6b580))
16
+
5
17
  ## [7.5.0](https://github.com/quintype/quintype-node-framework/compare/v7.4.1...v7.5.0) (2022-06-27)
6
18
 
7
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.5.0",
3
+ "version": "7.7.0-beta-amp-cta.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -31,7 +31,7 @@
31
31
  "homepage": "https://github.com/quintype/quintype-node-framework#readme",
32
32
  "dependencies": {
33
33
  "@ampproject/toolbox-optimizer": "2.8.3",
34
- "@quintype/amp": "^2.4.21",
34
+ "@quintype/amp": "^2.4.22-cta-feature.1",
35
35
  "@quintype/backend": "^2.3.1",
36
36
  "@quintype/components": "^3.0.0",
37
37
  "@quintype/prerender-node": "^3.2.24",
@@ -29,9 +29,9 @@ function createTemporaryClient(config, hostname) {
29
29
  return new Client(configuredHosts[hostname], true);
30
30
  }
31
31
 
32
- const matchedMadridUrl = (config.wildcard_to_api_host || []).find((str) => hostname.includes(str));
32
+ const matchedWildcardUrl = (config.wildcard_to_api_host || []).find((str) => hostname.includes(str));
33
33
 
34
- if (matchedMadridUrl) return new Client(`http://${hostname.replace(matchedMadridUrl, ".internal")}`, true);
34
+ if (matchedWildcardUrl) return new Client(`http://${hostname.replace(matchedWildcardUrl, ".internal")}`, true);
35
35
 
36
36
  const matchedString = (config.host_to_automatic_api_host || []).find((str) => hostname.includes(str));
37
37
 
package/server/routes.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @category Server
7
7
  * @module routes
8
8
  */
9
-
9
+ const { match } = require("path-to-regexp");
10
10
  const { generateServiceWorker } = require("./handlers/generate-service-worker");
11
11
  const {
12
12
  handleIsomorphicShell,
@@ -70,7 +70,10 @@ exports.upstreamQuintypeRoutes = function upstreamQuintypeRoutes(
70
70
  parseInt(_sMaxAge) > 0 &&
71
71
  apiProxy.on("proxyRes", function (proxyRes, req) {
72
72
  const pathName = get(req, ["originalUrl"], "").split("?")[0];
73
- const checkForExcludeRoutes = excludeRoutes.includes(pathName);
73
+ const checkForExcludeRoutes = excludeRoutes.some((path) => {
74
+ const matchFn = match(path, { decode: decodeURIComponent });
75
+ return matchFn(pathName);
76
+ });
74
77
  const getCacheControl = get(proxyRes, ["headers", "cache-control"], "");
75
78
  if (!checkForExcludeRoutes && getCacheControl.includes("public")) {
76
79
  proxyRes.headers["cache-control"] = getCacheControl.replace(/s-maxage=\d*/g, `s-maxage=${_sMaxAge}`);
@@ -87,7 +90,13 @@ exports.upstreamQuintypeRoutes = function upstreamQuintypeRoutes(
87
90
  });
88
91
 
89
92
  // Mention the routes which don't want to override the s-maxage value
90
- const excludeRoutes = ["/qlitics.js", "/api/v1/breaking-news"];
93
+ const excludeRoutes = [
94
+ "/qlitics.js",
95
+ "/api/v1/breaking-news",
96
+ "/stories.rss",
97
+ "/api/v1/collections/:slug.rss",
98
+ "/api/v1/advanced-search",
99
+ ];
91
100
 
92
101
  app.all("/api/*", sketchesProxy);
93
102
  app.all("/login", sketchesProxy);