@quintype/framework 7.0.3 → 7.1.1-socket-timeout.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,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.1.0](https://github.com/quintype/quintype-node-framework/compare/v7.0.3...v7.1.0) (2022-02-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * **Custom Layout:** support custom storylimit and custom nestedCollectionLimit ([#288](https://github.com/quintype/quintype-node-framework/issues/288)) ([1e3e8ae](https://github.com/quintype/quintype-node-framework/commit/1e3e8ae7c7da2e336260911cf41f56c5419e9480))
11
+
5
12
  ### [7.0.3](https://github.com/quintype/quintype-node-framework/compare/v7.0.2...v7.0.3) (2022-02-01)
6
13
 
7
14
  ### [7.0.2](https://github.com/quintype/quintype-node-framework/compare/v7.0.1...v7.0.2) (2022-01-05)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.0.3",
3
+ "version": "7.1.1-socket-timeout.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@ampproject/toolbox-optimizer": "2.8.3",
30
30
  "@quintype/amp": "^2.4.19",
31
- "@quintype/backend": "^2.1.0",
31
+ "@quintype/backend": "^2.2.1-socket-timeout.0",
32
32
  "@quintype/components": "^3.0.0",
33
33
  "@quintype/prerender-node": "^3.2.24",
34
34
  "@quintype/seo": "^1.38.1",
@@ -19,13 +19,21 @@ exports.homeCollectionOrStories = function homeCollectionOrStories(
19
19
  depth = 1,
20
20
  getStoryLimits,
21
21
  params = {},
22
- collectionOfCollectionsIndexes = []
22
+ collectionOfCollectionsIndexes = [],
23
+ customLayouts = [],
24
+ defaultNestedLimit = null
23
25
  ) {
24
26
  return Collection.getCollectionBySlug(
25
27
  client,
26
28
  "home",
27
29
  { "item-type": "collection", ...params },
28
- { depth, ...(getStoryLimits && { storyLimits: getStoryLimits() }), collectionOfCollectionsIndexes }
30
+ {
31
+ depth,
32
+ ...(getStoryLimits && { storyLimits: getStoryLimits() }),
33
+ collectionOfCollectionsIndexes,
34
+ customLayouts,
35
+ defaultNestedLimit,
36
+ }
29
37
  ).then((collection) => {
30
38
  if (collection) return collection;
31
39
  return Story.getStories(client).then((stories) =>
@@ -26,7 +26,7 @@ function loadDataForIsomorphicRoute(
26
26
  loadErrorData,
27
27
  url,
28
28
  routes,
29
- { otherParams, config, client, host, logError, domainSlug, redirectToLowercaseSlugs, cookies }
29
+ { otherParams, config, client, host, logError, domainSlug, redirectToLowercaseSlugs, cookies, mobileApiEnabled }
30
30
  ) {
31
31
  return loadDataForEachRoute().catch((error) => {
32
32
  logError(error);
@@ -61,6 +61,7 @@ function loadDataForIsomorphicRoute(
61
61
  next: abortHandler,
62
62
  domainSlug,
63
63
  cookies,
64
+ mobileApiEnabled,
64
65
  });
65
66
 
66
67
  if (result && result[ABORT_HANDLER]) continue;
@@ -253,6 +254,7 @@ exports.handleIsomorphicDataLoad = function handleIsomorphicDataLoad(
253
254
  logError,
254
255
  host: req.hostname,
255
256
  domainSlug,
257
+ mobileApiEnabled,
256
258
  }).then((result) => Object.assign({ pageType, disableIsomorphicComponent: true }, result));
257
259
  }
258
260
  }
@@ -275,6 +277,7 @@ exports.handleIsomorphicDataLoad = function handleIsomorphicDataLoad(
275
277
  domainSlug,
276
278
  redirectToLowercaseSlugs,
277
279
  cookies: req.cookies,
280
+ mobileApiEnabled,
278
281
  }).catch((e) => {
279
282
  logError(e);
280
283
  return { httpStatusCode: 500, pageType: "error" };
package/server/start.js CHANGED
@@ -16,6 +16,7 @@ const process = require("process");
16
16
  const { initializeAllClients } = require("./api-client");
17
17
  const logger = require("./logger");
18
18
  const logSuccess = chalk.bold.cyanBright;
19
+ const http = require('http');
19
20
 
20
21
  function startMaster({ workers = 4 }) {
21
22
  let terminating = false;
@@ -73,12 +74,19 @@ async function startWorker(appThunk, opts) {
73
74
  const app = appThunk();
74
75
 
75
76
  await initializeAllClients();
76
- const server = app.listen(opts.port || 3000, () => {
77
+ const server = http.createServer(app).listen(opts.port || 3000, () => {
77
78
  console.log(logSuccess(`||=============================||`));
78
- console.log(logSuccess(`|| App listening on port ${opts.port || 3000}! ||`))
79
+ console.log(logSuccess(`|| App listening on port ${opts.port || 3000}! ||`));
79
80
  console.log(logSuccess(`||=============================||`));
80
81
  });
81
82
 
83
+ server.setTimeout(900,()=>{
84
+ console.log("Socket is destroyed due to timeout");
85
+ server.close(()=>{
86
+ console.log("Server is closed");
87
+ })
88
+ })
89
+
82
90
  process.on("SIGTERM", () => {
83
91
  server.close(() => {
84
92
  cluster.worker.disconnect();