@quintype/framework 7.34.7-handle-500-issue.3 → 7.34.8-remove-custom-scripts.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,8 @@
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.34.7](https://github.com/quintype/quintype-node-framework/compare/v7.34.6...v7.34.7) (2025-11-21)
6
+
5
7
  ### [7.34.6](https://github.com/quintype/quintype-node-framework/compare/v7.34.4...v7.34.6) (2025-10-17)
6
8
 
7
9
  ### [7.34.5](https://github.com/quintype/quintype-node-framework/compare/v7.34.4...v7.34.5) (2025-09-01)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.34.7-handle-500-issue.3",
3
+ "version": "7.34.8-remove-custom-scripts.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -33,7 +33,7 @@
33
33
  "@ampproject/toolbox-optimizer": "2.8.3",
34
34
  "@grpc/grpc-js": "^1.12.5",
35
35
  "@jsdoc/salty": "^0.2.9",
36
- "@quintype/amp": "^2.22.5",
36
+ "@quintype/amp": "^2.22.8",
37
37
  "@quintype/backend": "^2.7.0",
38
38
  "@quintype/components": "^3.5.0",
39
39
  "@quintype/prerender-node": "^3.2.26",
@@ -195,6 +195,8 @@ exports.handleIsomorphicShell = async function handleIsomorphicShell(
195
195
 
196
196
  function createStoreFromResult(url, result, opts = {}) {
197
197
  const isBotRequest = _.get(url, "query.botrequest", false);
198
+ const nothirdparty = _.get(url, "query.nothirdparty", false);
199
+ console.log("log--nothirdparty", nothirdparty);
198
200
  const qt = {
199
201
  pageType: result.pageType || opts.defaultPageType,
200
202
  subPageType: result.subPageType,
@@ -204,6 +206,7 @@ function createStoreFromResult(url, result, opts = {}) {
204
206
  primaryHostUrl: result.primaryHostUrl,
205
207
  isBotRequest: isBotRequest,
206
208
  lazyLoadImageMargin: opts.lazyLoadImageMargin,
209
+ removeThirdPartyScripts: nothirdparty,
207
210
  };
208
211
  return createBasicStore(result, qt, opts);
209
212
  }
@@ -485,11 +488,6 @@ exports.handleIsomorphicRoute = function handleIsomorphicRoute(
485
488
  });
486
489
  return res.redirect(301, result.data.location);
487
490
  }
488
-
489
- if (statusCode >= 500) {
490
- return res.sendStatus(statusCode);
491
- }
492
-
493
491
  const seoInstance = getSeoInstance(seo, config, result.pageType);
494
492
  const seoTags = seoInstance && seoInstance.getMetaTags(config, result.pageType || match.pageType, result, { url });
495
493
 
@@ -48,7 +48,8 @@ function getClientStub(hostname) {
48
48
  page: {
49
49
  id: 103,
50
50
  title: "Testing",
51
- content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
51
+ content:
52
+ "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
52
53
  metadata: { header: true, footer: false },
53
54
  type: "static-page",
54
55
  "status-code": 200,
@@ -59,7 +60,8 @@ function getClientStub(hostname) {
59
60
  page: {
60
61
  id: 104,
61
62
  title: "Testing",
62
- content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
63
+ content:
64
+ "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
63
65
  metadata: { header: false, footer: false },
64
66
  type: "static-page",
65
67
  "status-code": 200,
@@ -70,7 +72,8 @@ function getClientStub(hostname) {
70
72
  page: {
71
73
  id: 105,
72
74
  title: "Testing mime type",
73
- content: "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
75
+ content:
76
+ "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
74
77
  metadata: {
75
78
  header: false,
76
79
  footer: false,
@@ -101,7 +104,9 @@ function createApp(loadData, routes, opts = {}) {
101
104
  generateRoutes: () => routes,
102
105
  loadData,
103
106
  renderLayout: (res, { contentTemplate, store }) =>
104
- res.send(JSON.stringify({ contentTemplate, store: store.getState() })),
107
+ res.send(
108
+ JSON.stringify({ contentTemplate, store: store.getState() })
109
+ ),
105
110
  handleNotFound: false,
106
111
  publisherConfig: {},
107
112
  },
@@ -121,7 +126,10 @@ describe("Custom Route Handler", function () {
121
126
  supertest(app)
122
127
  .get("/moved-permanently")
123
128
  .expect("Location", "/permanent-location")
124
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
129
+ .expect(
130
+ "Cache-Control",
131
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
132
+ )
125
133
  .expect("Vary", /Accept\-Encoding/)
126
134
  .expect("Surrogate-Key", "sp/42/101")
127
135
  .expect("Cache-Tag", "sp/42/101")
@@ -136,7 +144,10 @@ describe("Custom Route Handler", function () {
136
144
  supertest(app)
137
145
  .get("/moved-temporarily")
138
146
  .expect("Location", "/temporary-location")
139
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
147
+ .expect(
148
+ "Cache-Control",
149
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
150
+ )
140
151
  .expect("Vary", /Accept\-Encoding/)
141
152
  .expect("Surrogate-Key", "sp/42/102")
142
153
  .expect("Cache-Tag", "sp/42/102")
@@ -152,7 +163,10 @@ describe("Custom Route Handler", function () {
152
163
  supertest(app)
153
164
  .get("/static-with-header-footer")
154
165
  .expect("Content-Type", /html/)
155
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
166
+ .expect(
167
+ "Cache-Control",
168
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
169
+ )
156
170
  .expect("Vary", "Accept-Encoding")
157
171
  .expect("Surrogate-Key", "sp/42/103")
158
172
  .expect("Cache-Tag", "sp/42/103")
@@ -174,13 +188,19 @@ describe("Custom Route Handler", function () {
174
188
  supertest(app)
175
189
  .get("/static-without-header-footer")
176
190
  .expect("Content-Type", /html/)
177
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
191
+ .expect(
192
+ "Cache-Control",
193
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
194
+ )
178
195
  .expect("Vary", "Accept-Encoding")
179
196
  .expect("Surrogate-Key", "sp/42/104")
180
197
  .expect("Cache-Tag", "sp/42/104")
181
198
  .expect(200)
182
199
  .then((res) => {
183
- assert.equal("<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>", res.text);
200
+ assert.equal(
201
+ "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>",
202
+ res.text
203
+ );
184
204
  })
185
205
  .then(done);
186
206
  });
@@ -213,7 +233,9 @@ describe("Custom Route Handler", function () {
213
233
  it("Store reads config and data from data-loader response", function (done) {
214
234
  const app = createApp(
215
235
  (pageType, params, config, client, { host, next }) =>
216
- pageType === "custom-static-page" ? Promise.resolve({ data: { navigationMenu: [] }, config: {} }) : next(),
236
+ pageType === "custom-static-page"
237
+ ? Promise.resolve({ data: { navigationMenu: [] }, config: {} })
238
+ : next(),
217
239
  [{ pageType: "story-page", path: "/*" }]
218
240
  );
219
241
  supertest(app)
@@ -236,7 +258,10 @@ describe("Custom Route Handler", function () {
236
258
  supertest(app)
237
259
  .get("/moved-absolute")
238
260
  .expect("Location", "https://www.google.com")
239
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
261
+ .expect(
262
+ "Cache-Control",
263
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
264
+ )
240
265
  .expect("Vary", /Accept\-Encoding/)
241
266
  .expect("Surrogate-Key", "sp/42/105")
242
267
  .expect("Cache-Tag", "sp/42/105")
@@ -250,7 +275,10 @@ describe("Custom Route Handler", function () {
250
275
  );
251
276
  supertest(app)
252
277
  .get("/static-with-mime-type")
253
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
278
+ .expect(
279
+ "Cache-Control",
280
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
281
+ )
254
282
  .expect("Vary", /Accept\-Encoding/)
255
283
  .expect("Surrogate-Key", "sp/42/105")
256
284
  .expect("Cache-Tag", "sp/42/105")
@@ -265,7 +293,10 @@ describe("Custom Route Handler", function () {
265
293
  );
266
294
  supertest(app)
267
295
  .get("/static-without-header-footer")
268
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
296
+ .expect(
297
+ "Cache-Control",
298
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
299
+ )
269
300
  .expect("Vary", "Accept-Encoding")
270
301
  .expect("Surrogate-Key", "sp/42/104")
271
302
  .expect("Cache-Tag", "sp/42/104")
@@ -168,7 +168,17 @@ describe("Isomorphic Handler", function () {
168
168
  }),
169
169
  }
170
170
  );
171
- supertest(app).get("/").expect(500, done);
171
+
172
+ supertest(app)
173
+ .get("/")
174
+ .expect("Content-Type", /html/)
175
+ .expect(500)
176
+ .then((res) => {
177
+ const response = JSON.parse(res.text);
178
+ assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
179
+ assert.equal(true, response.store.qt.disableIsomorphicComponent);
180
+ })
181
+ .then(done, done);
172
182
  });
173
183
 
174
184
  it("Throws a 500 if loadData and loadErrorData both crash", function (done) {
@@ -184,7 +194,7 @@ describe("Isomorphic Handler", function () {
184
194
  }
185
195
  );
186
196
 
187
- supertest(app).get("/").expect(500, done);
197
+ supertest(app).get("/").expect("Content-Type", /html/).expect(500, done);
188
198
  });
189
199
 
190
200
  it("Cache headers are set", function (done) {
@@ -508,7 +508,10 @@ describe("Redirect Routes Handler", function () {
508
508
  redirectUrls,
509
509
  }
510
510
  );
511
- supertest(app).get("/moved-permanently-1").expect("Location", "/permanent-location-1").expect(301, done);
511
+ supertest(app)
512
+ .get("/moved-permanently-1")
513
+ .expect("Location", "/permanent-location-1")
514
+ .expect(301, done);
512
515
  });
513
516
 
514
517
  it("Redirects all the urls with status code to 302 if redirectUrls is present", function (done) {
@@ -525,7 +528,10 @@ describe("Redirect Routes Handler", function () {
525
528
  ],
526
529
  }
527
530
  );
528
- supertest(app).get("/moved-temporarily-1").expect("Location", "/temporarily-location-1").expect(302, done);
531
+ supertest(app)
532
+ .get("/moved-temporarily-1")
533
+ .expect("Location", "/temporarily-location-1")
534
+ .expect(302, done);
529
535
  });
530
536
 
531
537
  it("Renders homepage when redirect urls are present", function (done) {
@@ -549,7 +555,10 @@ describe("Redirect Routes Handler", function () {
549
555
  .expect(200)
550
556
  .then((res) => {
551
557
  const response = JSON.parse(res.text);
552
- assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
558
+ assert.equal(
559
+ '<div data-page-type="home-page">foobar</div>',
560
+ response.content
561
+ );
553
562
  assert.equal("foobar", response.store.qt.data.text);
554
563
  assert.equal("127.0.0.1", response.store.qt.data.host);
555
564
  assert.equal("home-page", response.store.qt.pageType);
@@ -563,7 +572,10 @@ describe("Redirect Routes Handler", function () {
563
572
  [{ pageType: "story-page", path: "/*" }],
564
573
  { redirectUrls: getRedirectUrl }
565
574
  );
566
- supertest(app).get("/moved-permanently-1").expect("Location", "/permanent-location-1").expect(301, done);
575
+ supertest(app)
576
+ .get("/moved-permanently-1")
577
+ .expect("Location", "/permanent-location-1")
578
+ .expect(301, done);
567
579
  });
568
580
 
569
581
  it("Should handle Route Parameters redirects properly", function (done) {
@@ -572,7 +584,10 @@ describe("Redirect Routes Handler", function () {
572
584
  [{ pageType: "story-page", path: "/*" }],
573
585
  { redirectUrls: getRedirectUrl }
574
586
  );
575
- supertest(app).get("/india/news/some-slug").expect("Location", "/india/some-slug").expect(301, done);
587
+ supertest(app)
588
+ .get("/india/news/some-slug")
589
+ .expect("Location", "/india/some-slug")
590
+ .expect(301, done);
576
591
  });
577
592
 
578
593
  it("Should handle multiple Route Parameters redirects properly", function (done) {
@@ -581,7 +596,10 @@ describe("Redirect Routes Handler", function () {
581
596
  [{ pageType: "story-page", path: "/*" }],
582
597
  { redirectUrls: getRedirectUrl }
583
598
  );
584
- supertest(app).get("/india/foo/some-slug/slug").expect("Location", "/india/some-slug").expect(302, done);
599
+ supertest(app)
600
+ .get("/india/foo/some-slug/slug")
601
+ .expect("Location", "/india/some-slug")
602
+ .expect(302, done);
585
603
  });
586
604
 
587
605
  it("Should handle interchanging route parameter redirects properly", function (done) {
@@ -590,7 +608,10 @@ describe("Redirect Routes Handler", function () {
590
608
  [{ pageType: "story-page", path: "/*" }],
591
609
  { redirectUrls: getRedirectUrl }
592
610
  );
593
- supertest(app).get("/foo/something/bar").expect("Location", "/bar/something/foo").expect(301, done);
611
+ supertest(app)
612
+ .get("/foo/something/bar")
613
+ .expect("Location", "/bar/something/foo")
614
+ .expect(301, done);
594
615
  });
595
616
 
596
617
  it("Should handle external redirects", function (done) {
@@ -599,7 +620,10 @@ describe("Redirect Routes Handler", function () {
599
620
  [{ pageType: "story-page", path: "/*" }],
600
621
  { redirectUrls: getRedirectUrl }
601
622
  );
602
- supertest(app).get("/something/new").expect("Location", "https://www.google.com/something").expect(301, done);
623
+ supertest(app)
624
+ .get("/something/new")
625
+ .expect("Location", "https://www.google.com/something")
626
+ .expect(301, done);
603
627
  });
604
628
 
605
629
  it("Should handle external redirects with params", function (done) {
@@ -608,7 +632,10 @@ describe("Redirect Routes Handler", function () {
608
632
  [{ pageType: "story-page", path: "/*" }],
609
633
  { redirectUrls: getRedirectUrl }
610
634
  );
611
- supertest(app).get("/something/new1").expect("Location", "https://www.google.com/new1").expect(301, done);
635
+ supertest(app)
636
+ .get("/something/new1")
637
+ .expect("Location", "https://www.google.com/new1")
638
+ .expect(301, done);
612
639
  });
613
640
 
614
641
  it("Should not crash if redirectUrls is not present", function (done) {
@@ -619,7 +646,10 @@ describe("Redirect Routes Handler", function () {
619
646
  supertest(app)
620
647
  .get("/moved-temporarily-1")
621
648
  .expect("Location", "/temporarily-location-1")
622
- .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
649
+ .expect(
650
+ "Cache-Control",
651
+ "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
652
+ )
623
653
  .expect("Vary", /Accept\-Encoding/)
624
654
  .expect("Surrogate-Key", "sp/42/102")
625
655
  .expect("Cache-Tag", "sp/42/102")