Skip to main content

createCitationEmitter

@retinue/monorepo


@retinue/monorepo / backend/src / createCitationEmitter

Function: createCitationEmitter()

createCitationEmitter(deps): object

Defined in: backend/src/citations/index.ts:138

Parameters​

deps​

CitationEmitterDeps

Returns​

emit()​

emit(context, candidates): Promise<EmittedCitations>

Turn candidates into parts, dropping any the reader may not open.

Checked here and not only at retrieval, because the two are different moments. A permission revoked in between is exactly the case the test steps name, and a citation emitted on a retrieval-time check would survive it.

Parameters​

context​

ExecutionContext

candidates​

readonly CitationCandidate[]

Returns​

Promise<EmittedCitations>

mayCite()​

mayCite(context, candidate): Promise<boolean>

Whether this reader may be shown this citation.

A web citation needs no check: its URL is public by construction, and asking a policy about it would be asking about a resource the policy has never heard of — which most policies answer by denying, silently suppressing every web citation.

Parameters​

context​

ExecutionContext

candidate​

CitationCandidate

Returns​

Promise<boolean>