ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.Npm.Filter

Description

Assemble admitted npm installation metadata from source snapshots and rebase artifact URLs.

Synopsis

URL rewriting

rewriteVersion :: (Text -> Maybe Text) -> Value -> Value Source #

Rebase dist.tarball through the given artifact URL renderer, keeping its filename. Build the renderer only from a document name that npmDocumentName admits.

Assembling the served document

assembleMergedPackument :: Text -> Map SourceId (Snapshot Value) -> MergePlan -> Value -> Value Source #

The plan supplies versions, tags and timestamps. Other top-level fields come from the base.

npmDocumentName :: KeyMap Value -> Maybe PackageName Source #

The packument's own name, safety-gated before it is interpolated into a rewritten path.

The served-document boundary (npm's CachedDoc capabilities)

assembleMergedDocument :: Text -> Map SourceId (Snapshot CachedDoc) -> MergePlan -> Maybe CachedDoc -> CachedDoc Source #

npm's metadataAssemble, over npm's own boundary. Packed sources and base render from their tables. Any other document goes through aeson's trees.

serialiseMergedDocument :: CachedDoc -> Either RenderRefused LByteString Source #

npm's metadataSerialise. Another ecosystem's document serialises as {}.