Module: middleware-common

Members

(static, constant) createPaginationTemplateParams

Potentially Updates req with pagination

Source:

(static, constant) expectationFetcher

Source:

(static, constant) expectations

The name field is used in queries.

Source:

(static, constant) fetchDatasetPlatformInfo

Emulate fetchDatasetInfo but from Platform API and with more detail such as typology

Source:

(static, constant) fetchEntitiesPlatformDb

Middleware. Updates req with 'entities' same as fetchEntities so not to be used together!

Fetches entities from the Platform API (mainWebsiteUrl) instead of Datasette. Uses REST API with query parameters instead of SQL, made in line with fetch spec pattern to allow easy swapping.

Source:

(static, constant) fetchLatestResource

Middleware. Updates req with resource.

Source:

(static, constant) getSetDataRange

Source:

(static, constant) isResourceIdValid

Was the resource accessed successfully via HTTP?

Source:

(static, constant) logPageError

Middleware. Set req.handlerName to a string that will identify the function that threw the error.

Source:

(static, constant) prepareAuthority

Middleware to determine authority level based on entity quality Queries the Platform API twice: first for 'authoritative' quality, then for 'some' quality if needed, only needs 1 result

Source:

(static, constant) preventIndexing

Middleware. Prevents indexing of certain pages

Source:

(static, constant) setAvailableDatasets

Provides the list of available/supported datasets.

Source:

Methods

(static) noop(req, res, next)

Middleware.

Parameters:
Name Type Description
req *

request object

res *

response object

next *

next function

Source:

(static) validateQueryParamsFn(req, res, next)

Middleware. Validates query params according to schema. Short circuits with 400 error if validation fails. Potentially updates req with parsedParams

this needs: { schema }

Parameters:
Name Type Description
req *
res *
next *
Source:

(inner) processEntitiesMiddleware()

Middleware chain to process entities and prepare them for the issue table

Source:

(inner) processSpecificationMiddleware()

Middleware chain to process the dataset specification and prepare it for the issue table, conditional execution on whether a specification exists

Source: