ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Npm.StreamingProjection

Description

Join streamed npm versions, tags and timestamps without retaining the source document. The typed projection keeps each release's typed facts, and each read keeps the served releases in its own form: aeson's tree, or packed against the read's table.

Synopsis

Typed facts

data NpmProjection Source #

Independent source maps. Typed releases are built as each retained version finishes.

type TypedRelease = Either InvalidEntry PackageDetails Source #

A kept release's typed facts, or the entry that records why it was dropped.

emptyProjection :: NpmProjection Source #

Start one source projection. No document or input chunk is retained here.

keepsRelease :: NpmProjection -> Text -> Bool Source #

Whether a release read now under the key would be kept: the key's first in the first versions object.

collectField :: Limits -> NpmProjection -> NpmFieldOf release -> Either LimitError NpmProjection Source #

Enforce the version ceiling while receiving source fields. A release's own payload is not read here.

Reading releases as aeson's tree

data TreeRead Source #

A read that keeps each release as aeson's tree: the typed facts, and the served releases.

emptyTreeRead :: TreeRead Source #

Start a tree read.

keepsTreeRelease :: TreeRead -> Text -> Bool Source #

Whether the tree read keeps a release read now under the key.

treeStep :: Limits -> PackageName -> TreeRead -> NpmFieldOf Value -> Either LimitError TreeRead Source #

Project each kept release from its tree, and serve the tree as read.

finishTree :: Limits -> PackageName -> Text -> TreeRead -> Either MetadataError (PackageInfo, Value) Source #

Bind the reported name, and serve each kept release with the source author pointer.

Reading releases packed

data PackedRead Source #

A read that keeps each release packed against its table: the typed facts, and the served releases, latest first.

emptyPackedRead :: PackedRead Source #

Start a packed read.

keepsPackedRelease :: PackedRead -> Text -> Bool Source #

Whether the packed read keeps a release read now under the key.

packedStep :: Writer st -> Limits -> PackageName -> PackedRead -> NpmFieldOf () -> (Either LimitError PackedRead -> ST st r) -> ST st r Source #

Seal each kept release the writer finished, and project its typed facts from the members they read. A release the read does not keep is discarded.

finishPacked :: Limits -> PackageName -> Text -> DocTable -> PackedRead -> Either MetadataError (PackageInfo, PackedPackument) Source #

Bind the reported name, and serve each kept release packed over the read's sealed table.