@quintype/framework 7.19.11 → 7.19.12-brightcove.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.
Files changed (2) hide show
  1. package/foo +430 -0
  2. package/package.json +2 -2
package/foo ADDED
@@ -0,0 +1,430 @@
1
+
2
+ > @quintype/framework@7.19.11 test
3
+ > NODE_ENV=test npx mocha --recursive --require ./test/babel
4
+
5
+
6
+ 1) Uncaught error outside test suite
7
+
8
+ 0 passing (16ms)
9
+ 1 failing
10
+
11
+ 1) Uncaught error outside test suite:
12
+ Uncaught Error: listen EADDRINUSE: address already in use :::4000
13
+ at Server.setupListenHandle [as _listen2] (node:net:1330:16)
14
+ at listenInCluster (node:net:1378:12)
15
+ at Server.listen (node:net:1465:7)
16
+ at Function.listen (node_modules/express/lib/application.js:635:24)
17
+ at Suite.<anonymous> (test/integration/isomorphic-handler-test.js:263:30)
18
+ at Suite.<anonymous> (test/integration/isomorphic-handler-test.js:261:3)
19
+ at Object.<anonymous> (test/integration/isomorphic-handler-test.js:53:1)
20
+ at Module._compile (node:internal/modules/cjs/loader:1103:14)
21
+ at loader (node_modules/babel-register/lib/node.js:144:5)
22
+ at Object.require.extensions.<computed> [as .js] (node_modules/babel-register/lib/node.js:154:7)
23
+ at Module.load (node:internal/modules/cjs/loader:981:32)
24
+ at Function.Module._load (node:internal/modules/cjs/loader:822:12)
25
+ at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
26
+ at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
27
+ at async Promise.all (index 0)
28
+ at ESMLoader.import (node:internal/modules/esm/loader:337:24)
29
+ at importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
30
+
31
+
32
+
33
+
34
+
35
+ ampStoryPageHandler integration tests
36
+ ✔ mounts an amp story page (78ms)
37
+ ✔ passes on errors to express error handler
38
+ ✔ should redirect to non-amp page if enableAmp is false
39
+ ✔ Redirects the urls with status code to 302 if redirectUrls is present
40
+ ✔ should redirect to non-amp page if story contains unsuported elements and invalid-elements-strategy in /api/v1/amp/config is set to redirect-to-web-version
41
+ ✔ should show amp page if story contains unsuported elements but invalid-elements-strategy in /api/v1/amp/config is set to any value other than redirect-to-web-version
42
+
43
+ Amp infinite scroll handler
44
+ ✔ Should return a 200 if request is same origin
45
+ ✔ Should return a 200 if origin is google/bing CDN
46
+ ✔ Should return a 200 if origin is subdomain
47
+ ✔ Should return a 200 if origin is CDN of subdomain
48
+ ✔ Should return a 401 if not same origin or origin is not in whitelist
49
+ ✔ returns infinite scroll json config from story 5 onwards
50
+ ✔ removes current story from infinite scroll json config
51
+
52
+ AssetLink Handler
53
+ ✔ returns a manifest
54
+
55
+ configWrapper
56
+ ✔ if passed extends the existing config with it being asynchronous in nature
57
+
58
+ configWrapper
59
+ ✔ if passed extends the existing config with it being synchronous in nature
60
+
61
+ configWrapper
62
+ ✔ if not passed returns the existing config
63
+
64
+ createApp
65
+ ✔ correctly gzips content
66
+ ✔ returns static files
67
+ ✔ static files that are assets have a long cache header
68
+
69
+ proxyGetHandler
70
+ ✔ can proxy a request to a handler which returs some data
71
+ ✔ returns a 503 if there is no data
72
+ proxying to another host
73
+ ✔ forwards the call upstream
74
+
75
+ Custom Route Handler
76
+ ✔ Redirects with status code 301 if API has 301 redirection setup
77
+ ✔ Redirects with status code 302 if API has 302 redirection setup
78
+ ✔ Renders the page in the normal flow if it's a static page and either header or footer is enabled
79
+ ✔ Renders the page by sending the content if it's a static page with disabled header and footer
80
+ ✔ Returns 404 if the route doesn't exist
81
+ ✔ DisableIsomorphicComponent is set to true
82
+ ✔ Store reads config and data from data-loader response
83
+ ✔ Redirects to an absolute route, even if sketches gives a junk response
84
+ ✔ Adds content type as per metadata in response
85
+ ✔ Adds content type default if metadata in response is not set
86
+
87
+ Isomorphic Data Load
88
+ ✔ returns data given by the load data function
89
+ ✔ passes url parameters to the load data function
90
+ ✔ loads data for the homepage if no path is passed in
91
+ ✔ returns an appVersion on every response
92
+ ✔ return the title of the page
93
+ ✔ passes any params to the loadData function
94
+ ✔ passes back caching headers
95
+ aborting the data loader
96
+ ✔ returns a 200 with a not-found if the load data decides to abort
97
+ ✔ returns a 200 with a not-found if the load data decides to abort
98
+ status codes
99
+ ✔ any status code more than 500 becomes an http 500
100
+ ✔ any status code less than 500 becomes an http 200
101
+ Multi Domain Support
102
+ ✔ passes the domain slug to the load data function, and returns currentHostUrl in response
103
+ ✔ passes undefined if domain mapping is not present, and returns currentHostUrl in response
104
+ ✔ passes null if the domain is the default domain (or not present in the map), and returns currentHostUrl in response
105
+ ✔ passes the domainSlug to generateSlug
106
+ ✔ strips the mount point
107
+ failure scenarios
108
+ ✔ returns 404 if the path is not matched
109
+ ✔ returns 404 if generate routes throws an exception
110
+ ✔ return 500 if loadData and loadErrorData both throw exceptions
111
+ ✔ loads error data if loadData throws an exceptions
112
+ ✔ has a default loadErrorData
113
+ Mobile Data
114
+ ✔ loads only config needed for mobile when mobileApiEnabled flag and the mobileConfigFields is passed
115
+ ✔ loads all the config fields if the list of mobile config fields is empty
116
+ ✔ third level of data remain as original
117
+ ✔ loads only data listed in the whitelisted keys
118
+ ✔ does not filter data if no whitelist is passed
119
+
120
+ Isomorphic Handler
121
+ ✔ Renders the page if the route matches
122
+ ✔ Accepts an async pickComponent function
123
+ ✔ Passes all URL parameters to the load data function
124
+ ✔ Throws a 404 if the route is not matched
125
+ ✔ Throws a 500 if loadData doesn't work
126
+ ✔ Throws a 500 if loadData and loadErrorData both crash
127
+ ✔ Cache headers are set
128
+ ✔ it redirects on a 301
129
+ ✔ returns a 500 if render layout crashes
130
+ ✔ Passes the primaryHostUrl and currentHostUrl to the render
131
+ preloading
132
+ ✔ preloads the app.js
133
+ Prerender server
134
+ ✔ Should run prerender servre if i pass any other server top of it
135
+ aborting the data loader
136
+ ✔ Throws a 404 if load data decides not to handle the request
137
+ ✔ Allows bypassing even data.abort is set
138
+ ✔ Allows you to chain one loader to the next if two routes overlap
139
+ lightPages
140
+ ✔ renders amp story pages
141
+ ✔ renders amp story pages when lightPages is passed as a function which return true
142
+ ✔ renders a normal story page when lightPages is passed as a function which return false
143
+ ✔ renders amp story pages using non-encode slug when lightPages is passed as a function which return true and shouldEncodeAmpUri is false
144
+ cdnProvider
145
+ ✔ Returns the right cloudflare headers for cache keys passed and no cdn provider passed
146
+ ✔ Returns the right cloudflare headers for no cacheKeys and no cdnProvider passed
147
+ ✔ Returns the right headers when there is cachekeys is set to DO_NOT_CACHE
148
+ ✔ Returns the right akamai headers when cachekeys are not passed
149
+ ✔ Returns the right akamai headers when right cachekeys are passed
150
+ ✔ Returns the right cache headers when cdnProvider is of type function
151
+ ✔ Override the s-maxage cache headers when sMaxAge value present
152
+ ✔ Fallback the value of s-maxage to 900 second if when sMaxAge value not present
153
+ redirectToLowercaseSlugs
154
+ ✔ when enabled, redirects story slug with capital letters to lowercase slug URL
155
+ ✔ when enabled, it does not redirect for story slugs containing accents or non-latin letters
156
+ ✔ when enabled, it does not redirect for section pages containing capital letters
157
+ ✔ when not enabled, story slug with capital letters gives a normal response
158
+ mountAt
159
+ ✔ Gets Pages Mounted at Some Path
160
+ ✔ returns 404 for pages outside the mount at
161
+ ✔ Gets Pages Mounted at Some Path
162
+ ✔ doesn't apply the mountpoint if the function returns undefined
163
+
164
+ ManifestHandler
165
+ ✔ returns a manifest
166
+
167
+ ServiceWorker Generator
168
+ ✔ generates the service worker correctly
169
+ ✔ skips only includes PWA routes in the route
170
+ ✔ generates the one signal handler
171
+
172
+ ShellHandler
173
+ ✔ returns the shell if the prechaching matches
174
+ ✔ returns a 503 if the precache doesn't match
175
+ ✔ returns the shell if there is no precaching
176
+ ✔ sets a header for preloading script
177
+
178
+ Sketches Proxy
179
+ forwarding requests
180
+ ✔ forwards requests to sketches
181
+ ✔ forwards custom routes to sketches
182
+ ✔ grabs the hostname from the client
183
+ ✔ does not forward unknown requests
184
+ ✔ forwards amp requests
185
+ ✔ gets favicon
186
+ ✔ allows mounting at a different path
187
+ Override the s-maxage cache header
188
+ ✔ Override the s-maxage cache header when sMaxAge value is present (463ms)
189
+ ✔ Does not override the s-maxage cache header if cacheability is Private
190
+ ✔ Does not override the s-maxage cache header for Breaking News (395ms)
191
+ ✔ if sMaxAge value is not present, do not override cache headers (48ms)
192
+ sitemap requests
193
+ ✔ forwards requests to test new_sitemap/today.xml should not throw error if isSitemapUrlEnabled is enabled
194
+ ✔ forwards requests to test news_sitemap.xml should not throw error if isSitemapUrlEnabled is disabled
195
+ ping check
196
+ ✔ returns a successful ping if the config is loaded
197
+ ✔ fails with a 503 if the config fails
198
+ ✔ responds with a ping even if it's mounted somewhere
199
+
200
+ Static Routes
201
+ route-data.json
202
+ ✔ Loads the data for the static route
203
+ ✔ defaults the pageType to static-page
204
+ ✔ disableIsomorphicComponent is always set to true
205
+ isomorphic handler
206
+ ✔ It renders a static page
207
+ ✔ defaults the pagetype to static page
208
+ ✔ can also set disableIsomorphicComponent to false
209
+
210
+ Redirect Handler
211
+ ✔ Redirects to a story on the root level
212
+ ✔ Redirects to a story on the root level even if there is a trailing /
213
+ ✔ Does not redirect if story is not found
214
+
215
+ TemplateOptionsHandler
216
+ ✔ returns the template options
217
+ ✔ does template options when passed in a function
218
+
219
+ Redirect Routes Handler
220
+ ✔ Redirects all the urls with status code to 301 if redirectUrls is present
221
+ ✔ Redirects all the urls with status code to 302 if redirectUrls is present
222
+ ✔ Renders homepage when redirect urls are present
223
+ ✔ Redirects all the urls with status code to 301 if redirectUrls function is present
224
+ ✔ Should handle Route Parameters redirects properly
225
+ ✔ Should handle multiple Route Parameters redirects properly
226
+ ✔ Should handle interchanging route parameter redirects properly
227
+ ✔ Should handle external redirects
228
+ ✔ Should handle external redirects with params
229
+ ✔ Should not crash if redirectUrls is not present
230
+ ✔ Returns 404 if the route doesn't exist
231
+
232
+ getDomainSpecificOpts helper function
233
+ ✔ Should return correct opts for subdomain
234
+ ✔ Should return correct opts for main domain
235
+
236
+ setCorsHeaders helper function
237
+ ✔ same-origin requests go through
238
+ ✔ sets CORS headers for requests coming from google CDN
239
+ ✔ sets CORS headers for requests coming from bing CDN
240
+ ✔ sets CORS headers for requests coming from a valid subdomain
241
+ ✔ sets a 401 on requests originating from an invalid subdomain
242
+ ✔ sets CORS headers for requests coming from a cached subdomain (Google)
243
+ ✔ sets CORS headers for requests coming from a cached subdomain (Bing)
244
+ ✔ sets a 401 on requests originating from a non-whitelisted source
245
+
246
+ ampStoryPageHandler unit tests
247
+ ✔ Should not mutate opts (102ms)
248
+ ✔ should not mutate req, res, client, config
249
+ ✔ should call the next middleware if story not found
250
+ ✔ should pass related stories to amplib if present
251
+ ✔ should not pass related stories to amplib if absent
252
+ ✔ should call seo function with pageType == 'story-page-amp' if passed from FE
253
+ ✔ should call getAdditionalConfig method if it's passed from FE; pass it on to amplib as additionalConfig
254
+ ✔ should call seo lib with appropriate timezone if timezone info is present in publisher config, pass it on to amplib
255
+ ✔ should call seo lib with null timezone if timezone info is absent in publisher config
256
+
257
+ getInitialInlineConfig method of InfiniteScrollAmp helper function
258
+ ✔ should throw err if storyId isn't passed
259
+ ✔ should return null if infinite scroll collection doesn't exist
260
+ ✔ should return null if infinite scroll collection contains no stories
261
+ ✔ should remove current story from infinite scroll
262
+ ✔ should remove visual stories from infinite scroll
263
+ ✔ should format JSON as per AMP spec
264
+ ✔ should throw err if storyId isn't passed for relatedStoriesApi
265
+ ✔ should return null if relatedStoriesApi infinite scroll collection doesn't exist
266
+ ✔ should return null if relatedStoriesApi infinite scroll collection contains no stories
267
+ ✔ should remove visual stories from relatedStoriesApi infinite scroll
268
+ ✔ relatedStoriesApi Response should be in JSON format as per AMP spec
269
+ ✔ should return null if CustomApi Stories infinite scroll collection doesn't exist
270
+ ✔ should return null if CustomApi Stories infinite scroll collection contains no stories
271
+ ✔ CustomApi Stories Response should be in JSON format as per AMP spec
272
+
273
+ getResponse method of InfiniteScrollAmp helper function
274
+ ✔ should throw an error in Collection if 'story-id' isn't passed as query param
275
+ ✔ should throw an error if Collection infinite scroll collection doesn't exist
276
+ ✔ should remove current story from Collection response
277
+ ✔ should remove visual stories from Collection response
278
+ ✔ should format Collection JSON as per AMP spec
279
+ ✔ should throw an error in relatedStoriesApi if 'story-id' isn't passed as query param
280
+ ✔ should throw an error if relatedStoriesApi scroll collection doesn't exist
281
+ ✔ should remove visual stories from relatedStoriesApi response
282
+ ✔ should format relatedStoriesApi JSON as per AMP spec
283
+ ✔ should throw an error if customApi infinite scroll collection doesn't exist
284
+ ✔ should format JSON as per AMP spec in customApi list
285
+
286
+ ApiClient
287
+ getClient
288
+ ✔ returns a cachedSecondaryClient if present
289
+ ✔ creates a temporary client if it matches a string
290
+ ✔ creates a temporary client if it matches a string with a .
291
+ ✔ creates a temporary client if host_to_api_host_is set
292
+ ✔ creates a wildcard temporary client if it matches a string
293
+ ✔ returns null if no client is found
294
+ Collection
295
+ ✔ should return collection as non-automated when automated key is not present in a collection
296
+ ✔ should return collection as non-automated when automated is false in a collection
297
+ ✔ should return collection as automated for an automated collection
298
+ ✔ should return all child collections at current level for a collection
299
+ ✔ should handle get child collections when items is missing in a collection
300
+ ✔ should return as leaf collection when it has no items and has no collection cache keys
301
+ ✔ should not be a leaf collection when collection has items or collection cache keys
302
+ ✔ should return empty array as cacheable child items when depth is less than or equal to zero for an automated collection
303
+ ✔ should return all child collections as cacheable child items when depth is undefined or greater than zero for an automated collection
304
+ ✔ should return only stories as cacheable child items when depth is less than or equal to zero for manual collection
305
+ ✔ should return all child items as cacheable child items when depth is undefined or greater than zero for an automated collection
306
+ caching
307
+ ✔ returns cache keys for the story
308
+ ✔ should return all stories and collection id as cache tags for a manual collection
309
+ ✔ should include all nested stories and collection ids as cache tags for a manual collection
310
+ ✔ should return only collection cache keys excluding story keys as cache keys for an automated collection
311
+ ✔ should include all nested collection cache keys excluding story keys as cache keys for automated collection
312
+ ✔ should return cache keys when an automated collection has a manual collection
313
+ ✔ should return cache keys when a manual collection has an automated collection under it
314
+ ✔ should include nested collection and stories cache tags only upto depth when depth is passed
315
+ ✔ should only include base collection cache keys and child items id as tags for an automated collection when depth is zero
316
+ ✔ should only include base collection cache keys, item ids at level zero for manual collection when depth is zero
317
+ ✔ should add all nested collection cache tags when depth is not passed
318
+ ✔ should add all nested collection cache tags even when leaf collection does not have much data
319
+ ✔ can also find the cache key for a sorter
320
+ Author
321
+ ✔ returns cache keys
322
+ ✔ returns cache keys as null if author is invalid
323
+ Custom urls
324
+ ✔ returns cache keys
325
+ ✔ returns cache keys as null if page is invalid
326
+
327
+ AssetHelper
328
+ assetPath
329
+ ✔ returns the asset path of known assets
330
+ ✔ returns nil for unknown assets
331
+ ✔ overwrites asset path
332
+ readAsset
333
+ ✔ can read assets from the disk
334
+ ✔ can read assets from the disk
335
+ ✔ returns undefined for any file that doesn't exist
336
+ get asset hash
337
+ ✔ returns null if the asset is not found
338
+ ✔ gets the asset hash for a particular asset
339
+ ✔ returns 1 if the asset has no hash
340
+ get all asset files
341
+ ✔ returns a set of all files
342
+ get files for a chunk
343
+ ✔ has a css-path and css-content
344
+ ✔ has js-paths with related dependencies
345
+ ✔ returns all the chunks
346
+ ✔ returns all the assets
347
+
348
+ assetify
349
+ ✔ returns the asset path
350
+
351
+ createQtStore
352
+ store
353
+ ✔ it can create a store with initial values
354
+ ✔ updates the store when a navigation event happens
355
+ Service Worker Has Updated
356
+ ✔ gets updates when the service worker is updated
357
+ ✔ can accept custom reducers too
358
+
359
+ NotFoundException
360
+ ✔ has a status of 404
361
+
362
+ generateRoutes
363
+ ✔ generates section routes correctly
364
+ ✔ generates section routes correctly with section prefix
365
+ ✔ generates section with collection slug
366
+ ✔ generates extra sub section route when secWithoutParentPrefix is true
367
+ ✔ generates extra sub section route and with section prefix when both secWithoutParentPrefix and addSectionPrefix is true
368
+ ✔ generates story routes correctly
369
+ ✔ adds routes for subsections when withoutParentSection is set
370
+ ✔ does not go into infinite loop if sections are recursive
371
+ ✔ handles missing parents correctly
372
+
373
+ MultiDomain Support
374
+ ✔ generate routes given a domainSlug
375
+ ✔ generates routes for null domain
376
+ ✔ generates story page routes given a domain Slug
377
+
378
+ generateCommonRoutes
379
+ ✔ generates section and story page routes
380
+ ✔ respects the skipPWA parameter for home, story and section pages
381
+ ✔ picks up the collection slug if there is one present in the section
382
+ ✔ only picks the sections from the correct domain
383
+ ✔ puts section urls before the story urls
384
+ ✔ removes /section from the story route
385
+ ✔ generates things correctly if the section-url is missing
386
+ ✔ generates the home page route
387
+ ✔ removes the mount point from the section path
388
+
389
+ LoadServiceWorker
390
+ registerServiceWorker
391
+ ✔ registers a service worker
392
+ ✔ does not register a service worker if enableServiceWorker is false
393
+ ✔ does not register a service worker if serviceworker is not supported
394
+ updating ServiceWorker
395
+ Updating the Service Worker
396
+ Service Worker Has Updated
397
+ ✔ updates the service worker if the page's appVersion is more than the app's version
398
+ ✔ doesn't update the service worker if the page's app version and the main app version are the same
399
+ Updating service worker due to config change
400
+ Service Worker Has Updated
401
+ ✔ updates service worker if the config timestamp is greater than the global timestamp
402
+ ✔ does not update service worker if the config timestamp is lesser than the global timestamp
403
+ ✔ does nothing if the service worker promise is null
404
+ ✔ does nothing if the service worker promise resolves to null
405
+ ✔ does nothing if the service worker promise has no update
406
+ Updating the Service Worker
407
+ Service Worker Has Updated
408
+ ✔ updates if a later page has a higher version
409
+
410
+ Logger
411
+ ✔ It should log error while sending logger.error
412
+ ✔ It should not log error while sending logger.info
413
+
414
+ OneSignal
415
+ ✔ should not break if onesignal config is not availabe in publisher config
416
+ ✔ should not render onesignal script if is_enable is set to false
417
+ ✔ should render onesignal script if is_enabled
418
+
419
+ routes
420
+ matchBestRoute
421
+ ✔ matches the home page
422
+ ✔ matches subsection-page
423
+ ✔ matches story page
424
+ ✔ matches story page with extra date info
425
+ ✔ matches route params
426
+ ✔ returns undefined if there is no match
427
+ ✔ matches even if there is no /
428
+ matchAllRoutes
429
+ ✔ matches all routes in order
430
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.19.11",
3
+ "version": "7.19.12-brightcove.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.15.2",
34
+ "@quintype/amp": "^2.15.3-brightcove.1",
35
35
  "@quintype/backend": "^2.3.3",
36
36
  "@quintype/components": "^3.3.0",
37
37
  "@quintype/prerender-node": "^3.2.26",