@quintype/framework 7.30.4 → 7.30.5

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,13 @@
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.30.5](https://github.com/quintype/quintype-node-framework/compare/v7.30.4...v7.30.5) (2024-10-22)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cache-tags:** fix amp cache tags ([#443](https://github.com/quintype/quintype-node-framework/issues/443)) ([009bbca](https://github.com/quintype/quintype-node-framework/commit/009bbcab7d42e70626d541ca80def10625ca021e))
11
+
5
12
  ### [7.30.4](https://github.com/quintype/quintype-node-framework/compare/v7.30.3...v7.30.4) (2024-10-22)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.30.4",
3
+ "version": "7.30.5",
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.19.3",
34
+ "@quintype/amp": "^2.20.0",
35
35
  "@quintype/backend": "2.5.1",
36
36
  "@quintype/components": "^3.5.0",
37
37
  "@quintype/prerender-node": "^3.2.26",
@@ -153,14 +153,26 @@ async function ampStoryPageHandler(
153
153
  if (ampHtml instanceof Error) return next(ampHtml);
154
154
 
155
155
  res.set("Content-Type", "text/html");
156
+
157
+ const pageCacheKey = `page/${config["publisher-id"]}/story-page`;
158
+ let cacheKeys = [storyToCacheKey(config["publisher-id"], story), pageCacheKey];
159
+
160
+ /* To cdn purge amp stories through custom tags, use getAdditionalCacheKeys function
161
+ to generate one or more cache tags, it should return cache tags as an array of strings. */
162
+ const getAdditionalCacheKeys = get(opts, ["featureConfig", "getAdditionalCacheKeys"]);
163
+ if (getAdditionalCacheKeys) {
164
+ const additionalCacheKeys = getAdditionalCacheKeys(config);
165
+ cacheKeys = cacheKeys.concat(additionalCacheKeys);
166
+ }
167
+
156
168
  addCacheHeadersToResult({
157
169
  res,
158
- cacheKeys: storyToCacheKey(config["publisher-id"], story),
170
+ cacheKeys,
159
171
  cdnProvider,
160
172
  config,
173
+ // sMaxAge: "86400", // uncomment this after testing fastly cache purge on prod
161
174
  });
162
175
 
163
-
164
176
  const finalResponse = optimizeAmpHtml ? await optimize(ampHtml) : ampHtml;
165
177
 
166
178
  return res.send(finalResponse);