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 :: 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 :: VersionWriter st -> Limits -> PackageName -> PackedRead -> NpmFieldOf VersionValue -> (Either LimitError PackedRead -> ST st r) -> ST st r Source #

Project direct facts for kept releases. Invalid facts use the diagnostic decoder.

retainedEntries :: PackedRead -> RetainedEntries Source #

The releases, timestamps and tags the packed read holds while it reads.

keptEntries :: PackedRead -> RetainedEntries Source #

The entries the finished read keeps: its releases, its tags, the bookkeeping times it serves, and its reported timestamp drops.

finishPacked :: 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.