@quintype/framework 7.12.1-chartbeat.0 → 7.13.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,23 @@
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.13.0](https://github.com/quintype/quintype-node-framework/compare/v7.4.1...v7.13.0) (2022-11-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * add video support to web stories ([#322](https://github.com/quintype/quintype-node-framework/issues/322)) ([f41b82b](https://github.com/quintype/quintype-node-framework/commit/f41b82be8285b555970527204ec6478f21c47782))
11
+ * **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))
12
+ * remove powered by quintype from the footer ([#334](https://github.com/quintype/quintype-node-framework/issues/334)) ([3dbc1f3](https://github.com/quintype/quintype-node-framework/commit/3dbc1f3144536a439ad0ecaacd2313cb6bb528e1))
13
+ * **SW:** Disable sw shell ([#321](https://github.com/quintype/quintype-node-framework/issues/321)) ([6d04bc8](https://github.com/quintype/quintype-node-framework/commit/6d04bc87dd42c647ec9763eca430ada2f4a4d8ea))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **redirects:** cache redirects ([#332](https://github.com/quintype/quintype-node-framework/issues/332)) ([ae820eb](https://github.com/quintype/quintype-node-framework/commit/ae820eb5fb205d3ae4ec4771ded953690705a3b9))
19
+ * remove prerender query param after the prerender check ([#314](https://github.com/quintype/quintype-node-framework/issues/314)) ([94eac28](https://github.com/quintype/quintype-node-framework/commit/94eac28bfd04483cc665c5ce4d2fc8768c84a31b))
20
+ * remove prerender query param after the prerender check [#314](https://github.com/quintype/quintype-node-framework/issues/314) ([#317](https://github.com/quintype/quintype-node-framework/issues/317)) ([0067d81](https://github.com/quintype/quintype-node-framework/commit/0067d81fe545a726948db14a44768876b41f6ba8))
21
+
5
22
  ## [7.12.0](https://github.com/quintype/quintype-node-framework/compare/v7.11.0...v7.12.0) (2022-11-02)
6
23
 
7
24
  ## [7.11.0](https://github.com/quintype/quintype-node-framework/compare/v7.10.5...v7.11.0) (2022-10-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.12.1-chartbeat.0",
3
+ "version": "7.13.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.7.4-chartbeat.1",
34
+ "@quintype/amp": "^2.7.3",
35
35
  "@quintype/backend": "^2.3.3",
36
36
  "@quintype/components": "^3.0.0",
37
37
  "@quintype/prerender-node": "^3.2.26",
@@ -33,11 +33,16 @@ function processRedirects(req, res, next, sourceUrlArray, urls) {
33
33
  });
34
34
  }
35
35
  const dynamicKeys = extractedSourceUrl(req.path);
36
- const compiledPath =
37
- dynamicKeys && extractedDestinationUrl(dynamicKeys.params);
36
+ const compiledPath = dynamicKeys && extractedDestinationUrl(dynamicKeys.params);
38
37
  if (compiledPath) {
38
+ const validStatusCodes = { 301: "max-age=604800", 302: "max-age=86400" };
39
+ const statusCode = parseInt(urls[sourceUrl].statusCode, 10);
40
+ const cacheValue = validStatusCodes[statusCode];
41
+ if (cacheValue) {
42
+ res.set("cache-control", `public,${cacheValue}`);
43
+ }
39
44
  res.redirect(
40
- urls[sourceUrl].statusCode,
45
+ statusCode,
41
46
  destinationUrl
42
47
  ? `${destinationUrl.protocol}//${destinationUrl.hostname}${compiledPath}${search}`
43
48
  : `${compiledPath}${search}`
@@ -49,12 +54,7 @@ function processRedirects(req, res, next, sourceUrlArray, urls) {
49
54
  });
50
55
  }
51
56
 
52
- exports.getRedirectUrl = async function getRedirectUrl(
53
- req,
54
- res,
55
- next,
56
- { redirectUrls, config }
57
- ) {
57
+ exports.getRedirectUrl = async function getRedirectUrl(req, res, next, { redirectUrls, config }) {
58
58
  let sourceUrls;
59
59
  if (typeof redirectUrls === "function") {
60
60
  const redirectUrlsList = await redirectUrls(config);
@@ -64,7 +64,6 @@ exports.getRedirectUrl = async function getRedirectUrl(
64
64
  }
65
65
  } else if (redirectUrls) {
66
66
  sourceUrls = Object.keys(redirectUrls);
67
- sourceUrls.length > 0 &&
68
- processRedirects(req, res, next, sourceUrls, redirectUrls);
67
+ sourceUrls.length > 0 && processRedirects(req, res, next, sourceUrls, redirectUrls);
69
68
  }
70
69
  };