lookup/kinds#
Classes#
LookupError#
Defined in: editor/src/lookup/kinds.ts:86
A request a service did not answer as asked: unreachable when no
answer came, status when the answer’s HTTP status is not 2xx,
malformed when its body is not of the service’s form. The message
completes a sentence naming the system (“Wikidata could not be searched:
Extends#
Error
Constructors#
Constructor#
new LookupError(
system,code,status,message,cause?):LookupError
Defined in: editor/src/lookup/kinds.ts:91
Parameters#
system#
string
code#
status#
number | null
message#
string
cause?#
unknown
Returns#
Overrides#
Error.constructor
Properties#
code#
readonlycode:LookupErrorCode
Defined in: editor/src/lookup/kinds.ts:88
status#
readonlystatus:number|null
Defined in: editor/src/lookup/kinds.ts:89
system#
readonlysystem:string
Defined in: editor/src/lookup/kinds.ts:87
Interfaces#
Candidate#
Defined in: editor/src/lookup/kinds.ts:31
A thing a service found.
Properties#
crossReferences#
readonlycrossReferences: readonlyCrossReference[]
Defined in: editor/src/lookup/kinds.ts:41
The things it is the same as: filled by resolve, empty from search.
description#
readonlydescription:string|null
Defined in: editor/src/lookup/kinds.ts:37
image#
readonlyimage:string|null
Defined in: editor/src/lookup/kinds.ts:39
A thumbnail’s URL, for display only; never written to a manifest.
iri#
readonlyiri:string
Defined in: editor/src/lookup/kinds.ts:35
Its absolute IRI, as the system’s thing template writes it.
label#
readonlylabel:string
Defined in: editor/src/lookup/kinds.ts:36
match#
readonlymatch:boolean
Defined in: editor/src/lookup/kinds.ts:45
Whether a reconciliation service called it a match; false elsewhere.
service#
readonlyservice:string
Defined in: editor/src/lookup/kinds.ts:43
The service that answered, as a provenance entry’s service names it.
system#
readonlysystem:string
Defined in: editor/src/lookup/kinds.ts:33
The catalogue system of the thing.
CrossReference#
Defined in: editor/src/lookup/kinds.ts:23
A thing another system names that a looked-up thing is the same as.
Properties#
iri#
readonlyiri:string
Defined in: editor/src/lookup/kinds.ts:27
Its IRI, as that thing’s template writes it.
system#
readonlysystem:string
Defined in: editor/src/lookup/kinds.ts:25
The catalogue system holding the thing.
LookupContext#
Defined in: editor/src/lookup/kinds.ts:107
What every service module reads: how to fetch, in which language, from which catalogue.
Properties#
catalogue#
readonlycatalogue:Catalogue
Defined in: editor/src/lookup/kinds.ts:110
fetch#
readonlyfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: editor/src/lookup/kinds.ts:108
Call Signature#
(
input,init?):Promise<Response>
Parameters#
input#
RequestInfo | URL
init?#
RequestInit
Returns#
Promise<Response>
Call Signature#
(
input,init?):Promise<Response>
Parameters#
input#
string | Request | URL
init?#
RequestInit
Returns#
Promise<Response>
language#
readonlylanguage:string
Defined in: editor/src/lookup/kinds.ts:109
Type Aliases#
LookupErrorCode#
LookupErrorCode =
"unreachable"|"status"|"malformed"
Defined in: editor/src/lookup/kinds.ts:77
Why a request failed (see LookupError).
ValueKind#
ValueKind =
"work"|"agent"|"recording"|"release"|"class"|"any"
Defined in: editor/src/lookup/kinds.ts:10
What a value field asks for: the lookup narrows its search by it.
Variables#
GND_FILTERS#
constGND_FILTERS:Readonly<Partial<Record<ValueKind,string>>>
Defined in: editor/src/lookup/kinds.ts:63
The type filter of a GND search per kind; a kind without one is not searched.
MUSICBRAINZ_TYPES#
constMUSICBRAINZ_TYPES:Readonly<Partial<Record<ValueKind,string>>>
Defined in: editor/src/lookup/kinds.ts:69
The MusicBrainz entity type searched per kind; a kind without one is not searched.
VALUE_KINDS#
constVALUE_KINDS: readonlyValueKind[]
Defined in: editor/src/lookup/kinds.ts:13
Every value kind, in the order above.
WIKIDATA_FILTERS#
constWIKIDATA_FILTERS:Readonly<Record<ValueKind,string|null>>
Defined in: editor/src/lookup/kinds.ts:53
The statement filter of a Wikidata search per kind, null for none:
works with a composer, humans, musical groups and orchestras, recordings
with a performer, albums, and classes (items that are a subclass).
Functions#
answerOf()#
answerOf(
system,fetcher,url,init?):Promise<unknown>
Defined in: editor/src/lookup/kinds.ts:154
Fetch url for system and answer its JSON body.
A request aborted through init.signal rejects with the signal’s
reason, never with a LookupError, so a caller tells a superseded
request from a failed one.
Parameters#
system#
string
fetcher#
{(input, init?): Promise<Response>; (input, init?): Promise<Response>; }
url#
string
init?#
RequestInit = {}
Returns#
Promise<unknown>
Throws#
LookupError unreachable without an answer; status for an
answer outside 2xx, with the detail of a JSON body where it names
one; malformed for a body that is no JSON.
isObject()#
isObject(
value):value is object
Defined in: editor/src/lookup/kinds.ts:114
Whether value is a JSON object (not a list).
Parameters#
value#
unknown
Returns#
value is object
malformed()#
malformed(
system,what):LookupError
Defined in: editor/src/lookup/kinds.ts:188
The error of an answer that is not of the service’s form: “its answer is
Parameters#
system#
string
what#
string
Returns#
memberOf()#
memberOf(
value,key):unknown
Defined in: editor/src/lookup/kinds.ts:119
The member key of a JSON object, undefined for anything else.
Parameters#
value#
unknown
key#
string
Returns#
unknown
textOf()#
textOf(
value,key):string|undefined
Defined in: editor/src/lookup/kinds.ts:124
The member key of a JSON object if it is a string, else undefined.
Parameters#
value#
unknown
key#
string
Returns#
string | undefined
urlWith()#
urlWith(
base,parameters):string
Defined in: editor/src/lookup/kinds.ts:193
A URL with its query parameters in the order given.
Parameters#
base#
string
parameters#
readonly (readonly [string, string])[]
Returns#
string