@maschinenlesbar.org/marktstammdatenregister-cli
    Preparing search index...

    Class RequestEngine

    Index
    bigIntegerKeys: ReadonlySet<string>

    EngineOptions.bigIntegerKeys, copied.

    • The request URL as an error about the answer shows it (GET <this>: …): absolute, so the message names the host that gave the bad answer (it matters with a mirror's base URL), with the query, userinfo redacted, and cut at MAX_DETAIL_LENGTH characters. The client's own answer errors (a wrong shape) use it too.

      Parameters

      Returns string

    • GET a path with query params and parse the JSON reply into T. Every MaStR endpoint answers with a JSON document, so an empty body or a 204 is a MastrParseError, never a silent null. So is a number JSON.parse can't carry exactly (firstInexactNumber): out of a double's range, past 2^53 in any written form, non-zero and too small for a double, or a subnormal that would print changed — never a changed value. Every error about the answer names the request (GET <url>: …, userinfo redacted).

      The text is never changed silently: bytes that are not valid in the charset, and lone surrogates written as JSON escapes (\ud800), are replaced with U+FFFD, so the result is well-formed text (jq rejects a lone surrogate, and with it the whole output), and onWarning is told how many. One bad character never sinks a whole answer.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • Perform a GET with Accept negotiation and transient-error retries. Redirects are NOT followed — the canonical host answers directly, so a 3xx (e.g. a bad base URL bouncing to a portal page) surfaces as an error.

      The engine enforces the transport contract itself, so it holds for a custom transport too: timeoutMs (an AbortSignal deadline), maxResponseBytes (checked on the body it gets back), any byte-array body, Headers/Map/any-case headers. Whatever a transport throws becomes a MastrNetworkError, and so does a malformed response; a reset connection (isTransientNetworkError) is retried like a 503.

      Parameters

      • path: string
      • Optionalquery: QueryParams
      • accept: string = "application/json"

      Returns Promise<RawResponse>

    • text without the base URL's credentials: server text (an error body that echoes the request URL, the Authorization header or the decoded user:password) and transport text (fetch's "Failed to fetch ") can carry them. The client runs it on the Errors envelopes it turns into errors.

      Parameters

      • text: string

      Returns string