Class: BaseJsonlService

(abstract) core/base-service/base-jsonl~BaseJsonlService()

Services which query a JSONL endpoint should extend BaseJsonlService

Constructor

(abstract) new BaseJsonlService()

Source:

Methods

_parseJsonl(buffer) → {Array.<object>}

Parse data from a JSONL endpoint

Parameters:
Name Type Description
buffer string

JSONL response from upstream API

Source:
Returns:

Parsed response

Type
Array.<object>

(async) _requestJsonl(attrs) → {Array.<object>}

Request data from an upstream API serving JSONL, parse it line-by-line and validate each entry against a schema

Parameters:
Name Type Description
attrs object

Refer to individual attrs

Properties
Name Type Attributes Default Description
schema Joi

Joi schema to validate each response line against

url string

URL to request

options object <optional>
{}

Options to pass to got. See documentation

httpErrors object <optional>
{}

Key-value map of status codes and custom error messages e.g: { 404: 'package not found' }. This can be used to extend or override the default

systemErrors object <optional>
{}

Key-value map of got network exception codes and an object of params to pass when we construct an Inaccessible exception object e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. See got error codes for allowed keys and module:core/base-service/errors~RuntimeErrorProps for allowed values

logErrors Array.<number> <optional>
[429]

An array of http error codes that will be logged (to sentry, if configured).

prettyErrorMessage string <optional>
'invalid response data'

Error message to surface when schema validation fails.

Source:
See:
Returns:

Parsed response

Type
Array.<object>