| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data ArtifactOrigin = ArtifactOrigin {}
- artifactOrigin :: AllowedHostPorts -> Text -> ArtifactOrigin
- data ArtifactLocation = ArtifactLocation {}
- data LocationRefusal = LocationRefusal {}
- data AuthorityVerdict
- noAuthorityVerdict :: AuthorityVerdict
- locateArtifact :: ArtifactOrigin -> AuthorityVerdict -> Text -> (AuthorityVerdict, Either LocationRefusal ArtifactLocation)
- checkArtifactAddress :: ArtifactOrigin -> Text -> Either LocationRefusal Text
- data ArtifactRefusal = ArtifactRefusal {
- refusedFile :: Text
- refusedReason :: Text
- refusedUrl :: Text
- resolveArtifact :: ArtifactOrigin -> AuthorityVerdict -> Artifact -> (AuthorityVerdict, Either ArtifactRefusal Artifact)
- partitionArtifacts :: Text -> [Either ArtifactRefusal artifact] -> (Maybe (NonEmpty artifact), [InvalidEntry])
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
| |
Instances
| Show ArtifactLocation Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods showsPrec :: Int -> ArtifactLocation -> ShowS # show :: ArtifactLocation -> String # showList :: [ArtifactLocation] -> ShowS # | |
| Eq ArtifactLocation Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods (==) :: ArtifactLocation -> ArtifactLocation -> Bool # (/=) :: ArtifactLocation -> ArtifactLocation -> Bool # | |
data LocationRefusal Source #
Why a URL failed the check: the failing test's reason, and the text that test read.
Constructors
| LocationRefusal | |
Fields
| |
Instances
| Show LocationRefusal Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods showsPrec :: Int -> LocationRefusal -> ShowS # show :: LocationRefusal -> String # showList :: [LocationRefusal] -> ShowS # | |
| Eq LocationRefusal Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods (==) :: LocationRefusal -> LocationRefusal -> Bool # (/=) :: LocationRefusal -> LocationRefusal -> Bool # | |
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
| |
Instances
| Show ArtifactRefusal Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods showsPrec :: Int -> ArtifactRefusal -> ShowS # show :: ArtifactRefusal -> String # showList :: [ArtifactRefusal] -> ShowS # | |
| Eq ArtifactRefusal Source # | |
Defined in Ecluse.Core.Package.Filter.Internal Methods (==) :: ArtifactRefusal -> ArtifactRefusal -> Bool # (/=) :: ArtifactRefusal -> ArtifactRefusal -> Bool # | |
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.