ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Package.Filter.Internal

Description

The location check behind Ecluse.Core.Package.Filter, and the drop records of its refusals. The check reads a URL's text: a safe filename, the https normalisation, and an authority the document's upstream honours, in that order, so the first failing test decides the recorded reason. Importing this module opts out of the public surface's stability promises. It exists so a spec can hold the check to a per-artifact reference.

Synopsis

A document's origin

data ArtifactOrigin Source #

The inputs every artifact of one document is checked against, derived once from its upstream.

Constructors

ArtifactOrigin 

Fields

artifactOrigin :: AllowedHostPorts -> Text -> ArtifactOrigin Source #

Derive a document's ArtifactOrigin from its ecosystem's artifact hosts and upstream base URL.

Checking a URL

data ArtifactLocation Source #

A URL that passed the check, with what its text says about the file it names.

Constructors

ArtifactLocation 

Fields

data LocationRefusal Source #

Why a URL failed the check: the failing test's reason, and the text that test read.

data AuthorityVerdict Source #

The last authority the check decided, with its verdict. It holds only for the ArtifactOrigin that decided it.

noAuthorityVerdict :: AuthorityVerdict Source #

The verdict a document's first URL starts from.

locateArtifact :: ArtifactOrigin -> AuthorityVerdict -> Text -> (AuthorityVerdict, Either LocationRefusal ArtifactLocation) Source #

Check a URL's filename, its https normalisation, then its authority, reusing the previous verdict for the same authority text. A non-https (loopback) upstream skips normalisation, not the authority check the download gate also applies.

checkArtifactAddress :: ArtifactOrigin -> Text -> Either LocationRefusal Text Source #

Check scheme and authority after a native protocol binds its own typed artifact coordinate.

Checking an artifact

data ArtifactRefusal Source #

Why one artifact was refused, for the drop record that reports it.

Constructors

ArtifactRefusal 

Fields

resolveArtifact :: ArtifactOrigin -> AuthorityVerdict -> Artifact -> (AuthorityVerdict, Either ArtifactRefusal Artifact) Source #

locateArtifact for a typed artifact, which stays as written unless normalising changed its URL.

Recording refusals

partitionArtifacts :: Text -> [Either ArtifactRefusal artifact] -> (Maybe (NonEmpty artifact), [InvalidEntry]) Source #

Split one version's checked artifacts, in file order, into its survivors and its drop records. A refused file records under its own name. A version left with none records its first refusal, under its key.