ProtectedsourceIDProtectedsourceURLThe most canonical URL for the source
ProtectedsupportedArray of 'thing' properties this adapter supports (e.g., 'label', 'description')
ProtectedsupportedRegular expression which determines whether this adapter supports a given URL
ProtectedthrottleMinimum milliseconds to wait between requests to this adapter's API. Set to 0 to disable throttling.
Protected_lookupInternal lookup implementation to be provided by each adapter. Do not call directly - use lookup() which handles throttling.
All text strings returned in AdapterMultilingualString objects MUST be in "HTML-safe text" format:
& → &, < → <)For text from external APIs, use this three-step sanitization:
import { decodeHTML } from 'entities';
import escapeHTML from 'escape-html';
import stripTags from 'striptags';
const safeText = escapeHTML(stripTags(decodeHTML(externalValue)));
This pattern:
Not all adapters need all three steps - adjust based on the format your
external API returns. If it already returns plain text with no entities
or tags, only escapeHTML() may be needed.
Does this adapter support a given URL?
Convert a Wikidata string object to a lib.reviews multilingual string. They are similar, but language codes differ, and Wikidata nests one level deeper in order to sometimes convey that a string represents a fallback for another language.
Wikidata strings may also contain unescaped special characters, while ml-strings may not, and we impose a maximum length if provided (applied to the escaped length).
OptionalmaxLength: numberReturn array of the codes we can handle
Return codes in list format expected by API
Return the native code for a Wikidata language code. Returns null if not a valid native language.
Return the Wikimedia code for a lib.reviews language code
Perform a lookup for a given URL with automatic throttling. Waits if necessary to respect the adapter's throttleMs setting. Ensures requests are serialized per adapter instance, even with concurrent callers. Implementations should override _lookup() instead of this method.
A short lower-case string, e.g., 'wikidata'